avoid repeated send-sequences
authorClaus Gittinger <cg@exept.de>
Thu, 16 Jul 1998 21:15:51 +0200
changeset 892 b200d2d9bf5e
parent 891 bafed0c2436d
child 893 09ea254a9fda
avoid repeated send-sequences
UIPainter.st
--- a/UIPainter.st	Thu Jul 16 21:11:20 1998 +0200
+++ b/UIPainter.st	Thu Jul 16 21:15:51 1998 +0200
@@ -1970,14 +1970,15 @@
 openEditMenu
     "opens a Menu Editor on current widget"
 
-    |cls selectorOrMenu editor selectedSpec|
+    |cls selectorOrMenu editor selectedSpec spec|
 
     (cls := self resolveName:specClass) isNil ifTrue:[
         self askForSaving ifFalse: [^self]
     ].
 
     cls notNil ifTrue:[
-        (selectorOrMenu := self specTool specification menuSelector) notNil ifTrue:[
+        spec := self specTool specification.
+        (selectorOrMenu := spec menuSelector) notNil ifTrue:[
             selectorOrMenu := selectorOrMenu asSymbol
         ] ifFalse:[
             "/ cg: q&d hack ...
@@ -2002,26 +2003,27 @@
 
         editor specSelector ~= selectorOrMenu ifTrue:[
             editor hasSaved ifTrue:[
-                self specTool specification menuSelector:editor specSelector.
+                spec menuSelector:editor specSelector.
                 self modifiedChannel value:true.
                 self accept
             ]
         ].
     ]
 
-    "Modified: 31.7.1997 / 14:26:13 / cg"
+    "Modified: / 16.7.1998 / 18:16:42 / cg"
 !
 
 openHierarchicalListEditor
     "opens a Hierarchical List Editor on current widget"
 
-    |selector editor|
+    |selector editor spec|
 
     (self resolveName:specClass) isNil ifTrue:[
         self askForSaving ifFalse: [^self]
     ].
 
-    (selector := self specTool specification hierarchicalList) notNil ifTrue:[
+    spec := self specTool specification.
+    (selector := spec hierarchicalList) notNil ifTrue:[
         selector := selector asSymbol
     ].
 
@@ -2031,11 +2033,13 @@
 
     editor specSelector ~= selector ifTrue:[
         editor hasSaved ifTrue:[
-            self specTool specification hierarchicalList:editor specSelector.
+            spec hierarchicalList:editor specSelector.
             self modifiedChannel value:true.
             self accept
         ]
     ]
+
+    "Modified: / 16.7.1998 / 18:15:46 / cg"
 !
 
 openSubSpecGUIPainter
@@ -2067,13 +2071,14 @@
 openTabListEditor
     "opens a Tab List Editor on current widget"
 
-    |selector editor|
+    |selector editor spec|
 
     (self resolveName:specClass) isNil ifTrue:[
         self askForSaving ifFalse: [^self]
     ].
 
-    (selector := self specTool specification listSelector) isArray 
+    spec := self specTool specification.
+    (selector := spec listSelector) isArray 
         ifTrue: [^self warn: 'Cannot open the Tab List Editor on an array!!'].
 
     editor := TabListEditor new.
@@ -2082,11 +2087,13 @@
 
     editor specSelector ~= selector ifTrue:[
         editor hasSaved ifTrue:[
-            self specTool specification listSelector:editor specSelector.
+            spec listSelector:editor specSelector.
             self modifiedChannel value:true.
             self accept.
         ]
     ]
+
+    "Modified: / 16.7.1998 / 18:15:14 / cg"
 ! !
 
 !UIPainter methodsFor:'change & update'!
@@ -2122,37 +2129,43 @@
 update:something with:aParameter from:someObject
     "catches change notifications"
 
+    |window|
+
     someObject == treeView model ifTrue:[
         (something == #selection
         or:[something == #selectionIndex]) ifTrue:[self treeSelection].
       ^ self
     ].
 
-    self galleryShown == someObject ifTrue:[
-        (self galleryShown value) ifTrue:[
-            self raiseUIView:(selectionPanel window)
+    someObject == self galleryShown ifTrue:[
+        "/ galleryShown toggle changed
+        window := selectionPanel window.
+        (someObject value) ifTrue:[
+            self raiseUIView:window
         ] ifFalse:[
-            self hideUIView:(selectionPanel window)
+            self hideUIView:window
         ].
       ^ self
     ].
 
-    self painterShown == someObject ifTrue:[
-        (self painterShown value) ifTrue:[
-            self raiseUIView:(self painter topView)
+    someObject == self painterShown ifTrue:[
+        "/ canvasShown toggle changed
+        window := self painter topView.
+        (someObject value) ifTrue:[
+            self raiseUIView:window
         ] ifFalse:[
-            self hideUIView:(self painter topView)
+            self hideUIView:window
         ].
       ^ self
     ].
 
-    "Modified: / 29.10.1997 / 17:48:19 / cg"
+    "Modified: / 16.7.1998 / 19:09:57 / cg"
 !
 
 updateChannels
     "updates the channels"
 
-    |canCutOrCopy canPaste clipboard sel|
+    |canCutOrCopy canPaste clipboard sel treeSelection|
 
     self canMoveOrAlignSelection        value:(treeView canMoveOrAlignSelection).
     self canChangeOrderInContainer      value:(treeView canChangeOrderInContainer).
@@ -2163,15 +2176,17 @@
     treeView notNil
     ifTrue:
     [
-        canCutOrCopy := treeView selection size >= 1 and:[treeView selection first ~~ 1].
+        treeSelection := treeView selection.
+        "/ the top-node cannot be cut, copied or pasted.
+        canCutOrCopy := treeSelection size >= 1 and:[treeSelection first ~~ 1].
         clipboard := self getSelection.
 
         clipboard isCollection ifTrue:[clipboard notEmpty ifTrue:[sel := clipboard first]]
                               ifFalse:[sel := clipboard].
 
         canPaste := (sel isKindOf:UISpecification) and: 
-                    [treeView selection size  = 1 
-                    and:[treeView selection first == 1 
+                    [treeSelection size  = 1 
+                    and:[treeSelection first == 1 
                     or: [self canPasteInto: treeView selectedNode contents view]]]
     ].
 
@@ -2179,6 +2194,8 @@
     self valueOfCanCopy value: canCutOrCopy.
     self valueOfCanPaste value: canPaste.            
     self valueOfCanPasteWithKeepingLayout value: (canPaste "&  self canKeepLayoutInSelection").
+
+    "Modified: / 16.7.1998 / 19:13:30 / cg"
 ! !
 
 !UIPainter methodsFor:'event handling'!
@@ -2955,7 +2972,7 @@
 doDefineClassAndSelector
     "launches a dialog for defining class, superclass, and selector of the application"
 
-    |again tmp helpDict helpKey|
+    |again tmp helpDict helpKey helpTool|
 
     [
         again := false.
@@ -2992,16 +3009,19 @@
     specClass := specClass isBehavior ifTrue:[specClass name]
                                       ifFalse:[specClass].
 
-    helpDict := self helpTool dictionary.
-    helpKey  := self helpTool helpKey.
-    self helpTool buildFromClass:specClass.    
-    self helpTool dictionary declareAllFrom: helpDict.
-    self helpTool updateList.
-    self helpTool helpKey: helpKey.
+    helpTool := self helpTool.
+    helpDict := helpTool dictionary.
+    helpKey  := helpTool helpKey.
+    helpTool buildFromClass:specClass.    
+    helpTool dictionary declareAllFrom: helpDict.
+    helpTool updateList.
+    helpTool helpKey: helpKey.
     self modifiedChannel value: false.
-    self helpTool modified: true.
+    helpTool modified: true.
 
     self updateInfoLabel
+
+    "Modified: / 16.7.1998 / 18:26:33 / cg"
 !
 
 doDefineGrid