//>>built
define("dojox/drawing/manager/Undo",["dojo","../util/oo"],function(_1,oo){
return oo.declare(function(_2){
this.keys=_2.keys;
this.undostack=[];
this.redostack=[];
_1.connect(this.keys,"onKeyDown",this,"onKeyDown");
},{onKeyDown:function(_3){
if(!_3.cmmd&&!_3.ctrl){
return;
}
if(_3.keyCode==90&&!_3.shift){
this.undo();
}else{
if((_3.keyCode==90&&_3.shift)||_3.keyCode==89){
this.redo();
}
}
},add:function(_4){
_4.args=_1.mixin({},_4.args);
this.undostack.push(_4);
},apply:function(_5,_6,_7){
_1.hitch(_5,_6)(_7);
},undo:function(){
var o=this.undostack.pop();
if(!o){
return;
}
o.before();
this.redostack.push(o);
},redo:function(){
var o=this.redostack.pop();
if(!o){
return;
}
if(o.after){
o.after();
}else{
o.before();
}
this.undostack.push(o);
}});
});
