[squeak-dev] The Trunk: Morphic-mt.1751.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Apr 14 09:19:46 UTC 2021


Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1751.mcz

==================== Summary ====================

Name: Morphic-mt.1751
Author: mt
Time: 14 April 2021, 11:19:35.123489 am
UUID: 8fa68c8f-44ca-4d4a-a9e7-f69619be782e
Ancestors: Morphic-mt.1750

Slightly improve browsing and debugging of so-called "button actions" by also supporting #perform:orSendTo:, which yields #effectiveActionTarget and #effectiveActionSelector.

(Note that this design is still to be improved. I refrained from adding the debug/browse interface for button actions to Morph. A next step might be to take a look at all implementors of #doButtonAction. Maybe this will generate some ideas.)

=============== Diff against Morphic-mt.1750 ===============

Item was removed:
- ----- Method: MenuItemMorph>>browseAllImplementorsOfRealSelector (in category 'browse') -----
- browseAllImplementorsOfRealSelector
- 	SystemNavigation default browseAllImplementorsOf: self realSelector localTo: target class!

Item was changed:
  ----- Method: MenuItemMorph>>browseImplementationOfActionSelector (in category 'browse') -----
  browseImplementationOfActionSelector
  
  	| method |
+ 	method := self effectiveActionTarget class lookupSelector: self effectiveActionSelector.
- 	method := target class lookupSelector: selector.
  	ToolSet browse: method methodClass selector: method selector.!

Item was changed:
  ----- Method: MenuItemMorph>>debugAction (in category 'browse') -----
  debugAction
  
  	(Process
  		forBlock: [self doButtonAction]
+ 		runUntil: [:context | context selector = self effectiveActionSelector])
- 		runUntil: [:context | context selector = self selector])
  			debugWithTitle: ('Debug menu action "{1}" in model "{2}"' format: {self contents. self target printString}).!

Item was added:
+ ----- Method: MenuItemMorph>>effectiveActionSelector (in category 'browse') -----
+ effectiveActionSelector
+ 	
+ 	^ self selector = #perform:orSendTo:
+ 		ifTrue: [self arguments first]
+ 		ifFalse: [self selector]!

Item was added:
+ ----- Method: MenuItemMorph>>effectiveActionTarget (in category 'browse') -----
+ effectiveActionTarget
+ 
+ 	^ (self selector = #perform:orSendTo:
+ 		and: [(self target respondsTo: self effectiveActionSelector) not])
+ 			ifTrue: [self arguments second]
+ 			ifFalse: [self target]!

Item was removed:
- ----- Method: MenuItemMorph>>realSelector (in category 'browse') -----
- realSelector
- 	selector == #perform:orSendTo: ifTrue: [^arguments first].
- 	^selector!

Item was changed:
  ----- Method: Morph>>doButtonAction (in category 'button') -----
  doButtonAction
+ 	"If the receiver has a button-action defined, do it now. The default button action of any morph is, well, to do nothing.  Note that there are several ways -- too many ways -- for morphs to have button-like actions. It is intended for morph classes whose very nature is to be buttons -- this method provides glue so that arbitrary buttons on the UI can be 'fired' programmatically from user scripts."!
- 	"If the receiver has a button-action defined, do it now.  The default button action of any morph is, well, to do nothing.  Note that there are several ways -- too many ways -- for morphs to have button-like actions.  This one refers not to the #mouseUpCodeToRun feature, nor does it refer to the Player-scripting mechanism.  Instead it is intended for morph classes whose very nature is to be buttons -- this method provides glue so that arbitrary buttons on the UI can be 'fired' programatticaly from user scripts"!

Item was changed:
  ----- Method: PluggableButtonMorph>>browseImplementationOfActionSelector (in category 'debug menu') -----
  browseImplementationOfActionSelector
  
  	| method |
+ 	self updateArguments.
+ 	method := self effectiveActionTarget class lookupSelector: self effectiveActionSelector.
- 	method := model class lookupSelector: actionSelector.
  	ToolSet browse: method methodClass selector: method selector.!

Item was changed:
  ----- Method: PluggableButtonMorph>>debugAction (in category 'debug menu') -----
  debugAction
  
+ 	self updateArguments.
+ 
  	(Process
+ 		forBlock: [self doButtonAction]
+ 		runUntil: [:context | context selector = self effectiveActionSelector])
- 		forBlock: [self performAction]
- 		runUntil: [:context | context selector = self actionSelector])
  			debugWithTitle: ('Debug button action "{1}" in model "{2}"' format: {self label. self target printString}).!

Item was added:
+ ----- Method: PluggableButtonMorph>>doButtonAction (in category 'button') -----
+ doButtonAction
+ 
+ 	^ self performAction!

Item was added:
+ ----- Method: PluggableButtonMorph>>effectiveActionSelector (in category 'debug menu') -----
+ effectiveActionSelector
+ 	
+ 	^ self actionSelector = #perform:orSendTo:
+ 		ifTrue: [arguments first]
+ 		ifFalse: [self actionSelector]!

Item was added:
+ ----- Method: PluggableButtonMorph>>effectiveActionTarget (in category 'debug menu') -----
+ effectiveActionTarget
+ 
+ 	^ (self actionSelector = #perform:orSendTo:
+ 		and: [(self target respondsTo: self effectiveActionSelector) not])
+ 			ifTrue: [arguments second]
+ 			ifFalse: [self target]!

Item was changed:
+ ----- Method: PluggableButtonMorph>>hResizing: (in category 'layout properties') -----
- ----- Method: PluggableButtonMorph>>hResizing: (in category 'layout-properties') -----
  hResizing: aSymbol
  	"We adapt our minimum extent according to our resize behavior."
  	
  	self hResizing == aSymbol ifTrue: [^ self].
  	super hResizing: aSymbol.
  	self updateMinimumExtent.!

Item was changed:
+ ----- Method: PluggableButtonMorph>>performAction (in category 'event handling') -----
- ----- Method: PluggableButtonMorph>>performAction (in category 'accessing') -----
  performAction
  	"Inform the model that this button has been pressed. Sent by the controller when this button is pressed. If the button's actionSelector takes any arguments, they are obtained dynamically by sending the argumentSelector to the argumentsProvider"
  
  	askBeforeChanging ifTrue: [model okToChange ifFalse: [^ self]].
  	actionSelector ifNotNil:
  		[actionSelector numArgs = 0
  			ifTrue:
  				[model perform: actionSelector]
  			ifFalse:
+ 				[self updateArguments.
- 				[argumentsProvider ifNotNil:
- 					[arguments := argumentsProvider perform: argumentsSelector].
  					model perform: actionSelector withArguments: arguments]]!

Item was added:
+ ----- Method: PluggableButtonMorph>>updateArguments (in category 'updating') -----
+ updateArguments
+ 
+ 	argumentsProvider ifNil: [^ self].
+ 	argumentsSelector ifNil: [^ self].
+ 	arguments := argumentsProvider perform: argumentsSelector.!

Item was changed:
+ ----- Method: PluggableButtonMorph>>vResizing: (in category 'layout properties') -----
- ----- Method: PluggableButtonMorph>>vResizing: (in category 'layout-properties') -----
  vResizing: aSymbol
  	"We adapt our minimum extent according to our resize behavior."
  	
  	self vResizing == aSymbol ifTrue: [^ self].
  	super vResizing: aSymbol.
  	self updateMinimumExtent.!



More information about the Squeak-dev mailing list