UIObjectView.st
author Claus Gittinger <cg@exept.de>
Tue, 08 Apr 1997 00:47:25 +0200
changeset 95 c20189d75ec3
parent 91 86d0c649f95e
child 96 73725336b4fe
permissions -rw-r--r--
*** empty log message ***
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
     1
ObjectView subclass:#UIObjectView
89
35c5711729c2 so far so good
ca
parents: 84
diff changeset
     2
	instanceVariableNames:'inputView testMode undoHistory copiedExtent copiedLayout
35c5711729c2 so far so good
ca
parents: 84
diff changeset
     3
		actionData createClass clipChildren selectionHiddenLevel
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
     4
		setOfSuperViewsSizeChanged'
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
     5
	classVariableNames:''
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
     6
	poolDictionaries:''
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
     7
	category:'Interface-UIPainter'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
     8
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
     9
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    10
Object subclass:#UndoHistory
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    11
	instanceVariableNames:'history transaction enabled'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    12
	classVariableNames:''
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    13
	poolDictionaries:''
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    14
	privateIn:UIObjectView
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    15
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    16
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
    17
Object subclass:#Transaction
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
    18
	instanceVariableNames:'type text actions'
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
    19
	classVariableNames:''
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
    20
	poolDictionaries:''
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
    21
	privateIn:UIObjectView::UndoHistory
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
    22
!
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
    23
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    24
63
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
    25
!UIObjectView class methodsFor:'conversion'!
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
    26
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
    27
asLayoutFrameFromView:aView
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
    28
    "convert layout from aView to a frameLayout. On success the frameLayout is
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
    29
     returned otherwise nil
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
    30
    "
68
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    31
    |lF lO rF rO tF tO bF bO type layout newLyt|
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    32
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    33
    type   := self layoutType:aView.
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    34
    layout := aView geometryLayout.
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    35
91
86d0c649f95e extent -> layout
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
    36
    layout isNil ifTrue:[
86d0c649f95e extent -> layout
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
    37
        type == #Extent ifTrue:[
86d0c649f95e extent -> layout
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
    38
            layout := aView bounds asLayout
86d0c649f95e extent -> layout
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
    39
        ]
86d0c649f95e extent -> layout
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
    40
    ].
86d0c649f95e extent -> layout
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
    41
68
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    42
    (type isNil or:[layout isNil]) ifTrue:[
63
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
    43
        ^ nil
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
    44
    ].
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
    45
68
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    46
    type == #LayoutFrame ifTrue:[
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    47
        ^ layout copy
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    48
    ].
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    49
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    50
    layout isLayout ifFalse:[
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    51
        type == #Rectangle ifTrue:[
63
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
    52
            lO := layout left.
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
    53
            tO := layout top.
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
    54
            rO := layout right.
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
    55
            bO := layout bottom.
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
    56
        ] ifFalse:[
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
    57
            lO := layout x.
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
    58
            tO := layout y.
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
    59
            rO := lO + aView extent x.
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
    60
            bO := tO + aView extent y.
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
    61
        ].
68
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    62
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    63
        ^ LayoutFrame leftFraction:0 offset:lO  rightFraction:0 offset:rO
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    64
                       topFraction:0 offset:tO bottomFraction:0 offset:bO
63
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
    65
    ].
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
    66
