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

commits at source.squeak.org commits at source.squeak.org
Mon Mar 7 10:07:27 UTC 2022


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

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

Name: ToolBuilder-Morphic-mt.306
Author: mt
Time: 7 March 2022, 11:07:26.542204 am
UUID: 5e5f1a8d-a149-6f47-9106-dd98754da77f
Ancestors: ToolBuilder-Morphic-mt.305

Fixes the issue where a custom #textStyle was not installed in a pluggable text field after being constructed via ToolBuilder.

Note that I think that we need a better strategy for extending pluggable widgets regarding their initialization. All #[get|set]*Selector(:) things are direct instVar-access only, relying on the initializer/constructor to fetch model data for the first time. See :#on:... methods, e.g., in PluggableTextMorph. So, I put that change in MorphicToolBuilder for now while it might be better placed directly in PluggableTextMorph.

=============== Diff against ToolBuilder-Morphic-mt.305 ===============

Item was changed:
  ----- Method: MorphicToolBuilder>>buildPluggableText: (in category 'widgets required') -----
  buildPluggableText: aSpec
  	| widget |
  	widget := self textPaneClass new.
  	aSpec stylerClass ifNotNil: [:c | widget styler: (c new view: widget)].	
  	widget
  		on: aSpec model
  		text: aSpec getText 
  		accept: aSpec setText
  		readSelection: aSpec selection 
  		menu: aSpec menu.
  	aSpec textStyle
  		ifNotNil: [:ts |
  			ts isSymbol
+ 				ifTrue: [widget getTextStyleSelector: ts; update: ts]
- 				ifTrue: [widget getTextStyleSelector: ts]
  				ifFalse: [widget setTextStyle: ts]]
  		ifNil: [
  			aSpec font ifNotNil: [:f |
  				f isSymbol
  					ifTrue: [widget getFontSelector: f]
  					ifFalse: [widget setTextStyle: f asNewTextStyle]] ].
  	
  	widget readOnly: aSpec readOnly.
  	widget plainTextOnly: aSpec plainTextOnly.
  	widget editTextSelector: aSpec editText.
  	widget wantsFrameAdornments: aSpec indicateUnacceptedChanges.
  
  	widget askBeforeDiscardingEdits: aSpec askBeforeDiscardingEdits.
  	widget setProperty: #alwaysAccept toValue: aSpec askBeforeDiscardingEdits not.
  
  	widget wrapFlag: (aSpec softLineWrap ifNil: [true]).
  	
  	self register: widget id: aSpec name.
  	widget getColorSelector: aSpec color.
  	widget getTextColorSelector: aSpec textColor.
  	self buildHelpFor: widget spec: aSpec.
  	 
  	self setFrame: aSpec frame in: widget.
  	self setLayoutHintsForTextField: widget spec: aSpec.
  	
  	parent ifNotNil:[self add: widget to: parent].
  	^widget!



More information about the Squeak-dev mailing list