diff pyink/MBScene.py @ 1263:1a54486c2987

Add undo points
author wycc
date Wed, 12 Jan 2011 08:31:32 +0800
parents 2609b219703d
children ff410dcdea02
line wrap: on
line diff
--- a/pyink/MBScene.py	Wed Jan 12 01:03:33 2011 +0800
+++ b/pyink/MBScene.py	Wed Jan 12 08:31:32 2011 +0800
@@ -225,24 +225,33 @@
 	
 	self._lockui = False
         pass
+
+    def markUndo(self, msg):
+	#self._domview.mark_undo(msg)
+	# FIXME: move into domview latter when the inkscpae-pybind is modified
+	#        to support the sp_document_done.
+	self.desktop.doc().done("None",msg)
     
     def doInsertKeyScene(self,w):
 	self._lockui=True
 	layer_idx, frame_idx = self._domview.get_active_layer_frame()
 	self.insertKeyScene(layer_idx, frame_idx)
 	self.selectSceneObject(layer_idx, frame_idx)
+	self.markUndo("insert key")
 	self._lockui=False
 	return
     
     def doDuplicateKeyScene(self,w):
 	self._lockui = True
         self.duplicateKeyScene()
+	self.markUndo("dup key")
 	self._lockui = False
 
     def doRemoveScene(self,w):
 	self._lockui = True
 	layer_idx, frame_idx = self._domview.get_active_layer_frame()
 	self.removeKeyScene(layer_idx, frame_idx)
+	self.markUndo("remove key")
 	self._lockui = False
 	return
 
@@ -250,6 +259,7 @@
     def doExtendScene(self,w):
 	self._lockui = True
 	self.extendScene()
+	self.markUndo("extend key")
 	self._lockui = False
 	pass
 
@@ -287,12 +297,14 @@
 	self.lockui=True
 	layer_idx, frame_idx = self._domview.get_active_layer_frame()
 	self._domview.insert_frames(layer_idx, frame_idx, 1)
+	self.markUndo("insert frame")
 	self.lockui=False
 
     def doRemoveFrame(self, w):
         self.lockui=True
 	layer_idx, frame_idx = self._domview.get_active_layer_frame()
 	self._domview.rm_frames(layer_idx, frame_idx, 1)
+	self.markUndo("remove frame")
 	self.lockui=False
 
     def do_TweenTypeChange(self, w):
@@ -308,6 +320,7 @@
 	    # Length of tween > 1 and cover this frame
 	    self._domview.chg_tween(layer_idx, start, tween_type=tween_type)
 	    pass
+	self.markUndo("change type")
 	pass
     
     def onQuit(self, event):