VariablePanelController.st
author Claus Gittinger <cg@exept.de>
Wed, 20 Feb 2019 10:29:52 +0100
changeset 6539 11056d07f893
parent 6520 bfddffa53838
child 6571 1ad83c609698
permissions -rw-r--r--
class: DialogBox class changed: #requestFileNameForImageSave:image:default:pattern: removed the libtool prerequisite
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
        handle notNil ifTrue:[
6464
d3ff7df466f7 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5518
diff changeset
   267
            "/ there is a handle; thus we have to setup the cursor...
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
            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
   269
        ].
954415c8fa83 bug fix in #pointerLeave: the KDE sends a #pointerLeave: with each button press which should be discard
ca
parents: 2652
diff changeset
   270
    ].
6464
d3ff7df466f7 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5518
diff changeset
   271
d3ff7df466f7 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5518
diff changeset
   272
    view showHandleWhenEntered ifTrue:[
d3ff7df466f7 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5518
diff changeset
   273
        handle := self detectHandleIndexAt:bx y:by.
d3ff7df466f7 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5518
diff changeset
   274
        handle notNil ifTrue:[
d3ff7df466f7 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5518
diff changeset
   275
            view showHandle:true
d3ff7df466f7 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5518
diff changeset
   276
        ].
d3ff7df466f7 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5518
diff changeset
   277
    ].
d3ff7df466f7 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5518
diff changeset
   278
d3ff7df466f7 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5518
diff changeset
   279
    "Modified: / 22-10-2018 / 23:42:39 / Claus Gittinger"
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   280
!
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   281
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   282
pointerLeave:state
6464
d3ff7df466f7 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5518
diff changeset
   283
    "this could be send by KDE before a button press event;
2665
954415c8fa83 bug fix in #pointerLeave: the KDE sends a #pointerLeave: with each button press which should be discard
ca
parents: 2652
diff changeset
   284
     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
   285
    "
6464
d3ff7df466f7 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5518
diff changeset
   286
    
2665
954415c8fa83 bug fix in #pointerLeave: the KDE sends a #pointerLeave: with each button press which should be discard
ca
parents: 2652
diff changeset
   287
    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
   288
954415c8fa83 bug fix in #pointerLeave: the KDE sends a #pointerLeave: with each button press which should be discard
ca
parents: 2652
diff changeset
   289
    "/ 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
   290
    "/ restore the cursor and redraw the snap if not nil
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   291
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   292
    saveCursor notNil ifTrue:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   293
        "restore the cursor"
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   294
        view cursor:saveCursor.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   295
        saveCursor := nil
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   296
    ].
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   297
2665
954415c8fa83 bug fix in #pointerLeave: the KDE sends a #pointerLeave: with each button press which should be discard
ca
parents: 2652
diff changeset
   298
    resizeMode := nil.
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   299
2665
954415c8fa83 bug fix in #pointerLeave: the KDE sends a #pointerLeave: with each button press which should be discard
ca
parents: 2652
diff changeset
   300
    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
   301
        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
   302
        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
   303
        movedHandle := nil.
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   304
    ].
6464
d3ff7df466f7 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5518
diff changeset
   305
d3ff7df466f7 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5518
diff changeset
   306
    view showHandleWhenEntered ifTrue:[
d3ff7df466f7 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5518
diff changeset
   307
        view showHandle:false
d3ff7df466f7 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5518
diff changeset
   308
    ].
d3ff7df466f7 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5518
diff changeset
   309
d3ff7df466f7 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5518
diff changeset
   310
    "Modified (format): / 22-10-2018 / 23:43:57 / Claus Gittinger"
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   311
! !
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   312
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   313
!VariablePanelController methodsFor:'private'!
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   314
2159
2864c0de7f33 make certain, that handles can always be clicked on;
Claus Gittinger <cg@exept.de>
parents: 2005
diff changeset
   315
checkedHandleMovementX:bx y:by
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   316
    "check and return valid position a handle can be placed
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   317
    "
