The Trunk: Morphic-cmm.1413.mcz

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

The Trunk: Morphic-cmm.1413.mcz

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

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

Name: Morphic-cmm.1413
Author: cmm
Time: 10 April 2018, 12:50:12.968668 am
UUID: 4e3f392f-220a-408a-b9eb-f20a9af4f668
Ancestors: Morphic-nice.1412

Integrate fix from Stéphane Rollandin that keeps ProportionalSplitter bars in their proportionally-assigned place after resizing windows.

=============== Diff against Morphic-nice.1412 ===============

Item was added:
+ ----- Method: ProportionalSplitterMorph>>balanceOffsets (in category 'layout') -----
+ balanceOffsets
+
+ 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>>mouseDown: (in category 'events') -----
  mouseDown: anEvent
  "If the user manually drags me, don't override him with auto positioning."
 
+ self setProperty: #fullDelta toValue: 0@0.
+
  anEvent redButtonChanged
  ifTrue: [ self withSiblingSplittersDo: [ : each | each stopStepping ] ]
  ifFalse:
  [ anEvent shiftPressed
  ifTrue: [ self startStepping ]
  ifFalse:
  [ self startStepping.
  self withSiblingSplittersDo: [ : each | each startStepping ] ] ].
  (self class showSplitterHandles not and: [ self bounds containsPoint: anEvent cursorPoint ]) ifTrue:
  [ oldColor := self color.
  self color: Color black ].
  ^ super mouseDown: anEvent!

Item was changed:
  ----- Method: ProportionalSplitterMorph>>mouseUp: (in category 'events') -----
  mouseUp: anEvent
  (self bounds containsPoint: anEvent cursorPoint)
  ifFalse: [anEvent hand showTemporaryCursor: nil].
  self class fastSplitterResize
  ifTrue: [self updateFromEvent: anEvent].
  traceMorph ifNotNil: [traceMorph delete. traceMorph := nil].
+ self color: self getOldColor.
+
+ self balanceOffsets!
- self color: self getOldColor!

Item was changed:
  ----- Method: ProportionalSplitterMorph>>reduceLeftRightImbalance (in category 'layout') -----
  reduceLeftRightImbalance
  | correction |
  correction := self leftRightImbalance.
  correction abs > 1
  ifTrue:
  [ (self proposedCorrectionWouldCauseFocusChange: correction) ifFalse:
  [ self repositionBy:
  (correction abs > 4
  ifTrue: [ correction sign * 2 @ 0 ]
  ifFalse: [ correction sign @ 0 ]) ] ]
  ifFalse:
+ [ self class smartVerticalSplitters ifFalse:
+ [ self
+ stopStepping ;
+ balanceOffsets ] ].
- [ self class smartVerticalSplitters ifFalse: [ self stopStepping ] ].
  ^ correction!

Item was changed:
  ----- Method: ProportionalSplitterMorph>>reduceTopBottomImbalance (in category 'layout') -----
  reduceTopBottomImbalance
  | correction |
  (correction := self topBottomCorrection) isZero
  ifTrue:
+ [ self class smartHorizontalSplitters ifFalse:
+ [ self
+ stopStepping ;
+ balanceOffsets ] ]
- [ self class smartHorizontalSplitters ifFalse: [ self stopStepping ] ]
  ifFalse:
  [ (self proposedCorrectionWouldCauseFocusChange: correction) ifFalse: [ self repositionBy: 0 @ correction ] ].
  ^ correction!

Item was changed:
  ----- Method: ProportionalSplitterMorph>>repositionBy: (in category 'layout') -----
  repositionBy: delta
  | selfTop selfBottom selfLeft selfRight |
