--- a/MenuPanel.st Thu Apr 07 09:35:08 2011 +0200
+++ b/MenuPanel.st Mon Apr 18 15:52:32 2011 +0200
@@ -922,8 +922,8 @@
app master fallBack|
anItem isNil ifTrue:[
- self menuAdornmentAt:#hasPerformed put:true.
- ^ nil
+ self menuAdornmentAt:#hasPerformed put:true.
+ ^ nil
].
isValueModel := aReceiver isValueModel.
@@ -931,101 +931,105 @@
self menuAdornmentAt:#hasPerformed put:isValueModel.
(selectorOrBlock := anItem value) isNil ifTrue:[
- ^ anIndex
+ ^ anIndex
].
(argument := anItem argument) isNil ifTrue:[
- argument := aState ? anItem
+ argument := aState ? anItem
].
selectorOrBlock isSymbol ifFalse:[
- "/ a valueHolder or block
- (selectorOrBlock respondsTo:#valueWithArguments:) ifFalse:[
- ^ selectorOrBlock
- ].
-
- numArgs := selectorOrBlock perform:#numArgs ifNotUnderstood:0.
-
- numArgs == 0 ifTrue:[
- args := nil
- ] ifFalse:[
- numArgs == 1 ifTrue:[
- args := Array with:argument
- ] ifFalse:[
- args := Array with:argument with:self
- ]
- ].
-
- selectorOrBlock valueWithArguments:args.
-
- self menuAdornmentAt:#hasPerformed put:true.
- ^ anIndex
+ "/ a valueHolder or block
+ (selectorOrBlock respondsTo:#valueWithArguments:) ifFalse:[
+ ^ selectorOrBlock
+ ].
+
+ numArgs := selectorOrBlock perform:#numArgs ifNotUnderstood:0.
+
+ numArgs == 0 ifTrue:[
+ args := nil
+ ] ifFalse:[
+ numArgs == 1 ifTrue:[
+ args := Array with:argument
+ ] ifFalse:[
+ args := Array with:argument with:self
+ ]
+ ].
+
+ selectorOrBlock valueWithArguments:args.
+
+ self menuAdornmentAt:#hasPerformed put:true.
+ ^ anIndex
].
anItem sendToOriginator ifTrue:[
- rec := self originator.
- rec isNil ifTrue:[
- self error:'no originating widget (no target for message)' mayProceed:true.
- ].
+ rec := self originator.
+ rec isNil ifTrue:[
+ self error:'no originating widget (no target for message)' mayProceed:true.
+ ].
] ifFalse:[
- rec := aReceiver
+ rec := aReceiver
].
rec isNil ifTrue:[
- ^ selectorOrBlock
+ ^ selectorOrBlock
].
isValueModel ifTrue:[
- rec value:selectorOrBlock
+ rec value:selectorOrBlock
] ifFalse:[
- arg2 := self.
-
- "/ support for ST80 style applications
- "/ (expecting the message to go to the application
- "/ if not understood by the view)
- "/ These expect the controller to be passed as argument.
- "/ sigh.
-
- (rec isView
- and:[(rec respondsTo:selectorOrBlock) not
- and:[(app := rec application) ~~ rec
- and:[app notNil]]]) ifTrue:[
- arg2 := rec controller. "/ the Views controller
- rec := app.
- ].
-
- (numArgs := selectorOrBlock numArgs) == 0 ifTrue:[
- args := nil
- ] ifFalse:[
- numArgs == 1 ifTrue:[
- args := Array with:argument
- ] ifFalse:[
- args := Array with:argument with:arg2
- ]
- ].
-
- fallBack :=
- [
- "/ mhmh - the receiver did not respond to that message;
- "/ if there is a master-application, try that one
- "/ (recursive)
- master := rec perform:#masterApplication ifNotUnderstood:nil.
- master notNil ifTrue:[
- rec := master.
- rec perform:selectorOrBlock withArguments:args ifNotUnderstood:fallBack
- ] ifFalse:[
- self
- error:'unimplemented (or error in) menu message: ' , selectorOrBlock
- mayProceed:true
- ].
- ].
-
- rec perform:selectorOrBlock withArguments:args ifNotUnderstood:fallBack.
+ arg2 := self.
+
+ "/ support for ST80 style applications
+ "/ (expecting the message to go to the application
+ "/ if not understood by the view)
+ "/ These expect the controller to be passed as argument.
+ "/ sigh.
+
+ (rec isView
+ and:[(rec respondsTo:selectorOrBlock) not
+ and:[(app := rec application) ~~ rec
+ and:[app notNil]]]) ifTrue:[
+ arg2 := rec controller. "/ the Views controller
+ rec := app.
+ ].
+
+ (numArgs := selectorOrBlock numArgs) == 0 ifTrue:[
+ args := nil
+ ] ifFalse:[
+ numArgs == 1 ifTrue:[
+ args := Array with:argument
+ ] ifFalse:[
+ args := Array with:argument with:arg2
+ ]
+ ].
+
+ fallBack :=
+ [
+ |val|
+
+ "/ mhmh - the receiver did not respond to that message;
+ "/ if there is a master-application, try that one
+ "/ (recursive)
+ master := rec perform:#masterApplication ifNotUnderstood:nil.
+ master notNil ifTrue:[
+ rec := master.
+ val := rec perform:selectorOrBlock withArguments:args ifNotUnderstood:fallBack
+ ] ifFalse:[
+ self
+ error:'unimplemented (or error in) menu message: ' , selectorOrBlock
+ mayProceed:true.
+ val := nil.
+ ].
+ val
+ ].
+
+ rec perform:selectorOrBlock withArguments:args ifNotUnderstood:fallBack.
].
self menuAdornmentAt:#hasPerformed put:true.
^ selectorOrBlock
- "Modified: / 19.2.2000 / 11:08:22 / cg"
+ "Modified: / 18-04-2011 / 15:51:30 / cg"
!
acceptItem:anItem inMenu:aMenu
@@ -8481,11 +8485,11 @@
!MenuPanel class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.517 2011-03-24 10:20:29 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.518 2011-04-18 13:52:32 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.517 2011-03-24 10:20:29 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.518 2011-04-18 13:52:32 cg Exp $'
! !
MenuPanel initialize!