5518
fc393425a691 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5475
diff changeset
   318
    |max min pos subViews halfBarHeight barHeight 
fc393425a691 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5475
diff changeset
   319
     thisView nextView nextView2
fc393425a691 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5475
diff changeset
   320
     minExtentThisView|
2159
2864c0de7f33 make certain, that handles can always be clicked on;
Claus Gittinger <cg@exept.de>
parents: 2005
diff changeset
   321
2864c0de7f33 make certain, that handles can always be clicked on;
Claus Gittinger <cg@exept.de>
parents: 2005
diff changeset
   322
    subViews := view subViews.
2252
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   323
    barHeight := view barHeight.
2245
e561458f9232 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2239
diff changeset
   324
"/    halfBarHeight := view barHeight + 1 // 2.
2252
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   325
    halfBarHeight := barHeight // 2.
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   326
5518
fc393425a691 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5475
diff changeset
   327
    thisView := subViews at:movedHandle. "/ the view above the handle
2252
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   328
    nextView := subViews at:movedHandle + 1.
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   329
    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
   330
5518
fc393425a691 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5475
diff changeset
   331
    minExtentThisView := thisView minExtent.
fc393425a691 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5475
diff changeset
   332
    
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   333
    view orientation == #vertical ifTrue:[
2245
e561458f9232 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2239
diff changeset
   334
        pos := by.
2252
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   335
        min := thisView top.
5518
fc393425a691 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5475
diff changeset
   336
        minExtentThisView notNil ifTrue:[
fc393425a691 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5475
diff changeset
   337
            min := min + (minExtentThisView y ? 0)
fc393425a691 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5475
diff changeset
   338
        ].    
2252
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   339
        nextView2 isNil ifTrue:[
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   340
            max := view height.
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   341
        ] ifFalse:[
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   342
            max := nextView2 top.
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   343
        ].
2159
2864c0de7f33 make certain, that handles can always be clicked on;
Claus Gittinger <cg@exept.de>
parents: 2005
diff changeset
   344
    ] ifFalse:[
2245
e561458f9232 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2239
diff changeset
   345
        pos := bx.
2252
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   346
        min := thisView left.
5518
fc393425a691 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5475
diff changeset
   347
        minExtentThisView notNil ifTrue:[
fc393425a691 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5475
diff changeset
   348
            min := min + (minExtentThisView x ? 0)
fc393425a691 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5475
diff changeset
   349
        ].    
2252
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   350
        nextView2 isNil ifTrue:[
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   351
            max := view width.
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   352
        ] ifFalse:[
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   353
            max := nextView2 left.
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
    ].
2864c0de7f33 make certain, that handles can always be clicked on;
Claus Gittinger <cg@exept.de>
parents: 2005
diff changeset
   356
2260
ce3be65862db min/max - make certain that handle can still be grabbed
Claus Gittinger <cg@exept.de>
parents: 2252
diff changeset
   357
    min := min + halfBarHeight "- 1".
2252
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   358
    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
   359
    movedHandle == 1 ifTrue:[
ce3be65862db min/max - make certain that handle can still be grabbed
Claus Gittinger <cg@exept.de>
parents: 2252
diff changeset
   360
        min := min + view margin
ce3be65862db min/max - make certain that handle can still be grabbed
Claus Gittinger <cg@exept.de>
parents: 2252
diff changeset
   361
    ].
2245
e561458f9232 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2239
diff changeset
   362
e561458f9232 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2239
diff changeset
   363
"/    max := max - halfBarHeight.
2252
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   364
"/    movedHandle == (subViews size-1) ifTrue:[
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   365
"/        max := max - barHeight + 2.
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   366
"/    ] ifFalse:[
5475
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   367
        max := max - halfBarHeight "+ 1".
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   368
        true "barHeight odd" ifTrue:[ max := max - 1 ].
2252
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   369
"/    ].
2159
2864c0de7f33 make certain, that handles can always be clicked on;
Claus Gittinger <cg@exept.de>
parents: 2005
diff changeset
   370
2260
ce3be65862db min/max - make certain that handle can still be grabbed
Claus Gittinger <cg@exept.de>
parents: 2252
diff changeset
   371
    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
   372
        max := max - view margin
ce3be65862db min/max - make certain that handle can still be grabbed
Claus Gittinger <cg@exept.de>
parents: 2252
diff changeset
   373
    ].