+
+ self setProperty: #fullDelta toValue: ((self valueOfProperty: #fullDelta) ifNil: [0@0]) + delta.
+
  leftOrTop do:
  [ : each | | firstRight firstBottom firstLeft firstTop |
  firstRight := each layoutFrame rightOffset ifNil: [ 0 ].
  firstBottom := each layoutFrame bottomOffset ifNil: [ 0 ].
  each layoutFrame rightOffset: firstRight + delta x.
  each layoutFrame bottomOffset: firstBottom + delta y.
  each layoutFrame hasFixedHeight ifTrue: [
  firstTop := each layoutFrame topOffset ifNil: [ 0 ].
  each layoutFrame topOffset: firstTop + delta y ].
  each layoutFrame hasFixedWidth ifTrue: [
  firstLeft := each layoutFrame leftOffset ifNil: [ 0 ].
  each layoutFrame leftOffset: firstLeft + delta x. ] ].
  rightOrBottom do:
  [ : each | | secondLeft secondTop secondRight secondBottom |
  secondLeft := each layoutFrame leftOffset ifNil: [ 0 ].
  secondTop := each layoutFrame topOffset ifNil: [ 0 ].
  each layoutFrame leftOffset: secondLeft + delta x.
  each layoutFrame topOffset: secondTop + delta y.
  each layoutFrame hasFixedHeight ifTrue: [
  secondBottom := each layoutFrame bottomOffset ifNil: [ 0 ].
  each layoutFrame bottomOffset: secondBottom + delta y. ].
  each layoutFrame hasFixedWidth ifTrue: [
  secondRight := each layoutFrame rightOffset ifNil: [ 0 ].
  each layoutFrame rightOffset: secondRight + delta x. ] ].
 
  selfTop := self layoutFrame topOffset ifNil: [ 0 ].
  selfBottom := self layoutFrame bottomOffset ifNil: [ 0 ].
  selfLeft := self layoutFrame leftOffset ifNil: [ 0 ].
  selfRight := self layoutFrame rightOffset ifNil: [ 0 ].
  self layoutFrame
  topOffset: selfTop + delta y ;
  bottomOffset: selfBottom + delta y ;
  leftOffset: selfLeft + delta x ;
  rightOffset: selfRight + delta x.
  self owner layoutChanged.
  self movements removeFirst; add: (splitsTopAndBottom ifTrue: [ delta y sign ] ifFalse: [ delta x sign ])!



Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-cmm.1413.mcz

Chris Muller-3
Hey Stéphane,

I've had to revert this my personal image could you possibly turn on
Smart Splitters for a bit just to take a look at your change in that
context?  There are many ways to reproduce the problem, just for
concreteness here are steps to show the problem, after turning on both
Smart Splitters:

  - open a hierarchy browser on Integer.
  - Once the horizontal splitter bar stops moving on its own, click
and drag it downward a few pixels.
  - BOOM!  Upon releasing the mouse button, the splitter bar jumps way
down to the bottom.  OR, now I'm actually getting a DoesNotUnderstad
-->  UndefinedObject>>#y.

I think #balanceOffets is not bullet-proof from leaving the splitters
in an inconsistent state, but because of the dynamics of Smart
Splitters, it needs to be.  If you turn on Smart Splitters.

On Tue, Apr 10, 2018 at 12:50 AM,  <[hidden email]> wrote:

