'From Squeak3.6alpha of ''17 March 2003'' [latest update: #5313] on 3 July 2003 at 7:47:05 pm'! "Change Set: BoundsInHaloFix-nk Date: 3 July 2003 Author: Ned Konz 3 July v2: forgot to include a couple of methods. 3 July: Added the #haloEnclosesFullBounds preference to allow for halos that encompass the fullBounds rather than just the bounds. The default value of this preference is false, for backwards compatibility. Note that the resizing is still done on the bounds, and not on the fullBounds. 27 June: fixed problem reported by Scott Wallace with updating rectangle during rotation. 13 June: fixed problems with drawing outside bounds in some cases. 12 May: original This fixes the problems with halos drawing outside their bounds and not being deletable when the showBoundsInHalo Preference is turned on. The following things work: * dismiss handle * recolor * balloon help on halo handles * no drawing gribblies "! !Morph methodsFor: 'geometry' stamp: 'nk 7/3/2003 19:39'! worldBoundsForHalo "Answer the rectangle to be used as the inner dimension of my halos. Allow for showing either bounds or fullBounds, and compensate for the optional bounds rectangle." | r | r _ (Preferences haloEnclosesFullBounds) ifFalse: [ self boundsIn: nil ] ifTrue: [ self fullBoundsInWorld ]. Preferences showBoundsInHalo ifTrue: [ ^r outsetBy: 1 ]. ^r! ! !HaloMorph methodsFor: 'drawing' stamp: 'nk 6/13/2003 13:27'! drawOn: aCanvas "Draw this morph only if it has no target." target isNil ifTrue: [^super drawOn: aCanvas]. Preferences showBoundsInHalo ifTrue: [aCanvas frameAndFillRectangle: self bounds fillColor: Color transparent borderWidth: 1 borderColor: Color blue]! ! !HaloMorph methodsFor: 'stepping' stamp: 'nk 6/27/2003 12:28'! localHaloBoundsFor: aMorph "aMorph may be in the hand and perhaps not in our world" | r | r _ aMorph worldBoundsForHalo truncated. aMorph world = self world ifFalse: [^r]. ^((self transformFromOutermostWorld) globalBoundsToLocal: r) truncated! ! !HaloMorph methodsFor: 'stepping' stamp: 'nk 6/27/2003 12:32'! step | newBounds | target ifNil: [^ self]. newBounds _ target isWorldMorph ifTrue: [target bounds] ifFalse: [self localHaloBoundsFor: target renderedMorph]. newBounds = self bounds ifTrue: [^ self]. newBounds extent = self bounds extent ifTrue: [^ self position: newBounds origin]. growingOrRotating ifFalse: [submorphs size > 1 ifTrue: [self addHandles]]. "adjust halo bounds if appropriate" self bounds: newBounds! ! !HaloMorph class methodsFor: 'class initialization' stamp: 'nk 7/3/2003 19:35'! initialize "HaloMorph initialize" Preferences preferenceAt: #haloEnclosesFullBounds ifAbsent: [ Preferences addPreference: #haloEnclosesFullBounds category: #halos default: false balloonHelp: 'if true, halos will enclose the full bounds of the target Morph, rather than just the bounds' ]. HandleSize _ 16! ! !Preferences class methodsFor: 'standard queries' stamp: 'nk 7/3/2003 19:36'! haloEnclosesFullBounds ^ self valueOfFlag: #haloEnclosesFullBounds ifAbsent: [false]! ! HaloMorph initialize!