[squeak-dev] The Inbox: Morphic-mt.721.mcz
commits at source.squeak.org
commits at source.squeak.org
Mon Feb 10 11:59:37 UTC 2014
A new version of Morphic was added to project The Inbox:
http://source.squeak.org/inbox/Morphic-mt.721.mcz
==================== Summary ====================
Name: Morphic-mt.721
Author: mt
Time: 10 February 2014, 12:57:04.053 pm
UUID: 4fc4ba71-fbc9-fa44-be19-a7d88f4cf9aa
Ancestors: Morphic-cmm.720
Fixed implementation for adding multiple morphs at once. Made API of addMorph* and addAllMorphs* more consistent w.r.t. index handling.
=============== Diff against Morphic-cmm.720 ===============
Item was changed:
----- Method: Morph>>addAllMorphs: (in category 'submorphs-add/remove') -----
addAllMorphs: aCollection
+ ^self addAllMorphsBack: aCollection!
- ^self privateAddAllMorphs: aCollection atIndex: submorphs size!
Item was changed:
----- Method: Morph>>addAllMorphs:after: (in category 'submorphs-add/remove') -----
addAllMorphs: aCollection after: anotherMorph
+ ^self addAllMorphs: aCollection behind: anotherMorph!
- ^self privateAddAllMorphs: aCollection
- atIndex: (submorphs indexOf: anotherMorph ifAbsent: [submorphs size])!
Item was added:
+ ----- Method: Morph>>addAllMorphs:behind: (in category 'submorphs-add/remove') -----
+ addAllMorphs: aCollection behind: anotherMorph
+ ^self privateAddAllMorphs: aCollection
+ atIndex: (submorphs indexOf: anotherMorph) + 1!
Item was added:
+ ----- Method: Morph>>addAllMorphs:inFrontOf: (in category 'submorphs-add/remove') -----
+ addAllMorphs: aCollection inFrontOf: anotherMorph
+ ^self privateAddAllMorphs: aCollection
+ atIndex: ((submorphs indexOf: anotherMorph) max: 1)!
Item was added:
+ ----- Method: Morph>>addAllMorphsBack: (in category 'submorphs-add/remove') -----
+ addAllMorphsBack: aCollection
+ ^self privateAddAllMorphs: aCollection atIndex: submorphs size + 1!
Item was added:
+ ----- Method: Morph>>addAllMorphsFront: (in category 'submorphs-add/remove') -----
+ addAllMorphsFront: aCollection
+ ^self privateAddAllMorphs: aCollection atIndex: 1!
Item was changed:
----- Method: Morph>>addMorph:after: (in category 'submorphs-add/remove') -----
addMorph: newMorph after: aMorph
+ ^self addMorph: newMorph behind: aMorph!
- "Add the given morph as one of my submorphs, inserting it after anotherMorph"
- ^self privateAddMorph: newMorph atIndex: (submorphs indexOf: aMorph)+1!
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'].
- | myWorld otherSubmorphs |
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.
- (index between: 0 and: otherSubmorphs size)
- ifFalse: [^ self error: 'index out of range'].
- index = 0
- ifTrue:[ submorphs := aCollection asArray, otherSubmorphs]
- ifFalse:[ index = otherSubmorphs size
- ifTrue:[ submorphs := otherSubmorphs, aCollection]
- ifFalse:[ submorphs := otherSubmorphs copyReplaceFrom: index + 1 to: index 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.
!
More information about the Squeak-dev
mailing list
|