Commit 900616c9 authored by Anna.Pavlova's avatar Anna.Pavlova

undo / redo

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@48978 954022d7-b5bf-4e40-9824-e11837661b57
parent dac0f705
...@@ -421,6 +421,10 @@ CControlComposition.prototype = ...@@ -421,6 +421,10 @@ CControlComposition.prototype =
Get_SelectionState: function() Get_SelectionState: function()
{ {
return this.Content[this.CurPos].Get_SelectionState(); return this.Content[this.CurPos].Get_SelectionState();
},
UpdateCursor: function()
{
this.Content[this.CurPos].UpdateCursor();
} }
} }
var MathControl = new CControlComposition(); var MathControl = new CControlComposition();
......
...@@ -994,7 +994,10 @@ CDocument.prototype = ...@@ -994,7 +994,10 @@ CDocument.prototype =
if ( true === this.NeedUpdateTarget && true === bFlag && false === this.Selection_Is_TableBorderMove() ) if ( true === this.NeedUpdateTarget && true === bFlag && false === this.Selection_Is_TableBorderMove() )
{ {
this.Document_UpdateRulersState(); this.Document_UpdateRulersState();
this.RecalculateCurPos(); //**
MathControl.UpdateCursor();
//this.RecalculateCurPos();
//**
this.NeedUpdateTarget = false; this.NeedUpdateTarget = false;
} }
}, },
......
...@@ -2,7 +2,6 @@ var historyitem_Math_AddItem = 1; // Добавляем эл ...@@ -2,7 +2,6 @@ var historyitem_Math_AddItem = 1; // Добавляем эл
var historyitem_Math_RemoveItem = 2; // Удаляем элемент var historyitem_Math_RemoveItem = 2; // Удаляем элемент
var TEST = true; var TEST = true;
var TEST_2 = false;
var StartTextElement = 0x2B1A; // Cambria Math var StartTextElement = 0x2B1A; // Cambria Math
...@@ -281,7 +280,7 @@ CMathContent.prototype = ...@@ -281,7 +280,7 @@ CMathContent.prototype =
var items = this.content.slice(Pos, EndPos); var items = this.content.slice(Pos, EndPos);
return {Items: items}; return items;
}, },
addLetter: function(code) addLetter: function(code)
{ {
...@@ -322,7 +321,7 @@ CMathContent.prototype = ...@@ -322,7 +321,7 @@ CMathContent.prototype =
// txt properties // txt properties
this.addElementToContent(symb, gps); this.addElementToContent(symb, gps);
var item = symb; var item = this.content[this.CurPos];
if(!TEST) if(!TEST)
{ {
...@@ -336,7 +335,7 @@ CMathContent.prototype = ...@@ -336,7 +335,7 @@ CMathContent.prototype =
this.rInterval.endPos++; // max количество элементов this.CurPos this.rInterval.endPos++; // max количество элементов this.CurPos
return { Items: [item] }; return [item];
}, },
addMComponent: function(ind) addMComponent: function(ind)
{ {
...@@ -459,7 +458,7 @@ CMathContent.prototype = ...@@ -459,7 +458,7 @@ CMathContent.prototype =
}, },
createEquation: function(ind) createEquation: function(ind)
{ {
var Pos = this.CurPos; var Pos = this.CurPos + 1;
switch(ind) switch(ind)
{ {
...@@ -2208,7 +2207,7 @@ CMathContent.prototype = ...@@ -2208,7 +2207,7 @@ CMathContent.prototype =
} }
var EndPos = this.CurPos; var EndPos = this.CurPos + 1;
if(!TEST) if(!TEST)
{ {
...@@ -2219,7 +2218,7 @@ CMathContent.prototype = ...@@ -2219,7 +2218,7 @@ CMathContent.prototype =
var items = this.content.slice(Pos, EndPos); var items = this.content.slice(Pos, EndPos);
return {Items: items}; return items;
}, },
removeAreaSelect: function() removeAreaSelect: function()
{ {
...@@ -3485,7 +3484,7 @@ CMathContent.prototype = ...@@ -3485,7 +3484,7 @@ CMathContent.prototype =
}, },
Redo: function(Data) Redo: function(Data)
{ {
/*var type = Data.Type; var type = Data.Type;
switch(type) switch(type)
{ {
...@@ -3503,6 +3502,9 @@ CMathContent.prototype = ...@@ -3503,6 +3502,9 @@ CMathContent.prototype =
var Content_start = this.content.slice(0, Pos); var Content_start = this.content.slice(0, Pos);
var Content_end = this.content.slice(Pos); var Content_end = this.content.slice(Pos);
this.setStart_Selection(Pos);
this.selection.active = false;
this.content = Content_start.concat(Data.Items, Content_end); this.content = Content_start.concat(Data.Items, Content_end);
break; break;
} }
...@@ -3510,10 +3512,12 @@ CMathContent.prototype = ...@@ -3510,10 +3512,12 @@ CMathContent.prototype =
{ {
var Pos = Data.Pos, var Pos = Data.Pos,
PosEnd = Data.PosEnd; PosEnd = Pos + Data.Items.length;
var Content_start = this.content.slice(0, Pos); var Content_start = this.content.slice(0, Pos);
var Content_end = this.content.slice(PosEnd); var Content_end = this.content.slice(PosEnd);
this.setStart_Selection(Pos - 1);
this.selection.active = false;
this.content = Content_start.concat(Content_end); this.content = Content_start.concat(Content_end);
this.CurPos = Pos - 1; this.CurPos = Pos - 1;
...@@ -3522,7 +3526,7 @@ CMathContent.prototype = ...@@ -3522,7 +3526,7 @@ CMathContent.prototype =
break; break;
} }
}*/ }
}, },
Save_Changes: function(Data, Writer) Save_Changes: function(Data, Writer)
{ {
...@@ -3564,7 +3568,7 @@ CMathContent.prototype = ...@@ -3564,7 +3568,7 @@ CMathContent.prototype =
if(bCurrent) if(bCurrent)
this.CurPos = pos.X; this.CurPos = pos.X;
if(stack.length > 0 && this.content[pos.X].value.SUBCONTENT) if(stack.length > 0)
content = this.content[pos.X].value.getContent(stack, bCurrent); content = this.content[pos.X].value.getContent(stack, bCurrent);
else else
content = this; content = this;
...@@ -3762,9 +3766,6 @@ CMathComposition.prototype = ...@@ -3762,9 +3766,6 @@ CMathComposition.prototype =
}, },
Remove: function(order) Remove: function(order)
{ {
if(TEST_2)
var temp = 0;
if(TEST) if(TEST)
{ {
History.Create_NewPoint(); History.Create_NewPoint();
...@@ -3792,7 +3793,6 @@ CMathComposition.prototype = ...@@ -3792,7 +3793,6 @@ CMathComposition.prototype =
this.CheckTarget(); this.CheckTarget();
TEST_2 = !TEST_2;
return result.state.bDelete; return result.state.bDelete;
}, },
...@@ -3854,6 +3854,10 @@ CMathComposition.prototype = ...@@ -3854,6 +3854,10 @@ CMathComposition.prototype =
this.ClearSelect(); this.ClearSelect();
this.SelectContent.removeAreaSelect(); this.SelectContent.removeAreaSelect();
if(TEST)
var Pos = this.SelectContent.CurPos + 1;
var items = this.SelectContent.createEquation(indef); var items = this.SelectContent.createEquation(indef);
/// ///
...@@ -3863,8 +3867,8 @@ CMathComposition.prototype = ...@@ -3863,8 +3867,8 @@ CMathComposition.prototype =
if(TEST) if(TEST)
{ {
var Pos = this.SelectContent.CurPos - 1, //var Pos = this.SelectContent.CurPos - 1,
EndPos = this.SelectContent.CurPos + 1; var EndPos = this.SelectContent.CurPos + 1;
History.Add(this.CurrentContent, {Type: historyitem_Math_AddItem, Items: items, Pos: Pos, PosEnd: EndPos}); History.Add(this.CurrentContent, {Type: historyitem_Math_AddItem, Items: items, Pos: Pos, PosEnd: EndPos});
} }
...@@ -3911,8 +3915,11 @@ CMathComposition.prototype = ...@@ -3911,8 +3915,11 @@ CMathComposition.prototype =
this.RecalculateReverse(); this.RecalculateReverse();
this.UpdatePosition(); this.UpdatePosition();
this.SelectContent = this.Root.getContent( State.Select.stack, false ); var stackSelect = Common_CopyObj(State.Select.stack),
this.CurrentContent = this.Root.getContent( State.Current.stack, true ); stackCurrent = Common_CopyObj(State.Current.stack);
this.SelectContent = this.Root.getContent( stackSelect, false );
this.CurrentContent = this.Root.getContent( stackCurrent, true );
if(this.SelectContent.IsTarget()) if(this.SelectContent.IsTarget())
this.CheckTarget(); this.CheckTarget();
......
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