[squeak-dev] The Trunk: Morphic-cmm.680.mcz
commits at source.squeak.org
commits at source.squeak.org
Tue Sep 10 18:11:58 UTC 2013
Chris Muller uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-cmm.680.mcz
==================== Summary ====================
Name: Morphic-cmm.680
Author: cmm
Time: 10 September 2013, 1:10:23.389 pm
UUID: 8b69c5f3-2a26-41ef-9584-ff0fbb507626
Ancestors: Morphic-cmm.679
Tame the twitching scenario when using Smart Splitters.
=============== Diff against Morphic-cmm.679 ===============
Item was changed:
----- Method: PluggableListMorph>>visibleList (in category 'accessing') -----
visibleList
- "Fix this to return just the items that are in the list."
^ list isEmptyOrNil
ifTrue: [ Array empty ]
ifFalse:
[ list
copyFrom: self topVisibleRowIndex
to: (self bottomVisibleRowIndex min: list size) ]!
Item was changed:
AbstractResizerMorph subclass: #ProportionalSplitterMorph
+ instanceVariableNames: 'leftOrTop rightOrBottom splitsTopAndBottom oldColor traceMorph handle movements'
- instanceVariableNames: 'leftOrTop rightOrBottom splitsTopAndBottom oldColor traceMorph handle'
classVariableNames: 'SmartHorizontalSplitters SmartVerticalSplitters'
poolDictionaries: ''
category: 'Morphic-Windows'!
!ProportionalSplitterMorph commentStamp: 'jmv 1/29/2006 17:16' prior: 0!
I am the morph the user grabs to adjust pane splitters.!
Item was changed:
----- Method: ProportionalSplitterMorph>>initialize (in category 'initialization') -----
initialize
super initialize.
self hResizing: #spaceFill.
self vResizing: #spaceFill.
splitsTopAndBottom := false.
leftOrTop := OrderedCollection new.
rightOrBottom := OrderedCollection new.
Preferences showSplitterHandles
ifTrue: [
handle := CircleMorph new
borderWidth: 0;
extent: 4 at 4;
yourself.
handle fillStyle: ((GradientFillStyle
ramp: {0.0 -> Preferences defaultWindowColor muchLighter.
1.0 -> Preferences defaultWindowColor darker})
origin: handle topLeft;
direction: 0 @ handle bounds extent y;
normal: handle bounds extent x @ 0;
radial: false;
yourself).
+ self addMorphCentered: handle].
+ self initializeMovements!
- self addMorphCentered: handle].!
Item was added:
+ ----- Method: ProportionalSplitterMorph>>initializeMovements (in category 'initialization') -----
+ initializeMovements
+ movements := OrderedCollection with: 0 with: 0 with: 0!
Item was added:
+ ----- Method: ProportionalSplitterMorph>>movements (in category 'layout') -----
+ movements
+ "Used to track my pattern of movement for the last 3 steps to fix the twitching."
+ "Lazy-init for now for smooth transition -- want to convert this back to direct-var access after a few months."
+ ^ movements ifNil: [ self initializeMovements ]!
Item was changed:
----- Method: ProportionalSplitterMorph>>repositionBy: (in category 'layout') -----
repositionBy: delta
| selfTop selfBottom selfLeft selfRight |
leftOrTop do:
[ : each | | firstRight firstBottom |
firstRight := each layoutFrame rightOffset ifNil: [ 0 ].
firstBottom := each layoutFrame bottomOffset ifNil: [ 0 ].
each layoutFrame rightOffset: firstRight + delta x.
each layoutFrame bottomOffset: firstBottom + delta y ].
rightOrBottom do:
[ : each | | secondLeft secondTop |
secondLeft := each layoutFrame leftOffset ifNil: [ 0 ].
secondTop := each layoutFrame topOffset ifNil: [ 0 ].
each layoutFrame leftOffset: secondLeft + delta x.
each layoutFrame topOffset: secondTop + delta y ].
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 ])!
- self owner layoutChanged!
Item was changed:
----- Method: ProportionalSplitterMorph>>stepTime (in category 'events') -----
stepTime
- | pause |
"When a splitter finds itself in the right place, let it rest for about 3 seconds to avoid performance impacts of constant, rapid stepping."
+ | pause |
pause := (2900 to: 3100) atRandom "to discourage any patternistic emergence".
+ ^ ({#(1 -1 1 ). #(-1 1 -1 )} includes: self movements asArray)
+ ifTrue: [ pause "don't twitch" ]
- ^ splitsTopAndBottom
- ifTrue:
- [ self topBottomCorrection isZero
- ifTrue: [ pause ]
- ifFalse: [ 0 ] ]
ifFalse:
+ [ splitsTopAndBottom
+ ifTrue:
+ [ self topBottomCorrection isZero
+ ifTrue: [ pause ]
+ ifFalse: [ 0 ] ]
+ ifFalse:
+ [ self leftRightImbalance abs > 1
+ ifTrue: [ ">1 rather than 0 to discourage one-off twitching"
+ 0 ]
+ ifFalse: [ pause ] ] ]!
- [ self leftRightImbalance abs > 1 ">1 rather than 0 to discourage one-off twitching"
- ifTrue: [ 0 ]
- ifFalse: [ pause ] ]!
More information about the Squeak-dev
mailing list
|