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