Controller.st
changeset 134 1a09a1d7d28d
parent 127 98b0725782bd
child 137 523edf3204e4
--- a/Controller.st	Tue Apr 11 17:56:14 1995 +0200
+++ b/Controller.st	Wed May 03 02:04:18 1995 +0200
@@ -11,7 +11,7 @@
 "
 
 Object subclass:#Controller
-       instanceVariableNames:'model view'
+       instanceVariableNames:'model view sensor'
        classVariableNames:''
        poolDictionaries:''
        category:'Interface-Support'
@@ -21,7 +21,7 @@
 COPYRIGHT (c) 1992 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libview/Controller.st,v 1.16 1995-03-31 02:54:58 claus Exp $
+$Header: /cvs/stx/stx/libview/Controller.st,v 1.17 1995-05-03 00:01:32 claus Exp $
 '!
 
 !Controller class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libview/Controller.st,v 1.16 1995-03-31 02:54:58 claus Exp $
+$Header: /cvs/stx/stx/libview/Controller.st,v 1.17 1995-05-03 00:01:32 claus Exp $
 "
 !
 
@@ -155,10 +155,48 @@
 !
 
 menuHolder 
-    ^ nil
+    "by default, the model has to provide the menu"
+
+    ^ model
 !
 
 menuPerformer 
+    "by default, the model is performing menu actions"
+
+    ^ model
+! !
+
+!Controller methodsFor:'menus'!
+
+yellowButtonMenu
+    "actually, this should be called 'middleButtonMenu'.
+     But for ST-80 compatibility ...."
+
+    |sym menuHolder m|
+
+    (m := view middleButtonMenu) notNil ifTrue:[
+	"/
+	"/ has been assigned a static middleButtonMenu
+	"/ (or a cached menu)
+	"/
+	^ m
+    ].
+
+    menuHolder := self menuHolder.
+
+    "
+     try ST-80 style menus first:
+     if there is a model, and a menuSymbol is defined,
+     ask model for the menu and launch that if non-nil.
+    "
+    (menuHolder notNil 
+    and:[(sym := view menuSymbol) notNil
+    and:[sym isSymbol]]) ifTrue:[
+	"
+	 ask model for the menu
+	"
+	^ menuHolder perform:sym.
+    ].
     ^ nil
 ! !
 
@@ -177,39 +215,25 @@
 
     |sym menu actionSelector menuHolder menuPerformer|
 
-    (menuHolder := self menuHolder) notNil ifTrue:[
-	self halt.
-    ] ifFalse:[
-	menuHolder := model
-    ].
-    (menuPerformer := self menuPerformer) notNil ifTrue:[
-	self halt.
-    ] ifFalse:[
-	menuPerformer := model
-    ].
+    menu := self yellowButtonMenu.
+    menu notNil ifTrue:[
+	menuPerformer := self menuPerformer.
+	"
+	 got one, launch the menu. It is supposed
+	 to return an actionSelector.
+	"
+	    "
+	     a temporary kludge: subMenus dont know about 
+	     actionSelectors yet ...
+	    "
+	    menu receiver isNil ifTrue:[
+		menu receiver:menuPerformer
+	    ].
+	actionSelector := menu startUp.
 
-    "
-     try ST-80 style menus first:
-     if there is a model, and a menuSymbol is defined,
-     ask model for the menu and launch that if non-nil.
-    "
-    (menuHolder notNil 
-    and:[(sym := view menuSymbol) notNil
-    and:[sym isSymbol]]) ifTrue:[
-	"
-	 ask model for the menu
-	"
-	menu := menuHolder perform:sym.
-	menu notNil ifTrue:[
-	    "
-	     got one, launch the menu. It is supposed
-	     to return an actionSelector.
-	    "
-	    actionSelector := menu startUp.
-	    (actionSelector notNil
-	    and:[actionSelector isSymbol]) ifTrue:[
-		menuPerformer perform:actionSelector
-	    ]
+	(actionSelector notNil
+	and:[actionSelector isSymbol]) ifTrue:[
+	    menuPerformer perform:actionSelector
 	].
 	^ self
     ].