68
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    67
    lF := layout leftFraction.
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    68
    lO := layout leftOffset.
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    69
    tF := layout topFraction.
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    70
    tO := layout topOffset.
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    71
    bF := tF.
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    72
    bO := tO + aView extent y.
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    73
    rF := lF.
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    74
    rO := lO + aView extent x.
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    75
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    76
    newLyt := LayoutFrame leftFraction:lF offset:lO  rightFraction:rF offset:rO
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    77
                           topFraction:tF offset:tO bottomFraction:bF offset:bO.
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    78
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    79
    (    (type == #AlignmentOrigin)
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    80
     and:[layout leftAlignmentFraction ~~ 0
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    81
      or:[layout topAlignmentFraction  ~~ 0]]
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    82
    ) ifTrue:[
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    83
        |svRc prBd dlta|
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    84
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    85
        svRc := aView superView viewRectangle.
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    86
        prBd := aView preferredBounds.
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    87
        dlta := (  ((layout rectangleRelativeTo:svRc preferred:prBd) corner)
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    88
                 - ((newLyt rectangleRelativeTo:svRc preferred:prBd) corner)
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    89
                ) rounded.
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    90
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    91
        newLyt leftOffset:(lO + dlta x).
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    92
        newLyt rightOffset:(rO + dlta x).
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    93
        newLyt topOffset:(tO + dlta y).
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    94
        newLyt bottomOffset:(bO + dlta y).
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    95
    ].
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    96
  ^ newLyt.
91
86d0c649f95e extent -> layout
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
    97
86d0c649f95e extent -> layout
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
    98
    "Modified: 28.3.1997 / 19:52:48 / cg"
63
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
    99
! !
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
   100
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   101
!UIObjectView class methodsFor:'defaults'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   102
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   103
defaultGrid
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   104
    ^ 4 @ 4
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   105
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   106
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   107
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   108
gridShown
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   109
    ^ false
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   110
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   111
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   112
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   113
handleSize
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   114
    "size of blob drawn for handles"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   115
    ^ 4
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   116
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   117
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   118
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   119
hitDelta
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   120
    ^ 4
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   121
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   122
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   123
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   124
!UIObjectView class methodsFor:'queries'!
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   125
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   126
layoutType:aView
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   127
    "returns layout type of aView or nil
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   128
    "
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   129
    |layout spec|
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   130
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   131
    layout := aView geometryLayout.
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   132
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   133
    layout notNil ifTrue:[
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   134
        layout isLayout ifTrue:[
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   135
            layout isLayoutFrame        ifTrue:[ ^ #LayoutFrame ].
67
09e9d4b57142 alignmentLayout
Claus Gittinger <cg@exept.de>
parents: 63
diff changeset
   136
            layout isAlignmentOrigin    ifTrue:[ ^ #AlignmentOrigin ].
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   137
            layout isLayoutOrigin       ifTrue:[ ^ #LayoutOrigin ].
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   138
        ] ifFalse:[
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   139
            layout isRectangle          ifTrue:[ ^ #Rectangle ].
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   140
            layout isPoint              ifTrue:[ ^ #Point ].
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   141
        ]
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   142
    ] ifFalse:[
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   143
        spec := aView superView specClass.
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   144
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   145
        spec canResizeSubComponents     ifTrue:[ ^ #Extent ].
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   146
    ].
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   147
    ^ nil
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   148
67
09e9d4b57142 alignmentLayout
Claus Gittinger <cg@exept.de>
parents: 63
diff changeset
   149
    "Modified: 28.2.1997 / 13:02:16 / cg"
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   150
! !
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   151
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   152
!UIObjectView methodsFor:'accessing'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   153
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   154
gridAlign
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   155
    "returns state of aligning to grid
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   156
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   157
    ^ aligning
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   158
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   159
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   160
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   161
gridAlign:aBool
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   162
    "change state of aligning to grid
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   163
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   164
    aBool ifTrue:[self alignOn]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   165
         ifFalse:[self alignOff]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   166
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   167
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   168
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   169
gridParameters
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   170
    "used by defineGrid, and in a separate method for
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   171
     easier redefinition in subclasses. 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   172
     Returns the grid parameters in an array of 7 elements,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   173
     which control the appearance of the grid-pattern.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   174
     the elements are:
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   175
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   176
        bigStepH        number of pixels horizontally between 2 major steps
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   177
        bigStepV        number of pixels vertically between 2 major steps
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   178
        littleStepH     number of pixels horizontally between 2 minor steps
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   179
        littleStepV     number of pixels vertically between 2 minor steps
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   180
        gridAlignH      number of pixels for horizontal grid align (pointer snap)
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   181
        gridAlignV      number of pixels for vertical grid align (pointer snap)
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   182
        docBounds       true, if document boundary should be shown
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   183
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   184
     if littleStepH/V are nil, only bigSteps are drawn.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   185
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   186
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   187
    ^ #(10 10 nil nil 10 10 false)
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   188
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   189
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   190
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   191
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   192
gridShown:aBool
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   193
    "change visibility of grid
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   194
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   195
    aBool ifTrue:[self showGrid]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   196
         ifFalse:[self hideGrid]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   197
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   198
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   199
hideGrid
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   200
    "hide grid
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   201
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   202
    gridShown ifTrue:[
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   203
        self withSelectionHiddenDo:[super hideGrid]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   204
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   205
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   206
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   207
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   208
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   209
showGrid
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   210
    "show grid
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   211
    "
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   212
    self withSelectionHiddenDo:[super showGrid]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   213
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   214
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   215
testMode
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   216
    "returns true if running test
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   217
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   218
    ^ testMode
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   219
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   220
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   221
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   222
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   223
testMode:aBoolean
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   224
    "change test mode
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   225
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   226
    (aBoolean == testMode) ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   227
        testMode := aBoolean.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   228
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   229
        testMode ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   230
            self unselect.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   231
            inputView unrealize
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   232
        ] ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   233
            inputView raise.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   234
            inputView realize
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   235
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   236
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   237
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   238
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   239
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   240
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   241
!UIObjectView methodsFor:'blocked'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   242
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   243
addObject:anObject
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   244
    "add the argument, anObject to the contents - with redraw
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   245
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   246
    self halt
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   247
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   248
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   249
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   250
addObjectWithoutRedraw:anObject
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   251
    "add the argument, anObject to the contents - with redraw
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   252
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   253
    self halt
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   254
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   255
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   256
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   257
!UIObjectView methodsFor:'event handling'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   258
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   259
elementChangedSize:aView
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   260
    "some element has changed its size; collect them during selectionHiddenLevel 
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   261
     is on
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   262
    "
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   263
    selectionHiddenLevel ~~ 0 ifTrue:[
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   264
        setOfSuperViewsSizeChanged add:aView superView
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   265
    ] ifFalse:[
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   266
        aView superView sizeChanged:nil
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   267
    ]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   268
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   269
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   270
exposeX:x y:y width:w height:h
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   271
    "handle an expose event from device; redraw selection
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   272
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   273
    super exposeX:x y:y width:w height:h.
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   274
"/    selectionHiddenLevel == 0 ifTrue:[
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   275
        self selectionDo:[:v | self showSelected:v]
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   276
"/    ]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   277
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   278
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   279
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   280
keyPress:key x:x y:y
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   281
    "any key pressed
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   282
    "
78
a0a00603a8b6 keep spec in properties
ca
parents: 76
diff changeset
   283
    <resource: #keyboard ( #Delete #BackSpace #Cut #Copy #Paste ) >
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   284
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   285
    (key == #Cut or:[key == #Delete or:[key == #BackSpace]]) ifTrue: [
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   286
        ^ self deleteSelection
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   287
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   288
78
a0a00603a8b6 keep spec in properties
ca
parents: 76
diff changeset
   289
    key == #Copy  ifTrue:[ ^ self copySelection].
a0a00603a8b6 keep spec in properties
ca
parents: 76
diff changeset
   290
    key == #Paste ifTrue:[ ^ self pasteBuffer].
a0a00603a8b6 keep spec in properties
ca
parents: 76
diff changeset
   291
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   292
    super keyPress:key x:x y:y
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   293
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   294
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   295
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   296
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   297
processEvent:anEvent
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   298
    "catch expose events for components, and redraw its handles after
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   299
     the redraw when this happens
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   300
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   301
    |view|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   302
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   303
    selection notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   304
        anEvent type == #damage ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   305
            view := anEvent view.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   306
            (selection == view
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   307
            or:[selection isCollection
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   308
                and:[selection includes:view]]) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   309
                    self showSelected:view
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   310
            ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   311
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   312
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   313
    ^ false.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   314
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   315
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   316
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   317
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   318
sizeChanged:how
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   319
    "size of a view(s) changed
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   320
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   321
    self withSelectionHiddenDo:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   322
        super sizeChanged:how
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   323
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   324
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   325
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   326
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   327
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   328
!UIObjectView methodsFor:'initialization'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   329
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   330
initialize
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   331
    "setup attributes
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   332
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   333
    super initialize.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   334
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   335
    "funny: since I do not want the created widgets to get pointer
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   336
     events, I put an InputView on top of them, which catches those events
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   337
     and passes them back to me - have to take care, that this inputView
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   338
     is always on top
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   339
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   340
    inputView := InputView origin:0.0@0.0 extent:1.0@1.0 in:self.
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   341
    setOfSuperViewsSizeChanged := IdentitySet new.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   342
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   343
    inputView eventReceiver:self.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   344
    inputView enableButtonEvents.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   345
    inputView enableButtonMotionEvents.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   346
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   347
    self setDefaultActions.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   348
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   349
    undoHistory  := UndoHistory new.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   350
    testMode     := false.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   351
    clipChildren := true.
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   352
    selectionHiddenLevel := 0.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   353
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   354
    (self class gridShown) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   355
        super showGrid
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   356
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   357
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   358
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   359
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   360
realize
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   361
    super realize.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   362
    self windowGroup postEventHook:self
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   363
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   364
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   365
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   366
!UIObjectView methodsFor:'misc'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   367
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   368
cursor:aCursor
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   369
    "set cursor
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   370
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   371
    inputView realized ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   372
        inputView cursor:aCursor
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   373
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   374
    super cursor:aCursor
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   375
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   376
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   377
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   378
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   379
invertOutlineOf:anObject
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   380
    "invert outline of an object
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   381
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   382
    |wasClipped delta|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   383
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   384
    (wasClipped := clipChildren) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   385
        self clippedByChildren:(clipChildren := false).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   386
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   387
    delta := (anObject originRelativeTo:self) - anObject origin.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   388
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   389
    self xoring:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   390
        self displayRectangle:((anObject origin + delta) extent:anObject extent).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   391
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   392
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   393
    wasClipped ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   394
        self clippedByChildren:(clipChildren := true).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   395
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   396
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   397
    "Modified: 5.9.1995 / 12:25:25 / claus"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   398
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   399
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   400
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   401
78
a0a00603a8b6 keep spec in properties
ca
parents: 76
diff changeset
   402
minSetOfSuperViews:setOfViews
a0a00603a8b6 keep spec in properties
ca
parents: 76
diff changeset
   403
a0a00603a8b6 keep spec in properties
ca
parents: 76
diff changeset
   404
    setOfViews isCollection ifFalse:[
a0a00603a8b6 keep spec in properties
ca
parents: 76
diff changeset
   405
        setOfViews notNil ifTrue:[^ Array with:setOfViews]
a0a00603a8b6 keep spec in properties
ca
parents: 76
diff changeset
   406
                         ifFalse:[^ nil]
72
a5a7054e2b7d *** empty log message ***
ca
parents: 68
diff changeset
   407
    ].
a5a7054e2b7d *** empty log message ***
ca
parents: 68
diff changeset
   408
78
a0a00603a8b6 keep spec in properties
ca
parents: 76
diff changeset
   409
  ^ setOfViews select:[:aView|
a0a00603a8b6 keep spec in properties
ca
parents: 76
diff changeset
   410
        (setOfViews detect:[:v|aView isComponentOf:v] ifNone:nil) isNil
a0a00603a8b6 keep spec in properties
ca
parents: 76
diff changeset
   411
    ]
72
a5a7054e2b7d *** empty log message ***
ca
parents: 68
diff changeset
   412
!
a5a7054e2b7d *** empty log message ***
ca
parents: 68
diff changeset
   413
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   414
setDefaultActions
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   415
    "set default actions
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   416
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   417
    pressAction      := [:pressPoint | self startSelectOrMove:pressPoint].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   418
    shiftPressAction := [:pressPoint | self startSelectMoreOrMove:pressPoint].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   419
    motionAction     := [:movePoint  | nil].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   420
    releaseAction    := [nil].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   421
    keyPressAction   := nil.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   422
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   423
    self cursor:Cursor normal.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   424
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   425
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   426
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   427
!UIObjectView methodsFor:'object creation'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   428
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   429
actionCreate:anObject frame:aFrame delta:aDelta
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   430
    "create and initialize action data
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   431
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   432
    |extent x y selectors values|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   433
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   434
"minimum extent
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   435
"
82
99dc76d66eab checkin from browser
ca
parents: 79
diff changeset
   436
    (anObject specClass supportsSubComponents) ifTrue:[
84
da0459487089 instance creation within a widget
ca
parents: 82
diff changeset
   437
        extent := 25@25
82
99dc76d66eab checkin from browser
ca
parents: 79
diff changeset
   438
    ] ifFalse:[
99dc76d66eab checkin from browser
ca
parents: 79
diff changeset
   439
        extent := self extent.
99dc76d66eab checkin from browser
ca
parents: 79
diff changeset
   440
        x := extent x // 3.
99dc76d66eab checkin from browser
ca
parents: 79
diff changeset
   441
        y := extent y // 3.
99dc76d66eab checkin from browser
ca
parents: 79
diff changeset
   442
        extent := anObject preferredExtent.
99dc76d66eab checkin from browser
ca
parents: 79
diff changeset
   443
99dc76d66eab checkin from browser
ca
parents: 79
diff changeset
   444
        (extent x > x) ifTrue:[extent x:x].
99dc76d66eab checkin from browser
ca
parents: 79
diff changeset
   445
        (extent y > y) ifTrue:[extent y:y].
99dc76d66eab checkin from browser
ca
parents: 79
diff changeset
   446
    ].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   447
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   448
"setup structure
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   449
"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   450
    selectors := #( object frame delta vertical horizontal minExtent ).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   451
    values    := Array new:(selectors size).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   452
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   453
    values at:1 put:anObject.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   454
    values at:2 put:aFrame.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   455
    values at:3 put:aDelta.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   456
    values at:4 put:(self isVerticalResizable:anObject).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   457
    values at:5 put:(self isHorizontalResizable:anObject).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   458
    values at:6 put:extent.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   459
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   460
    actionData := Structure newWith:selectors values:values.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   461
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   462
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   463
"can change cursor dependent on vertical/horizontal resizing
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   464
"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   465
    oldCursor := cursor.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   466
    self cursor:(Cursor leftHand).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   467
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   468
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   469
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   470
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   471
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   472
createWidgetWithClass:aClass
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   473
    "prepare to create new widgets
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   474
    "
89
35c5711729c2 so far so good
ca
parents: 84
diff changeset
   475
    aClass notNil ifTrue:[
35c5711729c2 so far so good
ca
parents: 84
diff changeset
   476
        createClass := aClass.
35c5711729c2 so far so good
ca
parents: 84
diff changeset
   477
        pressAction := [:aPoint| self startCreate:aPoint].
35c5711729c2 so far so good
ca
parents: 84
diff changeset
   478
        self cursor:Cursor origin.
35c5711729c2 so far so good
ca
parents: 84
diff changeset
   479
    ]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   480
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   481
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   482
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   483
doDragCreate:aPoint
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   484
    "do a widget create drag
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   485
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   486
    |frame object extent minimum|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   487
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   488
    frame   := actionData frame.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   489
    frame corner:((self alignToGrid:aPoint) - (actionData delta)).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   490
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   491
    object  := actionData object.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   492
    minimum := actionData minExtent.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   493
    extent  := frame extent.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   494
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   495
    ((extent x < minimum x) or:[actionData horizontal not]) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   496
        extent x:(minimum x)
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   497
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   498
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   499
    ((extent y < minimum y) or:[actionData vertical not]) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   500
        extent y:(minimum y)
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   501
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   502
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   503
    frame extent:extent.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   504
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   505
    self invertOutlineOf:object.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   506
    object origin:(frame origin) extent:(frame extent).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   507
    self invertOutlineOf:object.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   508
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   509
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   510
endCreate
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   511
    "end a widget create drag
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   512
    "
89
35c5711729c2 so far so good
ca
parents: 84
diff changeset
   513
    |object specClass|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   514
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   515
    object := actionData object.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   516
    self invertOutlineOf:object.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   517
    inputView raise.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   518
89
35c5711729c2 so far so good
ca
parents: 84
diff changeset
   519
    self setupInitialLayoutFor:object.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   520
    self changed:#tree.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   521
    self select:object.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   522
    actionData := nil.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   523
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   524
    self setDefaultActions.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   525
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   526
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   527
78
a0a00603a8b6 keep spec in properties
ca
parents: 76
diff changeset
   528
initializeCreatedObject:anObject
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   529
    self subclassResponsibility
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   530
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   531
89
35c5711729c2 so far so good
ca
parents: 84
diff changeset
   532
setupInitialLayoutFor:anObject
35c5711729c2 so far so good
ca
parents: 84
diff changeset
   533
    "setup initial layout for an object; !!!! some kludge !!!!
35c5711729c2 so far so good
ca
parents: 84
diff changeset
   534
    "
35c5711729c2 so far so good
ca
parents: 84
diff changeset
   535
    |spec topSpec|
35c5711729c2 so far so good
ca
parents: 84
diff changeset
   536
35c5711729c2 so far so good
ca
parents: 84
diff changeset
   537
    topSpec := anObject superView specClass basicNew.
35c5711729c2 so far so good
ca
parents: 84
diff changeset
   538
35c5711729c2 so far so good
ca
parents: 84
diff changeset
   539
    topSpec class isLayoutContainer ifFalse:[
35c5711729c2 so far so good
ca
parents: 84
diff changeset
   540
35c5711729c2 so far so good
ca
parents: 84
diff changeset
   541
"/ ... KLUDGE ....
35c5711729c2 so far so good
ca
parents: 84
diff changeset
   542
35c5711729c2 so far so good
ca
parents: 84
diff changeset
   543
        spec := anObject specClass.
35c5711729c2 so far so good
ca
parents: 84
diff changeset
   544
35c5711729c2 so far so good
ca
parents: 84
diff changeset
   545
        (    spec == ViewSpec
35c5711729c2 so far so good
ca
parents: 84
diff changeset
   546
         or:[spec == SubCanvasSpec
35c5711729c2 so far so good
ca
parents: 84
diff changeset
   547
         or:[spec == TextEditorSpec
35c5711729c2 so far so good
ca
parents: 84
diff changeset
   548
         or:[spec == SequenceViewSpec]]]
35c5711729c2 so far so good
ca
parents: 84
diff changeset
   549
        ) ifTrue:[
35c5711729c2 so far so good
ca
parents: 84
diff changeset
   550
            anObject geometryLayout:(anObject bounds asLayout).
35c5711729c2 so far so good
ca
parents: 84
diff changeset
   551
          ^ self
35c5711729c2 so far so good
ca
parents: 84
diff changeset
   552
        ]
35c5711729c2 so far so good
ca
parents: 84
diff changeset
   553
    ].
35c5711729c2 so far so good
ca
parents: 84
diff changeset
   554
    topSpec setupInitialLayoutFor:anObject.
35c5711729c2 so far so good
ca
parents: 84
diff changeset
   555
35c5711729c2 so far so good
ca
parents: 84
diff changeset
   556
!
35c5711729c2 so far so good
ca
parents: 84
diff changeset
   557
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   558
startCreate:aPoint
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   559
    "start a widget create
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   560
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   561
    |widget object start frame delta|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   562
89
35c5711729c2 so far so good
ca
parents: 84
diff changeset
   563
    self unselect.
35c5711729c2 so far so good
ca
parents: 84
diff changeset
   564
    widget := self findContainerViewAt:aPoint.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   565
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   566
    motionAction  := [:movePoint| self doDragCreate:movePoint].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   567
    releaseAction := [ self endCreate].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   568
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   569
    object := createClass new.
76
c9c4254a9ee5 *** empty log message ***
ca
parents: 72
diff changeset
   570
    (widget isKindOf:ScrollableView) ifTrue:[
c9c4254a9ee5 *** empty log message ***
ca
parents: 72
diff changeset
   571
        widget scrolledView:object
c9c4254a9ee5 *** empty log message ***
ca
parents: 72
diff changeset
   572
    ] ifFalse:[
c9c4254a9ee5 *** empty log message ***
ca
parents: 72
diff changeset
   573
        widget addSubView:object.
c9c4254a9ee5 *** empty log message ***
ca
parents: 72
diff changeset
   574
    ].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   575
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   576
    start := self alignToGrid:aPoint.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   577
    delta := widget originRelativeTo:self.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   578
    frame := Rectangle origin:(start - delta) corner:start.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   579
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   580
    object origin:(frame origin).
78
a0a00603a8b6 keep spec in properties
ca
parents: 76
diff changeset
   581
    self initializeCreatedObject:object.
82
99dc76d66eab checkin from browser
ca
parents: 79
diff changeset
   582
    self actionCreate:object frame:frame delta:delta.
99dc76d66eab checkin from browser
ca
parents: 79
diff changeset
   583
    object extent:(actionData minExtent).
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   584
    object realize.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   585
    self invertOutlineOf:object.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   586
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   587
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   588
!UIObjectView methodsFor:'object moving'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   589
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   590
doObjectMove:aPoint
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   591
    "move selection
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   592
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   593
    movedObject notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   594
        movedObject keysAndValuesDo:[:nr :aView|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   595
            self invertOutlineOf:aView.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   596
            self moveObject:aView to:(aPoint - (moveDelta at:nr)).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   597
            self invertOutlineOf:aView.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   598
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   599
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   600
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   601
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   602
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   603
endObjectMove
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   604
    "cleanup after object(s) move
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   605
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   606
    movedObject notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   607
        movedObject do:[:aView|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   608
            self invertOutlineOf:aView
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   609
        ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   610
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   611
        movedObject do:[:aView|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   612
            self showSelected:aView
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   613
        ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   614
        movedObject size == 1 ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   615
            selection := movedObject at:1
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   616
        ] ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   617
            selection := movedObject
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   618
        ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   619
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   620
        movedObject := nil.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   621
        self setDefaultActions.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   622
        self changed:#layout.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   623
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   624
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   625
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   626
moveObject:anObject to:aPoint
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   627
    "move anObject to newOrigin, aPoint
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   628
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   629
    |dX dY org delta|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   630
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   631
    anObject notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   632
        org := anObject computeOrigin.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   633
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   634
        delta := aPoint - org.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   635
        delta := (self alignToGrid:aPoint) - org.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   636
        dX := delta x.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   637
        dY := delta y.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   638
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   639
        undoHistory disabledTransitionDo:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   640
            self shiftLayout:anObject top:dY bottom:dY left:dX right:dX
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   641
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   642
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   643
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   644
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   645
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   646
startObjectMoveAt:aPoint
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   647
    "start object(s) move at a point
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   648
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   649
    self startObjectMove:selection at:aPoint.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   650
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   651
    selection isCollection ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   652
        movedObject := selection
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   653
    ] ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   654
        movedObject := Array with:selection
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   655
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   656
    super unselect.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   657
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   658
    moveDelta := movedObject collect:[:aView|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   659
        aPoint - aView computeOrigin
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   660
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   661
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   662
    self transaction:#move objects:movedObject do:[:aView|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   663
        self invertOutlineOf:aView.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   664
        self undoLayoutView:aView
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   665
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   666
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   667
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   668
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   669
startSelectMoreOrMove:aPoint
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   670
    "add/remove to/from selection"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   671
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   672
    |anObject|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   673
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   674
    testMode ifTrue:[^ self].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   675
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   676
    anObject := self findObjectAt:aPoint.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   677
    anObject notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   678
        (self isSelected:anObject) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   679
            self removeFromSelection:anObject
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   680
        ] ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   681
            self addToSelection:anObject
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   682
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   683
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   684
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   685
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   686
startSelectOrMove:aPoint
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   687
    "a button is pressed at a point; start moving or selection
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   688
    "
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   689
    |aView b|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   690
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   691
    testMode ifTrue:[^ self].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   692
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   693
    aView := self singleSelection.
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   694
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   695
    aView notNil ifTrue:[
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   696
        (aView superView specClass canResizeSubComponents) ifTrue:[
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   697
            b := self whichHandleOf:aView isHitBy:aPoint.
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   698
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   699
            (b notNil and:[b ~~ #view]) ifTrue:[
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   700
                ^ self startResizeBorder:b of:aView.
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   701
            ]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   702
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   703
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   704
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   705
    (aView := self findObjectAt:aPoint) isNil ifTrue:[
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   706
        ^ self unselect
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   707
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   708
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   709
    (self canMove:aView) ifFalse:[
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   710
        super unselect.
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   711
      ^ self select:aView
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   712
    ].
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   713
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   714
    (self isSelected:aView) ifFalse:[
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   715
        super unselect.
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   716
        self select:aView.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   717
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   718
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   719
    (self numberOfSelections ~~ 1) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   720
        releaseAction := [
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   721
            self setDefaultActions.
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   722
            self select:aView
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   723
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   724
    ] ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   725
        releaseAction := [self setDefaultActions]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   726
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   727
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   728
    "prepare move operation for an object
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   729
    "
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   730
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   731
    motionAction := [:movePoint|
72
a5a7054e2b7d *** empty log message ***
ca
parents: 68
diff changeset
   732
        (aPoint dist:movePoint) > 8.0 ifTrue:[
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   733
            self startObjectMoveAt:aPoint
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   734
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   735
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   736
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   737
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   738
!UIObjectView methodsFor:'object resize'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   739
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   740
actionResize:anObject selector:aSelector
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   741
    "create and initialize action for resize
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   742
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   743
    |selector delta|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   744
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   745
    delta    := anObject container originRelativeTo:self.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   746
    selector := ('resize:', aSelector, ':') asSymbol.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   747
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   748
    actionData := Structure with:(#object->anObject)
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   749
                            with:(#selector->selector)
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   750
                            with:(#delta->delta).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   751
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   752
"can change cursor dependent on vertical/horizontal resizing
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   753
"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   754
    oldCursor := cursor.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   755
    self cursor:(Cursor leftHand).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   756
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   757
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   758
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   759
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   760
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   761
doDragResize:aPoint
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   762
    "do a widget resize drag
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   763
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   764
    |p object|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   765
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   766
    object := actionData object.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   767
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   768
    self invertOutlineOf:object.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   769
    p := (self alignToGrid:aPoint) - (actionData delta).
79
33212fbe9766 resize extent
ca
parents: 78
diff changeset
   770
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   771
    self perform:(actionData selector) with:object with:p.
79
33212fbe9766 resize extent
ca
parents: 78
diff changeset
   772
   "/ object geometryLayout:(object geometryLayout).
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   773
    self invertOutlineOf:object
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   774
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   775
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   776
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   777
endResize
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   778
    "cleanup after object resize
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   779
    "
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   780
    |object|
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   781
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   782
    object := actionData object.
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   783
    actionData := nil.
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   784
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   785
    self invertOutlineOf:object.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   786
    self setDefaultActions.
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   787
    self elementChangedSize:object.
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   788
    super select:object.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   789
    self changed:#layout.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   790
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   791
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   792
startResizeBorder:b of:selection
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   793
    "resize selected view
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   794
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   795
    |object|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   796
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   797
    object := self singleSelection.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   798
    self actionResize:object selector:b.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   799
72
a5a7054e2b7d *** empty log message ***
ca
parents: 68
diff changeset
   800
    self transaction:#resize selectionDo:[:aView|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   801
        self undoLayoutView:aView
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   802
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   803
    super unselect.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   804
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   805
    motionAction  := [:movePoint | self doDragResize:movePoint].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   806
    releaseAction := [self endResize].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   807
    self invertOutlineOf:object
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   808
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   809
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   810
!UIObjectView methodsFor:'private handles'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   811
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   812
handlesOf:aView do:aBlock
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   813
    |dlta type v h|
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   814
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   815
    dlta := (aView originRelativeTo:self) - aView origin.
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   816
    type := self class layoutType:aView.
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   817
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   818
    (type == #LayoutFrame or:[type == #Rectangle]) ifTrue:[
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   819
        v := self isVerticalResizable:aView.
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   820
        h := self isHorizontalResizable:aView.
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   821
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   822
        h ifTrue:[  aBlock value:(aView leftCenter   + dlta) value:#left.
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   823
                    aBlock value:(aView rightCenter  + dlta) value:#right.
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   824
                 ].
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   825
        v ifTrue:[  aBlock value:(aView topCenter    + dlta) value:#top.
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   826
                    aBlock value:(aView bottomCenter + dlta) value:#bottom.
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   827
                 ].
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   828
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   829
        (h and:[v]) ifTrue:[
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   830
            aBlock value:(aView origin     + dlta) value:#origin.
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   831
            aBlock value:(aView topRight   + dlta) value:#topRight.
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   832
            aBlock value:(aView bottomLeft + dlta) value:#bottomLeft.
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   833
            aBlock value:(aView corner     + dlta) value:#corner.
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   834
          ^ self
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   835
        ]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   836
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   837
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   838
    aBlock value:(aView origin     + dlta) value:#view.
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   839
    aBlock value:(aView topRight   + dlta) value:#view.
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   840
    aBlock value:(aView bottomLeft + dlta) value:#view.
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   841
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   842
    type == #Extent ifTrue:[
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   843
        v := self isVerticalResizable:aView.
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   844
        h := self isHorizontalResizable:aView.
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   845
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   846
        v ifTrue:[aBlock value:(aView bottomCenter + dlta) value:#bottom].
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   847
        h ifTrue:[aBlock value:(aView rightCenter  + dlta) value:#right ].
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   848
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   849
        (h and:[v]) ifTrue:[
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   850
            aBlock value:(aView corner + dlta) value:#corner.
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   851
          ^ self
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   852
        ]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   853
    ].
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   854
    aBlock value:(aView corner + dlta) value:#view.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   855
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   856
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   857
showSelected:aComponent
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   858
    "show object selected
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   859
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   860
    |wasClipped delta oldPaint|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   861
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   862
    self paint:Color black.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   863
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   864
    (wasClipped := clipChildren) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   865
        self clippedByChildren:(clipChildren := false). 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   866
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   867
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   868
    self handlesOf:aComponent do:[:pnt :what |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   869
        what == #view ifTrue:[self displayRectangle:(pnt - (4@4) extent:7@7)]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   870
                     ifFalse:[self    fillRectangle:(pnt - (4@4) extent:7@7)]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   871
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   872
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   873
    wasClipped ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   874
        self clippedByChildren:(clipChildren := true).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   875
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   876
    self paint:oldPaint.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   877
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   878
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   879
showUnselected:aComponent
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   880
    "show object unselected
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   881
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   882
    |wasClipped delta r oldPaint|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   883
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   884
    r := aComponent origin extent:8@8.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   885
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   886
    (wasClipped := clipChildren) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   887
        self clippedByChildren:(clipChildren := false). 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   888
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   889
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   890
    self handlesOf:aComponent do:[:pnt :what |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   891
        self clearRectangle:(pnt - (4@4) extent:7@7).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   892
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   893
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   894
    wasClipped ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   895
        self clippedByChildren:(clipChildren := true). 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   896
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   897
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   898
    "/ must redraw all components which are affected b the handles
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   899
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   900
    r := (aComponent originRelativeTo:self) - (4@4)
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   901
             extent:(aComponent extent + (4@4)).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   902
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   903
    subViews do:[:anotherComponent |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   904
        |absOrg absFrame|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   905
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   906
        anotherComponent ~~ inputView ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   907
            absOrg := anotherComponent originRelativeTo:self.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   908
            absFrame := absOrg extent:(anotherComponent extent).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   909
            (absFrame intersects:r) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   910
                anotherComponent withAllSubViewsDo:[:v |
95
c20189d75ec3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 91
diff changeset
   911
                    v shown ifTrue:[
c20189d75ec3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 91
diff changeset
   912
                        v clear.
c20189d75ec3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 91
diff changeset
   913
                        v exposeX:0 y:0 width:9999 height:9999.
c20189d75ec3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 91
diff changeset
   914
                    ]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   915
                ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   916
            ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   917
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   918
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   919
95
c20189d75ec3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 91
diff changeset
   920
    "Modified: 8.4.1997 / 00:32:26 / cg"
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   921
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   922
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   923
whichHandleOf:aView isHitBy:aPoint
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   924
    "returns kind of handle or nil
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   925
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   926
    |bounds|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   927
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   928
    self handlesOf:aView do:[:pnt :what |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   929
        ((pnt - (4@4) extent:7@7) containsPoint:aPoint) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   930
            ^ what
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   931
        ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   932
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   933
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   934
    ^ nil
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   935
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   936
    "Modified: 5.9.1995 / 14:39:34 / claus"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   937
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   938
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   939
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   940
!UIObjectView methodsFor:'private resizing-subviews'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   941
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   942
resize:aView bottom:aPoint
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   943
    "resize a views bottom
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   944
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   945
    undoHistory disabledTransitionDo:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   946
        self shiftLayout:aView top:0 bottom:((aPoint y) - (aView computeCorner y))
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   947
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   948
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   949
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   950
resize:aView bottomLeft:aPoint
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   951
    "resize a views bottom and left
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   952
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   953
    undoHistory disabledTransitionDo:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   954
        self shiftLayout:aView top:0
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   955
                            bottom:((aPoint y) - (aView computeCorner y))
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   956
                              left:((aPoint x) - (aView computeOrigin x))
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   957
                             right:0
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   958
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   959
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   960
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   961
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   962
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   963
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   964
resize:aView corner:aPoint
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   965
    "resize a views corner
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   966
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   967
    |delta|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   968
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   969
    delta := aPoint - aView computeCorner.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   970
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   971
    undoHistory disabledTransitionDo:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   972
        self shiftLayout:aView top:0 bottom:(delta y) left:0 right:(delta x)
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   973
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   974
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   975
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   976
resize:aView left:aPoint
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   977
    "resize a views left
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   978
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   979
    undoHistory disabledTransitionDo:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   980
        self shiftLayout:aView left:((aPoint x) - (aView computeOrigin x)) right:0
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   981
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   982
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   983
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   984
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   985
resize:aView origin:aPoint
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   986
    "resize a views origin
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   987
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   988
    |delta|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   989
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   990
    delta := aPoint - aView computeOrigin.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   991
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   992
    undoHistory disabledTransitionDo:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   993
        self shiftLayout:aView top:(delta y) bottom:0 left:(delta x) right:0
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   994
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   995
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   996
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   997
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   998
resize:aView right:aPoint
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   999
    "resize a views right
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1000
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1001
    undoHistory disabledTransitionDo:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1002
        self shiftLayout:aView left:0 right:((aPoint x) - (aView computeCorner x))
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1003
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1004
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1005
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1006
resize:aView top:aPoint
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1007
    "resize a views top
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1008
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1009
    undoHistory disabledTransitionDo:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1010
        self shiftLayout:aView top:((aPoint y) - (aView computeOrigin y)) bottom:0
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1011
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1012
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1013
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1014
resize:aView topRight:aPoint
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1015
    "resize a views top and right
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1016
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1017
    undoHistory disabledTransitionDo:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1018
        self shiftLayout:aView top:((aPoint y) - (aView computeOrigin y))
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1019
                            bottom:0
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1020
                              left:0
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1021
                             right:((aPoint x) - (aView computeCorner x))
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1022
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1023
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1024
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1025
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1026
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1027
!UIObjectView methodsFor:'private shift-layout'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1028
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1029
shiftLayout:aView left:l right:r
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1030
    "shift layout for a view; in case of an open transaction, the undo
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1031
     action is registered
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1032
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1033
    self shiftLayout:aView top:0 bottom:0 left:l right:r
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1034
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1035
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1036
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1037
shiftLayout:aView top:t bottom:b
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1038
    "shift layout for a view; in case of an open transaction, the undo
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1039
     action is registered
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1040
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1041
    self shiftLayout:aView top:t bottom:b left:0 right:0
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1042
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1043
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1044
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1045
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1046
shiftLayout:aView top:t bottom:b left:l right:r
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1047
    "shift layout for a view; in case of an open transaction, the undo
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1048
     action is registered
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1049
    "
79
33212fbe9766 resize extent
ca
parents: 78
diff changeset
  1050
    |type layout oldExt|
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1051
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1052
    type := self class layoutType:aView.
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1053
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1054
    type notNil ifTrue:[
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1055
        self undoLayoutView:aView.
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1056
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1057
        type == #Extent ifTrue:[
79
33212fbe9766 resize extent
ca
parents: 78
diff changeset
  1058
            oldExt := aView extent.
33212fbe9766 resize extent
ca
parents: 78
diff changeset
  1059
            aView extent:(oldExt + ((r-l) @ (b-t))).
33212fbe9766 resize extent
ca
parents: 78
diff changeset
  1060
            ^ self 
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1061
        ].
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1062
78
a0a00603a8b6 keep spec in properties
ca
parents: 76
diff changeset
  1063
        layout := aView geometryLayout copy.
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1064
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1065
        layout isLayout ifTrue:[
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1066
            layout leftOffset:(layout leftOffset + l)
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1067
                    topOffset:(layout topOffset  + t).
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1068
                    
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1069
            type == #LayoutFrame ifTrue:[
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1070
                layout bottomOffset:(layout bottomOffset + b).
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1071
                layout  rightOffset:(layout rightOffset  + r).
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1072
            ]
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1073
        ] ifFalse:[
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1074
            type == #Rectangle ifTrue:[
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1075
                layout left:(layout left   + l)
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1076
                      right:(layout right  + r)
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1077
                        top:(layout top    + t)
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1078
                     bottom:(layout bottom + b).
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1079
            ] ifFalse:[     "POINT"
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1080
                layout x:(layout x + l) y:(layout y + t).
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1081
            ]
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1082
        ].
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1083
        aView geometryLayout:layout
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1084
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1085
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1086
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1087
!UIObjectView methodsFor:'searching'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1088
89
35c5711729c2 so far so good
ca
parents: 84
diff changeset
  1089
findContainerViewAt:aPoint
35c5711729c2 so far so good
ca
parents: 84
diff changeset
  1090
    "find container view responds to aPoint.
35c5711729c2 so far so good
ca
parents: 84
diff changeset
  1091
    "
35c5711729c2 so far so good
ca
parents: 84
diff changeset
  1092
    ^ self subclassResponsibility
35c5711729c2 so far so good
ca
parents: 84
diff changeset
  1093
35c5711729c2 so far so good
ca
parents: 84
diff changeset
  1094
35c5711729c2 so far so good
ca
parents: 84
diff changeset
  1095
!
35c5711729c2 so far so good
ca
parents: 84
diff changeset
  1096
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1097
findObjectAt:aPoint
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1098
    "find the origin/corner of the currentWidget
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1099
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1100
    |view viewId lastId point listOfViews|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1101
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1102
    viewId := rootView id.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1103
    point  := aPoint + (device translatePoint:0@0 from:(self id) to:viewId).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1104
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1105
    inputView lower.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1106
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1107
    [viewId notNil] whileTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1108
        lastId := viewId.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1109
        viewId := device viewIdFromPoint:point in:lastId
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1110
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1111
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1112
    inputView raise.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1113
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1114
    view := device viewFromId:lastId.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1115
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1116
    view ~~ inputView ifTrue:[^ view].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1117
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1118
    "/ look for 'hidden' views ...
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1119
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1120
    listOfViews := OrderedCollection new.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1121
    self allSubViewsDo:[:aView |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1122
        |org|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1123
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1124
        aView ~~ inputView ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1125
            org := device translatePoint:0@0 from:(aView id) to:self id.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1126
            ((org extent:aView extent) containsPoint:aPoint) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1127
                listOfViews add:aView.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1128
            ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1129
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1130
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1131
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1132
    listOfViews size > 0 ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1133
        ^ listOfViews last
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1134
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1135
    ^ nil
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1136
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1137
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1138
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1139
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1140
isPoint:aPoint containedIn:aView
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1141
    "checks whether a point is covered by a view.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1142
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1143
    |p|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1144
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1145
    p := device translatePoint:aPoint from:inputView id to:aView id.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1146
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1147
    (p x >= 0 and:[p y >= 0]) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1148
        p := aView extent - p.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1149
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1150
        (p x >= 0 and:[p y >= 0]) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1151
            ^ true
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1152
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1153
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1154
    ^ false
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1155
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1156
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1157
whichBorderOf:aView isHitBy:aPoint
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1158
    |p r bw org|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1159
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1160
    bw := aView borderWidth.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1161
    p := aPoint - (aView superView originRelativeTo:self).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1162
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1163
    r := Rectangle origin:(aView origin)
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1164
                   extent:(aView width @ bw).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1165
    (r containsPoint:p) ifTrue:[^ #top:].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1166
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1167
    r origin:(aView left @ (aView bottom + bw)) extent:(aView width @ bw).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1168
    (r containsPoint:p) ifTrue:[^ #bottom:].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1169
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1170
    r top:(aView top).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1171
    r extent:(bw @ aView height).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1172
    (r containsPoint:p) ifTrue:[^ #left:].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1173
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1174
    r origin:((aView right + bw) @ aView top).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1175
    (r containsPoint:p) ifTrue:[^ #right:].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1176
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1177
    ^ nil
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1178
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1179
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1180
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1181
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1182
!UIObjectView methodsFor:'selections'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1183
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1184
addToSelection:something
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1185
    "add something to selection
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1186
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1187
    (self canSelect:something) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1188
        super addToSelection:something.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1189
        self changed:#selection.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1190
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1191
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1192
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1193
numberOfSelections
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1194
    "return the number of selected entries
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1195
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1196
    |sz|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1197
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1198
    selection isNil ifTrue:[^ 0].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1199
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1200
    selection isCollection ifTrue:[^ selection size]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1201
                          ifFalse:[^ 1 ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1202
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1203
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1204
removeFromSelection:something
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1205
    "remove something from selection
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1206
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1207
    super removeFromSelection:something.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1208
    self changed:#selection
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1209
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1210
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1211
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1212
select:something
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1213
    "change selection to something
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1214
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1215
    (self canSelect:something) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1216
        super select:something.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1217
        self changed:#selection
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1218
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1219
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1220
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1221
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1222
selection
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1223
    "returns selection
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1224
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1225
    ^ selection
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1226
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1227
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1228
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1229
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1230
showSelection
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1231
    selectionHiddenLevel == 0 ifTrue:[
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1232
        super showSelection.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1233
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1234
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1235
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1236
singleSelection
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1237
    "returns single selection or nil
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1238
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1239
    selection isCollection ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1240
        ^ selection
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1241
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1242
    selection size == 1 ifTrue:[ ^ selection at:1]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1243
                       ifFalse:[ ^ nil].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1244
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1245
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1246
singleSelectionDo:aBlock
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1247
    "perform block with argument a view in case of one selection
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1248
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1249
    |view|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1250
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1251
    (view := self singleSelection) notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1252
        aBlock value:view
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1253
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1254
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1255
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1256
unselect
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1257
    "clear selection
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1258
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1259
    selection notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1260
        super unselect.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1261
        self changed:#selection
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1262
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1263
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1264
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1265
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1266
withSelectionHiddenDo:aBlock
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1267
    "apply block with selection hidden (no handles)
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1268
    "
78
a0a00603a8b6 keep spec in properties
ca
parents: 76
diff changeset
  1269
    |coll|
a0a00603a8b6 keep spec in properties
ca
parents: 76
diff changeset
  1270
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1271
    selectionHiddenLevel := selectionHiddenLevel + 1.
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1272
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1273
    selectionHiddenLevel == 1 ifTrue:[
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1274
        self selectionDo:[:aView| self showUnselected:aView].
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1275
        device flush.
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1276
    ].
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1277
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1278
    aBlock valueNowOrOnUnwindDo:[
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1279
        selectionHiddenLevel == 1 ifTrue:[
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1280
            setOfSuperViewsSizeChanged notEmpty ifTrue:[
78
a0a00603a8b6 keep spec in properties
ca
parents: 76
diff changeset
  1281
                coll := self minSetOfSuperViews:setOfSuperViewsSizeChanged.
a0a00603a8b6 keep spec in properties
ca
parents: 76
diff changeset
  1282
                coll do:[:aView| aView sizeChanged:nil].
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1283
                setOfSuperViewsSizeChanged := IdentitySet new
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1284
            ].
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1285
            self selectionDo:[:aView| self showSelected:aView].
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1286
        ].
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1287
        selectionHiddenLevel := selectionHiddenLevel - 1.
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1288
    ]
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1289
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1290
!
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1291
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1292
withoutSelectionDo:aBlock
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1293
    "evaluate aBlock while selection is nilled
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1294
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1295
    |sel|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1296
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1297
    selection isNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1298
        aBlock value