middleButtonMen:
authorca
Sat, 24 May 1997 05:07:29 +0200
changeset 121 96d6feeeb049
parent 120 d83c307f3bf5
child 122 c6f7d7881634
middleButtonMen: opens the menu but returns nil insteat of the menu; thus no operation could be done twice to the result returned by the menu
UIPainter.st
UIPainterView.st
--- a/UIPainter.st	Fri May 23 16:28:06 1997 +0200
+++ b/UIPainter.st	Sat May 24 05:07:29 1997 +0200
@@ -1,6 +1,6 @@
 ApplicationModel subclass:#UIPainter
 	instanceVariableNames:'objectList currentView selectionPanel tabSelection lastSlice
-		specView layoutTool emptyView fileName specClass specSelector
+		specView layoutTool fileName specClass specSelector
 		specSuperclass aspects'
 	classVariableNames:''
 	poolDictionaries:''
@@ -755,13 +755,11 @@
         noteBook   := View origin:0.0 @0.0 corner:1.0@1.0.
         layoutTool := UIPropertyView for:#Dimension     in:noteBook.
         specView   := UIPropertyView for:#Specification in:noteBook.
-        emptyView  := View origin:0.0 @0.0 corner:1.0@1.0 in:noteBook.
 
         channel := self modifiedChannel.
         layoutTool modifiedHolder:channel.
         specView   modifiedHolder:channel.
         specView   viewBackground:(layoutTool viewBackground).
-        emptyView  viewBackground:(layoutTool viewBackground).
         builder aspectAt:#noteBookView put:noteBook.
     ].
     ^ noteBook
@@ -775,7 +773,7 @@
     "returns a block which returns the menu
      !!hack!!
     "
-    ^ [ (self painter menu) startUp. nil ].
+    ^ [ self painter showMiddleButtonMenu ].
 
 
 
@@ -866,6 +864,8 @@
         (list findFirst:[:aName| aName = lastSlice]) ~~ 0 ifTrue:[
             setSel := lastSlice
         ]
+    ] ifTrue:[
+        layoutTool forView:nil
     ].
 
     specView specEdited:spec.
@@ -916,23 +916,26 @@
 tabSelection:something
     |specEdited slices spec idx|
 
-    (tabSelection := something) notNil ifTrue:[
-        (specEdited := specView specEdited) notNil ifTrue:[
-            slices    := specEdited class slices.
-            lastSlice := tabSelection.
+    something isNil ifTrue:[^ self].
+
+    tabSelection := something.
+
+    (specEdited := specView specEdited) notNil ifTrue:[
+        slices    := specEdited class slices.
+        lastSlice := tabSelection.
 
-            idx:= slices findFirst:[:aSlice| aSlice first = tabSelection ].
-            idx == 0 ifTrue:[
-                layoutTool forView:currentView.
-              ^ layoutTool raise.
-            ].
-            spec := specEdited class perform:((slices at:idx) last).
-        ]
+        idx:= slices findFirst:[:aSlice| aSlice first = tabSelection ].
+        idx == 0 ifTrue:[
+            layoutTool forView:currentView.
+          ^ layoutTool raise.
+        ].
+        spec := specEdited class perform:((slices at:idx) last).
     ].
+    specView raise.
+
     specEdited isNil ifTrue:[
-        emptyView raise
+        specView buildFromSpec:nil
     ] ifFalse:[
-        specView raise.
         specView buildFromSpec:spec
     ]
 ! !
--- a/UIPainterView.st	Fri May 23 16:28:06 1997 +0200
+++ b/UIPainterView.st	Sat May 24 05:07:29 1997 +0200
@@ -65,7 +65,7 @@
 defaultMenuMessage   
     "This message is the default yo be sent to the menuHolder to get a menu
     "
-    ^ #menu
+    ^ #showMiddleButtonMenu
 
 
 ! !
@@ -992,12 +992,32 @@
 
 !UIPainterView methodsFor:'menus'!
 
-menu
-    "returns middle-button menu dependent on the selection
+showFontPanel
+    |action theFont fontPanel|
+
+    fontPanel := FontPanel new. 
+
+    selection notNil ifTrue:[
+        action := [:aFontDescription | theFont := aFontDescription].
+        fontPanel action:action.
+        fontPanel showAtPointer.
+        fontPanel destroy.
+        theFont notNil ifTrue:[
+            self changeFont:theFont
+        ]
+    ]
+
+    "Modified: 10.4.1997 / 10:06:15 / cg"
+!
+
+showMiddleButtonMenu
+    "show the middle button menu; this returns nil
     "
     |menu canPaste|
 
-    self enabled ifFalse:[^ nil ].
+    self enabled ifFalse:[
+        ^ nil
+    ].
     menu := MenuPanel fromSpec:(self class menu) receiver:self.
 
     canPaste := self canPaste:(self getSelection).
@@ -1014,28 +1034,11 @@
     ].
 
     menu enabledAt:#undo put:(undoHistory notEmpty).
-  ^ menu
+    menu startUp.
+  ^ nil
 
 
 
-!
-
-showFontPanel
-    |action theFont fontPanel|
-
-    fontPanel := FontPanel new. 
-
-    selection notNil ifTrue:[
-        action := [:aFontDescription | theFont := aFontDescription].
-        fontPanel action:action.
-        fontPanel showAtPointer.
-        fontPanel destroy.
-        theFont notNil ifTrue:[
-            self changeFont:theFont
-        ]
-    ]
-
-    "Modified: 10.4.1997 / 10:06:15 / cg"
 ! !
 
 !UIPainterView methodsFor:'misc'!
@@ -1738,11 +1741,10 @@
     "initialize for a painter
     "
     painter := aPainter.
+    disabledChanged := false.
     self list:(OrderedCollection new).
     propertyList := OrderedCollection new.
     self selection:#().
-    disabledChanged := false.
-    painter := aPainter.
     self addDependent:painter.
 
 ! !