Commit 1224810d authored by Anna.Pavlova's avatar Anna.Pavlova Committed by Alexander.Trofimov

history

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@48825 954022d7-b5bf-4e40-9824-e11837661b57
parent 0a1a83d4
...@@ -409,6 +409,10 @@ CControlComposition.prototype = ...@@ -409,6 +409,10 @@ CControlComposition.prototype =
GetTxtPrp: function() GetTxtPrp: function()
{ {
return this.Content[this.CurPos].GetPrpSelectContent(); return this.Content[this.CurPos].GetPrpSelectContent();
},
Recalculate: function()
{
this.Content[this.CurPos].Refresh();
} }
} }
var MathControl = new CControlComposition(); var MathControl = new CControlComposition();
......
...@@ -7836,12 +7836,16 @@ CDocument.prototype = ...@@ -7836,12 +7836,16 @@ CDocument.prototype =
//** //**
OnKeyDown : function(e) OnKeyDown : function(e)
{ {
return MathControl.OnKeyDown(e); var flag = MathControl.OnKeyDown(e);
this.Document_UpdateInterfaceState();
return flag;
}, },
OnKeyPress : function(e) OnKeyPress : function(e)
{ {
return MathControl.OnKeyPress(e); var flag = MathControl.OnKeyPress(e);
this.Document_UpdateInterfaceState();
return flag;
}, },
OnMouseDown : function(e, X, Y, PageIndex) OnMouseDown : function(e, X, Y, PageIndex)
{ {
...@@ -9117,6 +9121,9 @@ CDocument.prototype = ...@@ -9117,6 +9121,9 @@ CDocument.prototype =
this.History.Undo(); this.History.Undo();
this.Recalculate( false, false, this.History.RecalculateData ); this.Recalculate( false, false, this.History.RecalculateData );
//**
MathControl.Recalculate();
//**
this.Document_UpdateSelectionState(); this.Document_UpdateSelectionState();
this.Document_UpdateInterfaceState(); this.Document_UpdateInterfaceState();
......
var historyitem_Math_AddItem = 1; // Добавляем элемент
var historyitem_Math_RemoveItem = 2; // Удаляем элемент
var StartTextElement = 0x2B1A; // Cambria Math var StartTextElement = 0x2B1A; // Cambria Math
function dist(_left, _right, _top, _bottom) function dist(_left, _right, _top, _bottom)
...@@ -392,7 +396,16 @@ CMathContent.prototype = ...@@ -392,7 +396,16 @@ CMathContent.prototype =
this.addElementToContent(symb, gps); this.addElementToContent(symb, gps);
var Pos = this.CurPos,
EndPos = this.CurPos + 1;
History.Add(this, {type: historyitem_Math_AddItem, Pos: Pos, PosEnd: EndPos});
//History.Add(this, {type: historyitem_Math_AddItem, Pos: this.CurPos, PosEnd: this.CurPos + 1});
this.rInterval.endPos++; // max количество элементов this.CurPos this.rInterval.endPos++; // max количество элементов this.CurPos
}, },
addMComponent: function(ind) addMComponent: function(ind)
{ {
...@@ -511,6 +524,8 @@ CMathContent.prototype = ...@@ -511,6 +524,8 @@ CMathContent.prototype =
}, },
createEquation: function(ind) createEquation: function(ind)
{ {
var Pos = this.CurPos;
switch(ind) switch(ind)
{ {
case 0: case 0:
...@@ -2257,6 +2272,10 @@ CMathContent.prototype = ...@@ -2257,6 +2272,10 @@ CMathContent.prototype =
break; break;
} }
var EndPos = this.CurPos;
History.Add(this, {type: historyitem_Math_AddItem, Pos: Pos, PosEnd: EndPos});
}, },
removeAreaSelect: function() removeAreaSelect: function()
{ {
...@@ -3082,7 +3101,7 @@ CMathContent.prototype = ...@@ -3082,7 +3101,7 @@ CMathContent.prototype =
{ {
bDelete: false, /* нужно ли пересчитывать позицию или нет, работает при backspace */ bDelete: false, /* нужно ли пересчитывать позицию или нет, работает при backspace */
bBeging: false, /* в начале контента или нет */ bBeging: false, /* в начале контента или нет */
bEnd: false /* в конце */ bEnd: false, /* в конце */
}; };
var CurrContent = SelectContent = null; var CurrContent = SelectContent = null;
...@@ -3147,7 +3166,7 @@ CMathContent.prototype = ...@@ -3147,7 +3166,7 @@ CMathContent.prototype =
} }
return {CurrContent : CurrContent, SelectContent: SelectContent, state: state }; return {CurrContent : CurrContent, SelectContent: SelectContent, state: state};
}, },
remove_internal: function(order) remove_internal: function(order)
...@@ -3195,15 +3214,23 @@ CMathContent.prototype = ...@@ -3195,15 +3214,23 @@ CMathContent.prototype =
end = this.CurPos + 2; end = this.CurPos + 2;
} }
var tmp = new Array(); /*var tmp = new Array();
for(var i = 0; i< start; i++) for(var i = 0; i< start; i++)
tmp.push(this.content[i]); tmp.push(this.content[i]);
for (var j = end; j < this.content.length; j++) for (var j = end; j < this.content.length; j++)
tmp.push(this.content[j]); tmp.push(this.content[j]);*/
this.content.length = 0;
this.content = tmp; //var Content_start = this.content.slice(0, start);
//var Content_end = this.content.slice(end, this.content.length);
History.Create_NewPoint();
var items = this.content.splice(start, end - start);
History.Add(this, {type: historyitem_Math_RemoveItem, Items: items, Pos: this.CurPos + 1});
//this.content = Content_start.concat(Content_end);
this.CurPos = start - 1; this.CurPos = start - 1;
this.setStart_Selection(this.CurPos); this.setStart_Selection(this.CurPos);
...@@ -3958,10 +3985,57 @@ CMathContent.prototype = ...@@ -3958,10 +3985,57 @@ CMathContent.prototype =
this.content[i].value.ResizeDirect(); this.content[i].value.ResizeDirect();
this.recalculate(); this.recalculate();
} },
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
Undo: function(Data)
{
var type = Data.type;
switch(type)
{
case historyitem_Math_AddItem:
{
var Pos = Data.Pos,
PosEnd = Data.PosEnd;
var Content_start = this.content.slice(0, Pos);
var Content_end = this.content.slice(PosEnd);
this.content = Content_start.concat(Content_end);
this.CurPos = Pos - 1;
break;
}
case historyitem_Math_RemoveItem:
{
var Pos = Data.Pos;
var Content_start = this.content.slice(0, Pos);
var Content_end = this.content.slice(Pos);
this.content = Content_start.concat(Data.Items, Content_end);
break;
}
}
},
Redo: function()
{
},
Save_Changes: function(Data, Writer)
{
},
Refresh_RecalcData: function()
{
this.RecalculateReverse();
}
} }
//todo //todo
//разобраться с gaps //разобраться с gaps
...@@ -4131,6 +4205,9 @@ CMathComposition.prototype = ...@@ -4131,6 +4205,9 @@ CMathComposition.prototype =
if( result.state.bDelete ) if( result.state.bDelete )
{ {
//History.Create_NewPoint();
//var Pos = this.SelectContent.CurPos + 1;
///History.Add(this, {type: historyitem_Math_RemoveItem, Items: result.interval, Pos: Pos});
this.CurrentContent.RecalculateReverse(); this.CurrentContent.RecalculateReverse();
this.UpdatePosition(); this.UpdatePosition();
} }
...@@ -4161,9 +4238,15 @@ CMathComposition.prototype = ...@@ -4161,9 +4238,15 @@ CMathComposition.prototype =
{ {
this.ClearSelect(); this.ClearSelect();
History.Create_NewPoint();
this.SelectContent.removeAreaSelect(); this.SelectContent.removeAreaSelect();
this.SelectContent.addLetter(code); this.SelectContent.addLetter(code);
/*var Pos = this.SelectContent.CurPos,
EndPos = this.SelectContent.CurPos + 1;
History.Add(this, {type: historyitem_Math_AddItem, Pos: Pos, PosEnd: EndPos});*/
/// ///
this.RecalculateReverse(); this.RecalculateReverse();
this.UpdatePosition(); this.UpdatePosition();
...@@ -4173,14 +4256,39 @@ CMathComposition.prototype = ...@@ -4173,14 +4256,39 @@ CMathComposition.prototype =
this.CurrentContent.update_Cursor(); this.CurrentContent.update_Cursor();
this.ShowCursor(); this.ShowCursor();
},
Undo: function(Data)
{
this.SelectContent.Undo(Data);
},
Redo: function()
{
},
Refresh_RecalcData: function()
{
this.RecalculateReverse();
this.UpdatePosition();
this.CurrentContent.update_Cursor();
this.ShowCursor();
},
Save_Changes: function(Data, Writer)
{
}, },
CreateEquation: function(indef) CreateEquation: function(indef)
{ {
this.ClearSelect(); this.ClearSelect();
History.Create_NewPoint();
this.SelectContent.removeAreaSelect(); this.SelectContent.removeAreaSelect();
this.SelectContent.createEquation(indef); this.SelectContent.createEquation(indef);
/*var Pos = this.SelectContent.CurPos - 1,
EndPos = this.SelectContent.CurPos + 1;
History.Add(this, {type: historyitem_Math_AddItem, Pos: Pos, PosEnd: EndPos});*/
/// ///
this.RecalculateReverse(); this.RecalculateReverse();
this.UpdatePosition(); this.UpdatePosition();
...@@ -4309,6 +4417,11 @@ CMathComposition.prototype = ...@@ -4309,6 +4417,11 @@ CMathComposition.prototype =
DrawSelect2: function() DrawSelect2: function()
{ {
this.SelectContent.drawSelect2(); this.SelectContent.drawSelect2();
},
Refresh: function()
{
this.RecalculateReverse();
this.UpdatePosition();
} }
} }
...@@ -5126,7 +5239,6 @@ Old_CMathComposition.prototype = ...@@ -5126,7 +5239,6 @@ Old_CMathComposition.prototype =
this.Root.draw(); this.Root.draw();
}, },
Cursor_MoveRight: function() Cursor_MoveRight: function()
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment