Commit dc2440e8 authored by Sergey.Luzyanin's avatar Sergey.Luzyanin Committed by Alexander.Trofimov

Undo/Redo для DrawingObjects

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@47952 954022d7-b5bf-4e40-9824-e11837661b57
parent 4f7cb983
......@@ -22,9 +22,19 @@ DrawingObjectsController.prototype =
this.curState = newState;
},
recalculateCurPos: function()
{
if(this.curState.id === STATES_ID_TEXT_ADD)
this.curState.textObject.recalculateCurPos();
},
onMouseDown: function(e, x, y)
{
this.curState.onMouseDown(e, x, y);
if(e.ClickCount < 2)
{
this.recalculateCurPos()
}
},
onMouseMove: function(e, x, y)
......
......@@ -214,6 +214,11 @@ function CDocumentContent(Parent, DrawingDocument, X, Y, XLimit, YLimit, Split,
CDocumentContent.prototype =
{
getType: function()
{
return CLASS_TYPE_DOCUMENT_CONTENT;
},
Set_Id : function(newId)
{
g_oTableId.Reset_Id( this, newId, this.Id );
......
......@@ -2908,42 +2908,43 @@ function CXfrm()
this.setPosition = function(posX, posY, model_id)
{
History.Add(g_oUndoRedoDrawingObject, historyitem_AutoShapes_Offset, model_id, null, {object: this, data:{oldX: this.offX, oldY: this.offY, newX: posX, newY: posY}});
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_Offset, model_id, null, new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOPairProps(this.offX, this.offY, posX, posY)));
this.offX = posX;
this.offY = posY;
};
this.setExtents = function(extX, extY, model_id)
{
History.Add(g_oUndoRedoDrawingObject, historyitem_AutoShapes_Extents, model_id, null, {object: this, data:{oldExtX: this.extX, oldExtY: this.extY, newExtX: extX, newExtY: extY}});
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_Extents, model_id, null, new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOPairProps(this.extX, this.extY, extX, extY)));
this.extX = extX;
this.extY = extY;
};
this.setChildOffsets = function(chOffX, chOffY, model_id)
{
History.Add(g_oUndoRedoDrawingObject, historyitem_AutoShapes_Child_Offset, model_id, null, {object: this, data:{oldChOffX: this.chOffX, oldChOffY: this.chOffY, newChOffX: chOffX, newChOffY: chOffY}});
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_Child_Offset, model_id, null, new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOPairProps(this.chOffX, this.chOffY, chOffX, chOffY)));
this.chOffX = chOffX;
this.chOffY = chOffY;
};
this.setChildExtents = function(chExtX, chExtY, model_id)
{
History.Add(g_oUndoRedoDrawingObject, historyitem_AutoShapes_Child_Extents, model_id, null, {object: this, data:{oldChExtX: this.chExtX, oldChExtY: this.chExtY, newChOffX: chExtX, newChOffY: chExtY}});
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_Child_Extents, model_id, null, new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOPairProps(this.chExtX, this.chExtY, chExtX, chExtY)));
this.chExtX = chExtX;
this.chExtY = chExtY;
};
this.setFlips = function(flipH, flipV, model_id)
{
History.Add(g_oUndoRedoDrawingObject, historyitem_AutoShapes_Flips, model_id, null, {object: this, data:{oldFlipH: this.flipH, oldFlipV: this.flipV, newFlipH: flipH, newFlipV: flipV}});
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_Flips, model_id, null, new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOPairProps(this.flipH, this.flipV, flipH, flipV)));
this.flipH = flipH;
this.flipV = flipV;
};
this.setRotate = function(rot, model_id)
{
History.Add(g_oUndoRedoDrawingObject, historyitem_AutoShapes_Flips, model_id, null, {object: this, data:{oldRot: this.rot, newRot: rot}});
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_Rotate, model_id, null, new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(this.rot, rot)));
this.rot = rot;
};
......@@ -2955,7 +2956,110 @@ function CXfrm()
this.setChildExtents(xfrm.chExtX, xfrm.chExtY);
this.setFlips(xfrm.flipH, xfrm.flipV);
this.setRotate(xfrm.rot);
};
this.Get_Id = function()
{
return this.Id;
};
this.Undo = function(type, data)
{
switch (type)
{
case historyitem_AutoShapes_Offset:
{
this.offX = data.oldValue1;
this.offY = data.oldValue2;
break;
}
case historyitem_AutoShapes_Extents:
{
this.extX = data.oldValue1;
this.extY = data.oldValue2;
break;
}
case historyitem_AutoShapes_Child_Offset:
{
this.chOffX = data.oldValue1;
this.chOffY = data.oldValue2;
break;
}
case historyitem_AutoShapes_Child_Extents:
{
this.chExtX = data.oldValue1;
this.chExtY = data.oldValue2;
break;
}
case historyitem_AutoShapes_Flips:
{
this.flipH = data.oldValue1;
this.flipV = data.oldValue2;
break;
}
case historyitem_AutoShapes_Rotate:
{
this.rot = data.oldValue;
break;
}
}
};
this.Redo = function(type, data)
{
switch (type)
{
case historyitem_AutoShapes_Offset:
{
this.offX = data.newValue1;
this.offY = data.newValue2;
break;
}
case historyitem_AutoShapes_Extents:
{
this.extX = data.newValue1;
this.extY = data.newValue2;
break;
}
case historyitem_AutoShapes_Child_Offset:
{
this.chOffX = data.newValue1;
this.chOffY = data.newValue2;
break;
}
case historyitem_AutoShapes_Child_Extents:
{
this.chExtX = data.newValue1;
this.chExtY = data.newValue2;
break;
}
case historyitem_AutoShapes_Flips:
{
this.flipH = data.newValue1;
this.flipV = data.newValue2;
break;
}
case historyitem_AutoShapes_Rotate:
{
this.rot = data.newValue;
break;
}
}
};
this.getObjectType = function()
{
return CLASS_TYPE_XFRM;
};
this.Id = g_oIdCounter.Get_NewId();
g_oTableId.Add(this, this.Id);
}
function CSpPr()
......
......@@ -469,11 +469,17 @@ function CGeometry()
return _duplicate;
};
this.Id = g_oIdCounter.Get_NewId();
g_oTableId.Add(this, this.Id);
}
CGeometry.prototype=
{
getObjectType: function()
{
return CLASS_TYPE_GEOMETRY;
},
Write_ToBinary: function(Writer)
{
......@@ -913,12 +919,15 @@ CGeometry.prototype=
AddAdj: function(name, formula, x, y, z)
{
History.Add(g_oUndoRedoGraphicObjects, this, historyitem_AutoShapes_Add_Adjustment, null, null, new UndoRedoDataGraphicObjects(this.Id, new UndoRedoDataAddAdjustment(name, x)), null);
this.gdLst[name] = parseInt(x);
this.avLst[name]=true;
this.avLst[name] = true;
},
AddGuide: function(name, formula, x, y, z)
{
History.Add(g_oUndoRedoGraphicObjects, this, historyitem_AutoShapes_Add_Guide, null, null, new UndoRedoDataGraphicObjects(this.Id, new UndoRedoDataAddGuide(name, formula, x, y, z)), null);
this.gdLstInfo.push(
{
name: name,
......@@ -932,6 +941,7 @@ CGeometry.prototype=
AddCnx: function(ang, x, y)
{
History.Add(g_oUndoRedoGraphicObjects, this, historyitem_AutoShapes_Add_Cnx, null, null, new UndoRedoDataGraphicObjects(this.Id, new UndoRedoDataAddCnx(ang, x, y)), null);
this.cnxLstInfo.push(
{
ang:ang,
......@@ -942,6 +952,7 @@ CGeometry.prototype=
AddHandleXY: function(gdRefX, minX, maxX, gdRefY, minY, maxY, posX, posY)
{
History.Add(g_oUndoRedoGraphicObjects, this, historyitem_AutoShapes_Add_Handle_XY, null, null, new UndoRedoDataGraphicObjects(this.Id, new UndoRedoDataAddHandleXY(gdRefX, minX, maxX, gdRefY, minY, maxY, posX, posY)), null);
this.ahXYLstInfo.push(
{
gdRefX:gdRefX,
......@@ -959,6 +970,7 @@ CGeometry.prototype=
AddHandlePolar: function(gdRefAng, minAng, maxAng, gdRefR, minR, maxR, posX, posY)
{
History.Add(g_oUndoRedoGraphicObjects, this, historyitem_AutoShapes_Add_Handle_Polar, null, null, new UndoRedoDataGraphicObjects(this.Id, new UndoRedoDataAddHandlePolar(gdRefAng, minAng, maxAng, gdRefR, minR, maxR, posX, posY)), null);
this.ahPolarLstInfo.push(
{
gdRefAng:gdRefAng,
......@@ -976,11 +988,12 @@ CGeometry.prototype=
AddPathCommand: function(command, x1, y1, x2, y2, x3, y3)
{
// History.Add(g_oUndoRedoGraphicObjects, this, historyitem_AutoShapes_Add_Path_Command, null, null, new UndoRedoDataGraphicObjects(this.Id, new UndoRedoDataAddPathCommand(command, x1, y1, x2, y2, x3, y3)), null);
switch(command)
{
case 0:
{ /* extrusionOk, fill, stroke, w, h*/
this.pathLst[this.pathLst.length] = new Path(x1, y1, x2, y2, x3);
this.AddPath(new Path(x1, y1, x2, y2, x3));
break;
}
case 1:
......@@ -1015,8 +1028,15 @@ CGeometry.prototype=
}
},
AddPath: function(path)
{
History.Add(g_oUndoRedoGraphicObjects, this, historyitem_AutoShapes_Add_Path, null, null, new UndoRedoDataGraphicObjects(this.Id, new UndoRedoDataAddObject(path.Id)), null);
this.pathLst.push(path);
},
AddRect: function(l, t, r, b)
{
History.Add(g_oUndoRedoGraphicObjects, this, historyitem_AutoShapes_Add_GeometryRect, null, null, new UndoRedoDataGraphicObjects(this.Id, new UndoRedoDataAddGeometryRect(l, t, r, b)), null);
this.rectS = {};
this.rectS.l = l;
this.rectS.t = t;
......@@ -1321,34 +1341,152 @@ CGeometry.prototype=
}
},
Undo: function(data)
Undo: function(type, data)
{
switch(data.Type)
switch(type)
{
case historyitem_SetGuideValue:
case historyitem_AutoShapes_Add_Adjustment:
{
this.gdLst[data.guideName] = data.oldValue;
delete this.gdLst[data.name];
break;
}
case historyitem_AutoShapes_Add_Guide:
{
var gd_lst = this.gdLstInfo;
for(var i = gd_lst.length - 1; i > -1; --i)
{
if(isRealObject(gd_lst[i]) && gd_lst[i].name === data.name)
{
gd_lst.splice(i, 1);
break;
}
}
break;
}
},
Redo: function(data)
case historyitem_AutoShapes_Add_Cnx:
{
switch(data.Type)
var cnx_lst = this.cnxLstInfo;
for(var i = cnx_lst.length - 1; i > -1; --i)
{
case historyitem_SetGuideValue:
if(isRealObject(cnx_lst[i]) && cnx_lst[i].ang === data.ang && cnx_lst.x === data.x && cnx_lst.y === data.y)
{
cnx_lst.splice(i, 1);
}
}
break;
}
case historyitem_AutoShapes_Add_Path:
{
this.pathLst.splice(this.pathLst.length - 1, 1);
break;
}
case historyitem_AutoShapes_Add_GeometryRect:
{
this.gdLst[data.guideName] = data.newValue;
delete this.rectS.l;
delete this.rectS.t;
delete this.rectS.r;
delete this.rectS.b;
break;
}
}
},
Save_Changes: function(data, writer)
{},
Redo: function(type, data)
{
switch(data.Type)
{
case historyitem_AutoShapes_Add_Adjustment:
{
this.gdLst[data.name] = data.val;
break;
}
case historyitem_AutoShapes_Add_Guide:
{
this.gdLstInfo.push(
{
name: data.name,
formula: data.formula,
x: data.x,
y: data.y,
z: data.z,
isAdj: false
});
break;
}
case historyitem_AutoShapes_Add_Cnx:
{
this.cnxLstInfo.push(
{
ang: data.ang,
x: data.x,
y: data.y
}
);
break;
}
case historyitem_AutoShapes_Add_Path_Command:
{
switch(data.command)
{
case 0:
{ /* extrusionOk, fill, stroke, w, h*/
this.pathLst[this.pathLst.length] = new Path(data.x1, data.y1, data.x2, data.y2, data.x3);
break;
}
case 1:
{
this.pathLst[this.pathLst.length-1].moveTo(data.x1, data.y1);
break;
}
case 2:
{
this.pathLst[this.pathLst.length-1].lnTo(data.x1, data.y1);
break;
}
case 3:
{
this.pathLst[this.pathLst.length-1].arcTo(data.x1/*wR*/, data.y1/*hR*/, data.x2/*stAng*/, data.y2/*swAng*/);
break;
}
case 4:
{
this.pathLst[this.pathLst.length-1].quadBezTo(data.x1, data.y1, data.x2, data.y2);
break;
}
case 5:
{
this.pathLst[this.pathLst.length-1].cubicBezTo(data.x1, data.y1, data.x2, data.y2, data.x3, data.y3);
break;
}
case 6:
{
this.pathLst[this.pathLst.length-1].close();
}
}
break;
}
case historyitem_AutoShapes_Add_Path:
{
var path = g_oTableId.Get_ById(data.objectId);
if(isRealObject(path))
this.pathLst.push(path);
break;
}
case historyitem_AutoShapes_Add_GeometryRect:
{
this.rectS.l = data.l;
this.rectS.t = data.t;
this.rectS.r = data.r;
this.rectS.b = data.b;
break;
}
}
},
hit: function(x, y)
{
......
......@@ -49,6 +49,11 @@ function CGroupShape(drawingBase, drawingObjects)
CGroupShape.prototype =
{
getObjectType: function()
{
return CLASS_TYPE_GROUP;
},
isShape: function()
{
return false;
......
......@@ -74,6 +74,12 @@ function CImage(drawingBase, drawingObjects)
CImage.prototype =
{
getObjectType: function()
{
return CLASS_TYPE_IMAGE;
},
isShape: function()
{
return false;
......@@ -711,5 +717,34 @@ CImage.prototype =
drawAdjustments: function(drawingDocument)
{
},
Undo: function(type, data)
{
switch (type)
{
case historyitem_AutoShapes_RecalculateTransformUndo:
{
this.recalculateTransform();
this.calculateContent();
this.calculateTransformTextMatrix();
break;
}
}
},
Redo: function(type, data)
{
switch (type)
{
case historyitem_AutoShapes_RecalculateTransformRedo:
{
this.recalculateTransform();
this.calculateContent();
this.calculateTransformTextMatrix();
break;
}
}
}
};
\ No newline at end of file
......@@ -46,11 +46,19 @@ function Path(extrusionOk, fill, stroke, w, h)
duplicate.ArrPathCommand[i] = clonePrototype(this.ArrPathCommand[i]);
} */
return duplicate;
}
};
this.Id = g_oIdCounter.Get_NewId();
g_oTableId.Add(this, this.Id);
}
Path.prototype = {
getObjectType: function()
{
return CLASS_TYPE_PATH;
},
Write_ToBinary2: function(writer)
{
writer.WriteBool(this.stroke);
......@@ -233,6 +241,8 @@ Path.prototype = {
x=parseInt(x,10);
if(!isNaN(parseInt(y,10)))
y=parseInt(y,10);
History.Add(g_oUndoRedoGraphicObjects, this, historyitem_AutoShapes_Add_PathMoveTo, null, null, new UndoRedoDataGraphicObjects(this.Id, new UndoRedoDataMoveToLineTo(x, y, true)), null);
this.ArrPathCommandInfo.push({id:moveTo, X:x, Y:y});
},
......@@ -242,6 +252,8 @@ Path.prototype = {
x=parseInt(x,10);
if(!isNaN(parseInt(y,10)))
y=parseInt(y,10);
History.Add(g_oUndoRedoGraphicObjects, this, historyitem_AutoShapes_Add_PathLineTo, null, null, new UndoRedoDataGraphicObjects(this.Id, new UndoRedoDataMoveToLineTo(x, y, false)), null);
this.ArrPathCommandInfo.push({id:lineTo, X:x, Y:y});
},
......@@ -256,6 +268,9 @@ Path.prototype = {
stAng=parseInt(stAng,10);
if(!isNaN(parseInt(swAng,10)))
swAng=parseInt(swAng,10);
History.Add(g_oUndoRedoGraphicObjects, this, historyitem_AutoShapes_Add_PathArcTo, null, null, new UndoRedoDataGraphicObjects(this.Id, new UndoRedoDataArcTo(wR, hR, stAng, swAng)), null);
this.ArrPathCommandInfo.push({id: arcTo, wR: wR, hR: hR, stAng: stAng, swAng: swAng});
},
......@@ -270,6 +285,7 @@ Path.prototype = {
x1=parseInt(x1,10);
if(!isNaN(parseInt(y1,10)))
y1=parseInt(y1,10);
History.Add(g_oUndoRedoGraphicObjects, this, historyitem_AutoShapes_Add_PathQuadBezTo, null, null, new UndoRedoDataGraphicObjects(this.Id, new UndoRedoDataQuadBezTo(x0, y0, x1, y1)), null);
this.ArrPathCommandInfo.push({id:bezier3, X0:x0, Y0:y0, X1:x1, Y1:y1});
},
......@@ -289,11 +305,13 @@ Path.prototype = {
x2=parseInt(x2,10);
if(!isNaN(parseInt(y2,10)))
y2=parseInt(y2,10);
History.Add(g_oUndoRedoGraphicObjects, this, historyitem_AutoShapes_Add_PathCubicBezTo, null, null, new UndoRedoDataGraphicObjects(this.Id, new UndoRedoDataCubicBezTo(x0, y0, x1, y1, x2, y2)), null);
this.ArrPathCommandInfo.push({id:bezier4, X0:x0, Y0:y0, X1:x1, Y1:y1, X2:x2, Y2:y2});
},
close: function()
{
History.Add(g_oUndoRedoGraphicObjects, this, historyitem_AutoShapes_Add_PathClose, null, null, new UndoRedoDataGraphicObjects(this.Id, new UndoRedoDataClosePath()), null);
this.ArrPathCommandInfo.push({id:close});
},
......@@ -1030,6 +1048,52 @@ Path.prototype = {
graphics._z();
graphics.ds();
}
},
Undo: function(type, data)
{
switch(type)
{
case historyitem_AutoShapes_Add_PathMoveTo:
case historyitem_AutoShapes_Add_PathLineTo:
case historyitem_AutoShapes_Add_PathArcTo:
case historyitem_AutoShapes_Add_PathQuadBezTo:
case historyitem_AutoShapes_Add_PathCubicBezTo:
{
this.ArrPathCommandInfo.splice(this.ArrPathCommandInfo.length - 1, 1);
}
}
},
Redo: function(type, data)
{
switch (type)
{
case historyitem_AutoShapes_Add_PathMoveTo:
{
this.ArrPathCommandInfo.push({id:moveTo, x: data.x, y: data.y});
break;
}
case historyitem_AutoShapes_Add_PathLineTo:
{
this.ArrPathCommandInfo.push({id:lineTo, x: data.x, y: data.y});
break;
}
case historyitem_AutoShapes_Add_PathArcTo:
{
this.ArrPathCommandInfo.push({id:arcTo, wR: data.wR, hR: data.hR, stAng: data.stAng, swAng: data.swAng});
break;
}
case historyitem_AutoShapes_Add_PathClose:
{
this.ArrPathCommandInfo.push({id: close});
break;
}
}
}
};
......
......@@ -158,11 +158,19 @@ function CShape(drawingBase, drawingObjects)
this.pen = null;
this.selected = false;
this.Id = g_oIdCounter.Get_NewId();
g_oTableId.Add(this, this.Id);
}
CShape.prototype =
{
getObjectType: function()
{
return CLASS_TYPE_SHAPE;
},
isShape: function()
{
return true;
......@@ -239,6 +247,12 @@ CShape.prototype =
this.txBody.updateSelectionState(drawingDocument);
},
recalculateCurPos: function()
{
if(this.txBody)
this.txBody.recalculateCurPos();
},
setExtents: function(extX, extY)
{
var model_id = this.drawingObjects.getWorksheet().model.getId();
......@@ -1369,6 +1383,35 @@ CShape.prototype =
this.setSyle(new CShapeStyle());
this.style.copyFromOther(sp.style);
}
},
Undo: function(type, data)
{
switch (type)
{
case historyitem_AutoShapes_RecalculateTransformUndo:
{
this.recalculateTransform();
this.calculateContent();
this.calculateTransformTextMatrix();
break;
}
}
},
Redo: function(type, data)
{
switch (type)
{
case historyitem_AutoShapes_RecalculateTransformRedo:
{
this.recalculateTransform();
this.calculateContent();
this.calculateTransformTextMatrix();
break;
}
}
}
};
\ No newline at end of file
......@@ -187,6 +187,12 @@ CTxBody.prototype =
}
},
recalculateCurPos: function()
{
this.content.RecalculateCurPos();
},
drawTextSelection: function()
{
this.content.Selection_Draw_Page(0);
......
......@@ -458,6 +458,7 @@ function RotateState(drawingObjectsController, drawingObjects, majorObject)
this.onMouseUp = function(e, x, y)
{
History.Create_NewPoint();
this.drawingObjectsController.trackEnd();
this.drawingObjectsController.clearTrackObjects();
this.drawingObjects.selectGraphicObject();
......@@ -553,6 +554,7 @@ function ResizeState(drawingObjectsController, drawingObjects, majorObject, card
this.onMouseUp = function(e, x, y)
{
History.Create_NewPoint();
this.drawingObjectsController.trackEnd();
this.drawingObjectsController.clearTrackObjects();
this.drawingObjects.selectGraphicObject();
......@@ -926,6 +928,7 @@ function MoveState(drawingObjectsController, drawingObjects, startX, startY, rec
this.onMouseUp = function(e, x, y)
{
History.Create_NewPoint();
this.drawingObjectsController.trackEnd();
this.drawingObjectsController.clearTrackObjects();
this.drawingObjects.selectGraphicObject();
......
......@@ -45,9 +45,12 @@ function MoveShapeImageTrack(originalObject)
this.trackEnd = function()
{
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformUndo, null, null, new UndoRedoDataGraphicObjects(this.originalObject.Id, new UndoRedoDataShapeRecalc()), null);
this.originalObject.setPosition(this.x, this.y);
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformRedo, null, null, new UndoRedoDataGraphicObjects(this.originalObject.Id, new UndoRedoDataShapeRecalc()), null);
this.originalObject.recalculateTransform();
this.originalObject.calculateTransformTextMatrix();
this.originalObject.updateDrawingBaseCoordinates();
};
}
......
......@@ -586,9 +586,12 @@ function ResizeTrackShapeImage(originalObject, cardDirection)
this.trackEnd = function()
{
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformUndo, null, null, new UndoRedoDataGraphicObjects(this.originalObject.Id, new UndoRedoDataShapeRecalc()), null);
this.originalObject.setPosition(this.resizedPosX, this.resizedPosY);
this.originalObject.setExtents(this.resizedExtX, this.resizedExtY);
this.originalObject.setFlips(this.resizedflipH, this.resizedflipV);
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformRedo, null, null, new UndoRedoDataGraphicObjects(this.originalObject.Id, new UndoRedoDataShapeRecalc()), null);
this.originalObject.recalculateTransform();
this.originalObject.calculateContent();
this.originalObject.calculateTransformTextMatrix();
......
......@@ -121,7 +121,9 @@ function RotateTrackShapeImage(originalObject)
this.trackEnd = function()
{
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformUndo, null, null, new UndoRedoDataGraphicObjects(this.originalObject.Id, new UndoRedoDataShapeRecalc()), null);
this.originalObject.setRotate(this.angle);
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformRedo, null, null, new UndoRedoDataGraphicObjects(this.originalObject.Id, new UndoRedoDataShapeRecalc()), null);
this.originalObject.recalculateTransform();
this.originalObject.calculateContent();
this.originalObject.calculateTransformTextMatrix();
......
......@@ -83,6 +83,25 @@ var historyitem_AutoShapes_Child_Extents = 4;
var historyitem_AutoShapes_Rotate = 5;
var historyitem_AutoShapes_Flips = 6;
var historyitem_AutoShapes_SetGuideValue = 7;
var historyitem_AutoShapes_RecalculateTransformUndo = 8;
var historyitem_AutoShapes_RecalculateTransformRedo = 9;
var historyitem_AutoShapes_Add_Adjustment = 10;
var historyitem_AutoShapes_Add_Guide = 11;
var historyitem_AutoShapes_Add_Cnx = 12;
var historyitem_AutoShapes_Add_Handle_XY = 13;
var historyitem_AutoShapes_Add_Handle_Polar = 14;
var historyitem_AutoShapes_Add_Path_Command = 15;
var historyitem_AutoShapes_Add_Path = 16;
var historyitem_AutoShapes_Add_GeometryRect = 17;
var historyitem_AutoShapes_Add_PathMoveTo = 18;
var historyitem_AutoShapes_Add_PathLineTo = 19;
var historyitem_AutoShapes_Add_PathArcTo = 20;
var historyitem_AutoShapes_Add_PathQuadBezTo = 21;
var historyitem_AutoShapes_Add_PathCubicBezTo = 22;
var historyitem_AutoShapes_Add_PathClose = 23;
var historyitem_Comment_Add = 1;
var historyitem_Comment_Remove = 2;
......
......@@ -345,7 +345,11 @@ var UndoRedoDataTypes = new function() {
this.GOAddPathCommand = 54;
this.GOAddObject = 55;
this.GOAddGeometryRect = 56;
this.GOPathLineToMoveTo = 57;
this.GOPathArcTo = 58;
this.GOPathQuadBezTo = 59;
this.GOPathCubicBezTo = 60;
this.GOPathClose = 61;
this.Create = function(nType)
{
......@@ -407,6 +411,11 @@ var UndoRedoDataTypes = new function() {
case this.GOAddPathCommand: return new UndoRedoDataAddPathCommand(); break;
case this.GOAddObject: return new UndoRedoDataAddObject(); break;
case this.GOAddGeometryRect: return new UndoRedoDataAddGeometryRect(); break;
case this.GOPathLineToMoveTo: return new UndoRedoDataMoveToLineTo();break;
case this.GOPathArcTo: return new UndoRedoDataArcTo(); break;
case this.GOPathQuadBezTo: return new UndoRedoDataQuadBezTo(); break;
case this.GOPathCubicBezTo: return new UndoRedoDataCubicBezTo(); break;
case this.GOPathClose: return new UndoRedoDataClosePath(); break;
}
return null;
......@@ -1828,6 +1837,240 @@ UndoRedoDataAddObject.prototype =
}
};
function UndoRedoDataMoveToLineTo(x, y, bMoveTo)
{
this.Properties = {
x: 0,
y: 1,
bMoveTo: 2
};
this.x = x;
this.y = y;
this.bMoveTo = bMoveTo;
}
UndoRedoDataMoveToLineTo.prototype =
{
getType : function ()
{
return UndoRedoDataTypes.GOPathLineToMoveTo;
},
getProperties : function ()
{
return this.Properties;
},
getProperty : function (nType)
{
switch (nType)
{
case this.Properties.x: return this.x;
case this.Properties.y: return this.y;
case this.Properties.bMoveTo: return this.bMoveTo;
}
return null;
},
setProperty : function (nType, value)
{
switch (nType)
{
case this.Properties.x: this.x = value; break;
case this.Properties.y: this.y = value; break;
case this.Properties.bMoveTo: this.bMoveTo = value; break;
}
}
};
function UndoRedoDataArcTo(wR, hR, stAng, swAng)
{
this.Properties = {
wR: 0,
hR: 1,
stAng: 2,
swAng: 3
};
this.wR = wR;
this.hR = hR;
this.stAng = stAng;
this.swAng = swAng;
}
UndoRedoDataArcTo.prototype =
{
getType : function ()
{
return UndoRedoDataTypes.GOPathArcTo;
},
getProperties : function ()
{
return this.Properties;
},
getProperty : function (nType)
{
switch (nType)
{
case this.Properties.wR: return this.wR;
case this.Properties.hR: return this.hR;
case this.Properties.stAng: return this.stAng;
case this.Properties.swAng: return this.swAng;
}
return null;
},
setProperty : function (nType, value)
{
switch (nType)
{
case this.Properties.wR: this.wR = value; break;
case this.Properties.hR: this.hR = value; break;
case this.Properties.stAng: this.stAng = value; break;
case this.Properties.swAng: this.swAng = value; break;
}
}
};
function UndoRedoDataQuadBezTo(x0, y0, x1, y1)
{
this.Properties = {
x0: 0,
y0: 1,
x1: 2,
y1: 3
};
this.x0 = x0;
this.y0 = y0;
this.x1 = x1;
this.y1 = y1;
}
UndoRedoDataQuadBezTo.prototype =
{
getType : function ()
{
return UndoRedoDataTypes.GOPathQuadBezTo;
},
getProperties : function ()
{
return this.Properties;
},
getProperty : function (nType)
{
switch (nType)
{
case this.Properties.x0: return this.x0;
case this.Properties.y0: return this.y0;
case this.Properties.x1: return this.x1;
case this.Properties.y1: return this.y1;
}
return null;
},
setProperty : function (nType, value)
{
switch (nType)
{
case this.Properties.x0: this.x0 = value; break;
case this.Properties.y0: this.y0 = value; break;
case this.Properties.x1: this.x1 = value; break;
case this.Properties.y1: this.y1 = value; break;
}
}
};
function UndoRedoDataCubicBezTo(x0, y0, x1, y1, x2, y2)
{
this.Properties = {
x0: 0,
y0: 1,
x1: 2,
y1: 3,
x2: 4,
y2: 5
};
this.x0 = x0;
this.y0 = y0;
this.x1 = x1;
this.y1 = y1;
this.x2 = x2;
this.y2 = y2;
}
UndoRedoDataCubicBezTo.prototype =
{
getType : function ()
{
return UndoRedoDataTypes.GOPathCubicBezTo;
},
getProperties : function ()
{
return this.Properties;
},
getProperty : function (nType)
{
switch (nType)
{
case this.Properties.x0: return this.x0;
case this.Properties.y0: return this.y0;
case this.Properties.x1: return this.x1;
case this.Properties.y1: return this.y1;
case this.Properties.x2: return this.x2;
case this.Properties.y2: return this.y2;
}
return null;
},
setProperty : function (nType, value)
{
switch (nType)
{
case this.Properties.x0: this.x0 = value; break;
case this.Properties.y0: this.y0 = value; break;
case this.Properties.x1: this.x1 = value; break;
case this.Properties.y1: this.y1 = value; break;
case this.Properties.x2: this.x2 = value; break;
case this.Properties.y2: this.y2 = value; break;
}
}
};
function UndoRedoDataClosePath()
{
this.Properties = {
};
}
UndoRedoDataClosePath.prototype =
{
getType : function ()
{
return UndoRedoDataTypes.GOPathClose;
},
getProperties : function ()
{
return this.Properties;
},
getProperty : function (nType)
{
return null;
},
setProperty : function (nType, value)
{
}
};
var g_oUndoRedoGraphicObjects = null;
......
......@@ -1393,6 +1393,7 @@ Workbook.prototype.initGlobalObjects=function(){
g_oUndoRedoDrawingObject = new UndoRedoDrawingObject(this);
g_oUndoRedoDrawingLayer = new UndoRedoDrawingLayer(this);
g_oUndoRedoAutoFilters = new UndoRedoAutoFilters(this);
g_oUndoRedoGraphicObjects = new UndoRedoGraphicObjects(this);
}
Workbook.prototype.init=function(){
if(this.nActive < 0)
......
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