ce3be65862db min/max - make certain that handle can still be grabbed
Claus Gittinger <cg@exept.de>
parents: 2252
diff changeset
   374
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   375
    pos < min ifTrue:[^ min].
2252
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   376
    pos > max ifTrue:[^ max].
67269562b687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   377
    ^ pos
2159
2864c0de7f33 make certain, that handles can always be clicked on;
Claus Gittinger <cg@exept.de>
parents: 2005
diff changeset
   378
!
2864c0de7f33 make certain, that handles can always be clicked on;
Claus Gittinger <cg@exept.de>
parents: 2005
diff changeset
   379
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   380
detectHandleIndexAt:x y:y
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   381
    "returns the handle index at position x@y or nil if none detected
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   382
    "
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   383
    |subViews
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   384
     size "{ Class: SmallInteger }"|
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   385
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   386
    subViews := view subViews.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   387
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   388
    (size := subViews size) > 1 ifTrue:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   389
	view orientation == #vertical ifTrue:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   390
	    2 to:size do:[:i|
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   391
		(subViews at:i) top >= y ifTrue:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   392
		    ^ (subViews at:(i-1)) bottom < y ifTrue:[i-1] ifFalse:[nil]
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   393
		]
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   394
	    ]
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   395
	] ifFalse:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   396
	    2 to:size do:[:i|
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   397
		(subViews at:i) left >= x ifTrue:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   398
		    ^ (subViews at:(i-1)) right < x ifTrue:[i-1] ifFalse:[nil]
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   399
		]
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   400
	    ]
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   401
	]
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   402
    ].
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   403
    ^ nil
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   404
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   405
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   406
! !
1871
a6b15bdfcc92 better opaque resize
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   407
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   408
!VariablePanelController methodsFor:'queries'!
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   409
2529
9501a63ce16c handler movement fixed
Claus Gittinger <cg@exept.de>
parents: 2512
diff changeset
   410
isSnapEntered
9501a63ce16c handler movement fixed
Claus Gittinger <cg@exept.de>
parents: 2512
diff changeset
   411
    ^ saveCursor notNil
9501a63ce16c handler movement fixed
Claus Gittinger <cg@exept.de>
parents: 2512
diff changeset
   412
