UIObjectView.st
author ca
Sun, 29 Jun 1997 10:15:24 +0200
changeset 194 2b05bd327785
parent 175 0b0b4d99e3e7
child 208 d6107fdfe5ce
permissions -rw-r--r--
recompute property list when changing view ordering by lower or raise
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
156
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
     1
"
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
     2
 COPYRIGHT (c) 1995 by eXept Software AG
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
     3
              All Rights Reserved
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
     4
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
     5
 This software is furnished under a license and may be used
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
     6
 only in accordance with the terms of that license and with the
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
     8
 be provided or otherwise made available to, or used by, any
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
     9
 other person.  No title to or ownership of the software is
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    10
 hereby transferred.
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    11
"
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    12
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    13
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    14
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    15
ObjectView subclass:#UIObjectView
123
421d412e797b keep old selection before starting test and
ca
parents: 119
diff changeset
    16
	instanceVariableNames:'saveSelection inputView enableChannel undoHistory copiedExtent
175
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
    17
		copiedLayout resizeData clipChildren selectionHiddenLevel
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
    18
		setOfSuperViewsSizeChanged'
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    19
	classVariableNames:''
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    20
	poolDictionaries:''
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    21
	category:'Interface-UIPainter'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    22
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    23
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    24
Object subclass:#UndoHistory
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 132
diff changeset
    25
	instanceVariableNames:'startIdentifier identifier painter history transaction enabled'
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    26
	classVariableNames:''
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    27
	poolDictionaries:''
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    28
	privateIn:UIObjectView
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    29
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    30
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
    31
Object subclass:#Transaction
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 132
diff changeset
    32
	instanceVariableNames:'identifier type text actions'
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
    33
	classVariableNames:''
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
    34
	poolDictionaries:''
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
    35
	privateIn:UIObjectView::UndoHistory
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
    36
!
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
    37
128
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
    38
!UIObjectView class methodsFor:'documentation'!
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
    39
156
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    40
copyright
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    41
"
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    42
 COPYRIGHT (c) 1995 by eXept Software AG
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    43
              All Rights Reserved
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    44
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    45
 This software is furnished under a license and may be used
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    46
 only in accordance with the terms of that license and with the
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    47
 inclusion of the above copyright notice.   This software may not
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    48
 be provided or otherwise made available to, or used by, any
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    49
 other person.  No title to or ownership of the software is
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    50
 hereby transferred.
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    51
"
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    52
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    53
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    54
!
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    55
128
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
    56
documentation
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
    57
"
131
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
    58
    buildIn view used by the UIPainter; it provides all services for creating, deleting
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
    59
    moving and changing layouts of painted components on a canvas.
128
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
    60
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
    61
    [see also:]
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
    62
        UIBuilder
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
    63
        UIPainterView
156
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    64
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    65
    [author:]
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    66
        Claus Atzkern
128
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
    67
"
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
    68
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
    69
! !
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    70
63
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
    71
!UIObjectView class methodsFor:'conversion'!
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
    72
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
    73
asLayoutFrameFromView:aView
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
    74
    "convert layout from aView to a frameLayout. On success the frameLayout is
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
    75
     returned otherwise nil
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
    76
    "
68
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    77
    |lF lO rF rO tF tO bF bO type layout newLyt|
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    78
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    79
    type   := self layoutType:aView.
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    80
    layout := aView geometryLayout.
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    81
91
86d0c649f95e extent -> layout
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
    82
    layout isNil ifTrue:[
86d0c649f95e extent -> layout
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
    83
        type == #Extent ifTrue:[
86d0c649f95e extent -> layout
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
    84
            layout := aView bounds asLayout
86d0c649f95e extent -> layout
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
    85
        ]
86d0c649f95e extent -> layout
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
    86
    ].
86d0c649f95e extent -> layout
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
    87
68
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    88
    (type isNil or:[layout isNil]) ifTrue:[
63
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
    89
        ^ nil
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
    90
    ].
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
    91
68
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    92
    type == #LayoutFrame ifTrue:[
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    93
        ^ layout copy
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    94
    ].
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    95
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    96
    layout isLayout ifFalse:[
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    97
        type == #Rectangle ifTrue:[
63
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
    98
            lO := layout left.
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
    99
            tO := layout top.
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
   100
            rO := layout right.
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
   101
            bO := layout bottom.
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
   102
        ] ifFalse:[
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
   103
            lO := layout x.
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
   104
            tO := layout y.
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
   105
            rO := lO + aView extent x.
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
   106
            bO := tO + aView extent y.
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
   107
        ].
68
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   108
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   109
        ^ LayoutFrame leftFraction:0 offset:lO  rightFraction:0 offset:rO
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   110
                       topFraction:0 offset:tO bottomFraction:0 offset:bO
63
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
   111
    ].
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
   112
