VariablePanelController.st
author Claus Gittinger <cg@exept.de>
Sat, 20 Jun 2009 10:47:07 +0200
changeset 3901 113dd960ba11
parent 2665 954415c8fa83
child 3921 f7f8661be48b
permissions -rw-r--r--
*** empty log message ***
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
104
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
     1
"
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
     2
 COPYRIGHT (c) 1995 by Claus Gittinger
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
     3
              All Rights Reserved
104
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
     4
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
    11
"
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
    12
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
    13
2223
75e5e3dc70be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2179
diff changeset
    14
"{ Package: 'stx:libwidg' }"
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
    15
104
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
    16
Controller subclass:#VariablePanelController
2582
edd71c89378d opaqueResize if shift is pressed
Claus Gittinger <cg@exept.de>
parents: 2529
diff changeset
    17
	instanceVariableNames:'movedHandle prevPos clickPos saveCursor startResizing resizeMode
edd71c89378d opaqueResize if shift is pressed
Claus Gittinger <cg@exept.de>
parents: 2529
diff changeset
    18
		opaqueResizing'
2005
9b1ff373a8ad moved opaqueResize setting to userPreferences
Claus Gittinger <cg@exept.de>
parents: 1871
diff changeset
    19
	classVariableNames:''
582
e151eeae2c9a documentation
Claus Gittinger <cg@exept.de>
parents: 294
diff changeset
    20
	poolDictionaries:''
e151eeae2c9a documentation
Claus Gittinger <cg@exept.de>
parents: 294
diff changeset
    21
	category:'Interface-Support-Controllers'
104
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
    22
!
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
    23
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
    24
!VariablePanelController class methodsFor:'documentation'!
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
    25
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
    26
copyright
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
    27
"
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
    28
 COPYRIGHT (c) 1995 by Claus Gittinger
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
    29
              All Rights Reserved
104
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
    30
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
    31
 This software is furnished under a license and may be used
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
    32
 only in accordance with the terms of that license and with the
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
    33
 inclusion of the above copyright notice.   This software may not
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
    34
 be provided or otherwise made available to, or used by, any
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
    35
 other person.  No title to or ownership of the software is
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
    36
 hereby transferred.
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
    37
"
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
    38
104
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
    39
!
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
    40
150
claus
parents: 131
diff changeset
    41
documentation
claus
parents: 131
diff changeset
    42
"
claus
parents: 131
diff changeset
    43
    An abstract class for variablePanel controllers;
claus
parents: 131
diff changeset
    44
    normally, not used directly by applications, these are created automatically
claus
parents: 131
diff changeset
    45
    whenever a variablePanel is created.
claus
parents: 131
diff changeset
    46
    Instances are responsible for tracking the mouse pointer and resize the
claus
parents: 131
diff changeset
    47
    views (a panel) subviews as appropriate.
582
e151eeae2c9a documentation
Claus Gittinger <cg@exept.de>
parents: 294
diff changeset
    48
e151eeae2c9a documentation
Claus Gittinger <cg@exept.de>
parents: 294
diff changeset
    49
    [author:]
e151eeae2c9a documentation
Claus Gittinger <cg@exept.de>
parents: 294
diff changeset
    50
        Claus Gittinger
150
claus
parents: 131
diff changeset
    51
"
1722
cfbd32394b80 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
    52
1720
896886032334 added opaqueResize option.
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
    53
896886032334 added opaqueResize option.
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
    54
! !
896886032334 added opaqueResize option.
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
    55
104
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
    56
!VariablePanelController methodsFor:'event handling'!
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
    57
161
claus
parents: 150
diff changeset
    58
buttonMotion:state x:bx y:by
104
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
    59
    "mouse-button was moved while pressed;
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
    60
     clear prev handleBar and draw handle bar at new position
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
    61
    "
