The Trunk: Morphic-mt.1511.mcz

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

The Trunk: Morphic-mt.1511.mcz

commits-2
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1511.mcz

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

Name: Morphic-mt.1511
Author: mt
Time: 2 September 2019, 7:52:46.126688 am
UUID: ed977144-0f6c-074f-86c5-a770cc48abad
Ancestors: Morphic-mt.1510

Fixes a recent regression with Morph >> #ownerChanged. Adds comments about this issue.

This relates to my recent changes in docking bars where I replaced the #noteNewOwner: callback in items with #addedMorph: in owner. We might want to revert that change because #addedMorph: needs to check for #isMenuItemMorph to support other stuff such as ClockMorph and SearchBar.

=============== Diff against Morphic-mt.1510 ===============

Item was changed:
  ----- Method: Morph>>doLayoutIn: (in category 'layout') -----
  doLayoutIn: layoutBounds
  "Compute a new layout based on the given layout bounds."
 
  | box priorBounds |
  "0) Quick return. No children means no effect in layout policies. Use #minWidth and #minHeight to implement #shrinkWrap for morphs without submorphs."
  self hasSubmorphs ifFalse: [^ fullBounds := self outerBounds].
 
  "X.1) Prepare redraw. Testing for #bounds or #layoutBounds would be sufficient to figure out if we need an invalidation afterwards but #outerBounds is what we need for all leaf nodes so we use that"
  priorBounds := self outerBounds.
 
+ "1) Give our children a chance to manually adjust *before* layout (cell) computation. This allows morphs to layout in their owner without having to use a layout policy."
+ self submorphsDo: [:m | m ownerChanged].
+
+ "2) Compute the new layout. This goes down the entire morph hierarchy. See #layoutInBounds: and #minExtent, which are the usual layout-policy callbacks."
- "1) Compute the new layout. This goes down the entire morph hierarchy. See #layoutInBounds: and #minExtent, which are the usual layout-policy callbacks."
  self layoutPolicy ifNotNil: [:layout |
 
+ "2.1) Compute the new layout."
- "1.1) Compute the new layout."
  self removeProperty: #doLayoutAgain.
  layout layout: self in: layoutBounds.
 
+ "2.2) Do one additional run on the layout if requested in #layoutInBounds:."
- "1.2) Do one additional run on the layout if requested in #layoutInBounds:."
  (self hasProperty: #doLayoutAgain) ifTrue: [
  self removeProperty: #doLayoutAgain.
  layout flushLayoutCache.
  layout layout: self in: layoutBounds].
  self assert: (self hasProperty: #doLayoutAgain) not].
+
-
- "2) Give our children a chance to manually adjust after layout computation. This allows morphs to layout in their owner without having to use a layout policy."
- self submorphsDo: [:m | m ownerChanged].
-
  "3) Watch out for minimal extent and apply #shrinkWrap constraints."
  self adjustLayoutBounds.
 
  "4) Compute and set the new full bounds. IMPORTANT to finish layout computation."
  fullBounds := self privateFullBounds.
 
  "X.2) Redraw."
  box := self outerBounds.
  box = priorBounds ifFalse: [
  self invalidRect: (priorBounds quickMerge: box)].!

Item was changed:
  ----- Method: Morph>>minHeight (in category 'layout') -----
  minHeight
+ "Layout specific. If you don't use a layout policy but claim to be #shrinkWrap on the vertical axis, use #minHeight to answer that shrink-wrapped height. See MenuItemMorph."
+
- "answer the receiver's minHeight"
  ^ self
  valueOfProperty: #minHeight
  ifAbsent: [1]!

Item was changed:
  ----- Method: Morph>>minWidth (in category 'layout') -----
  minWidth
+ "Layout specific. If you don't use a layout policy but claim to be #shrinkWrap on the horizontal axis, use #minWidth to answer that shrink-wrapped width."
+
- "answer the receiver's minWidth"
  ^ self
  valueOfProperty: #minWidth
  ifAbsent: [1]!