[squeak-dev] The Trunk: MorphicExtras-pre.175.mcz

commits at source.squeak.org commits at source.squeak.org
Fri May 20 08:18:31 UTC 2016


Patrick Rein uploaded a new version of MorphicExtras to project The Trunk:
http://source.squeak.org/trunk/MorphicExtras-pre.175.mcz

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

Name: MorphicExtras-pre.175
Author: pre
Time: 20 May 2016, 10:18:14.376592 am
UUID: 895e188c-ca42-4f48-9817-4d69b567dbc0
Ancestors: MorphicExtras-mt.174

Moves UpdatingRectangleMorph from EToys

=============== Diff against MorphicExtras-mt.174 ===============

Item was added:
+ RectangleMorph subclass: #UpdatingRectangleMorph
+ 	instanceVariableNames: 'target lastValue getSelector putSelector contents'
+ 	classVariableNames: ''
+ 	poolDictionaries: ''
+ 	category: 'MorphicExtras-Support'!
+ 
+ !UpdatingRectangleMorph commentStamp: '<historical>' prior: 0!
+ Intended for use as a color swatch coupled to a color obtained from the target, but made just slightly more general than that.!

Item was added:
+ ----- Method: UpdatingRectangleMorph>>contents (in category 'accessing') -----
+ contents
+ 	^ contents!

Item was added:
+ ----- Method: UpdatingRectangleMorph>>contents: (in category 'accessing') -----
+ contents: c
+ 	contents := c!

Item was added:
+ ----- Method: UpdatingRectangleMorph>>defaultBorderColor (in category 'initialization') -----
+ defaultBorderColor
+ 	"answer the default border color/fill style for the receiver"
+ 	^ Color lightGray lighter!

Item was added:
+ ----- Method: UpdatingRectangleMorph>>getSelector (in category 'accessing') -----
+ getSelector
+ 	"Answer the getSelector"
+ 
+ 	^ getSelector!

Item was added:
+ ----- Method: UpdatingRectangleMorph>>getSelector: (in category 'accessing') -----
+ getSelector: aSymbol
+ 
+ 	getSelector := aSymbol.
+ !

Item was added:
+ ----- Method: UpdatingRectangleMorph>>handlesMouseDown: (in category 'event handling') -----
+ handlesMouseDown: evt 
+ 	^putSelector notNil!

Item was added:
+ ----- Method: UpdatingRectangleMorph>>isEtoyReadout (in category 'accessing') -----
+ isEtoyReadout
+ 	"Answer whether the receiver can serve as an etoy readout"
+ 
+ 	^ true!

Item was added:
+ ----- Method: UpdatingRectangleMorph>>mouseUp: (in category 'event handling') -----
+ mouseUp: evt
+ 
+ 	self changeColorTarget: self selector: #setTargetColor: originalColor: color hand: evt hand.!

Item was added:
+ ----- Method: UpdatingRectangleMorph>>putSelector (in category 'accessing') -----
+ putSelector
+ 	^ putSelector!

Item was added:
+ ----- Method: UpdatingRectangleMorph>>putSelector: (in category 'accessing') -----
+ putSelector: aSymbol
+ 	putSelector := aSymbol!

Item was added:
+ ----- Method: UpdatingRectangleMorph>>readFromTarget (in category 'target access') -----
+ readFromTarget
+ 	"Read the color value from my target"
+ 
+ 	| v |
+ 	(target isNil or: [getSelector isNil]) ifTrue: [^contents].
+ 	target isMorph ifTrue: [target isInWorld ifFalse: [^contents]].
+ 	v := self valueProvider perform: getSelector.
+ 	lastValue := v.
+ 	^v!

Item was added:
+ ----- Method: UpdatingRectangleMorph>>setTargetColor: (in category 'setting') -----
+ setTargetColor: aColor
+ 	"Set my target's color as indicated"
+ 
+ 	putSelector ifNotNil:
+ 		[self color: aColor.
+ 		contents := aColor.
+ 		self valueProvider perform: self putSelector withArguments: (Array with: aColor)]
+ !

Item was added:
+ ----- Method: UpdatingRectangleMorph>>step (in category 'stepping and presenter') -----
+ step
+ 	| s |
+ 	super step.
+ 	s := self readFromTarget.
+ 	s = contents ifFalse:
+ 		[self contents: s.
+ 		self color: s]
+ !

Item was added:
+ ----- Method: UpdatingRectangleMorph>>stepTime (in category 'testing') -----
+ stepTime
+ 
+ 	^ 50!

Item was added:
+ ----- Method: UpdatingRectangleMorph>>target (in category 'accessing') -----
+ target
+ 
+ 	^ target
+ !

Item was added:
+ ----- Method: UpdatingRectangleMorph>>target: (in category 'accessing') -----
+ target: anObject
+ 
+ 	target := anObject.
+ !

Item was added:
+ ----- Method: UpdatingRectangleMorph>>userEditsAllowed (in category 'accessing') -----
+ userEditsAllowed
+ 	"Answer whether it is suitable for a user to change the value represented by this readout"
+ 
+ 	^ putSelector notNil!

Item was added:
+ ----- Method: UpdatingRectangleMorph>>valueProvider (in category 'setting') -----
+ valueProvider
+ 	"Answer the object to which my get/set messages should be sent.  This is inefficient and contorted in order to support grandfathered content for an earlier design"
+ 
+ 	^ target isMorph
+ 		ifTrue:
+ 			[target topRendererOrSelf player ifNil: [target]]
+ 		ifFalse:
+ 			[target]!

Item was added:
+ ----- Method: UpdatingRectangleMorph>>veryDeepFixupWith: (in category 'copying') -----
+ veryDeepFixupWith: deepCopier
+ 	"If target and arguments fields were weakly copied, fix them here.  If they were in the tree being copied, fix them up, otherwise point to the originals!!!!"
+ 
+ super veryDeepFixupWith: deepCopier.
+ target := deepCopier references at: target ifAbsent: [target].!

Item was added:
+ ----- Method: UpdatingRectangleMorph>>veryDeepInner: (in category 'copying') -----
+ veryDeepInner: deepCopier
+ 	"Copy all of my instance variables.  Some need to be not copied at all, but shared.  	Warning!!!!  Every instance variable defined in this class must be handled.  We must also implement veryDeepFixupWith:.  See DeepCopier class comment."
+ 
+ super veryDeepInner: deepCopier.
+ "target := target.		Weakly copied"
+ lastValue := lastValue veryDeepCopyWith: deepCopier.
+ "getSelector := getSelector.		a Symbol"
+ "putSelector := putSelector.		a Symbol"
+ contents := contents veryDeepCopyWith: deepCopier.!



More information about the Squeak-dev mailing list