UIPainterView.st
author Claus Gittinger <cg@exept.de>
Tue, 28 Oct 1997 21:26:16 +0100
changeset 354 a6de8821d3bf
parent 352 088174fc1e71
child 361 6624bb5d9a1a
permissions -rw-r--r--
add & remove popUpMenu
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
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   390
aspectMethods
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   391
    "extract a list of aspect methods - for browsing"
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   392
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   393
    |cls methods skip selector protoSpec|
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   394
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   395
    className isNil ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   396
        self warn:'set the class first'.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   397
        ^ #()
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   398
    ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   399
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   400
    cls := self resolveName:className.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   401
    methods := IdentitySet new.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   402
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   403
    treeView propertiesDo:[:aProp|
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   404
        |selector|
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   405
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   406
        (selector := aProp model) notNil ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   407
            selector isArray ifFalse:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   408
                selector := selector asSymbol.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   409
                (cls implements:selector) ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   410
                    skip := false.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   411
                    (cls isSubclassOf:SimpleDialog) ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   412
                        skip := SimpleDialog implements:selector asSymbol
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   413
                    ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   414
                    skip ifFalse:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   415
                        methods add:(cls compiledMethodAt:selector)
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   416
                    ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   417
                ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   418
            ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   419
        ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   420
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   421
        (selector := aProp menu) notNil ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   422
            selector isArray ifFalse:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   423
                selector := selector asSymbol.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   424
                (cls implements:selector) ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   425
                    methods add:(cls compiledMethodAt:selector)
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   426
                ]
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   427
            ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   428
        ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   429
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   430
        (aProp spec aspectSelectors) do:[:aSel |
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   431
            |selector|
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   432
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   433
            aSel isArray ifFalse:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   434
                selector := aSel asSymbol.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   435
                (cls implements:selector) ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   436
                    methods add:(cls compiledMethodAt:selector)
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   437
                ]
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   438
            ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   439
        ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   440
        aProp spec actionSelectors do:[:aSel|
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   441
            |selector|
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   442
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   443
            aSel isArray ifFalse:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   444
                selector := aSel asSymbol.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   445
                (cls implements:selector) ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   446
                    methods add:(cls compiledMethodAt:selector)
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   447
                ]
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   448
            ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   449
        ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   450
        aProp spec valueSelectors do:[:aSel|
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   451
            |selector|
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   452
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   453
            aSel isArray ifFalse:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   454
                selector := aSel asSymbol.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   455
                (cls implements:selector) ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   456
                    methods add:(cls compiledMethodAt:selector)
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   457
                ]
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   458
            ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   459
        ]
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   460
    ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   461
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   462
    protoSpec := treeView canvasSpec.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   463
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   464
    (selector := protoSpec menu) notNil ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   465
        selector isArray ifFalse:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   466
            selector := selector asSymbol.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   467
            (cls implements:selector) ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   468
                methods add:(cls compiledMethodAt:selector)
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   469
            ]
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   470
        ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   471
    ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   472
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   473
    ^ methods
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   474
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   475
    "Created: / 25.10.1997 / 18:58:25 / cg"
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   476
    "Modified: / 26.10.1997 / 15:06:18 / cg"
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   477
!
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   478
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   479
generateActionMethodFor:aspect spec:protoSpec inClass:targetClass
288
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   480
    |selector args showIt code alreadyInSuperclass|
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   481
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   482
    selector := aspect asSymbol.
141
d06c04391233 generate actions with argument
ca
parents: 137
diff changeset
   483
