The Inbox: Morphic-ct.1527.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: Morphic-ct.1527.mcz

commits-2
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!


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Morphic-ct.1527.mcz

Christoph Thiede

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 <[hidden email]> im Auftrag von [hidden email] <[hidden email]>
Gesendet: Freitag, 20. September 2019 20:25:38
An: [hidden email]
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!




Carpe Squeak!