2652
c9ebf9f7efa6 correclty cleanup movedHandle value
Claus Gittinger <cg@exept.de>
parents: 2582
diff changeset
    62
    |nextPos layout entered hindex handle|
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
    63
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
    64
    state == 0 ifTrue:[
2652
c9ebf9f7efa6 correclty cleanup movedHandle value
Claus Gittinger <cg@exept.de>
parents: 2582
diff changeset
    65
        movedHandle notNil ifTrue:[
c9ebf9f7efa6 correclty cleanup movedHandle value
Claus Gittinger <cg@exept.de>
parents: 2582
diff changeset
    66
            "/ oops - how can this happen
c9ebf9f7efa6 correclty cleanup movedHandle value
Claus Gittinger <cg@exept.de>
parents: 2582
diff changeset
    67
            self buttonRelease:1 x:bx y:bx.
c9ebf9f7efa6 correclty cleanup movedHandle value
Claus Gittinger <cg@exept.de>
parents: 2582
diff changeset
    68
            movedHandle := nil
c9ebf9f7efa6 correclty cleanup movedHandle value
Claus Gittinger <cg@exept.de>
parents: 2582
diff changeset
    69
        ].
c9ebf9f7efa6 correclty cleanup movedHandle value
Claus Gittinger <cg@exept.de>
parents: 2582
diff changeset
    70
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
    71
        view snapMode isNil ifTrue:[^ self].
104
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
    72
2652
c9ebf9f7efa6 correclty cleanup movedHandle value
Claus Gittinger <cg@exept.de>
parents: 2582
diff changeset
    73
        handle := self detectHandleIndexAt:bx y:by.
c9ebf9f7efa6 correclty cleanup movedHandle value
Claus Gittinger <cg@exept.de>
parents: 2582
diff changeset
    74
        handle isNil ifTrue:[^ self].
2529
9501a63ce16c handler movement fixed
Claus Gittinger <cg@exept.de>
parents: 2512
diff changeset
    75
"/
2652
c9ebf9f7efa6 correclty cleanup movedHandle value
Claus Gittinger <cg@exept.de>
parents: 2582
diff changeset
    76
"/        hindex ~~ handle ifTrue:[
2529
9501a63ce16c handler movement fixed
Claus Gittinger <cg@exept.de>
parents: 2512
diff changeset
    77
"/            self pointerLeave:0.
2652
c9ebf9f7efa6 correclty cleanup movedHandle value
Claus Gittinger <cg@exept.de>
parents: 2582
diff changeset
    78
"/            handle := hindex.
2529
9501a63ce16c handler movement fixed
Claus Gittinger <cg@exept.de>
parents: 2512
diff changeset
    79
"/        ].
2652
c9ebf9f7efa6 correclty cleanup movedHandle value
Claus Gittinger <cg@exept.de>
parents: 2582
diff changeset
    80
"/        handle isNil ifTrue:[^ self].
104
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
    81
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
    82
        "check entering click button ...."
2652
c9ebf9f7efa6 correclty cleanup movedHandle value
Claus Gittinger <cg@exept.de>
parents: 2582
diff changeset
    83
        layout  := view snapLayoutAt:handle.
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
    84
        entered := layout notNil and:[layout containsPointX:bx y:by].
104
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
    85
2529
9501a63ce16c handler movement fixed
Claus Gittinger <cg@exept.de>
parents: 2512
diff changeset
    86
        entered ~~ (self isSnapEntered) ifTrue:[
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
    87
            entered ifTrue:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
    88
                saveCursor := view cursor.
2239
31a57c0002a2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2236
diff changeset
    89
                view cursor:(Cursor hand).
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
    90
            ] ifFalse:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
    91
                view cursor:saveCursor.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
    92
                saveCursor := nil.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
    93
            ].
2652
c9ebf9f7efa6 correclty cleanup movedHandle value
Claus Gittinger <cg@exept.de>
parents: 2582
diff changeset
    94
            view drawSnapAt:handle
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
    95
        ].
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
    96
        ^ self
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
    97
    ].
2396
8340b529e8ce fix for windows MOUSE_MOVE event bug
Claus Gittinger <cg@exept.de>
parents: 2284
diff changeset
    98
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
    99
    (movedHandle isNil or:[resizeMode isNil]) ifTrue:[^ self].
1215
0d9e67bdfbe4 check for any change before moving handle (tiny optimization)
Claus Gittinger <cg@exept.de>
parents: 872
diff changeset
   100
2396
8340b529e8ce fix for windows MOUSE_MOVE event bug
Claus Gittinger <cg@exept.de>
parents: 2284
diff changeset
   101
    "/ kludge: workaround Windows bug, which sends a MOUSEMOVE
8340b529e8ce fix for windows MOUSE_MOVE event bug
Claus Gittinger <cg@exept.de>
parents: 2284
diff changeset
   102
    "/ (with same coordinate as previous MOUSE_DOWN
8340b529e8ce fix for windows MOUSE_MOVE event bug
Claus Gittinger <cg@exept.de>
parents: 2284
diff changeset
   103
    view orientation ~~ #vertical ifTrue:[
8340b529e8ce fix for windows MOUSE_MOVE event bug
Claus Gittinger <cg@exept.de>
parents: 2284
diff changeset
   104
        clickPos == bx ifTrue:[^ self].
2510
609971cc700d motion event compression
Claus Gittinger <cg@exept.de>
parents: 2396
diff changeset
   105
        prevPos == bx ifTrue:[^ self].
2396
8340b529e8ce fix for windows MOUSE_MOVE event bug
Claus Gittinger <cg@exept.de>
parents: 2284
diff changeset
   106
    ] ifFalse:[
8340b529e8ce fix for windows MOUSE_MOVE event bug
Claus Gittinger <cg@exept.de>
parents: 2284
diff changeset
   107
        clickPos == by ifTrue:[^ self].
2510
609971cc700d motion event compression
Claus Gittinger <cg@exept.de>
parents: 2396
diff changeset
   108
        prevPos == by ifTrue:[^ self].
2396
8340b529e8ce fix for windows MOUSE_MOVE event bug
Claus Gittinger <cg@exept.de>
parents: 2284
diff changeset
   109
    ].
8340b529e8ce fix for windows MOUSE_MOVE event bug
Claus Gittinger <cg@exept.de>
parents: 2284
diff changeset
   110
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   111
    "RESIZING"
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   112
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   113
    "compute new position ...."
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   114
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   115
    nextPos := self checkedHandleMovementX:bx y:by.
2252
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   116
"/    nextPos = prevPos ifTrue:[
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   117
"/        ^ self
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   118
"/    ].
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   119
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   120
    resizeMode == #active ifTrue:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   121
        "check position changed ..."
