code cleanup
authorClaus Gittinger <cg@exept.de>
Mon, 11 May 2009 09:39:28 +0200
changeset 2509 89612a372d8b
parent 2508 d9dc378aaf8d
child 2510 0760bec5f1e3
code cleanup
UIPainterView.st
--- a/UIPainterView.st	Mon May 11 08:36:06 2009 +0200
+++ b/UIPainterView.st	Mon May 11 09:39:28 2009 +0200
@@ -2782,8 +2782,8 @@
 !UIPainterView methodsFor:'undo actions'!
 
 createUndoLayout:aView
-    "create undo action before changing a views layout
-    "
+    "create undo action before changing a views layout"
+
     |lyt args prop|
 
     undoHistory isTransactionOpen ifTrue:[
@@ -2840,6 +2840,26 @@
     ]
 !
 
+createUndoStartPointEndPoint:aComponent
+    "create an undo action before changing aComponent"
+
+    |args prop|
+
+    undoHistory isTransactionOpen ifTrue:[
+        prop := self propertyOfView:aComponent.
+
+        prop notNil ifTrue:[
+            args := Array new:4.
+            args at:1 put:(prop identifier).
+            args at:2 put:#'startPoint:endPoint:'.
+            args at:3 put:(aComponent startPoint).
+            args at:4 put:(aComponent endPoint).
+            undoHistory addUndoSelector:#undoStartPointEndPoint: withArgs:args.
+            self undoHistoryChanged.
+        ]
+    ]
+!
+
 undoCreate:something
     "undo method for creating or pasting an object
     "
@@ -2903,6 +2923,18 @@
 	self rebuildView:view fromSpec:spec withBuilder:nil.
 	treeView propertyChanged:props.
     ]
+!
+
+undoStartPointEndPoint:args
+    "undo method to set the old start/endPoint; see 'createUndoStartPointEndPoint:'
+    "
+    |view|
+
+    (view := self findViewWithId:(args at:1)) notNil ifTrue:[
+        view perform:(args at:2) with:(args at:3) with:(args at:4).
+        self elementChangedSize:view.
+        self layoutChanged.
+    ]
 ! !
 
 !UIPainterView::ViewProperty class methodsFor:'instance creation'!