The Trunk: Morphic-cmm.1417.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-cmm.1417.mcz

commits-2
Chris Muller uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-cmm.1417.mcz

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

Name: Morphic-cmm.1417
Author: cmm
Time: 20 April 2018, 4:48:39.737614 pm
UUID: f6323e68-00dc-4929-83a2-c0a2e86f0815
Ancestors: Morphic-kfr.1416

#balanceOffsets needs or assumes atomicity with movement of the splitter bar, so it must be called on every #step for the SplitterMorph variables to remain in a consistent state.  Doing this requires an appropriately-defensive guard at the top.

=============== Diff against Morphic-kfr.1416 ===============

Item was changed:
  ----- Method: ProportionalSplitterMorph>>balanceOffsets (in category 'layout') -----
  balanceOffsets
+ (self valueOfProperty: #fullDelta) ifNil: [self setProperty: #fullDelta toValue: (0@0)] .
 
  self layoutFrame hasFixedHeight ifTrue: [
  | otop obot ctop cbot topf |
 
  otop := (owner submorphs detect: [:m |
  m layoutFrame topFraction isZero] ifNone: [^ self]) in: [:tm |
  tm top - (tm layoutFrame topOffset ifNil: [0])].
 
  obot := (owner submorphs detect: [:m |
  m layoutFrame bottomFraction = 1] ifNone: [^ self]) in: [:tm |
  tm bottom - (tm layoutFrame bottomOffset ifNil: [0])].
 
  ctop := (self layoutFrame topFraction * (obot - otop)) rounded
  + otop + (self layoutFrame topOffset ifNil: [0]).
  cbot := (self layoutFrame bottomFraction * (obot - otop)) rounded
  + otop + (self layoutFrame bottomOffset ifNil: [0]).
 
  topf := self layoutFrame topFraction.
  self layoutFrame topFraction:  ((ctop + cbot) * 0.5 - otop) / (obot - otop) asFloat.
  self layoutFrame bottomFraction: self layoutFrame topFraction.
  self layoutFrame topOffset: ctop -
  (self layoutFrame topFraction * (obot - otop) + otop) rounded.
  self layoutFrame bottomOffset: cbot -
  (self layoutFrame bottomFraction * (obot - otop) + otop) rounded..
 
  (leftOrTop copy union: rightOrBottom) do: [:m |
  (m layoutFrame topFraction closeTo: topf) ifTrue: [
  m layoutFrame topFraction: self layoutFrame topFraction.
  m layoutFrame topOffset:
  m layoutFrame topOffset - (self valueOfProperty: #fullDelta) y].
  (m layoutFrame bottomFraction closeTo: topf) ifTrue: [
  m layoutFrame bottomFraction: self layoutFrame topFraction.
  m layoutFrame bottomOffset:
  m layoutFrame bottomOffset - (self valueOfProperty: #fullDelta) y.]]] .
 
  self layoutFrame hasFixedWidth ifTrue: [
  | oleft oright cleft cright leftf |
 
  oleft := (owner submorphs detect: [:m |
  m layoutFrame leftFraction isZero] ifNone: [^ self]) in: [:tm |
  tm left - (tm layoutFrame leftOffset ifNil: [0])].
 
  oright := (owner submorphs detect: [:m |
  m layoutFrame rightFraction = 1] ifNone: [^ self]) in: [:tm |
  tm right - (tm layoutFrame rightOffset ifNil: [0])].
 
  cleft := (self layoutFrame leftFraction * (oright - oleft)) rounded
  + oleft + (self layoutFrame leftOffset ifNil: [0]).
  cright := (self layoutFrame rightFraction * (oright - oleft)) rounded
  + oleft + (self layoutFrame rightOffset ifNil: [0]).
 
  leftf := self layoutFrame leftFraction.
  self layoutFrame leftFraction: ((cleft + cright) * 0.5 - oleft) / (oright - oleft) asFloat.
  self layoutFrame rightFraction: self layoutFrame leftFraction.
 
  self layoutFrame leftOffset: cleft -
  (self layoutFrame leftFraction * (oright - oleft) + oleft) rounded.
  self layoutFrame rightOffset: cright -
  (self layoutFrame rightFraction * (oright - oleft) + oleft) rounded.
 
  (leftOrTop copy union: rightOrBottom) do: [:m |
  (m layoutFrame leftFraction closeTo: leftf) ifTrue: [
  m layoutFrame leftFraction: self layoutFrame leftFraction.
  m layoutFrame leftOffset:
  m layoutFrame leftOffset - (self valueOfProperty: #fullDelta) x].
  (m layoutFrame rightFraction closeTo: leftf) ifTrue: [
  m layoutFrame rightFraction: self layoutFrame leftFraction.
  m layoutFrame rightOffset:
  m layoutFrame rightOffset - (self valueOfProperty: #fullDelta) x.]]] .
 
  self removeProperty: #fullDelta.
  owner layoutChanged
  !

Item was changed:
  ----- Method: ProportionalSplitterMorph>>step (in category 'events') -----
  step
  splitsTopAndBottom
  ifTrue: [ self reduceTopBottomImbalance ]
  ifFalse:
  [ self reduceLeftRightImbalance abs > 1 ifTrue:
  [ self splittersLeftDo:
  [ : splitter | splitter reduceLeftRightImbalance ].
  self splittersRightDo:
+ [ : splitter | splitter reduceLeftRightImbalance ] ] ].
+ self balanceOffsets!
- [ : splitter | splitter reduceLeftRightImbalance ] ] ]!