2252
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   122
"/        nextPos > 10 ifTrue:[
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   123
"/            (prevPos - nextPos) abs < 2 ifTrue:[^ self].
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   124
"/        ].
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   125
        opaqueResizing ifFalse:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   126
            self doInvertHandle   "undo the last invert"
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   127
        ]
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   128
    ] ifFalse:[
2252
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   129
"/        nextPos > 10 ifTrue:[
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   130
"/            (clickPos - nextPos) abs < 5 ifTrue:[^ self].
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   131
"/        ].
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   132
        resizeMode := #active.
131
claus
parents: 126
diff changeset
   133
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   134
        "/ restore the snap cursor
2529
9501a63ce16c handler movement fixed
Claus Gittinger <cg@exept.de>
parents: 2512
diff changeset
   135
        self isSnapEntered ifTrue:[
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   136
            view grabPointerWithCursor:saveCursor.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   137
            saveCursor := nil.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   138
            view drawSnapAt:movedHandle.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   139
        ]
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   140
    ].
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   141
    prevPos := nextPos.
1720
896886032334 added opaqueResize option.
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
   142
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   143
    opaqueResizing ifFalse:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   144
        self doInvertHandle.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   145
    ] ifTrue:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   146
        self doResize.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   147
    ].
2396
8340b529e8ce fix for windows MOUSE_MOVE event bug
Claus Gittinger <cg@exept.de>
parents: 2284
diff changeset
   148
8340b529e8ce fix for windows MOUSE_MOVE event bug
Claus Gittinger <cg@exept.de>
parents: 2284
diff changeset
   149
    "Modified: / 24.8.2001 / 15:34:57 / cg"
104
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
   150
!
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
   151
200
aa3e56929a5a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   152
buttonPress:button x:bx y:by
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   153
    "button was pressed - setup resizing if a handle is hit
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   154
    "
2236
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   155
    |handleView hindex isMin isMax layout|
200
aa3e56929a5a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   156
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   157
    ((button == 1) or:[button == #select]) ifFalse:[
2284
a0fe280353ba ignore other button-presses/releases while moving the bar
Claus Gittinger <cg@exept.de>
parents: 2260
diff changeset
   158
        movedHandle isNil ifTrue:[
a0fe280353ba ignore other button-presses/releases while moving the bar
Claus Gittinger <cg@exept.de>
parents: 2260
diff changeset
   159
            self pointerLeave:0.
a0fe280353ba ignore other button-presses/releases while moving the bar
Claus Gittinger <cg@exept.de>
parents: 2260
diff changeset
   160
            super buttonPress:button x:bx y:by.
a0fe280353ba ignore other button-presses/releases while moving the bar
Claus Gittinger <cg@exept.de>
parents: 2260
diff changeset
   161
        ].
a0fe280353ba ignore other button-presses/releases while moving the bar
Claus Gittinger <cg@exept.de>
parents: 2260
diff changeset
   162
        ^ self.
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   163
    ].
2396
8340b529e8ce fix for windows MOUSE_MOVE event bug
Claus Gittinger <cg@exept.de>
parents: 2284
diff changeset
   164
2510
609971cc700d motion event compression
Claus Gittinger <cg@exept.de>
parents: 2396
diff changeset
   165
    view compressMotionEvents:true.
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   166
    hindex := self detectHandleIndexAt:bx y:by.
1626
3013631d4384 do nothing if pointer was never moved;
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
   167
2529
9501a63ce16c handler movement fixed
Claus Gittinger <cg@exept.de>
parents: 2512
diff changeset
   168
"/    movedHandle notNil ifTrue:[
9501a63ce16c handler movement fixed
Claus Gittinger <cg@exept.de>
parents: 2512
diff changeset
   169
"/        hindex ~~ movedHandle ifTrue:[self pointerLeave:0].     "restore the cursor"
9501a63ce16c handler movement fixed
Claus Gittinger <cg@exept.de>
parents: 2512
diff changeset
   170
"/    ].
200
aa3e56929a5a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   171
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   172
    (     (movedHandle := hindex) notNil
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   173
     and:[(view canChangeExtentOfViewAt:movedHandle)]
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   174
    ) ifFalse:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   175
        ^ self
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   176
    ].
2236
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   177
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   178
    view grabPointerWithCursor:(view cursor).
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   179
    handleView := view subViews at:movedHandle.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   180
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   181
    "setup resizeing"
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   182
    resizeMode := #init.
