VariablePanelController.st
author Stefan Vogel <sv@exept.de>
Wed, 16 May 2018 08:37:31 +0200
changeset 6320 d52325b32f05
parent 5518 fc393425a691
child 6464 d3ff7df466f7
permissions -rw-r--r--
#REFACTORING by stefan class: DialogBox class changed: #initialize #modifyingBoxWith:do: fix return value
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
5475
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
    14
"{ NameSpace: Smalltalk }"
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
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
    "
5475
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
    62
    |nextPos layout entered 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].
104
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
    75
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
    76
        "check entering click button ...."
2652
c9ebf9f7efa6 correclty cleanup movedHandle value
Claus Gittinger <cg@exept.de>
parents: 2582
diff changeset
    77
        layout  := view snapLayoutAt:handle.
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
    78
        entered := layout notNil and:[layout containsPointX:bx y:by].
104
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
    79
2529
9501a63ce16c handler movement fixed
Claus Gittinger <cg@exept.de>
parents: 2512
diff changeset
    80
        entered ~~ (self isSnapEntered) ifTrue:[
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
    81
            entered ifTrue:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
    82
                saveCursor := view cursor.
2239
31a57c0002a2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2236
diff changeset
    83
                view cursor:(Cursor hand).
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
    84
            ] ifFalse:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
    85
                view cursor:saveCursor.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
    86
                saveCursor := nil.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
    87
            ].
2652
c9ebf9f7efa6 correclty cleanup movedHandle value
Claus Gittinger <cg@exept.de>
parents: 2582
diff changeset
    88
            view drawSnapAt:handle
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
    89
        ].
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
    90
        ^ self
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
    91
    ].
2396
8340b529e8ce fix for windows MOUSE_MOVE event bug
Claus Gittinger <cg@exept.de>
parents: 2284
diff changeset
    92
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
    93
    (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
    94
2396
8340b529e8ce fix for windows MOUSE_MOVE event bug
Claus Gittinger <cg@exept.de>
parents: 2284
diff changeset
    95
    "/ 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
    96
    "/ (with same coordinate as previous MOUSE_DOWN
8340b529e8ce fix for windows MOUSE_MOVE event bug
Claus Gittinger <cg@exept.de>
parents: 2284
diff changeset
    97
    view orientation ~~ #vertical ifTrue:[
8340b529e8ce fix for windows MOUSE_MOVE event bug
Claus Gittinger <cg@exept.de>
parents: 2284
diff changeset
    98
        clickPos == bx ifTrue:[^ self].
2510
609971cc700d motion event compression
Claus Gittinger <cg@exept.de>
parents: 2396
diff changeset
    99
        prevPos == bx ifTrue:[^ self].
2396
8340b529e8ce fix for windows MOUSE_MOVE event bug
Claus Gittinger <cg@exept.de>
parents: 2284
diff changeset
   100
    ] ifFalse:[
8340b529e8ce fix for windows MOUSE_MOVE event bug
Claus Gittinger <cg@exept.de>
parents: 2284
diff changeset
   101
        clickPos == by ifTrue:[^ self].
2510
609971cc700d motion event compression
Claus Gittinger <cg@exept.de>
parents: 2396
diff changeset
   102
        prevPos == by ifTrue:[^ self].
2396
8340b529e8ce fix for windows MOUSE_MOVE event bug
Claus Gittinger <cg@exept.de>
parents: 2284
diff changeset
   103
    ].
8340b529e8ce fix for windows MOUSE_MOVE event bug
Claus Gittinger <cg@exept.de>
parents: 2284
diff changeset
   104
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   105
    "RESIZING"
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   106
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   107
    "compute new position ...."
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   108
    nextPos := self checkedHandleMovementX:bx y:by.
2252
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   109
"/    nextPos = prevPos ifTrue:[
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   110
"/        ^ self
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   111
"/    ].
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   112
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   113
    resizeMode == #active ifTrue:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   114
        "check position changed ..."
