Commit 7ffeca0b authored by Sergey Luzyanin's avatar Sergey Luzyanin

fix Bug 33882

parent 2de28ba9
...@@ -220,6 +220,10 @@ AscCommon.extendClass(CChangesDrawingObjectsAddToDrawingObjects, AscDFH.CChanges ...@@ -220,6 +220,10 @@ AscCommon.extendClass(CChangesDrawingObjectsAddToDrawingObjects, AscDFH.CChanges
this.Pos = Reader.GetLong(); this.Pos = Reader.GetLong();
}; };
CChangesDrawingObjectsAddToDrawingObjects.prototype.CreateReverseChange = function(){
return new CChangesDrawingObjectsRemoveFromDrawingObjects(this.Class, this.Pos);
};
AscDFH.changesFactory[AscDFH.historyitem_AutoShapes_AddToDrawingObjects] = CChangesDrawingObjectsAddToDrawingObjects; AscDFH.changesFactory[AscDFH.historyitem_AutoShapes_AddToDrawingObjects] = CChangesDrawingObjectsAddToDrawingObjects;
function CChangesDrawingObjectsRemoveFromDrawingObjects(Class, Pos){ function CChangesDrawingObjectsRemoveFromDrawingObjects(Class, Pos){
this.Type = AscDFH.historyitem_AutoShapes_RemoveFromDrawingObjects; this.Type = AscDFH.historyitem_AutoShapes_RemoveFromDrawingObjects;
...@@ -240,6 +244,10 @@ AscCommon.extendClass(CChangesDrawingObjectsRemoveFromDrawingObjects, AscDFH.CCh ...@@ -240,6 +244,10 @@ AscCommon.extendClass(CChangesDrawingObjectsRemoveFromDrawingObjects, AscDFH.CCh
this.Pos = Reader.GetLong(); this.Pos = Reader.GetLong();
}; };
CChangesDrawingObjectsRemoveFromDrawingObjects.prototype.CreateReverseChange = function(){
return new CChangesDrawingObjectsAddToDrawingObjects(this.Class, this.Pos);
};
AscDFH.changesFactory[AscDFH.historyitem_AutoShapes_RemoveFromDrawingObjects] = CChangesDrawingObjectsRemoveFromDrawingObjects; AscDFH.changesFactory[AscDFH.historyitem_AutoShapes_RemoveFromDrawingObjects] = CChangesDrawingObjectsRemoveFromDrawingObjects;
CShape.prototype.addToDrawingObjects = function(pos) CShape.prototype.addToDrawingObjects = function(pos)
......
...@@ -28,6 +28,10 @@ ...@@ -28,6 +28,10 @@
this.Redo(); this.Redo();
this.RefreshRecalcData(); this.RefreshRecalcData();
}; };
CChangesDrawingsBool.prototype.CreateReverseChange = function()
{
return new this.constructor(this.Class, this.Type, this.New, this.Old, this.Color);
};
CChangesDrawingsBool.prototype.ReadFromBinary = function (reader) { CChangesDrawingsBool.prototype.ReadFromBinary = function (reader) {
reader.Seek2(reader.GetCurPos() - 4); reader.Seek2(reader.GetCurPos() - 4);
...@@ -44,8 +48,16 @@ ...@@ -44,8 +48,16 @@
CChangesDrawingsLong.superclass.constructor.call(this, Class, _OldPr, _NewPr); CChangesDrawingsLong.superclass.constructor.call(this, Class, _OldPr, _NewPr);
} }
AscCommon.extendClass(CChangesDrawingsLong, AscDFH.CChangesBaseLongProperty); AscCommon.extendClass(CChangesDrawingsLong, AscDFH.CChangesBaseLongProperty);
CChangesDrawingsLong.prototype.CreateReverseChange = function()
{
return new this.constructor(this.Class, this.Type, this.New, this.Old, this.Color);
};
CChangesDrawingsLong.prototype.private_SetValue = private_SetValue; CChangesDrawingsLong.prototype.private_SetValue = private_SetValue;
CChangesDrawingsLong.prototype.Load = function(){ CChangesDrawingsLong.prototype.Load = function(){
this.Redo(); this.Redo();
...@@ -67,6 +79,11 @@ ...@@ -67,6 +79,11 @@
AscCommon.extendClass(CChangesDrawingsDouble, AscDFH.CChangesBaseDoubleProperty); AscCommon.extendClass(CChangesDrawingsDouble, AscDFH.CChangesBaseDoubleProperty);
CChangesDrawingsDouble.prototype.CreateReverseChange = function()
{
return new this.constructor(this.Class, this.Type, this.New, this.Old, this.Color);
};
CChangesDrawingsDouble.prototype.private_SetValue = private_SetValue; CChangesDrawingsDouble.prototype.private_SetValue = private_SetValue;
CChangesDrawingsDouble.prototype.Load = function(){ CChangesDrawingsDouble.prototype.Load = function(){
...@@ -91,6 +108,11 @@ ...@@ -91,6 +108,11 @@
AscCommon.extendClass(CChangesDrawingsString, AscDFH.CChangesBaseStringProperty); AscCommon.extendClass(CChangesDrawingsString, AscDFH.CChangesBaseStringProperty);
CChangesDrawingsString.prototype.CreateReverseChange = function()
{
return new this.constructor(this.Class, this.Type, this.New, this.Old, this.Color);
};
CChangesDrawingsString.prototype.private_SetValue = private_SetValue; CChangesDrawingsString.prototype.private_SetValue = private_SetValue;
CChangesDrawingsString.prototype.Load = function(){ CChangesDrawingsString.prototype.Load = function(){
...@@ -113,7 +135,12 @@ ...@@ -113,7 +135,12 @@
CChangesDrawingsObjectNoId.superclass.constructor.call(this, Class, _OldPr, _NewPr); CChangesDrawingsObjectNoId.superclass.constructor.call(this, Class, _OldPr, _NewPr);
} }
AscCommon.extendClass(CChangesDrawingsObjectNoId, AscDFH.CChangesBaseObjectProperty); AscCommon.extendClass(CChangesDrawingsObjectNoId, AscDFH.CChangesBaseObjectProperty);
CChangesDrawingsObjectNoId.prototype.CreateReverseChange = function()
{
return new this.constructor(this.Class, this.Type, this.New, this.Old, this.Color);
};
CChangesDrawingsObjectNoId.prototype.private_SetValue = private_SetValue; CChangesDrawingsObjectNoId.prototype.private_SetValue = private_SetValue;
CChangesDrawingsObjectNoId.prototype.Load = function(){ CChangesDrawingsObjectNoId.prototype.Load = function(){
this.Redo(); this.Redo();
...@@ -141,7 +168,13 @@ ...@@ -141,7 +168,13 @@
CChangesDrawingsObject.superclass.constructor.call(this, Class, _OldPr, _NewPr); CChangesDrawingsObject.superclass.constructor.call(this, Class, _OldPr, _NewPr);
} }
AscCommon.extendClass(CChangesDrawingsObject, AscDFH.CChangesBaseStringProperty); AscCommon.extendClass(CChangesDrawingsObject, AscDFH.CChangesBaseStringProperty);
CChangesDrawingsObject.prototype.CreateReverseChange = function()
{
return new this.constructor(this.Class, this.Type, AscCommon.g_oTableId.Get_ById(this.New), AscCommon.g_oTableId.Get_ById(this.Old), this.Color);
};
window['AscDFH'].CChangesDrawingsObject = CChangesDrawingsObject; window['AscDFH'].CChangesDrawingsObject = CChangesDrawingsObject;
CChangesDrawingsObject.prototype.ReadFromBinary = function (reader) { CChangesDrawingsObject.prototype.ReadFromBinary = function (reader) {
reader.Seek2(reader.GetCurPos() - 4); reader.Seek2(reader.GetCurPos() - 4);
...@@ -175,10 +208,12 @@ ...@@ -175,10 +208,12 @@
reader.Seek2(reader.GetCurPos() - 4); reader.Seek2(reader.GetCurPos() - 4);
this.Type = reader.GetLong(); this.Type = reader.GetLong();
this.Add = reader.GetBool(); this.Add = reader.GetBool();
this.Pos = reader.GetLong();
CChangesDrawingsContent.superclass.ReadFromBinary.call(this, reader); CChangesDrawingsContent.superclass.ReadFromBinary.call(this, reader);
}; };
CChangesDrawingsContent.prototype.WriteToBinary = function (writer) { CChangesDrawingsContent.prototype.WriteToBinary = function (writer) {
writer.WriteBool(this.IsAdd()); writer.WriteBool(this.IsAdd());
writer.WriteLong(this.Pos);
CChangesDrawingsContent.superclass.WriteToBinary.call(this, writer); CChangesDrawingsContent.superclass.WriteToBinary.call(this, writer);
}; };
...@@ -206,7 +241,7 @@ ...@@ -206,7 +241,7 @@
}; };
CChangesDrawingsContent.prototype.private_InsertInArrayLoad = function () { CChangesDrawingsContent.prototype.private_InsertInArrayLoad = function () {
if (this.PosArray.length <= 0 || this.Items.length <= 0) if (this.Items.length <= 0)
return; return;
var aChangedArray = this.private_GetChangedArray(); var aChangedArray = this.private_GetChangedArray();
...@@ -214,10 +249,10 @@ ...@@ -214,10 +249,10 @@
var oContentChanges = this.private_GetContentChanges(), nPos; var oContentChanges = this.private_GetContentChanges(), nPos;
for (var i = 0; i < this.Items.length; ++i) { for (var i = 0; i < this.Items.length; ++i) {
if (oContentChanges) { if (oContentChanges) {
nPos = oContentChanges.Check(AscCommon.contentchanges_Add, this.PosArray[i]); nPos = oContentChanges.Check(AscCommon.contentchanges_Add, this.Pos + i);
} }
else { else {
nPos = this.PosArray[i]; nPos = this.Pos + i;
} }
var oElement = this.Items[i]; var oElement = this.Items[i];
...@@ -235,10 +270,10 @@ ...@@ -235,10 +270,10 @@
var oContentChanges = this.private_GetContentChanges(), nPos; var oContentChanges = this.private_GetContentChanges(), nPos;
for (var i = 0; i < this.Items.length; ++i) { for (var i = 0; i < this.Items.length; ++i) {
if (oContentChanges) { if (oContentChanges) {
nPos = oContentChanges.Check(AscCommon.contentchanges_Remove, this.PosArray[i]); nPos = oContentChanges.Check(AscCommon.contentchanges_Remove, this.Pos + i);
} }
else { else {
nPos = this.PosArray[i]; nPos = this.Pos + i;
} }
if (false === nPos) { if (false === nPos) {
continue; continue;
...@@ -299,6 +334,23 @@ ...@@ -299,6 +334,23 @@
CChangesDrawingsContent.prototype.IsContentChange = function () { CChangesDrawingsContent.prototype.IsContentChange = function () {
return false; return false;
}; };
CChangesDrawingsContent.prototype.Copy = function()
{
var oChanges = new this.constructor(this.Class, this.Type, this.Pos, this.Items, this.Add);
oChanges.UseArray = this.UseArray;
oChanges.Pos = this.Pos;
for (var nIndex = 0, nCount = this.PosArray.length; nIndex < nCount; ++nIndex)
oChanges.PosArray[nIndex] = this.PosArray[nIndex];
return oChanges;
};
CChangesDrawingsContent.prototype.CreateReverseChange = function(){
var oRet = this.private_CreateReverseChange(CChangesDrawingsContent);
oRet.Type = this.Type;
oRet.Pos = this.Pos;
return oRet;
};
function CChangesDrawingsContentNoId(Class, Type, Pos, Items, isAdd){ function CChangesDrawingsContentNoId(Class, Type, Pos, Items, isAdd){
...@@ -342,12 +394,12 @@ ...@@ -342,12 +394,12 @@
CChangesDrawingsContentLongMap.prototype.private_InsertInArrayLoad = function () { CChangesDrawingsContentLongMap.prototype.private_InsertInArrayLoad = function () {
if (this.PosArray.length <= 0 || this.Items.length <= 0) if (this.Items.length <= 0)
return; return;
var aChangedArray = this.private_GetChangedArray(); var aChangedArray = this.private_GetChangedArray();
if (null !== aChangedArray) { if (null !== aChangedArray) {
for (var i = 0; i < this.Items.length; ++i) { for (var i = 0; i < this.Items.length; ++i) {
aChangedArray[this.PosArray[i]] = this.Items[i]; aChangedArray[this.Pos + i] = this.Items[i];
} }
} }
}; };
...@@ -356,8 +408,8 @@ ...@@ -356,8 +408,8 @@
var aChangedArray = this.private_GetChangedArray(); var aChangedArray = this.private_GetChangedArray();
if (null !== aChangedArray) { if (null !== aChangedArray) {
for (var i = 0; i < this.PosArray.length; ++i) { for (var i = 0; i < this.Items.length; ++i) {
aChangedArray[this.PosArray[i]] = null; aChangedArray[this.Pos + i] = null;
} }
} }
}; };
...@@ -427,6 +479,9 @@ ...@@ -427,6 +479,9 @@
this.RefreshRecalcData(); this.RefreshRecalcData();
}; };
CChangesDrawingChangeTheme.prototype.CreateReverseChange = function(){
return new CChangesDrawingChangeTheme(this.Class, this.Type, this.aIndexes);
};
window['AscDFH'].CChangesDrawingChangeTheme = CChangesDrawingChangeTheme; window['AscDFH'].CChangesDrawingChangeTheme = CChangesDrawingChangeTheme;
...@@ -480,6 +535,10 @@ ...@@ -480,6 +535,10 @@
this.Redo(); this.Redo();
this.RefreshRecalcData(); this.RefreshRecalcData();
}; };
CChangesDrawingTimingLocks.prototype.CreateReverseChange = function()
{
return new this.constructor(this.Class, null, null, null, null, null);
};
window['AscDFH'].CChangesDrawingTimingLocks = CChangesDrawingTimingLocks; window['AscDFH'].CChangesDrawingTimingLocks = CChangesDrawingTimingLocks;
...@@ -556,13 +615,18 @@ ...@@ -556,13 +615,18 @@
this.Redo(); this.Redo();
this.RefreshRecalcData(); this.RefreshRecalcData();
}; };
CChangesSparklinesChangeData.prototype.CreateReverseChange = function(){
return new CChangesSparklinesChangeData(this.Class, this.NewPr, this.OldPr);
};
window['AscDFH'].CChangesSparklinesChangeData = CChangesSparklinesChangeData; window['AscDFH'].CChangesSparklinesChangeData = CChangesSparklinesChangeData;
function CChangesSparklinesRemoveData(Class, oSparkline){ function CChangesSparklinesRemoveData(Class, oSparkline, bReverse){
this.Type = AscDFH.historyitem_Sparkline_RemoveData; this.Type = AscDFH.historyitem_Sparkline_RemoveData;
this.sparkline = oSparkline; this.sparkline = oSparkline;
this.bReverse = bReverse;
CChangesSparklinesRemoveData.superclass.constructor.call(this, Class); CChangesSparklinesRemoveData.superclass.constructor.call(this, Class);
} }
AscCommon.extendClass(CChangesSparklinesRemoveData, AscDFH.CChangesBase); AscCommon.extendClass(CChangesSparklinesRemoveData, AscDFH.CChangesBase);
...@@ -576,6 +640,7 @@ ...@@ -576,6 +640,7 @@
Writer.WriteLong(this.sparkline.sqref.r1); Writer.WriteLong(this.sparkline.sqref.r1);
Writer.WriteString2(this.sparkline.f); Writer.WriteString2(this.sparkline.f);
} }
Writer.WriteBool(this.bReverse === true);
}; };
CChangesSparklinesRemoveData.prototype.ReadFromBinary = function(Reader){ CChangesSparklinesRemoveData.prototype.ReadFromBinary = function(Reader){
var bIsObject = Reader.GetLong(); var bIsObject = Reader.GetLong();
...@@ -586,13 +651,29 @@ ...@@ -586,13 +651,29 @@
this.sparkline.sqref = new Asc.Range(col, row, col, row); this.sparkline.sqref = new Asc.Range(col, row, col, row);
this.sparkline.setF(Reader.GetString2()); this.sparkline.setF(Reader.GetString2());
} }
this.bReverse = Reader.GetBool();
}; };
CChangesSparklinesRemoveData.prototype.Undo = function(){ CChangesSparklinesRemoveData.prototype.Undo = function(){
this.Class.arrSparklines.push(this.sparkline); if(this.bReverse){
this.Class.remove(this.sparkline.sqref);
}
else{
this.Class.arrSparklines.push(this.sparkline);
}
}; };
CChangesSparklinesRemoveData.prototype.Redo = function(){ CChangesSparklinesRemoveData.prototype.Redo = function(){
this.Class.remove(this.sparkline.sqref); if(this.bReverse){
this.Class.arrSparklines.push(this.sparkline);
}
else{
this.Class.remove(this.sparkline.sqref);
}
};
CChangesSparklinesRemoveData.prototype.CreateReverseChange = function(){
return new CChangesSparklinesRemoveData(this.Class, this.sparkline, !this.bReverse);
}; };
...@@ -685,50 +766,60 @@ ...@@ -685,50 +766,60 @@
break; break;
} }
}; };
CChangesDrawingsExcelColor.prototype.CreateReverseChange = function(){
return new CChangesDrawingsExcelColor(this.Class, this.Type, this.NewPr, this.OldPr);
};
AscDFH.CChangesDrawingsExcelColor = CChangesDrawingsExcelColor; AscDFH.CChangesDrawingsExcelColor = CChangesDrawingsExcelColor;
function CChangesDrawingsSparklinesRemove(Class){ function CChangesDrawingsSparklinesRemove(Class, bReverse){
this.Type = AscDFH.historyitem_Sparkline_RemoveSparkline; this.Type = AscDFH.historyitem_Sparkline_RemoveSparkline;
this.bReverse = bReverse;
CChangesDrawingsSparklinesRemove.superclass.constructor.call(this, Class); CChangesDrawingsSparklinesRemove.superclass.constructor.call(this, Class);
} }
AscCommon.extendClass(CChangesDrawingsSparklinesRemove, AscDFH.CChangesBase); AscCommon.extendClass(CChangesDrawingsSparklinesRemove, AscDFH.CChangesBase);
CChangesDrawingsSparklinesRemove.prototype.Undo = function(){ CChangesDrawingsSparklinesRemove.prototype.Undo = function(){
if (this.Class.worksheet) { if (this.Class.worksheet) {
this.Class.worksheet.insertSparklineGroup(this.Class); if(this.bReverse){
this.Class.worksheet.removeSparklineGroup(this.Class.Get_Id());
}
else{
this.Class.worksheet.insertSparklineGroup(this.Class);
}
} }
}; };
CChangesDrawingsSparklinesRemove.prototype.Redo = function(){ CChangesDrawingsSparklinesRemove.prototype.Redo = function(){
if (this.Class.worksheet) { if (this.Class.worksheet) {
this.Class.worksheet.removeSparklineGroup(this.Class.Get_Id()); if(this.bReverse){
this.Class.worksheet.insertSparklineGroup(this.Class);
}
else{
this.Class.worksheet.removeSparklineGroup(this.Class.Get_Id());
}
} }
}; };
CChangesDrawingsSparklinesRemove.prototype.WriteToBinary = function(Writer){
Writer.WriteBool(!!this.bReverse);
};
CChangesDrawingsSparklinesRemove.prototype.ReadFromBinary = function(Reader){
this.bReverse = Reader.GetBool();
};
CChangesDrawingsSparklinesRemove.prototype.Load = function(){ CChangesDrawingsSparklinesRemove.prototype.Load = function(){
this.Redo(); this.Redo();
this.RefreshRecalcData(); this.RefreshRecalcData();
}; };
window['AscDFH'].CChangesDrawingsSparklinesRemove = CChangesDrawingsSparklinesRemove;
function CChangesDrawingsSparklineRemoveData(Class, Col, Row){ CChangesDrawingsSparklinesRemove.prototype.CreateReverseChange = function(){
this.Type = AscDFH.historyitem_Sparkline_RemoveData; return new CChangesDrawingsSparklinesRemove(this.Class, !this.bReverse);
this.Col = Col;
this.Row = Row;
CChangesDrawingsSparklineRemoveData.superclass.constructor.call(this, Class);
}
CChangesDrawingsSparklineRemoveData.prototype.WriteToBinary = function(Writer){
Writer.WriteLong(this.Col);
Writer.WriteLong(this.Row);
};
CChangesDrawingsSparklineRemoveData.prototype.ReadFromBinary = function(Reader){
this.Col = Reader.GetLong();
this.Row = Reader.GetLong();
}; };
window['AscDFH'].CChangesDrawingsSparklinesRemove = CChangesDrawingsSparklinesRemove;
CChangesDrawingsSparklineRemoveData.prototype.Undo = function(){
};
CChangesDrawingsSparklineRemoveData.prototype.Redo = function(){
this.Class.remove(new Asc.Range(this.Col, this.Row, this.Col, this.Row));
};
......
...@@ -381,17 +381,30 @@ function CalculateAhPolarList(ahPolarListInfo, ahPolarLst, gdLst) ...@@ -381,17 +381,30 @@ function CalculateAhPolarList(ahPolarListInfo, ahPolarLst, gdLst)
} }
} }
function CChangesGeometryAddAdj(Class, Name, OldValue, NewValue, OldAvValue){ function CChangesGeometryAddAdj(Class, Name, OldValue, NewValue, OldAvValue, bReverse){
this.Type = AscDFH.historyitem_GeometryAddAdj; this.Type = AscDFH.historyitem_GeometryAddAdj;
this.Name = Name; this.Name = Name;
this.OldValue = OldValue; this.OldValue = OldValue;
this.NewValue = NewValue; this.NewValue = NewValue;
this.OldAvValue = OldAvValue; this.OldAvValue = OldAvValue;
this.bReverse = bReverse;
CChangesGeometryAddAdj.superclass.constructor.call(this, Class); CChangesGeometryAddAdj.superclass.constructor.call(this, Class);
} }
AscCommon.extendClass(CChangesGeometryAddAdj, AscDFH.CChangesBase); AscCommon.extendClass(CChangesGeometryAddAdj, AscDFH.CChangesBase);
CChangesGeometryAddAdj.prototype.Undo = function(){
CChangesGeometryAddAdj.prototype.CreateReverseChange = function(){
return new CChangesGeometryAddAdj(this.Class, this.Name, this.OldValue, this.NewValue, this.OldAvValue, !this.bReverse)
};
CChangesGeometryAddAdj.prototype.AddAdj = function(){
this.Class.gdLst[this.Name] = parseInt(this.NewValue);
this.Class.avLst[this.Name] = true;
};
CChangesGeometryAddAdj.prototype.RemoveAdj = function(){
var _OldValue = parseInt(this.OldValue); var _OldValue = parseInt(this.OldValue);
if(!isNaN(_OldValue)){ if(!isNaN(_OldValue)){
this.Class.gdLst[this.Name] = _OldValue; this.Class.gdLst[this.Name] = _OldValue;
...@@ -402,38 +415,54 @@ AscCommon.extendClass(CChangesGeometryAddAdj, AscDFH.CChangesBase); ...@@ -402,38 +415,54 @@ AscCommon.extendClass(CChangesGeometryAddAdj, AscDFH.CChangesBase);
this.Class.avLst[this.Name] = this.OldAvValue; this.Class.avLst[this.Name] = this.OldAvValue;
}; };
CChangesGeometryAddAdj.prototype.Undo = function(){
if(this.bReverse){
this.AddAdj();
}
else{
this.RemoveAdj();
}
};
CChangesGeometryAddAdj.prototype.Redo = function(){ CChangesGeometryAddAdj.prototype.Redo = function(){
this.Class.gdLst[this.Name] = parseInt(this.NewValue); if(this.bReverse){
this.Class.avLst[this.Name] = true; this.RemoveAdj();
}
else{
this.AddAdj();
}
}; };
CChangesGeometryAddAdj.prototype.WriteToBinary = function(Writer){ CChangesGeometryAddAdj.prototype.WriteToBinary = function(Writer){
Writer.WriteString2(this.Name); Writer.WriteString2(this.Name);
Writer.WriteString2(this.NewValue); Writer.WriteString2(this.NewValue);
AscFormat.writeString(Writer, this.OldValue); AscFormat.writeString(Writer, this.OldValue);
AscFormat.writeBool(Writer, this.OldAvValue); AscFormat.writeBool(Writer, this.OldAvValue);
Writer.WriteBool(!!this.bReverse);
}; };
CChangesGeometryAddAdj.prototype.ReadFromBinary = function(Reader){ CChangesGeometryAddAdj.prototype.ReadFromBinary = function(Reader){
this.Name = Reader.GetString2(); this.Name = Reader.GetString2();
this.NewValue = Reader.GetString2(); this.NewValue = Reader.GetString2();
this.OldValue = AscFormat.readString(Reader); this.OldValue = AscFormat.readString(Reader);
this.OldAvValue = AscFormat.readBool(Reader); this.OldAvValue = AscFormat.readBool(Reader);
this.bReverse = Reader.GetBool();
}; };
AscDFH.changesFactory[AscDFH.historyitem_GeometryAddAdj] = CChangesGeometryAddAdj; AscDFH.changesFactory[AscDFH.historyitem_GeometryAddAdj] = CChangesGeometryAddAdj;
function CChangesGeometryAddGuide(Class, Name, formula, x, y, z){ function CChangesGeometryAddGuide(Class, Name, formula, x, y, z, bReverse){
this.Type = AscDFH.historyitem_GeometryAddGuide; this.Type = AscDFH.historyitem_GeometryAddGuide;
this.Name = Name; this.Name = Name;
this.formula = formula; this.formula = formula;
this.x = x; this.x = x;
this.y = y; this.y = y;
this.z = z; this.z = z;
this.bReverse = bReverse;
CChangesGeometryAddGuide.superclass.constructor.call(this, Class); CChangesGeometryAddGuide.superclass.constructor.call(this, Class);
} }
AscCommon.extendClass(CChangesGeometryAddGuide, AscDFH.CChangesBase); AscCommon.extendClass(CChangesGeometryAddGuide, AscDFH.CChangesBase);
CChangesGeometryAddGuide.prototype.Undo = function(){ CChangesGeometryAddGuide.prototype.RemoveGuide = function(){
var aGdLstInfo = this.Class.gdLstInfo; var aGdLstInfo = this.Class.gdLstInfo;
for(var i = aGdLstInfo.length - 1; i > -1 ; --i){ for(var i = aGdLstInfo.length - 1; i > -1 ; --i){
var oCurGd = aGdLstInfo[i]; var oCurGd = aGdLstInfo[i];
...@@ -443,15 +472,34 @@ AscCommon.extendClass(CChangesGeometryAddAdj, AscDFH.CChangesBase); ...@@ -443,15 +472,34 @@ AscCommon.extendClass(CChangesGeometryAddAdj, AscDFH.CChangesBase);
} }
} }
}; };
CChangesGeometryAddGuide.prototype.Redo = function(){
CChangesGeometryAddGuide.prototype.AddGuide = function(){
this.Class.gdLstInfo.push({name: this.Name, formula: this.formula, x: this.x, y: this.y, z: this.z}); this.Class.gdLstInfo.push({name: this.Name, formula: this.formula, x: this.x, y: this.y, z: this.z});
}; };
CChangesGeometryAddGuide.prototype.Undo = function(){
if(this.bReverse){
this.AddGuide();
}
else{
this.RemoveGuide();
}
};
CChangesGeometryAddGuide.prototype.Redo = function(){
if(this.bReverse){
this.RemoveGuide();
}
else{
this.AddGuide();
}
};
CChangesGeometryAddGuide.prototype.WriteToBinary = function(Writer){ CChangesGeometryAddGuide.prototype.WriteToBinary = function(Writer){
Writer.WriteString2(this.Name); Writer.WriteString2(this.Name);
Writer.WriteLong(this.formula); Writer.WriteLong(this.formula);
AscFormat.writeString(Writer, this.x); AscFormat.writeString(Writer, this.x);
AscFormat.writeString(Writer, this.y); AscFormat.writeString(Writer, this.y);
AscFormat.writeString(Writer, this.z); AscFormat.writeString(Writer, this.z);
Writer.WriteBool(!!this.bReverse);
}; };
CChangesGeometryAddGuide.prototype.ReadFromBinary = function(Reader){ CChangesGeometryAddGuide.prototype.ReadFromBinary = function(Reader){
this.Name = Reader.GetString2(); this.Name = Reader.GetString2();
...@@ -459,20 +507,28 @@ AscCommon.extendClass(CChangesGeometryAddAdj, AscDFH.CChangesBase); ...@@ -459,20 +507,28 @@ AscCommon.extendClass(CChangesGeometryAddAdj, AscDFH.CChangesBase);
this.x = AscFormat.readString(Reader); this.x = AscFormat.readString(Reader);
this.y = AscFormat.readString(Reader); this.y = AscFormat.readString(Reader);
this.z = AscFormat.readString(Reader); this.z = AscFormat.readString(Reader);
this.bReverse = Reader.GetBool();
}; };
CChangesGeometryAddGuide.prototype.CreateReverseChange = function(){
return new CChangesGeometryAddGuide(this.Class, this.Name, this.formula, this.x, this.y, this.z, !this.bReverse);
};
AscDFH.changesFactory[AscDFH.historyitem_GeometryAddGuide] = CChangesGeometryAddGuide; AscDFH.changesFactory[AscDFH.historyitem_GeometryAddGuide] = CChangesGeometryAddGuide;
function CChangesGeometryAddCnx(Class, ang, x, y){ function CChangesGeometryAddCnx(Class, ang, x, y, bReverse){
this.Type = AscDFH.historyitem_GeometryAddCnx; this.Type = AscDFH.historyitem_GeometryAddCnx;
this.ang = ang; this.ang = ang;
this.x = x; this.x = x;
this.y = y; this.y = y;
this.bReverse = bReverse;
CChangesGeometryAddCnx.superclass.constructor.call(this, Class); CChangesGeometryAddCnx.superclass.constructor.call(this, Class);
} }
AscCommon.extendClass(CChangesGeometryAddCnx, AscDFH.CChangesBase); AscCommon.extendClass(CChangesGeometryAddCnx, AscDFH.CChangesBase);
CChangesGeometryAddCnx.prototype.Undo = function(){ CChangesGeometryAddCnx.prototype.RemoveCnx = function(){
var aCnxLstInfo = this.Class.cnxLstInfo; var aCnxLstInfo = this.Class.cnxLstInfo;
for(var i = aCnxLstInfo.length - 1; i > -1 ; --i){ for(var i = aCnxLstInfo.length - 1; i > -1 ; --i){
var oCurCnx = aCnxLstInfo[i]; var oCurCnx = aCnxLstInfo[i];
...@@ -481,23 +537,46 @@ AscCommon.extendClass(CChangesGeometryAddAdj, AscDFH.CChangesBase); ...@@ -481,23 +537,46 @@ AscCommon.extendClass(CChangesGeometryAddAdj, AscDFH.CChangesBase);
} }
} }
}; };
CChangesGeometryAddCnx.prototype.Redo = function(){ CChangesGeometryAddCnx.prototype.AddCnx = function(){
this.Class.cnxLstInfo.push({ang: this.ang, x: this.x, y: this.y}); this.Class.cnxLstInfo.push({ang: this.ang, x: this.x, y: this.y});
}; };
CChangesGeometryAddCnx.prototype.Undo = function(){
if(this.bReverse){
this.AddCnx();
}
else{
this.RemoveCnx();
}
};
CChangesGeometryAddCnx.prototype.Redo = function(){
if(this.bReverse){
this.RemoveCnx();
}
else{
this.AddCnx();
}
};
CChangesGeometryAddCnx.prototype.WriteToBinary = function(Writer){ CChangesGeometryAddCnx.prototype.WriteToBinary = function(Writer){
AscFormat.writeString(Writer, this.ang); AscFormat.writeString(Writer, this.ang);
AscFormat.writeString(Writer, this.x); AscFormat.writeString(Writer, this.x);
AscFormat.writeString(Writer, this.y); AscFormat.writeString(Writer, this.y);
Writer.WriteBool(!!this.bReverse);
}; };
CChangesGeometryAddCnx.prototype.ReadFromBinary = function(Reader){ CChangesGeometryAddCnx.prototype.ReadFromBinary = function(Reader){
this.ang = AscFormat.readString(Reader); this.ang = AscFormat.readString(Reader);
this.x = AscFormat.readString(Reader); this.x = AscFormat.readString(Reader);
this.y = AscFormat.readString(Reader); this.y = AscFormat.readString(Reader);
this.bReverse = Reader.GetBool();
};
CChangesGeometryAddCnx.prototype.CreateReverseChange = function(){
return new CChangesGeometryAddCnx(this.Class, this.ang, this.x, this.y, !this.bReverse);
}; };
AscDFH.changesFactory[AscDFH.historyitem_GeometryAddCnx] = CChangesGeometryAddCnx; AscDFH.changesFactory[AscDFH.historyitem_GeometryAddCnx] = CChangesGeometryAddCnx;
function CChangesGeometryAddHandleXY(Class, gdRefX, minX, maxX, gdRefY, minY, maxY, posX, posY){ function CChangesGeometryAddHandleXY(Class, gdRefX, minX, maxX, gdRefY, minY, maxY, posX, posY, bReverse){
this.Type = AscDFH.historyitem_GeometryAddHandleXY; this.Type = AscDFH.historyitem_GeometryAddHandleXY;
this.gdRefX = gdRefX; this.gdRefX = gdRefX;
this.minX = minX; this.minX = minX;
...@@ -507,25 +586,42 @@ AscCommon.extendClass(CChangesGeometryAddAdj, AscDFH.CChangesBase); ...@@ -507,25 +586,42 @@ AscCommon.extendClass(CChangesGeometryAddAdj, AscDFH.CChangesBase);
this.maxY = maxY; this.maxY = maxY;
this.posX = posX; this.posX = posX;
this.posY = posY; this.posY = posY;
this.bReverse = bReverse;
CChangesGeometryAddHandleXY.superclass.constructor.call(this, Class); CChangesGeometryAddHandleXY.superclass.constructor.call(this, Class);
} }
AscCommon.extendClass(CChangesGeometryAddHandleXY, AscDFH.CChangesBase); AscCommon.extendClass(CChangesGeometryAddHandleXY, AscDFH.CChangesBase);
CChangesGeometryAddHandleXY.prototype.RemoveHandleXY = function(){
CChangesGeometryAddHandleXY.prototype.Undo = function(){
var ahXYLstInfo = this.Class.ahXYLstInfo; var ahXYLstInfo = this.Class.ahXYLstInfo;
for(var i = ahXYLstInfo.length - 1; i > -1 ; --i){ for(var i = ahXYLstInfo.length - 1; i > -1 ; --i){
var oCurXY = ahXYLstInfo[i]; var oCurXY = ahXYLstInfo[i];
if(oCurXY.gdRefX == this.gdRefX && oCurXY.minX == this.minX && oCurXY.maxX == this.maxX && if(oCurXY.gdRefX == this.gdRefX && oCurXY.minX == this.minX && oCurXY.maxX == this.maxX &&
oCurXY.gdRefY == this.gdRefY && oCurXY.minY == this.minY && oCurXY.maxY == this.maxY && oCurXY.gdRefY == this.gdRefY && oCurXY.minY == this.minY && oCurXY.maxY == this.maxY &&
oCurXY.posX == this.posX && oCurXY.posY == this.posY){ oCurXY.posX == this.posX && oCurXY.posY == this.posY){
ahXYLstInfo.splice(i, 1); ahXYLstInfo.splice(i, 1);
} }
} }
}; };
CChangesGeometryAddHandleXY.prototype.Redo = function(){ CChangesGeometryAddHandleXY.prototype.AddHandleXY = function(){
this.Class.ahXYLstInfo.push({gdRefX: this.gdRefX, minX: this.minX, maxX: this.maxX, gdRefY: this.gdRefY, minY: this.minY, maxY: this.maxY, posX: this.posX,posY: this.posY}); this.Class.ahXYLstInfo.push({gdRefX: this.gdRefX, minX: this.minX, maxX: this.maxX, gdRefY: this.gdRefY, minY: this.minY, maxY: this.maxY, posX: this.posX,posY: this.posY});
}; };
CChangesGeometryAddHandleXY.prototype.Undo = function(){
if(this.bReverse){
this.AddHandleXY();
}
else{
this.RemoveHandleXY();
}
};
CChangesGeometryAddHandleXY.prototype.Redo = function(){
if(this.bReverse){
this.RemoveHandleXY();
}
else{
this.AddHandleXY();
}
};
CChangesGeometryAddHandleXY.prototype.WriteToBinary = function(Writer){ CChangesGeometryAddHandleXY.prototype.WriteToBinary = function(Writer){
AscFormat.writeString(Writer, this.gdRefX); AscFormat.writeString(Writer, this.gdRefX);
AscFormat.writeString(Writer, this.minX); AscFormat.writeString(Writer, this.minX);
...@@ -535,6 +631,7 @@ AscCommon.extendClass(CChangesGeometryAddAdj, AscDFH.CChangesBase); ...@@ -535,6 +631,7 @@ AscCommon.extendClass(CChangesGeometryAddAdj, AscDFH.CChangesBase);
AscFormat.writeString(Writer, this.maxY); AscFormat.writeString(Writer, this.maxY);
AscFormat.writeString(Writer, this.posX); AscFormat.writeString(Writer, this.posX);
AscFormat.writeString(Writer, this.posY); AscFormat.writeString(Writer, this.posY);
Writer.WriteBool(!!this.bReverse);
}; };
CChangesGeometryAddHandleXY.prototype.ReadFromBinary = function(Reader){ CChangesGeometryAddHandleXY.prototype.ReadFromBinary = function(Reader){
this.gdRefX = AscFormat.readString(Reader); this.gdRefX = AscFormat.readString(Reader);
...@@ -545,10 +642,15 @@ AscCommon.extendClass(CChangesGeometryAddAdj, AscDFH.CChangesBase); ...@@ -545,10 +642,15 @@ AscCommon.extendClass(CChangesGeometryAddAdj, AscDFH.CChangesBase);
this.maxY = AscFormat.readString(Reader); this.maxY = AscFormat.readString(Reader);
this.posX = AscFormat.readString(Reader); this.posX = AscFormat.readString(Reader);
this.posY = AscFormat.readString(Reader); this.posY = AscFormat.readString(Reader);
this.bReverse = Reader.GetBool();
};
CChangesGeometryAddHandleXY.prototype.CreateReverseChange = function(){
return new CChangesGeometryAddHandleXY(this.Class, this.gdRefX, this.minX, this.maxX, this.gdRefY, this.minY, this.maxY, this.posX, this.posY, !this.bReverse);
}; };
AscDFH.changesFactory[AscDFH.historyitem_GeometryAddHandleXY] = CChangesGeometryAddHandleXY; AscDFH.changesFactory[AscDFH.historyitem_GeometryAddHandleXY] = CChangesGeometryAddHandleXY;
function CChangesGeometryAddHandlePolar(Class, gdRefR, minR, maxR, gdRefAng, minAng, maxAng, posX, posY){ function CChangesGeometryAddHandlePolar(Class, gdRefR, minR, maxR, gdRefAng, minAng, maxAng, posX, posY, bReverse){
this.Type = AscDFH.historyitem_GeometryAddHandleXY; this.Type = AscDFH.historyitem_GeometryAddHandleXY;
this.gdRefAng = gdRefAng; this.gdRefAng = gdRefAng;
this.minAng = minAng; this.minAng = minAng;
...@@ -558,25 +660,44 @@ AscCommon.extendClass(CChangesGeometryAddAdj, AscDFH.CChangesBase); ...@@ -558,25 +660,44 @@ AscCommon.extendClass(CChangesGeometryAddAdj, AscDFH.CChangesBase);
this.maxR = maxR; this.maxR = maxR;
this.posX = posX; this.posX = posX;
this.posY = posY; this.posY = posY;
this.bReverse = bReverse;
CChangesGeometryAddHandlePolar.superclass.constructor.call(this, Class); CChangesGeometryAddHandlePolar.superclass.constructor.call(this, Class);
} }
AscCommon.extendClass(CChangesGeometryAddHandlePolar, AscDFH.CChangesBase); AscCommon.extendClass(CChangesGeometryAddHandlePolar, AscDFH.CChangesBase);
CChangesGeometryAddHandlePolar.prototype.Undo = function(){ CChangesGeometryAddHandlePolar.prototype.RemoveHandlePolar = function(){
var ahPolarLstInfo = this.Class.ahPolarLstInfo; var ahPolarLstInfo = this.Class.ahPolarLstInfo;
for(var i = ahPolarLstInfo.length - 1; i > -1 ; --i){ for(var i = ahPolarLstInfo.length - 1; i > -1 ; --i){
var oCurPolar= ahPolarLstInfo[i]; var oCurPolar= ahPolarLstInfo[i];
if(oCurPolar.gdRefR == this.gdRefR && oCurPolar.minR == this.minR && oCurPolar.maxR == this.maxR && if(oCurPolar.gdRefR == this.gdRefR && oCurPolar.minR == this.minR && oCurPolar.maxR == this.maxR &&
oCurPolar.gdRefAng == this.gdRefAng && oCurPolar.minAng == this.minAng && oCurPolar.maxAng == this.maxAng && oCurPolar.gdRefAng == this.gdRefAng && oCurPolar.minAng == this.minAng && oCurPolar.maxAng == this.maxAng &&
oCurPolar.posX == this.posX && oCurPolar.posY == this.posY){ oCurPolar.posX == this.posX && oCurPolar.posY == this.posY){
ahPolarLstInfo.splice(i, 1); ahPolarLstInfo.splice(i, 1);
} }
} }
}; };
CChangesGeometryAddHandlePolar.prototype.Redo = function(){
CChangesGeometryAddHandlePolar.prototype.AddHandlePolar = function(){
this.Class.ahPolarLstInfo.push({gdRefR: this.gdRefR, minR: this.minR, maxR: this.maxR, gdRefAng: this.gdRefAng, minAng: this.minAng, maxAng: this.maxAng, posX: this.posX,posY: this.posY}); this.Class.ahPolarLstInfo.push({gdRefR: this.gdRefR, minR: this.minR, maxR: this.maxR, gdRefAng: this.gdRefAng, minAng: this.minAng, maxAng: this.maxAng, posX: this.posX,posY: this.posY});
}; };
CChangesGeometryAddHandlePolar.prototype.Undo = function(){
if(this.bReverse){
this.AddHandlePolar();
}
else{
this.RemoveHandlePolar();
}
};
CChangesGeometryAddHandlePolar.prototype.Redo = function(){
if(this.bReverse){
this.RemoveHandlePolar();
}
else{
this.AddHandlePolar();
}
};
CChangesGeometryAddHandlePolar.prototype.WriteToBinary = function(Writer){ CChangesGeometryAddHandlePolar.prototype.WriteToBinary = function(Writer){
AscFormat.writeString(Writer, this.gdRefR); AscFormat.writeString(Writer, this.gdRefR);
AscFormat.writeString(Writer, this.minR); AscFormat.writeString(Writer, this.minR);
...@@ -586,6 +707,7 @@ AscCommon.extendClass(CChangesGeometryAddAdj, AscDFH.CChangesBase); ...@@ -586,6 +707,7 @@ AscCommon.extendClass(CChangesGeometryAddAdj, AscDFH.CChangesBase);
AscFormat.writeString(Writer, this.maxAng); AscFormat.writeString(Writer, this.maxAng);
AscFormat.writeString(Writer, this.posX); AscFormat.writeString(Writer, this.posX);
AscFormat.writeString(Writer, this.posY); AscFormat.writeString(Writer, this.posY);
Writer.WriteBool(!!this.bReverse);
}; };
CChangesGeometryAddHandlePolar.prototype.ReadFromBinary = function(Reader){ CChangesGeometryAddHandlePolar.prototype.ReadFromBinary = function(Reader){
this.gdRefR = AscFormat.readString(Reader); this.gdRefR = AscFormat.readString(Reader);
...@@ -596,35 +718,53 @@ AscCommon.extendClass(CChangesGeometryAddAdj, AscDFH.CChangesBase); ...@@ -596,35 +718,53 @@ AscCommon.extendClass(CChangesGeometryAddAdj, AscDFH.CChangesBase);
this.maxAng = AscFormat.readString(Reader); this.maxAng = AscFormat.readString(Reader);
this.posX = AscFormat.readString(Reader); this.posX = AscFormat.readString(Reader);
this.posY = AscFormat.readString(Reader); this.posY = AscFormat.readString(Reader);
this.bReverse = Reader.GetBool();
};
CChangesGeometryAddHandlePolar.prototype.CreateReverseChange = function(){
return new CChangesGeometryAddHandlePolar(this.Class, this.gdRefR, this.minR, this.maxR, this.gdRefAng, this.minAng, this.maxAng, this.posX, this.posY, !this.bReverse);
}; };
AscDFH.changesFactory[AscDFH.historyitem_GeometryAddHandlePolar] = CChangesGeometryAddHandlePolar; AscDFH.changesFactory[AscDFH.historyitem_GeometryAddHandlePolar] = CChangesGeometryAddHandlePolar;
function CChangesGeometryAddRect(Class, l, t, r, b){ function CChangesGeometryAddRect(Class, l, t, r, b, bReverse){
this.Type = AscDFH.historyitem_GeometryAddRect; this.Type = AscDFH.historyitem_GeometryAddRect;
this.l = l; this.l = l;
this.t = t; this.t = t;
this.r = r; this.r = r;
this.b = b; this.b = b;
this.bReverse = bReverse;
CChangesGeometryAddRect.superclass.constructor.call(this, Class); CChangesGeometryAddRect.superclass.constructor.call(this, Class);
} }
AscCommon.extendClass(CChangesGeometryAddRect, AscDFH.CChangesBase); AscCommon.extendClass(CChangesGeometryAddRect, AscDFH.CChangesBase);
CChangesGeometryAddRect.prototype.Undo = function(){ CChangesGeometryAddRect.prototype.Undo = function(){
this.Class.rectS = null; if(this.bReverse){
this.Class.rectS = {l: this.l, t: this.t, r: this.r, b: this.b};
}
else{
this.Class.rectS = null;
}
}; };
CChangesGeometryAddRect.prototype.Redo = function(){ CChangesGeometryAddRect.prototype.Redo = function(){
this.Class.rectS = {l: this.l, t: this.t, r: this.r, b: this.b}; if(this.bReverse){
this.Class.rectS = null;
}
else{
this.Class.rectS = {l: this.l, t: this.t, r: this.r, b: this.b};
}
}; };
CChangesGeometryAddRect.prototype.WriteToBinary = function(Writer){ CChangesGeometryAddRect.prototype.WriteToBinary = function(Writer){
AscFormat.writeString(Writer, this.l); AscFormat.writeString(Writer, this.l);
AscFormat.writeString(Writer, this.t); AscFormat.writeString(Writer, this.t);
AscFormat.writeString(Writer, this.r); AscFormat.writeString(Writer, this.r);
AscFormat.writeString(Writer, this.b); AscFormat.writeString(Writer, this.b);
Writer.WriteBool(!!this.bReverse);
}; };
CChangesGeometryAddRect.prototype.ReadFromBinary = function(Reader){ CChangesGeometryAddRect.prototype.ReadFromBinary = function(Reader){
this.l = AscFormat.readString(Reader); this.l = AscFormat.readString(Reader);
this.t = AscFormat.readString(Reader); this.t = AscFormat.readString(Reader);
this.r = AscFormat.readString(Reader); this.r = AscFormat.readString(Reader);
this.b = AscFormat.readString(Reader); this.b = AscFormat.readString(Reader);
this.bReverse = Reader.GetBool();
}; };
AscDFH.changesFactory[AscDFH.historyitem_GeometryAddRect] = CChangesGeometryAddRect; AscDFH.changesFactory[AscDFH.historyitem_GeometryAddRect] = CChangesGeometryAddRect;
AscDFH.changesFactory[AscDFH.historyitem_GeometrySetPreset ] = AscDFH.CChangesDrawingsString; AscDFH.changesFactory[AscDFH.historyitem_GeometrySetPreset ] = AscDFH.CChangesDrawingsString;
...@@ -655,12 +795,6 @@ function Geometry() ...@@ -655,12 +795,6 @@ function Geometry()
this.parent = null; this.parent = null;
//коэффиценты линейной связи размеров автофигуры с размерами текстового ректа
this.kW = null;
this.bW = null;
this.kH = null;
this.bH = null;
this.bDrawSmart = false; this.bDrawSmart = false;
......
...@@ -60,25 +60,37 @@ var MOVE_DELTA = AscFormat.MOVE_DELTA; ...@@ -60,25 +60,37 @@ var MOVE_DELTA = AscFormat.MOVE_DELTA;
var cToRad2 = (Math.PI/60000)/180; var cToRad2 = (Math.PI/60000)/180;
function CChangesDrawingsAddPathCommand(Class, oCommand, nIndex){ function CChangesDrawingsAddPathCommand(Class, oCommand, nIndex, bReverse){
this.Type = AscDFH.historyitem_PathAddPathCommand; this.Type = AscDFH.historyitem_PathAddPathCommand;
this.Command = oCommand; this.Command = oCommand;
this.Index = nIndex; this.Index = nIndex;
this.bReverse = bReverse;
CChangesDrawingsAddPathCommand.superclass.constructor.call(this, Class); CChangesDrawingsAddPathCommand.superclass.constructor.call(this, Class);
} }
AscCommon.extendClass(CChangesDrawingsAddPathCommand, AscDFH.CChangesBase); AscCommon.extendClass(CChangesDrawingsAddPathCommand, AscDFH.CChangesBase);
CChangesDrawingsAddPathCommand.prototype.Undo = function(){ CChangesDrawingsAddPathCommand.prototype.Undo = function(){
this.Class.ArrPathCommandInfo.splice(this.Index, 1); if(this.bReverse){
this.Class.ArrPathCommandInfo.splice(this.Index, 0, this.Command);
}
else{
this.Class.ArrPathCommandInfo.splice(this.Index, 1);
}
}; };
CChangesDrawingsAddPathCommand.prototype.Redo = function(){ CChangesDrawingsAddPathCommand.prototype.Redo = function(){
this.Class.ArrPathCommandInfo.splice(this.Index, 0, this.Command); if(this.bReverse){
this.Class.ArrPathCommandInfo.splice(this.Index, 1);
}
else{
this.Class.ArrPathCommandInfo.splice(this.Index, 0, this.Command);
}
}; };
CChangesDrawingsAddPathCommand.prototype.WriteToBinary = function(Writer){ CChangesDrawingsAddPathCommand.prototype.WriteToBinary = function(Writer){
Writer.WriteLong(this.Index); Writer.WriteLong(this.Index);
Writer.WriteLong(this.Command.id); Writer.WriteLong(this.Command.id);
Writer.WriteBool(!!this.bReverse);
switch(this.Command.id){ switch(this.Command.id){
case moveTo: case moveTo:
case lineTo: case lineTo:
...@@ -125,6 +137,7 @@ AscCommon.extendClass(CChangesDrawingsAddPathCommand, AscDFH.CChangesBase); ...@@ -125,6 +137,7 @@ AscCommon.extendClass(CChangesDrawingsAddPathCommand, AscDFH.CChangesBase);
this.Index = Reader.GetLong(); this.Index = Reader.GetLong();
this.Command = {}; this.Command = {};
this.Command.id = Reader.GetLong(); this.Command.id = Reader.GetLong();
this.bReverse = Reader.GetBool();
switch(this.Command.id){ switch(this.Command.id){
case moveTo: case moveTo:
case lineTo: case lineTo:
......
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