UIObjectView.st
author Claus Gittinger <cg@exept.de>
Tue, 28 Nov 2017 16:10:04 +0100
changeset 3505 a7aec486480c
parent 3473 3449a8a8aecc
child 3548 e0f85c2db0f9
permissions -rw-r--r--
#BUGFIX by cg class: ImageEditor changed: #colorMapMode:
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
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1112
diff changeset
     3
	      All Rights Reserved
156
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
"
1399
a0687f5e1f54 category changes
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
    12
"{ Package: 'stx:libtool2' }"
a0687f5e1f54 category changes
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
    13
3219
2395b33f653e class: UIObjectView
Claus Gittinger <cg@exept.de>
parents: 3143
diff changeset
    14
"{ NameSpace: Smalltalk }"
2395b33f653e class: UIObjectView
Claus Gittinger <cg@exept.de>
parents: 3143
diff changeset
    15
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    16
ObjectView subclass:#UIObjectView
1672
5e89f5959780 no longer use InputView
ca
parents: 1581
diff changeset
    17
	instanceVariableNames:'saveSelection undoHistory copiedExtent copiedLayout resizeData
5e89f5959780 no longer use InputView
ca
parents: 1581
diff changeset
    18
		clipChildren selectionHiddenLevel gridParameters
3219
2395b33f653e class: UIObjectView
Claus Gittinger <cg@exept.de>
parents: 3143
diff changeset
    19
		setOfSuperViewsSizeChanged hasUndoHistoryHolder
2395b33f653e class: UIObjectView
Claus Gittinger <cg@exept.de>
parents: 3143
diff changeset
    20
		nPixelsForMoveSelection'
2364
121c79884983 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2356
diff changeset
    21
	classVariableNames:'CopiedLayout CopiedExtent'
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    22
	poolDictionaries:''
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    23
	category:'Interface-UIPainter'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    24
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    25
1672
5e89f5959780 no longer use InputView
ca
parents: 1581
diff changeset
    26
Object subclass:#PostEventHandler
5e89f5959780 no longer use InputView
ca
parents: 1581
diff changeset
    27
	instanceVariableNames:'onView'
5e89f5959780 no longer use InputView
ca
parents: 1581
diff changeset
    28
	classVariableNames:''
5e89f5959780 no longer use InputView
ca
parents: 1581
diff changeset
    29
	poolDictionaries:''
5e89f5959780 no longer use InputView
ca
parents: 1581
diff changeset
    30
	privateIn:UIObjectView
5e89f5959780 no longer use InputView
ca
parents: 1581
diff changeset
    31
!
5e89f5959780 no longer use InputView
ca
parents: 1581
diff changeset
    32
1437
daaf701ab6a2 *** empty log message ***
ca
parents: 1427
diff changeset
    33
Object subclass:#ResizeData
2536
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
    34
	instanceVariableNames:'object selector checkForChangeSelector delta'
1437
daaf701ab6a2 *** empty log message ***
ca
parents: 1427
diff changeset
    35
	classVariableNames:''
daaf701ab6a2 *** empty log message ***
ca
parents: 1427
diff changeset
    36
	poolDictionaries:''
daaf701ab6a2 *** empty log message ***
ca
parents: 1427
diff changeset
    37
	privateIn:UIObjectView
daaf701ab6a2 *** empty log message ***
ca
parents: 1427
diff changeset
    38
!
daaf701ab6a2 *** empty log message ***
ca
parents: 1427
diff changeset
    39
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    40
Object subclass:#UndoHistory
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 132
diff changeset
    41
	instanceVariableNames:'startIdentifier identifier painter history transaction enabled'
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    42
	classVariableNames:''
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    43
	poolDictionaries:''
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    44
	privateIn:UIObjectView
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    45
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    46
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
    47
Object subclass:#Transaction
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 132
diff changeset
    48
	instanceVariableNames:'identifier type text actions'
54
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
    49
	classVariableNames:''
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
    50
	poolDictionaries:''
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
    51
	privateIn:UIObjectView::UndoHistory
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
    52
!
d0b5a33e6df0 *** empty log message ***
ca
parents: 52
diff changeset
    53
128
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
    54
!UIObjectView class methodsFor:'documentation'!
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
    55
156
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    56
copyright
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    57
"
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    58
 COPYRIGHT (c) 1995 by eXept Software AG
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1112
diff changeset
    59
	      All Rights Reserved
156
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    60
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    61
 This software is furnished under a license and may be used
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    62
 only in accordance with the terms of that license and with the
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    63
 inclusion of the above copyright notice.   This software may not
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    64
 be provided or otherwise made available to, or used by, any
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    65
 other person.  No title to or ownership of the software is
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    66
 hereby transferred.
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    67
"
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    68
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    69
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    70
!
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    71
128
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
    72
documentation
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
    73
"
131
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
    74
    buildIn view used by the UIPainter; it provides all services for creating, deleting
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
    75
    moving and changing layouts of painted components on a canvas.
128
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
    76
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
    77
    [see also:]
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1112
diff changeset
    78
	UIBuilder
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1112
diff changeset
    79
	UIPainterView
156
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    80
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    81
    [author:]
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1112
diff changeset
    82
	Claus Atzkern
128
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
    83
"
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
    84
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
    85
! !
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    86
63
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
    87
!UIObjectView class methodsFor:'conversion'!
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
    88
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
    89
asLayoutFrameFromView:aView
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
    90
    "convert layout from aView to a frameLayout. On success the frameLayout is
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
    91
     returned otherwise nil
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
    92
    "
68
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    93
    |lF lO rF rO tF tO bF bO type layout newLyt|
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    94
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    95
    type   := self layoutType:aView.
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    96
    layout := aView geometryLayout.
889c3877baf0 layout ....
ca
parents: 67
diff changeset
    97
91
86d0c649f95e extent -> layout
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
    98
    layout isNil ifTrue:[
1581
d7afe06ebbae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
    99
        type == #Extent ifTrue:[
d7afe06ebbae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
   100
            layout := aView bounds asLayout
d7afe06ebbae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
   101
        ]
91
86d0c649f95e extent -> layout
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   102
    ].
86d0c649f95e extent -> layout
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   103
68
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   104
    (type isNil or:[layout isNil]) ifTrue:[
1581
d7afe06ebbae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
   105
        ^ nil
63
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
   106
    ].
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
   107
68
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   108
    type == #LayoutFrame ifTrue:[
1581
d7afe06ebbae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
   109
        ^ layout copy
68
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   110
    ].
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   111
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   112
    layout isLayout ifFalse:[
1581
d7afe06ebbae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
   113
        type == #Rectangle ifTrue:[
d7afe06ebbae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
   114
            lO := layout left.
d7afe06ebbae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
   115
            tO := layout top.
d7afe06ebbae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
   116
            rO := layout right.
d7afe06ebbae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
   117
            bO := layout bottom.
d7afe06ebbae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
   118
        ] ifFalse:[
d7afe06ebbae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
   119
            lO := layout x.
d7afe06ebbae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
   120
            tO := layout y.
d7afe06ebbae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
   121
            rO := lO + aView extent x.
d7afe06ebbae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
   122
            bO := tO + aView extent y.
d7afe06ebbae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
   123
        ].
d7afe06ebbae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
   124
d7afe06ebbae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
   125
        ^ LayoutFrame 
d7afe06ebbae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
   126
                leftFraction:0 offset:lO  
d7afe06ebbae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
   127
                rightFraction:0 offset:rO
d7afe06ebbae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
   128
                topFraction:0 offset:tO 
d7afe06ebbae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
   129
                bottomFraction:0 offset:bO
63
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
   130
    ].
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
   131
68
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   132
    lF := layout leftFraction.
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   133
    lO := layout leftOffset.
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   134
    tF := layout topFraction.
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   135
    tO := layout topOffset.
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   136
    bF := tF.
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   137
    bO := tO + aView extent y.
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   138
    rF := lF.
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   139
    rO := lO + aView extent x.
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   140
1581
d7afe06ebbae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
   141
    newLyt := LayoutFrame 
d7afe06ebbae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
   142
                leftFraction:lF offset:lO  
d7afe06ebbae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
   143
                rightFraction:rF offset:rO
d7afe06ebbae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
   144
                topFraction:tF offset:tO 
d7afe06ebbae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
   145
                bottomFraction:bF offset:bO.