68
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   113
    lF := layout leftFraction.
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   114
    lO := layout leftOffset.
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   115
    tF := layout topFraction.
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   116
    tO := layout topOffset.
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   117
    bF := tF.
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   118
    bO := tO + aView extent y.
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   119
    rF := lF.
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   120
    rO := lO + aView extent x.
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   121
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   122
    newLyt := LayoutFrame leftFraction:lF offset:lO  rightFraction:rF offset:rO
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   123
                           topFraction:tF offset:tO bottomFraction:bF offset:bO.
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   124
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   125
    (    (type == #AlignmentOrigin)
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   126
     and:[layout leftAlignmentFraction ~~ 0
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   127
      or:[layout topAlignmentFraction  ~~ 0]]
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   128
    ) ifTrue:[
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   129
        |svRc prBd dlta|
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   130
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   131
        svRc := aView superView viewRectangle.
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   132
        prBd := aView preferredBounds.
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   133
        dlta := (  ((layout rectangleRelativeTo:svRc preferred:prBd) corner)
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   134
                 - ((newLyt rectangleRelativeTo:svRc preferred:prBd) corner)
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   135
                ) rounded.
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   136
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   137
        newLyt leftOffset:(lO + dlta x).
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   138
        newLyt rightOffset:(rO + dlta x).
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   139
        newLyt topOffset:(tO + dlta y).
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   140
        newLyt bottomOffset:(bO + dlta y).
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   141
    ].
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   142
  ^ newLyt.
91
86d0c649f95e extent -> layout
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   143
86d0c649f95e extent -> layout
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   144
    "Modified: 28.3.1997 / 19:52:48 / cg"
63
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
   145
! !
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
   146
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   147
!UIObjectView class methodsFor:'defaults'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   148
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   149
defaultGrid
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   150
    ^ 4 @ 4
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   151
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   152
!
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
gridShown
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   155
    ^ false
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   156
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   157
!
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
handleSize
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   160
    "size of blob drawn for handles"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   161
    ^ 4
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   162
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   163
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   164
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   165
hitDelta
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   166
    ^ 4
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
175
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   170
!UIObjectView class methodsFor:'handles'!
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   171
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   172
handlesOf:aView do:aBlock
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   173
    |type v h|
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   174
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   175
    type := self layoutType:aView.
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   176
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   177
    (type == #LayoutFrame or:[type == #Rectangle]) ifTrue:[
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   178
        v := self isVerticalResizable:aView.
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   179
        h := self isHorizontalResizable:aView.
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   180
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   181
        h ifTrue:[  aBlock value:(aView leftCenter ) value:#left.
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   182
                    aBlock value:(aView rightCenter) value:#right.
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   183
                 ].
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   184
        v ifTrue:[  aBlock value:(aView topCenter   ) value:#top.
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   185
                    aBlock value:(aView bottomCenter) value:#bottom.
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   186
                 ].
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   187
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   188
        (h and:[v]) ifTrue:[
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   189
            aBlock value:(aView origin    ) value:#origin.
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   190
            aBlock value:(aView topRight  ) value:#topRight.
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   191
            aBlock value:(aView bottomLeft) value:#bottomLeft.
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   192
            aBlock value:(aView corner    ) value:#corner.
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   193
          ^ self
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   194
        ]
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   195
    ].
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   196
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   197
    aBlock value:(aView origin    ) value:#view.
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   198
    aBlock value:(aView topRight  ) value:#view.
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   199
    aBlock value:(aView bottomLeft) value:#view.
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   200
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   201
    type == #Extent ifTrue:[
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   202
        v := self isVerticalResizable:aView.
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   203
        h := self isHorizontalResizable:aView.
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   204
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   205
        v ifTrue:[aBlock value:(aView bottomCenter) value:#bottom].
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   206
        h ifTrue:[aBlock value:(aView rightCenter ) value:#right ].
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   207
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   208
        (h and:[v]) ifTrue:[
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   209
            aBlock value:(aView corner) value:#corner.
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   210
          ^ self
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   211
        ]
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   212
    ].
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   213
    aBlock value:(aView corner) value:#view.
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   214
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   215
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   216
! !
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   217
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   218
!UIObjectView class methodsFor:'queries'!
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   219
175
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   220
isHorizontalResizable:aComponent
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   221
    "returns true if instance is horizontal resizeable
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   222
    "
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   223
    (aComponent isKindOf:ScrollBar) ifTrue:[
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   224
        ^ aComponent orientation == #horizontal
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   225
    ].
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   226
    (aComponent isKindOf:Scroller) ifTrue:[
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   227
        ^ aComponent orientation == #horizontal
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   228
    ].
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   229
    (aComponent isKindOf:Slider) ifTrue:[
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   230
        ^ aComponent orientation == #horizontal
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   231
    ].
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   232
    ^ true
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   233
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   234
!
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   235
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   236
isVerticalResizable:aComponent
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   237
    "returns true if instance is vertical resizeable
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   238
    "
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   239
    (aComponent isKindOf:EditField) ifTrue:[
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   240
        ^ false
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   241
    ].
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   242
    (aComponent isKindOf:ComboBoxView) ifTrue:[
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   243
        ^ false
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   244
    ].
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   245
    (aComponent isKindOf:CheckBox) ifTrue:[
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   246
        ^ false
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   247
    ].
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   248
    (aComponent isKindOf:ScrollBar) ifTrue:[
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   249
        ^ aComponent orientation == #vertical
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   250
    ].
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   251
    (aComponent isKindOf:Scroller) ifTrue:[
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   252
        ^ aComponent orientation == #vertical
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   253
    ].
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   254
    (aComponent isKindOf:Slider) ifTrue:[
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   255
        ^ aComponent orientation == #vertical
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   256
    ].
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   257
    ^ true
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   258
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   259
!
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   260
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   261
layoutType:aView
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   262
    "returns layout type of aView or nil
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   263
    "
113
1854c2e61c4e bug fixes
ca
parents: 100
diff changeset
   264
    |layout spec superView|
1854c2e61c4e bug fixes
ca
parents: 100
diff changeset
   265
1854c2e61c4e bug fixes
ca
parents: 100
diff changeset
   266
    aView notNil ifTrue:[
1854c2e61c4e bug fixes
ca
parents: 100
diff changeset
   267
        layout := aView geometryLayout.
1854c2e61c4e bug fixes
ca
parents: 100
diff changeset
   268
        layout notNil ifTrue:[
1854c2e61c4e bug fixes
ca
parents: 100
diff changeset
   269
            layout isLayout ifTrue:[
1854c2e61c4e bug fixes
ca
parents: 100
diff changeset
   270
                layout isLayoutFrame        ifTrue:[ ^ #LayoutFrame ].
1854c2e61c4e bug fixes
ca
parents: 100
diff changeset
   271
                layout isAlignmentOrigin    ifTrue:[ ^ #AlignmentOrigin ].
1854c2e61c4e bug fixes
ca
parents: 100
diff changeset
   272
                layout isLayoutOrigin       ifTrue:[ ^ #LayoutOrigin ].
1854c2e61c4e bug fixes
ca
parents: 100
diff changeset
   273
            ] ifFalse:[
1854c2e61c4e bug fixes
ca
parents: 100
diff changeset
   274
                layout isRectangle          ifTrue:[ ^ #Rectangle ].
1854c2e61c4e bug fixes
ca
parents: 100
diff changeset
   275
                layout isPoint              ifTrue:[ ^ #Point ].
1854c2e61c4e bug fixes
ca
parents: 100
diff changeset
   276
            ]
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   277
        ] ifFalse:[
113
1854c2e61c4e bug fixes
ca
parents: 100
diff changeset
   278
            (superView := aView superView) notNil ifTrue:[
1854c2e61c4e bug fixes
ca
parents: 100
diff changeset
   279
                spec := superView specClass.
1854c2e61c4e bug fixes
ca
parents: 100
diff changeset
   280
                spec canResizeSubComponents ifTrue:[
1854c2e61c4e bug fixes
ca
parents: 100
diff changeset
   281
                    ^ #Extent
1854c2e61c4e bug fixes
ca
parents: 100
diff changeset
   282
                ]
1854c2e61c4e bug fixes
ca
parents: 100
diff changeset
   283
            ]
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   284
        ]
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   285
    ].
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   286
    ^ nil
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   287
67
09e9d4b57142 alignmentLayout
Claus Gittinger <cg@exept.de>
parents: 63
diff changeset
   288
    "Modified: 28.2.1997 / 13:02:16 / cg"
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   289
! !
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   290
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   291
!UIObjectView methodsFor:'accessing'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   292
119
39acd704ad51 testMode is now a ValueHolder
ca
parents: 113
diff changeset
   293
enableChannel
39acd704ad51 testMode is now a ValueHolder
ca
parents: 113
diff changeset
   294
    "returns the channel which keeps false if running test otherwise true
39acd704ad51 testMode is now a ValueHolder
ca
parents: 113
diff changeset
   295
    "
39acd704ad51 testMode is now a ValueHolder
ca
parents: 113
diff changeset
   296
  ^ enableChannel
113
1854c2e61c4e bug fixes
ca
parents: 100
diff changeset
   297
!
1854c2e61c4e bug fixes
ca
parents: 100
diff changeset
   298
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   299
gridAlign
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   300
    "returns state of aligning to grid
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   301
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   302
    ^ aligning
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   303
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   304
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   305
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   306
gridAlign:aBool
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   307
    "change state of aligning to grid
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   308
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   309
    aBool ifTrue:[self alignOn]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   310
         ifFalse:[self alignOff]
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
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   314
gridParameters
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   315
    "used by defineGrid, and in a separate method for
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   316
     easier redefinition in subclasses. 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   317
     Returns the grid parameters in an array of 7 elements,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   318
     which control the appearance of the grid-pattern.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   319
     the elements are:
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   320
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   321
        bigStepH        number of pixels horizontally between 2 major steps
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   322
        bigStepV        number of pixels vertically between 2 major steps
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   323
        littleStepH     number of pixels horizontally between 2 minor steps
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   324
        littleStepV     number of pixels vertically between 2 minor steps
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   325
        gridAlignH      number of pixels for horizontal grid align (pointer snap)
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   326
        gridAlignV      number of pixels for vertical grid align (pointer snap)
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   327
        docBounds       true, if document boundary should be shown
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   328
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   329
     if littleStepH/V are nil, only bigSteps are drawn.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   330
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   331
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   332
    ^ #(10 10 nil nil 10 10 false)
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   333
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
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   336
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   337
gridShown:aBool
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   338
    "change visibility of grid
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   339
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   340
    aBool ifTrue:[self showGrid]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   341
         ifFalse:[self hideGrid]
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
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   344
hideGrid
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   345
    "hide grid
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   346
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   347
    gridShown ifTrue:[
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   348
        self withSelectionHiddenDo:[super hideGrid]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   349
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   350
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   351
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   352
!
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
showGrid
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   355
    "show grid
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   356
    "
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   357
    self withSelectionHiddenDo:[super showGrid]
119
39acd704ad51 testMode is now a ValueHolder
ca
parents: 113
diff changeset
   358
! !
39acd704ad51 testMode is now a ValueHolder
ca
parents: 113
diff changeset
   359
39acd704ad51 testMode is now a ValueHolder
ca
parents: 113
diff changeset
   360
!UIObjectView methodsFor:'accessing behavior'!
39acd704ad51 testMode is now a ValueHolder
ca
parents: 113
diff changeset
   361
39acd704ad51 testMode is now a ValueHolder
ca
parents: 113
diff changeset
   362
enabled
39acd704ad51 testMode is now a ValueHolder
ca
parents: 113
diff changeset
   363
    ^ enableChannel value
39acd704ad51 testMode is now a ValueHolder
ca
parents: 113
diff changeset
   364
!
39acd704ad51 testMode is now a ValueHolder
ca
parents: 113
diff changeset
   365
39acd704ad51 testMode is now a ValueHolder
ca
parents: 113
diff changeset
   366
enabled:aState
39acd704ad51 testMode is now a ValueHolder
ca
parents: 113
diff changeset
   367
    "set the modification / test mode
39acd704ad51 testMode is now a ValueHolder
ca
parents: 113
diff changeset
   368
    "
39acd704ad51 testMode is now a ValueHolder
ca
parents: 113
diff changeset
   369
    (aState == enableChannel value) ifFalse:[
123
421d412e797b keep old selection before starting test and
ca
parents: 119
diff changeset
   370
        aState ifFalse:[
131
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
   371
            saveSelection := self selection.
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
   372
            self select:nil.
128
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
   373
            enableChannel value:aState.
140
1dde784a73d7 update specs; remove color and default values
ca
parents: 138
diff changeset
   374
            inputView unmap.
119
39acd704ad51 testMode is now a ValueHolder
ca
parents: 113
diff changeset
   375
        ] ifTrue:[
39acd704ad51 testMode is now a ValueHolder
ca
parents: 113
diff changeset
   376
            inputView raise.
123
421d412e797b keep old selection before starting test and
ca
parents: 119
diff changeset
   377
            inputView realize.
128
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
   378
            enableChannel value:aState.
123
421d412e797b keep old selection before starting test and
ca
parents: 119
diff changeset
   379
            self select:saveSelection.
421d412e797b keep old selection before starting test and
ca
parents: 119
diff changeset
   380
        ]
119
39acd704ad51 testMode is now a ValueHolder
ca
parents: 113
diff changeset
   381
    ]
39acd704ad51 testMode is now a ValueHolder
ca
parents: 113
diff changeset
   382
39acd704ad51 testMode is now a ValueHolder
ca
parents: 113
diff changeset
   383
39acd704ad51 testMode is now a ValueHolder
ca
parents: 113
diff changeset
   384
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   385
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   386
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 132
diff changeset
   387
resetModification
d5ab85ec27fd undo history; keep view identifier
ca
parents: 132
diff changeset
   388
    "set modification state to false
d5ab85ec27fd undo history; keep view identifier
ca
parents: 132
diff changeset
   389
    "
d5ab85ec27fd undo history; keep view identifier
ca
parents: 132
diff changeset
   390
    undoHistory resetModification
d5ab85ec27fd undo history; keep view identifier
ca
parents: 132
diff changeset
   391
!
d5ab85ec27fd undo history; keep view identifier
ca
parents: 132
diff changeset
   392
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   393
testMode
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   394
    "returns true if running test
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   395
    "
119
39acd704ad51 testMode is now a ValueHolder
ca
parents: 113
diff changeset
   396
    ^ enableChannel value not
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   397
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
testMode:aBoolean
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   402
    "change test mode
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   403
    "
119
39acd704ad51 testMode is now a ValueHolder
ca
parents: 113
diff changeset
   404
    self enabled:(aBoolean not)
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   405
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   406
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   407
!UIObjectView methodsFor:'blocked'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   408
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   409
addObject:anObject
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   410
    "add the argument, anObject to the contents - with redraw
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   411
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   412
    self halt
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   413
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   414
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   415
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   416
addObjectWithoutRedraw:anObject
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   417
    "add the argument, anObject to the contents - with redraw
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   418
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   419
    self halt
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   420
175
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   421
!
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   422
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   423
startCreate:aPoint
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   424
    self setDefaultActions.
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   425
    self halt
60
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
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   428
!UIObjectView methodsFor:'event handling'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   429
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   430
elementChangedSize:aView
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   431
    "some element has changed its size; collect them during selectionHiddenLevel 
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   432
     is on
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   433
    "
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   434
    selectionHiddenLevel ~~ 0 ifTrue:[
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   435
        setOfSuperViewsSizeChanged add:aView superView
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   436
    ] ifFalse:[
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   437
        aView superView sizeChanged:nil
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   438
    ]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   439
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   440
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   441
exposeX:x y:y width:w height:h
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   442
    "handle an expose event from device; redraw selection
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   443
    "
175
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   444
    resizeData isNil ifTrue:[
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   445
        super exposeX:x y:y width:w height:h.
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   446
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   447
        "/ handle any expose events (for subcomponents) before
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   448
        "/ redrawing the handles.
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   449
        (self sensor hasExposeEventFor:nil) ifTrue:[^ self].
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   450
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   451
        self selectionDo:[:aComponent |
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   452
            aComponent withAllSubViewsDo:[:v |
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   453
                self sensor flushExposeEventsFor:v.
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   454
                v exposeX:0 y:0 width:9999 height:9999.
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   455
            ].
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   456
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   457
            self showSelected:aComponent
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   458
        ]
132
8649766ce095 catch expose events for all subviews associated with
ca
parents: 131
diff changeset
   459
    ]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   460
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
keyPress:key x:x y:y
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   464
    "any key pressed
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   465
    "
78
a0a00603a8b6 keep spec in properties
ca
parents: 76
diff changeset
   466
    <resource: #keyboard ( #Delete #BackSpace #Cut #Copy #Paste ) >
60
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
    (key == #Cut or:[key == #Delete or:[key == #BackSpace]]) ifTrue: [
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   469
        ^ self deleteSelection
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
78
a0a00603a8b6 keep spec in properties
ca
parents: 76
diff changeset
   472
    key == #Copy  ifTrue:[ ^ self copySelection].
a0a00603a8b6 keep spec in properties
ca
parents: 76
diff changeset
   473
    key == #Paste ifTrue:[ ^ self pasteBuffer].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   474
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   475
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   476
processEvent:anEvent
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   477
    "catch expose events for components, and redraw its handles after
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   478
     the redraw when this happens
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   479
    "
128
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
   480
    (anEvent type == #damage and:[self isSelected:(anEvent view)]) ifTrue:[
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
   481
        self showSelected:(anEvent view)
60
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
    ^ false.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   484
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
!
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
sizeChanged:how
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   489
    "size of a view(s) changed
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   490
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   491
    self withSelectionHiddenDo:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   492
        super sizeChanged:how
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   493
    ]
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
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   496
! !
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
!UIObjectView methodsFor:'initialization'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   499
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   500
initialize
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   501
    "setup attributes
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   502
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   503
    super initialize.
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
    "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
   506
     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
   507
     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
   508
     is always on top
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
    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
   511
    setOfSuperViewsSizeChanged := IdentitySet new.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   512
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   513
    inputView eventReceiver:self.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   514
    inputView enableButtonEvents.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   515
    inputView enableButtonMotionEvents.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   516
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   517
    self setDefaultActions.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   518
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 132
diff changeset
   519
    undoHistory          := UndoHistory on:self.
119
39acd704ad51 testMode is now a ValueHolder
ca
parents: 113
diff changeset
   520
    enableChannel        := true asValue.
39acd704ad51 testMode is now a ValueHolder
ca
parents: 113
diff changeset
   521
    clipChildren         := true.
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   522
    selectionHiddenLevel := 0.
60
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 class gridShown) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   525
        super showGrid
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
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   528
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   529
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   530
realize
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   531
    super realize.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   532
    self windowGroup postEventHook:self
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   533
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   534
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   535
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   536
!UIObjectView methodsFor:'misc'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   537
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   538
cursor:aCursor
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   539
    "set cursor
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   540
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   541
    inputView realized ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   542
        inputView cursor:aCursor
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   543
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   544
    super cursor:aCursor
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   545
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   546
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   547
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   548
175
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   549
invertOutlineOf:something
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   550
    "invert outline of an object or collection of objects
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   551
    "
175
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   552
    |wasClipped p|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   553
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   554
    (wasClipped := clipChildren) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   555
        self clippedByChildren:(clipChildren := false).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   556
    ].
175
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   557
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   558
    something isCollection ifTrue:[
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   559
        something do:[:v|
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   560
            p := v originRelativeTo:self.
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   561
            self xoring:[self displayRectangle:(p extent:v extent)].
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   562
        ]
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   563
    ] ifFalse:[
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   564
        p := something originRelativeTo:self.
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   565
        self xoring:[self displayRectangle:(p extent:something extent)]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   566
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   567
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   568
    wasClipped ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   569
        self clippedByChildren:(clipChildren := true).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   570
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   571
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   572
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   573
78
a0a00603a8b6 keep spec in properties
ca
parents: 76
diff changeset
   574
minSetOfSuperViews:setOfViews
a0a00603a8b6 keep spec in properties
ca
parents: 76
diff changeset
   575
a0a00603a8b6 keep spec in properties
ca
parents: 76
diff changeset
   576
    setOfViews isCollection ifFalse:[
a0a00603a8b6 keep spec in properties
ca
parents: 76
diff changeset
   577
        setOfViews notNil ifTrue:[^ Array with:setOfViews]
a0a00603a8b6 keep spec in properties
ca
parents: 76
diff changeset
   578
                         ifFalse:[^ nil]
72
a5a7054e2b7d *** empty log message ***
ca
parents: 68
diff changeset
   579
    ].
78
a0a00603a8b6 keep spec in properties
ca
parents: 76
diff changeset
   580
  ^ setOfViews select:[:aView|
a0a00603a8b6 keep spec in properties
ca
parents: 76
diff changeset
   581
        (setOfViews detect:[:v|aView isComponentOf:v] ifNone:nil) isNil
a0a00603a8b6 keep spec in properties
ca
parents: 76
diff changeset
   582
    ]
72
a5a7054e2b7d *** empty log message ***
ca
parents: 68
diff changeset
   583
!
a5a7054e2b7d *** empty log message ***
ca
parents: 68
diff changeset
   584
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   585
setDefaultActions
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   586
    "set default actions
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   587
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   588
    pressAction      := [:pressPoint | self startSelectOrMove:pressPoint].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   589
    shiftPressAction := [:pressPoint | self startSelectMoreOrMove:pressPoint].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   590
    motionAction     := [:movePoint  | nil].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   591
    releaseAction    := [nil].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   592
    keyPressAction   := nil.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   593
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   594
    self cursor:Cursor normal.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   595
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   596
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   597
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   598
!UIObjectView methodsFor:'object moving'!
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
doObjectMove:aPoint
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   601
    "move selection
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
    movedObject notNil ifTrue:[
175
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   604
        self invertOutlineOf:movedObject.
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   605
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   606
        movedObject keysAndValuesDo:[:i :v|
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   607
            self moveObject:v to:(aPoint - (moveDelta at:i)).
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   608
        ].
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   609
        self invertOutlineOf:movedObject.
60
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
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   612
!
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
endObjectMove
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   615
    "cleanup after object(s) move
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   616
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   617
    movedObject notNil ifTrue:[
175
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   618
        self invertOutlineOf:movedObject.
128
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
   619
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
   620
        movedObject size == 1 ifTrue:[
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
   621
            movedObject := movedObject first
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   622
        ].
128
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
   623
        self setSelection:movedObject withRedraw:true.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   624
        movedObject := nil.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   625
        self setDefaultActions.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   626
        self changed:#layout.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   627
    ].
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
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   630
moveObject:anObject to:aPoint
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   631
    "move anObject to newOrigin, aPoint
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   632
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   633
    |dX dY org delta|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   634
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   635
    anObject notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   636
        org := anObject computeOrigin.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   637
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   638
        delta := aPoint - org.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   639
        delta := (self alignToGrid:aPoint) - org.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   640
        dX := delta x.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   641
        dY := delta y.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   642
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 132
diff changeset
   643
        undoHistory withoutTransactionDo:[
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   644
            self shiftLayout:anObject top:dY bottom:dY left:dX right:dX
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
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   647
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   648
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   649
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   650
startObjectMoveAt:aPoint
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   651
    "start object(s) move at a point
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   652
    "
128
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
   653
    self startObjectMove:(self selection) at:aPoint.
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
   654
    movedObject := self selection.
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
   655
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
   656
    movedObject isCollection ifFalse:[
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
   657
        movedObject := Array with:movedObject
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   658
    ].
128
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
   659
    self setSelection:nil withRedraw:true.
60
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
    moveDelta := movedObject collect:[:aView|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   662
        aPoint - aView computeOrigin
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   663
    ].
175
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   664
    self transaction:#move objects:movedObject do:[:v|self createUndoLayout:v].
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   665
    self invertOutlineOf:movedObject.
60
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
startSelectMoreOrMove:aPoint
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   669
    "add/remove to/from selection"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   670
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   671
    |anObject|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   672
119
39acd704ad51 testMode is now a ValueHolder
ca
parents: 113
diff changeset
   673
    self enabled ifFalse:[^ self].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   674
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   675
    anObject := self findObjectAt:aPoint.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   676
    anObject notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   677
        (self isSelected:anObject) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   678
            self removeFromSelection:anObject
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   679
        ] ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   680
            self addToSelection:anObject
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   681
        ]
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
startSelectOrMove:aPoint
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   686
    "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
   687
    "
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   688
    |aView b|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   689
119
39acd704ad51 testMode is now a ValueHolder
ca
parents: 113
diff changeset
   690
    self enabled ifFalse:[^ self].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   691
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   692
    aView := self singleSelection.
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   693
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   694
    aView notNil ifTrue:[
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   695
        (aView superView specClass canResizeSubComponents) ifTrue:[
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   696
            b := self whichHandleOf:aView isHitBy:aPoint.
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   697
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   698
            (b notNil and:[b ~~ #view]) ifTrue:[
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   699
                ^ self startResizeBorder:b of:aView.
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   700
            ]
100
01775d3d8489 startSelectOrMove:aPoint
ca
parents: 99
diff changeset
   701
        ].
01775d3d8489 startSelectOrMove:aPoint
ca
parents: 99
diff changeset
   702
01775d3d8489 startSelectOrMove:aPoint
ca
parents: 99
diff changeset
   703
        (self sensor ctrlDown and:[self canMove:aView]) ifFalse:[
01775d3d8489 startSelectOrMove:aPoint
ca
parents: 99
diff changeset
   704
            aView := nil
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   705
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   706
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   707
100
01775d3d8489 startSelectOrMove:aPoint
ca
parents: 99
diff changeset
   708
    aView isNil ifTrue:[
01775d3d8489 startSelectOrMove:aPoint
ca
parents: 99
diff changeset
   709
        (aView := self findObjectAt:aPoint) isNil ifTrue:[
131
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
   710
            ^ self select:nil
100
01775d3d8489 startSelectOrMove:aPoint
ca
parents: 99
diff changeset
   711
        ].
01775d3d8489 startSelectOrMove:aPoint
ca
parents: 99
diff changeset
   712
01775d3d8489 startSelectOrMove:aPoint
ca
parents: 99
diff changeset
   713
        (self canMove:aView) ifFalse:[
128
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
   714
            ^ self select:aView
100
01775d3d8489 startSelectOrMove:aPoint
ca
parents: 99
diff changeset
   715
        ]
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   716
    ].
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   717
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   718
    (self isSelected:aView) ifFalse:[
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   719
        self select:aView.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   720
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   721
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   722
    (self numberOfSelections ~~ 1) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   723
        releaseAction := [
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   724
            self setDefaultActions.
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   725
            self select:aView
60
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
    ] ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   728
        releaseAction := [self setDefaultActions]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   729
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   730
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   731
    "prepare move operation for an object
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   732
    "
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   733
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   734
    motionAction := [:movePoint|
72
a5a7054e2b7d *** empty log message ***
ca
parents: 68
diff changeset
   735
        (aPoint dist:movePoint) > 8.0 ifTrue:[
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   736
            self startObjectMoveAt:aPoint
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
    ].
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
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   741
!UIObjectView methodsFor:'object 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
actionResize:anObject selector:aSelector
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   744
    "create and initialize action for resize
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   745
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   746
    |selector delta|
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
    delta    := anObject container originRelativeTo:self.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   749
    selector := ('resize:', aSelector, ':') asSymbol.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   750
175
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   751
    resizeData := Structure with:(#object->anObject)
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   752
                            with:(#selector->selector)
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   753
                            with:(#delta->delta).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   754
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   755
"can change cursor dependent on vertical/horizontal resizing
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
    oldCursor := cursor.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   758
    self cursor:(Cursor leftHand).
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
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   762
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   763
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   764
doDragResize:aPoint
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   765
    "do a widget resize drag
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   766
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   767
    |p object|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   768
175
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   769
    object := resizeData object.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   770
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   771
    self invertOutlineOf:object.
175
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   772
    p := (self alignToGrid:aPoint) - (resizeData delta).
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   773
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   774
    self perform:(resizeData selector) with:object with:p.
79
33212fbe9766 resize extent
ca
parents: 78
diff changeset
   775
   "/ object geometryLayout:(object geometryLayout).
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   776
    self invertOutlineOf:object
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   777
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   778
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   779
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   780
endResize
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   781
    "cleanup after object resize
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   782
    "
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   783
    |object|
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   784
175
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   785
    object := resizeData object.
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   786
    resizeData := nil.
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   787
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   788
    self invertOutlineOf:object.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   789
    self setDefaultActions.
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   790
    self elementChangedSize:object.
138
ca
parents: 134
diff changeset
   791
ca
parents: 134
diff changeset
   792
    "/ handle any expose events (for subcomponents) before
ca
parents: 134
diff changeset
   793
    "/ redrawing the handles.
ca
parents: 134
diff changeset
   794
    Delay waitForSeconds:0.05.
ca
parents: 134
diff changeset
   795
    [self sensor hasExposeEventFor:nil] whileTrue:[
ca
parents: 134
diff changeset
   796
        self windowGroup processExposeEvents
ca
parents: 134
diff changeset
   797
    ].
ca
parents: 134
diff changeset
   798
128
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
   799
    self setSelection:object withRedraw:true.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   800
    self changed:#layout.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   801
!
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
startResizeBorder:b of:selection
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   804
    "resize selected view
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   805
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   806
    |object|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   807
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   808
    object := self singleSelection.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   809
    self actionResize:object selector:b.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   810
72
a5a7054e2b7d *** empty log message ***
ca
parents: 68
diff changeset
   811
    self transaction:#resize selectionDo:[:aView|
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 132
diff changeset
   812
        self createUndoLayout:aView
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   813
    ].
128
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
   814
    self setSelection:nil withRedraw:true.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   815
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   816
    motionAction  := [:movePoint | self doDragResize:movePoint].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   817
    releaseAction := [self endResize].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   818
    self invertOutlineOf:object
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   819
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   820
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   821
!UIObjectView methodsFor:'private handles'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   822
175
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   823
handlesOf:aComponent do:aTwoArgAction
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   824
    "perform action on each handle of a component
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   825
    "
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   826
    |dlt ext|
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   827
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   828
    dlt := (aComponent originRelativeTo:self) - aComponent origin.
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   829
    dlt := dlt - (3@3).
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   830
    ext := 6@6.
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   831
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   832
    self class handlesOf:aComponent do:[:pnt :wht |
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   833
        aTwoArgAction value:(pnt + dlt extent:ext) value:wht
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   834
    ]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   835
!
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
showSelected:aComponent
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   838
    "show object selected
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   839
    "
175
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   840
    |wasClipped|
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   841
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   842
    selectionHiddenLevel == 0 ifTrue:[
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   843
        self paint:Color black.
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   844
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   845
        (wasClipped := clipChildren) ifTrue:[
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   846
            self clippedByChildren:(clipChildren := false). 
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   847
        ].
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   848
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   849
        self handlesOf:aComponent do:[:rectangle :what|
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   850
            what == #view ifTrue:[self displayRectangle:rectangle]
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   851
                         ifFalse:[self fillRectangle:rectangle]
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   852
        ].
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   853
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   854
        wasClipped ifTrue:[
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   855
            self clippedByChildren:(clipChildren := true).
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   856
        ]
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   857
    ]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   858
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   859
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   860
showUnselected:aComponent
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   861
    "show object unselected
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   862
    "
132
8649766ce095 catch expose events for all subviews associated with
ca
parents: 131
diff changeset
   863
    |wasClipped delta r|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   864
138
ca
parents: 134
diff changeset
   865
    selectionHiddenLevel ~~ 0 ifTrue:[^ self].
ca
parents: 134
diff changeset
   866
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   867
    (wasClipped := clipChildren) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   868
        self clippedByChildren:(clipChildren := false). 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   869
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   870
175
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   871
    self handlesOf:aComponent do:[:rec :wht| self clearRectangle:rec ].
60
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
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   877
    "/ must redraw all components which are affected b the handles
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   878
175
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   879
    r := (aComponent originRelativeTo:self) - (3@3) extent:(aComponent extent + (6@6)).
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   880
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   881
    subViews do:[:anotherComponent |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   882
        |absOrg absFrame|
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
        anotherComponent ~~ inputView ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   885
            absOrg := anotherComponent originRelativeTo:self.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   886
            absFrame := absOrg extent:(anotherComponent extent).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   887
            (absFrame intersects:r) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   888
                anotherComponent withAllSubViewsDo:[:v |
95
c20189d75ec3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 91
diff changeset
   889
                    v shown ifTrue:[
132
8649766ce095 catch expose events for all subviews associated with
ca
parents: 131
diff changeset
   890
                        v fill:v viewBackground.
95
c20189d75ec3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 91
diff changeset
   891
                        v exposeX:0 y:0 width:9999 height:9999.
c20189d75ec3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 91
diff changeset
   892
                    ]
60
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
            ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   895
        ]
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
95
c20189d75ec3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 91
diff changeset
   898
    "Modified: 8.4.1997 / 00:32:26 / cg"
60
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
175
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   901
whichHandleOf:aComponent isHitBy:aPoint
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   902
    "returns kind of handle or nil
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   903
    "
175
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   904
    self handlesOf:aComponent do:[:rectangle :what|
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   905
        (rectangle containsPoint:aPoint) ifTrue:[^ what]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   906
    ].
175
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   907
  ^ nil
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   908
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   909
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   910
!UIObjectView methodsFor:'private resizing-subviews'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   911
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   912
resize:aView bottom:aPoint
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   913
    "resize a views bottom
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   914
    "
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 132
diff changeset
   915
    undoHistory withoutTransactionDo:[
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   916
        self shiftLayout:aView top:0 bottom:((aPoint y) - (aView computeCorner y))
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
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   920
resize:aView bottomLeft:aPoint
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   921
    "resize a views bottom and left
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   922
    "
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 132
diff changeset
   923
    undoHistory withoutTransactionDo:[
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   924
        self shiftLayout:aView top:0
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   925
                            bottom:((aPoint y) - (aView computeCorner y))
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   926
                              left:((aPoint x) - (aView computeOrigin x))
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   927
                             right:0
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   928
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   929
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   930
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
resize:aView corner:aPoint
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   935
    "resize a views corner
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   936
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   937
    |delta|
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
    delta := aPoint - aView computeCorner.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   940
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 132
diff changeset
   941
    undoHistory withoutTransactionDo:[
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   942
        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
   943
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   944
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   945
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   946
resize:aView left:aPoint
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   947
    "resize a views left
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   948
    "
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 132
diff changeset
   949
    undoHistory withoutTransactionDo:[
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   950
        self shiftLayout:aView left:((aPoint x) - (aView computeOrigin x)) right:0
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   951
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   952
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   953
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   954
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   955
resize:aView origin:aPoint
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   956
    "resize a views origin
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   957
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   958
    |delta|
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
    delta := aPoint - aView computeOrigin.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   961
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 132
diff changeset
   962
    undoHistory withoutTransactionDo:[
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   963
        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
   964
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   965
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   966
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   967
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   968
resize:aView right:aPoint
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   969
    "resize a views right
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   970
    "
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 132
diff changeset
   971
    undoHistory withoutTransactionDo:[
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   972
        self shiftLayout:aView left:0 right:((aPoint x) - (aView computeCorner 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 top:aPoint
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   977
    "resize a views top
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   978
    "
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 132
diff changeset
   979
    undoHistory withoutTransactionDo:[
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   980
        self shiftLayout:aView top:((aPoint y) - (aView computeOrigin y)) bottom: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
resize:aView topRight:aPoint
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   985
    "resize a views top and right
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   986
    "
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 132
diff changeset
   987
    undoHistory withoutTransactionDo:[
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   988
        self shiftLayout:aView top:((aPoint y) - (aView computeOrigin y))
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   989
                            bottom:0
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   990
                              left:0
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   991
                             right:((aPoint x) - (aView computeCorner x))
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   992
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   993
    ]
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
!UIObjectView methodsFor:'private shift-layout'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   998
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   999
shiftLayout:aView left:l right:r
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1000
    "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
  1001
     action is registered
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1002
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1003
    self shiftLayout:aView top:0 bottom:0 left:l right:r
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
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1007
shiftLayout:aView top:t bottom:b
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1008
    "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
  1009
     action is registered
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1010
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1011
    self shiftLayout:aView top:t bottom:b left:0 right:0
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
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1015
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1016
shiftLayout:aView top:t bottom:b left:l right:r
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1017
    "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
  1018
     action is registered
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1019
    "
79
33212fbe9766 resize extent
ca
parents: 78
diff changeset
  1020
    |type layout oldExt|
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1021
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1022
    type := self class layoutType:aView.
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1023
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1024
    type notNil ifTrue:[
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 132
diff changeset
  1025
        self createUndoLayout:aView.
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1026
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1027
        type == #Extent ifTrue:[
79
33212fbe9766 resize extent
ca
parents: 78
diff changeset
  1028
            oldExt := aView extent.
33212fbe9766 resize extent
ca
parents: 78
diff changeset
  1029
            aView extent:(oldExt + ((r-l) @ (b-t))).
33212fbe9766 resize extent
ca
parents: 78
diff changeset
  1030
            ^ self 
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1031
        ].
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1032
78
a0a00603a8b6 keep spec in properties
ca
parents: 76
diff changeset
  1033
        layout := aView geometryLayout copy.
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1034
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1035
        layout isLayout ifTrue:[
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1036
            layout leftOffset:(layout leftOffset + l)
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1037
                    topOffset:(layout topOffset  + t).
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1038
                    
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1039
            type == #LayoutFrame ifTrue:[
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1040
                layout bottomOffset:(layout bottomOffset + b).
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1041
                layout  rightOffset:(layout rightOffset  + r).
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1042
            ]
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1043
        ] ifFalse:[
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1044
            type == #Rectangle ifTrue:[
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1045
                layout left:(layout left   + l)
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1046
                      right:(layout right  + r)
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1047
                        top:(layout top    + t)
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1048
                     bottom:(layout bottom + b).
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1049
            ] ifFalse:[     "POINT"
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1050
                layout x:(layout x + l) y:(layout y + t).
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1051
            ]
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1052
        ].
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1053
        aView geometryLayout:layout
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1054
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1055
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1056
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1057
!UIObjectView methodsFor:'searching'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1058
89
35c5711729c2 so far so good
ca
parents: 84
diff changeset
  1059
findContainerViewAt:aPoint
35c5711729c2 so far so good
ca
parents: 84
diff changeset
  1060
    "find container view responds to aPoint.
35c5711729c2 so far so good
ca
parents: 84
diff changeset
  1061
    "
35c5711729c2 so far so good
ca
parents: 84
diff changeset
  1062
    ^ self subclassResponsibility
35c5711729c2 so far so good
ca
parents: 84
diff changeset
  1063
35c5711729c2 so far so good
ca
parents: 84
diff changeset
  1064
35c5711729c2 so far so good
ca
parents: 84
diff changeset
  1065
!
35c5711729c2 so far so good
ca
parents: 84
diff changeset
  1066
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1067
findObjectAt:aPoint
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1068
    "find the origin/corner of the currentWidget
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1069
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1070
    |view viewId lastId point listOfViews|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1071
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1072
    viewId := rootView id.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1073
    point  := aPoint + (device translatePoint:0@0 from:(self id) to:viewId).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1074
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1075
    inputView lower.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1076
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1077
    [viewId notNil] whileTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1078
        lastId := viewId.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1079
        viewId := device viewIdFromPoint:point in:lastId
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1080
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1081
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1082
    inputView raise.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1083
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1084
    view := device viewFromId:lastId.
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
    view ~~ inputView ifTrue:[^ view].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1087
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1088
    "/ look for 'hidden' views ...
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1089
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1090
    listOfViews := OrderedCollection new.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1091
    self allSubViewsDo:[:aView |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1092
        |org|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1093
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1094
        aView ~~ inputView ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1095
            org := device translatePoint:0@0 from:(aView id) to:self id.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1096
            ((org extent:aView extent) containsPoint:aPoint) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1097
                listOfViews add:aView.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1098
            ]
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
    ].
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
    listOfViews size > 0 ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1103
        ^ listOfViews last
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
    ^ nil
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
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1108
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1109
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1110
!UIObjectView methodsFor:'selections'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1111
128
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
  1112
moveableSelection
131
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1113
    "checks whether the selection is not empty and all selected instances
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1114
     can be moved. If true the selection is returned otherwise nil
128
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
  1115
    "
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
  1116
    |coll|
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
  1117
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
  1118
    self hasSelection ifTrue:[
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
  1119
        (self canMove:(coll := self selection)) ifTrue:[
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
  1120
            ^ coll
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
  1121
        ]
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
  1122
    ].
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
  1123
  ^ nil
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
  1124
!
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
  1125
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1126
numberOfSelections
131
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1127
    "return the number of selected instances
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1128
    "
128
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
  1129
    |coll size|
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
  1130
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
  1131
    coll := self selection.
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
  1132
    size := coll size.
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
  1133
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
  1134
    (size ~~ 0 or:[coll isNil]) ifTrue:[^ size].
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
  1135
  ^ 1
60
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
select:something
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1139
    "change selection to something
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1140
    "
128
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
  1141
    (self enabled and:[something ~= self selection]) ifTrue:[
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
  1142
        self setSelection:something withRedraw:true.
113
1854c2e61c4e bug fixes
ca
parents: 100
diff changeset
  1143
        self selectionChanged
60
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
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
149
e652608690b1 help ...
ca
parents: 145
diff changeset
  1148
selection:something
e652608690b1 help ...
ca
parents: 145
diff changeset
  1149
    "change selection to something
e652608690b1 help ...
ca
parents: 145
diff changeset
  1150
    "
e652608690b1 help ...
ca
parents: 145
diff changeset
  1151
    self select:something
e652608690b1 help ...
ca
parents: 145
diff changeset
  1152
!
e652608690b1 help ...
ca
parents: 145
diff changeset
  1153
113
1854c2e61c4e bug fixes
ca
parents: 100
diff changeset
  1154
selectionChanged
1854c2e61c4e bug fixes
ca
parents: 100
diff changeset
  1155
    "called whenever the selection changed
1854c2e61c4e bug fixes
ca
parents: 100
diff changeset
  1156
    "
1854c2e61c4e bug fixes
ca
parents: 100
diff changeset
  1157
    self subclassResponsibility
1854c2e61c4e bug fixes
ca
parents: 100
diff changeset
  1158
1854c2e61c4e bug fixes
ca
parents: 100
diff changeset
  1159
!
1854c2e61c4e bug fixes
ca
parents: 100
diff changeset
  1160
128
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
  1161
selectionDo:aBlock
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
  1162
    "apply block to every selected object
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
  1163
    "
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
  1164
    self forEach:(self selection) do:aBlock
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
  1165
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
  1166
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
  1167
!
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
  1168
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1169
showSelection
128
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
  1170
    "show the selection - draw handles
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
  1171
    "
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1172
    selectionHiddenLevel == 0 ifTrue:[
128
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
  1173
        self selectionDo:[:el| self showSelected:el ]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1174
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1175
!
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
singleSelection
131
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1178
    "checks whether one element is selected; in this case the element is
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1179
     returned otherwise nil
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1180
    "
128
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
  1181
    |coll|
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
  1182
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
  1183
    (coll := self selection) isCollection ifFalse:[
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
  1184
        ^ coll
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1185
    ].
128
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
  1186
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
  1187
    coll size == 1 ifTrue:[ ^ coll first].
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
  1188
  ^ nil
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1189
!
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
singleSelectionDo:aBlock
131
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1192
    "checks whether one element is selected; in this case the block
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1193
     with argument the selected instance will be processed
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1194
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1195
    |view|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1196
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1197
    (view := self singleSelection) notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1198
        aBlock value:view
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
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1201
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1202
unselect
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1203
    "clear selection
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1204
    "
128
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
  1205
    self select:nil
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1206
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1207
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1208
withSelectionHiddenDo:aBlock
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1209
    "apply block with selection hidden (no handles)
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1210
    "
78
a0a00603a8b6 keep spec in properties
ca
parents: 76
diff changeset
  1211
    |coll|
a0a00603a8b6 keep spec in properties
ca
parents: 76
diff changeset
  1212
138
ca
parents: 134
diff changeset
  1213
    selectionHiddenLevel == 0 ifTrue:[
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1214
        self selectionDo:[:aView| self showUnselected:aView].
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1215
        device flush.
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1216
    ].
138
ca
parents: 134
diff changeset
  1217
    selectionHiddenLevel := selectionHiddenLevel + 1.
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1218
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1219
    aBlock valueNowOrOnUnwindDo:[
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1220
        selectionHiddenLevel == 1 ifTrue:[
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1221
            setOfSuperViewsSizeChanged notEmpty ifTrue:[
78
a0a00603a8b6 keep spec in properties
ca
parents: 76
diff changeset
  1222
                coll := self minSetOfSuperViews:setOfSuperViewsSizeChanged.
a0a00603a8b6 keep spec in properties
ca
parents: 76
diff changeset
  1223
                coll do:[:aView| aView sizeChanged:nil].
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1224
                setOfSuperViewsSizeChanged := IdentitySet new
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1225
            ].
138
ca
parents: 134
diff changeset
  1226
            selectionHiddenLevel := 0.
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1227
            self selectionDo:[:aView| self showSelected:aView].
138
ca
parents: 134
diff changeset
  1228
        ] ifFalse:[
ca
parents: 134
diff changeset
  1229
            selectionHiddenLevel := selectionHiddenLevel - 1.
ca
parents: 134
diff changeset
  1230
        ]
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1231
    ]
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1232
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1233
!
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1234
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1235
withoutSelectionDo:aBlock
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1236
    "evaluate aBlock while selection is nilled
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1237
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1238
    |sel|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1239
128
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
  1240
    self hasSelection ifFalse:[
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1241
        aBlock value
128
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
  1242
    ] ifTrue:[
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
  1243
        sel := self selection.
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
  1244
        self setSelection:nil withRedraw:true.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1245
        aBlock value.
128
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
  1246
        self setSelection:sel withRedraw:true.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1247
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1248
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1249
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
131
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1252
!UIObjectView methodsFor:'selections basic'!
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1253
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1254
addToSelection:anObject
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1255
    "add an object to the selection
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1256
    "
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1257
    (self enabled and:[(self isSelected:anObject) not]) ifTrue:[
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1258
        selection isCollection ifFalse:[
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1259
            selection isNil ifTrue:[
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1260
                selection := anObject
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1261
            ] ifFalse:[
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1262
                selection := OrderedCollection with:selection with:anObject
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1263
            ]
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1264
        ] ifTrue:[
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1265
            selection add:anObject
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1266
        ].
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1267
        self showSelected:anObject.
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1268
        self selectionChanged.
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1269
    ]
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1270
!
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1271
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1272
removeFromSelection:anObject
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1273
    "remove an object from the selection
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1274
    "
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1275
    (self isSelected:anObject) ifTrue:[
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1276
        self showUnselected:anObject.
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1277
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1278
        selection size > 1 ifTrue:[
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1279
            selection remove:anObject ifAbsent:nil.
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1280
            self showSelection.
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1281
        ] ifFalse:[
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1282
            selection := nil
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1283
        ].
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1284
        self selectionChanged.
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1285
    ]
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1286
!
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1287
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1288
selection
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1289
    "returns the current selection
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1290
    "
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1291
    ^ selection
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1292
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1293
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1294
!
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1295
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1296
setSelection:aNewSelection withRedraw:doRedraw
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1297
    "set a new selection without change notifications
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1298
    "
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1299
    doRedraw ifTrue:[
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1300
        self hideSelection.
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1301
        selection := aNewSelection.
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1302
        self showSelection
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1303
    ] ifFalse:[
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1304
        selection := aNewSelection
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1305
    ]
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1306
! !
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
  1307
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1308
!UIObjectView methodsFor:'testing'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1309
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1310
canMove:something
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1311
    "returns always true; all contained views can be moved
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1312
    "
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1313
    |sv|
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1314
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1315
    something notNil ifTrue:[
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1316
        self forEach:something do:[:v|
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1317
            sv ~~ v superView ifTrue:[
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1318
                (sv notNil or:[v superView specClass isLayoutContainer]) ifTrue:[
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1319
                    ^ false
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1320
                ].
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1321
                sv := v superView
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1322
            ]
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1323
        ].
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1324
        ^ true
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1325
    ].
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1326
    ^ false
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1327
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1328
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1329
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1330
canPaste:something
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1331
    "returns true if something could be paste
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1332
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1333
    something notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1334
        something isCollection ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1335
            something notEmpty ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1336
                ^ (something at:1) isKindOf:UISpecification
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1337
            ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1338
        ] ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1339
            ^ something isKindOf:UISpecification
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1340
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1341
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1342
    ^ false
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1343
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1344
!