2252
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   115
"/        nextPos > 10 ifTrue:[
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   116
"/            (prevPos - nextPos) abs < 2 ifTrue:[^ self].
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   117
"/        ].
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   118
        opaqueResizing ifFalse:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   119
            self doInvertHandle   "undo the last invert"
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   120
        ]
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   121
    ] ifFalse:[
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
"/            (clickPos - nextPos) abs < 5 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
        resizeMode := #active.
131
claus
parents: 126
diff changeset
   126
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   127
        "/ restore the snap cursor
2529
9501a63ce16c handler movement fixed
Claus Gittinger <cg@exept.de>
parents: 2512
diff changeset
   128
        self isSnapEntered ifTrue:[
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   129
            view grabPointerWithCursor:saveCursor.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   130
            saveCursor := nil.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   131
            view drawSnapAt:movedHandle.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   132
        ]
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   133
    ].
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   134
    prevPos := nextPos.
1720
896886032334 added opaqueResize option.
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
   135
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   136
    opaqueResizing ifFalse:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   137
        self doInvertHandle.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   138
    ] ifTrue:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   139
        self doResize.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   140
    ].
2396
8340b529e8ce fix for windows MOUSE_MOVE event bug
Claus Gittinger <cg@exept.de>
parents: 2284
diff changeset
   141
8340b529e8ce fix for windows MOUSE_MOVE event bug
Claus Gittinger <cg@exept.de>
parents: 2284
diff changeset
   142
    "Modified: / 24.8.2001 / 15:34:57 / cg"
104
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
   143
!
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
   144
200
aa3e56929a5a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   145
buttonPress:button x:bx y:by
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   146
    "button was pressed - setup resizing if a handle is hit
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   147
    "
2236
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   148
    |handleView hindex isMin isMax layout|
200
aa3e56929a5a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   149
3921
f7f8661be48b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2665
diff changeset
   150
    (button == 1) ifFalse:[
2284
a0fe280353ba ignore other button-presses/releases while moving the bar
Claus Gittinger <cg@exept.de>
parents: 2260
diff changeset
   151
        movedHandle isNil ifTrue:[
a0fe280353ba ignore other button-presses/releases while moving the bar
Claus Gittinger <cg@exept.de>
parents: 2260
diff changeset
   152
            self pointerLeave:0.
a0fe280353ba ignore other button-presses/releases while moving the bar
Claus Gittinger <cg@exept.de>
parents: 2260
diff changeset
   153
            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
   154
        ].
a0fe280353ba ignore other button-presses/releases while moving the bar
Claus Gittinger <cg@exept.de>
parents: 2260
diff changeset
   155
        ^ self.
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   156
    ].
2396
8340b529e8ce fix for windows MOUSE_MOVE event bug
Claus Gittinger <cg@exept.de>
parents: 2284
diff changeset
   157
2510
609971cc700d motion event compression
Claus Gittinger <cg@exept.de>
parents: 2396
diff changeset
   158
    view compressMotionEvents:true.
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   159
    hindex := self detectHandleIndexAt:bx y:by.
1626
3013631d4384 do nothing if pointer was never moved;
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
   160
2529
9501a63ce16c handler movement fixed
Claus Gittinger <cg@exept.de>
parents: 2512
diff changeset
   161
"/    movedHandle notNil ifTrue:[
9501a63ce16c handler movement fixed
Claus Gittinger <cg@exept.de>
parents: 2512
diff changeset
   162
"/        hindex ~~ movedHandle ifTrue:[self pointerLeave:0].     "restore the cursor"
9501a63ce16c handler movement fixed
Claus Gittinger <cg@exept.de>
parents: 2512
diff changeset
   163
"/    ].
200
aa3e56929a5a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   164
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   165
    (     (movedHandle := hindex) notNil
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   166
     and:[(view canChangeExtentOfViewAt:movedHandle)]
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   167
    ) ifFalse:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   168
        ^ self
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   169
    ].
2236
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   170
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   171
    view grabPointerWithCursor:(view cursor).
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   172
    handleView := view subViews at:movedHandle.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   173
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   174
    "setup resizeing"
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   175
    resizeMode := #init.
