[squeak-dev] The Trunk: Tools-dtl.381.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Sep 28 23:46:21 UTC 2011


David T. Lewis uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-dtl.381.mcz

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

Name: Tools-dtl.381
Author: dtl
Time: 28 September 2011, 7:45:43.945 pm
UUID: 77c96c37-0027-4bb6-929b-6d04917268b7
Ancestors: Tools-eem.380

Provide updating button for "what to show" button on CodeHolder, similar to Squeak 3.8 behavior. This button activates a menu, and displays the resulting menu selection. For the default look, normal buttons are rounded and the menu activation button is square (vice versa if the "Rounded Button Corners" preference is disabled). When menu selection is changed, the button label displays the selected mode ('source', 'decompile', 'bytecodes' etc).

Changes are in four packages.

ToolBuilder-Kernel:
- Add PluggableButtonSpec>>style to provide style hint. Used to suggest that a button should be rendered differently, in this case rounded versus square corners.
- Add changeLableWhen: to connect pluggable button with change notification, in this case to allow update: #contents to result in a label update in the dependent button.

ToolBuilder-Morphic:
- Add #whenChanged:update: as a mechanism for hooking change events to button updates, allowing an individual button to respond to e.g. self changed: #contents in the model.
- Update MorphicToolBuilder>>buildPluggableButton to make use of style and changeLabelWhen in the widget spec.

Tools:
 - Update CodeHolder>>buildCodeProvenanceButtonWith: to add style hint for round/ square corners and changeLableWhen: for change notification to the widget spec.

Note: ToolBuilder has PluggableDropDownListSpec which is presumably intended to describe a drop-down list widget. This is currently unused in the image, but in future might provide a better approach than the current action button with menu approach.

Morphic:
- Let style hint control rounded versus square corners for a PluggableButtonMorph. May be used as a visual cue to distinguish simple action buttons from buttons that invoke a selection menu (e.g. "what to show" button for a CodeHolder).
- Instance var #style was added to PluggableButtonMorph, so must also update #veryDeepInner: to match (problem detected by DeepCopier>>checkClass: called from ChangeSet>>fileOutClassDefinition:on:).

=============== Diff against Tools-eem.380 ===============

Item was changed:
  ----- Method: CodeHolder>>buildCodeProvenanceButtonWith: (in category 'toolbuilder') -----
  buildCodeProvenanceButtonWith: builder
  	| buttonSpec |
  	buttonSpec := builder pluggableActionButtonSpec new.
  	buttonSpec model: self.
  	buttonSpec label: #codePaneProvenanceString.
+ 	buttonSpec changeLabelWhen: #contents.
+ 	buttonSpec style: #menuButton.
  	buttonSpec action: #offerWhatToShowMenu.
  	buttonSpec help: 'Governs what view is shown in the code pane.  Click here to change the view'.
  	^buttonSpec!

Item was changed:
  ----- Method: CodeHolder>>decompiledSourceIntoContentsWithTempNames: (in category 'message list') -----
  decompiledSourceIntoContentsWithTempNames: showTempNames 
  	"Obtain a source string by decompiling the method's code, and place 
  	that source string into my contents.
  	Also return the string.
  	Get temps from source file if showTempNames is true."
  
  	| tempNames class selector method |
  	class := self selectedClassOrMetaClass.
  	selector := self selectedMessageName.
  	"Was method deleted while in another project?"
  	method := class compiledMethodAt: selector ifAbsent: [^ ''].
  
  	currentCompiledMethod := method.
  	(showTempNames not
+ 			or: [method fileIndex > 0
+ 					and: [(SourceFiles at: method fileIndex) isNil]])
+ 		ifTrue: [
- 	 or: [method fileIndex > 0 and: [(SourceFiles at: method fileIndex) isNil]])
- 		ifTrue:
  			"Emergency or no source file -- decompile without temp names "
+ 			contents := (class decompilerClass new
+ 						decompile: selector
+ 						in: class
+ 						method: method) decompileString]
+ 		ifFalse: [tempNames := (class newCompiler
- 			[contents := (class decompilerClass new
- 							decompile: selector
- 							in: class
- 							method: method methodForDecompile) decompileString]
- 		ifFalse:
- 			[tempNames := (class newCompiler
  									parse: method getSourceFromFile asString
  									in: class
  									notifying: nil)
  										generate: CompiledMethodTrailer defaultMethodTrailer;
  										schematicTempNamesString.
  			contents := ((class decompilerClass new withTempNames: tempNames)
+ 						decompile: selector
+ 						in: class
+ 						method: method) decompileString].
- 							decompile: selector
- 							in: class
- 							method: method methodForDecompile) decompileString].
  	contents := contents asText makeSelectorBoldIn: class.
  	^ contents copy!




More information about the Squeak-dev mailing list