--- a/UIObjectView.st Tue Oct 30 15:47:54 2001 +0100
+++ b/UIObjectView.st Tue Oct 30 15:48:17 2001 +0100
@@ -2564,6 +2564,16 @@
!UIObjectView::UndoHistory methodsFor:'undo'!
+labelOfLastUndo
+ "return astring describing the last undo-action (for the menu)"
+
+ history size = 0 ifTrue:[^ '* nothing to undo *'].
+ ^ history last "actions" type
+
+ "Created: / 30.10.2001 / 13:45:28 / cg"
+ "Modified: / 30.10.2001 / 13:46:33 / cg"
+!
+
undoLast:nTransactions
"undo last n transactions; an open transaction will be closed;
transactions during undo are disabled
--- a/UIPainter.st Tue Oct 30 15:47:54 2001 +0100
+++ b/UIPainter.st Tue Oct 30 15:48:17 2001 +0100
@@ -2353,6 +2353,24 @@
"Modified: / 20.6.1998 / 16:49:16 / cg"
! !
+!UIPainter methodsFor:'menus - dynamic'!
+
+menuEdit
+ |m i|
+
+ m := self class menuEdit.
+ m := m decodeAsLiteralArray.
+ i := m detectItem:[:item | item nameKey == #undo] ifNone:nil.
+ i notNil ifTrue:[
+ i label:(i label , ' (' , self painter undoHistory labelOfLastUndo , ')')
+ ].
+ m findGuiResourcesIn:self.
+ ^ m
+
+ "Created: / 30.10.2001 / 13:29:04 / cg"
+ "Modified: / 30.10.2001 / 13:47:19 / cg"
+! !
+
!UIPainter methodsFor:'private'!
askForModification
@@ -3129,26 +3147,28 @@
addWidgetOfSpec: aSpec
"adds a widget from aSpec to the current widget"
- |newSel|
+ |newSel|
+
(newSel := self pasteSpecifications:aSpec keepLayout:false at:0@0) notNil
ifTrue:
[
- self select: newSel
+ self select: newSel
]
ifFalse:
[
- ((treeView selection size = 0) or: [treeView selectedNode isNil])
- ifTrue:
- [
- treeView selection: #(1).
- ]
- ifFalse:
- [
- treeView selectNode: (treeView detectNode: [:n| n = treeView selectedNode parent])
- ].
- self addWidgetOfSpec: aSpec
+ ((treeView selection size = 0) or: [treeView selectedNode isNil])
+ ifTrue:
+ [
+ treeView selection: #(1).
+ ]
+ ifFalse:
+ [
+ treeView selectNode: (treeView detectNode: [:n| n = treeView selectedNode parent])
+ ].
+ self addWidgetOfSpec: aSpec
]
+ "Modified: / 30.10.2001 / 13:22:25 / cg"
!
cancel