undo button
authorClaus Gittinger <cg@exept.de>
Fri, 15 Jul 2005 11:34:54 +0200
changeset 1917 53832fa044f1
parent 1916 c91c39976bef
child 1918 f5e8dfe30838
undo button
UIPainter.st
--- a/UIPainter.st	Wed Jul 13 17:47:46 2005 +0200
+++ b/UIPainter.st	Fri Jul 15 11:34:54 2005 +0200
@@ -2003,7 +2003,7 @@
             labelImage: (ResourceRetriever ToolbarIconLibrary start22x22Icon)
           )
          (MenuItem
-            label: ''
+            label: '-'
           )
          (MenuItem
             activeHelpKey: fileNew
@@ -2030,7 +2030,19 @@
             labelImage: (ResourceRetriever ToolbarIconLibrary saveAsMethodIcon)
           )
          (MenuItem
-            label: ''
+            label: '-'
+          )
+         (MenuItem
+            activeHelpKey: editUndo
+            enabled: hasUndoHistoryHolder
+            label: 'Undo'
+            itemValue: undoLast
+            translateLabel: true
+            isButton: true
+            labelImage: (ResourceRetriever XPToolbarIconLibrary undoIcon)
+          )
+         (MenuItem
+            label: '-'
           )
          (MenuItem
             activeHelpKey: editCut
@@ -2070,7 +2082,7 @@
             labelImage: (ResourceRetriever ToolbarIconLibrary deleteWidgetIcon)
           )
          (MenuItem
-            label: ''
+            label: '-'
           )
          (MenuItem
             activeHelpKey: moveWidgetUp
@@ -2109,7 +2121,7 @@
             labelImage: (ResourceRetriever ToolbarIconLibrary moveWidgetLeftDownIcon)
           )
          (MenuItem
-            label: ''
+            label: '-'
             startGroup: right
           )
          (MenuItem
@@ -2338,6 +2350,10 @@
     ^ builder booleanValueAspectFor:#hasOneSelectionOtherThanCanvas
 !
 
+hasUndoHistory
+    ^ self painter hasUndoHistory
+!
+
 helpIcon
 
     ^Icon helpIcon
@@ -2808,6 +2824,26 @@
     "Modified: / 20.6.1998 / 16:49:16 / cg"
 ! !
 
+!UIPainter methodsFor:'help spec'!
+
+flyByHelpSpec
+    |spec|
+
+    spec := self class flyByHelpSpec.
+    spec at:#editUndo put:(resources string:'Undo (%1)' 
+                        with:(resources string:self painter undoHistory labelOfLastUndo)).
+    ^ spec
+!
+
+helpSpec
+    |spec|
+
+    spec := self class helpSpec.
+    spec at:#editUndo put:(resources string:'Undo (%1)' 
+                        with:(resources string:self painter undoHistory labelOfLastUndo)).
+    ^ spec
+! !
+
 !UIPainter methodsFor:'menus-dynamic'!
 
 menuEdit
@@ -2818,7 +2854,8 @@
         m := m decodeAsLiteralArray.
         i := m detectItem:[:item | item nameKey == #undo] ifNone:nil.
         i notNil ifTrue:[
-            i label:(i label , ' (' , self painter undoHistory labelOfLastUndo , ')')   
+            i label:(resources string:(i label , ' (%1)') 
+                        with:(resources string:self painter undoHistory labelOfLastUndo)).
         ].
         "/ m receiver:self.   -- now done in findGuiResources ...
         m findGuiResourcesIn:self.