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

commits at source.squeak.org commits at source.squeak.org
Mon Apr 27 08:21:34 UTC 2020


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

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

Name: ToolBuilder-Morphic-mt.258
Author: mt
Time: 27 April 2020, 10:21:31.53034 am
UUID: 56af8f04-9f4c-b843-afe5-e9ed08d06dc8
Ancestors: ToolBuilder-Morphic-mt.257

Complements Tools-mt.965. Inspector refactoring. See: http://forum.world.st/Please-try-out-Inspector-Refactoring-tp5114974.html

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

Item was added:
+ ----- Method: Morph>>inspectorClass (in category '*ToolBuilder-Morphic') -----
+ inspectorClass
+ 
+ 	^ MorphInspector!

Item was added:
+ Inspector subclass: #MorphInspector
+ 	instanceVariableNames: ''
+ 	classVariableNames: ''
+ 	poolDictionaries: ''
+ 	category: 'ToolBuilder-Morphic-Tools'!
+ 
+ !MorphInspector commentStamp: 'mt 4/22/2020 08:13' prior: 0!
+ I am an inspector for morphs. In addition to field values I display properties of the morph, and add additional selections to the field item menu.!

Item was added:
+ ----- Method: MorphInspector>>addFieldItemsTo: (in category 'menu - construction') -----
+ addFieldItemsTo: aMenu
+ 
+ 	super addFieldItemsTo: aMenu.
+ 
+ 	self isMorphSelected ifFalse: [^ self].
+ 	
+ 	aMenu addLine.
+ 	
+ 	aMenu addTranslatedList: #(
+ 			('open screenshot in hand'			openScreenshotInHand)
+ 			('open screenshot in world'			openScreenshotInWorld)).!

Item was added:
+ ----- Method: MorphInspector>>fieldExtent (in category 'fields') -----
+ fieldExtent
+ 
+ 	^ (self newFieldForType: #misc key: #extent)
+ 		name: 'extent' translated; emphasizeName;
+ 		valueGetter: [:morph | morph extent];
+ 		valueSetter: [:morph :newExtent | morph extent: newExtent];
+ 		yourself!

Item was added:
+ ----- Method: MorphInspector>>isMorphSelected (in category 'morphs') -----
+ isMorphSelected
+ 
+ 	^ [self selectionOrObject isMorph] ifError: [false]!

Item was added:
+ ----- Method: MorphInspector>>openScreenshotInHand (in category 'menu - commands') -----
+ openScreenshotInHand
+ 
+ 	^ self selectedMorph imageForm asMorph openInHand!

Item was added:
+ ----- Method: MorphInspector>>openScreenshotInWorld (in category 'menu - commands') -----
+ openScreenshotInWorld
+ 
+ 	^ self selectedMorph imageForm asMorph openInWorld!

Item was added:
+ ----- Method: MorphInspector>>selectedMorph (in category 'morphs') -----
+ selectedMorph
+ 
+ 	^ self selectionOrObject!

Item was added:
+ ----- Method: MorphInspector>>streamBaseFieldsOn: (in category 'fields - streaming') -----
+ streamBaseFieldsOn: aStream
+ 
+ 	super streamBaseFieldsOn: aStream.
+ 	aStream nextPut: self fieldExtent.!

Item was added:
+ ----- Method: MorphInspector>>streamInstanceVariablesOn: (in category 'fields - streaming') -----
+ streamInstanceVariablesOn: aStream
+ 
+ 	super streamInstanceVariablesOn: aStream.
+ 	self streamPropertiesOn: aStream.!

Item was added:
+ ----- Method: MorphInspector>>streamPropertiesOn: (in category 'fields - streaming') -----
+ streamPropertiesOn: aStream
+ 	"Prepend all properties with # (hash) so that users can distinguish them from regular instance variables. Trigger both #layoutChanged and #changed to be sure that any value changes yield the expected visual updates. Note that this is required because we invade the morph's privacy by exposing its extension object this way; normal updates are handled only through the morph's public interface. For example, compare Morph >> #visible: with MorphExtension >> #visible:."
+ 	
+ 	| extension field |
+ 	(extension := self object extension) ifNil: [^ self].
+ 	
+ 	extension sortedPropertyNames do: [:property |
+ 		(extension respondsTo: property)
+ 			ifTrue: [field := (self newFieldForType: #property key: property)
+ 				name: property printString;
+ 				valueGetter: [:morph | morph extension perform: property];
+ 				valueSetter: [:morph :value |
+ 					morph extension perform: property asSimpleSetter with: value.
+ 					morph layoutChanged; changed];
+ 				yourself]
+ 			ifFalse: [field := (self newFieldForType: #property key: property)
+ 				name: property printString;
+ 				valueGetter: [:morph | morph extension valueOfProperty: property];
+ 				valueSetter: [:morph :value |
+ 					morph extension setProperty: property toValue: value.
+ 					morph layoutChanged; changed];
+ 				yourself].
+ 			
+ 		aStream nextPut: field].!



More information about the Squeak-dev mailing list