2159
2864c0de7f33 make certain, that handles can always be clicked on;
Claus Gittinger <cg@exept.de>
parents: 2005
diff changeset
   183
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   184
    view orientation ~~ #vertical ifTrue:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   185
        clickPos := bx.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   186
        prevPos  := handleView right.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   187
    ] ifFalse:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   188
        clickPos := by.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   189
        prevPos  := handleView bottom.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   190
    ].
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   191
    prevPos := prevPos + (view barHeight + 1 // 2).
2159
2864c0de7f33 make certain, that handles can always be clicked on;
Claus Gittinger <cg@exept.de>
parents: 2005
diff changeset
   192
2652
c9ebf9f7efa6 correclty cleanup movedHandle value
Claus Gittinger <cg@exept.de>
parents: 2582
diff changeset
   193
    "/ self pointerEnter:0 x:bx y:by.
2582
edd71c89378d opaqueResize if shift is pressed
Claus Gittinger <cg@exept.de>
parents: 2529
diff changeset
   194
edd71c89378d opaqueResize if shift is pressed
Claus Gittinger <cg@exept.de>
parents: 2529
diff changeset
   195
    opaqueResizing := self sensor shiftDown or:[UserPreferences current opaqueVariablePanelResizing == true].
edd71c89378d opaqueResize if shift is pressed
Claus Gittinger <cg@exept.de>
parents: 2529
diff changeset
   196
2529
9501a63ce16c handler movement fixed
Claus Gittinger <cg@exept.de>
parents: 2512
diff changeset
   197
    self isSnapEntered ifTrue:[
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   198
        "there is a snap under the cursor; redraw selected"
2236
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   199
        view snapMode == #both ifTrue:[
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   200
            layout := view snapLayoutAt:movedHandle.
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   201
            view orientation == #vertical ifTrue:[
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   202
                isMax := bx > (layout right - (layout width//3)).
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   203
                isMin := bx < (layout left + (layout width//3)).
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   204
            ] ifFalse:[
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   205
                isMax := by > (layout bottom - (layout height//3)).
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   206
                isMin := by < (layout top + (layout height//3)).
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   207
            ].
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   208
            handleView objectAttributeAt:#snapPart  put:(isMin ifTrue:[#left] ifFalse:[ isMax ifTrue:[#right] ifFalse:[#middle]]).
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   209
        ].
2529
9501a63ce16c handler movement fixed
Claus Gittinger <cg@exept.de>
parents: 2512
diff changeset
   210
        view drawSnapAt:movedHandle.
9501a63ce16c handler movement fixed
Claus Gittinger <cg@exept.de>
parents: 2512
diff changeset
   211
    ] ifFalse:[
2582
edd71c89378d opaqueResize if shift is pressed
Claus Gittinger <cg@exept.de>
parents: 2529
diff changeset
   212
        opaqueResizing ifFalse:[
2529
9501a63ce16c handler movement fixed
Claus Gittinger <cg@exept.de>
parents: 2512
diff changeset
   213
            self doInvertHandle.
9501a63ce16c handler movement fixed
Claus Gittinger <cg@exept.de>
parents: 2512
diff changeset
   214
            resizeMode := #active.
9501a63ce16c handler movement fixed
Claus Gittinger <cg@exept.de>
parents: 2512
diff changeset
   215
        ].
2512
57d79580ff7f invert on click (not on first move)
Claus Gittinger <cg@exept.de>
parents: 2510
diff changeset
   216
    ].
2396
8340b529e8ce fix for windows MOUSE_MOVE event bug
Claus Gittinger <cg@exept.de>
parents: 2284
diff changeset
   217
8340b529e8ce fix for windows MOUSE_MOVE event bug
Claus Gittinger <cg@exept.de>
parents: 2284
diff changeset
   218
    "Modified: / 24.8.2001 / 15:35:27 / cg"
200
aa3e56929a5a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   219
!
aa3e56929a5a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   220
1626
3013631d4384 do nothing if pointer was never moved;
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
   221
buttonRelease:button x:bx y:by
104
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
   222
    "end bar-move"
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
   223
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   224
    |subViews layout aboveView|
1871
a6b15bdfcc92 better opaque resize
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   225
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   226
    ((button == 1) or:[button == #select]) ifFalse:[
2284
a0fe280353ba ignore other button-presses/releases while moving the bar
Claus Gittinger <cg@exept.de>
parents: 2260
diff changeset
   227
        movedHandle isNil ifTrue:[
a0fe280353ba ignore other button-presses/releases while moving the bar
Claus Gittinger <cg@exept.de>
parents: 2260
diff changeset
   228
            resizeMode := nil.
a0fe280353ba ignore other button-presses/releases while moving the bar
Claus Gittinger <cg@exept.de>
parents: 2260
diff changeset
   229
            super buttonRelease:button x:bx y:by
a0fe280353ba ignore other button-presses/releases while moving the bar
Claus Gittinger <cg@exept.de>
parents: 2260
diff changeset
   230
        ].
a0fe280353ba ignore other button-presses/releases while moving the bar
Claus Gittinger <cg@exept.de>
parents: 2260
diff changeset
   231
        ^ self.
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   232
    ].
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   233
2510
609971cc700d motion event compression
Claus Gittinger <cg@exept.de>
parents: 2396
diff changeset
   234
    view compressMotionEvents:false.
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   235
    view ungrabPointer.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   236
    movedHandle isNil ifTrue:[^ self].
1871
a6b15bdfcc92 better opaque resize
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   237
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   238
    resizeMode notNil ifTrue:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   239
        resizeMode == #active ifTrue:[
2236
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   240
            (view snapMode == #both) ifFalse:[
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   241
                aboveView := view subViews at:movedHandle.
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   242
                aboveView objectAttributeAt:#vpext put:(aboveView relativeCorner).
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   243
            ].
2582
edd71c89378d opaqueResize if shift is pressed
Claus Gittinger <cg@exept.de>
parents: 2529
diff changeset
   244
            opaqueResizing ifFalse:[
2252
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   245
                self doResize
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   246
            ].
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   247
        ] ifFalse:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   248
            (    (layout := view snapLayoutAt:movedHandle) notNil
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   249
             and:[layout containsPointX:bx y:by]
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   250
            ) ifTrue:[
2236
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   251
                self doSnapPressedX:bx y:by
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   252
            ].
1871
a6b15bdfcc92 better opaque resize
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   253
        ].
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   254
    ].
2652
c9ebf9f7efa6 correclty cleanup movedHandle value
Claus Gittinger <cg@exept.de>
parents: 2582
diff changeset
   255
    movedHandle := nil.
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   256
    self pointerLeave:0.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   257
    self pointerEnter:0 x:bx y:by.      "check whether mouse on a handle"
2396
8340b529e8ce fix for windows MOUSE_MOVE event bug
Claus Gittinger <cg@exept.de>
parents: 2284
diff changeset
   258
8340b529e8ce fix for windows MOUSE_MOVE event bug
Claus Gittinger <cg@exept.de>
parents: 2284
diff changeset
   259
    "Modified: / 24.8.2001 / 15:35:33 / cg"
1871
a6b15bdfcc92 better opaque resize
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   260
!
a6b15bdfcc92 better opaque resize
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   261
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   262
pointerEnter:state x:bx y:by
2665
954415c8fa83 bug fix in #pointerLeave: the KDE sends a #pointerLeave: with each button press which should be discard
ca
parents: 2652
diff changeset
   263
    "this could be send by the KDE before a button press event;
954415c8fa83 bug fix in #pointerLeave: the KDE sends a #pointerLeave: with each button press which should be discard
ca
parents: 2652
diff changeset
   264
     test whether the state == 0
954415c8fa83 bug fix in #pointerLeave: the KDE sends a #pointerLeave: with each button press which should be discard
ca
parents: 2652
diff changeset
   265
    "
954415c8fa83 bug fix in #pointerLeave: the KDE sends a #pointerLeave: with each button press which should be discard
ca
parents: 2652
diff changeset
   266
    |handle|
954415c8fa83 bug fix in #pointerLeave: the KDE sends a #pointerLeave: with each button press which should be discard
ca
parents: 2652
diff changeset
   267
954415c8fa83 bug fix in #pointerLeave: the KDE sends a #pointerLeave: with each button press which should be discard
ca
parents: 2652
diff changeset
   268
    state ~~ 0 ifTrue:[ ^ self ].
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   269
2665
954415c8fa83 bug fix in #pointerLeave: the KDE sends a #pointerLeave: with each button press which should be discard
ca
parents: 2652
diff changeset
   270
    view snapMode notNil ifTrue:[
954415c8fa83 bug fix in #pointerLeave: the KDE sends a #pointerLeave: with each button press which should be discard
ca
parents: 2652
diff changeset
   271
        "/ test whether a handle is under the cursor
954415c8fa83 bug fix in #pointerLeave: the KDE sends a #pointerLeave: with each button press which should be discard
ca
parents: 2652
diff changeset
   272
        handle := self detectHandleIndexAt:bx y:by.
954415c8fa83 bug fix in #pointerLeave: the KDE sends a #pointerLeave: with each button press which should be discard
ca
parents: 2652
diff changeset
   273
954415c8fa83 bug fix in #pointerLeave: the KDE sends a #pointerLeave: with each button press which should be discard
ca
parents: 2652
diff changeset
   274
        handle notNil ifTrue:[
954415c8fa83 bug fix in #pointerLeave: the KDE sends a #pointerLeave: with each button press which should be discard
ca
parents: 2652
diff changeset
   275
            "/ there is a handel; thus we have to setup the cursor...
954415c8fa83 bug fix in #pointerLeave: the KDE sends a #pointerLeave: with each button press which should be discard
ca
parents: 2652
diff changeset
   276
            self buttonMotion:state x:bx y:by
954415c8fa83 bug fix in #pointerLeave: the KDE sends a #pointerLeave: with each button press which should be discard
ca
parents: 2652
diff changeset
   277
        ].
954415c8fa83 bug fix in #pointerLeave: the KDE sends a #pointerLeave: with each button press which should be discard
ca
parents: 2652
diff changeset
   278
    ].
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   279
!
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   280
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   281
pointerLeave:state
2665
954415c8fa83 bug fix in #pointerLeave: the KDE sends a #pointerLeave: with each button press which should be discard
ca
parents: 2652
diff changeset
   282
    "this could be send by the KDE before a button press event;
954415c8fa83 bug fix in #pointerLeave: the KDE sends a #pointerLeave: with each button press which should be discard
ca
parents: 2652
diff changeset
   283
     test whether the state == 0
954415c8fa83 bug fix in #pointerLeave: the KDE sends a #pointerLeave: with each button press which should be discard
ca
parents: 2652
diff changeset
   284
    "
954415c8fa83 bug fix in #pointerLeave: the KDE sends a #pointerLeave: with each button press which should be discard
ca
parents: 2652
diff changeset
   285
    state ~~ 0 ifTrue:[ ^ self ].
954415c8fa83 bug fix in #pointerLeave: the KDE sends a #pointerLeave: with each button press which should be discard
ca
parents: 2652
diff changeset
   286
954415c8fa83 bug fix in #pointerLeave: the KDE sends a #pointerLeave: with each button press which should be discard
ca
parents: 2652
diff changeset
   287
    "/ the view is leave and no button is pressed
954415c8fa83 bug fix in #pointerLeave: the KDE sends a #pointerLeave: with each button press which should be discard
ca
parents: 2652
diff changeset
   288
    "/ restore the cursor and redraw the snap if not nil
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   289
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   290
    saveCursor notNil ifTrue:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   291
        "restore the cursor"
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   292
        view cursor:saveCursor.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   293
        saveCursor := nil
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   294
    ].
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   295
2665
954415c8fa83 bug fix in #pointerLeave: the KDE sends a #pointerLeave: with each button press which should be discard
ca
parents: 2652
diff changeset
   296
    resizeMode := nil.
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   297
2665
954415c8fa83 bug fix in #pointerLeave: the KDE sends a #pointerLeave: with each button press which should be discard
ca
parents: 2652
diff changeset
   298
    movedHandle notNil ifTrue:[
954415c8fa83 bug fix in #pointerLeave: the KDE sends a #pointerLeave: with each button press which should be discard
ca
parents: 2652
diff changeset
   299
        view drawSnapAt:movedHandle.
954415c8fa83 bug fix in #pointerLeave: the KDE sends a #pointerLeave: with each button press which should be discard
ca
parents: 2652
diff changeset
   300
        self buttonRelease:1 x:0 y:0.
954415c8fa83 bug fix in #pointerLeave: the KDE sends a #pointerLeave: with each button press which should be discard
ca
parents: 2652
diff changeset
   301
        movedHandle := nil.
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   302
    ].
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   303
! !
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   304
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   305
!VariablePanelController methodsFor:'private'!
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   306
2159
2864c0de7f33 make certain, that handles can always be clicked on;
Claus Gittinger <cg@exept.de>
parents: 2005
diff changeset
   307
checkedHandleMovementX:bx y:by
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   308
    "check and return valid position a handle can be placed
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   309
    "
2252
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   310
    |max min pos subViews halfBarHeight barHeight thisView nextView nextView2|
2159
2864c0de7f33 make certain, that handles can always be clicked on;
Claus Gittinger <cg@exept.de>
parents: 2005
diff changeset
   311
2864c0de7f33 make certain, that handles can always be clicked on;
Claus Gittinger <cg@exept.de>
parents: 2005
diff changeset
   312
    subViews := view subViews.
2252
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   313
    barHeight := view barHeight.
2245
e561458f9232 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2239
diff changeset
   314
"/    halfBarHeight := view barHeight + 1 // 2.
2252
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   315
    halfBarHeight := barHeight // 2.
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   316
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   317
    thisView := subViews at:movedHandle.
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   318
    nextView := subViews at:movedHandle + 1.
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   319
    nextView2 := subViews at:movedHandle + 2 ifAbsent:nil.
2159
2864c0de7f33 make certain, that handles can always be clicked on;
Claus Gittinger <cg@exept.de>
parents: 2005
diff changeset
   320
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   321
    view orientation == #vertical ifTrue:[
2245
e561458f9232 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2239
diff changeset
   322
        pos := by.
2252
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   323
        min := thisView top.
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   324
        nextView2 isNil ifTrue:[
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   325
            max := view height.
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   326
        ] ifFalse:[
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   327
            max := nextView2 top.
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   328
        ].
2159
2864c0de7f33 make certain, that handles can always be clicked on;
Claus Gittinger <cg@exept.de>
parents: 2005
diff changeset
   329
    ] ifFalse:[
2245
e561458f9232 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2239
diff changeset
   330
        pos := bx.
2252
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   331
        min := thisView left.
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   332
        nextView2 isNil ifTrue:[
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   333
            max := view width.
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   334
        ] ifFalse:[
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   335
            max := nextView2 left.
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   336
        ].
2159
2864c0de7f33 make certain, that handles can always be clicked on;
Claus Gittinger <cg@exept.de>
parents: 2005
diff changeset
   337
    ].
2864c0de7f33 make certain, that handles can always be clicked on;
Claus Gittinger <cg@exept.de>
parents: 2005
diff changeset
   338
2260
ce3be65862db min/max - make certain that handle can still be grabbed
Claus Gittinger <cg@exept.de>
parents: 2252
diff changeset
   339
    min := min + halfBarHeight "- 1".
2252
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   340
    barHeight odd ifTrue:[ min := min + 1 ].
2260
ce3be65862db min/max - make certain that handle can still be grabbed
Claus Gittinger <cg@exept.de>
parents: 2252
diff changeset
   341
    movedHandle == 1 ifTrue:[
ce3be65862db min/max - make certain that handle can still be grabbed
Claus Gittinger <cg@exept.de>
parents: 2252
diff changeset
   342
        min := min + view margin
ce3be65862db min/max - make certain that handle can still be grabbed
Claus Gittinger <cg@exept.de>
parents: 2252
diff changeset
   343
    ].
2245
e561458f9232 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2239
diff changeset
   344
e561458f9232 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2239
diff changeset
   345
"/    max := max - halfBarHeight.
2252
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   346
"/    movedHandle == (subViews size-1) ifTrue:[
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   347
"/        max := max - barHeight + 2.
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   348
"/    ] ifFalse:[
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   349
        max := max - halfBarHeight + 1.
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   350
        barHeight odd ifTrue:[ max := max - 1 ].
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   351
"/    ].
2159
2864c0de7f33 make certain, that handles can always be clicked on;
Claus Gittinger <cg@exept.de>
parents: 2005
diff changeset
   352
2260
ce3be65862db min/max - make certain that handle can still be grabbed
Claus Gittinger <cg@exept.de>
parents: 2252
diff changeset
   353
    movedHandle == (subViews size-1) ifTrue:[
ce3be65862db min/max - make certain that handle can still be grabbed
Claus Gittinger <cg@exept.de>
parents: 2252
diff changeset
   354
        max := max - view margin
ce3be65862db min/max - make certain that handle can still be grabbed
Claus Gittinger <cg@exept.de>
parents: 2252
diff changeset
   355
    ].
ce3be65862db min/max - make certain that handle can still be grabbed
Claus Gittinger <cg@exept.de>
parents: 2252
diff changeset
   356
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   357
    pos < min ifTrue:[^ min].
2252
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   358
    pos > max ifTrue:[^ max].
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   359
    ^ pos
2159
2864c0de7f33 make certain, that handles can always be clicked on;
Claus Gittinger <cg@exept.de>
parents: 2005
diff changeset
   360
!
2864c0de7f33 make certain, that handles can always be clicked on;
Claus Gittinger <cg@exept.de>
parents: 2005
diff changeset
   361
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   362
detectHandleIndexAt:x y:y
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   363
    "returns the handle index at position x@y or nil if none detected
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   364
    "
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   365
    |subViews
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   366
     size "{ Class: SmallInteger }"|
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   367
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   368
    subViews := view subViews.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   369
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   370
    (size := subViews size) > 1 ifTrue:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   371
	view orientation == #vertical ifTrue:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   372
	    2 to:size do:[:i|
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   373
		(subViews at:i) top >= y ifTrue:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   374
		    ^ (subViews at:(i-1)) bottom < y ifTrue:[i-1] ifFalse:[nil]
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   375
		]
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   376
	    ]
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   377
	] ifFalse:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   378
	    2 to:size do:[:i|
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   379
		(subViews at:i) left >= x ifTrue:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   380
		    ^ (subViews at:(i-1)) right < x ifTrue:[i-1] ifFalse:[nil]
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   381
		]
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   382
	    ]
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   383
	]
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   384
    ].
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   385
    ^ nil
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   386
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   387
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   388
! !
1871
a6b15bdfcc92 better opaque resize
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   389
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   390
!VariablePanelController methodsFor:'queries'!
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   391
2529
9501a63ce16c handler movement fixed
Claus Gittinger <cg@exept.de>
parents: 2512
diff changeset
   392
