[squeak-dev] The Inbox: Morphic-ct.1527.mcz

Thiede, Christoph Christoph.Thiede at student.hpi.uni-potsdam.de
Fri Sep 20 18:27:15 UTC 2019


I did not change the behavior of #beReplacementFor:. However, I wonder why it is forbidden to replace a morph from a different world.

Do you actually want this?

________________________________
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von commits at source.squeak.org <commits at source.squeak.org>
Gesendet: Freitag, 20. September 2019 20:25:38
An: squeak-dev at lists.squeakfoundation.org
Betreff: [squeak-dev] The Inbox: Morphic-ct.1527.mcz

A new version of Morphic was added to project The Inbox:
http://source.squeak.org/inbox/Morphic-ct.1527.mcz

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

Name: Morphic-ct.1527
Author: ct
Time: 20 September 2019, 8:25:26.969726 pm
UUID: 92cf521a-6df8-784b-b6c7-7be9cdcf8493
Ancestors: Morphic-mt.1526

Allow for constructing CollapsedMorphs for different owners

Primarily, it was not possible to create a CollapsedMorph for a Morph not-yet-in-world before. Now you can do:

(CollapsedMorph createReplacementFor: Morph new in: World) centerWithWrappees: 100 @ 100

=============== Diff against Morphic-mt.1526 ===============

Item was added:
+ ----- Method: CollapsedMorph class>>createReplacementFor:in: (in category 'instance creation') -----
+ createReplacementFor: aMorph in: anOwner
+
+        ^ self new
+                beReplacementFor: aMorph in: anOwner;
+                yourself!

Item was changed:
  ----- Method: CollapsedMorph>>beReplacementFor: (in category 'collapse/expand') -----
  beReplacementFor: aMorph
+        "Encapsulate aMorph with the CollapsedMorph and display the latter"

+        | itsWorld |
-        | itsWorld priorPosition |
         (itsWorld := aMorph world) ifNil: [^self].
+        self beReplacementFor: aMorph in: itsWorld.!
-        uncollapsedMorph := aMorph.
-
-        self setLabel: aMorph externalName.
-        aMorph delete.
-        itsWorld addMorphFront: self.
-        self collapseOrExpand.
-        (priorPosition := aMorph valueOfProperty: #collapsedPosition ifAbsent: [nil])
-        ifNotNil:
-                [self position: priorPosition].
- !

Item was added:
+ ----- Method: CollapsedMorph>>beReplacementFor:in: (in category 'collapse/expand') -----
+ beReplacementFor: aMorph in: anOwner
+        "Encapsulate aMorph with the CollapsedMorph and display the latter in anOwner"
+
+        | priorPosition |
+        uncollapsedMorph := aMorph.
+
+        self setLabel: aMorph externalName.
+        aMorph delete.
+        self privateOwner: anOwner. "lest RealEstateAgent fail at positioning me"
+        self collapseOrExpand.
+        anOwner addMorphFront: self.
+        (priorPosition := aMorph valueOfProperty: #collapsedPosition ifAbsent: [nil])
+                ifNotNil: [self position: priorPosition].!

Item was added:
+ ----- Method: CollapsedMorph>>centerWithWrappees: (in category 'adjusting') -----
+ centerWithWrappees: aPoint
+
+        self center: aPoint.
+        uncollapsedMorph center: aPoint.!

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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20190920/1bdf4313/attachment.html>


More information about the Squeak-dev mailing list