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