!
9501a63ce16c handler movement fixed
Claus Gittinger <cg@exept.de>
parents: 2512
diff changeset
   413
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   414
isSnapEntered:anIndex
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   415
    ^ saveCursor notNil and:[anIndex == movedHandle]
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   416
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
isSnapPressed
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   420
    ^ resizeMode notNil and:[resizeMode ~~ #active]
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   421
! !
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   422
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   423
!VariablePanelController methodsFor:'user operations'!
104
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
   424
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   425
doInvertHandle
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   426
    "invert a handle
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   427
    "
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   428
    |pos|
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   429
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   430
    pos := prevPos - (view barHeight + 1 // 2).
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   431
    view invertHandleBarAtX:pos y:pos.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   432
!
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   433
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   434
doResize
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   435
    "perform the resize
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   436
    "
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   437
    |aboveView belowView aboveIndex belowIndex newRelPos subViews isVertical 
5475
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   438
     newCorner newOrigin halfBarHg aboveInvisible belowInvisible|
104
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
   439
1871
a6b15bdfcc92 better opaque resize
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   440
    "undo the last invert"
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   441
    (resizeMode == #active and:[opaqueResizing not]) ifTrue:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   442
        self doInvertHandle
1871
a6b15bdfcc92 better opaque resize
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   443
    ].
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   444
    "check if position changed"
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   445
    prevPos == clickPos ifTrue:[^ self].
104
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
   446
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   447
    "compute the new relative origins & corners"
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   448
    isVertical := view orientation == #vertical.
1871
a6b15bdfcc92 better opaque resize
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   449
    aboveIndex := movedHandle.
a6b15bdfcc92 better opaque resize
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   450
    belowIndex := movedHandle + 1.
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   451
    subViews   := view subViews.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   452
    aboveView  := subViews at:aboveIndex.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   453
    belowView  := subViews at:belowIndex.
5475
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   454
    halfBarHg  := (view barHeight + 1) // 2.
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   455
    aboveInvisible := belowInvisible := false.
1626
3013631d4384 do nothing if pointer was never moved;
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
   456
5475
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   457
    isVertical ifTrue:[
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   458
        "X complains badly if you try to create/resize a view with a dimension <= 0
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   459
        "
5475
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   460
        prevPos - halfBarHg == aboveView top ifTrue:[
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   461
            prevPos := prevPos + 1.
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   462
            aboveInvisible := true.
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   463
        ].
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   464
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   465
        newRelPos := (prevPos / view height) asFloat.
6520
bfddffa53838 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6464
diff changeset
   466
        aboveView relativeCorner isNil ifTrue:[
bfddffa53838 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6464
diff changeset
   467
            view setupSubviewOrigins.
bfddffa53838 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6464
diff changeset
   468
            thisContext restart.
bfddffa53838 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6464
diff changeset
   469
        ].    
5475
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   470
        newCorner := aboveView relativeCorner x @ newRelPos.
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   471
        newOrigin := belowView relativeOrigin x @ newRelPos.
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   472
    ] ifFalse:[
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   473
        "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
   474
        "
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   475
        prevPos - halfBarHg == aboveView left ifTrue:[
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   476
            prevPos := prevPos + 1.
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   477
            aboveInvisible := true.
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   478
        ].
104
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
   479
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   480
        newRelPos := (prevPos / view width) asFloat.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   481
        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
   482
        newOrigin := newRelPos @ belowView relativeOrigin y.
1871
a6b15bdfcc92 better opaque resize
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   483
    ].
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   484
    view lockRedraw.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   485
1871
a6b15bdfcc92 better opaque resize
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   486
    aboveView relativeCorner:newCorner.
a6b15bdfcc92 better opaque resize
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   487
    belowView relativeOrigin:newOrigin.
5475
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   488
    aboveInvisible ifTrue:[
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   489
        aboveView realized ifTrue:[ aboveView unmap ].
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   490
    ] ifFalse:[
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   491
        aboveView realized ifFalse:[ aboveView map ].
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   492
    ].    
104
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
   493
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   494
    prevPos > clickPos ifTrue:[ "above view grows"
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   495
        view resizeSubviewsFrom:aboveIndex to:belowIndex.
104
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
   496
    ] ifFalse:[
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   497
        view resizeSubviewsFrom:belowIndex to:aboveIndex
1871
a6b15bdfcc92 better opaque resize
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   498
    ].
a6b15bdfcc92 better opaque resize
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   499
    view unlockRedraw.
1626
3013631d4384 do nothing if pointer was never moved;
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
   500
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   501
    prevPos := isVertical ifTrue:[aboveView bottom] ifFalse:[aboveView right].
5475
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   502
    prevPos := prevPos + halfBarHg.
6520
bfddffa53838 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6464
diff changeset
   503
bfddffa53838 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6464
diff changeset
   504
    "Modified: / 01-02-2019 / 20:51:56 / Claus Gittinger"
1483
e0fb580b5131 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
   505
!
e0fb580b5131 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
   506
2236
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   507
doSnapPressedX:x y:y
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   508
    "perform the snap press
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   509
    "
2236
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   510
    |layout handle curRCorner prvRCorner isVertical newPos mode isMax isMin doRememberPosition|
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   511
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   512
    (mode := view snapMode) isNil ifTrue:[^ self].
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   513
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   514
    layout     := view snapLayoutAt:movedHandle.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   515
    handle     := view subViews at:movedHandle.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   516
    isVertical := view orientation == #vertical.
2236
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   517
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   518
    curRCorner := handle relativeCorner.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   519
    prvRCorner := handle objectAttributeAt:#vpext.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   520
2236
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   521
    isMax := isMin := false.
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   522
    mode == #both ifTrue:[
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   523
        isVertical ifTrue:[
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   524
            isMax := x > (layout right - (layout width//3)).
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   525
            isMin := x < (layout left + (layout width//3)).
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   526
        ] ifFalse:[
2239
31a57c0002a2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2236
diff changeset
   527
            isMin := y > (layout bottom - (layout height//3)).
31a57c0002a2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2236
diff changeset
   528
            isMax := y < (layout top + (layout height//3)).
2236
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   529
        ].
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   530
        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
   531
        doRememberPosition := (isMin or:[isMax]) and:[prvRCorner isNil].
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   532
    ] ifFalse:[
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   533
        isMax := view snapAtIndexWillGrow:movedHandle.
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   534
        isMin := isMax not.
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   535
        isMax ifTrue:[
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   536
           isMax := prvRCorner isNil or:[mode ~~ #min]
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   537
        ] ifFalse:[
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   538
           isMin := prvRCorner isNil or:[mode ~~ #max]
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   539
        ].
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   540
        doRememberPosition := true.
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   541
    ].
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   542
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   543
    isMax ifTrue:[
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   544
        newPos := 99999        "set extent to max"
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   545
    ] ifFalse:[
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   546
        isMin ifTrue:[
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   547
            newPos := 0        "set extent to min"
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   548
        ] ifFalse:[
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   549
            newPos := nil      "restore previous extent"
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   550
        ]
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   551
    ].
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   552
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   553
    newPos isNil ifTrue:[
2236
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   554
        prvRCorner isNil ifTrue:[
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   555
            "/ nothing to do
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   556
            ^ self
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
        "restore previous extent"
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   560
        newPos := isVertical ifTrue:[view height * prvRCorner y]
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   561
                            ifFalse:[view width  * prvRCorner x].
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   562
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   563
        newPos := self checkedHandleMovementX:newPos y:newPos.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   564
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   565
        (prevPos - newPos) abs < 2 ifTrue:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   566
            "cannot resize; set extent to min or max dependent on the current extent"
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   567
            isVertical ifTrue:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   568
                newPos := handle height > 2 ifTrue:[0] ifFalse:[99999]
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   569
            ] ifFalse:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   570
                newPos := handle width  > 2 ifTrue:[0] ifFalse:[99999]
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   571
            ].
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   572
            newPos := self checkedHandleMovementX:newPos y:newPos.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   573
        ].
2236
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   574
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   575
        mode == #both ifTrue:[
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   576
           handle objectAttributeAt:#vpext put:nil.         "clear previous corner"
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   577
           doRememberPosition := false.
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   578
        ].
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   579
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   580
    ] ifFalse:[
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   581
        newPos := self checkedHandleMovementX:newPos y:newPos
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   582
    ].
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   583
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   584
    (newPos - prevPos) abs < 2 ifFalse:[
2236
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   585
        doRememberPosition ifTrue:[
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   586
            handle objectAttributeAt:#vpext put:curRCorner.         "save previous corner"
cd77d04c9a0a snapMode: #both
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   587
        ].
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   588
        prevPos := newPos.
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   589
        self doResize.
1483
e0fb580b5131 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
   590
    ]
200
aa3e56929a5a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   591
! !
104
ca75c90df7a9 Initial revision
claus
parents:
diff changeset
   592
203
8a38b0b03233 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   593
!VariablePanelController class methodsFor:'documentation'!
8a38b0b03233 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   594
8a38b0b03233 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   595
version
5475
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   596
    ^ '$Header$'
2179
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   597
ae22ac1e068e support snap
ca
parents: 2163
diff changeset
   598
203
8a38b0b03233 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   599
! !
5475
f7082f92390c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
   600