2159
2864c0de7f33 make certain, that handles can always be clicked on;
Claus Gittinger <cg@exept.de>
parents: 2005
diff changeset
   176
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   177
    view orientation ~~ #vertical ifTrue:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   178
        clickPos := bx.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   179
        prevPos  := handleView right.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   180
    ] ifFalse:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   181
        clickPos := by.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   182
        prevPos  := handleView bottom.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   183
    ].
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   184
    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
   185
2652
c9ebf9f7efa6 correclty cleanup movedHandle value
Claus Gittinger <cg@exept.de>
parents: 2582
diff changeset
   186
    "/ self pointerEnter:0 x:bx y:by.
2582
edd71c89378d opaqueResize if shift is pressed
Claus Gittinger <cg@exept.de>
parents: 2529
diff changeset
   187
edd71c89378d opaqueResize if shift is pressed
Claus Gittinger <cg@exept.de>
parents: 2529
diff changeset
   188
    opaqueResizing := self sensor shiftDown or:[UserPreferences current opaqueVariablePanelResizing == true].
edd71c89378d opaqueResize if shift is pressed
Claus Gittinger <cg@exept.de>
parents: 2529
diff changeset
   189
2529
9501a63ce16c handler movement fixed
Claus Gittinger <cg@exept.de>
parents: 2512
diff changeset
   190
    self isSnapEntered ifTrue:[
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   191
        "there is a snap under the cursor; redraw selected"
2236
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   192
        view snapMode == #both ifTrue:[
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   193
            layout := view snapLayoutAt:movedHandle.
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   194
            view orientation == #vertical ifTrue:[
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   195
                isMax := bx > (layout right - (layout width//3)).
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   196
                isMin := bx < (layout left + (layout width//3)).
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   197
            ] ifFalse:[
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   198
                isMax := by > (layout bottom - (layout height//3)).
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   199
                isMin := by < (layout top + (layout height//3)).
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   200
            ].
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   201
            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
   202
        ].
2529
9501a63ce16c handler movement fixed
Claus Gittinger <cg@exept.de>
parents: 2512
diff changeset
   203
        view drawSnapAt:movedHandle.
9501a63ce16c handler movement fixed
Claus Gittinger <cg@exept.de>
parents: 2512
diff changeset
   204
    ] ifFalse:[
2582
edd71c89378d opaqueResize if shift is pressed
Claus Gittinger <cg@exept.de>
parents: 2529
diff changeset
   205
        opaqueResizing ifFalse:[
2529
9501a63ce16c handler movement fixed
Claus Gittinger <cg@exept.de>
parents: 2512
diff changeset
   206
            self doInvertHandle.
9501a63ce16c handler movement fixed
Claus Gittinger <cg@exept.de>
parents: 2512
diff changeset
   207
            resizeMode := #active.
9501a63ce16c handler movement fixed
Claus Gittinger <cg@exept.de>
parents: 2512
diff changeset
   208
        ].
2512
57d79580ff7f invert on click (not on first move)
Claus Gittinger <cg@exept.de>
parents: 2510
diff changeset
   209
    ].
2396
8340b529e8ce fix for windows MOUSE_MOVE event bug
Claus Gittinger <cg@exept.de>
parents: 2284
diff changeset
   210
8340b529e8ce fix for windows MOUSE_MOVE event bug
Claus Gittinger <cg@exept.de>
parents: 2284
diff changeset
   211
    "Modified: / 24.8.2001 / 15:35:27 / cg"
200
aa3e56929a5a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   212
!
aa3e56929a5a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   213
1626
3013631d4384 do nothing if pointer was never moved;
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
   214
buttonRelease:button x:bx y:by
104
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
   215
    "end bar-move"
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
   216
3921
f7f8661be48b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2665
diff changeset
   217
    |layout aboveView|
1871
a6b15bdfcc92 better opaque resize
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   218
3921
f7f8661be48b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2665
diff changeset
   219
    (button == 1) ifFalse:[
2284
a0fe280353ba ignore other button-presses/releases while moving the bar
Claus Gittinger <cg@exept.de>
parents: 2260
diff changeset
   220
        movedHandle isNil ifTrue:[
a0fe280353ba ignore other button-presses/releases while moving the bar
Claus Gittinger <cg@exept.de>
parents: 2260
diff changeset
   221
            resizeMode := nil.
a0fe280353ba ignore other button-presses/releases while moving the bar
Claus Gittinger <cg@exept.de>
parents: 2260
diff changeset
   222
            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
   223
        ].
a0fe280353ba ignore other button-presses/releases while moving the bar
Claus Gittinger <cg@exept.de>
parents: 2260
diff changeset
   224
        ^ self.
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   225
    ].
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   226
2510
609971cc700d motion event compression
Claus Gittinger <cg@exept.de>
parents: 2396
diff changeset
   227
    view compressMotionEvents:false.
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   228
    view ungrabPointer.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   229
    movedHandle isNil ifTrue:[^ self].
1871
a6b15bdfcc92 better opaque resize
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   230
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   231
    resizeMode notNil ifTrue:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   232
        resizeMode == #active ifTrue:[
2236
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   233
            (view snapMode == #both) ifFalse:[
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   234
                aboveView := view subViews at:movedHandle.
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   235
                aboveView objectAttributeAt:#vpext put:(aboveView relativeCorner).
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   236
            ].
2582
edd71c89378d opaqueResize if shift is pressed
Claus Gittinger <cg@exept.de>
parents: 2529
diff changeset
   237
            opaqueResizing ifFalse:[
2252
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   238
                self doResize
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   239
            ].
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   240
        ] ifFalse:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   241
            (    (layout := view snapLayoutAt:movedHandle) notNil
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   242
             and:[layout containsPointX:bx y:by]
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   243
            ) ifTrue:[
2236
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   244
                self doSnapPressedX:bx y:by
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   245
            ].
1871
a6b15bdfcc92 better opaque resize
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   246
        ].
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   247
    ].
2652
c9ebf9f7efa6 correclty cleanup movedHandle value
Claus Gittinger <cg@exept.de>
parents: 2582
diff changeset
   248
    movedHandle := nil.
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   249
    self pointerLeave:0.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   250
    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
   251
8340b529e8ce fix for windows MOUSE_MOVE event bug
Claus Gittinger <cg@exept.de>
parents: 2284
diff changeset
   252
    "Modified: / 24.8.2001 / 15:35:33 / cg"
1871
a6b15bdfcc92 better opaque resize
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   253
!
a6b15bdfcc92 better opaque resize
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   254
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   255
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
   256
    "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
   257
     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
   258
    "
954415c8fa83 bug fix in #pointerLeave: the KDE sends a #pointerLeave: with each button press which should be discard
ca
parents: 2652
diff changeset
   259
    |handle|
954415c8fa83 bug fix in #pointerLeave: the KDE sends a #pointerLeave: with each button press which should be discard
ca
parents: 2652
diff changeset
   260
954415c8fa83 bug fix in #pointerLeave: the KDE sends a #pointerLeave: with each button press which should be discard
ca
parents: 2652
diff changeset
   261
    state ~~ 0 ifTrue:[ ^ self ].
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   262
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
    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
   264
        "/ 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
   265
        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
   266
954415c8fa83 bug fix in #pointerLeave: the KDE sends a #pointerLeave: with each button press which should be discard
ca
parents: 2652
diff changeset
   267
        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
   268
            "/ 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
   269
            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
   270
        ].
954415c8fa83 bug fix in #pointerLeave: the KDE sends a #pointerLeave: with each button press which should be discard
ca
parents: 2652
diff changeset
   271
    ].
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   272
!
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   273
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   274
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
   275
    "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
   276
     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
   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
    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
   279
954415c8fa83 bug fix in #pointerLeave: the KDE sends a #pointerLeave: with each button press which should be discard
ca
parents: 2652
diff changeset
   280
    "/ 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
   281
    "/ restore the cursor and redraw the snap if not nil
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   282
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   283
    saveCursor notNil ifTrue:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   284
        "restore the cursor"
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   285
        view cursor:saveCursor.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   286
        saveCursor := nil
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   287
    ].
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   288
2665
954415c8fa83 bug fix in #pointerLeave: the KDE sends a #pointerLeave: with each button press which should be discard
ca
parents: 2652
diff changeset
   289
    resizeMode := nil.
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   290
2665
954415c8fa83 bug fix in #pointerLeave: the KDE sends a #pointerLeave: with each button press which should be discard
ca
parents: 2652
diff changeset
   291
    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
   292
        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
   293
        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
   294
        movedHandle := nil.
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   295
    ].
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   296
! !
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   297
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   298
!VariablePanelController methodsFor:'private'!
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   299
2159
2864c0de7f33 make certain, that handles can always be clicked on;
Claus Gittinger <cg@exept.de>
parents: 2005
diff changeset
   300
