Commit f27636c2 authored by Ilya Kirillov's avatar Ilya Kirillov

Undo/redo functions are working with both types of changes like an old object...

Undo/redo functions are working with both types of changes like an old object and like a new classes.
parent ef45a769
...@@ -2891,6 +2891,11 @@ ...@@ -2891,6 +2891,11 @@
{ {
return this.Class; return this.Class;
}; };
CChangesBase.prototype.RefreshRecalcData = function()
{
if (this.Class && this.Class.Refresh_RecalcData)
this.Class.Refresh_RecalcData(this);
};
window['AscDFH'].CChangesBase = CChangesBase; window['AscDFH'].CChangesBase = CChangesBase;
/** /**
* Базовый класс для изменения свойств. * Базовый класс для изменения свойств.
......
...@@ -250,11 +250,20 @@ CHistory.prototype = ...@@ -250,11 +250,20 @@ CHistory.prototype =
for (var Index = Point.Items.length - 1; Index >= 0; Index--) for (var Index = Point.Items.length - 1; Index >= 0; Index--)
{ {
var Item = Point.Items[Index]; var Item = Point.Items[Index];
if (Item.Data && Item.Data.IsChangesClass && Item.Data.IsChangesClass())
{
Item.Data.Undo();
Item.Data.RefreshRecalcData();
}
else
{
Item.Class.Undo(Item.Data); Item.Class.Undo(Item.Data);
Item.Class.Refresh_RecalcData(Item.Data); Item.Class.Refresh_RecalcData(Item.Data);
} }
} }
} }
}
else else
{ {
Point = this.Points[this.Index--]; Point = this.Points[this.Index--];
...@@ -263,10 +272,18 @@ CHistory.prototype = ...@@ -263,10 +272,18 @@ CHistory.prototype =
for (var Index = Point.Items.length - 1; Index >= 0; Index--) for (var Index = Point.Items.length - 1; Index >= 0; Index--)
{ {
var Item = Point.Items[Index]; var Item = Point.Items[Index];
if (Item.Data && Item.Data.IsChangesClass && Item.Data.IsChangesClass())
{
Item.Data.Undo();
Item.Data.RefreshRecalcData();
}
else
{
Item.Class.Undo(Item.Data); Item.Class.Undo(Item.Data);
Item.Class.Refresh_RecalcData(Item.Data); Item.Class.Refresh_RecalcData(Item.Data);
} }
} }
}
if (null != Point) if (null != Point)
this.Document.Set_SelectionState( Point.State ); this.Document.Set_SelectionState( Point.State );
...@@ -290,8 +307,17 @@ CHistory.prototype = ...@@ -290,8 +307,17 @@ CHistory.prototype =
for ( var Index = 0; Index < Point.Items.length; Index++ ) for ( var Index = 0; Index < Point.Items.length; Index++ )
{ {
var Item = Point.Items[Index]; var Item = Point.Items[Index];
Item.Class.Redo( Item.Data );
Item.Class.Refresh_RecalcData( Item.Data ); if (Item.Data && Item.Data.IsChangesClass && Item.Data.IsChangesClass())
{
Item.Data.Redo();
Item.Data.RefreshRecalcData();
}
else
{
Item.Class.Redo(Item.Data);
Item.Class.Refresh_RecalcData(Item.Data);
}
} }
// Восстанавливаем состояние на следующую точку // Восстанавливаем состояние на следующую точку
......
...@@ -190,6 +190,7 @@ CChangesRunRemoveItem.prototype.Undo = function() ...@@ -190,6 +190,7 @@ CChangesRunRemoveItem.prototype.Undo = function()
}; };
CChangesRunRemoveItem.prototype.Redo = function() CChangesRunRemoveItem.prototype.Redo = function()
{ {
var oRun = this.Class;
oRun.Content.splice(this.Pos, this.EndPos - this.Pos + 1); oRun.Content.splice(this.Pos, this.EndPos - this.Pos + 1);
oRun.RecalcInfo.Measure = true; oRun.RecalcInfo.Measure = true;
......
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