UIPainterView.st
author ca
Wed, 15 Oct 1997 12:41:27 +0200
changeset 330 643ac5544426
parent 327 0040d47658c6
child 335 9f048ededd7d
permissions -rw-r--r--
use: resolveName:
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
     1
"
156
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
     2
 COPYRIGHT (c) 1995 by Claus Gittinger / eXept Software AG
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
     3
              All Rights Reserved
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
     4
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
     5
 This software is furnished under a license and may be used
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
     6
 only in accordance with the terms of that license and with the
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
     8
 be provided or otherwise made available to, or used by, any
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
     9
 other person.  No title to or ownership of the software is
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    10
 hereby transferred.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    11
"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    12
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    13
UIObjectView subclass:#UIPainterView
278
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
    14
	instanceVariableNames:'treeView listHolder superclassName className methodName
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
    15
		categoryName'
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    16
	classVariableNames:'HandCursor'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    17
	poolDictionaries:''
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    18
	category:'Interface-UIPainter'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    19
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    20
211
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
    21
Object subclass:#ViewProperty
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
    22
	instanceVariableNames:'view spec identifier'
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
    23
	classVariableNames:'Identifier'
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
    24
	poolDictionaries:''
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
    25
	privateIn:UIPainterView
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
    26
!
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
    27
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    28
!UIPainterView class methodsFor:'documentation'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    29
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    30
copyright
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    31
"
156
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
    32
 COPYRIGHT (c) 1995 by Claus Gittinger / eXept Software AG
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
    33
              All Rights Reserved
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    34
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    35
 This software is furnished under a license and may be used
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    36
 only in accordance with the terms of that license and with the
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    37
 inclusion of the above copyright notice.   This software may not
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    38
 be provided or otherwise made available to, or used by, any
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    39
 other person.  No title to or ownership of the software is
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    40
 hereby transferred.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    41
"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    42
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    43
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    44
documentation
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    45
"
128
9779b7459a1c selection and update from selection
ca
parents: 121
diff changeset
    46
    buildIn view used by the UIPainter; from this view, the layout of the
9779b7459a1c selection and update from selection
ca
parents: 121
diff changeset
    47
    new application derives from.
9779b7459a1c selection and update from selection
ca
parents: 121
diff changeset
    48
9779b7459a1c selection and update from selection
ca
parents: 121
diff changeset
    49
    [see also:]
9779b7459a1c selection and update from selection
ca
parents: 121
diff changeset
    50
        UIBuilder
9779b7459a1c selection and update from selection
ca
parents: 121
diff changeset
    51
        UIObjectView
156
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
    52
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
    53
    [author:]
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
    54
        Claus Gittinger
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
    55
        Claus Atzkern
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    56
"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    57
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    58
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    59
!UIPainterView class methodsFor:'defaults'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    61
defaultMenuMessage   
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    62
    "This message is the default yo be sent to the menuHolder to get a menu
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    63
    "
121
96d6feeeb049 middleButtonMen:
ca
parents: 119
diff changeset
    64
    ^ #showMiddleButtonMenu
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    65
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    66
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    67
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    68
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    69
!UIPainterView methodsFor:'accessing'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    70
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    71
application
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    72
    ^ nil
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    73
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    74
    "Modified: 6.9.1995 / 00:46:44 / claus"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    75
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    76
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
    77
applicationName
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
    78
    ^ self className
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
    79
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
    80
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
    81
applicationName:aName
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
    82
    self className:aName
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
    83
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
    84
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    85
className
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    86
    ^ className
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    87
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    88
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
    89
className:aName
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
    90
    className := aName
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    91
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    92
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    93
className:aClassName superclassName:aSuperclassName selector:aSelector
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
    94
    className      := aClassName.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    95
    superclassName := aSuperclassName.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
    96
    methodName     := aSelector.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    97
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    98
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    99
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   100
findInputViewIn:aSuperView
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   101
    "returns index of input view into superview or nil
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   102
    "
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   103
    aSuperView == self ifTrue:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   104
        ^ self subViews findFirst:[:v| v == inputView ]
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   105
    ].
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   106
  ^ 0
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   107
!
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   108
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   109
inputView
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   110
    ^ inputView
111
ca
parents: 103
diff changeset
   111
!
ca
parents: 103
diff changeset
   112
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   113
methodName
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   114
    ^ methodName
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   115
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   116
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   117
methodName:aName
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   118
    methodName := aName
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   119
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   120
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   121
selectNames:aStringOrCollection
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   122
    |prop coll s|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   123
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   124
    (aStringOrCollection isNil or:[aStringOrCollection isEmpty]) ifTrue:[
131
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
   125
        ^ self select:nil
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   126
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   127
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   128
    (s := aStringOrCollection) isString ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   129
        s size == 1 ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   130
            s := s first
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   131
        ] ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   132
            coll := OrderedCollection new.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   133
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   134
            s do:[:aName|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   135
                (prop := self propertyOfName:aName) notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   136
                    coll add:(prop view)
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   137
                ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   138
            ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   139
            coll size == 1 ifTrue:[ ^ self select:(coll at:1) ].
131
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
   140
            coll size == 0 ifTrue:[ ^ self select:nil ].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   141
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   142
          ^ self select:coll.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   143
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   144
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   145
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   146
    prop := self propertyOfName:s.
131
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
   147
    prop isNil ifTrue:[^ self select:nil]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   148
              ifFalse:[^ self select:(prop view)]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   149
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   150
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   151
111
ca
parents: 103
diff changeset
   152
!UIPainterView methodsFor:'change & update'!
ca
parents: 103
diff changeset
   153
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   154
layoutChanged
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   155
    treeView layoutChanged
111
ca
parents: 103
diff changeset
   156
! !
ca
parents: 103
diff changeset
   157
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   158
!UIPainterView methodsFor:'copy & cut & paste'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   159
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   160
copySelection
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   161
    "copy the selection into the cut&paste-buffer
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   162
    "
71
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   163
    |specs coll|
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   164
128
9779b7459a1c selection and update from selection
ca
parents: 121
diff changeset
   165
    coll := self minSetOfSuperViews:(self selection).
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   166
71
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   167
    coll notNil ifTrue:[
131
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
   168
        self select:nil.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   169
        specs := coll collect:[:aView| self fullSpecFor:aView ].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   170
        self setSelection:specs
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   171
    ].
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   172
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   173
60
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
deleteSelection
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   177
    "delete the selection; copy the selection into the cut&paste-buffer
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   178
     and open a transaction
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   179
    "
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
   180
    |specs coll|
71
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   181
128
9779b7459a1c selection and update from selection
ca
parents: 121
diff changeset
   182
    coll := self minSetOfSuperViews:(self selection).
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   183
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   184
    coll notNil ifTrue:[
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   185
        treeView cvsEventsDisabledDo:[
131
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
   186
            self select:nil.
111
ca
parents: 103
diff changeset
   187
            specs := coll collect:[:aView| self fullSpecFor:aView ].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   188
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
   189
            self withinTransaction:#cut objects:coll do:[
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
   190
                coll reverseDo:[:aView|
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
   191
                    self createUndoRemove:aView.
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
   192
                    self remove:aView
111
ca
parents: 103
diff changeset
   193
                ]
ca
parents: 103
diff changeset
   194
            ].
ca
parents: 103
diff changeset
   195
            self setSelection:specs.
ca
parents: 103
diff changeset
   196
        ]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   197
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   198
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   199
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   200
pasteBuffer
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   201
    "add the objects in the paste-buffer to the object view
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   202
    "
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   203
    |sel|
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   204
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   205
    sel := self pasteSpecifications:(self getSelection) keepLayout:false.
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   206
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   207
    sel notNil ifTrue:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   208
        self select:sel.
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   209
    ].
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   210
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   211
!
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   212
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   213
pasteSpecifications:aSpecificationOrList keepLayout:keepLayout
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   214
    "add the specs to the object view; returns list of pasted components
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   215
    "
