RectanglefromUserController.st
author Claus Gittinger <cg@exept.de>
Thu, 09 Nov 2017 20:09:30 +0100
changeset 6225 0122e4e6c587
parent 6144 b62a2aacaccb
child 6793 8527e1fe23c4
permissions -rw-r--r--
#FEATURE by cg class: GenericToolbarIconLibrary class added: #hideFilter16x16Icon
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6119
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 2017 by eXept Software AG
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
              All Rights Reserved
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 hereby transferred.
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
"
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
"{ Package: 'stx:libwidg' }"
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
"{ NameSpace: Smalltalk }"
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
ButtonController subclass:#RectangleFromUserController
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	instanceVariableNames:'action startPoint lastX lastY'
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	classVariableNames:''
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
	poolDictionaries:''
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
	category:'Interface-Support-Controllers'
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
!
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
!RectangleFromUserController class methodsFor:'documentation'!
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
copyright
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
"
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
 COPYRIGHT (c) 2017 by eXept Software AG
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
              All Rights Reserved
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
 This software is furnished under a license and may be used
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
 only in accordance with the terms of that license and with the
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
 be provided or otherwise made available to, or used by, any
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
 other person.  No title to or ownership of the software is
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
 hereby transferred.
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
"
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
!
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
documentation
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
"
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
    drags a rectangle.
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
    An instance of me can be installed temporarily as controller of any view,
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
    to let the user select a rectangular area from the view.
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
    Use the utility method:
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
        dragRectangleIn:aView thenDo:action
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
    which does exactly that for your (and cares to restore any original controller)    
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
    
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
"
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
!
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
examples
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
"
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
    |v c|
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
    v := View new openAndWait.
6120
37438a85b476 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6119
diff changeset
    58
    c := RectangleFromUserController new.
6119
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
    c action:[:rect | Transcript showCR:rect ].
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
    v openAndWait.
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
    
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
    v controller:c.
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
"
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
! !
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
!RectangleFromUserController class methodsFor:'utilities'!
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
dragRectangleIn:aView thenDo:action
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
    "drag a rectangle in aView"
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
    
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
    |dragController oldController oldCursor|
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
    
6120
37438a85b476 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6119
diff changeset
    73
    dragController := self new.
6119
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
    dragController view:aView.
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
    oldController := aView controller.
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
    oldCursor := aView cursor.
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
    aView cursor:Cursor origin.
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
    dragController action:[:rectOrNil |
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
        |image|
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
        aView controller:oldController.
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
        aView cursor:oldCursor.
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
        action value:rectOrNil.
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
    ].
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
    
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
    aView controller:dragController.
6120
37438a85b476 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6119
diff changeset
    88
37438a85b476 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6119
diff changeset
    89
    "Modified: / 07-03-2017 / 18:25:27 / cg"
37438a85b476 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6119
diff changeset
    90
!
37438a85b476 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6119
diff changeset
    91
37438a85b476 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6119
diff changeset
    92
rectangleFromUserIn:aView thenDo:action
37438a85b476 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6119
diff changeset
    93
    "drag a rectangle in aView"
37438a85b476 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6119
diff changeset
    94
    
37438a85b476 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6119
diff changeset
    95
    |dragController oldController oldCursor|
37438a85b476 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6119
diff changeset
    96
    
37438a85b476 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6119
diff changeset
    97
    dragController := self new.
37438a85b476 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6119
diff changeset
    98
    dragController view:aView.
37438a85b476 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6119
diff changeset
    99
    oldController := aView controller.
37438a85b476 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6119
diff changeset
   100
    oldCursor := aView cursor.
37438a85b476 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6119
diff changeset
   101
37438a85b476 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6119
diff changeset
   102
    aView cursor:Cursor origin.
37438a85b476 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6119
diff changeset
   103
    dragController action:[:rectOrNil |
37438a85b476 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6119
diff changeset
   104
        |image|
37438a85b476 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6119
diff changeset
   105
37438a85b476 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6119
diff changeset
   106
        aView controller:oldController.
37438a85b476 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6119
diff changeset
   107
        aView cursor:oldCursor.
37438a85b476 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6119
diff changeset
   108
        action value:rectOrNil.
37438a85b476 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6119
diff changeset
   109
    ].
