a:20:{s:9:"#provides";s:22:"dojox.sketch.UndoStack";s:9:"#resource";s:19:"sketch/UndoStack.js";s:9:"#requires";a:1:{i:0;a:2:{i:0;s:6:"common";i:1;s:19:"dojox.xml.DomParser";}}s:22:"dojox.sketch.UndoStack";a:5:{s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:6:"figure";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:66:" this.figure=figure; this._steps=[]; this._undoedSteps=[];";s:9:"classlike";b:1;s:7:"summary";s:0:"";}s:28:"dojox.sketch.UndoStack.apply";a:5:{s:9:"prototype";s:22:"dojox.sketch.UndoStack";s:4:"type";s:8:"Function";s:10:"parameters";a:3:{s:5:"state";a:1:{s:4:"type";s:0:"";}s:4:"from";a:1:{s:4:"type";s:0:"";}s:2:"to";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:1518:"dojo.provide("dojox.sketch.UndoStack"); dojo.require("dojox.xml.DomParser"); (function(){ var ta=dojox.sketch; ta.CommandTypes={ Create:"Create", Move:"Move", Modify:"Modify", Delete:"Delete", Convert:"Convert"}; dojo.declare("dojox.sketch.UndoStack",null,{ constructor: function(figure){ this.figure=figure; this._steps=[]; this._undoedSteps=[]; }, apply: function(state, from, to){ // the key here is to neutrally move from one state to another. // we let the individual functions (i.e. undo and redo) actually // determine the from and to; all we do here is implement it. // check whether this is a fullText step if(!from && !to && state.fullText){ this.figure.setValue(state.fullText); return; } var fromText=from.shapeText; var toText=to.shapeText; if(fromText.length==0&&toText.length==0){ // nothing to reapply? return; } if(fromText.length==0){ // We are creating. var o=dojox.xml.DomParser.parse(toText).documentElement; var a=this.figure._loadAnnotation(o); if(a) this.figure._add(a); return; } if(toText.length==0){ // we are deleting. var ann=this.figure.get(from.shapeId); this.figure._delete([ann],true); return; } // we can simply reinit and draw from the shape itself, // regardless of the actual command. var nann=this.figure.get(to.shapeId); var no=dojox.xml.DomParser.parse(toText).documentElement; nann.draw(no); this.figure.select(nann); return;";s:7:"summary";s:0:"";}s:26:"dojox.sketch.UndoStack.add";a:5:{s:9:"prototype";s:22:"dojox.sketch.UndoStack";s:4:"type";s:8:"Function";s:10:"parameters";a:3:{s:3:"cmd";a:1:{s:4:"type";s:6:"String";}s:3:"ann";a:2:{s:8:"optional";b:1;s:4:"type";s:13:"ta.Annotation";}s:6:"before";a:2:{s:8:"optional";b:1;s:4:"type";s:6:"String";}}s:6:"source";s:572:" var id=ann?ann.id:''; //var bbox=ann?ann.getBBox():{}; var after=ann?ann.serialize():""; if(cmd==ta.CommandTypes.Delete){ after=""; } /*if(ann){ // fix the bbox x/y coords var t=ann.transform; bbox.x+=t.dx; bbox.y+=t.dy; }*/ var state={ cmdname:cmd, //bbox:bbox, // fullText:fullText, before:{ shapeId: id, shapeText:before||'' }, after:{ shapeId: id, shapeText:after } }; //console.log('dojox.sketch history add',state); this._steps.push(state); this._undoedSteps = [];";s:7:"summary";s:0:"";}s:30:"dojox.sketch.UndoStack.destroy";a:4:{s:9:"prototype";s:22:"dojox.sketch.UndoStack";s:4:"type";s:8:"Function";s:6:"source";s:3:"} ";s:7:"summary";s:0:"";}s:27:"dojox.sketch.UndoStack.undo";a:5:{s:9:"prototype";s:22:"dojox.sketch.UndoStack";s:4:"type";s:8:"Function";s:6:"source";s:133:" var state=this._steps.pop(); if(state){ this._undoedSteps.push(state); this.apply(state,state.after,state.before); }";s:6:"chains";a:1:{s:4:"call";a:1:{i:0;s:4:"this";}}s:7:"summary";s:0:"";}s:27:"dojox.sketch.UndoStack.redo";a:5:{s:9:"prototype";s:22:"dojox.sketch.UndoStack";s:4:"type";s:8:"Function";s:6:"source";s:133:" var state=this._undoedSteps.pop(); if(state){ this._steps.push(state); this.apply(state,state.before,state.after); }";s:6:"chains";a:1:{s:4:"call";a:1:{i:0;s:4:"this";}}s:7:"summary";s:0:"";}s:35:"dojox.sketch.UndoStack._undoedSteps";a:3:{s:8:"instance";s:22:"dojox.sketch.UndoStack";s:7:"private";b:1;s:7:"summary";s:0:"";}s:29:"dojox.sketch.UndoStack.figure";a:2:{s:8:"instance";s:22:"dojox.sketch.UndoStack";s:7:"summary";s:0:"";}s:29:"dojox.sketch.UndoStack._steps";a:3:{s:8:"instance";s:22:"dojox.sketch.UndoStack";s:7:"private";b:1;s:7:"summary";s:0:"";}s:25:"dojox.sketch.CommandTypes";a:2:{s:4:"type";s:6:"Object";s:7:"summary";s:0:"";}s:32:"dojox.sketch.CommandTypes.Create";a:1:{s:7:"summary";s:0:"";}s:30:"dojox.sketch.CommandTypes.Move";a:1:{s:7:"summary";s:0:"";}s:32:"dojox.sketch.CommandTypes.Modify";a:1:{s:7:"summary";s:0:"";}s:32:"dojox.sketch.CommandTypes.Delete";a:1:{s:7:"summary";s:0:"";}s:33:"dojox.sketch.CommandTypes.Convert";a:1:{s:7:"summary";s:0:"";}s:12:"dojox.sketch";a:2:{s:4:"type";s:6:"Object";s:7:"summary";s:0:"";}s:5:"dojox";a:2:{s:4:"type";s:6:"Object";s:7:"summary";s:0:"";}}