UIPainterView.st
author Claus Gittinger <cg@exept.de>
Sun, 02 Nov 1997 19:40:38 +0100
changeset 376 3023fc08ee35
parent 361 6624bb5d9a1a
child 392 53a63b0e8279
permissions -rw-r--r--
checkin from browser
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
361
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   388
!UIPainterView methodsFor:'event handling'!
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   389
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   390
keyPress:key x:x y:y view:aView
376
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   391
    "a delegated keyEvent from aView"
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   392
361
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   393
    self keyPress:key x:x y:y
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   394
376
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   395
    "Modified: / 31.10.1997 / 20:27:22 / cg"
361
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   396
!
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   397
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   398
keyRelease:key x:x y:y view:aView
376
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   399
    "a delegated keyEvent from aView"
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   400
361
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   401
    self keyRelease:key x:x y:y
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   402
376
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   403
    "Modified: / 31.10.1997 / 20:27:32 / cg"
361
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   404
! !
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   405
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   406
!UIPainterView methodsFor:'generating output'!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   407
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   408
aspectMethods
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   409
    "extract a list of aspect methods - for browsing"
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   410
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   411
    |cls methods skip selector protoSpec|
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   412
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   413
    className isNil ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   414
        self warn:'set the class first'.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   415
        ^ #()
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
    cls := self resolveName:className.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   419
    methods := IdentitySet new.
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
    treeView propertiesDo:[:aProp|
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   422
        |selector|
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   423
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   424
        (selector := aProp model) notNil ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   425
            selector isArray ifFalse:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   426
                selector := selector asSymbol.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   427
                (cls implements:selector) ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   428
                    skip := false.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   429
                    (cls isSubclassOf:SimpleDialog) ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   430
                        skip := SimpleDialog implements:selector asSymbol
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   431
                    ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   432
                    skip ifFalse:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   433
                        methods add:(cls compiledMethodAt:selector)
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   434
                    ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   435
                ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   436
            ].
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
        (selector := aProp menu) notNil ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   440
            selector isArray ifFalse:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   441
                selector := selector asSymbol.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   442
                (cls implements:selector) ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   443
                    methods add:(cls compiledMethodAt:selector)
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   444
                ]
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   445
            ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   446
        ].
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
        (aProp spec aspectSelectors) do:[:aSel |
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   449
            |selector|
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   450
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   451
            aSel isArray ifFalse:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   452
                selector := aSel asSymbol.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   453
                (cls implements:selector) ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   454
                    methods add:(cls compiledMethodAt:selector)
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   455
                ]
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   456
            ].
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
        aProp spec actionSelectors do:[:aSel|
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   459
            |selector|
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
            aSel isArray ifFalse:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   462
                selector := aSel asSymbol.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   463
                (cls implements:selector) ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   464
                    methods add:(cls compiledMethodAt:selector)
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   465
                ]
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   466
            ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   467
        ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   468
        aProp spec valueSelectors do:[:aSel|
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   469
            |selector|
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
            aSel isArray ifFalse:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   472
                selector := aSel asSymbol.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   473
                (cls implements:selector) ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   474
                    methods add:(cls compiledMethodAt:selector)
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   475
                ]
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   476
            ].
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
    ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   479
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   480
    protoSpec := treeView canvasSpec.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   481
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   482
    (selector := protoSpec menu) notNil ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   483
        selector isArray ifFalse:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   484
            selector := selector asSymbol.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   485
            (cls implements:selector) ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   486
                methods add:(cls compiledMethodAt:selector)
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   487
            ]
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   488
        ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   489
    ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   490
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   491
    ^ methods
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   492
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   493
    "Created: / 25.10.1997 / 18:58:25 / cg"
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   494
    "Modified: / 26.10.1997 / 15:06:18 / cg"
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   495
!
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   496
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   497
generateActionMethodFor:aspect spec:protoSpec inClass:targetClass
288
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   498
    |selector args showIt code alreadyInSuperclass|
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   499
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   500
    selector := aspect asSymbol.
141
d06c04391233 generate actions with argument
ca
parents: 137
diff changeset
   501