checkedHandleMovementX:bx y:by
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   301
    "check and return valid position a handle can be placed
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   302
    "
5518
fc393425a691 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5475
diff changeset
   303
    |max min pos subViews halfBarHeight barHeight 
fc393425a691 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5475
diff changeset
   304
     thisView nextView nextView2
fc393425a691 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5475
diff changeset
   305
     minExtentThisView|
2159
2864c0de7f33 make certain, that handles can always be clicked on;
Claus Gittinger <cg@exept.de>
parents: 2005
diff changeset
   306
2864c0de7f33 make certain, that handles can always be clicked on;
Claus Gittinger <cg@exept.de>
parents: 2005
diff changeset
   307
    subViews := view subViews.
2252
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   308
    barHeight := view barHeight.
2245
e561458f9232 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2239
diff changeset
   309
"/    halfBarHeight := view barHeight + 1 // 2.
2252
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   310
    halfBarHeight := barHeight // 2.
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   311
5518
fc393425a691 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5475
diff changeset
   312
    thisView := subViews at:movedHandle. "/ the view above the handle
2252
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   313
    nextView := subViews at:movedHandle + 1.
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   314
    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
   315
5518
fc393425a691 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5475
diff changeset
   316
    minExtentThisView := thisView minExtent.
fc393425a691 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5475
diff changeset
   317
    
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   318
    view orientation == #vertical ifTrue:[
