--- a/VariablePanelController.st Thu Nov 12 15:55:33 1998 +0100
+++ b/VariablePanelController.st Fri Nov 13 15:20:00 1998 +0100
@@ -12,7 +12,7 @@
Controller subclass:#VariablePanelController
instanceVariableNames:'movedHandle prevPos startPos clickPos'
- classVariableNames:''
+ classVariableNames:'OpaqueResize'
poolDictionaries:''
category:'Interface-Support-Controllers'
!
@@ -46,6 +46,25 @@
"
! !
+!VariablePanelController class methodsFor:'defaults'!
+
+opaqueResize:aBoolean
+ "set/clear opaque-resizing.
+ If off (the default), the resizing takes place at the end of
+ the handle move operation (when the mouse button is released).
+ If on, the resizing is syncronous with the move.
+ On slow machines, it may make sense to leave it off."
+
+ OpaqueResize := aBoolean.
+
+ "
+ self opaqueResize:true
+ self opaqueResize:false
+ "
+
+ "Modified: / 13.11.1998 / 15:16:37 / cg"
+! !
+
!VariablePanelController methodsFor:'event handling'!
buttonMotion:state x:bx y:by
@@ -66,71 +85,80 @@
barHeight := view barHeight.
view orientation ~~ #vertical ifTrue:[
- pos := bx - startPos.
- "
- the two lines below will not allow resizing down to zero
- (so that some is always visible)
- "
+ pos := bx - startPos.
+ "
+ the two lines below will not allow resizing down to zero
+ (so that some is always visible)
+ "
"/ limitMin := barHeight // 2.
"/ limitMax := view width - barHeight.
- "
- these allow resizing to zero - which is better ?
- "
- limitMin := 0.
- limitMax := view innerWidth.
+ "
+ these allow resizing to zero - which is better ?
+ "
+ limitMin := 0.
+ limitMax := view innerWidth.
- movedHandle > 1 ifTrue:[
- limitMin := (subViews at:movedHandle) origin x + (barHeight // 2)
- ].
- movedHandle < (subViews size - 1) ifTrue:[
- limitMax := (subViews at:(movedHandle + 2)) origin x - barHeight
- ].
+ movedHandle > 1 ifTrue:[
+ limitMin := (subViews at:movedHandle) origin x + (barHeight // 2)
+ ].
+ movedHandle < (subViews size - 1) ifTrue:[
+ limitMax := (subViews at:(movedHandle + 2)) origin x - barHeight
+ ].
] ifFalse:[
- pos := by - startPos.
- "
- the two lines below will not allow resizing down to zero
- (so that some is always visible)
- "
+ pos := by - startPos.
+ "
+ the two lines below will not allow resizing down to zero
+ (so that some is always visible)
+ "
"/ limitMin := barHeight // 2.
"/ limitMax := view height - barHeight.
- "
- these allow resizing to zero - which is better ?
- "
- limitMin := 0.
- limitMax := view innerHeight.
+ "
+ these allow resizing to zero - which is better ?
+ "
+ limitMin := 0.
+ limitMax := view innerHeight.
- movedHandle > 1 ifTrue:[
- limitMin := (subViews at:movedHandle) origin y + (barHeight // 2)
- ].
- movedHandle < (subViews size - 1) ifTrue:[
- limitMax := (subViews at:(movedHandle + 2)) origin y - barHeight
- ].
+ movedHandle > 1 ifTrue:[
+ limitMin := (subViews at:movedHandle) origin y + (barHeight // 2)
+ ].
+ movedHandle < (subViews size - 1) ifTrue:[
+ limitMax := (subViews at:(movedHandle + 2)) origin y - barHeight
+ ].
].
limitMax := limitMax - barHeight.
(pos < limitMin) ifTrue:[ "check against view limits"
- pos := limitMin
+ pos := limitMin
] ifFalse:[
- (pos > limitMax) ifTrue:[
- pos := limitMax
- ]
+ (pos > limitMax) ifTrue:[
+ pos := limitMax
+ ]
].
prevPos == pos ifTrue:[^ self].
view orientation ~~ #vertical ifTrue:[
- oldHx := prevPos.
- newHx := pos.
- oldHy := newHy := 0.
+ oldHx := prevPos.
+ newHx := pos.
+ oldHy := newHy := 0.
] ifFalse:[
- oldHy := prevPos.
- newHy := pos.
- oldHx := newHx := 0.
+ oldHy := prevPos.
+ newHy := pos.
+ oldHx := newHx := 0.
+ ].
+
+ OpaqueResize ~~ true ifTrue:[
+ view invertHandleBarAtX:oldHx y:oldHy.
+ view invertHandleBarAtX:newHx y:newHy.
].
- view invertHandleBarAtX:oldHx y:oldHy.
- view invertHandleBarAtX:newHx y:newHy.
+ prevPos := pos.
- prevPos := pos
+ OpaqueResize == true ifTrue:[
+ self buttonRelease:1 x:bx y:by.
+ self buttonPress:1 x:bx y:by.
+ ]
+
+ "Modified: / 13.11.1998 / 15:13:47 / cg"
!
buttonPress:button x:bx y:by
@@ -172,8 +200,11 @@
thatsTheHandle ifTrue:[
movedHandle := handle.
- view grabPointer.
- view invertHandleBarAtX:hx y:hy.
+
+ OpaqueResize ~~ true ifTrue:[
+ view grabPointer.
+ view invertHandleBarAtX:hx y:hy.
+ ].
(group := view windowGroup) notNil ifTrue:[
group showCursor:view cursor
].
@@ -188,7 +219,7 @@
super buttonPress:button x:bx y:by
]
- "Modified: / 29.7.1998 / 15:52:35 / cg"
+ "Modified: / 13.11.1998 / 15:18:10 / cg"
!
buttonRelease:button x:bx y:by
@@ -204,7 +235,10 @@
isHorizontal := view orientation ~~ #vertical.
- view ungrabPointer.
+ OpaqueResize ~~ true ifTrue:[
+ view ungrabPointer.
+ ].
+
(group := view windowGroup) notNil ifTrue:[
group restoreCursors
].
@@ -216,7 +250,9 @@
] ifFalse:[
hX := 0. hY := prevPos.
].
- view invertHandleBarAtX:hX y:hY.
+ OpaqueResize ~~ true ifTrue:[
+ view invertHandleBarAtX:hX y:hY.
+ ].
"/ any change ?
isHorizontal ifTrue:[
@@ -264,7 +300,7 @@
super buttonRelease:button x:bx y:by
]
- "Modified: / 29.7.1998 / 15:52:43 / cg"
+ "Modified: / 13.11.1998 / 15:17:54 / cg"
!
pointerEnter:state x:x y:y
@@ -279,5 +315,5 @@
!VariablePanelController class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/VariablePanelController.st,v 1.16 1998-07-29 16:00:06 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/VariablePanelController.st,v 1.17 1998-11-13 14:20:00 cg Exp $'
! !