> Chris Muller uploaded a new version of Morphic to project The Trunk:
> http://source.squeak.org/trunk/Morphic-cmm.1413.mcz
>
> ==================== Summary ====================
>
> Name: Morphic-cmm.1413
> Author: cmm
> Time: 10 April 2018, 12:50:12.968668 am
> UUID: 4e3f392f-220a-408a-b9eb-f20a9af4f668
> Ancestors: Morphic-nice.1412
>
> Integrate fix from Stéphane Rollandin that keeps ProportionalSplitter bars in their proportionally-assigned place after resizing windows.
>
> =============== Diff against Morphic-nice.1412 ===============
>
> Item was added:
> + ----- Method: ProportionalSplitterMorph>>balanceOffsets (in category 'layout') -----
> + balanceOffsets
> +
> +       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>>mouseDown: (in category 'events') -----
>   mouseDown: anEvent
>         "If the user manually drags me, don't override him with auto positioning."
>
> +       self setProperty: #fullDelta toValue: 0@0.
> +
>         anEvent redButtonChanged
>                 ifTrue: [ self withSiblingSplittersDo: [ : each | each stopStepping ] ]
>                 ifFalse:
>                         [ anEvent shiftPressed
>                                 ifTrue: [ self startStepping ]
>                                 ifFalse:
>                                         [ self startStepping.
>                                         self withSiblingSplittersDo: [ : each | each startStepping ] ] ].
>         (self class showSplitterHandles not and: [ self bounds containsPoint: anEvent cursorPoint ]) ifTrue:
>                 [ oldColor := self color.
>                 self color: Color black ].
>         ^ super mouseDown: anEvent!
>
> Item was changed:
>   ----- Method: ProportionalSplitterMorph>>mouseUp: (in category 'events') -----
>   mouseUp: anEvent
>         (self bounds containsPoint: anEvent cursorPoint)
>                 ifFalse: [anEvent hand showTemporaryCursor: nil].
>         self class fastSplitterResize
>                 ifTrue: [self updateFromEvent: anEvent].
>         traceMorph ifNotNil: [traceMorph delete. traceMorph := nil].
> +       self color: self getOldColor.
> +
> +       self balanceOffsets!
> -       self color: self getOldColor!
>
> Item was changed:
>   ----- Method: ProportionalSplitterMorph>>reduceLeftRightImbalance (in category 'layout') -----
>   reduceLeftRightImbalance
>         | correction |
>         correction := self leftRightImbalance.
>         correction abs > 1
>                 ifTrue:
>                         [ (self proposedCorrectionWouldCauseFocusChange: correction) ifFalse:
>                                 [ self repositionBy:
>                                         (correction abs > 4
>                                                 ifTrue: [ correction sign * 2 @ 0 ]
>                                                 ifFalse: [ correction sign @ 0 ]) ] ]
>                 ifFalse:
> +                       [ self class smartVerticalSplitters ifFalse:
> +                               [ self
> +                                        stopStepping ;
> +                                        balanceOffsets ] ].
> -                       [ self class smartVerticalSplitters ifFalse: [ self stopStepping ] ].
>         ^ correction!
>
> Item was changed:
>   ----- Method: ProportionalSplitterMorph>>reduceTopBottomImbalance (in category 'layout') -----
>   reduceTopBottomImbalance
>         | correction |
>         (correction := self topBottomCorrection) isZero
>                 ifTrue:
> +                       [ self class smartHorizontalSplitters ifFalse:
> +                               [ self
> +                                        stopStepping ;
> +                                        balanceOffsets ] ]
> -                       [ self class smartHorizontalSplitters ifFalse: [ self stopStepping ] ]
>                 ifFalse:
>                         [ (self proposedCorrectionWouldCauseFocusChange: correction) ifFalse: [ self repositionBy: 0 @ correction ] ].
>         ^ correction!
>
> Item was changed:
>   ----- Method: ProportionalSplitterMorph>>repositionBy: (in category 'layout') -----
>   repositionBy: delta
>         | selfTop selfBottom selfLeft selfRight |
> +
> +       self setProperty: #fullDelta toValue: ((self valueOfProperty: #fullDelta) ifNil: [0@0]) + delta.
> +
>         leftOrTop do:
>                 [ : each | | firstRight firstBottom firstLeft firstTop |
>                 firstRight := each layoutFrame rightOffset ifNil: [ 0 ].
>                 firstBottom := each layoutFrame bottomOffset ifNil: [ 0 ].
>                 each layoutFrame rightOffset: firstRight + delta x.
>                 each layoutFrame bottomOffset: firstBottom + delta y.
>                 each layoutFrame hasFixedHeight ifTrue: [
>                         firstTop := each layoutFrame topOffset ifNil: [ 0 ].
>                         each layoutFrame topOffset: firstTop + delta y ].
>                 each layoutFrame hasFixedWidth ifTrue: [
>                         firstLeft := each layoutFrame leftOffset ifNil: [ 0 ].
>                         each layoutFrame leftOffset: firstLeft + delta x. ] ].
>         rightOrBottom do:
>                 [ : each | | secondLeft secondTop secondRight secondBottom |
>                 secondLeft := each layoutFrame leftOffset ifNil: [ 0 ].
>                 secondTop := each layoutFrame topOffset ifNil: [ 0 ].
>                 each layoutFrame leftOffset: secondLeft + delta x.
>                 each layoutFrame topOffset: secondTop + delta y.
>                 each layoutFrame hasFixedHeight ifTrue: [
>                         secondBottom := each layoutFrame bottomOffset ifNil: [ 0 ].
>                         each layoutFrame bottomOffset: secondBottom + delta y. ].
>                 each layoutFrame hasFixedWidth ifTrue: [
>                         secondRight := each layoutFrame rightOffset ifNil: [ 0 ].
>                         each layoutFrame rightOffset: secondRight + delta x. ] ].
>
>         selfTop := self layoutFrame topOffset ifNil: [ 0 ].
>         selfBottom := self layoutFrame bottomOffset ifNil: [ 0 ].
>         selfLeft := self layoutFrame leftOffset ifNil: [ 0 ].
>         selfRight := self layoutFrame rightOffset ifNil: [ 0 ].
>         self layoutFrame
>                  topOffset: selfTop + delta y ;
>                  bottomOffset: selfBottom + delta y ;
>                  leftOffset: selfLeft + delta x ;
>                  rightOffset: selfRight + delta x.
>         self owner layoutChanged.
>         self movements removeFirst; add: (splitsTopAndBottom ifTrue: [ delta y sign ] ifFalse: [ delta x sign ])!
>
>
>
>