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