[Pkg] The Trunk: Morphic-mt.1797.mcz
commits at source.squeak.org
commits at source.squeak.org
Mon Nov 22 14:52:26 UTC 2021
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1797.mcz
==================== Summary ====================
Name: Morphic-mt.1797
Author: mt
Time: 22 November 2021, 3:52:20.61133 pm
UUID: 20ca4712-f68a-9649-84fd-20222029e155
Ancestors: Morphic-ct.1796
Adds check to avoid image freeze when trying to add your owner as a submorph. Thanks to Jens Lincke (jl)!!! Long time squeaker by heart. :-)
Note that I kept the style of error reporting like the existing range check. Needs to be improved. Maybe like Collection's #error* messages.
=============== Diff against Morphic-ct.1796 ===============
Item was changed:
----- Method: Morph>>privateAddAllMorphs:atIndex: (in category 'private') -----
privateAddAllMorphs: aCollection atIndex: index
"Private. Add aCollection of morphs to the receiver"
| myWorld otherSubmorphs offset |
(index between: 1 and: submorphs size+1)
ifFalse: [^ self error: 'index out of range'].
+ (aCollection anySatisfy: [:newMorph | self hasOwner: newMorph])
+ ifTrue: [^ self error: 'tried to add your (indirect) owner as new submorph'].
+ myWorld := self world.
- myWorld := self world.
otherSubmorphs := submorphs copyWithoutAll: aCollection.
offset := aCollection count: [:m | (submorphs indexOf: m) between: 1 and: index - 1].
submorphs := otherSubmorphs copyReplaceFrom: index-offset to: index-offset-1 with: aCollection.
aCollection do: [:m | | itsOwner itsWorld |
itsOwner := m owner.
itsOwner ifNotNil: [
itsWorld := m world.
(itsWorld == myWorld) ifFalse: [
itsWorld ifNotNil: [self privateInvalidateMorph: m].
m outOfWorld: itsWorld].
(itsOwner ~~ self) ifTrue: [
m owner privateRemove: m.
m owner removedMorph: m ]].
m privateOwner: self.
myWorld ifNotNil: [self privateInvalidateMorph: m].
(myWorld == itsWorld) ifFalse: [m intoWorld: myWorld].
itsOwner == self ifFalse: [
self addedMorph: m.
m noteNewOwner: self ].
].
self layoutChanged.
!
Item was changed:
----- Method: Morph>>privateAddMorph:atIndex: (in category 'private') -----
privateAddMorph: aMorph atIndex: index
| oldIndex myWorld itsWorld oldOwner |
+
((index >= 1) and: [index <= (submorphs size + 1)])
ifFalse: [^ self error: 'index out of range'].
+ (self hasOwner: aMorph)
+ ifTrue: [^ self error: 'tried to add your (indirect) owner as new submorph'].
myWorld := self world.
oldOwner := aMorph owner.
(oldOwner == self and: [(oldIndex := submorphs indexOf: aMorph) > 0]) ifTrue:[
"aMorph's position changes within in the submorph chain"
oldIndex < index ifTrue:[
"moving aMorph to back"
submorphs replaceFrom: oldIndex to: index-2 with: submorphs startingAt: oldIndex+1.
submorphs at: index-1 put: aMorph.
] ifFalse:[
"moving aMorph to front"
oldIndex-1 to: index by: -1 do:[:i|
submorphs at: i+1 put: (submorphs at: i)].
submorphs at: index put: aMorph.
].
] ifFalse:[
"adding a new morph"
oldOwner ifNotNil:[
itsWorld := aMorph world.
itsWorld ifNotNil: [self privateInvalidateMorph: aMorph].
(itsWorld == myWorld) ifFalse: [aMorph outOfWorld: itsWorld].
oldOwner privateRemove: aMorph.
oldOwner removedMorph: aMorph.
].
aMorph privateOwner: self.
submorphs := submorphs copyReplaceFrom: index to: index-1 with: (Array with: aMorph).
(itsWorld == myWorld) ifFalse: [aMorph intoWorld: myWorld].
].
myWorld ifNotNil:[self privateInvalidateMorph: aMorph].
self layoutChanged.
oldOwner == self ifFalse: [
self addedMorph: aMorph.
aMorph noteNewOwner: self ].
!
Item was changed:
(PackageInfo named: 'Morphic') postscript: 'SystemProgressMorph reset. "New layer number"
+ "Morphic-ct.1796 - Inverts the preference ''halo encloses full bounds'' by pressing the control key while invocating a halo."
+ (Preferences preferenceAt: #haloEnclosesFullBounds) instVarNamed: ''helpString'' put: ''If enabled, halos will enclose the full bounds of the target morph, rather than just the bounds. You can also invert this behavior temporarily by holding down Ctrl while invoking a halo on a morph.''.'!
- "Morphic-ct.1796 - Inverts the preference "halo encloses full bounds" by pressing the control key while invocating a halo."
- (Preferences preferenceAt: #haloEnclosesFullBounds) instVarNamed: ''helpString'' put: ''If enabled, halos will enclose the full bounds of the target morph, rather than just the bounds. You can also invert this behavior temporarily by holding down Ctrl while invoking a halo'' on a morph.''.'!
More information about the Packages
mailing list