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