278
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   216
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   217
    ^ self
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   218
        pasteSpecifications:aSpecificationOrList 
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   219
        keepLayout:keepLayout 
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   220
        at:nil
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   221
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   222
    "Modified: 11.8.1997 / 01:00:35 / cg"
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   223
!
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   224
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   225
pasteSpecifications:aSpecificationOrList keepLayout:keepLayout at:aPointOrNil
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   226
    "add the specs to the object view; returns list of pasted components
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   227
    "
312
386932d91a97 paste at a point; first translate the point
ca
parents: 310
diff changeset
   228
    |paste frame pasteOrigin pasteOffset builder newSel bounds|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   229
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   230
    (self canPaste:aSpecificationOrList) ifFalse:[
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   231
        ^ nil
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   232
    ].
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   233
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   234
    treeView cvsSetupListDo:[
165
f7df2a53d042 less change notifications
ca
parents: 162
diff changeset
   235
        aSpecificationOrList isCollection ifTrue:[
f7df2a53d042 less change notifications
ca
parents: 162
diff changeset
   236
            paste := aSpecificationOrList
f7df2a53d042 less change notifications
ca
parents: 162
diff changeset
   237
        ] ifFalse:[
f7df2a53d042 less change notifications
ca
parents: 162
diff changeset
   238
            paste := Array with:aSpecificationOrList
f7df2a53d042 less change notifications
ca
parents: 162
diff changeset
   239
        ].
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   240
        (frame := self singleSelection) isNil ifTrue:[
165
f7df2a53d042 less change notifications
ca
parents: 162
diff changeset
   241
            frame := self
f7df2a53d042 less change notifications
ca
parents: 162
diff changeset
   242
        ].
f7df2a53d042 less change notifications
ca
parents: 162
diff changeset
   243
        self setSelection:nil withRedraw:true.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   244
165
f7df2a53d042 less change notifications
ca
parents: 162
diff changeset
   245
        newSel  := OrderedCollection new.
f7df2a53d042 less change notifications
ca
parents: 162
diff changeset
   246
        builder := UIBuilder new.
212
1836a16763cc oops again
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
   247
        className notNil ifTrue:[
330
ca
parents: 327
diff changeset
   248
            builder applicationClass:(self resolveName:className)
212
1836a16763cc oops again
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
   249
        ].
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   250
165
f7df2a53d042 less change notifications
ca
parents: 162
diff changeset
   251
        keepLayout ifFalse:[
f7df2a53d042 less change notifications
ca
parents: 162
diff changeset
   252
            pasteOffset := 0@0.
312
386932d91a97 paste at a point; first translate the point
ca
parents: 310
diff changeset
   253
278
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   254
            aPointOrNil isNil ifTrue:[
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   255
                pasteOrigin := self sensor mousePoint.
312
386932d91a97 paste at a point; first translate the point
ca
parents: 310
diff changeset
   256
                pasteOrigin := device translatePoint:pasteOrigin
386932d91a97 paste at a point; first translate the point
ca
parents: 310
diff changeset
   257
                                            from:device rootView id
386932d91a97 paste at a point; first translate the point
ca
parents: 310
diff changeset
   258
                                              to:frame id.
278
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   259
            ] ifFalse:[
312
386932d91a97 paste at a point; first translate the point
ca
parents: 310
diff changeset
   260
                pasteOrigin := device translatePoint:aPointOrNil
386932d91a97 paste at a point; first translate the point
ca
parents: 310
diff changeset
   261
                                                from:self id
386932d91a97 paste at a point; first translate the point
ca
parents: 310
diff changeset
   262
                                                  to:frame id.
386932d91a97 paste at a point; first translate the point
ca
parents: 310
diff changeset
   263
            ]
386932d91a97 paste at a point; first translate the point
ca
parents: 310
diff changeset
   264
        ].
386932d91a97 paste at a point; first translate the point
ca
parents: 310
diff changeset
   265
        keepLayout ifFalse:[
386932d91a97 paste at a point; first translate the point
ca
parents: 310
diff changeset
   266
            bounds := Rectangle origin:0@0 extent:(frame bounds extent)
165
f7df2a53d042 less change notifications
ca
parents: 162
diff changeset
   267
        ].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   268
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   269
        paste do:[:aSpec|
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   270
            |view|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   271
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   272
            view := self addSpec:aSpec builder:builder in:frame.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   273
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   274
            keepLayout ifFalse:[
312
386932d91a97 paste at a point; first translate the point
ca
parents: 310
diff changeset
   275
                (bounds containsPoint:pasteOrigin) ifFalse:[
315
056c9fe74cc6 remove a halt statement
ca
parents: 312
diff changeset
   276
                    self moveObject:view to:pasteOffset.
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   277
                ] ifTrue:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   278
                    self moveObject:view to:pasteOrigin + pasteOffset.
111
ca
parents: 103
diff changeset
   279
                ].
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   280
                pasteOffset := pasteOffset + 4
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   281
            ].
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   282
            view realize.
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   283
            newSel add:view.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   284
        ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   285
165
f7df2a53d042 less change notifications
ca
parents: 162
diff changeset
   286
        self withinTransaction:#paste objects:newSel do:[
f7df2a53d042 less change notifications
ca
parents: 162
diff changeset
   287
            undoHistory addUndoSelector:#undoCreate:
f7df2a53d042 less change notifications
ca
parents: 162
diff changeset
   288
                               withArgs:(newSel collect:[:v|(self propertyOfView:v) identifier])
f7df2a53d042 less change notifications
ca
parents: 162
diff changeset
   289
        ].
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
   290
165
f7df2a53d042 less change notifications
ca
parents: 162
diff changeset
   291
        self realizeAllSubViews.
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   292
        newSel do:[:v| v raise].
165
f7df2a53d042 less change notifications
ca
parents: 162
diff changeset
   293
        inputView raise.
