UIObjectView.st
author ca
Mon, 17 Feb 1997 18:23:19 +0100
changeset 54 d0b5a33e6df0
parent 52 40a98a1507b4
child 55 19e021c8f1ef
permissions -rw-r--r--
*** empty log message ***
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
<
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
     1
ObjectView subclass:#UIObjectView
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
     2
	instanceVariableNames:'inputView testMode undoHistory copiedExtent actionData
52
40a98a1507b4 *** empty log message ***
ca
parents: 51
diff changeset
     3
		createClass clipChildren'
40a98a1507b4 *** empty log message ***
ca
parents: 51
diff changeset
     4
	classVariableNames:''
40a98a1507b4 *** empty log message ***
ca
parents: 51
diff changeset
     5
	poolDictionaries:''
40a98a1507b4 *** empty log message ***
ca
parents: 51
diff changeset
     6
	category:'Interface-UIPainter'
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
     7
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
     8
47
5e4319953a0b *** empty log message ***
ca
parents: 44
diff changeset
     9
Object subclass:#UndoHistory
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
    10
	instanceVariableNames:'history transaction enabled'
52
40a98a1507b4 *** empty log message ***
ca
parents: 51
diff changeset
    11
	classVariableNames:''
40a98a1507b4 *** empty log message ***
ca
parents: 51
diff changeset
    12
	poolDictionaries:''
40a98a1507b4 *** empty log message ***
ca
parents: 51
diff changeset
    13
	privateIn:UIObjectView
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    14
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    15
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
    16
Object subclass:#Transaction
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
    17
	instanceVariableNames:'type text actions'
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
    18
	classVariableNames:''
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
    19
	poolDictionaries:''
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
    20
	privateIn:UIObjectView::UndoHistory
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
    21
