'From Squeak3.7alpha of ''11 September 2003'' [latest update: #5497] on 20 October 2003 at 9:39:15 pm'! "Change Set: MorphRemovalNotificationsFix-nk Date: 20 October 2003 Author: Ned Konz Version: 3.7a >5486 This is a follow-on to the 3.7a update 5486MorphRemoval-ar-nk that updates 3.7 images to the equivalent of my v6 posting on 16 October. 16 October (v6) (Ned Konz): Added removedMorph: notifications to removeAllMorphs and removeAllMorphsIn: "! !Morph methodsFor: 'submorphs-add/remove' stamp: 'nk 10/18/2003 15:20'! delete "Remove the receiver as a submorph of its owner and make its new owner be nil." | aWorld | aWorld := self world ifNil: [World]. "Terminate genie recognition focus" self disableSubmorphFocusForHand: self activeHand. self activeHand releaseKeyboardFocus: self; releaseMouseFocus: self. owner ifNotNil:[ self privateDelete. self player ifNotNilDo: [ :player | "Player must be notified" player noteDeletionOf: self fromWorld: aWorld]].! ! !Morph methodsFor: 'submorphs-add/remove' stamp: 'nk 10/16/2003 14:08'! removeAllMorphs | oldMorphs myWorld | myWorld _ self world. (fullBounds notNil or:[myWorld notNil]) ifTrue:[self invalidRect: self fullBounds]. submorphs do: [:m | myWorld ifNotNil: [ m outOfWorld: myWorld ]. m privateOwner: nil]. oldMorphs _ submorphs. submorphs _ EmptyArray. oldMorphs do: [ :m | self removedMorph: m ]. self layoutChanged. ! ! !Morph methodsFor: 'submorphs-add/remove' stamp: 'nk 10/16/2003 14:02'! removeAllMorphsIn: aCollection "greatly speeds up the removal of *lots* of submorphs" | set myWorld | set _ IdentitySet new: aCollection size * 4 // 3. aCollection do: [:each | each owner == self ifTrue: [ set add: each]]. myWorld _ self world. (fullBounds notNil or:[myWorld notNil]) ifTrue:[self invalidRect: self fullBounds]. set do: [:m | myWorld ifNotNil: [ m outOfWorld: myWorld ]. m privateOwner: nil]. submorphs _ submorphs reject: [ :each | set includes: each]. set do: [ :m | self removedMorph: m ]. self layoutChanged. ! !