f7df2a53d042 less change notifications
ca
parents: 162
diff changeset
   294
        self elementChangedSize:frame.
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   295
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   296
        newSel size == 1 ifTrue:[newSel := newSel at:1].
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   297
    ].
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   298
    ^ newSel
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   299
!
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   300
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   301
pasteWithLayout
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   302
    "add the objects in the paste-buffer to the object view; don't change the
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   303
     layout
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   304
    "
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   305
    |sel|
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   306
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   307
    sel := self pasteSpecifications:(self getSelection) keepLayout:true.
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   308
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   309
    sel notNil ifTrue:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   310
        self select:sel.
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   311
    ].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   312
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   313
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   314
!UIPainterView methodsFor:'drag & drop'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   315
288
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   316
canDrop:something
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   317
    "returns true if something can be droped
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   318
    "
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   319
    (something size == 1 and:[self enabled and:[self numberOfSelections <= 1]]) ifTrue:[
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   320
      ^ something first theObject isKindOf:UISpecification
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   321
    ].
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   322
    ^ false
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   323
!
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   324
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   325
canPaste
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   326
    "returns true if something to be past exists and can be paste into
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   327
     the selection if exists
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   328
    "
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   329
    ^ self canPaste:(self getSelection)
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   330
!
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   331
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   332
canPaste:something
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   333
    "returns true if something could be paste
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   334
    "
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   335
    |el size|
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   336
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   337
    ((size := self numberOfSelections) <= 1 and:[self enabled]) ifFalse:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   338
        ^ false
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   339
    ].
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   340
    something isCollection ifTrue:[something notEmpty ifTrue:[el := something first]]
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   341
                          ifFalse:[el := something].
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   342
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   343
    (el isKindOf:UISpecification) ifFalse:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   344
        ^ false
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   345
    ].
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   346
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   347
    size == 1 ifTrue:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   348
        ^ self canPasteInto:(self singleSelection)
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   349
    ].
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   350
  ^ true
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   351
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   352
!
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   353
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   354
canPasteInto:aView
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   355
    "can paste into a view
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   356
    "
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   357
    |prop|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   358
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   359
    aView notNil ifTrue:[
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   360
        (prop := self propertyRespondsToView:aView) notNil ifTrue:[
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   361
            ^ prop spec class supportsSubComponents
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   362
        ].
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   363
      ^ aView specClass supportsSubComponents.
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   364
    ].
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   365
    ^ false
96
73725336b4fe dont paste into scrollable selectionInListViews ...
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   366
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   367
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   368
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   369
drop:anObjectOrCollection at:aPoint
278
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   370
    |spec newSel oldSel dragOffset|
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   371
288
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   372
    self selection notNil ifTrue:[
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   373
        oldSel := self singleSelection.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   374
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   375
        (self canPasteInto:oldSel) ifFalse:[
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   376
            oldSel := nil.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   377
            self setSelection:nil withRedraw:true
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   378
        ]
231
75de472d579f check whether selection is a view or a collection
ca
parents: 223
diff changeset
   379
    ].
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   380
    spec := (anObjectOrCollection at:1) theObject.
278
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   381
    dragOffset := DragAndDropManager dragOffsetQuerySignal raise.
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   382
    newSel := self pasteSpecifications:spec keepLayout:false at:aPoint - dragOffset.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   383
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   384
    oldSel isNil ifTrue:[self select:newSel]
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   385
                ifFalse:[self select:oldSel]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   386
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   387
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   388
!UIPainterView methodsFor:'generating output'!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   389
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   390
generateActionMethodFor:aspect spec:protoSpec inClass:targetClass
288
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   391
    |selector args showIt code alreadyInSuperclass|
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   392
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   393
    selector := aspect asSymbol.
141
d06c04391233 generate actions with argument
ca
parents: 137
diff changeset
   394