isSnapEntered
9501a63ce16c handler movement fixed
Claus Gittinger <cg@exept.de>
parents: 2512
diff changeset
   393
    ^ saveCursor notNil
9501a63ce16c handler movement fixed
Claus Gittinger <cg@exept.de>
parents: 2512
diff changeset
   394
!
9501a63ce16c handler movement fixed
Claus Gittinger <cg@exept.de>
parents: 2512
diff changeset
   395
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   396
isSnapEntered:anIndex
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   397
    ^ saveCursor notNil and:[anIndex == movedHandle]
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   398
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   399
!
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   400
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   401
isSnapPressed
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   402
    ^ resizeMode notNil and:[resizeMode ~~ #active]
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   403
! !
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   404
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   405
!VariablePanelController methodsFor:'user operations'!
104
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
   406
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   407
doInvertHandle
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   408
    "invert a handle
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   409
    "
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   410
    |pos|
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   411
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   412
    pos := prevPos - (view barHeight + 1 // 2).
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   413
    view invertHandleBarAtX:pos y:pos.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   414
!
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   415
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   416
doResize
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   417
    "perform the resize
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   418
    "
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   419
    |aboveView belowView aboveIndex belowIndex newRelPos subViews isVertical 
2582
edd71c89378d opaqueResize if shift is pressed
Claus Gittinger <cg@exept.de>
parents: 2529
diff changeset
   420
     newCorner newOrigin halfBarHg|
104
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
   421
1871
a6b15bdfcc92 better opaque resize
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   422
    "undo the last invert"
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   423
    (resizeMode == #active and:[opaqueResizing not]) ifTrue:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   424
        self doInvertHandle
1871
a6b15bdfcc92 better opaque resize
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   425
    ].
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   426
    "check if position changed"
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   427
    prevPos == clickPos ifTrue:[^ self].
104
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
   428
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   429
    "compute the new relative origins & corners"
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   430
    isVertical := view orientation == #vertical.
1871
a6b15bdfcc92 better opaque resize
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   431
    aboveIndex := movedHandle.
a6b15bdfcc92 better opaque resize
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   432
    belowIndex := movedHandle + 1.
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   433
    subViews   := view subViews.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   434
    aboveView  := subViews at:aboveIndex.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   435
    belowView  := subViews at:belowIndex.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   436
    halfBarHg  := view barHeight + 1 // 2.
1626
3013631d4384 do nothing if pointer was never moved;
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
   437
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   438
    isVertical ifFalse:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   439
        "X complains badly if you try to create/resize a view with a dimension <= 0
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   440
        "
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   441
        prevPos - halfBarHg == aboveView left ifTrue:[prevPos := prevPos + 1].
104
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
   442
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   443
        newRelPos := (prevPos / view width) asFloat.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   444
        newCorner := newRelPos @ aboveView relativeCorner y.
2159
2864c0de7f33 make certain, that handles can always be clicked on;
Claus Gittinger <cg@exept.de>
parents: 2005
diff changeset
   445
        newOrigin := newRelPos @ belowView relativeOrigin y.
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   446
    ] ifTrue:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   447
        "X complains badly if you try to create/resize a view with a dimension <= 0
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   448
        "
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   449
        prevPos - halfBarHg == aboveView top ifTrue:[prevPos := prevPos + 1].
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   450
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   451
        newRelPos := (prevPos / view height) asFloat.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   452
        newCorner := aboveView relativeCorner x @ newRelPos.
2159
2864c0de7f33 make certain, that handles can always be clicked on;
Claus Gittinger <cg@exept.de>
parents: 2005
diff changeset
   453
        newOrigin := belowView relativeOrigin x @ newRelPos.
1871
a6b15bdfcc92 better opaque resize
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   454
    ].
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   455
    view lockRedraw.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   456