2245
e561458f9232 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2239
diff changeset
   319
        pos := by.
2252
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   320
        min := thisView top.
5518
fc393425a691 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5475
diff changeset
   321
        minExtentThisView notNil ifTrue:[
fc393425a691 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5475
diff changeset
   322
            min := min + (minExtentThisView y ? 0)
fc393425a691 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5475
diff changeset
   323
        ].    
2252
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.
5518
fc393425a691 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5475
diff changeset
   332
        minExtentThisView notNil ifTrue:[
fc393425a691 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5475
diff changeset
   333
            min := min + (minExtentThisView x ? 0)
fc393425a691 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5475
diff changeset
   334
        ].    
2252
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   335
        nextView2 isNil ifTrue:[
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   336
            max := view width.
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   337
        ] ifFalse:[
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   338
            max := nextView2 left.
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   339
        ].
2159
2864c0de7f33 make certain, that handles can always be clicked on;
Claus Gittinger <cg@exept.de>
parents: 2005
diff changeset
   340
    ].
2864c0de7f33 make certain, that handles can always be clicked on;
Claus Gittinger <cg@exept.de>
parents: 2005
diff changeset
   341
2260
ce3be65862db min/max - make certain that handle can still be grabbed
Claus Gittinger <cg@exept.de>
parents: 2252
diff changeset
   342
    min := min + halfBarHeight "- 1".
2252
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   343
    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
   344
    movedHandle == 1 ifTrue:[
ce3be65862db min/max - make certain that handle can still be grabbed
Claus Gittinger <cg@exept.de>
parents: 2252
diff changeset
   345
        min := min + view margin
ce3be65862db min/max - make certain that handle can still be grabbed
Claus Gittinger <cg@exept.de>
parents: 2252
diff changeset
   346
    ].