68
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   146
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   147
    (    (type == #AlignmentOrigin)
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   148
     and:[layout leftAlignmentFraction ~~ 0
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   149
      or:[layout topAlignmentFraction  ~~ 0]]
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   150
    ) ifTrue:[
1581
d7afe06ebbae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
   151
        |svRc prBd dlta|
d7afe06ebbae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
   152
d7afe06ebbae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
   153
        svRc := aView superView viewRectangle.
d7afe06ebbae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
   154
        prBd := aView preferredBounds.
d7afe06ebbae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
   155
        dlta := (  ((layout rectangleRelativeTo:svRc preferred:prBd) corner)
d7afe06ebbae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
   156
                 - ((newLyt rectangleRelativeTo:svRc preferred:prBd) corner)
d7afe06ebbae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
   157
                ) rounded.
d7afe06ebbae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
   158
d7afe06ebbae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
   159
        newLyt 
d7afe06ebbae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
   160
            leftOffset:(lO + dlta x)
d7afe06ebbae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
   161
            rightOffset:(rO + dlta x)
d7afe06ebbae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
   162
            topOffset:(tO + dlta y)
d7afe06ebbae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
   163
            bottomOffset:(bO + dlta y).
68
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   164
    ].
889c3877baf0 layout ....
ca
parents: 67
diff changeset
   165
  ^ newLyt.
91
86d0c649f95e extent -> layout
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   166
86d0c649f95e extent -> layout
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   167
    "Modified: 28.3.1997 / 19:52:48 / cg"
63
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
   168
! !
6714daee4b26 checkin from browser
ca
parents: 61
diff changeset
   169
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   170
!UIObjectView class methodsFor:'defaults'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   171
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   172
defaultGrid
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   173
    ^ 4 @ 4
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   174
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   175
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   176
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   177
gridShown
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   178
    ^ false
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   179
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   180
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   181
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   182
handleSize
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   183
    "size of blob drawn for handles"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   184
    ^ 4
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   185
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   186
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   187
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   188
hitDelta
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   189
    ^ 4
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   190
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   191
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   192
175
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   193
!UIObjectView class methodsFor:'handles'!
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   194
2510
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   195
handlesOf:aViewOrComponent do:aBlock
175
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   196
    |type v h|
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   197
3143
0eb6a10e5dc8 class: UIObjectView
Stefan Vogel <sv@exept.de>
parents: 3082
diff changeset
   198
    (aViewOrComponent isKindOf:(Smalltalk classNamed:#LineSegmentMorph)) ifTrue:[
2510
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   199
        aBlock value:(aViewOrComponent startPoint) value:#startPoint.
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   200
        aBlock value:(aViewOrComponent endPoint) value:#endPoint.
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   201
        ^ self.
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   202
    ].
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   203
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   204
    type := self layoutType:aViewOrComponent.
175
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   205
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   206
    (type == #LayoutFrame or:[type == #Rectangle]) ifTrue:[
2510
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   207
        v := self isVerticalResizable:aViewOrComponent.
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   208
        h := self isHorizontalResizable:aViewOrComponent.
2501
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   209
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   210
        h ifTrue:[  
2510
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   211
            aBlock value:(aViewOrComponent leftCenter rounded ) value:#left.
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   212
            aBlock value:(aViewOrComponent rightCenter rounded) value:#right
2501
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   213
        ].
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   214
        v ifTrue:[  
2510
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   215
            aBlock value:(aViewOrComponent topCenter rounded   ) value:#top.
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   216
            aBlock value:(aViewOrComponent bottomCenter rounded) value:#bottom.
2501
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   217
        ].
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   218
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   219
        (h and:[v]) ifTrue:[
2510
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   220
            aBlock value:(aViewOrComponent origin    ) value:#origin.
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   221
            aBlock value:(aViewOrComponent topRight  ) value:#topRight.
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   222
            aBlock value:(aViewOrComponent bottomLeft) value:#bottomLeft.
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   223
            aBlock value:(aViewOrComponent corner    ) value:#corner.
2501
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   224
            ^ self
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   225
        ]
175
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   226
    ].
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   227
2510
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   228
    aBlock value:(aViewOrComponent origin    ) value:#view.
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   229
    aBlock value:(aViewOrComponent topRight  ) value:#view.
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   230
    aBlock value:(aViewOrComponent bottomLeft) value:#view.
175
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   231
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   232
    type == #Extent ifTrue:[
2510
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   233
        v := self isVerticalResizable:aViewOrComponent.
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   234
        h := self isHorizontalResizable:aViewOrComponent.
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   235
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   236
        v ifTrue:[ aBlock value:(aViewOrComponent bottomCenter rounded) value:#bottom ].
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   237
        h ifTrue:[ aBlock value:(aViewOrComponent rightCenter rounded ) value:#right ].
2501
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   238
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   239
        (h and:[v]) ifTrue:[
2510
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   240
            aBlock value:(aViewOrComponent corner) value:#corner.
2501
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   241
            ^ self
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   242
        ]
175
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   243
    ].
2510
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   244
    aBlock value:(aViewOrComponent corner) value:#view.
175
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   245
! !
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   246
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   247
!UIObjectView class methodsFor:'queries'!
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   248
175
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   249
isHorizontalResizable:aComponent
2510
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   250
    "returns true if aComponent is horizontal resizeable
175
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   251
    "
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   252
    (aComponent isKindOf:ScrollBar) ifTrue:[
2510
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   253
        ^ aComponent orientation == #horizontal
175
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   254
    ].
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   255
    (aComponent isKindOf:Scroller) ifTrue:[
2510
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   256
        ^ aComponent orientation == #horizontal
175
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   257
    ].
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   258
    (aComponent isKindOf:Slider) ifTrue:[
2510
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   259
        ^ aComponent orientation == #horizontal
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   260
    ].
3143
0eb6a10e5dc8 class: UIObjectView
Stefan Vogel <sv@exept.de>
parents: 3082
diff changeset
   261
    (aComponent isKindOf:(Smalltalk classNamed:#LineSegmentMorph)) ifTrue:[
2510
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   262
        ^ false
175
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   263
    ].
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   264
    ^ true
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   265
!
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   266
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   267
isVerticalResizable:aComponent
2510
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   268
    "returns true if aComponent is vertical resizeable
175
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   269
    "
2364
121c79884983 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2356
diff changeset
   270
"/    (aComponent isKindOf:EditField) ifTrue:[
121c79884983 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2356
diff changeset
   271
"/        ^ false
121c79884983 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2356
diff changeset
   272
"/    ].
121c79884983 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2356
diff changeset
   273
"/    (aComponent isKindOf:ComboBoxView) ifTrue:[
121c79884983 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2356
diff changeset
   274
"/        ^ false
121c79884983 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2356
diff changeset
   275
"/    ].
121c79884983 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2356
diff changeset
   276
"/    (aComponent isKindOf:CheckBox) ifTrue:[
121c79884983 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2356
diff changeset
   277
"/        ^ false
121c79884983 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2356
diff changeset
   278
"/    ].
121c79884983 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2356
diff changeset
   279
"/    (aComponent isKindOf:ScrollBar) ifTrue:[
121c79884983 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2356
diff changeset
   280
"/        ^ aComponent orientation == #vertical
121c79884983 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2356
diff changeset
   281
"/    ].
121c79884983 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2356
diff changeset
   282
"/    (aComponent isKindOf:Scroller) ifTrue:[
121c79884983 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2356
diff changeset
   283
"/        ^ aComponent orientation == #vertical
121c79884983 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2356
diff changeset
   284
"/    ].
121c79884983 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2356
diff changeset
   285
"/    (aComponent isKindOf:Slider) ifTrue:[
121c79884983 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2356
diff changeset
   286
"/        ^ aComponent orientation == #vertical
121c79884983 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2356
diff changeset
   287
"/    ].
3143
0eb6a10e5dc8 class: UIObjectView
Stefan Vogel <sv@exept.de>
parents: 3082
diff changeset
   288
    (aComponent isKindOf:(Smalltalk classNamed:#LineSegmentMorph)) ifTrue:[
2510
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   289
        ^ false
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   290
    ].
175
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   291
    ^ true
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   292
!
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   293
2510
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   294
layoutType:aViewOrComponent
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   295
    "returns layout type of aView or nil"
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   296
113
1854c2e61c4e bug fixes
ca
parents: 100
diff changeset
   297
    |layout spec superView|
1854c2e61c4e bug fixes
ca
parents: 100
diff changeset
   298
2510
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   299
    aViewOrComponent isNil ifTrue:[ ^ nil ].
3143
0eb6a10e5dc8 class: UIObjectView
Stefan Vogel <sv@exept.de>
parents: 3082
diff changeset
   300
    (aViewOrComponent isKindOf:(Smalltalk classNamed:#LineSegmentMorph)) ifTrue:[
2510
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   301
        ^ nil
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   302
    ].
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   303
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   304
    layout := aViewOrComponent geometryLayout.
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   305
    layout notNil ifTrue:[
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   306
        layout isLayout ifTrue:[
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   307
            layout isLayoutFrame        ifTrue:[ ^ #LayoutFrame ].
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   308
            layout isAlignmentOrigin    ifTrue:[ ^ #AlignmentOrigin ].
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   309
            layout isLayoutOrigin       ifTrue:[ ^ #LayoutOrigin ].
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   310
        ] ifFalse:[
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   311
            layout isRectangle          ifTrue:[ ^ #Rectangle ].
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   312
            layout isPoint              ifTrue:[ ^ #Point ].
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   313
        ].
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   314
    ] ifFalse:[
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   315
        (superView := aViewOrComponent superView) notNil ifTrue:[
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   316
            spec := superView specClass.
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   317
            spec canResizeSubComponents ifTrue:[
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   318
                ^ #Extent
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   319
            ]
0760bec5f1e3 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
   320
        ]
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   321
    ].
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   322
    ^ nil
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   323
67
09e9d4b57142 alignmentLayout
Claus Gittinger <cg@exept.de>
parents: 63
diff changeset
   324
    "Modified: 28.2.1997 / 13:02:16 / cg"
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   325
! !
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   326
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   327
!UIObjectView methodsFor:'accessing'!
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
gridAlign
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   330
    "returns state of aligning to grid
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   331
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   332
    ^ aligning
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
gridAlign:aBool
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   337
    "change state of aligning to grid
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   338
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   339
    aBool ifTrue:[self alignOn]
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1112
diff changeset
   340
	 ifFalse:[self alignOff]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   341
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
gridParameters
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   345
    "used by defineGrid, and in a separate method for
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   346
     easier redefinition in subclasses. 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   347
     Returns the grid parameters in an array of 7 elements,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   348
     which control the appearance of the grid-pattern.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   349
     the elements are:
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   350
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1112
diff changeset
   351
	bigStepH        number of pixels horizontally between 2 major steps
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1112
diff changeset
   352
	bigStepV        number of pixels vertically between 2 major steps
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1112
diff changeset
   353
	littleStepH     number of pixels horizontally between 2 minor steps
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1112
diff changeset
   354
	littleStepV     number of pixels vertically between 2 minor steps
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1112
diff changeset
   355
	gridAlignH      number of pixels for horizontal grid align (pointer snap)
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1112
diff changeset
   356
	gridAlignV      number of pixels for vertical grid align (pointer snap)
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1112
diff changeset
   357
	docBounds       true, if document boundary should be shown
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   358
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   359
     if littleStepH/V are nil, only bigSteps are drawn.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   360
    "
360
1a4ec4aa2c67 configuration of grid parameters
ca
parents: 353
diff changeset
   361
    gridParameters isNil ifTrue:[
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1112
diff changeset
   362
	gridParameters := #(10 10 nil nil 10 10 false)
360
1a4ec4aa2c67 configuration of grid parameters
ca
parents: 353
diff changeset
   363
    ].
1a4ec4aa2c67 configuration of grid parameters
ca
parents: 353
diff changeset
   364
    ^ gridParameters
1a4ec4aa2c67 configuration of grid parameters
ca
parents: 353
diff changeset
   365
1a4ec4aa2c67 configuration of grid parameters
ca
parents: 353
diff changeset
   366
1a4ec4aa2c67 configuration of grid parameters
ca
parents: 353
diff changeset
   367
!
1a4ec4aa2c67 configuration of grid parameters
ca
parents: 353
diff changeset
   368
1a4ec4aa2c67 configuration of grid parameters
ca
parents: 353
diff changeset
   369
gridParameters:newGridParameters
1a4ec4aa2c67 configuration of grid parameters
ca
parents: 353
diff changeset
   370
    "used by defineGrid, and in a separate method for
1a4ec4aa2c67 configuration of grid parameters
ca
parents: 353
diff changeset
   371
     easier redefinition in subclasses. 
1a4ec4aa2c67 configuration of grid parameters
ca
parents: 353
diff changeset
   372
     Returns the grid parameters in an array of 7 elements,
1a4ec4aa2c67 configuration of grid parameters
ca
parents: 353
diff changeset
   373
     which control the appearance of the grid-pattern.
1a4ec4aa2c67 configuration of grid parameters
ca
parents: 353
diff changeset
   374
     the elements are:
1a4ec4aa2c67 configuration of grid parameters
ca
parents: 353
diff changeset
   375
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1112
diff changeset
   376
	bigStepH        number of pixels horizontally between 2 major steps
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1112
diff changeset
   377
	bigStepV        number of pixels vertically between 2 major steps
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1112
diff changeset
   378
	littleStepH     number of pixels horizontally between 2 minor steps
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1112
diff changeset
   379
	littleStepV     number of pixels vertically between 2 minor steps
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1112
diff changeset
   380
	gridAlignH      number of pixels for horizontal grid align (pointer snap)
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1112
diff changeset
   381
	gridAlignV      number of pixels for vertical grid align (pointer snap)
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1112
diff changeset
   382
	docBounds       true, if document boundary should be shown
360
1a4ec4aa2c67 configuration of grid parameters
ca
parents: 353
diff changeset
   383
1a4ec4aa2c67 configuration of grid parameters
ca
parents: 353
diff changeset
   384
     if littleStepH/V are nil, only bigSteps are drawn.
1a4ec4aa2c67 configuration of grid parameters
ca
parents: 353
diff changeset
   385
    "
1a4ec4aa2c67 configuration of grid parameters
ca
parents: 353
diff changeset
   386
    newGridParameters size == 7 ifTrue:[
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1112
diff changeset
   387
	gridParameters := newGridParameters
360
1a4ec4aa2c67 configuration of grid parameters
ca
parents: 353
diff changeset
   388
    ].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   389
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   390
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   391
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   392
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   393
gridShown:aBool
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   394
    "change visibility of grid
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   395
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   396
    aBool ifTrue:[self showGrid]
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1112
diff changeset
   397
	 ifFalse:[self hideGrid]
60
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
hideGrid
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   401
    "hide grid
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   402
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   403
    gridShown ifTrue:[
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1112
diff changeset
   404
	self withSelectionHiddenDo:[super hideGrid]
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
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
3219
2395b33f653e class: UIObjectView
Claus Gittinger <cg@exept.de>
parents: 3143
diff changeset
   410
nPixelsForMoveSelection
2395b33f653e class: UIObjectView
Claus Gittinger <cg@exept.de>
parents: 3143
diff changeset
   411
    ^ nPixelsForMoveSelection
2395b33f653e class: UIObjectView
Claus Gittinger <cg@exept.de>
parents: 3143
diff changeset
   412
!
2395b33f653e class: UIObjectView
Claus Gittinger <cg@exept.de>
parents: 3143
diff changeset
   413
2395b33f653e class: UIObjectView
Claus Gittinger <cg@exept.de>
parents: 3143
diff changeset
   414
nPixelsForMoveSelection:something
2395b33f653e class: UIObjectView
Claus Gittinger <cg@exept.de>
parents: 3143
diff changeset
   415
    nPixelsForMoveSelection := something.
2395b33f653e class: UIObjectView
Claus Gittinger <cg@exept.de>
parents: 3143
diff changeset
   416
!
2395b33f653e class: UIObjectView
Claus Gittinger <cg@exept.de>
parents: 3143
diff changeset
   417
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   418
showGrid
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   419
    "show grid
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   420
    "
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   421
    self withSelectionHiddenDo:[super showGrid]
119
39acd704ad51 testMode is now a ValueHolder
ca
parents: 113
diff changeset
   422
! !
39acd704ad51 testMode is now a ValueHolder
ca
parents: 113
diff changeset
   423
1399
a0687f5e1f54 category changes
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   424
!UIObjectView methodsFor:'accessing-behavior'!
119
39acd704ad51 testMode is now a ValueHolder
ca
parents: 113
diff changeset
   425
1100
bf884041701f Implement common channels in View.
Stefan Vogel <sv@exept.de>
parents: 1048
diff changeset
   426
enableStateChanged
2364
121c79884983 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2356
diff changeset
   427
    "toggle the test mode
1100
bf884041701f Implement common channels in View.
Stefan Vogel <sv@exept.de>
parents: 1048
diff changeset
   428
    "
1102
abcdd3d5a67b testMode enable/disable
Claus Gittinger <cg@exept.de>
parents: 1100
diff changeset
   429
    self shown ifTrue:[
1672
5e89f5959780 no longer use InputView
ca
parents: 1581
diff changeset
   430
        enableChannel value ifFalse:[
5e89f5959780 no longer use InputView
ca
parents: 1581
diff changeset
   431
            saveSelection := selection.
5e89f5959780 no longer use InputView
ca
parents: 1581
diff changeset
   432
            self hideSelection.
5e89f5959780 no longer use InputView
ca
parents: 1581
diff changeset
   433
            selection := nil.
5e89f5959780 no longer use InputView
ca
parents: 1581
diff changeset
   434
        ] ifTrue:[
5e89f5959780 no longer use InputView
ca
parents: 1581
diff changeset
   435
            selection := saveSelection.
5e89f5959780 no longer use InputView
ca
parents: 1581
diff changeset
   436
            self showSelection
5e89f5959780 no longer use InputView
ca
parents: 1581
diff changeset
   437
        ]
1100
bf884041701f Implement common channels in View.
Stefan Vogel <sv@exept.de>
parents: 1048
diff changeset
   438
    ]
bf884041701f Implement common channels in View.
Stefan Vogel <sv@exept.de>
parents: 1048
diff changeset
   439
bf884041701f Implement common channels in View.
Stefan Vogel <sv@exept.de>
parents: 1048
diff changeset
   440
    "Created: / 30.3.1999 / 16:17:24 / stefan"
bf884041701f Implement common channels in View.
Stefan Vogel <sv@exept.de>
parents: 1048
diff changeset
   441
!
bf884041701f Implement common channels in View.
Stefan Vogel <sv@exept.de>
parents: 1048
diff changeset
   442
119
39acd704ad51 testMode is now a ValueHolder
ca
parents: 113
diff changeset
   443
enabled
39acd704ad51 testMode is now a ValueHolder
ca
parents: 113
diff changeset
   444
    ^ enableChannel value
39acd704ad51 testMode is now a ValueHolder
ca
parents: 113
diff changeset
   445
!
39acd704ad51 testMode is now a ValueHolder
ca
parents: 113
diff changeset
   446
3395
818e06192ffc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   447
enabled:aBoolean
119
39acd704ad51 testMode is now a ValueHolder
ca
parents: 113
diff changeset
   448
    "set the modification / test mode
39acd704ad51 testMode is now a ValueHolder
ca
parents: 113
diff changeset
   449
    "
1100
bf884041701f Implement common channels in View.
Stefan Vogel <sv@exept.de>
parents: 1048
diff changeset
   450
3395
818e06192ffc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   451
    enableChannel value:aBoolean
818e06192ffc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   452
818e06192ffc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   453
    "Modified: / 30-03-1999 / 16:18:12 / stefan"
818e06192ffc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   454
    "Modified (format): / 04-02-2017 / 21:34:58 / cg"
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   455
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   456
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 132
diff changeset
   457
resetModification
1918
f5e8dfe30838 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1911
diff changeset
   458
    "set modification state to false"
f5e8dfe30838 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1911
diff changeset
   459
1954
1344ec1f99eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1918
diff changeset
   460
    undoHistory resetModification.
1344ec1f99eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1918
diff changeset
   461
    self undoHistoryChanged.
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 132
diff changeset
   462
!
d5ab85ec27fd undo history; keep view identifier
ca
parents: 132
diff changeset
   463
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   464
testMode
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   465
    "returns true if running test
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   466
    "
119
39acd704ad51 testMode is now a ValueHolder
ca
parents: 113
diff changeset
   467
    ^ enableChannel value not
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   468
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   469
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   470
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   471
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   472
testMode:aBoolean
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   473
    "change test mode
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   474
    "
1102
abcdd3d5a67b testMode enable/disable
Claus Gittinger <cg@exept.de>
parents: 1100
diff changeset
   475
    enableChannel value:(aBoolean not)
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   476
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   477
1954
1344ec1f99eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1918
diff changeset
   478
!UIObjectView methodsFor:'aspects'!
1344ec1f99eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1918
diff changeset
   479
1344ec1f99eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1918
diff changeset
   480
hasUndoHistoryHolder
1344ec1f99eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1918
diff changeset
   481
    hasUndoHistoryHolder isNil ifTrue:[
1344ec1f99eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1918
diff changeset
   482
        hasUndoHistoryHolder := false asValue
1344ec1f99eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1918
diff changeset
   483
    ].
1344ec1f99eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1918
diff changeset
   484
    ^ hasUndoHistoryHolder
1344ec1f99eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1918
diff changeset
   485
! !
1344ec1f99eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1918
diff changeset
   486
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   487
!UIObjectView methodsFor:'blocked'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   488
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   489
addObject:anObject
1746
bb4f759cf456 Do not use #halt
Stefan Vogel <sv@exept.de>
parents: 1745
diff changeset
   490
    "add the argument, anObject to the contents - with redraw"
bb4f759cf456 Do not use #halt
Stefan Vogel <sv@exept.de>
parents: 1745
diff changeset
   491
bb4f759cf456 Do not use #halt
Stefan Vogel <sv@exept.de>
parents: 1745
diff changeset
   492
    self shouldNotImplement
60
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
addObjectWithoutRedraw:anObject
1746
bb4f759cf456 Do not use #halt
Stefan Vogel <sv@exept.de>
parents: 1745
diff changeset
   496
    "add the argument, anObject to the contents - with redraw"
bb4f759cf456 Do not use #halt
Stefan Vogel <sv@exept.de>
parents: 1745
diff changeset
   497
bb4f759cf456 Do not use #halt
Stefan Vogel <sv@exept.de>
parents: 1745
diff changeset
   498
    self shouldNotImplement
60
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
2538
ded6eb784054 refactored selectAll to allow for rectangle-drag in UIObjectView
Claus Gittinger <cg@exept.de>
parents: 2536
diff changeset
   501
!UIObjectView methodsFor:'enumerating'!
ded6eb784054 refactored selectAll to allow for rectangle-drag in UIObjectView
Claus Gittinger <cg@exept.de>
parents: 2536
diff changeset
   502
ded6eb784054 refactored selectAll to allow for rectangle-drag in UIObjectView
Claus Gittinger <cg@exept.de>
parents: 2536
diff changeset
   503
contentsDo:aBlock
ded6eb784054 refactored selectAll to allow for rectangle-drag in UIObjectView
Claus Gittinger <cg@exept.de>
parents: 2536
diff changeset
   504
    self subViews do:aBlock.
ded6eb784054 refactored selectAll to allow for rectangle-drag in UIObjectView
Claus Gittinger <cg@exept.de>
parents: 2536
diff changeset
   505
    self components do:aBlock.
ded6eb784054 refactored selectAll to allow for rectangle-drag in UIObjectView
Claus Gittinger <cg@exept.de>
parents: 2536
diff changeset
   506
! !
ded6eb784054 refactored selectAll to allow for rectangle-drag in UIObjectView
Claus Gittinger <cg@exept.de>
parents: 2536
diff changeset
   507
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   508
!UIObjectView methodsFor:'event handling'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   509
1833
6ad211a201cf *** empty log message ***
werner
parents: 1829
diff changeset
   510
doublePressed:pressPoint
6ad211a201cf *** empty log message ***
werner
parents: 1829
diff changeset
   511
!
6ad211a201cf *** empty log message ***
werner
parents: 1829
diff changeset
   512
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   513
elementChangedSize:aView
2501
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   514
    "some element has changed its size; collect them while selectionHiddenLevel is on"
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   515
284
995078a58977 show the selection after mapping the view
ca
parents: 251
diff changeset
   516
    |spv|
995078a58977 show the selection after mapping the view
ca
parents: 251
diff changeset
   517
995078a58977 show the selection after mapping the view
ca
parents: 251
diff changeset
   518
    spv := self findContainerOfView:aView.
995078a58977 show the selection after mapping the view
ca
parents: 251
diff changeset
   519
2501
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   520
    aView isView ifFalse:[
2503
36dce8c654af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
   521
"/        spv invalidate.
2501
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   522
    ].
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   523
2503
36dce8c654af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
   524
"/    spv := self findContainerOfView:aView.
2501
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   525
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   526
    selectionHiddenLevel ~~ 0 ifTrue:[
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   527
        setOfSuperViewsSizeChanged add:spv
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   528
    ] ifFalse:[
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   529
        spv sizeChanged:nil
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   530
    ]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   531
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   532
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   533
keyPress:key x:x y:y
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   534
    "any key pressed
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   535
    "
1048
d6d4b7abfdd0 +cursorKeys to move widgets
Claus Gittinger <cg@exept.de>
parents: 1016
diff changeset
   536
    <resource: #keyboard ( #CursorUp #CursorDown #CursorLeft #CursorRight
1827
691d1471cd3e WOs changes
werner
parents: 1746
diff changeset
   537
                           #Delete #BackSpace #Cut #Copy #Paste #Cmdu #Again) >
1222
bcb8b0ec295c collect cursor events for widget move;
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
   538
bcb8b0ec295c collect cursor events for widget move;
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
   539
    |n sensor|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   540
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   541
    (key == #Cut or:[key == #Delete or:[key == #BackSpace]]) ifTrue: [
1222
bcb8b0ec295c collect cursor events for widget move;
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
   542
        ^ self deleteSelection
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   543
    ].
1827
691d1471cd3e WOs changes
werner
parents: 1746
diff changeset
   544
    (key = #PreviousPage) ifTrue:[
691d1471cd3e WOs changes
werner
parents: 1746
diff changeset
   545
        self selectNextUpInHierarchy.
691d1471cd3e WOs changes
werner
parents: 1746
diff changeset
   546
    ].
78
a0a00603a8b6 keep spec in properties
ca
parents: 76
diff changeset
   547
    key == #Copy  ifTrue:[ ^ self copySelection].
a0a00603a8b6 keep spec in properties
ca
parents: 76
diff changeset
   548
    key == #Paste ifTrue:[ ^ self pasteBuffer].
360
1a4ec4aa2c67 configuration of grid parameters
ca
parents: 353
diff changeset
   549
    key == #Cmdu  ifTrue:[ ^ self undoLast ].           "/ #Undo
1a4ec4aa2c67 configuration of grid parameters
ca
parents: 353
diff changeset
   550
1827
691d1471cd3e WOs changes
werner
parents: 1746
diff changeset
   551
    ( #(CursorUp CursorDown CursorRight CursorLeft)
691d1471cd3e WOs changes
werner
parents: 1746
diff changeset
   552
    includes:key) ifTrue:[
691d1471cd3e WOs changes
werner
parents: 1746
diff changeset
   553
        (sensor := self sensor) isNil ifTrue:[
691d1471cd3e WOs changes
werner
parents: 1746
diff changeset
   554
            n := 1
691d1471cd3e WOs changes
werner
parents: 1746
diff changeset
   555
        ] ifFalse:[
691d1471cd3e WOs changes
werner
parents: 1746
diff changeset
   556
            n := 1 + (sensor compressKeyPressEventsWithKey:key).
691d1471cd3e WOs changes
werner
parents: 1746
diff changeset
   557
            sensor shiftDown ifTrue:[
691d1471cd3e WOs changes
werner
parents: 1746
diff changeset
   558
                n := n * 10.
691d1471cd3e WOs changes
werner
parents: 1746
diff changeset
   559
            ].
1222
bcb8b0ec295c collect cursor events for widget move;
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
   560
        ].
bcb8b0ec295c collect cursor events for widget move;
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
   561
bcb8b0ec295c collect cursor events for widget move;
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
   562
        key == #CursorUp ifTrue:[
bcb8b0ec295c collect cursor events for widget move;
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
   563
            ^ self moveSelectionUp:n
bcb8b0ec295c collect cursor events for widget move;
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
   564
        ].
bcb8b0ec295c collect cursor events for widget move;
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
   565
        key == #CursorDown ifTrue:[
bcb8b0ec295c collect cursor events for widget move;
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
   566
            ^ self moveSelectionDown:n
bcb8b0ec295c collect cursor events for widget move;
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
   567
        ].
bcb8b0ec295c collect cursor events for widget move;
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
   568
        key == #CursorRight ifTrue:[
bcb8b0ec295c collect cursor events for widget move;
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
   569
            ^ self moveSelectionRight:n
bcb8b0ec295c collect cursor events for widget move;
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
   570
        ].
bcb8b0ec295c collect cursor events for widget move;
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
   571
        key == #CursorLeft ifTrue:[
bcb8b0ec295c collect cursor events for widget move;
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
   572
            ^ self moveSelectionLeft:n
bcb8b0ec295c collect cursor events for widget move;
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
   573
        ].
bcb8b0ec295c collect cursor events for widget move;
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
   574
    ].
374
421f8a3723f1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 360
diff changeset
   575
    super keyPress:key x:x y:y
421f8a3723f1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 360
diff changeset
   576
1048
d6d4b7abfdd0 +cursorKeys to move widgets
Claus Gittinger <cg@exept.de>
parents: 1016
diff changeset
   577
    "Modified: / 6.3.1999 / 22:47:48 / cg"
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   578
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   579
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   580
processEvent:anEvent
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   581
    "catch expose events for components, and redraw its handles after
1895
b7d6683ebaca *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1861
diff changeset
   582
     the redraw when this happens.
b7d6683ebaca *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1861
diff changeset
   583
     Return true, if I have eaten the event"
b7d6683ebaca *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1861
diff changeset
   584
2501
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   585
    |evView widget p|
1672
5e89f5959780 no longer use InputView
ca
parents: 1581
diff changeset
   586
5e89f5959780 no longer use InputView
ca
parents: 1581
diff changeset
   587
    self testMode ifTrue:[^ false].
5e89f5959780 no longer use InputView
ca
parents: 1581
diff changeset
   588
2555
322f0de7da00 changed #processEvent:
Claus Gittinger <cg@exept.de>
parents: 2554
diff changeset
   589
    anEvent isInputEvent ifFalse:[^ false].
322f0de7da00 changed #processEvent:
Claus Gittinger <cg@exept.de>
parents: 2554
diff changeset
   590
1672
5e89f5959780 no longer use InputView
ca
parents: 1581
diff changeset
   591
    evView := anEvent view.
2548
c3ee3b652ef7 careful to only ignore events for me
Claus Gittinger <cg@exept.de>
parents: 2538
diff changeset
   592
    evView isNil ifTrue:[ ^ false].
c3ee3b652ef7 careful to only ignore events for me
Claus Gittinger <cg@exept.de>
parents: 2538
diff changeset
   593
2501
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   594
    (evView == self) ifTrue:[
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   595
        "/ new: check for a component to be hit by the event
2554
226127373d77 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2550
diff changeset
   596
2501
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   597
        components notEmptyOrNil ifTrue:[
2554
226127373d77 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2550
diff changeset
   598
            anEvent x notNil ifTrue:[
226127373d77 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2550
diff changeset
   599
                p := (anEvent x @ anEvent y).        
226127373d77 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2550
diff changeset
   600
                widget := components detect:[:c | c bounds containsPoint:p ] ifNone:nil.
226127373d77 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2550
diff changeset
   601
            ].
2501
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   602
        ].
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   603
        widget isNil ifTrue:[
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   604
            ^ false
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   605
        ].
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   606
    ] ifFalse:[
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   607
        widget := evView.
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   608
    ].
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   609
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   610
    (widget isComponentOf:self) ifFalse:[
1672
5e89f5959780 no longer use InputView
ca
parents: 1581
diff changeset
   611
        ^ false
5e89f5959780 no longer use InputView
ca
parents: 1581
diff changeset
   612
    ].
2550
53294c69f292 oops - a halt
Claus Gittinger <cg@exept.de>
parents: 2548
diff changeset
   613
2548
c3ee3b652ef7 careful to only ignore events for me
Claus Gittinger <cg@exept.de>
parents: 2538
diff changeset
   614
    "/ eat most of my events
c3ee3b652ef7 careful to only ignore events for me
Claus Gittinger <cg@exept.de>
parents: 2538
diff changeset
   615
    anEvent isPointerEnterLeaveEvent ifTrue:[^ true. ^ false].
c3ee3b652ef7 careful to only ignore events for me
Claus Gittinger <cg@exept.de>
parents: 2538
diff changeset
   616
    anEvent isKeyboardFocusEvent ifTrue:[^ true. ^ false].
c3ee3b652ef7 careful to only ignore events for me
Claus Gittinger <cg@exept.de>
parents: 2538
diff changeset
   617
c3ee3b652ef7 careful to only ignore events for me
Claus Gittinger <cg@exept.de>
parents: 2538
diff changeset
   618
    (anEvent isButtonEvent or:[anEvent isKeyEvent]) ifFalse:[ ^ true ].
1672
5e89f5959780 no longer use InputView
ca
parents: 1581
diff changeset
   619
2203
919b6f0753fa changed #processEvent:
ca
parents: 2041
diff changeset
   620
    anEvent isButtonMotionEvent ifTrue:[
919b6f0753fa changed #processEvent:
ca
parents: 2041
diff changeset
   621
        "/ use current point - layout of underlaying view might change
919b6f0753fa changed #processEvent:
ca
parents: 2041
diff changeset
   622
        "/ and computation dependent on origin is wrong
919b6f0753fa changed #processEvent:
ca
parents: 2041
diff changeset
   623
        p := self sensor mousePoint.
3261
b830ad071eb5 device access
Claus Gittinger <cg@exept.de>
parents: 3219
diff changeset
   624
        p := device translatePoint:p fromView:nil toView:self.
2203
919b6f0753fa changed #processEvent:
ca
parents: 2041
diff changeset
   625
    ] ifFalse:[
2501
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   626
        p := (anEvent x) @ (anEvent y).
3261
b830ad071eb5 device access
Claus Gittinger <cg@exept.de>
parents: 3219
diff changeset
   627
        p := device translatePoint:p fromView:evView toView:self.
2203
919b6f0753fa changed #processEvent:
ca
parents: 2041
diff changeset
   628
    ].
1672
5e89f5959780 no longer use InputView
ca
parents: 1581
diff changeset
   629
5e89f5959780 no longer use InputView
ca
parents: 1581
diff changeset
   630
    "/ patch the event
5e89f5959780 no longer use InputView
ca
parents: 1581
diff changeset
   631
    anEvent x:p x.
5e89f5959780 no longer use InputView
ca
parents: 1581
diff changeset
   632
    anEvent y:p y.
5e89f5959780 no longer use InputView
ca
parents: 1581
diff changeset
   633
    anEvent view:self.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   634
    ^ false.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   635
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   636
624
26e7978936fc ignore redraws - components redraw themself.
Claus Gittinger <cg@exept.de>
parents: 543
diff changeset
   637
redrawX:nx y:ny width:nw height:nh
1911
0538568157f0 handle redrawing fixed
Claus Gittinger <cg@exept.de>
parents: 1903
diff changeset
   638
    |redrawFrame|
0538568157f0 handle redrawing fixed
Claus Gittinger <cg@exept.de>
parents: 1903
diff changeset
   639
0538568157f0 handle redrawing fixed
Claus Gittinger <cg@exept.de>
parents: 1903
diff changeset
   640
    redrawFrame := Rectangle left:nx top:ny width:nw height:nh.
2501
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   641
    "/ self clearRectangle:redrawFrame.
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   642
    super redrawX:nx y:ny width:nw height:nh.
1911
0538568157f0 handle redrawing fixed
Claus Gittinger <cg@exept.de>
parents: 1903
diff changeset
   643
0538568157f0 handle redrawing fixed
Claus Gittinger <cg@exept.de>
parents: 1903
diff changeset
   644
    self selectionDo:[:aComponent |
0538568157f0 handle redrawing fixed
Claus Gittinger <cg@exept.de>
parents: 1903
diff changeset
   645
        |anyHandleToRedraw|
0538568157f0 handle redrawing fixed
Claus Gittinger <cg@exept.de>
parents: 1903
diff changeset
   646
0538568157f0 handle redrawing fixed
Claus Gittinger <cg@exept.de>
parents: 1903
diff changeset
   647
        anyHandleToRedraw := false.
0538568157f0 handle redrawing fixed
Claus Gittinger <cg@exept.de>
parents: 1903
diff changeset
   648
        self handlesOf:aComponent do:[:hRect :typeOfHandle |
0538568157f0 handle redrawing fixed
Claus Gittinger <cg@exept.de>
parents: 1903
diff changeset
   649
            (hRect intersects:redrawFrame) ifTrue:[        
0538568157f0 handle redrawing fixed
Claus Gittinger <cg@exept.de>
parents: 1903
diff changeset
   650
                anyHandleToRedraw := true.
0538568157f0 handle redrawing fixed
Claus Gittinger <cg@exept.de>
parents: 1903
diff changeset
   651
            ].
0538568157f0 handle redrawing fixed
Claus Gittinger <cg@exept.de>
parents: 1903
diff changeset
   652
        ].
0538568157f0 handle redrawing fixed
Claus Gittinger <cg@exept.de>
parents: 1903
diff changeset
   653
        anyHandleToRedraw ifTrue:[
0538568157f0 handle redrawing fixed
Claus Gittinger <cg@exept.de>
parents: 1903
diff changeset
   654
            self showSelected:aComponent
0538568157f0 handle redrawing fixed
Claus Gittinger <cg@exept.de>
parents: 1903
diff changeset
   655
        ]
0538568157f0 handle redrawing fixed
Claus Gittinger <cg@exept.de>
parents: 1903
diff changeset
   656
    ]
2246
1422d76c54dc changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2215
diff changeset
   657
1422d76c54dc changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2215
diff changeset
   658
    "Modified: / 16-01-2008 / 17:57:09 / cg"
624
26e7978936fc ignore redraws - components redraw themself.
Claus Gittinger <cg@exept.de>
parents: 543
diff changeset
   659
!
26e7978936fc ignore redraws - components redraw themself.
Claus Gittinger <cg@exept.de>
parents: 543
diff changeset
   660
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   661
sizeChanged:how
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   662
    "size of a view(s) changed
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   663
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   664
    self withSelectionHiddenDo:[
1672
5e89f5959780 no longer use InputView
ca
parents: 1581
diff changeset
   665
        super sizeChanged:how.
5e89f5959780 no longer use InputView
ca
parents: 1581
diff changeset
   666
    ].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   667
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   668
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   669
!UIObjectView methodsFor:'initialization'!
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
initialize
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   672
    "setup attributes
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   673
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   674
    super initialize.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   675
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   676
    setOfSuperViewsSizeChanged := IdentitySet new.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   677
    self setDefaultActions.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   678
1954
1344ec1f99eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1918
diff changeset
   679
    undoHistory := UndoHistory on:self.
1344ec1f99eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1918
diff changeset
   680
1100
bf884041701f Implement common channels in View.
Stefan Vogel <sv@exept.de>
parents: 1048
diff changeset
   681
    self enableChannel:(true asValue).
119
39acd704ad51 testMode is now a ValueHolder
ca
parents: 113
diff changeset
   682
    clipChildren         := true.
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   683
    selectionHiddenLevel := 0.
3219
2395b33f653e class: UIObjectView
Claus Gittinger <cg@exept.de>
parents: 3143
diff changeset
   684
    nPixelsForMoveSelection := 1.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   685
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   686
    (self class gridShown) ifTrue:[
1672
5e89f5959780 no longer use InputView
ca
parents: 1581
diff changeset
   687
        super showGrid
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   688
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   689
897
43f9bdc12ae4 make certain inputView is on top when restarting from a snapshot
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
   690
    "Modified: / 20.7.1998 / 18:14:51 / cg"
1100
bf884041701f Implement common channels in View.
Stefan Vogel <sv@exept.de>
parents: 1048
diff changeset
   691
    "Modified: / 30.3.1999 / 16:19:15 / stefan"
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   692
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   693
284
995078a58977 show the selection after mapping the view
ca
parents: 251
diff changeset
   694
map
995078a58977 show the selection after mapping the view
ca
parents: 251
diff changeset
   695
    "make the view visible on the screen and in case of a none empty
995078a58977 show the selection after mapping the view
ca
parents: 251
diff changeset
   696
     selection the selection will be shown.
995078a58977 show the selection after mapping the view
ca
parents: 251
diff changeset
   697
    "
995078a58977 show the selection after mapping the view
ca
parents: 251
diff changeset
   698
    super map.
995078a58977 show the selection after mapping the view
ca
parents: 251
diff changeset
   699
    self showSelection.
995078a58977 show the selection after mapping the view
ca
parents: 251
diff changeset
   700
!
995078a58977 show the selection after mapping the view
ca
parents: 251
diff changeset
   701
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   702
realize
1672
5e89f5959780 no longer use InputView
ca
parents: 1581
diff changeset
   703
    |windowGroup|
5e89f5959780 no longer use InputView
ca
parents: 1581
diff changeset
   704
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   705
    super realize.
1672
5e89f5959780 no longer use InputView
ca
parents: 1581
diff changeset
   706
    windowGroup := self windowGroup.
5e89f5959780 no longer use InputView
ca
parents: 1581
diff changeset
   707
    windowGroup  addPreEventHook:self.
5e89f5959780 no longer use InputView
ca
parents: 1581
diff changeset
   708
    windowGroup addPostEventHook:(PostEventHandler new onView:self).
897
43f9bdc12ae4 make certain inputView is on top when restarting from a snapshot
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
   709
!
43f9bdc12ae4 make certain inputView is on top when restarting from a snapshot
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
   710
43f9bdc12ae4 make certain inputView is on top when restarting from a snapshot
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
   711
remap
43f9bdc12ae4 make certain inputView is on top when restarting from a snapshot
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
   712
    "make the view visible on the screen and in case of a none empty
1746
bb4f759cf456 Do not use #halt
Stefan Vogel <sv@exept.de>
parents: 1745
diff changeset
   713
     selection the selection will be shown"
bb4f759cf456 Do not use #halt
Stefan Vogel <sv@exept.de>
parents: 1745
diff changeset
   714
bb4f759cf456 Do not use #halt
Stefan Vogel <sv@exept.de>
parents: 1745
diff changeset
   715
    self shouldNotImplement
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   716
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   717
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   718
!UIObjectView methodsFor:'misc'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   719
175
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   720
invertOutlineOf:something
2501
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   721
    "invert outline of an object or collection of objects"
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   722
2536
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   723
    ^ self.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   724
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   725
"/ cg: nope - all done via handles now.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   726
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   727
"/    |wasClipped|
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   728
"/
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   729
"/    (wasClipped := clipChildren) ifTrue:[
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   730
"/        self clippedByChildren:(clipChildren := false).
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   731
"/    ].
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   732
"/
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   733
"/    self xoring:[
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   734
"/        |p|
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   735
"/
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   736
"/        something isCollection ifTrue:[
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   737
"/            something do:[:v |
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   738
"/                p := v originRelativeTo:self.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   739
"/                self displayRectangle:(p extent:v extent).
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   740
"/            ].
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   741
"/        ] ifFalse:[
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   742
"/            p := something originRelativeTo:self.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   743
"/            self displayRectangle:(p extent:something extent).
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   744
"/        ]
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   745
"/    ].
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   746
"/
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   747
"/    wasClipped ifTrue:[
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   748
"/        self clippedByChildren:(clipChildren := true).
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   749
"/    ].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   750
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   751
2255
4cca07c42e74 code beautification
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   752
minClosedViewSetFor:setOfViews
4cca07c42e74 code beautification
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   753
    "return the minimum closure for a given set of view;
4cca07c42e74 code beautification
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   754
     That is the minimum set of views which contains the given set of views.
4cca07c42e74 code beautification
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   755
     Concrete: all subviews from setOfViews of which any superView is already in the set
4cca07c42e74 code beautification
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   756
               is excluded from the result"
4cca07c42e74 code beautification
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   757
78
a0a00603a8b6 keep spec in properties
ca
parents: 76
diff changeset
   758
    setOfViews isCollection ifFalse:[
1903
f409fa760169 refactored intention revealing code:
Claus Gittinger <cg@exept.de>
parents: 1895
diff changeset
   759
        setOfViews notNil ifTrue:[^ Array with:setOfViews].
f409fa760169 refactored intention revealing code:
Claus Gittinger <cg@exept.de>
parents: 1895
diff changeset
   760
        ^ nil
72
a5a7054e2b7d *** empty log message ***
ca
parents: 68
diff changeset
   761
    ].
3011
ceaec66469ff class: UIObjectView
Claus Gittinger <cg@exept.de>
parents: 2849
diff changeset
   762
    ^ setOfViews reject:[:aView| (setOfViews contains:[:v | aView isComponentOf:v]) ]
72
a5a7054e2b7d *** empty log message ***
ca
parents: 68
diff changeset
   763
!
a5a7054e2b7d *** empty log message ***
ca
parents: 68
diff changeset
   764
624
26e7978936fc ignore redraws - components redraw themself.
Claus Gittinger <cg@exept.de>
parents: 543
diff changeset
   765
redrawObjectsInVisible:redrawFrame
2501
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   766
    "my objects are views - they redraw themself.
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   767
     - no longer - all non-views MUST be redrawn."
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   768
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   769
    super redrawObjectsInVisible:redrawFrame.
624
26e7978936fc ignore redraws - components redraw themself.
Claus Gittinger <cg@exept.de>
parents: 543
diff changeset
   770
    ^ self
26e7978936fc ignore redraws - components redraw themself.
Claus Gittinger <cg@exept.de>
parents: 543
diff changeset
   771
!
26e7978936fc ignore redraws - components redraw themself.
Claus Gittinger <cg@exept.de>
parents: 543
diff changeset
   772
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   773
setDefaultActions
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   774
    "set default actions
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   775
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   776
    pressAction      := [:pressPoint | self startSelectOrMove:pressPoint].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   777
    shiftPressAction := [:pressPoint | self startSelectMoreOrMove:pressPoint].
1861
4c173871788a ctrl-action
ca
parents: 1833
diff changeset
   778
    ctrlPressAction  := [:pressPoint | self startSelectMoreOrMove:pressPoint].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   779
    motionAction     := [:movePoint  | nil].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   780
    releaseAction    := [nil].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   781
    keyPressAction   := nil.
1827
691d1471cd3e WOs changes
werner
parents: 1746
diff changeset
   782
    doublePressAction   := [:pressPoint | self doublePressed: pressPoint].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   783
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   784
    self cursor:Cursor normal.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   785
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   786
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   787
!UIObjectView methodsFor:'object moving'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   788
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   789
doObjectMove:aPoint
2536
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   790
    "move movedOject (which is a misnomer - it's actually a collection of objects to move)"
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   791
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   792
    |anyMove|
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   793
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   794
    movedObject isEmptyOrNil ifTrue:[^ self].
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   795
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   796
    anyMove := false.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   797
    "/ to avoid flicker, check if this really involves a move (due to align)
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   798
    movedObject keysAndValuesDo:[:i :obj|
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   799
        |newOrigin delta|
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   800
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   801
        newOrigin := (aPoint - (moveDelta at:i)).
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   802
        delta := (self alignToGrid:newOrigin) - obj computeOrigin.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   803
        delta ~= (0@0) ifTrue:[ anyMove := true ].
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   804
    ].
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   805
    anyMove ifFalse:[^ self ].
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   806
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   807
    self hideSelection.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   808
    self invertOutlineOf:movedObject.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   809
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   810
    movedObject keysAndValuesDo:[:i :v|
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   811
        self moveObject:v to:(aPoint - (moveDelta at:i)).
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   812
    ].
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   813
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   814
    self invertOutlineOf:movedObject.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   815
    self showSelection.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   816
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   817
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   818
endObjectMove
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   819
    "cleanup after object(s) move
2205
0582767018d7 endObjectMove - send expose to all - workaround drawing
ca
parents: 2203
diff changeset
   820
     send expose to each view - workaround....
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   821
    "
2205
0582767018d7 endObjectMove - send expose to all - workaround drawing
ca
parents: 2203
diff changeset
   822
    |newSel|
0582767018d7 endObjectMove - send expose to all - workaround drawing
ca
parents: 2203
diff changeset
   823
0582767018d7 endObjectMove - send expose to all - workaround drawing
ca
parents: 2203
diff changeset
   824
    movedObject isNil ifTrue:[^ self].
0582767018d7 endObjectMove - send expose to all - workaround drawing
ca
parents: 2203
diff changeset
   825
0582767018d7 endObjectMove - send expose to all - workaround drawing
ca
parents: 2203
diff changeset
   826
    movedObject size == 1 ifTrue:[ newSel := movedObject first ]
0582767018d7 endObjectMove - send expose to all - workaround drawing
ca
parents: 2203
diff changeset
   827
                         ifFalse:[ newSel := movedObject ].
0582767018d7 endObjectMove - send expose to all - workaround drawing
ca
parents: 2203
diff changeset
   828
    movedObject := nil.
0582767018d7 endObjectMove - send expose to all - workaround drawing
ca
parents: 2203
diff changeset
   829
2536
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   830
"/    self withSelectionHiddenDo:[
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   831
"/        self setSelection:newSel withRedraw:false.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   832
"/
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   833
"/        components notEmptyOrNil ifTrue:[
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   834
"/            self invalidate.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   835
"/        ].
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   836
"/        self allSubViewsDo:[:v|
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   837
"/            v shown ifTrue:[
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   838
"/                v fill:v viewBackground.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   839
"/                v exposeX:0 y:0 width:v width height:v height.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   840
"/            ].
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   841
"/        ].
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   842
"/    ].
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   843
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   844
    self setDefaultActions.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   845
    self layoutChanged.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   846
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   847
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   848
moveObject:anObject to:aPoint
2514
faf45b01db30 moving non-layout objects
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
   849
    "move anObject to newOrigin, aPoint"
faf45b01db30 moving non-layout objects
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
   850
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   851
    |dX dY org delta|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   852
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   853
    anObject notNil ifTrue:[
1954
1344ec1f99eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1918
diff changeset
   854
        org := anObject computeOrigin.
2849
e061cea3416f changed: #moveObject:to:
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
   855
        org notNil ifTrue:[
e061cea3416f changed: #moveObject:to:
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
   856
            delta := aPoint - org.
e061cea3416f changed: #moveObject:to:
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
   857
            delta := (self alignToGrid:aPoint) - org.
e061cea3416f changed: #moveObject:to:
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
   858
            dX := delta x.
e061cea3416f changed: #moveObject:to:
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
   859
            dY := delta y.
e061cea3416f changed: #moveObject:to:
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
   860
e061cea3416f changed: #moveObject:to:
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
   861
            undoHistory withoutTransactionDo:[
e061cea3416f changed: #moveObject:to:
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
   862
                self shiftLayout:anObject horizontal:dX vertical:dY
e061cea3416f changed: #moveObject:to:
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
   863
            ]
1954
1344ec1f99eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1918
diff changeset
   864
        ]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   865
    ]
2849
e061cea3416f changed: #moveObject:to:
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
   866
e061cea3416f changed: #moveObject:to:
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
   867
    "Modified: / 25-07-2011 / 17:27:08 / cg"
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   868
!
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
startObjectMoveAt:aPoint
2501
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   871
    "start object(s) move at a point"
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   872
128
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
   873
    self startObjectMove:(self selection) at:aPoint.
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
   874
    movedObject := self selection.
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
   875
9779b7459a1c selection and update from selection
ca
parents: 123
diff changeset
   876
    movedObject isCollection ifFalse:[
1451
f7c591a04f00 drag resize: wait for expose before continue
ca
parents: 1438
diff changeset
   877
        movedObject := Array with:movedObject
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   878
    ].
2501
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   879
"/    self setSelection:nil withRedraw:true.
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   880
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   881
    moveDelta := movedObject collect:[:aView | aPoint - aView computeOrigin].
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   882
175
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   883
    self transaction:#move objects:movedObject do:[:v|self createUndoLayout:v].
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
   884
    self invertOutlineOf:movedObject.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   885
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   886
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   887
startSelectMoreOrMove:aPoint
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   888
    "add/remove to/from selection"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   889
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   890
    |anObject|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   891
119
39acd704ad51 testMode is now a ValueHolder
ca
parents: 113
diff changeset
   892
    self enabled ifFalse:[^ self].
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
    anObject := self findObjectAt:aPoint.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   895
    anObject notNil ifTrue:[
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1112
diff changeset
   896
	(self isSelected:anObject) ifTrue:[
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1112
diff changeset
   897
	    self removeFromSelection:anObject
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1112
diff changeset
   898
	] ifFalse:[
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1112
diff changeset
   899
	    self addToSelection:anObject
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1112
diff changeset
   900
	]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   901
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   902
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   903
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   904
startSelectOrMove:aPoint
2356
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   905
    "a button is pressed at a point; start moving or selecting"
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   906
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   907
    |selectedView containerOfSelectedView
2501
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   908
     clickedView viewOperatedUpon borderHandleSelector pView|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   909
119
39acd704ad51 testMode is now a ValueHolder
ca
parents: 113
diff changeset
   910
    self enabled ifFalse:[^ self].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   911
2356
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   912
    selectedView := self singleSelection.
2364
121c79884983 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2356
diff changeset
   913
121c79884983 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2356
diff changeset
   914
"/    clickedView := self findObjectAt:aPoint.
121c79884983 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2356
diff changeset
   915
"/    (clickedView notNil 
121c79884983 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2356
diff changeset
   916
"/    and:[clickedView isComponentOf:selectedView]) ifTrue:[
121c79884983 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2356
diff changeset
   917
"/        self unselect.
121c79884983 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2356
diff changeset
   918
"/        selectedView := nil.    
121c79884983 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2356
diff changeset
   919
"/    ].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   920
2501
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   921
    "/ if there is already a selection, see if user clicked onto a handle
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   922
    "/ then, this may be the start of a resize operation.
2356
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   923
    selectedView notNil ifTrue:[
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   924
        containerOfSelectedView := self findContainerOfView:selectedView.
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   925
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   926
        containerOfSelectedView specClass canResizeSubComponents ifTrue:[
2501
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   927
            borderHandleSelector := self whichHandleOf:selectedView isHitBy:aPoint.
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   928
            (borderHandleSelector notNil and:[borderHandleSelector ~~ #view]) ifTrue:[
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
   929
                self startResizeBorder:borderHandleSelector.
2356
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   930
                ^ self
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   931
            ]
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   932
        ].
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   933
        viewOperatedUpon := selectedView.
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   934
3261
b830ad071eb5 device access
Claus Gittinger <cg@exept.de>
parents: 3219
diff changeset
   935
        pView := device translatePoint:aPoint fromView:self toView:selectedView superView.
2356
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   936
        (selectedView bounds containsPoint:pView) ifFalse:[
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   937
            "/ clicked outside the selection
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   938
            (self sensor ctrlDown and:[self canChangeLayoutOfView:selectedView]) ifFalse:[
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   939
                viewOperatedUpon := nil
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   940
            ]
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   941
        ]
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   942
    ].
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
   943
2364
121c79884983 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2356
diff changeset
   944
    clickedView := self findObjectAt:aPoint.
2368
Claus Gittinger <cg@exept.de>
parents: 2364
diff changeset
   945
    clickedView notNil ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 2364
diff changeset
   946
        (clickedView isComponentOf:selectedView) ifTrue:[
2530
73efe0a84f4b no need to unselect/select in startSelectOrMove (avoid flicker)
Claus Gittinger <cg@exept.de>
parents: 2528
diff changeset
   947
            "/ self unselect.
2368
Claus Gittinger <cg@exept.de>
parents: 2364
diff changeset
   948
            selectedView := nil.    
Claus Gittinger <cg@exept.de>
parents: 2364
diff changeset
   949
            viewOperatedUpon := nil
Claus Gittinger <cg@exept.de>
parents: 2364
diff changeset
   950
        ] ifFalse:[
2530
73efe0a84f4b no need to unselect/select in startSelectOrMove (avoid flicker)
Claus Gittinger <cg@exept.de>
parents: 2528
diff changeset
   951
            "/ self unselect.
2368
Claus Gittinger <cg@exept.de>
parents: 2364
diff changeset
   952
            selectedView := nil.    
Claus Gittinger <cg@exept.de>
parents: 2364
diff changeset
   953
            viewOperatedUpon := clickedView
Claus Gittinger <cg@exept.de>
parents: 2364
diff changeset
   954
        ].
2364
121c79884983 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2356
diff changeset
   955
    ].
121c79884983 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2356
diff changeset
   956
2356
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   957
    viewOperatedUpon isNil ifTrue:[
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   958
        clickedView isNil ifTrue:[
2538
ded6eb784054 refactored selectAll to allow for rectangle-drag in UIObjectView
Claus Gittinger <cg@exept.de>
parents: 2536
diff changeset
   959
            "/ clicked outside - start a rectangle drag.
2356
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   960
            self select:nil.
2538
ded6eb784054 refactored selectAll to allow for rectangle-drag in UIObjectView
Claus Gittinger <cg@exept.de>
parents: 2536
diff changeset
   961
            self startRectangleDrag:aPoint.
2356
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   962
            ^ self.
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   963
        ].
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   964
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   965
        (self canChangeLayoutOfView:clickedView) ifFalse:[
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   966
            self select:clickedView.
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   967
            ^ self
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   968
        ].
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   969
        viewOperatedUpon := clickedView
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   970
    ].
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   971
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   972
    (self isSelected:viewOperatedUpon) ifFalse:[
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   973
        self select:viewOperatedUpon.
60
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
    (self numberOfSelections ~~ 1) ifTrue:[
2356
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   977
        releaseAction := 
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   978
            [
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   979
                self setDefaultActions.
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   980
                self select:viewOperatedUpon
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   981
            ]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   982
    ] ifFalse:[
2356
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   983
        releaseAction := [self setDefaultActions]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   984
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   985
2356
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   986
    "prepare move operation for an object"
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   987
    motionAction := 
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   988
        [:movePoint|
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   989
            (aPoint dist:movePoint) > 4.0 ifTrue:[
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   990
                self startObjectMoveAt:aPoint
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   991
            ]
bb961692c387 clicking on an already selected object for move
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
   992
        ].
60
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
!UIObjectView methodsFor:'object resize'!
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
actionResize:anObject selector:aSelector
2536
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   998
    "create and initialize action for resize"
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   999
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1000
    |delta|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1001
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1002
    delta    := anObject container originRelativeTo:self.
543
e3f2bf2dfb59 eliminated use of Structure - added private ResizeData class instead
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  1003
    resizeData := ResizeData new
2536
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1004
                        object:anObject 
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1005
                        selector:aSelector
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1006
                        delta:delta.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1007
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1008
"can change cursor dependent on vertical/horizontal resizing
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1009
"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1010
    oldCursor := cursor.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1011
    self cursor:(Cursor leftHand).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1012
543
e3f2bf2dfb59 eliminated use of Structure - added private ResizeData class instead
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  1013
    "Modified: / 2.2.1998 / 13:40:55 / cg"
60
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
doDragResize:aPoint
2536
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1017
    "do a widget resize drag"
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1018
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1019
    |p object|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1020
175
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
  1021
    object := resizeData object.
2536
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1022
    p := (self alignToGrid:aPoint) - (resizeData delta).
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1023
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1024
    (self resize:object handle:(resizeData selector) to:p check:true) ifFalse:[
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1025
        ^ self  "/ no real change (due to align)
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1026
    ].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1027
2514
faf45b01db30 moving non-layout objects
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1028
    self hideSelection.
faf45b01db30 moving non-layout objects
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1029
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1030
    self invertOutlineOf:object.
2536
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1031
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1032
    self resize:object handle:(resizeData selector) to:p check:false.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1033
1451
f7c591a04f00 drag resize: wait for expose before continue
ca
parents: 1438
diff changeset
  1034
    Delay waitForSeconds:0.05.
f7c591a04f00 drag resize: wait for expose before continue
ca
parents: 1438
diff changeset
  1035
    [self sensor hasExposeEventFor:nil] whileTrue:[
f7c591a04f00 drag resize: wait for expose before continue
ca
parents: 1438
diff changeset
  1036
        self windowGroup processExposeEvents
f7c591a04f00 drag resize: wait for expose before continue
ca
parents: 1438
diff changeset
  1037
    ].
f7c591a04f00 drag resize: wait for expose before continue
ca
parents: 1438
diff changeset
  1038
79
33212fbe9766 resize extent
ca
parents: 78
diff changeset
  1039
   "/ object geometryLayout:(object geometryLayout).
2501
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
  1040
    self invertOutlineOf:object.
43386f544f3d cleaned up the code and fixed many bugs;
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
  1041
2514
faf45b01db30 moving non-layout objects
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1042
    self showSelection.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1043
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1044
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1045
endResize
2536
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1046
    "cleanup after object resize"
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1047
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1048
    |object savedSelection anyLayoutWrapper anyTransparentBox|
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1049
175
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
  1050
    object := resizeData object.
0b0b4d99e3e7 isResizeable
ca
parents: 156
diff changeset
  1051
    resizeData := nil.
61
85ef247db6b1 so far so good ...
ca
parents: 60
diff changeset
  1052
2536
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1053
    "/ container objects might want to rearrange their elements after a size change;
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1054
    "/ therefore, we hide the handles while this is possibly done.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1055
    "/ however, to avoid flicker, we check for containers first.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1056
    anyLayoutWrapper := anyTransparentBox := false.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1057
    self forEach:object do:[:aViewOrComponent | 
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1058
        aViewOrComponent isLayoutWrapper ifTrue:[ anyLayoutWrapper := true ].
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1059
        aViewOrComponent isTransparentBox ifTrue:[ anyTransparentBox := true ].
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1060
    ].
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1061
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1062
    (anyLayoutWrapper or:[anyTransparentBox]) ifTrue:[
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1063
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1064
        self invertOutlineOf:object.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1065
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1066
        "/ temporarily hide the selection, in order to allow the container to move the
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1067
        "/ element around...
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1068
        savedSelection := selection.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1069
        self setSelection:nil withRedraw:true.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1070
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1071
        "/ handle any expose events (for subcomponents) before
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1072
        "/ redrawing the handles.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1073
        self windowGroup processExposeEvents.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1074
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1075
        self elementChangedSize:object.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1076
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1077
        "/ handle any expose events (for subcomponents) before
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1078
        "/ redrawing the handles.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1079
        Delay waitForSeconds:0.05.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1080
        [self sensor hasExposeEventFor:nil] whileTrue:[
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1081
            self windowGroup processExposeEvents
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1082
        ].
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1083
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1084
        self forEach:savedSelection do:[:aView |
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1085
            self recomputeShapeIfTransparentBox:aView.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1086
        ].
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1087
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1088
        self setSelection:object withRedraw:true.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1089
    ].
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1090
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1091
    self layoutChanged.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1092
    self setDefaultActions.
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
1827
691d1471cd3e WOs changes
werner
parents: 1746
diff changeset
  1095
layoutChanged
691d1471cd3e WOs changes
werner
parents: 1746
diff changeset
  1096
!
691d1471cd3e WOs changes
werner
parents: 1746
diff changeset
  1097
2536
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1098
resize:aView bottom:aPoint
3473
3449a8a8aecc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3451
diff changeset
  1099
    "obsolete: resize a view's bottom"
2536
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1100
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1101
    self resize:aView handle:#bottom to:aPoint check:false.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1102
"/    undoHistory withoutTransactionDo:[
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1103
"/        self shiftLayout:aView top:0 bottom:((aPoint y) - (aView computeCorner y))
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1104
"/    ].
3473
3449a8a8aecc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3451
diff changeset
  1105
3449a8a8aecc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3451
diff changeset
  1106
    "Modified (comment): / 31-08-2017 / 20:16:31 / cg"
2536
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1107
!
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1108
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1109
resize:aView bottomLeft:aPoint
3473
3449a8a8aecc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3451
diff changeset
  1110
    "obsolete: resize a view's bottom and left"
2536
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1111
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1112
    self resize:aView handle:#bottomLeft to:aPoint check:false.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1113
"/    undoHistory withoutTransactionDo:[
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1114
"/        self shiftLayout:aView top:0
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1115
"/                            bottom:((aPoint y) - (aView computeCorner y))
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1116
"/                              left:((aPoint x) - (aView computeOrigin x))
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1117
"/                             right:0
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1118
"/
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1119
"/    ]
3473
3449a8a8aecc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3451
diff changeset
  1120
3449a8a8aecc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3451
diff changeset
  1121
    "Modified (comment): / 31-08-2017 / 20:16:35 / cg"
2536
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1122
!
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1123
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1124
resize:aView corner:aPoint
3473
3449a8a8aecc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3451
diff changeset
  1125
    "obsolete: resize a view's corner"
2536
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1126
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1127
    self resize:aView handle:#corner to:aPoint check:false.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1128
"/    |delta|
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1129
"/
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1130
"/    delta := aPoint - aView computeCorner.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1131
"/    undoHistory withoutTransactionDo:[
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1132
"/        self shiftLayout:aView top:0 bottom:(delta y) left:0 right:(delta x)
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1133
"/    ]
3473
3449a8a8aecc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3451
diff changeset
  1134
3449a8a8aecc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3451
diff changeset
  1135
    "Modified (comment): / 31-08-2017 / 20:16:40 / cg"
2536
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1136
!
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1137
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1138
resize:aComponent endPoint:newEndPoint
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1139
    "obsolete: move a component's endPoint"
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1140
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1141
    self resize:aComponent handle:#endPoint to:newEndPoint check:false
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1142
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1143
"/    undoHistory 
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1144
"/        withoutTransactionDo:[
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1145
"/            self shiftLayout:aComponent startPoint:0 endPoint:(newEndPoint - (aComponent endPoint))
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1146
"/        ]
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1147
!
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1148
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1149
resize:aComponent handle:aSymbol to:aPoint check:doCheck
3473
3449a8a8aecc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3451
diff changeset
  1150
    "resize a view's handle - if doCheck is true, only check if the handle would change
2536
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1151
     (used to avoid flicker, when an aligned move would actually not move anything)"
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1152
3451
1c9aad7b074f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3445
diff changeset
  1153
    <ignore: RBReturnsBooleanAndOtherRule rationale:'only returns boolean if doCheck' author:'cg'>
1c9aad7b074f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3445
diff changeset
  1154
    
2536
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1155
    |newX newY oldBottom oldTop oldLeft oldRight 
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1156
     oldOrigin oldCorner shiftTop shiftBottom shiftLeft shiftRight|
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1157
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1158
    aSymbol == #startPoint ifTrue:[
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1159
        doCheck ifTrue:[
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1160
            ^ aPoint ~= (aComponent startPoint)
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1161
        ].
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1162
        self 
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1163
            shiftLayout:aComponent 
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1164
            startPoint:(aPoint - (aComponent startPoint)) endPoint:0.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1165
        ^ self.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1166
    ].
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1167
    aSymbol == #endPoint ifTrue:[
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1168
        doCheck ifTrue:[
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1169
            ^ aPoint ~= (aComponent endPoint)
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1170
        ].
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1171
        self 
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1172
            shiftLayout:aComponent 
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1173
            startPoint:0 endPoint:(aPoint - (aComponent endPoint)).
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1174
        ^ self.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1175
    ].
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1176
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1177
    newX := aPoint x.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1178
    newY := aPoint y.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1179
    shiftTop := shiftBottom := shiftLeft := shiftRight := 0.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1180
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1181
    oldOrigin := aComponent computeOrigin.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1182
    oldCorner := aComponent computeCorner.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1183
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1184
    oldTop := oldOrigin y.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1185
    oldBottom := oldCorner y.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1186
    oldLeft := oldOrigin x.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1187
    oldRight := oldCorner x.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1188
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1189
    aSymbol == #bottom ifTrue:[
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1190
        shiftBottom := newY - oldBottom.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1191
    ]. 
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1192
    aSymbol == #top ifTrue:[     
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1193
        shiftTop := newY - oldTop.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1194
    ].
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1195
    aSymbol == #left ifTrue:[
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1196
        shiftLeft := newX - oldLeft.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1197
    ].
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1198
    aSymbol == #right ifTrue:[
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1199
        shiftRight := newX - oldRight.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1200
    ].
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1201
    aSymbol == #origin ifTrue:[
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1202
        shiftLeft := newX - oldLeft.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1203
        shiftTop := newY - oldTop.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1204
    ].
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1205
    aSymbol == #topRight ifTrue:[
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1206
        shiftRight := newX - oldRight.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1207
        shiftTop := newY - oldTop.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1208
    ].
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1209
    aSymbol == #corner ifTrue:[
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1210
        shiftRight := newX - oldRight.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1211
        shiftBottom := newY - oldBottom.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1212
    ].
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1213
    aSymbol == #bottomLeft ifTrue:[
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1214
        shiftLeft := newX - oldLeft.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1215
        shiftBottom := newY - oldBottom.
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1216
    ].
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1217
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1218
    doCheck ifTrue:[
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1219
        ^ (shiftTop ~= 0) or:[ shiftBottom ~= 0 or:[ shiftLeft ~= 0 or:[ shiftRight ~= 0 ]]]
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1220
    ].
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1221
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1222
    undoHistory withoutTransactionDo:[
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1223
        self 
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1224
            shiftLayout:aComponent 
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1225
            top:shiftTop bottom:shiftBottom 
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1226
            left:shiftLeft right:shiftRight
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1227
    ].
3451
1c9aad7b074f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3445
diff changeset
  1228
1c9aad7b074f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3445
diff changeset
  1229
    "Modified: / 16-07-2017 / 14:00:05 / cg"
3473
3449a8a8aecc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3451
diff changeset
  1230
    "Modified (comment): / 31-08-2017 / 20:16:50 / cg"
2536
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1231
!
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1232
408cba0cbef4 many redraw changes to avoid flicker when resizing or moving
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
  1233
resize:aView left:aPoint
3473
3449a8a8aecc #DOCUMENTATION by cg
Claus Gittinger <cg