!
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
    22
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    23
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    24
!UIObjectView class methodsFor:'defaults'!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    25
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    26
defaultGrid
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    27
    ^ 4 @ 4
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    28
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    29
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    30
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    31
gridShown
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    32
    ^ false
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    33
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    34
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    35
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    36
handleSize
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    37
    "size of blob drawn for handles"
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    38
    ^ 4
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    39
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    40
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    41
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    42
hitDelta
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    43
    ^ 4
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    44
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    45
! !
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    46
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    47
!UIObjectView methodsFor:'accessing'!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    48
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    49
gridParameters
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    50
    "used by defineGrid, and in a separate method for
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    51
     easier redefinition in subclasses. 
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    52
     Returns the grid parameters in an array of 7 elements,
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    53
     which control the appearance of the grid-pattern.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    54
     the elements are:
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    55
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    56
        bigStepH        number of pixels horizontally between 2 major steps
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    57
        bigStepV        number of pixels vertically between 2 major steps
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    58
        littleStepH     number of pixels horizontally between 2 minor steps
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    59
        littleStepV     number of pixels vertically between 2 minor steps
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    60
        gridAlignH      number of pixels for horizontal grid align (pointer snap)
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    61
        gridAlignV      number of pixels for vertical grid align (pointer snap)
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    62
        docBounds       true, if document boundary should be shown
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    63
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    64
     if littleStepH/V are nil, only bigSteps are drawn.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    65
    "
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    66
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    67
    ^ #(10 10 nil nil 10 10 false)
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    68
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    69
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    70
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    71
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    72
hideGrid
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    73
    gridShown ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    74
        self withSelectionHiddenDo:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    75
            super hideGrid
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    76
        ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    77
    ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    78
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    79
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    80
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    81
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    82
showGrid
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    83
    self withSelectionHiddenDo:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    84
        super showGrid
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    85
    ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    86
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    87
    "Modified: 5.9.1995 / 12:47:46 / claus"
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    88
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    89
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    90
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    91
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    92
testMode
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    93
    "returns testMode
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    94
    "
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    95
    ^ testMode
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    96
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    97
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    98
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
    99
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   100
testMode:aBoolean
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   101
    "change testMode
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   102
    "
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   103
    (aBoolean == testMode) ifFalse:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   104
        testMode := aBoolean.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   105
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   106
        testMode ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   107
            self unselect.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   108
            inputView unrealize
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   109
        ] ifFalse:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   110
            inputView raise.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   111
            inputView realize
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   112
        ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   113
    ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   114
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   115
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   116
! !
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   117
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   118
!UIObjectView methodsFor:'blocked'!
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   119
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   120
addObject:anObject
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   121
    "add the argument, anObject to the contents - with redraw"
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   122
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   123
    self halt
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   124
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   125
!
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   126
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   127
addObjectWithoutRedraw:anObject
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   128
    "add the argument, anObject to the contents - with redraw"
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   129
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   130
    self halt
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   131
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   132
! !
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   133
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   134
!UIObjectView methodsFor:'event handling'!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   135
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   136
doKeyInput:key
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   137
    ^ self
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   138
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   139
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   140
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   141
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   142
elementChanged:aView 
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   143
    "some element has been changed - kludge to force a resizing
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   144
     operation (for child layout recomputation) in its superView"
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   145
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   146
    aView superView sizeChanged:nil.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   147
    self changed:#any.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   148
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   149
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   150
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   151
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   152
elementChangedLayout:aView 
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   153
    "some element has been changed - kludge to force a resizing
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   154
     operation (for child layout recomputation) in its superView"
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   155
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   156
    aView superView sizeChanged:nil.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   157
    self changed:#layout.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   158
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   159
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   160
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   161
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   162
exposeX:x y:y width:w height:h
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   163
    "handle an expose event from device; redraw selection
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   164
    "
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   165
    super exposeX:x y:y width:w height:h.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   166
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   167
    selection notNil ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   168
        self selectionDo:[:v | self showSelected:v]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   169
    ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   170
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   171
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   172
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   173
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   174
keyPress:key x:x y:y
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   175
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   176
    key == #InspectIt ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   177
        ^ self inspectSelection
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   178
    ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   179
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   180
    (key == #Delete or:[key == #BackSpace]) ifTrue: [
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   181
        selection notNil ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   182
            self deleteSelection
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   183
        ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   184
    ] ifFalse:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   185
        keyPressAction notNil ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   186
            keyPressAction value:key
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   187
        ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   188
    ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   189
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   190
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   191
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   192
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   193
processEvent:anEvent
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   194
    "catch expose events for components, and redraw its handles after
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   195
     the redraw when this happens
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   196
    "
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   197
    |view|
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   198
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   199
    selection notNil ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   200
        anEvent type == #damage ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   201
            view := anEvent view.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   202
            (selection == view
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   203
            or:[selection isCollection
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   204
                and:[selection includes:view]]) ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   205
                    self showSelected:view
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   206
            ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   207
        ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   208
    ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   209
    ^ false.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   210
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   211
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   212
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   213
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   214
sizeChanged:how
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   215
    self withSelectionHiddenDo:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   216
        super sizeChanged:how
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   217
    ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   218
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   219
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   220
! !
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   221
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   222
!UIObjectView methodsFor:'initialization'!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   223
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   224
initialize
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   225
    super initialize.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   226
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   227
    "funny: since I do not want the created widgets to get pointer
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   228
     events, I put an InputView on top of them, which catches those events
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   229
     and passes them back to me - have to take care, that this inputView
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   230
     is always on top
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   231
    "
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   232
    inputView := InputView origin:0.0@0.0 extent:1.0@1.0 in:self.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   233
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   234
    inputView eventReceiver:self.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   235
    inputView enableButtonEvents.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   236
    inputView enableButtonMotionEvents.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   237
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   238
    self setDefaultActions.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   239
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   240
    undoHistory  := UndoHistory new.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   241
    testMode     := false.
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   242
    clipChildren := true.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   243
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   244
    (self class gridShown) ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   245
        super showGrid
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   246
    ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   247
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   248
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   249
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   250
realize
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   251
    super realize.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   252
    self windowGroup postEventHook:self
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   253
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   254
! !
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   255
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   256
!UIObjectView methodsFor:'misc'!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   257
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   258
cursor:aCursor
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   259
    inputView realized ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   260
        inputView cursor:aCursor
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   261
    ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   262
    super cursor:aCursor
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   263
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   264
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   265
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   266
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   267
invertOutlineOf:anObject
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   268
    |wasClipped delta|
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   269
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   270
    (wasClipped := clipChildren) ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   271
        self clippedByChildren:(clipChildren := false).
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   272
    ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   273
    delta := (anObject originRelativeTo:self) - anObject origin.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   274
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   275
    self xoring:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   276
        self displayRectangle:((anObject origin + delta) extent:anObject extent).
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   277
    ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   278
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   279
    wasClipped ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   280
        self clippedByChildren:(clipChildren := true).
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   281
    ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   282
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   283
    "Modified: 5.9.1995 / 12:25:25 / claus"
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   284
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   285
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   286
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   287
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   288
setDefaultActions
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   289
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   290
    pressAction      := [:pressPoint | self startSelectOrMove:pressPoint].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   291
    shiftPressAction := [:pressPoint | self startSelectMoreOrMove:pressPoint].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   292
    motionAction     := [:movePoint  | nil].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   293
    releaseAction    := [nil].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   294
    keyPressAction   := [:key | self doKeyInput:key].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   295
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   296
    self cursor:Cursor normal.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   297
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   298
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   299
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   300
showDragging:something offset:anOffset
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   301
    "drag around a View"
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   302
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   303
    |top|
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   304
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   305
    self forEach:something do:[:anObject |
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   306
        self drawRectangle:((anObject origin + anOffset) extent:(anObject extent))
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   307
    ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   308
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   309
! !
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   310
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   311
!UIObjectView methodsFor:'object creation'!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   312
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   313
actionCreate:anObject frame:aFrame delta:aDelta
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   314
    "create and initialize action data
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   315
    "
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   316
    |extent x y selectors values|
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   317
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   318
"minimum extent
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   319
"
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   320
    extent := self extent.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   321
    x := extent x // 3.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   322
    y := extent y // 3.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   323
    extent := anObject preferredExtent.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   324
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   325
    (extent x > x) ifTrue:[extent x:x].
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   326
    (extent y > y) ifTrue:[extent y:y].
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   327
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   328
"setup structure
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   329
"
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   330
    selectors := #( object frame delta vertical horizontal minExtent ).
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   331
    values    := Array new:(selectors size).
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   332
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   333
    values at:1 put:anObject.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   334
    values at:2 put:aFrame.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   335
    values at:3 put:aDelta.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   336
    values at:4 put:(self isVerticalResizable:anObject).
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   337
    values at:5 put:(self isHorizontalResizable:anObject).
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   338
    values at:6 put:extent.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   339
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   340
    actionData := Structure newWith:selectors values:values.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   341
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   342
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   343
"can change cursor dependent on vertical/horizontal resizing
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   344
"
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   345
    oldCursor := cursor.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   346
    self cursor:(Cursor leftHand).
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   347
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   348
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   349
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   350
!
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   351
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   352
createWidgetWithClass:aClass
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   353
    "prepare to create new widgets
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   354
    "
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   355
    createClass := aClass.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   356
    pressAction := [:pressPoint | self startCreate:pressPoint].
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   357
    self cursor:Cursor origin.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   358
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   359
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   360
!
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   361
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   362
doDragCreate:aPoint
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   363
    "do a widget create drag
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   364
    "
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   365
    |frame object extent minimum|
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   366
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   367
    frame   := actionData frame.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   368
    frame corner:((self alignToGrid:aPoint) - (actionData delta)).
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   369
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   370
    object  := actionData object.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   371
    minimum := actionData minExtent.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   372
    extent  := frame extent.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   373
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   374
    ((extent x < minimum x) or:[actionData horizontal not]) ifTrue:[
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   375
        extent x:(minimum x)
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   376
    ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   377
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   378
    ((extent y < minimum y) or:[actionData vertical not]) ifTrue:[
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   379
        extent y:(minimum y)
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   380
    ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   381
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   382
    frame extent:extent.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   383
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   384
    self invertOutlineOf:object.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   385
    object origin:(frame origin) extent:(frame extent).
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   386
    self invertOutlineOf:object.
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   387
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   388
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   389
endCreate
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   390
    "end a widget create drag
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   391
    "
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   392
    |layout x y|
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   393
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   394
    self invertOutlineOf:(actionData object).
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   395
    inputView raise.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   396
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   397
    layout := (actionData object) bounds asLayout.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   398
    (actionData object) geometryLayout:layout.
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   399
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   400
    self changed:#tree.
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   401
    self select:(actionData object).
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   402
    actionData := nil.
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   403
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   404
    self setDefaultActions.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   405
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   406
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   407
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   408
setupCreatedObject:anObject
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   409
    self subclassResponsibility
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   410
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   411
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   412
startCreate:aPoint
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   413
    "start a widget create
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   414
    "
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   415
    |widget object start frame delta|
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   416
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   417
    createClass isNil ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   418
        ^ self setDefaultActions
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   419
    ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   420
    (selection isKindOf:Collection) ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   421
        self unselect.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   422
      ^ self setDefaultActions.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   423
    ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   424
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   425
    motionAction  := [:movePoint| self doDragCreate:movePoint].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   426
    releaseAction := [ self endCreate].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   427
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   428
    selection notNil ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   429
        (    (self isPoint:aPoint containedIn:selection)
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   430
         and:[self supportsSubComponents:selection]
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   431
        ) ifFalse:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   432
            self unselect
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   433
        ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   434
    ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   435
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   436
    widget := selection ? self.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   437
    object := createClass new.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   438
    widget addSubView:object.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   439
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   440
    start := self alignToGrid:aPoint.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   441
    delta := widget originRelativeTo:self.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   442
    frame := Rectangle origin:(start - delta) corner:start.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   443
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   444
    object origin:(frame origin).
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   445
    self setupCreatedObject:object.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   446
    object realize.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   447
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   448
    self actionCreate:object frame:frame delta:delta.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   449
    self invertOutlineOf:object.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   450
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   451
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   452
! !
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   453
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   454
!UIObjectView methodsFor:'object moving'!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   455
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   456
doObjectMove:aPoint
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   457
    "move selection
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   458
    "
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   459
    movedObject notNil ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   460
        movedObject keysAndValuesDo:[:nr :aView|
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   461
            self invertOutlineOf:aView.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   462
            self moveObject:aView to:(aPoint - (moveDelta at:nr)).
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   463
            self invertOutlineOf:aView.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   464
        ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   465
    ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   466
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   467
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   468
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   469
endObjectMove
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   470
    "cleanup after object move"
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   471
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   472
    movedObject notNil ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   473
        movedObject do:[:aView|
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   474
            self invertOutlineOf:aView
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   475
        ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   476
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   477
        movedObject do:[:aView|
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   478
            self showSelected:aView
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   479
        ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   480
        movedObject size == 1 ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   481
            selection := movedObject at:1
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   482
        ] ifFalse:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   483
            selection := movedObject
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   484
        ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   485
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   486
        movedObject := nil.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   487
        self setDefaultActions.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   488
        self changed:#layout.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   489
    ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   490
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   491
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   492
moveObject:anObject to:aPoint
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   493
    "move anObject to newOrigin, aPoint
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   494
    "
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   495
    |dX dY org delta|
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   496
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   497
    anObject notNil ifTrue:[
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   498
        org := anObject computeOrigin.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   499
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   500
        delta := aPoint - org.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   501
        delta := (self alignToGrid:aPoint) - org.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   502
        dX := delta x.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   503
        dY := delta y.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   504
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   505
        undoHistory disabledTransitionDo:[
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   506
            self shifLayout:anObject top:dY bottom:dY left:dX right:dX
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   507
        ]
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   508
    ]
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   509
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   510
!
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   511
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   512
startObjectMoveAt:aPoint
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   513
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   514
    self startObjectMove:selection at:aPoint.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   515
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   516
    selection size == 0 ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   517
        movedObject := Array with:selection
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   518
    ] ifFalse:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   519
        movedObject := selection
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   520
    ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   521
    super unselect.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   522
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   523
    moveDelta := movedObject collect:[:aView|
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   524
        aPoint - aView computeOrigin
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   525
    ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   526
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   527
    selection := movedObject.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   528
    self transaction:#move selectionDo:[:aView|
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   529
        self invertOutlineOf:aView.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   530
        self undoBlockPositionChanged:aView
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   531
    ].
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   532
    selection := nil
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   533
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   534
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   535
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   536
startSelectMoreOrMove:aPoint
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   537
    "add/remove to/from selection"
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   538
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   539
    |anObject|
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   540
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   541
    testMode ifTrue:[^ self].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   542
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   543
    anObject := self findObjectAt:aPoint.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   544
    anObject notNil ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   545
        (self isSelected:anObject) ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   546
            self removeFromSelection:anObject
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   547
        ] ifFalse:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   548
            self addToSelection:anObject
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   549
        ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   550
    ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   551
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   552
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   553
startSelectOrMove:aPoint
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   554
    "a button is pressed at a point
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   555
    "
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   556
    |anObject b|
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   557
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   558
    testMode ifTrue:[^ self].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   559
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   560
    "if there is one selection and point hits handle, start a resize
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   561
    "
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   562
    self singleSelection notNil ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   563
        b := self whichHandleOf:selection isHitBy:aPoint.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   564
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   565
        (b notNil and:[b ~~ #view]) ifTrue:[
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   566
            ^ self startResizeBorder:b of:selection.
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   567
        ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   568
    ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   569
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   570
    anObject := self findObjectAt:aPoint.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   571
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   572
    "nothing is selected
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   573
    "
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   574
    anObject isNil ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   575
        ^ self unselect
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   576
    ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   577
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   578
    (self isSelected:anObject) ifFalse:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   579
        super unselect.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   580
        self select:anObject.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   581
    ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   582
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   583
    selection isCollection ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   584
        releaseAction := [
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   585
            self setDefaultActions.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   586
            self select:anObject
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   587
        ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   588
    ] ifFalse:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   589
        releaseAction := [self setDefaultActions]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   590
    ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   591
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   592
    "prepare move operation for an object
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   593
    "
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   594
    motionAction := [:movePoint|
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   595
        (aPoint dist:movePoint) > 4.0 ifTrue:[
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   596
            self startObjectMoveAt:aPoint
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   597
        ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   598
    ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   599
! !
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   600
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   601
!UIObjectView methodsFor:'object resize'!
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   602
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   603
actionResize:anObject selector:aSelector
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   604
    "create and initialize action for resize
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   605
    "
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   606
    |selector delta|
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   607
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   608
    delta    := anObject container originRelativeTo:self.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   609
    selector := ('resize:', aSelector, ':') asSymbol.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   610
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   611
    actionData := Structure with:(#object->anObject)
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   612
                            with:(#selector->selector)
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   613
                            with:(#delta->delta).
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   614
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   615
"can change cursor dependent on vertical/horizontal resizing
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   616
"
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   617
    oldCursor := cursor.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   618
    self cursor:(Cursor leftHand).
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   619
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   620
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   621
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   622
!
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   623
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   624
doDragResize:aPoint
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   625
    "do a widget resize drag"
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   626
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   627
    |p object|
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   628
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   629
    object := actionData object.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   630
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   631
    self invertOutlineOf:object.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   632
    p := (self alignToGrid:aPoint) - (actionData delta).
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   633
    self perform:(actionData selector) with:object with:p.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   634
    object geometryLayout:(object geometryLayout).
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   635
    self invertOutlineOf:object
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   636
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   637
!
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   638
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   639
endResize
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   640
    "cleanup after object resize"
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   641
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   642
    self invertOutlineOf:(actionData object).
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   643
    self setDefaultActions.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   644
    self select:(actionData object).
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   645
    actionData := nil
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   646
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   647
    "Modified: 5.9.1995 / 17:11:17 / claus"
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   648
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   649
!
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   650
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   651
startResizeBorder:b of:selection
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   652
    "resize selected view
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   653
    "
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   654
    |object|
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   655
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   656
    object := self singleSelection.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   657
    self actionResize:object selector:b.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   658
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   659
    self transaction:#extent selectionDo:[:aView|
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   660
        self undoBlockDimensionChanged:aView
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   661
    ].
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   662
    super unselect.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   663
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   664
    motionAction  := [:movePoint | self doDragResize:movePoint].
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   665
    releaseAction := [self endResize].
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   666
    self invertOutlineOf:object
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   667
! !
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   668
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   669
!UIObjectView methodsFor:'private handles'!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   670
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   671
handlesOf:aComponent do:aBlock
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   672
    |delta layout vertical horizontal|
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   673
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   674
    layout := aComponent geometryLayout.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   675
    delta  := (aComponent originRelativeTo:self) - aComponent origin.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   676
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   677
    (layout isLayout not or:[layout isLayoutFrame]) ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   678
        vertical   := self isVerticalResizable:aComponent.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   679
        horizontal := self isHorizontalResizable:aComponent.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   680
    ] ifFalse:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   681
        vertical   := false.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   682
        horizontal := false.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   683
    ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   684
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   685
    horizontal ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   686
        aBlock value:(aComponent leftCenter   + delta) value:#left.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   687
        aBlock value:(aComponent rightCenter  + delta) value:#right.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   688
    ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   689
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   690
    vertical ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   691
        aBlock value:(aComponent topCenter    + delta) value:#top.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   692
        aBlock value:(aComponent bottomCenter + delta) value:#bottom.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   693
    ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   694
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   695
    (horizontal and:[vertical]) ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   696
        aBlock value:(aComponent origin     + delta) value:#origin.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   697
        aBlock value:(aComponent corner     + delta) value:#corner.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   698
        aBlock value:(aComponent topRight   + delta) value:#topRight.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   699
        aBlock value:(aComponent bottomLeft + delta) value:#bottomLeft.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   700
    ] ifFalse:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   701
        aBlock value:(aComponent origin     + delta) value:#view.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   702
        aBlock value:(aComponent corner     + delta) value:#view.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   703
        aBlock value:(aComponent topRight   + delta) value:#view.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   704
        aBlock value:(aComponent bottomLeft + delta) value:#view.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   705
    ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   706
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   707
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   708
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   709
showSelected:aComponent
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   710
    |wasClipped delta oldPaint|
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   711
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   712
    self paint:Color black.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   713
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   714
    (wasClipped := clipChildren) ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   715
        self clippedByChildren:(clipChildren := false). 
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   716
    ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   717
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   718
    self handlesOf:aComponent do:[:pnt :what |
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   719
        what == #view ifTrue:[self displayRectangle:(pnt - (4@4) extent:7@7)]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   720
                     ifFalse:[self    fillRectangle:(pnt - (4@4) extent:7@7)]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   721
    ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   722
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   723
    wasClipped ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   724
        self clippedByChildren:(clipChildren := true).
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   725
    ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   726
    self paint:oldPaint.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   727
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   728
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   729
showUnselected:aComponent
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   730
    |wasClipped delta r oldPaint|
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   731
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   732
    r := aComponent origin extent:8@8.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   733
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   734
    (wasClipped := clipChildren) ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   735
        self clippedByChildren:(clipChildren := false). 
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   736
    ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   737
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   738
    self handlesOf:aComponent do:[:pnt :what |
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   739
        self clearRectangle:(pnt - (4@4) extent:7@7).
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   740
    ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   741
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   742
    wasClipped ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   743
        self clippedByChildren:(clipChildren := true). 
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   744
    ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   745
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   746
    "/ must redraw all components which are affected b the handles
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   747
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   748
    r := (aComponent originRelativeTo:self) - (4@4)
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   749
             extent:(aComponent extent + (4@4)).
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   750
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   751
    subViews do:[:anotherComponent |
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   752
        |absOrg absFrame|
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   753
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   754
        anotherComponent ~~ inputView ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   755
            absOrg := anotherComponent originRelativeTo:self.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   756
            absFrame := absOrg extent:(anotherComponent extent).
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   757
            (absFrame intersects:r) ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   758
                anotherComponent withAllSubViewsDo:[:v |
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   759
                    v clear.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   760
                    v exposeX:0 y:0 width:9999 height:9999.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   761
                ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   762
            ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   763
        ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   764
    ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   765
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   766
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   767
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   768
whichHandleOf:aView isHitBy:aPoint
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   769
    |bounds|
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   770
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   771
    self handlesOf:aView do:[:pnt :what |
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   772
        ((pnt - (4@4) extent:7@7) containsPoint:aPoint) ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   773
            ^ what
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   774
        ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   775
    ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   776
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   777
    ^ nil
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   778
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   779
    "Modified: 5.9.1995 / 14:39:34 / claus"
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   780
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   781
! !
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   782
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   783
!UIObjectView methodsFor:'private resizing-subviews'!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   784
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   785
resize:aView bottom:aPoint
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   786
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   787
    undoHistory disabledTransitionDo:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   788
        self shifLayout:aView top:0 bottom:((aPoint y) - (aView computeCorner y))
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   789
    ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   790
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   791
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   792
resize:aView bottomLeft:aPoint
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   793
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   794
    undoHistory disabledTransitionDo:[
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   795
        self shifLayout:aView top:0
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   796
                           bottom:((aPoint y) - (aView computeCorner y))
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   797
                             left:((aPoint x) - (aView computeOrigin x))
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   798
                            right:0
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   799
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   800
    ]
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   801
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   802
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   803
!
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   804
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   805
resize:aView corner:aPoint
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   806
    |delta|
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   807
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   808
    delta := aPoint - aView computeCorner.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   809
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   810
    undoHistory disabledTransitionDo:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   811
        self shifLayout:aView top:0 bottom:(delta y) left:0 right:(delta x)
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   812
    ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   813
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   814
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   815
resize:aView left:aPoint
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   816
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   817
    undoHistory disabledTransitionDo:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   818
        self shifLayout:aView left:((aPoint x) - (aView computeOrigin x)) right:0
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   819
    ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   820
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   821
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   822
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   823
resize:aView origin:aPoint
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   824
    |delta|
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   825
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   826
    delta := aPoint - aView computeOrigin.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   827
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   828
    undoHistory disabledTransitionDo:[
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   829
        self shifLayout:aView top:(delta y) bottom:0 left:(delta x) right:0
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   830
    ]
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   831
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   832
!
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   833
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   834
resize:aView right:aPoint
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   835
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   836
    undoHistory disabledTransitionDo:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   837
        self shifLayout:aView left:0 right:((aPoint x) - (aView computeCorner x))
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   838
    ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   839
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   840
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   841
resize:aView top:aPoint
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   842
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   843
    undoHistory disabledTransitionDo:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   844
        self shifLayout:aView top:((aPoint y) - (aView computeOrigin y)) bottom:0
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   845
    ]
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   846
!
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   847
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   848
resize:aView topRight:aPoint
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   849
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   850
    undoHistory disabledTransitionDo:[
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   851
        self shifLayout:aView top:((aPoint y) - (aView computeOrigin y))
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   852
                           bottom:0
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   853
                             left:0
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   854
                            right:((aPoint x) - (aView computeCorner x))
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   855
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   856
    ]
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   857
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   858
! !
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   859
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   860
!UIObjectView methodsFor:'private shift-layout'!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   861
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   862
shifLayout:aView left:l right:r
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   863
    "shift layout for a view; in case of an open transaction, the undo
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   864
     action is registered
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   865
    "
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   866
    self shifLayout:aView top:0 bottom:0 left:l right:r
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   867
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   868
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   869
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   870
shifLayout:aView top:t bottom:b
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   871
    "shift layout for a view; in case of an open transaction, the undo
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   872
     action is registered
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   873
    "
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   874
    self shifLayout:aView top:t bottom:b left:0 right:0
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   875
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   876
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   877
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   878
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   879
shifLayout:aView top:t bottom:b left:l right:r
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   880
    "shift layout for a view; in case of an open transaction, the undo
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
   881
     action is registered
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   882
    "
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   883
    |layout|
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   884
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   885
    self undoBlockPositionChanged:aView.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   886
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   887
    layout := aView geometryLayout.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   888
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   889
    layout leftOffset:(layout leftOffset + l)
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   890
            topOffset:(layout topOffset  + t).
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   891
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   892
    layout isLayoutFrame ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   893
        layout bottomOffset:(layout bottomOffset + b).
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   894
        layout  rightOffset:(layout rightOffset  + r).
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   895
    ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   896
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   897
    aView geometryLayout:layout.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   898
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   899
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   900
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   901
! !
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   902
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   903
!UIObjectView methodsFor:'searching'!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   904
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   905
findObjectAt:aPoint
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   906
    "find the origin/corner of the currentWidget
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   907
    "
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   908
    |view viewId lastId point|
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   909
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   910
    viewId := rootView id.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   911
    point  := aPoint + (device translatePoint:0@0 from:(self id) to:viewId).
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   912
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   913
    inputView lower.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   914
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   915
    [viewId notNil] whileTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   916
        lastId := viewId.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   917
        viewId := device viewIdFromPoint:point in:lastId
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   918
    ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   919
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   920
    inputView raise.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   921
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   922
    view := device viewFromId:lastId.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   923
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   924
    view ~~ inputView ifTrue:[^ view]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   925
                     ifFalse:[^ nil]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   926
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   927
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   928
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   929
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   930
isPoint:aPoint containedIn:aView
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   931
    "checks whether a point is covered by a view.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   932
    "
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   933
    |org ext|
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   934
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   935
    org := aView computeOrigin.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   936
    ext := aView computeExtent.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   937
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   938
    ^ ((org extent:ext) containsPoint:aPoint)
47
5e4319953a0b *** empty log message ***
ca
parents: 44
diff changeset
   939
!
5e4319953a0b *** empty log message ***
ca
parents: 44
diff changeset
   940
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   941
whichBorderOf:aView isHitBy:aPoint
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   942
    |p r bw org|
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   943
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   944
    bw := aView borderWidth.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   945
    p := aPoint - (aView superView originRelativeTo:self).
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   946
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   947
    r := Rectangle origin:(aView origin)
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   948
                   extent:(aView width @ bw).
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   949
    (r containsPoint:p) ifTrue:[^ #top:].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   950
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   951
    r origin:(aView left @ (aView bottom + bw)) extent:(aView width @ bw).
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   952
    (r containsPoint:p) ifTrue:[^ #bottom:].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   953
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   954
    r top:(aView top).
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   955
    r extent:(bw @ aView height).
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   956
    (r containsPoint:p) ifTrue:[^ #left:].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   957
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   958
    r origin:((aView right + bw) @ aView top).
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   959
    (r containsPoint:p) ifTrue:[^ #right:].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   960
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   961
    ^ nil
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   962
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   963
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   964
! !
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   965
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   966
!UIObjectView methodsFor:'selections'!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   967
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   968
addToSelection:something
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   969
    (testMode or:[something == selection]) ifFalse:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   970
        super addToSelection:something.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   971
        self changed:#selection.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   972
    ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   973
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   974
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   975
inspectSelection
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   976
    self singleSelectionDo:[:aView |
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   977
        aView inspect
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   978
    ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   979
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   980
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   981
removeFromSelection:something
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   982
    super removeFromSelection:something.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   983
    self changed:#selection
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   984
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   985
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   986
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   987
select:something
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   988
    (testMode or:[something == selection]) ifFalse:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   989
        super select:something.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   990
        self changed:#selection
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   991
    ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   992
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   993
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   994
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   995
selection
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   996
    ^ selection
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   997
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   998
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
   999
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1000
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1001
selectionFindMinimum:aOneArgBlock
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1002
    "returns the minimum value from the block evaluated on each view
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1003
     in the selection
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1004
    "
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1005
    |min val|
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1006
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1007
    self selectionDo:[:aView|
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1008
        val := aOneArgBlock value:aView.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1009
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1010
        min isNil ifTrue:[min := val]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1011
                 ifFalse:[min := min min:val]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1012
    ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1013
    ^ min
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1014
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1015
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1016
selectionHiddenDo:aBlock
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1017
    "apply block to every object in selection"
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1018
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1019
    self selectionDo:[:aView |
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1020
        self showUnselected:aView.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1021
    ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1022
    device flush.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1023
    aBlock value.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1024
    self selectionDo:[:aView |
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1025
        self showSelected:aView
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1026
    ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1027
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1028
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1029
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1030
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1031
singleSelection
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1032
    "returns single selection or nil
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1033
    "
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1034
    (selection isKindOf:SimpleView) ifTrue:[^ selection]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1035
                                   ifFalse:[^ nil]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1036
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1037
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1038
singleSelectionDo:aBlock
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1039
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1040
    self singleSelection notNil ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1041
        aBlock value:selection
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1042
    ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1043
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1044
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1045
unselect
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1046
    selection notNil ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1047
        super unselect.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1048
        self changed:#selection
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1049
    ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1050
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1051
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1052
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1053
withSelectionHiddenDo:aBlock
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1054
    "evaluate aBlock while selection is hidden"
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1055
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1056
    |sel|
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1057
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1058
    selection isNil ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1059
        aBlock value
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1060
    ] ifFalse:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1061
        sel := selection.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1062
        super unselect.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1063
        aBlock value.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1064
        super select:sel
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1065
    ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1066
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1067
    "Modified: 6.9.1995 / 01:46:16 / claus"
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1068
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1069
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1070
! !
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1071
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1072
!UIObjectView methodsFor:'testing'!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1073
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1074
canMove:something
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1075
    ^ true
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1076
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1077
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1078
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1079
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1080
isHorizontalResizable:aComponent
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1081
    ^ self subclassResponsibility
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1082
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1083
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1084
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1085
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1086
isVerticalResizable:aComponent
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1087
    ^ self subclassResponsibility
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1088
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1089
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1090
!
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1091
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1092
supportsSubComponents:something
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1093
    "returns true if somrthing supports subcomponents
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1094
    "
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1095
    |specClass|
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1096
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1097
    something notNil ifTrue:[
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1098
        something isCollection ifFalse:[
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1099
            specClass := something specClass
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1100
        ] ifTrue:[
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1101
            something size == 1 ifTrue:[
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1102
                specClass := (something at:1) specClass
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1103
            ]
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1104
        ].
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1105
        specClass notNil ifTrue:[
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1106
            ^ specClass basicNew supportsSubComponents
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1107
        ]
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1108
    ].
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1109
    ^ false
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1110
! !
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1111
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1112
!UIObjectView methodsFor:'transaction & undo'!
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1113
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1114
transaction:aType objects:something do:aOneArgBlock
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1115
    "opens a transaction and evaluates a block within the transaction; the
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1116
     argument to the block is a view from derived from something
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1117
    "
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1118
    self subclassResponsibility
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1119
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1120
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1121
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1122
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1123
transaction:aType selectionDo:aOneArgBlock
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1124
    "opens a transaction and evaluates a block within the transaction; the
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1125
     argument to the block is a view from the selection
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1126
    "
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1127
    self transaction:aType objects:selection do:aOneArgBlock
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1128
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1129
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1130
!
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1131
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1132
undoBlockDimensionChanged:aView
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1133
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1134
    undoHistory isTransactionOpen ifTrue:[
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1135
        |layout|
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1136
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1137
        layout := aView geometryLayout copy.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1138
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1139
        undoHistory addUndoBlock:[
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1140
            aView geometryLayout:layout.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1141
            aView superView sizeChanged:nil.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1142
        ]
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1143
    ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1144
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1145
!
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1146
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1147
undoBlockPositionChanged:aView
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1148
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1149
    undoHistory isTransactionOpen ifTrue:[
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1150
        |layout|
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1151
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1152
        layout := aView geometryLayout copy.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1153
        undoHistory addUndoBlock:[aView geometryLayout:layout]
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1154
    ]
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1155
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1156
!
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1157
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1158
undoLast
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1159
    self undoLast:1
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1160
!
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1161
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1162
undoLast:n
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1163
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1164
    self unselect.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1165
    undoHistory undoLast:n.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1166
    self changed:#tree
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1167
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1168
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1169
! !
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1170
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1171
!UIObjectView methodsFor:'user actions - dimension'!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1172
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1173
copyExtent
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1174
    (selection isNil or:[selection isKindOf:Collection]) ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1175
        ^ self warn:'exactly one element must be selected'.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1176
    ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1177
    copiedExtent := selection computeExtent
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1178
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1179
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1180
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1181
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1182
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1183
pasteExtent
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1184
    copiedExtent notNil ifTrue:[
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1185
        self transition:#extent dimensionDo:[:v|
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1186
            self resize:v corner:(v computeOrigin + copiedExtent)
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1187
        ]    
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1188
    ]    
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1189
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1190
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1191
pasteHeight
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1192
    copiedExtent notNil ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1193
        self transition:'paste height' dimensionDo:[:v|
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1194
            self resize:v bottom:(v computeOrigin + copiedExtent)
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1195
        ]    
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1196
    ]    
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1197
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1198
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1199
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1200
pasteWidth
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1201
    copiedExtent notNil ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1202
        self transition:'paste width' dimensionDo:[:v|
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1203
            self resize:v right:(v computeOrigin + copiedExtent)
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1204
        ]    
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1205
    ]    
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1206
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1207
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1208
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1209
setDimension:aLayout
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1210
    |type|
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1211
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1212
    aLayout isLayout ifTrue:[
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1213
        aLayout isLayoutFrame ifTrue:[
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1214
            type := #layoutFrame
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1215
        ] ifFalse:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1216
            aLayout isAlignmentOrigin ifTrue:[
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1217
                type := #layoutAlignOrigin.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1218
            ] ifFalse:[
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1219
                type := #layoutOrigin
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1220
            ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1221
        ]
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1222
    ] ifFalse:[
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1223
        type := #layout
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1224
    ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1225
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1226
    self transition:type dimensionDo:[:v| v geometryLayout:(aLayout copy)]    
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1227
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1228
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1229
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1230
setToDefaultExtent
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1231
    self transition:#extent dimensionDo:[:v|
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1232
        self resize:v corner:(v computeOrigin + (v preferredExtent))
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1233
    ]    
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1234
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1235
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1236
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1237
setToDefaultHeight
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1238
    self transition:'default height' dimensionDo:[:v|
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1239
        self resize:v bottom:(v computeOrigin + (v preferredExtent))
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1240
    ]    
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1241
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1242
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1243
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1244
setToDefaultWidth
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1245
    self transition:'default width' dimensionDo:[:v|
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1246
        self resize:v right:(v computeOrigin + (v preferredExtent))
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1247
    ]    
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1248
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1249
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1250
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1251
transition:aType dimensionDo:aOneArgBlock
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1252
    "change dimension within a transaction for the selected elements by evaluating
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1253
     the block with the argument a view.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1254
    "
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1255
    self selectionHiddenDo:[
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1256
        self transaction:aType selectionDo:[:aView|
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1257
            self undoBlockDimensionChanged:aView.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1258
            aOneArgBlock value:aView.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1259
            aView superView sizeChanged:nil
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1260
        ].
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1261
        self changed:#layout
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1262
    ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1263
! !
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1264
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1265
!UIObjectView methodsFor:'user actions - move'!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1266
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1267
basicMoveSelectionHorizontal:n
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1268
    "move left:  n < 0
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1269
     move right: n > 0
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1270
    "
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1271
    self selectionHiddenDo:[
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1272
        self transaction:#move selectionDo:[:v| self shifLayout:v left:n right:n].
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1273
        self changed:#layout
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1274
    ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1275
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1276
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1277
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1278
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1279
basicMoveSelectionVertical:n
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1280
    "move up:   n < 0
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1281
     move down: n > 0
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1282
    "
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1283
    self selectionHiddenDo:[
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1284
        self transaction:#move selectionDo:[:v| self shifLayout:v top:n bottom:n ].
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1285
        self changed:#layout
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1286
    ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1287
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1288
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1289
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1290
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1291
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1292
moveSelectionDown
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1293
    self moveSelectionDown:1
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1294
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1295
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1296
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1297
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1298
moveSelectionDown10
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1299
    self moveSelectionDown:10
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1300
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1301
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1302
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1303
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1304
moveSelectionDown:n
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1305
    self basicMoveSelectionVertical:n
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1306
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1307
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1308
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1309
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1310
moveSelectionLeft
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1311
    self moveSelectionLeft:1
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1312
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1313
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1314
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1315
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1316
moveSelectionLeft10
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1317
    self moveSelectionLeft:10
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1318
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1319
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1320
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1321
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1322
moveSelectionLeft:n
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1323
    self basicMoveSelectionHorizontal:(n negated)
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1324
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1325
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1326
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1327
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1328
moveSelectionRight
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1329
    self moveSelectionRight:1
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1330
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1331
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1332
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1333
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1334
moveSelectionRight10
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1335
    self moveSelectionRight:10
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1336
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1337
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1338
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1339
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1340
moveSelectionRight:n
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1341
    self basicMoveSelectionHorizontal:n
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1342
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1343
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1344
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1345
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1346
moveSelectionUp
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1347
    self moveSelectionUp:1
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1348
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1349
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1350
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1351
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1352
moveSelectionUp10
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1353
    self moveSelectionUp:10
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1354
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1355
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1356
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1357
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1358
moveSelectionUp:n
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1359
    self basicMoveSelectionVertical:(n negated)
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1360
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1361
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1362
! !
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1363
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1364
!UIObjectView methodsFor:'user actions - position'!
44
cb65ce16c150 intitial checkin
ca
parents:
diff changeset
  1365
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1366
alignSelectionBottom
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1367
    |bmost delta|
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1368
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1369
    self selectionHiddenDo:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1370
        bmost := 0.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1371
        self selectionDo:[:v| bmost := bmost max:(v computeCorner y)].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1372
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1373
        self transaction:#align selectionDo:[:v|
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1374
            (delta := bmost - (v computeCorner y)) ~~ 0 ifTrue:[
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1375
                self shifLayout:v top:delta bottom:delta.
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1376
            ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1377
        ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1378
        self changed:#layout
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1379
    ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1380
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1381
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1382
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1383
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1384
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1385
alignSelectionCenterHor
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1386
    |counter centerX|
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1387
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1388
    self selectionHiddenDo:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1389
        counter := 0.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1390
        centerX := 0.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1391
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1392
        self selectionDo:[:v |
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1393
            centerX := centerX + (v computeCorner x + v computeOrigin x).
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1394
            counter := counter + 1.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1395
        ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1396
        centerX := centerX // (counter * 2).
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1397
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1398
        self transaction:#align selectionDo:[:v|
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1399
            |newX oldX delta|
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1400
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1401
            oldX  := v computeOrigin x.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1402
            newX  := centerX - ((v computeCorner x - oldX) // 2).
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1403
            delta := newX - oldX.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1404
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1405
            self shifLayout:v left:delta right:delta
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1406
        ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1407
        self changed:#layout
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1408
    ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1409
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1410
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1411
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1412
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1413
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1414
alignSelectionCenterVer
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1415
    |counter centerY|
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1416
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1417
    self selectionHiddenDo:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1418
        counter := 0.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1419
        centerY := 0.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1420
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1421
        self selectionDo:[:v |
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1422
            centerY := centerY + (v computeCorner y + v computeOrigin y).
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1423
            counter := counter + 1.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1424
        ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1425
        centerY := centerY // (counter * 2).
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1426
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1427
        self transaction:#align selectionDo:[:v|
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1428
            |newY oldY delta|
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1429
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1430
            oldY  := v computeOrigin y.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1431
            newY  := centerY - ((v computeCorner y - oldY) // 2).
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1432
            delta := newY - oldY.
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1433
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1434
            self shifLayout:v top:delta bottom:delta
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1435
        ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1436
        self changed:#layout
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1437
    ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1438
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1439
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1440
alignSelectionLeft
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1441
    |lmost delta|
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1442
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1443
    self selectionHiddenDo:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1444
        lmost := self selectionFindMinimum:[:v| v computeOrigin x].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1445
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1446
        self transaction:#align selectionDo:[:v|
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1447
            (delta := lmost - (v computeOrigin x)) ~~ 0 ifTrue:[
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1448
                self shifLayout:v left:delta right:delta
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1449
            ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1450
        ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1451
        self changed:#layout
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1452
    ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1453
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1454
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1455
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1456
alignSelectionLeftAndRight
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1457
    |lmost rmost|
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1458
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1459
    self selectionHiddenDo:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1460
        lmost := self selectionFindMinimum:[:v| v computeOrigin x].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1461
        rmost := 0.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1462
        self selectionDo:[:v | rmost := rmost max:(v computeCorner x)].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1463
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1464
        self transaction:#align selectionDo:[:v|
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1465
            self shifLayout:v left:(lmost - (v computeOrigin x))
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1466
                             right:(rmost - (v computeCorner x))
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1467
        ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1468
        self changed:#layout
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1469
    ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1470
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1471
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1472
alignSelectionRight
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1473
    |rmost delta|
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1474
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1475
    self selectionHiddenDo:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1476
        rmost := 0.
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1477
        self selectionDo:[:v| rmost := rmost max:(v computeCorner x)].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1478
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1479
        self transaction:#align selectionDo:[:v|
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1480
            (delta := rmost - (v computeCorner x)) ~~ 0 ifTrue:[
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1481
                self shifLayout:v left:delta right:delta
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1482
            ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1483
        ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1484
        self changed:#layout
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1485
    ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1486
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1487
!
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1488
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1489
alignSelectionTop
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1490
    |tmost delta|
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1491
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1492
    self selectionHiddenDo:[
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1493
        tmost := self selectionFindMinimum:[:v| v computeOrigin y].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1494
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1495
        self transaction:#align selectionDo:[:v|
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1496
            (delta := tmost - (v computeOrigin y)) ~~ 0 ifTrue:[
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
  1497
                self shifLayout:v top:delta bottom:delta
51
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1498
            ]
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1499
        ].
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1500
        self changed:#layout
01d0c9394944 *** empty log message ***
ca
parents: 50
diff changeset
  1501
    ]