2245
e561458f9232 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2239
diff changeset
   347
e561458f9232 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2239
diff changeset
   348
"/    max := max - halfBarHeight.
2252
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   349
"/    movedHandle == (subViews size-1) ifTrue:[
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   350
"/        max := max - barHeight + 2.
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   351
"/    ] ifFalse:[
5475
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   352
        max := max - halfBarHeight "+ 1".
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   353
        true "barHeight odd" ifTrue:[ max := max - 1 ].
2252
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   354
"/    ].
2159
2864c0de7f33 make certain, that handles can always be clicked on;
Claus Gittinger <cg@exept.de>
parents: 2005
diff changeset
   355
2260
ce3be65862db min/max - make certain that handle can still be grabbed
Claus Gittinger <cg@exept.de>
parents: 2252
diff changeset
   356
    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
   357
        max := max - view margin
ce3be65862db min/max - make certain that handle can still be grabbed
Claus Gittinger <cg@exept.de>
parents: 2252
diff changeset
   358
    ].
ce3be65862db min/max - make certain that handle can still be grabbed
Claus Gittinger <cg@exept.de>
parents: 2252
diff changeset
   359
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   360
    pos < min ifTrue:[^ min].
2252
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   361
    pos > max ifTrue:[^ max].
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   362
    ^ pos
2159
2864c0de7f33 make certain, that handles can always be clicked on;
Claus Gittinger <cg@exept.de>
parents: 2005
diff changeset
   363
!
2864c0de7f33 make certain, that handles can always be clicked on;
Claus Gittinger <cg@exept.de>
parents: 2005
diff changeset
   364
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   365
detectHandleIndexAt:x y:y
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   366
    "returns the handle index at position x@y or nil if none detected
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   367
    "
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   368
    |subViews
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   369
     size "{ Class: SmallInteger }"|
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   370
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   371
    subViews := view subViews.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   372
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   373
    (size := subViews size) > 1 ifTrue:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   374
	view orientation == #vertical ifTrue:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   375
	    2 to:size do:[:i|
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   376
		(subViews at:i) top >= y ifTrue:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   377
		    ^ (subViews at:(i-1)) bottom < y ifTrue:[i-1] ifFalse:[nil]
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   378
		]
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   379
	    ]
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   380
	] ifFalse:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   381
	    2 to:size do:[:i|
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   382
		(subViews at:i) left >= x ifTrue:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   383
		    ^ (subViews at:(i-1)) right < x ifTrue:[i-1] ifFalse:[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
	]
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   387
    ].
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   388
    ^ nil
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   389
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   390
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   391
! !
1871
a6b15bdfcc92 better opaque resize
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   392
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   393
!VariablePanelController methodsFor:'queries'!
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   394
2529
9501a63ce16c handler movement fixed
Claus Gittinger <cg@exept.de>
parents: 2512
diff changeset
   395
isSnapEntered
9501a63ce16c handler movement fixed
Claus Gittinger <cg@exept.de>
parents: 2512
diff changeset
   396
    ^ saveCursor notNil
9501a63ce16c handler movement fixed
Claus Gittinger <cg@exept.de>
parents: 2512
diff changeset
   397