37438a85b476 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6119
diff changeset
   110
    
37438a85b476 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6119
diff changeset
   111
    aView controller:dragController.
37438a85b476 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6119
diff changeset
   112
37438a85b476 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6119
diff changeset
   113
    "Created: / 07-03-2017 / 18:30:04 / cg"
6119
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
! !
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   116
!RectangleFromUserController methodsFor:'accessing'!
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   117
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   118
action:aBlock
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
    "set the block which will be called when the rectangle drag is finished.
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
     The block will be called with a nil arg, if escape is pressed"
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
     
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
    action := aBlock
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
!
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
lastMousePoint
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
    lastX isNil ifTrue:[^ nil].
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
    ^ lastX @ lastY
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
!
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
startPoint
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
    ^ startPoint
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   132
! !
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
!RectangleFromUserController methodsFor:'event handling'!
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
buttonMotion:buttonState x:x y:y
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
    (buttonState == 0 or:[startPoint isNil]) ifTrue:[
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
        super buttonMotion:buttonState x:x y:y.
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
        ^ self
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   140
    ].
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
    
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
    lastX notNil ifTrue:[
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   143
        view xoring:[
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   144
            view displayRectangle:(startPoint corner:(lastX@lastY))
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   145
        ].
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   146
    ].
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
    
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
    lastX := x.
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   149
    lastY := y.
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   150
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   151
    startPoint ~= (x@y) ifTrue:[
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   152
        view xoring:[
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   153
            view displayRectangle:(startPoint corner:(lastX@lastY))
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   154
        ].
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   155
    ].
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
!
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   157
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   158
buttonPress:button x:x y:y
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   159
    startPoint := x@y.
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   160
    view cursor:(Cursor corner).
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   161
!
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   162
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   163
buttonRelease:button x:x y:y
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
    |rect|
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
    
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
    startPoint isNil ifTrue:[
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   167
        super buttonRelease:button x:x y:y.
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   168
        ^ self
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   169
    ].
6144
b62a2aacaccb #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6120
diff changeset
   170
    
6119
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   171
    (lastX isNil or:[lastY isNil]) ifTrue:[
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   172
        lastX := x.
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   173
        lastY := y.
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   174
    ].
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   175
    
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   176
    view xoring:[
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   177
        view displayRectangle:(startPoint corner:(lastX@lastY))
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   178
    ].
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   179
    rect := startPoint corner:(lastX@lastY).
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   180
    startPoint := lastX := lastY := nil.
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   181
    action value:rect.
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   182
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   183
    "Modified: / 09-02-2017 / 23:18:01 / cg"
6144
b62a2aacaccb #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6120
diff changeset
   184
    "Modified (format): / 10-04-2017 / 08:39:33 / cg"
6119
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   185
!
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   186
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   187
keyPress:key x:x y:y
6144
b62a2aacaccb #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6120
diff changeset
   188
    "actually, this is for the escape key (to abort a drag operation)"
b62a2aacaccb #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6120
diff changeset
   189
    
6119
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   190
    startPoint isNil ifTrue:[
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   191
        super keyPress:key x:x y:y.
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   192
        ^ self
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   193
    ].
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   194
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   195
    lastX notNil ifTrue:[
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   196
        view xoring:[
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   197
            view displayRectangle:(startPoint corner:(lastX@lastY))
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   198
        ].
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   199
    ].
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   200
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   201
    startPoint := nil.
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   202
    action value:nil.
6144
b62a2aacaccb #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6120
diff changeset
   203
b62a2aacaccb #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6120
diff changeset
   204
    "Modified (comment): / 10-04-2017 / 08:40:57 / cg"
6119
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   205
! !
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   206
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   207
!RectangleFromUserController class methodsFor:'documentation'!
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   208
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   209
version
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   210
    ^ '$Header$'
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   211
!
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   212
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   213
version_CVS
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   214
    ^ '$Header$'
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   215
! !
ad406347b834 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   216