288
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   502
    alreadyInSuperclass := targetClass superclass canUnderstand:selector.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   503
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   504
    (selector numArgs) == 1 ifFalse:[
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   505
        args := ''.
149
e652608690b1 help ...
ca
parents: 146
diff changeset
   506
        showIt := ' ...''.\'.
e652608690b1 help ...
ca
parents: 146
diff changeset
   507
    ] ifTrue:[
288
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   508
        args := 'anArgument'.
149
e652608690b1 help ...
ca
parents: 146
diff changeset
   509
        showIt := ''' , anArgument printString , '' ...''.\'.
e652608690b1 help ...
ca
parents: 146
diff changeset
   510
    ].
141
d06c04391233 generate actions with argument
ca
parents: 137
diff changeset
   511
288
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   512
    code := '!!' , targetClass name , ' methodsFor:''actions''!!\\' ,
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   513
                aspect , args , '\' ,
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   514
                '    "automatically generated by UIPainter ..."\\' ,
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   515
                '    "*** the code below performs no action"\' ,
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   516
                '    "*** (except for some feedback on the Transcript)"\' ,
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   517
                '    "*** Please change as required and accept in the browser."\' ,
288
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   518
                '\' .
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   519
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   520
    alreadyInSuperclass ifTrue:[
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   521
        code := code ,
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   522
                    '    "action for ' , aspect , ' is already provided in a superclass."\' ,
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   523
                    '    "It may be redefined here ..."\\'.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   524
    ] ifFalse:[
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   525
        code := code ,
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   526
                    '    "action to be added ..."\\'.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   527
    ].
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   528
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   529
    code := code ,
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   530
                '    Transcript showCR:self class name, '': '.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   531
    alreadyInSuperclass ifTrue:[
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   532
        code := code , 'inherited '.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   533
    ].
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   534
    code := code , 'action for ' , aspect , showIt.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   535
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   536
    alreadyInSuperclass ifTrue:[
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   537
        code := code ,
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   538
                        '    super ' , aspect , args , '.\'.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   539
    ].
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   540
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   541
    code := code ,
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   542
                '!! !!\\'.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   543
    ^ code withCRs
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   544
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   545
    "Modified: / 25.10.1997 / 19:18:50 / cg"
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   546
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   547
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   548
generateAspectMethodFor:aspect spec:protoSpec inClass:targetClass
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   549
    |modelClass modelValue modelGen|
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
   550
149
e652608690b1 help ...
ca
parents: 146
diff changeset
   551
    modelClass := protoSpec defaultModelClassFor:aspect.
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   552
    modelValue := protoSpec defaultModelValueFor:aspect.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   553
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   554
    modelValue isNil ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   555
        modelGen := modelClass name , ' new'
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   556
    ] ifFalse:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   557
        modelGen := modelValue storeString , ' asValue'
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   558
    ].
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
   559
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   560
    ^ ('!!' , targetClass name , ' methodsFor:''aspects''!!\\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   561
      aspect , '\' ,
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   562
      '    "automatically generated by UIPainter ..."\\' ,
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   563
      '    "*** the code below creates a default model when invoked."\' ,
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   564
      '    "*** (which may not be the one you wanted)"\' ,
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   565
      '    "*** Please change as required and accept in the browser."\' ,
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   566
      '\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   567
      '    |holder|\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   568
      '\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   569
      '    (holder := builder bindingAt:#' , aspect , ') isNil ifTrue:[\' ,
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   570
      '        builder aspectAt:#' , aspect , ' put:(holder := ' , ' ' , modelGen , ').\' ,
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   571
      '    ].\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   572
      '    ^ holder\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   573
      '!! !!\\') withCRs
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   574
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   575
    "Modified: / 26.10.1997 / 19:01:15 / cg"
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   576
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   577
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   578
generateAspectMethods
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   579
    "generate aspect, action & menu methods
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   580
     - but do not overwrite existing ones.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   581
     Return a string ready to compile into the application class."
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   582
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   583
    |cls code skip menuSelector protoSpec thisCode|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   584
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   585
    code := ''.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   586
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   587
    className isNil ifTrue:[
69
e533f77871dd generateAspectMethods: code2
ca
parents: 62
diff changeset
   588
        self warn:'set the class first'.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   589
        ^ code
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   590
    ].
330
ca
parents: 327
diff changeset
   591
    cls := self resolveName:className.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   592
316
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   593
    treeView propertiesDo:[:aProp|
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   594
        |modelSelector menuSelector|
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   595
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
   596
        protoSpec := aProp spec.
175
0b0b4d99e3e7 isResizeable
ca
parents: 165
diff changeset
   597
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   598
        (modelSelector := aProp model) notNil ifTrue:[
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   599
            (modelSelector isArray not) ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   600
                (cls implements:modelSelector asSymbol) ifFalse:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   601
                    skip := false.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   602
                    (cls isSubclassOf:SimpleDialog) ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   603
                        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
   604
                    ].
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   605
                    skip ifFalse:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   606
                        "/ kludge ..
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   607
                        (protoSpec isMemberOf:ActionButtonSpec) ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   608
                            thisCode := (self generateActionMethodFor:modelSelector spec:protoSpec inClass:cls).
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   609
                        ] ifFalse:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   610
                            thisCode := (self generateAspectMethodFor:modelSelector spec:protoSpec inClass:cls).
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   611
                        ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   612
                        code := code , thisCode
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   613
                    ].
158
6e7f892308ae do not generate accept/cancel and help action methods,
Claus Gittinger <cg@exept.de>
parents: 156
diff changeset
   614
                ].
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   615
            ].
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   616
        ].
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   617
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   618
        (menuSelector := aProp menu) notNil ifTrue:[
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   619
            (menuSelector isArray not) ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   620
                thisCode := self generateMenuMethodFor:menuSelector spec:protoSpec inClass:cls.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   621
                thisCode size ~~ 0 ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   622
                    code := code , thisCode
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   623
                ]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   624
            ]
111
ca
parents: 103
diff changeset
   625
        ].
ca
parents: 103
diff changeset
   626
ca
parents: 103
diff changeset
   627
        aProp spec aspectSelectors do:[:aSel|
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   628
            (aSel isArray not) ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   629
                (cls implements:aSel asSymbol) ifFalse:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   630
                    thisCode := (self generateAspectMethodFor:aSel spec:protoSpec inClass:cls).
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   631
                    code := code , thisCode
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   632
                ]
111
ca
parents: 103
diff changeset
   633
            ]
ca
parents: 103
diff changeset
   634
        ].
137
ca
parents: 134
diff changeset
   635
        aProp spec actionSelectors do:[:aSel|
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   636
            (aSel isArray not) ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   637
                (cls implements:aSel asSymbol) ifFalse:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   638
                    thisCode := (self generateActionMethodFor:aSel spec:protoSpec inClass:cls).
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   639
                    code := code , thisCode
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   640
                ]
137
ca
parents: 134
diff changeset
   641
            ]
ca
parents: 134
diff changeset
   642
        ].
188
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   643
        aProp spec valueSelectors do:[:aSel|
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   644
            (aSel isArray not) ifTrue:[
376
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   645
                "/ uppercase: - assume its a globals name.
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   646
                aSel first isUppercase ifFalse:[
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   647
                    (cls implements:aSel asSymbol) ifFalse:[
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   648
                        thisCode := (self generateValueMethodFor:aSel spec:protoSpec inClass:cls).
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   649
                        code := code , thisCode
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   650
                    ]
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   651
                ]
188
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   652
            ]
316
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   653
        ]
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   654
    ].
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   655
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   656
    protoSpec := treeView canvasSpec.
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   657
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   658
    (menuSelector := protoSpec menu) notNil ifTrue:[
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   659
        (menuSelector isArray not) ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   660
            thisCode := self generateMenuMethodFor:menuSelector spec:protoSpec inClass:cls.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   661
            thisCode size ~~ 0 ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   662
                code := code , thisCode
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   663
            ]
316
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   664
        ]
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   665
    ].
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   666
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   667
    ^ code
316
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   668
376
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   669
    "Modified: / 31.10.1997 / 14:22:30 / cg"
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   670
!
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   671
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   672
generateHookMethodFor:selectorSpec comment:commentWhen note:noteOrNil defaultCode:defaultCode inClass:targetClass
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   673
    ^ ('!!' , targetClass name , ' methodsFor:''hooks''!!\\' ,
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   674
      selectorSpec , '\' ,
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   675
      '    "automatically generated by UIPainter ..."\\' ,
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   676
      '    "*** the code here does nothing. It is invoked when"\' ,
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   677
      '    "*** ' , commentWhen , '"\' ,
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   678
      '    "*** Please change as required and accept in the browser."\' ,
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   679
      '\' ,
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   680
      '    "specific code to be added below ..."\' ,
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   681
      '    "' , (noteOrNil ? '') , '"\' ,
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   682
      '\' ,
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   683
      (defaultCode ? '^ self.') ,
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   684
      '!! !!\\') withCRs
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   685
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   686
    "Modified: / 25.10.1997 / 19:22:17 / cg"
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   687
    "Created: / 31.10.1997 / 17:31:53 / cg"
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   688
!
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   689
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   690
generateHookMethods
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   691
    "generate hook methods
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   692
     - but do not overwrite existing ones.
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   693
     Return a string ready to compile into the application class."
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   694
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   695
    |cls code skip menuSelector protoSpec thisCode|
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   696
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   697
    code := ''.
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   698
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   699
    className isNil ifTrue:[
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   700
        self warn:'set the class first'.
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   701
        ^ code
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   702
    ].
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   703
    cls := self resolveName:className.
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   704
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   705
    code := code , (self generateHookMethodsInClass:cls).
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   706
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   707
    ^ code
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   708
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   709
    "Created: / 31.10.1997 / 17:21:29 / cg"
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   710
    "Modified: / 31.10.1997 / 17:38:11 / cg"
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   711
!
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   712
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   713
generateHookMethodsInClass:targetClass
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   714
    |code|
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   715
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   716
    code := ''.
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   717
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   718
    (targetClass implements:#postBuildWith:) ifFalse:[
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   719
        code := code 
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   720
                , (self 
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   721
                    generateHookMethodFor:'postBuildWith:aBuilder'
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   722
                    comment:'the widgets have been built, but before the view is opened'
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   723
                    note:nil
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   724
                    defaultCode:nil
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   725
                    inClass:targetClass)
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   726
    ].
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   727
    (targetClass implements:#postOpenWith:) ifFalse:[
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   728
        code := code 
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   729
                , (self 
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   730
                    generateHookMethodFor:'postOpenWith:aBuilder'
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   731
                    comment:'the topView has been opened, but before events are dispatched for it'
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   732
                    note:nil
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   733
                    defaultCode:nil
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   734
                    inClass:targetClass)
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   735
    ].
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   736
    (targetClass implements:#closeRequest) ifFalse:[
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   737
        code := code 
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   738
                , (self 
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   739
                    generateHookMethodFor:'closeRequest'
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   740
                    comment:'the topView has been asked to close'
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   741
                    note:'return without the ''super closeRequest'' to stay open'
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   742
                    defaultCode:'^ super closeRequest'
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   743
                    inClass:targetClass)
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   744
    ].
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   745
    ^ code
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   746
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   747
    "Modified: / 31.10.1997 / 17:30:34 / cg"
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   748
    "Created: / 31.10.1997 / 17:32:49 / cg"
316
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   749
!
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   750
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   751
generateMenuMethodFor:aspect spec:protoSpec inClass:aClass
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   752
    |code cperf performer category|
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   753
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   754
    (aClass implements:aspect asSymbol) ifFalse:[
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   755
        code := MenuEditor generateCodeFor:aClass menuSelector:(aspect asSymbol).
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   756
    ] ifTrue:[
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   757
        code := ''
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   758
    ].
111
ca
parents: 103
diff changeset
   759
316
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   760
    (protoSpec respondsTo:#menuPerformer) ifTrue:[
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   761
        performer := protoSpec menuPerformer.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   762
    ].
316
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   763
    performer notNil ifTrue:[
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   764
        performer := performer asSymbol.
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   765
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   766
        (aClass implements:performer) ifFalse:[
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   767
            category := MenuEditor sourceCategory.
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   768
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   769
            cperf  := Character excla asString 
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   770
                    , aClass name , ' methodsFor:' , category storeString
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   771
                    , Character excla asString , '\\'
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   772
                    , performer , '\'
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   773
                    , '    "this menu spec was automatically generated by the UI MenuBuilder"\\'
316
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   774
                    , '    ^ self\\'
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   775
                    , '\'
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   776
                    , Character excla asString
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   777
                    , ' '
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   778
                    , Character excla asString
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   779
                    , '\\'.
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   780
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   781
            code := code, cperf.
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   782
        ]
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   783
    ].
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   784
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   785
    code size == 0 ifTrue:[
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   786
        ^ nil
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   787
    ].
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   788
  ^ code withCRs
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   789
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   790
    "Modified: / 26.10.1997 / 14:44:20 / cg"
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   791
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   792
188
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   793
generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   794
    ^ ('!!' , targetClass name , ' methodsFor:''values''!!\\' ,
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   795
      aspect , '\' ,
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   796
      '    "automatically generated by UIPainter ..."\\' ,
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   797
      '    "*** the code below returns a default value when invoked."\' ,
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   798
      '    "*** (which may not be the one you wanted)"\' ,
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   799
      '    "*** Please change as required and accept in the browser."\' ,
188
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   800
      '\' ,
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   801
      '    "value to be added below ..."\' ,
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   802
      '    Transcript showCR:self class name , '': no value yet for ' , aspect , ' ...''.\' ,
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   803
      '\' ,
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   804
      '^ nil.' ,
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   805
      '!! !!\\') withCRs
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   806
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   807
    "Modified: / 25.10.1997 / 19:22:17 / cg"
188
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   808
!
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   809
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   810
generateWindowSpecMethodSource
310
a68c182d050f support of scrollers and menu for the canvas
ca
parents: 288
diff changeset
   811
    |spec str code category cls mthd|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   812
310
a68c182d050f support of scrollers and menu for the canvas
ca
parents: 288
diff changeset
   813
    spec := OrderedCollection new.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   814
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   815
    self subViews do:[:aView|
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   816
        aView ~~ inputView ifTrue:[
310
a68c182d050f support of scrollers and menu for the canvas
ca
parents: 288
diff changeset
   817
            spec add:(self fullSpecFor:aView)
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   818
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   819
    ].
310
a68c182d050f support of scrollers and menu for the canvas
ca
parents: 288
diff changeset
   820
    spec := treeView generateFullSpecForComponents:spec.
a68c182d050f support of scrollers and menu for the canvas
ca
parents: 288
diff changeset
   821
    str  := WriteStream on:String new.
a68c182d050f support of scrollers and menu for the canvas
ca
parents: 288
diff changeset
   822
    UISpecification prettyPrintSpecArray:spec on:str indent:5.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   823
178
fb8451053c96 keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
   824
    "/ 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
   825
fb8451053c96 keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
   826
    category := 'interface specs'.
330
ca
parents: 327
diff changeset
   827
    cls := self resolveName:className.
ca
parents: 327
diff changeset
   828
ca
parents: 327
diff changeset
   829
    cls notNil ifTrue:[
178
fb8451053c96 keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
   830
        (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
   831
            category := mthd category.
fb8451053c96 keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
   832
        ]
fb8451053c96 keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
   833
    ].
fb8451053c96 keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
   834
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   835
    code := '!!'
178
fb8451053c96 keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
   836
            , className , ' class methodsFor:' , category storeString
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   837
            , '!!' , '\\'
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   838
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   839
            , methodName , '\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   840
            , '    "this window spec was automatically generated by the ST/X UIPainter"\\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   841
            , '    "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
   842
            , '     handle the specification if its corrupted."\\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   843
            , '    "\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   844
            , '     UIPainter new openOnClass:' , className , ' andSelector:#' , methodName , '\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   845
            , '     ' , className , ' new openInterface:#' , methodName , '\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   846
            , '    "\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   847
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   848
    methodName = 'windowSpec' ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   849
        code := code , '    "' , className , ' open"\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   850
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   851
    code := code 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   852
            , '\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   853
            , '    <resource: #canvas>\\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   854
            , '    ^\' 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   855
            , '     ', str contents
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   856
            , '\'
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   857
            , '!! !!'
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   858
            , '\\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   859
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   860
    ^ code withCRs
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   861
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   862
    "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
   863
    "Modified: 24.6.1997 / 19:12:44 / cg"
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
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   866
!UIPainterView methodsFor:'initialization'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   867
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   868
initialize
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   869
    "setup attributes
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   870
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   871
    super initialize.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   872
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   873
    superclassName := 'ApplicationModel'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   874
    className      := 'NewApplication'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   875
    methodName     := 'windowSpec'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   876
    categoryName   := 'Applications'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   877
    HandCursor     := Cursor leftHand.
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
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   880
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   881
setupFromSpec:specOrSpecArray
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   882
    |spec builder|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   883
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   884
    treeView cvsSetupListDo:[
111
ca
parents: 103
diff changeset
   885
        self removeAll.
ca
parents: 103
diff changeset
   886
        spec    := UISpecification from:specOrSpecArray.
ca
parents: 103
diff changeset
   887
        builder := UIBuilder new.
ca
parents: 103
diff changeset
   888
        spec window setupView:self topView for:builder.
ca
parents: 103
diff changeset
   889
        self addSpec:(spec component) builder:builder in:self.
ca
parents: 103
diff changeset
   890
        self realizeAllSubViews.
ca
parents: 103
diff changeset
   891
        inputView raise.
310
a68c182d050f support of scrollers and menu for the canvas
ca
parents: 288
diff changeset
   892
        treeView setAttributesFromWindowSpec:(spec window).
111
ca
parents: 103
diff changeset
   893
    ]
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   894
!
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   895
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   896
treeView:aTreeView
361
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   897
    treeView := aTreeView.
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   898
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   899
    treeView delegate:(
376
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   900
        "/
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   901
        "/ I want to handle everything typed
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   902
        "/ in the treeView, except for Return and Cursor-keys
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   903
        "/
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   904
        KeyboardForwarder 
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   905
            toView:self
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   906
            condition:nil
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   907
            filter:[:k | (k isSymbol 
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   908
                         and:[k ~~ #Return 
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   909
                         and:[(k startsWith:#Cursor) not]])
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   910
                   ]
361
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   911
    )
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   912
376
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   913
    "Modified: / 31.10.1997 / 20:22:09 / cg"
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   914
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   915
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   916
!UIPainterView methodsFor:'menus'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   917
121
96d6feeeb049 middleButtonMen:
ca
parents: 119
diff changeset
   918
showMiddleButtonMenu
96d6feeeb049 middleButtonMen:
ca
parents: 119
diff changeset
   919
    "show the middle button menu; this returns nil
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   920
    "
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   921
    self enabled ifTrue:[
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   922
        (MenuPanel fromSpec:(UIPainter menuCanvas) receiver:self) startUp
111
ca
parents: 103
diff changeset
   923
    ].
121
96d6feeeb049 middleButtonMen:
ca
parents: 119
diff changeset
   924
  ^ nil
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   925
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   926
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   927
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   928
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   929
335
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
   930
!UIPainterView methodsFor:'queries'!
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
   931
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
   932
resolveName:aName
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
   933
    |appl|
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
   934
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
   935
    appl := self application.
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
   936
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
   937
    appl notNil ifTrue:[
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
   938
        ^ appl resolveName:aName
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
   939
    ].
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
   940
    ^ Smalltalk resolveName:aName inClass:self class
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
   941
! !
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
   942
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   943
!UIPainterView methodsFor:'removing components'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   944
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   945
remove:anObject
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   946
    "remove anObject from the contents do redraw
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   947
    "
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
   948
    anObject notNil ifTrue:[
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   949
        treeView removeView:anObject.
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
   950
    ]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   951
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   952
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   953
removeAll
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   954
    "remove all objects and properties
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   955
    "
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   956
    treeView cvsEventsDisabledDo:[
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   957
        self  select:nil.
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   958
        treeView removeAll.
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   959
        self  removeUndoHistory.
111
ca
parents: 103
diff changeset
   960
    ]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   961
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   962
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   963
!UIPainterView methodsFor:'searching'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   964
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   965
findContainerOfView:aView
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   966
    "returns the super view assigned to a view
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   967
    "
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   968
    |p|
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   969
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   970
    (p := self propertyOfParentForView:aView) isNil ifTrue:[
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   971
        ^ self
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   972
    ].
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   973
    ^ p view
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   974
!
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   975
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   976
findObjectAt:aPoint
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   977
    "find the origin/corner of the currentWidget
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   978
    "
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   979
    |view prop|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   980
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   981
    view := super findObjectAt:aPoint.
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   982
    prop := self propertyRespondsToView:view.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   983
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   984
    prop notNil ifTrue:[^ prop view].
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   985
  ^ nil
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   986
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   987
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   988
findViewWithId:aViewId
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   989
    "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
   990
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   991
    |prop|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   992
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   993
    prop := self propertyOfIdentifier:aViewId.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   994
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   995
    prop notNil ifTrue:[^ prop view]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   996
               ifFalse:[^ nil]
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   997
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   998
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   999
propertyOfIdentifier:anId
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1000
    "returns property assigned to unique identifier
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1001
    "
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1002
    anId notNil ifTrue:[
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
  1003
        ^ treeView propertyDetect:[:p| p identifier == anId ]
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1004
    ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1005
    ^ nil
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1006
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1007
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1008
propertyOfName:aString
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1009
    "returns property assigned to name
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1010
    "
111
ca
parents: 103
diff changeset
  1011
    |name|
ca
parents: 103
diff changeset
  1012
ca
parents: 103
diff changeset
  1013
    aString isNil ifFalse:[
ca
parents: 103
diff changeset
  1014
        name := aString string withoutSeparators.
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
  1015
      ^ treeView propertyDetect:[:p| p name = name ].
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1016
    ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1017
    ^ nil
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1018
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1019
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1020
propertyOfParentForView:aSubView
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1021
    "returns the property of the parent or nil
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1022
    "
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1023
    |item|
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1024
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1025
    (item := treeView detectItemRespondsToView:aSubView) notNil ifTrue:[
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1026
        (item := item parent) notNil ifTrue:[^ item contents]
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1027
    ].
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1028
    ^ nil
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1029
!
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1030
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1031
propertyOfView:aView
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1032
    "returns property assigned to view
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1033
    "
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1034
    (aView isNil or:[aView == self]) ifFalse:[
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
  1035
        ^ treeView propertyDetect:[:p| p view == aView ]
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1036
    ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1037
    ^ nil
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1038
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1039
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1040
propertyRespondsToView:aView
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1041
    "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
  1042
     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
  1043
     nil is returned.
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1044
    "
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1045
    |item|
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1046
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1047
    item := treeView detectItemRespondsToView:aView.
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1048
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1049
    (item notNil and:[item parent notNil]) ifTrue:[
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1050
        ^ item contents
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1051
    ].
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1052
    ^ nil
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1053
!
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1054
111
ca
parents: 103
diff changeset
  1055
uniqueNameFor:aSpecOrString
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1056
    "generate and return an unique name for a class
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1057
    "
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1058
    |next name size|
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1059
111
ca
parents: 103
diff changeset
  1060
    aSpecOrString isString ifFalse:[name := aSpecOrString className asString]
ca
parents: 103
diff changeset
  1061
                            ifTrue:[name := aSpecOrString].
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1062
111
ca
parents: 103
diff changeset
  1063
    (name endsWith:'Spec') ifTrue:[
ca
parents: 103
diff changeset
  1064
        name := name copyFrom:1 to:(name size - 4).
ca
parents: 103
diff changeset
  1065
    ] ifFalse:[
ca
parents: 103
diff changeset
  1066
        name := name copy
ca
parents: 103
diff changeset
  1067
    ].
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1068
    name at:1 put:(name at:1) asLowercase.
111
ca
parents: 103
diff changeset
  1069
    size  := name size + 1.
ca
parents: 103
diff changeset
  1070
    next  := 0.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1071
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
  1072
    treeView propertiesDo:[:p|
111
ca
parents: 103
diff changeset
  1073
        |n|
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1074
        n := p name.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1075
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1076
        (n size >= size and:[n startsWith:name]) ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1077
            next := next max:(p extractNumberStartingAt:size)
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1078
        ]
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1079
    ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1080
    next := next + 1.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1081
    name := name, next printString.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1082
  ^ name
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1083
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
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1087
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1088
uniqueNameOf:aView
111
ca
parents: 103
diff changeset
  1089
    |prop|
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1090
111
ca
parents: 103
diff changeset
  1091
    (prop := self propertyOfView:aView) notNil ifTrue:[
ca
parents: 103
diff changeset
  1092
        prop name isNil ifTrue:[
ca
parents: 103
diff changeset
  1093
            prop name:(self uniqueNameFor:(prop spec)).
ca
parents: 103
diff changeset
  1094
        ].
ca
parents: 103
diff changeset
  1095
        ^ prop name
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1096
    ].
111
ca
parents: 103
diff changeset
  1097
    ^ 'self'
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1098
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1099
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1100
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1101
!UIPainterView methodsFor:'selection basics'!
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1102
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1103
addToSelection:anObject
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1104
    "add an object to the selection
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1105
    "
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1106
    (self enabled and:[(self isSelected:anObject) not]) ifTrue:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1107
        selection isCollection ifFalse:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1108
            selection isNil ifTrue:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1109
                selection := anObject
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1110
            ] ifFalse:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1111
                selection := OrderedCollection with:selection with:anObject
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1112
            ]
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1113
        ] ifTrue:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1114
            selection add:anObject
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1115
        ].
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1116
        self showSelected:anObject.
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
  1117
        treeView cvsSelectionAdd:anObject.
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1118
    ]
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1119
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1120
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1121
!
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1122
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1123
removeFromSelection:anObject
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1124
    "remove an object from the selection
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1125
    "
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1126
    (self isSelected:anObject) ifTrue:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1127
        self showUnselected:anObject.
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1128
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1129
        selection size > 1 ifTrue:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1130
            selection remove:anObject ifAbsent:nil.
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1131
            self showSelection.
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1132
        ] ifFalse:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1133
            selection := nil
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1134
        ].
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
  1135
        treeView cvsSelectionRemove:anObject.
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1136
    ]
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1137
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1138
!
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1139
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1140
select:something
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1141
    "change selection to something
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1142
    "
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1143
    (self enabled and:[something ~= self selection]) ifTrue:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1144
        self setSelection:something withRedraw:true.
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
  1145
        treeView cvsSelection:something
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1146
    ]
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1147
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1148
!
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1149
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1150
updateSelectionFromModel:aSelOrNil
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1151
    "update selection from a new selection
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1152
    "
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1153
    selectionHiddenLevel == 0 ifTrue:[
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1154
        aSelOrNil size ~~ 0 ifTrue:[
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1155
            self selectionDo:[:el| (aSelOrNil includes:el) ifFalse:[self showUnselected:el] ]
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1156
        ] ifFalse:[
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1157
            self selectionDo:[:el| self showUnselected:el ]
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1158
        ]
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1159
    ].
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1160
    self setSelection:aSelOrNil withRedraw:false.
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1161
    self showSelection
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1162
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1163
! !
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1164
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1165
!UIPainterView methodsFor:'specification'!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1166
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1167
addSpec:aSpecification builder:aBuilder in:aFrame
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1168
    "build view and subviews from aSpecification into a frame. The top view
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1169
     is returned. The contained components of a spec are set to nil
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1170
    "
330
ca
parents: 327
diff changeset
  1171
    |cls|
212
1836a16763cc oops again
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
  1172
330
ca
parents: 327
diff changeset
  1173
    cls := self resolveName:className.
ca
parents: 327
diff changeset
  1174
ca
parents: 327
diff changeset
  1175
    cls notNil ifTrue:[
ca
parents: 327
diff changeset
  1176
        aBuilder applicationClass:cls.
212
1836a16763cc oops again
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
  1177
    ].
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1178
111
ca
parents: 103
diff changeset
  1179
    aBuilder componentCreationHook:[:aView :aSpec :aBdr||sv p s n|
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1180
        p := ViewProperty new.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1181
        s := aSpec copy.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1182
        p spec:s.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1183
        p view:aView.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1184
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1185
        s class supportsSubComponents ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1186
            s component:nil
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1187
        ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1188
111
ca
parents: 103
diff changeset
  1189
        n := s name.
ca
parents: 103
diff changeset
  1190
ca
parents: 103
diff changeset
  1191
        (n isNil or:[(self propertyOfName:n) notNil]) ifTrue:[
ca
parents: 103
diff changeset
  1192
            s name:(self uniqueNameFor:s)
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1193
        ].
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
  1194
        treeView addProperty:p.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1195
    ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1196
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1197
    ^ aSpecification buildViewWithLayoutFor:aBuilder in:aFrame.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1198
212
1836a16763cc oops again
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
  1199
    "Modified: 4.7.1997 / 23:48:55 / cg"
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1200
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1201
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1202
fullSpecFor:anObject
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1203
    "generate a full spec for an object
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
  1204
    "
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1205
    |mySpec subSpecs|
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1206
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1207
    mySpec := self specFor:anObject.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1208
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1209
    (mySpec notNil and:[mySpec class supportsSubComponents]) ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1210
        (anObject subViews notNil) ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1211
            anObject subViews do:[:aSubView||spec|
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1212
                spec := self fullSpecFor:aSubView.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1213
                spec notNil ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1214
                    subSpecs isNil ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1215
                        subSpecs := OrderedCollection new
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1216
                    ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1217
                    subSpecs add:spec.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1218
                ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1219
            ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1220
            subSpecs notNil ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1221
                mySpec component:(SpecCollection new collection:subSpecs)
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1222
            ]
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1223
        ]
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1224
    ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1225
    ^ mySpec
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1226
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1227
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1228
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1229
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1230
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1231
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1232
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1233
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1234
rebuildView:aView fromSpec:aSpec withBuilder:aBuilder
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1235
    |v|
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
    aSpec needsRebuildForAttributes ifTrue:[
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1238
        v := aSpec buildViewWithLayoutFor:aBuilder in:(self findContainerOfView:aView).
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1239
        v realize.    
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1240
        aView destroy.
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1241
        device sync.
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1242
        device flush.
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1243
        aView becomeSameAs:v.
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1244
        inputView raise.
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1245
    ] ifFalse:[
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1246
        aSpec setAttributesIn:aView with:aBuilder.
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1247
        self elementChangedSize:aView.
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1248
    ].
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1249
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1250
!
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1251
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1252
specFor:anObject
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1253
    "returns spec assigned to an object
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
  1254
    "
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1255
    |prop spec|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1256
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1257
    (prop := self propertyOfView:anObject) notNil ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1258
        spec := prop spec copy.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1259
        spec layoutFromView:anObject
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1260
    ].
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1261
    ^ spec
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1262
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1263
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1264
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1265
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1266
146
ae84facd80be checkin from browser
ca
parents: 141
diff changeset
  1267
specForSelection
ae84facd80be checkin from browser
ca
parents: 141
diff changeset
  1268
    "returns spec assigned to current single selection or nil
ae84facd80be checkin from browser
ca
parents: 141
diff changeset
  1269
    "
ae84facd80be checkin from browser
ca
parents: 141
diff changeset
  1270
    ^ self specFor:(self singleSelection)
ae84facd80be checkin from browser
ca
parents: 141
diff changeset
  1271
ae84facd80be checkin from browser
ca
parents: 141
diff changeset
  1272
ae84facd80be checkin from browser
ca
parents: 141
diff changeset
  1273
!
ae84facd80be checkin from browser
ca
parents: 141
diff changeset
  1274
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1275
updateFromSpec:aSpec
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1276
    "update current selected view from specification
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
  1277
    "
327
0040d47658c6 check - warnings eliminated. Fix in InspectorList.st
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
  1278
    |props name builder|
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1279
281
aabb4037f6a3 window spec
ca
parents: 279
diff changeset
  1280
    aSpec class == WindowSpec ifTrue:[
310
a68c182d050f support of scrollers and menu for the canvas
ca
parents: 288
diff changeset
  1281
        ^ treeView canvasSpec:aSpec
281
aabb4037f6a3 window spec
ca
parents: 279
diff changeset
  1282
    ].
aabb4037f6a3 window spec
ca
parents: 279
diff changeset
  1283
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1284
    self singleSelection notNil ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1285
        self withSelectionHiddenDo:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1286
            self transaction:#specification selectionDo:[:aView|
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1287
                builder := UIBuilder new.
212
1836a16763cc oops again
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
  1288
                className notNil ifTrue:[
330
ca
parents: 327
diff changeset
  1289
                    builder applicationClass:(self resolveName:className).
212
1836a16763cc oops again
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
  1290
                ].
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1291
                props   := self propertyOfView:aView.
82
99dc76d66eab checkin from browser
ca
parents: 80
diff changeset
  1292
                name    := (aSpec name) withoutSeparators.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1293
82
99dc76d66eab checkin from browser
ca
parents: 80
diff changeset
  1294
                name = props name ifFalse:[
99dc76d66eab checkin from browser
ca
parents: 80
diff changeset
  1295
                    (self propertyOfName:name) notNil ifTrue:[
99dc76d66eab checkin from browser
ca
parents: 80
diff changeset
  1296
                        name := props name
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1297
                    ]
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1298
                ].
82
99dc76d66eab checkin from browser
ca
parents: 80
diff changeset
  1299
                aSpec name:name.
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1300
                self createUndoSpecModify:props.
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1301
                self rebuildView:aView fromSpec:aSpec withBuilder:builder.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1302
                props spec:(aSpec copy).
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
  1303
                treeView propertyChanged:props.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1304
            ]
111
ca
parents: 103
diff changeset
  1305
        ]
82
99dc76d66eab checkin from browser
ca
parents: 80
diff changeset
  1306
    ]
212
1836a16763cc oops again
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
  1307
1836a16763cc oops again
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
  1308
    "Modified: 4.7.1997 / 23:49:44 / cg"
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1309
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1310
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1311
!UIPainterView methodsFor:'testing'!
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1312
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1313
canChangeLayoutOfView:aView
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1314
    "returns true if the view can change its layout which is depend