!
9501a63ce16c handler movement fixed
Claus Gittinger <cg@exept.de>
parents: 2512
diff changeset
   398
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   399
isSnapEntered:anIndex
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   400
    ^ saveCursor notNil and:[anIndex == movedHandle]
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
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   404
isSnapPressed
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   405
    ^ resizeMode notNil and:[resizeMode ~~ #active]
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   406
! !
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   407
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   408
!VariablePanelController methodsFor:'user operations'!
104
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
   409
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   410
doInvertHandle
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   411
    "invert a handle
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   412
    "
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   413
    |pos|
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   414
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   415
    pos := prevPos - (view barHeight + 1 // 2).
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   416
    view invertHandleBarAtX:pos y:pos.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   417
!
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   418
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   419
doResize
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   420
    "perform the resize
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   421
    "
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   422
    |aboveView belowView aboveIndex belowIndex newRelPos subViews isVertical 
5475
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   423
     newCorner newOrigin halfBarHg aboveInvisible belowInvisible|
104
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
   424
1871
a6b15bdfcc92 better opaque resize
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   425
    "undo the last invert"
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   426
    (resizeMode == #active and:[opaqueResizing not]) ifTrue:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   427
        self doInvertHandle
1871
a6b15bdfcc92 better opaque resize
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   428
    ].
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   429
    "check if position changed"
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   430
    prevPos == clickPos ifTrue:[^ self].
104
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
   431
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   432
    "compute the new relative origins & corners"
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   433
    isVertical := view orientation == #vertical.
1871
a6b15bdfcc92 better opaque resize
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   434
    aboveIndex := movedHandle.
a6b15bdfcc92 better opaque resize
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   435
    belowIndex := movedHandle + 1.
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   436
    subViews   := view subViews.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   437
    aboveView  := subViews at:aboveIndex.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   438
    belowView  := subViews at:belowIndex.
5475
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   439
    halfBarHg  := (view barHeight + 1) // 2.
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   440
    aboveInvisible := belowInvisible := false.
1626
3013631d4384 do nothing if pointer was never moved;
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
   441
5475
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   442
    isVertical ifTrue:[
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   443
        "X complains badly if you try to create/resize a view with a dimension <= 0
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   444
        "
5475
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   445
        prevPos - halfBarHg == aboveView top ifTrue:[
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   446
            prevPos := prevPos + 1.
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   447
            aboveInvisible := true.
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   448
        ].
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   449
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   450
        newRelPos := (prevPos / view height) asFloat.
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   451
        newCorner := aboveView relativeCorner x @ newRelPos.
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   452
        newOrigin := belowView relativeOrigin x @ newRelPos.
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   453
    ] ifFalse:[
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   454
        "X complains badly if you try to create/resize a view with a dimension <= 0
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   455
        "
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   456
        prevPos - halfBarHg == aboveView left ifTrue:[
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   457
            prevPos := prevPos + 1.
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   458
            aboveInvisible := true.
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   459
        ].
104
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
   460
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   461
        newRelPos := (prevPos / view width) asFloat.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   462
        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
   463
        newOrigin := newRelPos @ belowView relativeOrigin y.
1871
a6b15bdfcc92 better opaque resize
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   464
    ].
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   465
    view lockRedraw.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   466
1871
a6b15bdfcc92 better opaque resize
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   467
    aboveView relativeCorner:newCorner.
a6b15bdfcc92 better opaque resize
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   468
    belowView relativeOrigin:newOrigin.
5475
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   469
    aboveInvisible ifTrue:[
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   470
        aboveView realized ifTrue:[ aboveView unmap ].
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   471
    ] ifFalse:[
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   472
        aboveView realized ifFalse:[ aboveView map ].
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   473
    ].    
104
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
   474
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   475
    prevPos > clickPos ifTrue:[ "above view grows"
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   476
        view resizeSubviewsFrom:aboveIndex to:belowIndex.
104
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
   477
    ] ifFalse:[
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   478
        view resizeSubviewsFrom:belowIndex to:aboveIndex
1871
a6b15bdfcc92 better opaque resize
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   479
    ].
a6b15bdfcc92 better opaque resize
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   480
    view unlockRedraw.
1626
3013631d4384 do nothing if pointer was never moved;
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
   481
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   482
    prevPos := isVertical ifTrue:[aboveView bottom] ifFalse:[aboveView right].
5475
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   483
    prevPos := prevPos + halfBarHg.
1483
e0fb580b5131 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
   484
!
e0fb580b5131 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
   485
2236
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   486
doSnapPressedX:x y:y
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   487
    "perform the snap press
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   488
    "
2236
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   489
    |layout handle curRCorner prvRCorner isVertical newPos mode isMax isMin doRememberPosition|
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   490
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   491
    (mode := view snapMode) isNil ifTrue:[^ self].
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   492
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   493
    layout     := view snapLayoutAt:movedHandle.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   494
    handle     := view subViews at:movedHandle.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   495
    isVertical := view orientation == #vertical.
2236
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   496
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   497
    curRCorner := handle relativeCorner.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   498
    prvRCorner := handle objectAttributeAt:#vpext.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   499
2236
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   500
    isMax := isMin := false.
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   501
    mode == #both ifTrue:[
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   502
        isVertical ifTrue:[
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   503
            isMax := x > (layout right - (layout width//3)).
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   504
            isMin := x < (layout left + (layout width//3)).
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   505
        ] ifFalse:[
2239
31a57c0002a2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2236
diff changeset
   506
            isMin := y > (layout bottom - (layout height//3)).
31a57c0002a2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2236
diff changeset
   507
            isMax := y < (layout top + (layout height//3)).
2236
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   508
        ].
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   509
        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
   510
        doRememberPosition := (isMin or:[isMax]) and:[prvRCorner isNil].
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   511
    ] ifFalse:[
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   512
        isMax := view snapAtIndexWillGrow:movedHandle.
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   513
        isMin := isMax not.
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   514
        isMax ifTrue:[
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   515
           isMax := prvRCorner isNil or:[mode ~~ #min]
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   516
        ] ifFalse:[
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   517
           isMin := prvRCorner isNil or:[mode ~~ #max]
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   518
        ].
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   519
        doRememberPosition := true.
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   520
    ].
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
    isMax ifTrue:[
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   523
        newPos := 99999        "set extent to max"
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   524
    ] ifFalse:[
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   525
        isMin ifTrue:[
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   526
            newPos := 0        "set extent to min"
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   527
        ] ifFalse:[
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   528
            newPos := nil      "restore previous extent"
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   529
        ]
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   530
    ].
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   531
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   532
    newPos isNil ifTrue:[
2236
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   533
        prvRCorner isNil ifTrue:[
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   534
            "/ nothing to do
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   535
            ^ self
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
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   538
        "restore previous extent"
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   539
        newPos := isVertical ifTrue:[view height * prvRCorner y]
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   540
                            ifFalse:[view width  * prvRCorner x].
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   541
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   542
        newPos := self checkedHandleMovementX:newPos y:newPos.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   543
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   544
        (prevPos - newPos) abs < 2 ifTrue:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   545
            "cannot resize; set extent to min or max dependent on the current extent"
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   546
            isVertical ifTrue:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   547
                newPos := handle height > 2 ifTrue:[0] ifFalse:[99999]
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   548
            ] ifFalse:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   549
                newPos := handle width  > 2 ifTrue:[0] ifFalse:[99999]
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   550
            ].
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   551
            newPos := self checkedHandleMovementX:newPos y:newPos.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   552
        ].
2236
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   553
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   554
        mode == #both ifTrue:[
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   555
           handle objectAttributeAt:#vpext put:nil.         "clear previous corner"
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   556
           doRememberPosition := false.
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   557
        ].
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   558
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   559
    ] ifFalse:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   560
        newPos := self checkedHandleMovementX:newPos y:newPos
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   561
    ].
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   562
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   563
    (newPos - prevPos) abs < 2 ifFalse:[
2236
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   564
        doRememberPosition ifTrue:[
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   565
            handle objectAttributeAt:#vpext put:curRCorner.         "save previous corner"
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   566
        ].
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   567
        prevPos := newPos.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   568
        self doResize.
1483
e0fb580b5131 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
   569
    ]
200
aa3e56929a5a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   570
! !
104
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
   571
203
8a38b0b03233 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   572
!VariablePanelController class methodsFor:'documentation'!
8a38b0b03233 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   573
8a38b0b03233 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   574
version
5475
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   575
    ^ '$Header$'
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   576
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   577
203
8a38b0b03233 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   578
! !
5475
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   579