288
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   395
    alreadyInSuperclass := targetClass superclass canUnderstand:selector.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   396
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   397
    (selector numArgs) == 1 ifFalse:[
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   398
        args := ''.
149
e652608690b1 help ...
ca
parents: 146
diff changeset
   399
        showIt := ' ...''.\'.
e652608690b1 help ...
ca
parents: 146
diff changeset
   400
    ] ifTrue:[
288
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   401
        args := 'anArgument'.
149
e652608690b1 help ...
ca
parents: 146
diff changeset
   402
        showIt := ''' , anArgument printString , '' ...''.\'.
e652608690b1 help ...
ca
parents: 146
diff changeset
   403
    ].
141
d06c04391233 generate actions with argument
ca
parents: 137
diff changeset
   404
288
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   405
    code := '!!' , targetClass name , ' methodsFor:''actions''!!\\' ,
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   406
                aspect , args , '\' ,
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   407
                '    "automatically generated by UIPainter ..."\' ,
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   408
                '\' .
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   409
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   410
    alreadyInSuperclass ifTrue:[
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   411
        code := code ,
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   412
                    '    "action for ' , aspect , ' is already provided in a superclass."\' ,
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   413
                    '    "It may be redefined here ..."\\'.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   414
    ] ifFalse:[
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   415
        code := code ,
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   416
                    '    "action to be added ..."\\'.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   417
    ].
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   418
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   419
    code := code ,
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   420
                '    Transcript showCR:self class name, '': '.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   421
    alreadyInSuperclass ifTrue:[
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   422
        code := code , 'inherited '.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   423
    ].
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   424
    code := code , 'action for ' , aspect , showIt.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   425
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   426
    alreadyInSuperclass ifTrue:[
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   427
        code := code ,
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   428
                        '    super ' , aspect , args , '.\'.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   429
    ].
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   430
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   431
    code := code ,
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   432
                '!! !!\\'.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   433
    ^ code withCRs
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   434
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   435
    "Modified: 19.8.1997 / 12:03:20 / cg"
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   436
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   437
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   438
generateAspectMethodFor:aspect spec:protoSpec inClass:targetClass
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
   439
    |modelClass|
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
   440
149
e652608690b1 help ...
ca
parents: 146
diff changeset
   441
    modelClass := protoSpec defaultModelClassFor:aspect.
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
   442
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   443
    ^ ('!!' , targetClass name , ' methodsFor:''aspects''!!\\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   444
      aspect , '\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   445
      '    "automatically generated by UIPainter ..."\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   446
      '\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   447
      '    |holder|\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   448
      '\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   449
      '    (holder := builder bindingAt:#' , aspect , ') isNil ifTrue:[\' ,
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
   450
      '        builder aspectAt:#' , aspect , ' put:(holder := ' , ' ' , modelClass name , ' new' , ').\' ,
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   451
      '    ].\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   452
      '    ^ holder\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   453
      '!! !!\\') withCRs
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   454
!
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
generateAspectMethods
327
0040d47658c6 check - warnings eliminated. Fix in InspectorList.st
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   457
    |cls code skip modelSelector menuSelector protoSpec thisCode|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   458
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   459
    code := ''.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   460
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   461
    className isNil ifTrue:[
69
e533f77871dd generateAspectMethods: code2
ca
parents: 62
diff changeset
   462
        self warn:'set the class first'.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   463
        ^ code
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   464
    ].
330
ca
parents: 327
diff changeset
   465
    cls := self resolveName:className.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   466
316
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   467
    treeView propertiesDo:[:aProp|
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
   468
        protoSpec := aProp spec.
175
0b0b4d99e3e7 isResizeable
ca
parents: 165
diff changeset
   469
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   470
        (modelSelector := aProp model) notNil ifTrue:[
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   471
            (cls implements:modelSelector asSymbol) ifFalse:[
158
6e7f892308ae do not generate accept/cancel and help action methods,
Claus Gittinger <cg@exept.de>
parents: 156
diff changeset
   472
                skip := false.
6e7f892308ae do not generate accept/cancel and help action methods,
Claus Gittinger <cg@exept.de>
parents: 156
diff changeset
   473
                (cls isSubclassOf:SimpleDialog) ifTrue:[
6e7f892308ae do not generate accept/cancel and help action methods,
Claus Gittinger <cg@exept.de>
parents: 156
diff changeset
   474
                    skip := SimpleDialog implements:modelSelector asSymbol
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   475
                ].
158
6e7f892308ae do not generate accept/cancel and help action methods,
Claus Gittinger <cg@exept.de>
parents: 156
diff changeset
   476
                skip ifFalse:[
6e7f892308ae do not generate accept/cancel and help action methods,
Claus Gittinger <cg@exept.de>
parents: 156
diff changeset
   477
                    "/ kludge ..
6e7f892308ae do not generate accept/cancel and help action methods,
Claus Gittinger <cg@exept.de>
parents: 156
diff changeset
   478
                    (protoSpec isMemberOf:ActionButtonSpec) ifTrue:[
6e7f892308ae do not generate accept/cancel and help action methods,
Claus Gittinger <cg@exept.de>
parents: 156
diff changeset
   479
                        thisCode := (self generateActionMethodFor:modelSelector spec:protoSpec inClass:cls).
6e7f892308ae do not generate accept/cancel and help action methods,
Claus Gittinger <cg@exept.de>
parents: 156
diff changeset
   480
                    ] ifFalse:[
6e7f892308ae do not generate accept/cancel and help action methods,
Claus Gittinger <cg@exept.de>
parents: 156
diff changeset
   481
                        thisCode := (self generateAspectMethodFor:modelSelector spec:protoSpec inClass:cls).
6e7f892308ae do not generate accept/cancel and help action methods,
Claus Gittinger <cg@exept.de>
parents: 156
diff changeset
   482
                    ].
6e7f892308ae do not generate accept/cancel and help action methods,
Claus Gittinger <cg@exept.de>
parents: 156
diff changeset
   483
                    code := code , thisCode
6e7f892308ae do not generate accept/cancel and help action methods,
Claus Gittinger <cg@exept.de>
parents: 156
diff changeset
   484
                ].
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   485
            ].
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   486
        ].
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   487
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   488
        (menuSelector := aProp menu) notNil ifTrue:[
316
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   489
            thisCode := self generateMenuMethodFor:menuSelector spec:protoSpec inClass:cls.
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   490
            thisCode size ~~ 0 ifTrue:[
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   491
                code := code , thisCode
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   492
            ]
111
ca
parents: 103
diff changeset
   493
        ].
ca
parents: 103
diff changeset
   494
ca
parents: 103
diff changeset
   495
        aProp spec aspectSelectors do:[:aSel|
ca
parents: 103
diff changeset
   496
            (cls implements:aSel asSymbol) ifFalse:[
ca
parents: 103
diff changeset
   497
                thisCode := (self generateAspectMethodFor:aSel spec:protoSpec inClass:cls).
ca
parents: 103
diff changeset
   498
                code := code , thisCode
ca
parents: 103
diff changeset
   499
            ]
ca
parents: 103
diff changeset
   500
        ].
137
ca
parents: 134
diff changeset
   501
        aProp spec actionSelectors do:[:aSel|
ca
parents: 134
diff changeset
   502
            (cls implements:aSel asSymbol) ifFalse:[
ca
parents: 134
diff changeset
   503
                thisCode := (self generateActionMethodFor:aSel spec:protoSpec inClass:cls).
ca
parents: 134
diff changeset
   504
                code := code , thisCode
ca
parents: 134
diff changeset
   505
            ]
ca
parents: 134
diff changeset
   506
        ].
188
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   507
        aProp spec valueSelectors do:[:aSel|
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   508
            (cls implements:aSel asSymbol) ifFalse:[
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   509
                thisCode := (self generateValueMethodFor:aSel spec:protoSpec inClass:cls).
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   510
                code := code , thisCode
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   511
            ]
316
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   512
        ]
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   513
    ].
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   514
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   515
    protoSpec := treeView canvasSpec.
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   516
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   517
    (menuSelector := protoSpec menu) notNil ifTrue:[
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   518
        thisCode := self generateMenuMethodFor:menuSelector spec:protoSpec inClass:cls.
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   519
        thisCode size ~~ 0 ifTrue:[
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   520
            code := code , thisCode
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   521
        ]
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   522
    ].
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   523
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   524
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   525
    ^ code
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   526
!
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   527
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   528
generateMenuMethodFor:aspect spec:protoSpec inClass:aClass
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   529
    |code cperf performer category|
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   530
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   531
    (aClass implements:aspect asSymbol) ifFalse:[
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   532
        code := MenuEditor generateCodeFor:aClass menuSelector:(aspect asSymbol).
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   533
    ] ifTrue:[
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   534
        code := ''
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   535
    ].
111
ca
parents: 103
diff changeset
   536
316
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   537
    (protoSpec respondsTo:#menuPerformer) ifTrue:[
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   538
        performer := protoSpec menuPerformer.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   539
    ].
316
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   540
    performer notNil ifTrue:[
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   541
        performer := performer asSymbol.
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   542
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   543
        (aClass implements:performer) ifFalse:[
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   544
            category := MenuEditor sourceCategory.
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   545
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   546
            cperf  := Character excla asString 
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   547
                    , aClass name , ' methodsFor:' , category storeString
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   548
                    , Character excla asString , '\\'
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   549
                    , performer , '\'
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   550
                    , '    "this window spec was automatically generated by the UI Builder"\\'
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   551
                    , '    ^ self\\'
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   552
                    , '\'
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   553
                    , Character excla asString
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   554
                    , ' '
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   555
                    , Character excla asString
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   556
                    , '\\'.
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   557
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   558
            code := code, cperf.
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   559
        ]
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   560
    ].
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   561
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   562
    code size == 0 ifTrue:[
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   563
        ^ nil
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   564
    ].
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   565
  ^ code withCRs
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   566
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   567
188
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   568
generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   569
    ^ ('!!' , targetClass name , ' methodsFor:''values''!!\\' ,
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   570
      aspect , '\' ,
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   571
      '    "automatically generated by UIPainter ..."\' ,
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   572
      '\' ,
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   573
      '    "value to be added below ..."\' ,
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   574
      '    Transcript showCR:self class name , '': no value yet for ' , aspect , ' ...''.\' ,
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   575
      '\' ,
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   576
      '^ nil.' ,
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   577
      '!! !!\\') withCRs
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   578
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   579
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   580
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   581
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   582
!
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   583
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   584
generateWindowSpecMethodSource
310
a68c182d050f support of scrollers and menu for the canvas
ca
parents: 288
diff changeset
   585
    |spec str code category cls mthd|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   586
310
a68c182d050f support of scrollers and menu for the canvas
ca
parents: 288
diff changeset
   587
    spec := OrderedCollection new.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   588
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   589
    self subViews do:[:aView|
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   590
        aView ~~ inputView ifTrue:[
310
a68c182d050f support of scrollers and menu for the canvas
ca
parents: 288
diff changeset
   591
            spec add:(self fullSpecFor:aView)
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   592
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   593
    ].
310
a68c182d050f support of scrollers and menu for the canvas
ca
parents: 288
diff changeset
   594
    spec := treeView generateFullSpecForComponents:spec.
a68c182d050f support of scrollers and menu for the canvas
ca
parents: 288
diff changeset
   595
    str  := WriteStream on:String new.
a68c182d050f support of scrollers and menu for the canvas
ca
parents: 288
diff changeset
   596
    UISpecification prettyPrintSpecArray:spec on:str indent:5.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   597
178
fb8451053c96 keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
   598
    "/ if that method already exists, do not overwrite the category
fb8451053c96 keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
   599
fb8451053c96 keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
   600
    category := 'interface specs'.
330
ca
parents: 327
diff changeset
   601
    cls := self resolveName:className.
ca
parents: 327
diff changeset
   602
ca
parents: 327
diff changeset
   603
    cls notNil ifTrue:[
178
fb8451053c96 keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
   604
        (mthd := cls class compiledMethodAt:methodName asSymbol) notNil ifTrue:[
fb8451053c96 keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
   605
            category := mthd category.
fb8451053c96 keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
   606
        ]
fb8451053c96 keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
   607
    ].
fb8451053c96 keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
   608
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   609
    code := '!!'
178
fb8451053c96 keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
   610
            , className , ' class methodsFor:' , category storeString
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   611
            , '!!' , '\\'
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   612
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   613
            , methodName , '\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   614
            , '    "this window spec was automatically generated by the ST/X UIPainter"\\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   615
            , '    "do not manually edit this - the painter/builder may not be able to\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   616
            , '     handle the specification if its corrupted."\\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   617
            , '    "\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   618
            , '     UIPainter new openOnClass:' , className , ' andSelector:#' , methodName , '\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   619
            , '     ' , className , ' new openInterface:#' , methodName , '\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   620
            , '    "\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   621
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   622
    methodName = 'windowSpec' ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   623
        code := code , '    "' , className , ' open"\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   624
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   625
    code := code 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   626
            , '\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   627
            , '    <resource: #canvas>\\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   628
            , '    ^\' 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   629
            , '     ', str contents
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   630
            , '\'
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   631
            , '!! !!'
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   632
            , '\\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   633
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   634
    ^ code withCRs
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
    "Modified: 5.9.1995 / 21:01:35 / claus"
178
fb8451053c96 keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
   637
    "Modified: 24.6.1997 / 19:12:44 / cg"
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   638
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   639
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   640
!UIPainterView methodsFor:'initialization'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   641
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   642
initialize
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   643
    "setup attributes
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   644
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   645
    super initialize.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   646
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   647
    superclassName := 'ApplicationModel'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   648
    className      := 'NewApplication'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   649
    methodName     := 'windowSpec'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   650
    categoryName   := 'Applications'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   651
    HandCursor     := Cursor leftHand.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   652
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   653
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   654
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   655
setupFromSpec:specOrSpecArray
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   656
    |spec builder|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   657
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   658
    treeView cvsSetupListDo:[
111
ca
parents: 103
diff changeset
   659
        self removeAll.
ca
parents: 103
diff changeset
   660
        spec    := UISpecification from:specOrSpecArray.
ca
parents: 103
diff changeset
   661
        builder := UIBuilder new.
ca
parents: 103
diff changeset
   662
        spec window setupView:self topView for:builder.
ca
parents: 103
diff changeset
   663
        self addSpec:(spec component) builder:builder in:self.
ca
parents: 103
diff changeset
   664
        self realizeAllSubViews.
ca
parents: 103
diff changeset
   665
        inputView raise.
310
a68c182d050f support of scrollers and menu for the canvas
ca
parents: 288
diff changeset
   666
        treeView setAttributesFromWindowSpec:(spec window).
111
ca
parents: 103
diff changeset
   667
    ]
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   668
!
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   669
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   670
treeView:aTreeView
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   671
    treeView := aTreeView
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   672
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   673
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   674
!UIPainterView methodsFor:'menus'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   675
121
96d6feeeb049 middleButtonMen:
ca
parents: 119
diff changeset
   676
showMiddleButtonMenu
96d6feeeb049 middleButtonMen:
ca
parents: 119
diff changeset
   677
    "show the middle button menu; this returns nil
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   678
    "
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   679
    self enabled ifTrue:[
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   680
        (MenuPanel fromSpec:(UIPainter menuCanvas) receiver:self) startUp
111
ca
parents: 103
diff changeset
   681
    ].
121
96d6feeeb049 middleButtonMen:
ca
parents: 119
diff changeset
   682
  ^ nil
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   683
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   684
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   685
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   686
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   687
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   688
!UIPainterView methodsFor:'removing components'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   689
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   690
remove:anObject
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   691
    "remove anObject from the contents do redraw
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   692
    "
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
   693
    anObject notNil ifTrue:[
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   694
        treeView removeView:anObject.
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
   695
    ]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   696
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   697
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   698
removeAll
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   699
    "remove all objects and properties
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   700
    "
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   701
    treeView cvsEventsDisabledDo:[
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   702
        self  select:nil.
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   703
        treeView removeAll.
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   704
        self  removeUndoHistory.
111
ca
parents: 103
diff changeset
   705
    ]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   706
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   707
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   708
!UIPainterView methodsFor:'searching'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   709
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   710
findContainerOfView:aView
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   711
    "returns the super view assigned to a view
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   712
    "
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   713
    |p|
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   714
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   715
    (p := self propertyOfParentForView:aView) isNil ifTrue:[
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   716
        ^ self
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   717
    ].
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   718
    ^ p view
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   719
!
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   720
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   721
findObjectAt:aPoint
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   722
    "find the origin/corner of the currentWidget
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   723
    "
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   724
    |view prop|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   725
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   726
    view := super findObjectAt:aPoint.
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   727
    prop := self propertyRespondsToView:view.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   728
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   729
    prop notNil ifTrue:[^ prop view].
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   730
  ^ nil
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   731
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   732
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   733
findViewWithId:aViewId
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   734
    "finds view assigned to identifier and returns the view or nil
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   735
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   736
    |prop|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   737
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   738
    prop := self propertyOfIdentifier:aViewId.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   739
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   740
    prop notNil ifTrue:[^ prop view]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   741
               ifFalse:[^ nil]
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   742
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   743
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   744
propertyOfIdentifier:anId
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   745
    "returns property assigned to unique identifier
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   746
    "
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   747
    anId notNil ifTrue:[
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   748
        ^ treeView propertyDetect:[:p| p identifier == anId ]
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   749
    ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   750
    ^ nil
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   751
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   752
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   753
propertyOfName:aString
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   754
    "returns property assigned to name
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   755
    "
111
ca
parents: 103
diff changeset
   756
    |name|
ca
parents: 103
diff changeset
   757
ca
parents: 103
diff changeset
   758
    aString isNil ifFalse:[
ca
parents: 103
diff changeset
   759
        name := aString string withoutSeparators.
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   760
      ^ treeView propertyDetect:[:p| p name = name ].
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   761
    ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   762
    ^ nil
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   763
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   764
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   765
propertyOfParentForView:aSubView
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   766
    "returns the property of the parent or nil
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   767
    "
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   768
    |item|
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   769
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   770
    (item := treeView detectItemRespondsToView:aSubView) notNil ifTrue:[
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   771
        (item := item parent) notNil ifTrue:[^ item contents]
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   772
    ].
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   773
    ^ nil
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   774
!
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   775
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   776
propertyOfView:aView
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   777
    "returns property assigned to view
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   778
    "
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   779
    (aView isNil or:[aView == self]) ifFalse:[
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   780
        ^ treeView propertyDetect:[:p| p view == aView ]
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   781
    ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   782
    ^ nil
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   783
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   784
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   785
propertyRespondsToView:aView
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   786
    "detect the property responding to the argument a view. The property of the view or
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   787
     the first subview providing the properties is returned. If no property is detected
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   788
     nil is returned.
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   789
    "
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   790
    |item|
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   791
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   792
    item := treeView detectItemRespondsToView:aView.
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   793
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   794
    (item notNil and:[item parent notNil]) ifTrue:[
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   795
        ^ item contents
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   796
    ].
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   797
    ^ nil
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   798
!
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   799
111
ca
parents: 103
diff changeset
   800
uniqueNameFor:aSpecOrString
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   801
    "generate and return an unique name for a class
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   802
    "
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   803
    |next name size|
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   804
111
ca
parents: 103
diff changeset
   805
    aSpecOrString isString ifFalse:[name := aSpecOrString className asString]
ca
parents: 103
diff changeset
   806
                            ifTrue:[name := aSpecOrString].
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   807
111
ca
parents: 103
diff changeset
   808
    (name endsWith:'Spec') ifTrue:[
ca
parents: 103
diff changeset
   809
        name := name copyFrom:1 to:(name size - 4).
ca
parents: 103
diff changeset
   810
    ] ifFalse:[
ca
parents: 103
diff changeset
   811
        name := name copy
ca
parents: 103
diff changeset
   812
    ].
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   813
    name at:1 put:(name at:1) asLowercase.
111
ca
parents: 103
diff changeset
   814
    size  := name size + 1.
ca
parents: 103
diff changeset
   815
    next  := 0.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   816
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   817
    treeView propertiesDo:[:p|
111
ca
parents: 103
diff changeset
   818
        |n|
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   819
        n := p name.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   820
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   821
        (n size >= size and:[n startsWith:name]) ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   822
            next := next max:(p extractNumberStartingAt:size)
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   823
        ]
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   824
    ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   825
    next := next + 1.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   826
    name := name, next printString.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   827
  ^ name
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   828
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   829
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   830
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   831
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   832
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   833
uniqueNameOf:aView
111
ca
parents: 103
diff changeset
   834
    |prop|
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   835
111
ca
parents: 103
diff changeset
   836
    (prop := self propertyOfView:aView) notNil ifTrue:[
ca
parents: 103
diff changeset
   837
        prop name isNil ifTrue:[
ca
parents: 103
diff changeset
   838
            prop name:(self uniqueNameFor:(prop spec)).
ca
parents: 103
diff changeset
   839
        ].
ca
parents: 103
diff changeset
   840
        ^ prop name
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   841
    ].
111
ca
parents: 103
diff changeset
   842
    ^ 'self'
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   843
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   844
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   845
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   846
!UIPainterView methodsFor:'selection basics'!
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   847
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   848
addToSelection:anObject
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   849
    "add an object to the selection
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   850
    "
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   851
    (self enabled and:[(self isSelected:anObject) not]) ifTrue:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   852
        selection isCollection ifFalse:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   853
            selection isNil ifTrue:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   854
                selection := anObject
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   855
            ] ifFalse:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   856
                selection := OrderedCollection with:selection with:anObject
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   857
            ]
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   858
        ] ifTrue:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   859
            selection add:anObject
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   860
        ].
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   861
        self showSelected:anObject.
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   862
        treeView cvsSelectionAdd:anObject.
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   863
    ]
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   864
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   865
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   866
!
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   867
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   868
removeFromSelection:anObject
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   869
    "remove an object from the selection
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   870
    "
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   871
    (self isSelected:anObject) ifTrue:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   872
        self showUnselected:anObject.
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   873
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   874
        selection size > 1 ifTrue:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   875
            selection remove:anObject ifAbsent:nil.
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   876
            self showSelection.
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   877
        ] ifFalse:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   878
            selection := nil
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   879
        ].
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   880
        treeView cvsSelectionRemove:anObject.
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   881
    ]
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   882
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   883
!
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   884
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   885
select:something
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   886
    "change selection to something
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   887
    "
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   888
    (self enabled and:[something ~= self selection]) ifTrue:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   889
        self setSelection:something withRedraw:true.
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   890
        treeView cvsSelection:something
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   891
    ]
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   892
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   893
!
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   894
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   895
updateSelectionFromModel:aSelOrNil
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   896
    "update selection from a new selection
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   897
    "
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   898
    selectionHiddenLevel == 0 ifTrue:[
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   899
        aSelOrNil size ~~ 0 ifTrue:[
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   900
            self selectionDo:[:el| (aSelOrNil includes:el) ifFalse:[self showUnselected:el] ]
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   901
        ] ifFalse:[
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   902
            self selectionDo:[:el| self showUnselected:el ]
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   903
        ]
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   904
    ].
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   905
    self setSelection:aSelOrNil withRedraw:false.
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   906
    self showSelection
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   907
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   908
! !
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   909
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   910
!UIPainterView methodsFor:'specification'!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   911
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   912
addSpec:aSpecification builder:aBuilder in:aFrame
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   913
    "build view and subviews from aSpecification into a frame. The top view
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   914
     is returned. The contained components of a spec are set to nil
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   915
    "
330
ca
parents: 327
diff changeset
   916
    |cls|
212
1836a16763cc oops again
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
   917
330
ca
parents: 327
diff changeset
   918
    cls := self resolveName:className.
ca
parents: 327
diff changeset
   919
ca
parents: 327
diff changeset
   920
    cls notNil ifTrue:[
ca
parents: 327
diff changeset
   921
        aBuilder applicationClass:cls.
212
1836a16763cc oops again
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
   922
    ].
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   923
111
ca
parents: 103
diff changeset
   924
    aBuilder componentCreationHook:[:aView :aSpec :aBdr||sv p s n|
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   925
        p := ViewProperty new.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   926
        s := aSpec copy.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   927
        p spec:s.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   928
        p view:aView.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   929
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   930
        s class supportsSubComponents ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   931
            s component:nil
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   932
        ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   933
111
ca
parents: 103
diff changeset
   934
        n := s name.
ca
parents: 103
diff changeset
   935
ca
parents: 103
diff changeset
   936
        (n isNil or:[(self propertyOfName:n) notNil]) ifTrue:[
ca
parents: 103
diff changeset
   937
            s name:(self uniqueNameFor:s)
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   938
        ].
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   939
        treeView addProperty:p.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   940
    ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   941
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   942
    ^ aSpecification buildViewWithLayoutFor:aBuilder in:aFrame.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   943
212
1836a16763cc oops again
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
   944
    "Modified: 4.7.1997 / 23:48:55 / cg"
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   945
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   946
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   947
fullSpecFor:anObject
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   948
    "generate a full spec for an object
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   949
    "
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   950
    |mySpec subSpecs|
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   951
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   952
    mySpec := self specFor:anObject.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   953
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   954
    (mySpec notNil and:[mySpec class supportsSubComponents]) ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   955
        (anObject subViews notNil) ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   956
            anObject subViews do:[:aSubView||spec|
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   957
                spec := self fullSpecFor:aSubView.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   958
                spec notNil ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   959
                    subSpecs isNil ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   960
                        subSpecs := OrderedCollection new
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   961
                    ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   962
                    subSpecs add:spec.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   963
                ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   964
            ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   965
            subSpecs notNil ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   966
                mySpec component:(SpecCollection new collection:subSpecs)
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   967
            ]
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   968
        ]
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   969
    ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   970
    ^ mySpec
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   971
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   972
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   973
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   974
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   975
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   976
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   977
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   978
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   979
rebuildView:aView fromSpec:aSpec withBuilder:aBuilder
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   980
    |v|
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   981
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   982
    aSpec needsRebuildForAttributes ifTrue:[
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   983
        v := aSpec buildViewWithLayoutFor:aBuilder in:(self findContainerOfView:aView).
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   984
        v realize.    
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   985
        aView destroy.
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   986
        device sync.
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   987
        device flush.
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   988
        aView becomeSameAs:v.
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   989
        inputView raise.
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   990
    ] ifFalse:[
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   991
        aSpec setAttributesIn:aView with:aBuilder.
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   992
        self elementChangedSize:aView.
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   993
    ].
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   994
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   995
!
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   996
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   997
specFor:anObject
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   998
    "returns spec assigned to an object
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   999
    "
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1000
    |prop spec|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1001
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1002
    (prop := self propertyOfView:anObject) notNil ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1003
        spec := prop spec copy.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1004
        spec layoutFromView:anObject
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1005
    ].
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1006
    ^ spec
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1007
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1008
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1009
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1010
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1011
146
ae84facd80be checkin from browser
ca
parents: 141
diff changeset
  1012
specForSelection
ae84facd80be checkin from browser
ca
parents: 141
diff changeset
  1013
    "returns spec assigned to current single selection or nil
ae84facd80be checkin from browser
ca
parents: 141
diff changeset
  1014
    "
ae84facd80be checkin from browser
ca
parents: 141
diff changeset
  1015
    ^ self specFor:(self singleSelection)
ae84facd80be checkin from browser
ca
parents: 141
diff changeset
  1016
ae84facd80be checkin from browser
ca
parents: 141
diff changeset
  1017
ae84facd80be checkin from browser
ca
parents: 141
diff changeset
  1018
!
ae84facd80be checkin from browser
ca
parents: 141
diff changeset
  1019
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1020
updateFromSpec:aSpec
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1021
    "update current selected view from specification
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
  1022
    "
327
0040d47658c6 check - warnings eliminated. Fix in InspectorList.st
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
  1023
    |props name builder|
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1024
281
aabb4037f6a3 window spec
ca
parents: 279
diff changeset
  1025
    aSpec class == WindowSpec ifTrue:[
310
a68c182d050f support of scrollers and menu for the canvas
ca
parents: 288
diff changeset
  1026
        ^ treeView canvasSpec:aSpec
281
aabb4037f6a3 window spec
ca
parents: 279
diff changeset
  1027
    ].
aabb4037f6a3 window spec
ca
parents: 279
diff changeset
  1028
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1029
    self singleSelection notNil ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1030
        self withSelectionHiddenDo:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1031
            self transaction:#specification selectionDo:[:aView|
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1032
                builder := UIBuilder new.
212
1836a16763cc oops again
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
  1033
                className notNil ifTrue:[
330
ca
parents: 327
diff changeset
  1034
                    builder applicationClass:(self resolveName:className).
212
1836a16763cc oops again
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
  1035
                ].
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1036
                props   := self propertyOfView:aView.
82
99dc76d66eab checkin from browser
ca
parents: 80
diff changeset
  1037
                name    := (aSpec name) withoutSeparators.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1038
82
99dc76d66eab checkin from browser
ca
parents: 80
diff changeset
  1039
                name = props name ifFalse:[
99dc76d66eab checkin from browser
ca
parents: 80
diff changeset
  1040
                    (self propertyOfName:name) notNil ifTrue:[
99dc76d66eab checkin from browser
ca
parents: 80
diff changeset
  1041
                        name := props name
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1042
                    ]
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1043
                ].
82
99dc76d66eab checkin from browser
ca
parents: 80
diff changeset
  1044
                aSpec name:name.
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1045
                self createUndoSpecModify:props.
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1046
                self rebuildView:aView fromSpec:aSpec withBuilder:builder.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1047
                props spec:(aSpec copy).
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
  1048
                treeView propertyChanged:props.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1049
            ]
111
ca
parents: 103
diff changeset
  1050
        ]
82
99dc76d66eab checkin from browser
ca
parents: 80
diff changeset
  1051
    ]
212
1836a16763cc oops again
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
  1052
1836a16763cc oops again
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
  1053
    "Modified: 4.7.1997 / 23:49:44 / cg"
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1054
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1055
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1056
!UIPainterView methodsFor:'testing'!
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1057
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1058
canChangeLayoutOfView:aView
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1059
    "returns true if the view can change its layout which is dependant on
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1060
     its parent view.
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1061
    "
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1062
    |item prnt|
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1063
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1064
    (     (item := treeView itemOfView:aView) isNil
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1065
      or:[(prnt := item parent) isNil]
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1066
    ) ifTrue:[
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1067
        ^ false
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1068
    ].
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1069
    ^ (prnt parent isNil or:[prnt contents spec class isLayoutContainer not])
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1070
!
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1071
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1072
canKeepLayoutInSelection
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1073
    "returns true if layout can be kept during a paste operation
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1074
    "
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1075
    |prop|
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1076
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1077
    prop := self propertyOfView:(self singleSelection).
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1078
  ^ (prop isNil or:[prop spec class isLayoutContainer not])
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1079
!
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1080
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1081
canMove:something
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1082
    "checks whether something is not nil and if all widgets derived from
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1083
     something can change their layout ( move, align, ... operation ).
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1084
    "
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1085
    something notNil ifTrue:[
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1086
        self forEach:something do:[:aView|
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1087
            (self canChangeLayoutOfView:aView) ifFalse:[^ false]
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1088
        ].
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1089
        ^ true
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1090
    ].
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1091
    ^ false
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1092
!
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1093
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1094
canMoveOrAlignSelection
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1095
    "returns true if a selection exists and all elements in the selection
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1096
     can be moved or aligned
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1097
    "
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1098
  ^ self canMove:(self selection)
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1099
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1100
! !
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1101
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1102
!UIPainterView methodsFor:'transaction'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1103
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1104
transaction:aType objects:something do:aOneArgBlock
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1105
    "opens a transaction and evaluates a block within the transaction; the
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1106
     argument to the block is a view from derived from something
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1107
    "
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1108
    self withinTransaction:aType objects:something do:[
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1109
        self forEach:something do:aOneArgBlock
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1110
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1111
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1112
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1113
withinTransaction:aType objects:objects do:aNoneArgBlock
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1114
    "evaluate a block with no arguments within a transaction
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1115
    "
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1116
    |text size prop|
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1117
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1118
    objects isNil ifTrue:[ ^ self ].
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1119
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1120
    size := objects size.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1121
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1122
    objects isCollection ifTrue:[
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1123
        size == 0 ifTrue:[ ^ self ].
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1124
        size == 1 ifTrue:[ prop := self propertyOfView:(objects first) ]
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1125
    ] ifFalse:[
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1126
        prop := self propertyOfView:objects
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1127
    ].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1128
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1129
    prop notNil ifTrue:[
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1130
        text := prop name
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1131
    ] ifFalse:[
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1132
        text := size printString, ' elements'
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1133
    ].
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1135
    undoHistory withinTransaction:aType text:text do:[
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1136
        aNoneArgBlock value
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1137
    ]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1138
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1139
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1140
!UIPainterView methodsFor:'undo actions'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1141
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1142
createUndoLayout:aView
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1143
    "create undo action before changing a views layout
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1144
    "
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1145
    |lyt args prop|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1146
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1147
    undoHistory isTransactionOpen ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1148
        prop := self propertyOfView:aView.
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1149
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1150
        prop notNil ifTrue:[
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1151
            args := Array new:3.
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1152
            args at:1 put:(prop identifier).
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1153
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1154
            (lyt := aView geometryLayout) notNil ifTrue:[
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1155
                args at:2 put:#geometryLayout:
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1156
            ] ifFalse:[
146
ae84facd80be checkin from browser
ca
parents: 141
diff changeset
  1157
                lyt := aView extent.
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1158
                args at:2 put:#extent:
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1159
            ].
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1160
            args at:3 put:(lyt copy).
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1161
            undoHistory addUndoSelector:#undoLayout: withArgs:args.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1162
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1163
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1164
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1165
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1166
createUndoRemove:aView
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1167
    "create undo method before deleting views
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1168
    "
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1169
    |prop pid|
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1170
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1171
    (prop := self propertyOfView:aView) notNil ifTrue:[
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1172
        (pid := self propertyOfParentForView:aView) notNil ifTrue:[
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1173
            pid := pid identifier
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1174
        ].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1175
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1176
        undoHistory addUndoSelector:#undoRemove:
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1177
                           withArgs:(Array with:(self fullSpecFor:aView)
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1178
                               with:(prop identifier)
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1179
                               with:pid)
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1180
    ]
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1181
!
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1182
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1183
createUndoSpecModify:aProp
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1184
    "undo method when changing the specification for an object
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1185
    "
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1186
    aProp notNil ifTrue:[
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1187
        undoHistory addUndoSelector:#undoSpecModify:
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1188
                           withArgs:(Array with:(aProp spec) with:(aProp identifier))
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1189
    ]
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1190
!
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1191
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1192
undoCreate:something
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1193
    "undo method for creating or pasting an object
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1194
    "
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1195
    self forEach:something do:[:anId|self remove:(self findViewWithId:anId)].
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1196
!
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1197
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1198
undoLayout:args
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1199
    "undo method to set the old layout; see 'createUndoLayout:'
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1200
    "
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1201
    |view|
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1202
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1203
    (view := self findViewWithId:(args at:1)) notNil ifTrue:[
146
ae84facd80be checkin from browser
ca
parents: 141
diff changeset
  1204
        view perform:(args at:2) with:(args at:3).
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1205
        self layoutChanged.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1206
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1207
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1208
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1209
undoRemove:args
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1210
    "undo method when removing an object; see 'createUndoRemove:'
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1211
    "
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1212
    |frame prop view|
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1213
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1214
    (args at:3) notNil ifTrue:[
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1215
        frame := self findViewWithId:(args at:3).
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1216
    ].
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1217
    frame isNil ifTrue:[
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1218
        frame := self
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1219
    ].
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1220
    view := self addSpec:(args at:1) builder:(UIBuilder new) in:frame.
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1221
    view realize.
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1222
    inputView raise.
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1223
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1224
    prop := self propertyOfView:view.
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1225
    prop identifier:(args at:2).
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1226
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1227
!
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1228
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1229
undoSpecModify:args
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1230
    "undo method when changing a spec; see 'createUndoSpecModify:'
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1231
    "
327
0040d47658c6 check - warnings eliminated. Fix in InspectorList.st
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
  1232
    |builder view spec props|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1233
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1234
    props := self propertyOfIdentifier:(args at:2).
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1235
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1236
    props notNil ifTrue:[
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1237
        view    := props view.
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1238
        spec    := args at:1.
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1239
        builder := UIBuilder new.
212
1836a16763cc oops again
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
  1240
        className notNil ifTrue:[
330
ca
parents: 327
diff changeset
  1241
            builder applicationClass:(self resolveName:className).
212
1836a16763cc oops again
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
  1242
        ].
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1243
        props spec:spec.
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1244
        self rebuildView:view fromSpec:spec withBuilder:builder.
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
  1245
        treeView propertyChanged:props.
211
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1246
    ]
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1247
! !
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1248
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1249
!UIPainterView::ViewProperty class methodsFor:'instance creation'!
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1250
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1251
new
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1252
    Identifier notNil ifTrue:[Identifier := Identifier + 1]
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1253
                     ifFalse:[Identifier := 1].
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1254
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1255
  ^ self basicNew initialize
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1256
! !
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1257
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1258
!UIPainterView::ViewProperty methodsFor:'accessing'!
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1259
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1260
identifier
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1261
    "return the unique identifier assigned to property
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1262
    "
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1263
    ^ identifier
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1264
!
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1265
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1266
identifier:anIdentifier
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1267
    "set the unique identifier assigned to property; called after an restore of
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1268
     a deleted instance
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1269
    "
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1270
    identifier := anIdentifier
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1271
!
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1272
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1273
spec
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1274
    "return the value of the instance variable 'spec' (automatically generated)"
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1275
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1276
    ^ spec!
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1277
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1278
spec:something
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1279
    "set the value of the instance variable 'spec' (automatically generated)"
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1280
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1281
    spec := something.!
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1282
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1283
view
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1284
    "return the value of the instance variable 'view' (automatically generated)"
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1285
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1286
    ^ view!
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1287
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1288
view:something
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1289
    "set the value of the instance variable 'view' (automatically generated)"
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1290
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1291
    view := something.! !
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1292
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1293
!UIPainterView::ViewProperty methodsFor:'initialization'!
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1294
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1295
initialize
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1296
    super initialize.
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1297
    identifier := Identifier
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1298
! !
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1299
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1300
!UIPainterView::ViewProperty methodsFor:'misc'!
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1301
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1302
extractNumberStartingAt:anIndex
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1303
    "return the number from the name starting at anIndex or 0.
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1304
    "
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1305
    |val|
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1306
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1307
    val := 0.
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1308
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1309
    self name from:anIndex do:[:c|
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1310
        c isDigit ifTrue:[val := val * 10 + c digitValue]
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1311
                 ifFalse:[^ 0]
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1312
    ].
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1313
    ^ val
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1314
        
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1315
! !
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1316
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1317
!UIPainterView::ViewProperty methodsFor:'spec messages'!
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1318
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1319
doesNotUnderstand:aMessage
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1320
    spec notNil ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1321
        (spec respondsTo:(aMessage selector)) ifTrue:[^ aMessage sendTo:spec]
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1322
    ].
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1323
    ^ nil
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1324
!
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1325
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1326
layout
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1327
    spec layout
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1328
!
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1329
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1330
layout:aLayout
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1331
    spec layout:aLayout
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1332
!
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1333
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1334
name
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1335
    ^ spec name
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1336
!
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1337
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1338
name:aName
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1339
    spec name:aName
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1340
! !
Claus Gittinger <cg@exept.de>
parents: