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