288
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   484
    alreadyInSuperclass := targetClass superclass canUnderstand:selector.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   485
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   486
    (selector numArgs) == 1 ifFalse:[
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   487
        args := ''.
149
e652608690b1 help ...
ca
parents: 146
diff changeset
   488
        showIt := ' ...''.\'.
e652608690b1 help ...
ca
parents: 146
diff changeset
   489
    ] ifTrue:[
288
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   490
        args := 'anArgument'.
149
e652608690b1 help ...
ca
parents: 146
diff changeset
   491
        showIt := ''' , anArgument printString , '' ...''.\'.
e652608690b1 help ...
ca
parents: 146
diff changeset
   492
    ].
141
d06c04391233 generate actions with argument
ca
parents: 137
diff changeset
   493
288
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   494
    code := '!!' , targetClass name , ' methodsFor:''actions''!!\\' ,
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   495
                aspect , args , '\' ,
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   496
                '    "automatically generated by UIPainter ..."\\' ,
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   497
                '    "*** the code below performs no action"\' ,
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   498
                '    "*** (except for some feedback on the Transcript)"\' ,
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   499
                '    "*** Please change as required and accept in the browser."\' ,
288
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   500
                '\' .
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   501
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   502
    alreadyInSuperclass ifTrue:[
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   503
        code := code ,
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   504
                    '    "action for ' , aspect , ' is already provided in a superclass."\' ,
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   505
                    '    "It may be redefined here ..."\\'.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   506
    ] ifFalse:[
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   507
        code := code ,
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   508
                    '    "action to be added ..."\\'.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   509
    ].
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   510
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   511
    code := code ,
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   512
                '    Transcript showCR:self class name, '': '.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   513
    alreadyInSuperclass ifTrue:[
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   514
        code := code , 'inherited '.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   515
    ].
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   516
    code := code , 'action for ' , aspect , showIt.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   517
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   518
    alreadyInSuperclass ifTrue:[
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   519
        code := code ,
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   520
                        '    super ' , aspect , args , '.\'.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   521
    ].
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   522
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   523
    code := code ,
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   524
                '!! !!\\'.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   525
    ^ code withCRs
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   526
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   527
    "Modified: / 25.10.1997 / 19:18:50 / cg"
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   528
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   529
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   530
generateAspectMethodFor:aspect spec:protoSpec inClass:targetClass
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   531
    |modelClass modelValue modelGen|
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
   532
149
e652608690b1 help ...
ca
parents: 146
diff changeset
   533
    modelClass := protoSpec defaultModelClassFor:aspect.
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   534
    modelValue := protoSpec defaultModelValueFor:aspect.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   535
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   536
    modelValue isNil ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   537
        modelGen := modelClass name , ' new'
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   538
    ] ifFalse:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   539
        modelGen := modelValue storeString , ' asValue'
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   540
    ].
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
   541
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   542
    ^ ('!!' , targetClass name , ' methodsFor:''aspects''!!\\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   543
      aspect , '\' ,
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   544
      '    "automatically generated by UIPainter ..."\\' ,
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   545
      '    "*** the code below creates a default model when invoked."\' ,
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   546
      '    "*** (which may not be the one you wanted)"\' ,
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   547
      '    "*** Please change as required and accept in the browser."\' ,
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   548
      '\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   549
      '    |holder|\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   550
      '\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   551
      '    (holder := builder bindingAt:#' , aspect , ') isNil ifTrue:[\' ,
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   552
      '        builder aspectAt:#' , aspect , ' put:(holder := ' , ' ' , modelGen , ').\' ,
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   553
      '    ].\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   554
      '    ^ holder\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   555
      '!! !!\\') withCRs
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   556
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   557
    "Modified: / 26.10.1997 / 19:01:15 / cg"
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   558
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   559
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   560
generateAspectMethods
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   561
    "generate aspect, action & menu methods
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   562
     - but do not overwrite existing ones.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   563
     Return a string ready to compile into the application class."
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   564
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   565
    |cls code skip menuSelector protoSpec thisCode|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   566
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   567
    code := ''.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   568
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   569
    className isNil ifTrue:[
69
e533f77871dd generateAspectMethods: code2
ca
parents: 62
diff changeset
   570
        self warn:'set the class first'.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   571
        ^ code
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   572
    ].
330
ca
parents: 327
diff changeset
   573
    cls := self resolveName:className.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   574
316
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   575
    treeView propertiesDo:[:aProp|
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   576
        |modelSelector menuSelector|
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   577
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
   578
        protoSpec := aProp spec.
175
0b0b4d99e3e7 isResizeable
ca
parents: 165
diff changeset
   579
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   580
        (modelSelector := aProp model) notNil ifTrue:[
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   581
            (modelSelector isArray not) ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   582
                (cls implements:modelSelector asSymbol) ifFalse:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   583
                    skip := false.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   584
                    (cls isSubclassOf:SimpleDialog) ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   585
                        skip := SimpleDialog implements:modelSelector asSymbol
158
6e7f892308ae do not generate accept/cancel and help action methods,
Claus Gittinger <cg@exept.de>
parents: 156
diff changeset
   586
                    ].
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   587
                    skip ifFalse:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   588
                        "/ kludge ..
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   589
                        (protoSpec isMemberOf:ActionButtonSpec) ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   590
                            thisCode := (self generateActionMethodFor:modelSelector spec:protoSpec inClass:cls).
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   591
                        ] ifFalse:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   592
                            thisCode := (self generateAspectMethodFor:modelSelector spec:protoSpec inClass:cls).
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   593
                        ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   594
                        code := code , thisCode
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   595
                    ].
158
6e7f892308ae do not generate accept/cancel and help action methods,
Claus Gittinger <cg@exept.de>
parents: 156
diff changeset
   596
                ].
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   597
            ].
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   598
        ].
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   599
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   600
        (menuSelector := aProp menu) notNil ifTrue:[
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   601
            (menuSelector isArray not) ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   602
                thisCode := self generateMenuMethodFor:menuSelector spec:protoSpec inClass:cls.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   603
                thisCode size ~~ 0 ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   604
                    code := code , thisCode
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   605
                ]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   606
            ]
111
ca
parents: 103
diff changeset
   607
        ].
ca
parents: 103
diff changeset
   608
ca
parents: 103
diff changeset
   609
        aProp spec aspectSelectors do:[:aSel|
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   610
            (aSel isArray not) ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   611
                (cls implements:aSel asSymbol) ifFalse:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   612
                    thisCode := (self generateAspectMethodFor:aSel spec:protoSpec inClass:cls).
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   613
                    code := code , thisCode
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   614
                ]
111
ca
parents: 103
diff changeset
   615
            ]
ca
parents: 103
diff changeset
   616
        ].
137
ca
parents: 134
diff changeset
   617
        aProp spec actionSelectors do:[:aSel|
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   618
            (aSel isArray not) ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   619
                (cls implements:aSel asSymbol) ifFalse:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   620
                    thisCode := (self generateActionMethodFor:aSel spec:protoSpec inClass:cls).
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   621
                    code := code , thisCode
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   622
                ]
137
ca
parents: 134
diff changeset
   623
            ]
ca
parents: 134
diff changeset
   624
        ].
188
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   625
        aProp spec valueSelectors do:[:aSel|
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   626
            (aSel isArray not) ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   627
                (cls implements:aSel asSymbol) ifFalse:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   628
                    thisCode := (self generateValueMethodFor:aSel spec:protoSpec inClass:cls).
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   629
                    code := code , thisCode
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   630
                ]
188
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   631
            ]
316
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   632
        ]
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   633
    ].
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   634
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   635
    protoSpec := treeView canvasSpec.
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   636
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   637
    (menuSelector := protoSpec menu) notNil ifTrue:[
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   638
        (menuSelector isArray not) ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   639
            thisCode := self generateMenuMethodFor:menuSelector spec:protoSpec inClass:cls.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   640
            thisCode size ~~ 0 ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   641
                code := code , thisCode
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   642
            ]
316
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   643
        ]
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   644
    ].
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   645
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   646
    ^ code
316
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   647
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   648
    "Modified: / 26.10.1997 / 14:43:55 / cg"
316
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   649
!
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   650
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   651
generateMenuMethodFor:aspect spec:protoSpec inClass:aClass
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   652
    |code cperf performer category|
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   653
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   654
    (aClass implements:aspect asSymbol) ifFalse:[
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   655
        code := MenuEditor generateCodeFor:aClass menuSelector:(aspect asSymbol).
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   656
    ] ifTrue:[
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   657
        code := ''
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   658
    ].
111
ca
parents: 103
diff changeset
   659
316
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   660
    (protoSpec respondsTo:#menuPerformer) ifTrue:[
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   661
        performer := protoSpec menuPerformer.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   662
    ].
316
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   663
    performer notNil ifTrue:[
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   664
        performer := performer asSymbol.
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   665
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   666
        (aClass implements:performer) ifFalse:[
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   667
            category := MenuEditor sourceCategory.
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   668
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   669
            cperf  := Character excla asString 
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   670
                    , aClass name , ' methodsFor:' , category storeString
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   671
                    , Character excla asString , '\\'
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   672
                    , performer , '\'
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   673
                    , '    "this menu spec was automatically generated by the UI MenuBuilder"\\'
316
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   674
                    , '    ^ self\\'
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   675
                    , '\'
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   676
                    , Character excla asString
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   677
                    , ' '
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   678
                    , Character excla asString
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   679
                    , '\\'.
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   680
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   681
            code := code, cperf.
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   682
        ]
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   683
    ].
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   684
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   685
    code size == 0 ifTrue:[
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   686
        ^ nil
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   687
    ].
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   688
  ^ code withCRs
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   689
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   690
    "Modified: / 26.10.1997 / 14:44:20 / cg"
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   691
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   692
188
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   693
generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   694
    ^ ('!!' , targetClass name , ' methodsFor:''values''!!\\' ,
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   695
      aspect , '\' ,
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   696
      '    "automatically generated by UIPainter ..."\\' ,
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   697
      '    "*** the code below returns a default value when invoked."\' ,
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   698
      '    "*** (which may not be the one you wanted)"\' ,
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   699
      '    "*** Please change as required and accept in the browser."\' ,
188
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   700
      '\' ,
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   701
      '    "value to be added below ..."\' ,
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   702
      '    Transcript showCR:self class name , '': no value yet for ' , aspect , ' ...''.\' ,
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   703
      '\' ,
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   704
      '^ nil.' ,
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   705
      '!! !!\\') withCRs
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   706
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   707
    "Modified: / 25.10.1997 / 19:22:17 / cg"
188
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   708
!
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   709
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   710
generateWindowSpecMethodSource
310
a68c182d050f support of scrollers and menu for the canvas
ca
parents: 288
diff changeset
   711
    |spec str code category cls mthd|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   712
310
a68c182d050f support of scrollers and menu for the canvas
ca
parents: 288
diff changeset
   713
    spec := OrderedCollection new.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   714
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   715
    self subViews do:[:aView|
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   716
        aView ~~ inputView ifTrue:[
310
a68c182d050f support of scrollers and menu for the canvas
ca
parents: 288
diff changeset
   717
            spec add:(self fullSpecFor:aView)
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   718
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   719
    ].
310
a68c182d050f support of scrollers and menu for the canvas
ca
parents: 288
diff changeset
   720
    spec := treeView generateFullSpecForComponents:spec.
a68c182d050f support of scrollers and menu for the canvas
ca
parents: 288
diff changeset
   721
    str  := WriteStream on:String new.
a68c182d050f support of scrollers and menu for the canvas
ca
parents: 288
diff changeset
   722
    UISpecification prettyPrintSpecArray:spec on:str indent:5.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   723
178
fb8451053c96 keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
   724
    "/ 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
   725
fb8451053c96 keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
   726
    category := 'interface specs'.
330
ca
parents: 327
diff changeset
   727
    cls := self resolveName:className.
ca
parents: 327
diff changeset
   728
ca
parents: 327
diff changeset
   729
    cls notNil ifTrue:[
178
fb8451053c96 keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
   730
        (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
   731
            category := mthd category.
fb8451053c96 keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
   732
        ]
fb8451053c96 keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
   733
    ].
fb8451053c96 keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
   734
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   735
    code := '!!'
178
fb8451053c96 keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
   736
            , className , ' class methodsFor:' , category storeString
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   737
            , '!!' , '\\'
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   738
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   739
            , methodName , '\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   740
            , '    "this window spec was automatically generated by the ST/X UIPainter"\\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   741
            , '    "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
   742
            , '     handle the specification if its corrupted."\\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   743
            , '    "\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   744
            , '     UIPainter new openOnClass:' , className , ' andSelector:#' , methodName , '\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   745
            , '     ' , className , ' new openInterface:#' , methodName , '\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   746
            , '    "\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   747
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   748
    methodName = 'windowSpec' ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   749
        code := code , '    "' , className , ' open"\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   750
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   751
    code := code 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   752
            , '\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   753
            , '    <resource: #canvas>\\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   754
            , '    ^\' 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   755
            , '     ', str contents
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   756
            , '\'
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   757
            , '!! !!'
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   758
            , '\\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   759
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   760
    ^ code withCRs
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   761
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   762
    "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
   763
    "Modified: 24.6.1997 / 19:12:44 / cg"
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   764
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   765
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   766
!UIPainterView methodsFor:'initialization'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   767
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   768
initialize
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   769
    "setup attributes
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   770
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   771
    super initialize.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   772
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   773
    superclassName := 'ApplicationModel'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   774
    className      := 'NewApplication'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   775
    methodName     := 'windowSpec'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   776
    categoryName   := 'Applications'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   777
    HandCursor     := Cursor leftHand.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   778
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   779
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   780
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   781
setupFromSpec:specOrSpecArray
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   782
    |spec builder|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   783
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   784
    treeView cvsSetupListDo:[
111
ca
parents: 103
diff changeset
   785
        self removeAll.
ca
parents: 103
diff changeset
   786
        spec    := UISpecification from:specOrSpecArray.
ca
parents: 103
diff changeset
   787
        builder := UIBuilder new.
ca
parents: 103
diff changeset
   788
        spec window setupView:self topView for:builder.
ca
parents: 103
diff changeset
   789
        self addSpec:(spec component) builder:builder in:self.
ca
parents: 103
diff changeset
   790
        self realizeAllSubViews.
ca
parents: 103
diff changeset
   791
        inputView raise.
310
a68c182d050f support of scrollers and menu for the canvas
ca
parents: 288
diff changeset
   792
        treeView setAttributesFromWindowSpec:(spec window).
111
ca
parents: 103
diff changeset
   793
    ]
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   794
!
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   795
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   796
treeView:aTreeView
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   797
    treeView := aTreeView
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   798
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   799
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   800
!UIPainterView methodsFor:'menus'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   801
121
96d6feeeb049 middleButtonMen:
ca
parents: 119
diff changeset
   802
showMiddleButtonMenu
96d6feeeb049 middleButtonMen:
ca
parents: 119
diff changeset
   803
    "show the middle button menu; this returns nil
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   804
    "
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   805
    self enabled ifTrue:[
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   806
        (MenuPanel fromSpec:(UIPainter menuCanvas) receiver:self) startUp
111
ca
parents: 103
diff changeset
   807
    ].
121
96d6feeeb049 middleButtonMen:
ca
parents: 119
diff changeset
   808
  ^ nil
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   809
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   810
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   811
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   812
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   813
335
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
   814
!UIPainterView methodsFor:'queries'!
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
   815
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
   816
resolveName:aName
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
   817
    |appl|
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
   818
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
   819
    appl := self application.
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
   820
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
   821
    appl notNil ifTrue:[
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
   822
        ^ appl resolveName:aName
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
   823
    ].
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
   824
    ^ Smalltalk resolveName:aName inClass:self class
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
   825
! !
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
   826
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   827
!UIPainterView methodsFor:'removing components'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   828
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   829
remove:anObject
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   830
    "remove anObject from the contents do redraw
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   831
    "
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
   832
    anObject notNil ifTrue:[
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   833
        treeView removeView:anObject.
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
   834
    ]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   835
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   836
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   837
removeAll
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   838
    "remove all objects and properties
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   839
    "
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   840
    treeView cvsEventsDisabledDo:[
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   841
        self  select:nil.
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   842
        treeView removeAll.
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   843
        self  removeUndoHistory.
111
ca
parents: 103
diff changeset
   844
    ]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   845
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   846
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   847
!UIPainterView methodsFor:'searching'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   848
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   849
findContainerOfView:aView
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   850
    "returns the super view assigned to a view
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   851
    "
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   852
    |p|
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   853
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   854
    (p := self propertyOfParentForView:aView) isNil ifTrue:[
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   855
        ^ self
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   856
    ].
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   857
    ^ p view
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   858
!
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   859
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   860
findObjectAt:aPoint
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   861
    "find the origin/corner of the currentWidget
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   862
    "
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   863
    |view prop|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   864
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   865
    view := super findObjectAt:aPoint.
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   866
    prop := self propertyRespondsToView:view.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   867
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   868
    prop notNil ifTrue:[^ prop view].
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   869
  ^ nil
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   870
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   871
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   872
findViewWithId:aViewId
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   873
    "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
   874
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   875
    |prop|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   876
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   877
    prop := self propertyOfIdentifier:aViewId.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   878
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   879
    prop notNil ifTrue:[^ prop view]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   880
               ifFalse:[^ nil]
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   881
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   882
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   883
propertyOfIdentifier:anId
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   884
    "returns property assigned to unique identifier
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   885
    "
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   886
    anId notNil ifTrue:[
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   887
        ^ treeView propertyDetect:[:p| p identifier == anId ]
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   888
    ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   889
    ^ nil
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   890
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   891
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   892
propertyOfName:aString
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   893
    "returns property assigned to name
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   894
    "
111
ca
parents: 103
diff changeset
   895
    |name|
ca
parents: 103
diff changeset
   896
ca
parents: 103
diff changeset
   897
    aString isNil ifFalse:[
ca
parents: 103
diff changeset
   898
        name := aString string withoutSeparators.
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   899
      ^ treeView propertyDetect:[:p| p name = name ].
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   900
    ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   901
    ^ nil
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   902
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   903
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   904
propertyOfParentForView:aSubView
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   905
    "returns the property of the parent or nil
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   906
    "
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   907
    |item|
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   908
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   909
    (item := treeView detectItemRespondsToView:aSubView) notNil ifTrue:[
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   910
        (item := item parent) notNil ifTrue:[^ item contents]
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   911
    ].
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   912
    ^ nil
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   913
!
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   914
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   915
propertyOfView:aView
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   916
    "returns property assigned to view
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   917
    "
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   918
    (aView isNil or:[aView == self]) ifFalse:[
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   919
        ^ treeView propertyDetect:[:p| p view == aView ]
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   920
    ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   921
    ^ nil
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   922
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   923
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   924
propertyRespondsToView:aView
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   925
    "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
   926
     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
   927
     nil is returned.
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   928
    "
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   929
    |item|
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   930
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   931
    item := treeView detectItemRespondsToView:aView.
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   932
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   933
    (item notNil and:[item parent notNil]) ifTrue:[
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   934
        ^ item contents
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   935
    ].
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   936
    ^ nil
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   937
!
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   938
111
ca
parents: 103
diff changeset
   939
uniqueNameFor:aSpecOrString
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   940
    "generate and return an unique name for a class
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   941
    "
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   942
    |next name size|
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   943
111
ca
parents: 103
diff changeset
   944
    aSpecOrString isString ifFalse:[name := aSpecOrString className asString]
ca
parents: 103
diff changeset
   945
                            ifTrue:[name := aSpecOrString].
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   946
111
ca
parents: 103
diff changeset
   947
    (name endsWith:'Spec') ifTrue:[
ca
parents: 103
diff changeset
   948
        name := name copyFrom:1 to:(name size - 4).
ca
parents: 103
diff changeset
   949
    ] ifFalse:[
ca
parents: 103
diff changeset
   950
        name := name copy
ca
parents: 103
diff changeset
   951
    ].
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   952
    name at:1 put:(name at:1) asLowercase.
111
ca
parents: 103
diff changeset
   953
    size  := name size + 1.
ca
parents: 103
diff changeset
   954
    next  := 0.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   955
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   956
    treeView propertiesDo:[:p|
111
ca
parents: 103
diff changeset
   957
        |n|
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   958
        n := p name.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   959
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   960
        (n size >= size and:[n startsWith:name]) ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   961
            next := next max:(p extractNumberStartingAt:size)
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   962
        ]
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   963
    ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   964
    next := next + 1.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   965
    name := name, next printString.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   966
  ^ name
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
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   971
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   972
uniqueNameOf:aView
111
ca
parents: 103
diff changeset
   973
    |prop|
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   974
111
ca
parents: 103
diff changeset
   975
    (prop := self propertyOfView:aView) notNil ifTrue:[
ca
parents: 103
diff changeset
   976
        prop name isNil ifTrue:[
ca
parents: 103
diff changeset
   977
            prop name:(self uniqueNameFor:(prop spec)).
ca
parents: 103
diff changeset
   978
        ].
ca
parents: 103
diff changeset
   979
        ^ prop name
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   980
    ].
111
ca
parents: 103
diff changeset
   981
    ^ 'self'
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   982
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   983
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   984
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   985
!UIPainterView methodsFor:'selection basics'!
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   986
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   987
addToSelection:anObject
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   988
    "add an object to the selection
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   989
    "
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   990
    (self enabled and:[(self isSelected:anObject) not]) ifTrue:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   991
        selection isCollection ifFalse:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   992
            selection isNil ifTrue:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   993
                selection := anObject
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   994
            ] ifFalse:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   995
                selection := OrderedCollection with:selection with:anObject
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   996
            ]
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   997
        ] ifTrue:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   998
            selection add:anObject
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   999
        ].
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1000
        self showSelected:anObject.
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
  1001
        treeView cvsSelectionAdd:anObject.
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1002
    ]
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1003
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1004
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1005
!
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1006
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1007
removeFromSelection:anObject
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1008
    "remove an object from the selection
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1009
    "
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1010
    (self isSelected:anObject) ifTrue:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1011
        self showUnselected:anObject.
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1012
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1013
        selection size > 1 ifTrue:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1014
            selection remove:anObject ifAbsent:nil.
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1015
            self showSelection.
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1016
        ] ifFalse:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1017
            selection := nil
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1018
        ].
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
  1019
        treeView cvsSelectionRemove:anObject.
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1020
    ]
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1021
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1022
!
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1023
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1024
select:something
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1025
    "change selection to something
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1026
    "
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1027
    (self enabled and:[something ~= self selection]) ifTrue:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1028
        self setSelection:something withRedraw:true.
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
  1029
        treeView cvsSelection:something
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1030
    ]
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1031
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1032
!
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1033
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1034
updateSelectionFromModel:aSelOrNil
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1035
    "update selection from a new selection
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1036
    "
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1037
    selectionHiddenLevel == 0 ifTrue:[
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1038
        aSelOrNil size ~~ 0 ifTrue:[
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1039
            self selectionDo:[:el| (aSelOrNil includes:el) ifFalse:[self showUnselected:el] ]
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1040
        ] ifFalse:[
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1041
            self selectionDo:[:el| self showUnselected:el ]
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1042
        ]
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1043
    ].
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1044
    self setSelection:aSelOrNil withRedraw:false.
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1045
    self showSelection
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1046
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1047
! !
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1048
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1049
!UIPainterView methodsFor:'specification'!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1050
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1051
addSpec:aSpecification builder:aBuilder in:aFrame
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1052
    "build view and subviews from aSpecification into a frame. The top view
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1053
     is returned. The contained components of a spec are set to nil
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1054
    "
330
ca
parents: 327
diff changeset
  1055
    |cls|
212
1836a16763cc oops again
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
  1056
330
ca
parents: 327
diff changeset
  1057
    cls := self resolveName:className.
ca
parents: 327
diff changeset
  1058
ca
parents: 327
diff changeset
  1059
    cls notNil ifTrue:[
ca
parents: 327
diff changeset
  1060
        aBuilder applicationClass:cls.
212
1836a16763cc oops again
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
  1061
    ].
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1062
111
ca
parents: 103
diff changeset
  1063
    aBuilder componentCreationHook:[:aView :aSpec :aBdr||sv p s n|
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1064
        p := ViewProperty new.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1065
        s := aSpec copy.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1066
        p spec:s.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1067
        p view:aView.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1068
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1069
        s class supportsSubComponents ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1070
            s component:nil
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1071
        ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1072
111
ca
parents: 103
diff changeset
  1073
        n := s name.
ca
parents: 103
diff changeset
  1074
ca
parents: 103
diff changeset
  1075
        (n isNil or:[(self propertyOfName:n) notNil]) ifTrue:[
ca
parents: 103
diff changeset
  1076
            s name:(self uniqueNameFor:s)
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1077
        ].
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
  1078
        treeView addProperty:p.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1079
    ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1080
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1081
    ^ aSpecification buildViewWithLayoutFor:aBuilder in:aFrame.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1082
212
1836a16763cc oops again
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
  1083
    "Modified: 4.7.1997 / 23:48:55 / cg"
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1084
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1085
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1086
fullSpecFor:anObject
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1087
    "generate a full spec for an object
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
  1088
    "
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1089
    |mySpec subSpecs|
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1090
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1091
    mySpec := self specFor:anObject.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1092
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1093
    (mySpec notNil and:[mySpec class supportsSubComponents]) ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1094
        (anObject subViews notNil) ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1095
            anObject subViews do:[:aSubView||spec|
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1096
                spec := self fullSpecFor:aSubView.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1097
                spec notNil ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1098
                    subSpecs isNil ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1099
                        subSpecs := OrderedCollection new
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1100
                    ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1101
                    subSpecs add:spec.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1102
                ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1103
            ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1104
            subSpecs notNil ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1105
                mySpec component:(SpecCollection new collection:subSpecs)
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1106
            ]
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1107
        ]
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1108
    ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1109
    ^ mySpec
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1110
60
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
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1113
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1114
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1115
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1116
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1117
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1118
rebuildView:aView fromSpec:aSpec withBuilder:aBuilder
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1119
    |v|
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1120
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1121
    aSpec needsRebuildForAttributes ifTrue:[
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1122
        v := aSpec buildViewWithLayoutFor:aBuilder in:(self findContainerOfView:aView).
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1123
        v realize.    
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1124
        aView destroy.
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1125
        device sync.
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1126
        device flush.
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1127
        aView becomeSameAs:v.
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1128
        inputView raise.
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1129
    ] ifFalse:[
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1130
        aSpec setAttributesIn:aView with:aBuilder.
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1131
        self elementChangedSize:aView.
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1132
    ].
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1133
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1134
!
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1135
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1136
specFor:anObject
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1137
    "returns spec assigned to an object
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
  1138
    "
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1139
    |prop spec|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1140
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1141
    (prop := self propertyOfView:anObject) notNil ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1142
        spec := prop spec copy.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1143
        spec layoutFromView:anObject
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1144
    ].
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1145
    ^ spec
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1146
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1147
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1148
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1149
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1150
146
ae84facd80be checkin from browser
ca
parents: 141
diff changeset
  1151
specForSelection
ae84facd80be checkin from browser
ca
parents: 141
diff changeset
  1152
    "returns spec assigned to current single selection or nil
ae84facd80be checkin from browser
ca
parents: 141
diff changeset
  1153
    "
ae84facd80be checkin from browser
ca
parents: 141
diff changeset
  1154
    ^ self specFor:(self singleSelection)
ae84facd80be checkin from browser
ca
parents: 141
diff changeset
  1155
ae84facd80be checkin from browser
ca
parents: 141
diff changeset
  1156
ae84facd80be checkin from browser
ca
parents: 141
diff changeset
  1157
!
ae84facd80be checkin from browser
ca
parents: 141
diff changeset
  1158
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1159
updateFromSpec:aSpec
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1160
    "update current selected view from specification
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
  1161
    "
327
0040d47658c6 check - warnings eliminated. Fix in InspectorList.st
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
  1162
    |props name builder|
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1163
281
aabb4037f6a3 window spec
ca
parents: 279
diff changeset
  1164
    aSpec class == WindowSpec ifTrue:[
310
a68c182d050f support of scrollers and menu for the canvas
ca
parents: 288
diff changeset
  1165
        ^ treeView canvasSpec:aSpec
281
aabb4037f6a3 window spec
ca
parents: 279
diff changeset
  1166
    ].
aabb4037f6a3 window spec
ca
parents: 279
diff changeset
  1167
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1168
    self singleSelection notNil ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1169
        self withSelectionHiddenDo:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1170
            self transaction:#specification selectionDo:[:aView|
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1171
                builder := UIBuilder new.
212
1836a16763cc oops again
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
  1172
                className notNil ifTrue:[
330
ca
parents: 327
diff changeset
  1173
                    builder applicationClass:(self resolveName:className).
212
1836a16763cc oops again
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
  1174
                ].
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1175
                props   := self propertyOfView:aView.
82
99dc76d66eab checkin from browser
ca
parents: 80
diff changeset
  1176
                name    := (aSpec name) withoutSeparators.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1177
82
99dc76d66eab checkin from browser
ca
parents: 80
diff changeset
  1178
                name = props name ifFalse:[
99dc76d66eab checkin from browser
ca
parents: 80
diff changeset
  1179
                    (self propertyOfName:name) notNil ifTrue:[
99dc76d66eab checkin from browser
ca
parents: 80
diff changeset
  1180
                        name := props name
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1181
                    ]
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1182
                ].
82
99dc76d66eab checkin from browser
ca
parents: 80
diff changeset
  1183
                aSpec name:name.
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1184
                self createUndoSpecModify:props.
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1185
                self rebuildView:aView fromSpec:aSpec withBuilder:builder.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1186
                props spec:(aSpec copy).
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
  1187
                treeView propertyChanged:props.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1188
            ]
111
ca
parents: 103
diff changeset
  1189
        ]
82
99dc76d66eab checkin from browser
ca
parents: 80
diff changeset
  1190
    ]
212
1836a16763cc oops again
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
  1191
1836a16763cc oops again
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
  1192
    "Modified: 4.7.1997 / 23:49:44 / cg"
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1193
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1194
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1195
!UIPainterView methodsFor:'testing'!
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1196
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1197
canChangeLayoutOfView:aView
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1198
    "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
  1199
     its parent view.
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1200
    "
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1201
    |item prnt|
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1202
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1203
    (     (item := treeView itemOfView:aView) isNil
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1204
      or:[(prnt := item parent) isNil]
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1205
    ) ifTrue:[
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1206
        ^ false
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1207
    ].
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1208
    ^ (prnt parent isNil or:[prnt contents spec class isLayoutContainer not])
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1209
!
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1210
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1211
canKeepLayoutInSelection
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1212
    "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
  1213
    "
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1214
    |prop|
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1215
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1216
    prop := self propertyOfView:(self singleSelection).
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1217
  ^ (prop isNil or:[prop spec class isLayoutContainer not])
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1218
!
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1219
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1220
canMove:something
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1221
    "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
  1222
     something can change their layout ( move, align, ... operation ).
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1223
    "
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1224
    something notNil ifTrue:[
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1225
        self forEach:something do:[:aView|
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1226
            (self canChangeLayoutOfView:aView) ifFalse:[^ false]
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1227
        ].
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1228
        ^ true
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1229
    ].
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1230
    ^ false
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1231
!
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1232
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1233
canMoveOrAlignSelection
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1234
    "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
  1235
     can be moved or aligned
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1236
    "
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1237
  ^ self canMove:(self selection)
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1238
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1239
! !
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1240
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1241
!UIPainterView methodsFor:'transaction'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1242
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1243
transaction:aType objects:something do:aOneArgBlock
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1244
    "opens a transaction and evaluates a block within the transaction; the
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1245
     argument to the block is a view from derived from something
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1246
    "
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1247
    self withinTransaction:aType objects:something do:[
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1248
        self forEach:something do:aOneArgBlock
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1249
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1250
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1251
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1252
withinTransaction:aType objects:objects do:aNoneArgBlock
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1253
    "evaluate a block with no arguments within a transaction
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1254
    "
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1255
    |text size prop|
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1256
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1257
    objects isNil ifTrue:[ ^ self ].
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1258
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1259
    size := objects size.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1260
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1261
    objects isCollection ifTrue:[
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1262
        size == 0 ifTrue:[ ^ self ].
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1263
        size == 1 ifTrue:[ prop := self propertyOfView:(objects first) ]
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1264
    ] ifFalse:[
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1265
        prop := self propertyOfView:objects
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1266
    ].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1267
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1268
    prop notNil ifTrue:[
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1269
        text := prop name
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1270
    ] ifFalse:[
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1271
        text := size printString, ' elements'
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1272
    ].
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1273
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1274
    undoHistory withinTransaction:aType text:text do:[
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1275
        aNoneArgBlock value
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1276
    ]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1277
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1278
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1279
!UIPainterView methodsFor:'undo actions'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1280
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1281
createUndoLayout:aView
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1282
    "create undo action before changing a views layout
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1283
    "
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1284
    |lyt args prop|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1285
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1286
    undoHistory isTransactionOpen ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1287
        prop := self propertyOfView:aView.
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1288
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1289
        prop notNil ifTrue:[
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1290
            args := Array new:3.
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1291
            args at:1 put:(prop identifier).
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1292
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1293
            (lyt := aView geometryLayout) notNil ifTrue:[
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1294
                args at:2 put:#geometryLayout:
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1295
            ] ifFalse:[
146
ae84facd80be checkin from browser
ca
parents: 141
diff changeset
  1296
                lyt := aView extent.
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1297
                args at:2 put:#extent:
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1298
            ].
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1299
            args at:3 put:(lyt copy).
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1300
            undoHistory addUndoSelector:#undoLayout: withArgs:args.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1301
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1302
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1303
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1304
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1305
createUndoRemove:aView
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1306
    "create undo method before deleting views
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1307
    "
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1308
    |prop pid|
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1309
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1310
    (prop := self propertyOfView:aView) notNil ifTrue:[
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1311
        (pid := self propertyOfParentForView:aView) notNil ifTrue:[
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1312
            pid := pid identifier
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1313
        ].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1314
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1315
        undoHistory addUndoSelector:#undoRemove:
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1316
                           withArgs:(Array with:(self fullSpecFor:aView)
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1317
                               with:(prop identifier)
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1318
                               with:pid)
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1319
    ]
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1320
!
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1321
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1322
createUndoSpecModify:aProp
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1323
    "undo method when changing the specification for an object
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1324
    "
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1325
    aProp notNil ifTrue:[
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1326
        undoHistory addUndoSelector:#undoSpecModify:
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1327
                           withArgs:(Array with:(aProp spec) with:(aProp identifier))
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1328
    ]
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1329
!
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1330
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1331
undoCreate:something
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1332
    "undo method for creating or pasting an object
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1333
    "
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1334
    self forEach:something do:[:anId|self remove:(self findViewWithId:anId)].
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1335
!
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1336
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1337
undoLayout:args
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1338
    "undo method to set the old layout; see 'createUndoLayout:'
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1339
    "
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1340
    |view|
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1341
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1342
    (view := self findViewWithId:(args at:1)) notNil ifTrue:[
146
ae84facd80be checkin from browser
ca
parents: 141
diff changeset
  1343
        view perform:(args at:2) with:(args at:3).
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1344
        self layoutChanged.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1345
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1346
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1347
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1348
undoRemove:args
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1349
    "undo method when removing an object; see 'createUndoRemove:'
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1350
    "
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1351
    |frame prop view|
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1352
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1353
    (args at:3) notNil ifTrue:[
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1354
        frame := self findViewWithId:(args at:3).
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1355
    ].
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1356
    frame isNil ifTrue:[
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1357
        frame := self
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1358
    ].
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1359
    view := self addSpec:(args at:1) builder:(UIBuilder new) in:frame.
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1360
    view realize.
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1361
    inputView raise.
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1362
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1363
    prop := self propertyOfView:view.
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1364
    prop identifier:(args at:2).
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1365
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1366
!
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1367
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1368
undoSpecModify:args
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1369
    "undo method when changing a spec; see 'createUndoSpecModify:'
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1370
    "
327
0040d47658c6 check - warnings eliminated. Fix in InspectorList.st
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
  1371
    |builder view spec props|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1372
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1373
    props := self propertyOfIdentifier:(args at:2).
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1374
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1375
    props notNil ifTrue:[
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1376
        view    := props view.
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1377
        spec    := args at:1.
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1378
        builder := UIBuilder new.
212
1836a16763cc oops again
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
  1379
        className notNil ifTrue:[
330
ca
parents: 327
diff changeset
  1380
            builder applicationClass:(self resolveName:className).
212
1836a16763cc oops again
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
  1381
        ].
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1382
        props spec:spec.
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1383
        self rebuildView:view fromSpec:spec withBuilder:builder.
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
  1384
        treeView propertyChanged:props.
211
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1385
    ]
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1386
! !
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1387
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1388
!UIPainterView::ViewProperty class methodsFor:'instance creation'!
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1389
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1390
new
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1391
    Identifier notNil ifTrue:[Identifier := Identifier + 1]
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1392
                     ifFalse:[Identifier := 1].
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1393
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1394
  ^ self basicNew initialize
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1395
! !
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1396
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1397
!UIPainterView::ViewProperty methodsFor:'accessing'!
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1398
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1399
identifier
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1400
    "return the unique identifier assigned to property
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1401
    "
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1402
    ^ identifier
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1403
!
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1404
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1405
identifier:anIdentifier
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1406
    "set the unique identifier assigned to property; called after an restore of
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1407
     a deleted instance
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1408
    "
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1409
    identifier := anIdentifier
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1410
!
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1411
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1412
spec
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1413
    "return the value of the instance variable 'spec' (automatically generated)"
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1414
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1415
    ^ spec!
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1416
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1417
spec:something
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1418
    "set the value of the instance variable 'spec' (automatically generated)"
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1419
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1420
    spec := something.!
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1421
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1422
view
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1423
    "return the value of the instance variable 'view' (automatically generated)"
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1424
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1425
    ^ view!
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1426
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1427
view:something
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1428
    "set the value of the instance variable 'view' (automatically generated)"
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1429
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1430
    view := something.! !
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1431
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1432
!UIPainterView::ViewProperty methodsFor:'initialization'!
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1433
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1434
initialize
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1435
    super initialize.
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1436
    identifier := Identifier
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1437
! !
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1438
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1439
!UIPainterView::ViewProperty methodsFor:'misc'!
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1440
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1441
extractNumberStartingAt:anIndex
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1442
    "return the number from the name starting at anIndex or 0.
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1443
    "
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1444
    |val|
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1445
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1446
    val := 0.
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1447
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1448
    self name from:anIndex do:[:c|
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1449
        c isDigit ifTrue:[val := val * 10 + c digitValue]
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1450
                 ifFalse:[^ 0]
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1451
    ].
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1452
    ^ val
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1453
        
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1454
! !
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1455
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1456
!UIPainterView::ViewProperty methodsFor:'spec messages'!
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1457
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1458
doesNotUnderstand:aMessage
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1459
    spec notNil ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1460
        (spec respondsTo:(aMessage selector)) ifTrue:[^ aMessage sendTo:spec]
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1461
    ].
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1462
    ^ nil
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1463
!
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1464
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1465
layout
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1466
    spec layout
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1467
!
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1468
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1469
layout:aLayout
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1470
    spec layout:aLayout
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1471
!
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1472
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1473
name
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1474
    ^ spec name
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1475
!
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1476
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1477
name:aName
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1478
    spec name:aName
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1479
! !
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  1480
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1481
!UIPainterView class methodsFor:'documentation'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1482
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1483
version
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1484
    ^ '$Header$'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1485
! !