1871
a6b15bdfcc92 better opaque resize
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   457
    aboveView relativeCorner:newCorner.
a6b15bdfcc92 better opaque resize
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   458
    belowView relativeOrigin:newOrigin.
104
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
   459
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   460
    prevPos > clickPos ifTrue:[ "above view grows"
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   461
        view resizeSubviewsFrom:aboveIndex to:belowIndex.
104
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
   462
    ] ifFalse:[
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   463
        view resizeSubviewsFrom:belowIndex to:aboveIndex
1871
a6b15bdfcc92 better opaque resize
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   464
    ].
a6b15bdfcc92 better opaque resize
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   465
    view unlockRedraw.
1626
3013631d4384 do nothing if pointer was never moved;
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
   466
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   467
    prevPos := isVertical ifTrue:[aboveView bottom] ifFalse:[aboveView right].
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   468
    prevPos := prevPos + (view barHeight + 1 // 2).
1483
e0fb580b5131 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
   469
!
e0fb580b5131 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
   470
2236
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   471
doSnapPressedX:x y:y
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   472
    "perform the snap press
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   473
    "
2236
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   474
    |layout handle curRCorner prvRCorner isVertical newPos mode isMax isMin doRememberPosition|
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   475
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   476
    (mode := view snapMode) isNil ifTrue:[^ self].
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   477
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   478
    layout     := view snapLayoutAt:movedHandle.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   479
    handle     := view subViews at:movedHandle.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   480
    isVertical := view orientation == #vertical.
2236
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   481
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   482
    curRCorner := handle relativeCorner.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   483
    prvRCorner := handle objectAttributeAt:#vpext.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   484
2236
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   485
    isMax := isMin := false.
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   486
    mode == #both ifTrue:[
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   487
        isVertical ifTrue:[
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   488
            isMax := x > (layout right - (layout width//3)).
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   489
            isMin := x < (layout left + (layout width//3)).
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   490
        ] ifFalse:[
2239
31a57c0002a2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2236
diff changeset
   491
            isMin := y > (layout bottom - (layout height//3)).
31a57c0002a2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2236
diff changeset
   492
            isMax := y < (layout top + (layout height//3)).
2236
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   493
        ].
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   494
        handle objectAttributeAt:#snapPart  put:(isMin ifTrue:[#left] ifFalse:[ isMax ifTrue:[#right] ifFalse:[#middle]]).
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   495
        doRememberPosition := (isMin or:[isMax]) and:[prvRCorner isNil].
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   496
    ] ifFalse:[
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   497
        isMax := view snapAtIndexWillGrow:movedHandle.
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   498
        isMin := isMax not.
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   499
        isMax ifTrue:[
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   500
           isMax := prvRCorner isNil or:[mode ~~ #min]
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   501
        ] ifFalse:[
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   502
           isMin := prvRCorner isNil or:[mode ~~ #max]
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   503
        ].
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   504
        doRememberPosition := true.
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   505
    ].
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   506
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   507
    isMax ifTrue:[
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   508
        newPos := 99999        "set extent to max"
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   509
    ] ifFalse:[
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   510
        isMin ifTrue:[
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   511
            newPos := 0        "set extent to min"
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   512
        ] ifFalse:[
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   513
            newPos := nil      "restore previous extent"
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   514
        ]
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   515
    ].
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   516
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   517
    newPos isNil ifTrue:[
2236
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   518
        prvRCorner isNil ifTrue:[
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   519
            "/ nothing to do
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   520
            ^ self
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   521
        ].
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   522
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   523
        "restore previous extent"
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   524
        newPos := isVertical ifTrue:[view height * prvRCorner y]
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   525
                            ifFalse:[view width  * prvRCorner x].
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   526
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   527
        newPos := self checkedHandleMovementX:newPos y:newPos.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   528
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   529
        (prevPos - newPos) abs < 2 ifTrue:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   530
            "cannot resize; set extent to min or max dependent on the current extent"
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   531
            isVertical ifTrue:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   532
                newPos := handle height > 2 ifTrue:[0] ifFalse:[99999]
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   533
            ] ifFalse:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   534
                newPos := handle width  > 2 ifTrue:[0] ifFalse:[99999]
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   535
            ].
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   536
            newPos := self checkedHandleMovementX:newPos y:newPos.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   537
        ].
2236
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   538
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   539
        mode == #both ifTrue:[
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   540
           handle objectAttributeAt:#vpext put:nil.         "clear previous corner"
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   541
           doRememberPosition := false.
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   542
        ].
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   543
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   544
    ] ifFalse:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   545
        newPos := self checkedHandleMovementX:newPos y:newPos
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   546
    ].
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   547
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   548
    (newPos - prevPos) abs < 2 ifFalse:[
2236
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   549
        doRememberPosition ifTrue:[
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   550
            handle objectAttributeAt:#vpext put:curRCorner.         "save previous corner"
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   551
        ].
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   552
        prevPos := newPos.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   553
        self doResize.
1483
e0fb580b5131 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
   554
    ]
200
aa3e56929a5a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   555
! !
104
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
   556
203
8a38b0b03233 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   557
!VariablePanelController class methodsFor:'documentation'!
8a38b0b03233 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   558
8a38b0b03233 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   559
version
2665
954415c8fa83 bug fix in #pointerLeave: the KDE sends a #pointerLeave: with each button press which should be discard
ca
parents: 2652
diff changeset
   560
    ^ '$Header: /cvs/stx/stx/libwidg/VariablePanelController.st,v 1.40 2002-11-18 07:24:54 ca Exp $'
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   561
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   562
203
8a38b0b03233 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   563
! !