UIPainterView.st
author ca
Tue, 18 Feb 1997 11:38:57 +0100
changeset 55 19e021c8f1ef
parent 53 d03569a6ff03
child 57 5af567f52811
permissions -rw-r--r--
*** empty log message ***
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
     1
"
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
     2
 COPYRIGHT (c) 1995 by Claus Gittinger
52
40a98a1507b4 *** empty log message ***
ca
parents: 51
diff changeset
     3
	      All Rights Reserved
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
     4
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
     5
 This software is furnished under a license and may be used
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
     6
 only in accordance with the terms of that license and with the
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
     8
 be provided or otherwise made available to, or used by, any
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
     9
 other person.  No title to or ownership of the software is
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    10
 hereby transferred.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    11
"
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    12
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    13
UIObjectView subclass:#UIPainterView
55
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
    14
	instanceVariableNames:'fontPanel viewProperties superclassName className methodName
52
40a98a1507b4 *** empty log message ***
ca
parents: 51
diff changeset
    15
		categoryName'
40a98a1507b4 *** empty log message ***
ca
parents: 51
diff changeset
    16
	classVariableNames:'HandCursor'
40a98a1507b4 *** empty log message ***
ca
parents: 51
diff changeset
    17
	poolDictionaries:''
40a98a1507b4 *** empty log message ***
ca
parents: 51
diff changeset
    18
	category:'Interface-UIPainter'
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    19
!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    20
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    21
Object subclass:#ViewProperty
52
40a98a1507b4 *** empty log message ***
ca
parents: 51
diff changeset
    22
	instanceVariableNames:'aspectSelector changeSelector name nameIndex view elementClass
40a98a1507b4 *** empty log message ***
ca
parents: 51
diff changeset
    23
		labelSelector identifier'
40a98a1507b4 *** empty log message ***
ca
parents: 51
diff changeset
    24
	classVariableNames:'Identifier'
40a98a1507b4 *** empty log message ***
ca
parents: 51
diff changeset
    25
	poolDictionaries:''
40a98a1507b4 *** empty log message ***
ca
parents: 51
diff changeset
    26
	privateIn:UIPainterView
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    27
!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    28
48
2fb81a3e0246 *** empty log message ***
ca
parents: 45
diff changeset
    29
UIPainterView::ViewProperty subclass:#GroupProperties
52
40a98a1507b4 *** empty log message ***
ca
parents: 51
diff changeset
    30
	instanceVariableNames:'controlledObjects group'
40a98a1507b4 *** empty log message ***
ca
parents: 51
diff changeset
    31
	classVariableNames:''
40a98a1507b4 *** empty log message ***
ca
parents: 51
diff changeset
    32
	poolDictionaries:''
40a98a1507b4 *** empty log message ***
ca
parents: 51
diff changeset
    33
	privateIn:UIPainterView
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    34
!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    35
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    36
!UIPainterView class methodsFor:'documentation'!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    37
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    38
copyright
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    39
"
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    40
 COPYRIGHT (c) 1995 by Claus Gittinger
52
40a98a1507b4 *** empty log message ***
ca
parents: 51
diff changeset
    41
	      All Rights Reserved
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    42
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    43
 This software is furnished under a license and may be used
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    44
 only in accordance with the terms of that license and with the
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    45
 inclusion of the above copyright notice.   This software may not
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    46
 be provided or otherwise made available to, or used by, any
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    47
 other person.  No title to or ownership of the software is
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    48
 hereby transferred.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    49
"
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    50
!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    52
documentation
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    53
"
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    54
    not yet finished, not yet published, not yet released.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    55
"
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    56
! !
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    57
53
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
    58
!UIPainterView class methodsFor:'defaults'!
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
    59
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
    60
defaultMenuMessage   
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
    61
    "This message is the default yo be sent to the menuHolder to get a menu
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
    62
    "
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
    63
    ^ #menu
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
    64
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
    65
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
    66
! !
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
    67
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    68
!UIPainterView methodsFor:'accessing'!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    69
53
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
    70
application
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
    71
    self halt.
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
    72
    ^ nil
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
    73
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
    74
    "Modified: 6.9.1995 / 00:46:44 / claus"
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
    75
!
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
    76
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    77
className
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    78
    ^ className
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    79
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    80
    "Modified: 5.9.1995 / 18:41:30 / claus"
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    81
!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    82
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    83
className:aString
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    84
    className := aString
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    85
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    86
    "Modified: 5.9.1995 / 18:47:17 / claus"
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    87
!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    88
55
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
    89
className:aClassName superclassName:aSuperclassName selector:aSelector
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
    90
    className := aClassName.
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
    91
    superclassName := aSuperclassName.
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
    92
    methodName := aSelector.
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
    93
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
    94
!
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
    95
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    96
methodName
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    97
    ^ methodName
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    98
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    99
    "Modified: 5.9.1995 / 18:41:34 / claus"
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   100
!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   101
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   102
methodName:aString
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   103
    methodName := aString
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   104
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   105
    "Modified: 5.9.1995 / 18:47:27 / claus"
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   106
!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   107
53
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   108
selectNames:aStringOrCollection
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   109
    |prop coll s|
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   110
53
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   111
    (aStringOrCollection isNil or:[aStringOrCollection isEmpty]) ifTrue:[
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   112
        ^ self unselect
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   113
    ].
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   114
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   115
    (s := aStringOrCollection) isString ifFalse:[
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   116
        s size == 1 ifTrue:[
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   117
            s := s first
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   118
        ] ifFalse:[
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   119
            coll := OrderedCollection new.
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   120
53
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   121
            s do:[:aName|
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   122
                (prop := self propertyOfName:aName) notNil ifTrue:[
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   123
                    coll add:(prop view)
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   124
                ]
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   125
            ].
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   126
            coll size == 1 ifTrue:[ ^ self select:(coll at:1) ].
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   127
            coll size == 0 ifTrue:[ ^ self unselect ].
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   128
53
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   129
            self hideSelection.
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   130
            selection := coll.
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   131
            self showSelection.
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   132
          ^ self changed:#selection
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   133
        ]
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   134
    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   135
53
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   136
    prop := self propertyOfName:s.
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   137
    prop isNil ifTrue:[^ self unselect]
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   138
              ifFalse:[^ self select:(prop view)]
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   139
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   140
! !
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   141
55
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   142
!UIPainterView ignoredMethodsFor:'code manipulation'!
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   143
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   144
changeClass
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   145
    |box classNameHolder superclassNameHolder|
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   146
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   147
    classNameHolder := (className ? 'MyClass') asValue.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   148
    superclassNameHolder := (superclassName ? 'ApplicationModel') asValue.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   149
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   150
    box := DialogBox new.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   151
    box addTextLabel:'class:'.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   152
    box addInputFieldOn:classNameHolder.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   153
    box addTextLabel:'super class:'.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   154
    box addInputFieldOn:superclassNameHolder.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   155
    box addAbortButton; addOkButton.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   156
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   157
    box open.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   158
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   159
    box accepted ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   160
        className := classNameHolder value.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   161
        superclassName := superclassNameHolder value.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   162
    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   163
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   164
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   165
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   166
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   167
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   168
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   169
!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   170
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   171
changeVariables
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   172
    | box names propList p n newName|
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   173
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   174
    names := VariableArray new.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   175
    propList := VariableArray new.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   176
    viewProperties do:[:props |
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   177
        n := props name.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   178
        n notNil ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   179
            names add:n.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   180
            propList add:props
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   181
        ]
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   182
    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   183
    box := BuilderVariablesBox new.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   184
    box list:names.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   185
    box selectAction:[:selection |
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   186
        p := propList at:selection
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   187
    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   188
    box okAction:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   189
        newName := box enterValue.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   190
Transcript showCR:('renamed ' , (p name) , 'to:' , newName).
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   191
        p name:newName
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   192
    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   193
    box showAtPointer
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   194
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   195
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   196
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   197
! !
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   198
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   199
!UIPainterView methodsFor:'creating subviews'!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   200
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   201
addProperties:properties for:aView
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   202
    "set properties to a view and add properties to viewProperties.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   203
     In case that properties are nil properties are created
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   204
    "
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   205
    |name props|
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   206
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   207
    (props := properties) isNil ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   208
        props := self propertiesForNewView:aView.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   209
    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   210
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   211
    viewProperties add:props.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   212
    name := props name.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   213
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   214
    (aView respondsTo:#label:) ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   215
        aView label:name
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   216
    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   217
    aView name:name.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   218
  ^ props
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   219
!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   220
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   221
propertiesForNewView:aView
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   222
    |cls props index|
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   223
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   224
    cls := aView class.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   225
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   226
    props := ViewProperty new.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   227
    props view:aView.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   228
    props elementClass:cls.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   229
    index := self variableIndexForClass:cls.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   230
    props nameIndex:index.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   231
    props name:(self variableNameForClass:cls index:index).
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   232
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   233
"/    props initCode:nil.       --- add user-defined init code later
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   234
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   235
    ^ props
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   236
!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   237
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   238
setupCreatedObject:anObject
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   239
    "set default properties for a created object
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   240
    "
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   241
    |props|
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   242
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   243
    props := self addProperties:nil for:anObject.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   244
53
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   245
    undoHistory transaction:#create text:(props name) do:[
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   246
        self undoCreate:(props identifier).
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   247
    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   248
! !
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   249
55
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   250
!UIPainterView ignoredMethodsFor:'generating output'!
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   251
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   252
generateClassDefinition
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   253
    |defCode|
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   254
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   255
    defCode := superclassName , ' subclass:#' , className , '\'.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   256
    defCode := defCode , '  instanceVariableNames:'''.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   257
    defCode := defCode , self subviewVariableNames , '''\'.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   258
    defCode := defCode , '  classVariableNames:''''\'.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   259
    defCode := defCode , '  poolDictionaries:''''\'.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   260
    defCode := defCode , '  category:''' , categoryName , '''\'.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   261
    defCode := defCode , Character excla asString , '\\'.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   262
55
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   263
    ^ defCode withCRs
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   264
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   265
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   266
55
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   267
! !
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   268
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   269
!UIPainterView methodsFor:'generating output'!
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   270
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   271
generateCode
55
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   272
    "generate code for the windowSpec method"
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   273
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   274
    |code|
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   275
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   276
    code := ''.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   277
55
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   278
"/    (Smalltalk classNamed:className asSymbol) isNil ifTrue:[
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   279
"/        code := code , self generateClassDefinition.
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   280
"/    ].
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   281
"/    code := code , self generateInitMethod.
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   282
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   283
    code := code , self generateWindowSpecMethodSource.
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   284
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   285
"/    code := code , self generateAspectMethods.
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   286
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   287
    ^ code withCRs
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   288
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   289
    "Modified: 5.9.1995 / 20:57:53 / claus"
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   290
! !
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   291
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   292
!UIPainterView ignoredMethodsFor:'generating output'!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   293
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   294
generateInitCodeForGroup:aGroup
55
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   295
    |code c name p objects outlets moreCode sym typ val|
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   296
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   297
    " <name> := <GroupClass> in:<name-of-superview>"
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   298
55
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   299
    code := ''.
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   300
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   301
    p := self propertyOfGroup:aGroup.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   302
    name := p at:#variableName.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   303
    c := '  ' , name , ' := ' , (aGroup class name) , ' new.\'.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   304
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   305
    code := code , c withCRs.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   306
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   307
    " <name> <symbol>:<value>"
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   308
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   309
    objects := p at:#controlledObjects ifAbsent:[nil].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   310
    objects notNil ifTrue:[
55
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   311
        objects do:[:controlledObject |
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   312
            c := c , name , ' add:' , (self variableNameOf:controlledObject) , '.\'
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   313
        ]
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   314
    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   315
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   316
    code := code , c withCRs
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   317
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   318
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   319
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   320
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   321
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   322
!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   323
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   324
generateInitCodeForOtherStuff
55
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   325
    |code g c name p outlets moreCode sym typ val|
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   326
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   327
    code := ''.
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   328
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   329
    "generate code for groups"
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   330
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   331
    viewProperties do:[:props |
55
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   332
        g := props at:#group ifAbsent:[nil].
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   333
        g notNil ifTrue:[
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   334
            code := code , (self generateInitCodeForGroup:g)
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   335
        ]
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   336
    ].
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   337
    ^ code
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   338
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   339
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   340
!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   341
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   342
generateInitCodeForView:aView
55
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   343
    |code c name p outlets moreCode sym typ val|
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   344
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   345
    " <name> := <ViewClass> in:<name-of-superview>"
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   346
55
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   347
    code := ''.
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   348
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   349
    p := self propertyOfView:aView.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   350
    name := p at:#variableName.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   351
    c := '    ' , name , ' := ' ,
55
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   352
         (aView class name) , ' in:' , (self variableNameOf:(aView superView)) , '.\'.
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   353
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   354
    " <name> origin:(...) extent:(...)"
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   355
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   356
    c := c , '    ' , name , ' origin:(', aView origin printString , ')'
55
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   357
                    , ' extent:(', aView extent printString , ').\'.
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   358
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   359
    moreCode := p at:#initCode ifAbsent:nil.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   360
    moreCode notNil ifTrue:[
55
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   361
        c := c , moreCode , '\' withCRs
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   362
    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   363
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   364
    code := code , c withCRs.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   365
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   366
    " <name> <symbol>:<value>"
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   367
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   368
    outlets := p at:#outlets ifAbsent:[nil].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   369
    outlets notNil ifTrue:[
55
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   370
        outlets do:[:selectorOutlet |
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   371
            sym := selectorOutlet at:#selector.
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   372
            typ := selectorOutlet at:#type.
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   373
            val := selectorOutlet at:#value.
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   374
            c :=  '    ' , name , ' ' , sym.
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   375
            (typ == #number) ifTrue:[
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   376
                c := c , val printString
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   377
            ].
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   378
            (typ == #string) ifTrue:[
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   379
                c := c , '''' , val , ''''
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   380
            ].
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   381
            (typ == #text) ifTrue:[
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   382
                c := c , '''' , val asString , ''''
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   383
            ].
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   384
            (typ == #strings) ifTrue:[
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   385
                c := c , '#( '.
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   386
                val asText do:[:aString |
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   387
                    c := c , '''' , aString , ''' '
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   388
                ].
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   389
                c := c , ')'
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   390
            ].
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   391
            (typ == #block) ifTrue:[
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   392
                c := c , val
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   393
            ].
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   394
            (typ == #color) ifTrue:[
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   395
                c := c , '(Color name:''' , val , ''')'
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   396
            ].
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   397
            c := c , '.' , Character cr asString.
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   398
            code := code , c
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   399
        ]
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   400
    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   401
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   402
    self subviewsOf:aView do:[:v |
55
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   403
        code := code , (self generateInitCodeForView:v)
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   404
    ].
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   405
    ^ code.
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   406
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   407
    "Modified: 5.9.1995 / 20:06:07 / claus"
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   408
!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   409
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   410
generateInitMethod
55
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   411
    |defCode code|
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   412
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   413
    defCode := Character excla asString ,
55
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   414
               className , ' methodsFor:''initialization''' ,
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   415
               Character excla asString , '\\'.
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   416
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   417
    defCode := defCode , 'initialize\'.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   418
    defCode := defCode , '    super initialize.\'.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   419
    defCode := defCode , '    self setupSubViews.\'.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   420
    defCode := defCode , '    self setupLocalStuff\'.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   421
    defCode := defCode , Character excla asString , '\\'.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   422
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   423
    defCode := defCode , 'setupSubViews\'.
55
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   424
    code := defCode withCRs.
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   425
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   426
    self subviewsOf:self do:[:v |
55
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   427
        code := code , (self generateInitCodeForView:v)
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   428
    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   429
55
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   430
    code := code , (self generateInitCodeForOtherStuff).
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   431
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   432
    code := code , '    ^ self\' withCRs.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   433
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   434
    defCode := Character excla asString , '\\'.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   435
    defCode := defCode , 'setupLocalStuff\'.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   436
    defCode := defCode , '    ^ self\'.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   437
    defCode := defCode , Character excla asString , ' ' ,
55
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   438
                         Character excla asString , '\\'.
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   439
55
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   440
    code := code , defCode withCRs.
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   441
    ^ code.
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   442
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   443
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   444
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   445
55
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   446
!
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   447
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   448
generateOutlets
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   449
    ^ self
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   450
! !
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   451
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   452
!UIPainterView methodsFor:'generating output'!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   453
53
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   454
generateSpecFor:something
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   455
    "generate a spec for a view or collection of views
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   456
    "
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   457
    |spec views|
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   458
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   459
    something notNil ifTrue:[
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   460
        something isCollection ifTrue:[views := something]
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   461
                              ifFalse:[views := Array with:something].
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   462
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   463
        spec := views collect:[:aView||topSpec|
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   464
            topSpec := aView specClass 
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   465
                            fromView:aView 
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   466
                            callBack:[:spec :aSubView | 
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   467
"/                                aSubView geometryLayout:(aSubView geometryLayout copy)
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   468
                            ].
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   469
            topSpec
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   470
        ]
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   471
    ].
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   472
    ^ spec
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   473
!
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   474
55
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   475
generateWindowSpecMethodSource
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   476
    |spec specArray str code|
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   477
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   478
    subViews remove:inputView.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   479
    [
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   480
        spec := FullSpec fromView:self callBack:[:newSpec :view | self stuffPropertiesFrom:view intoSpec:newSpec].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   481
    ] valueNowOrOnUnwindDo:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   482
        subViews addFirst:inputView.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   483
    ].
55
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   484
    specArray := spec literalArrayEncoding.
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   485
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   486
    str := WriteStream on:String new.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   487
    self prettyPrintSpecArray:specArray on:str indent:5.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   488
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   489
    code := Character excla asString 
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   490
            , className , ' class methodsFor:''interface specs'''
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   491
            , Character excla asString , '\\'
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   492
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   493
            , methodName , '\'
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   494
            , '    "this window spec was automatically generated by the ST/X UIPainter"\\'
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   495
            , '    "do not manually edit this - the painter/builder may not be able to\'
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   496
            , '     handle the specification if its corrupted."\\'
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   497
            , '    "UIPainter new openOnClass:' , className , ' andSelector:#' , methodName , '"\'
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   498
            , '    "' , className , ' new openInterface:#' , methodName , '"\'.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   499
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   500
    methodName = 'windowSpec' ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   501
        code := code , '    "' , className , ' open"\'
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   502
    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   503
    code := code 
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   504
            , '\'
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   505
            , '    <resource: #canvas>\\'
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   506
            , '    ^\' 
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   507
            , '     ', str contents
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   508
            , '\'
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   509
            , Character excla asString
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   510
            , ' '
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   511
            , Character excla asString
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   512
            , '\\'.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   513
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   514
    ^ code withCRs
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   515
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   516
    "Modified: 5.9.1995 / 21:01:35 / claus"
55
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   517
! !
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   518
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   519
!UIPainterView ignoredMethodsFor:'generating output'!
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   520
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   521
nameOfClass
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   522
    ^ 'NewView'
55
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   523
! !
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   524
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   525
!UIPainterView methodsFor:'generating output'!
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   526
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   527
outletValueOf:aSymbol for:aView
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   528
"/    |c name p outlets moreCode sym typ val|
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   529
"/
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   530
"/    p := self propertyOfView:aView.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   531
"/    outlets := p at:#outlets ifAbsent:[^ nil].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   532
"/    outlets notNil ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   533
"/        outlets do:[:selectorOutlet |
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   534
"/            sym := selectorOutlet at:#selector.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   535
"/            (sym == aSymbol) ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   536
"/                typ := selectorOutlet at:#type.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   537
"/                val := selectorOutlet at:#value.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   538
"/                ^ val
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   539
"/            ]
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   540
"/        ]
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   541
"/    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   542
    ^ nil
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   543
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   544
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   545
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   546
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   547
!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   548
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   549
prettyPrintSpecArray:spec on:aStream indent:i
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   550
    "just for your convenience: prettyPrint a specArray to aStream - it looks better that way"
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   551
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   552
    |what oneLine|
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   553
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   554
    spec isArray ifFalse:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   555
        spec isLiteral ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   556
            aStream nextPutAll:spec storeString
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   557
        ] ifFalse:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   558
            self halt.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   559
        ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   560
        ^ self
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   561
    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   562
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   563
    spec isEmpty ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   564
        aStream nextPutAll:'#()'.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   565
        ^ self
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   566
    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   567
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   568
    what := spec at:1.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   569
    what isArray ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   570
        aStream cr; spaces:i+2.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   571
        aStream nextPutAll:'#('.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   572
        "/ a spec-collection
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   573
        spec do:[:element |
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   574
            self prettyPrintSpecArray:element on:aStream indent:i+2.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   575
        ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   576
        aStream cr.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   577
        aStream spaces:i+1.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   578
        aStream nextPutAll:')'.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   579
        ^ self.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   580
    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   581
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   582
    oneLine := false.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   583
    (#(#LayoutFrame #LayoutOrigin #AlignmentOrigin 
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   584
       #Rectangle #Point
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   585
       #Color #ColorValue
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   586
    ) 
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   587
    includesIdentical:what) ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   588
        oneLine := true
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   589
    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   590
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   591
    oneLine ifFalse:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   592
        aStream cr.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   593
        aStream spaces:i+2.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   594
    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   595
    aStream nextPutAll:'#('.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   596
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   597
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   598
    aStream nextPutAll:what storeString.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   599
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   600
    oneLine ifFalse:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   601
        aStream cr.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   602
        aStream spaces:i+4.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   603
    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   604
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   605
    2 to:spec size do:[:index |
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   606
        aStream space.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   607
        self prettyPrintSpecArray:(spec at:index) on:aStream indent:i+4.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   608
        oneLine ifFalse:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   609
            (index odd and:[index ~~ (spec size)]) ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   610
                aStream cr; spaces:i+4.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   611
            ]
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   612
        ]
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   613
    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   614
    oneLine ifFalse:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   615
        aStream cr.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   616
        aStream spaces:i+1.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   617
    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   618
    aStream nextPutAll:')'.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   619
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   620
    "Modified: 5.9.1995 / 17:44:20 / claus"
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   621
!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   622
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   623
storeContentsOn:aStream
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   624
    viewProperties do:[:p| p storeOn:aStream]
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   625
!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   626
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   627
stuffPropertiesFrom:view intoSpec:newSpec
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   628
    "stuff any additional information (held in the properties) into the spec
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   629
     which was just created from view"
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   630
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   631
    |props aspectSelector changeSelector labelSelector name|
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   632
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   633
    props := self propertyOfView:view.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   634
    props isNil ifTrue:[^ self].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   635
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   636
    (aspectSelector := props aspectSelector) notNil ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   637
        newSpec model:aspectSelector
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   638
    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   639
    (changeSelector := props changeSelector) notNil ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   640
        newSpec change:changeSelector
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   641
    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   642
    (labelSelector := props labelSelector) notNil ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   643
        newSpec label:labelSelector
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   644
    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   645
    (name := props name) notNil ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   646
        newSpec name:name
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   647
    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   648
55
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   649
! !
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   650
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   651
!UIPainterView ignoredMethodsFor:'generating output'!
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   652
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   653
subviewVariableNames
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   654
    |names|
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   655
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   656
    names := ''.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   657
    viewProperties do:[:p| names := names , ' ' , (p name)].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   658
  ^ names
55
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   659
! !
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   660
19e021c8f1ef *** empty log message ***
ca
parents: 53
diff changeset
   661
!UIPainterView methodsFor:'generating output'!
48
2fb81a3e0246 *** empty log message ***
ca
parents: 45
diff changeset
   662
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   663
subviewsOf:aView do:aBlock
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   664
    |subs v|
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   665
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   666
    (subs := aView subViews) notNil ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   667
        subs do:[:v|
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   668
            (v ~~ inputView and:[v notNil]) ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   669
                (viewProperties detect:[:p | p view == v] ifNone:nil) notNil ifTrue:[ 
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   670
                    (v superView == aView) ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   671
                        aBlock value:v
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   672
                    ]
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   673
                ]
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   674
            ]
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   675
        ]
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   676
    ]
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   677
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   678
! !
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   679
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   680
!UIPainterView methodsFor:'group manipulations'!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   681
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   682
groupEnterFields
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   683
    |props name index group objects|
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   684
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   685
    selection isNil ifTrue:[^ self].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   686
    self selectionDo:[:aView |
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   687
        (aView isKindOf:EditField) ifFalse:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   688
            self warn:'select EditFields only !!'.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   689
            ^ self
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   690
        ]
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   691
    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   692
    self selectionHiddenDo:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   693
        group := EnterFieldGroup new.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   694
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   695
        props := GroupProperties new.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   696
        props elementClass:EnterFieldGroup.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   697
        props group:group.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   698
        index := self variableIndexForClass:EnterFieldGroup.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   699
        props nameIndex:index.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   700
        name := self variableNameForClass:EnterFieldGroup index:index.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   701
        props name:name.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   702
        objects := OrderedCollection new.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   703
        props controlledObjects:objects.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   704
        viewProperties add:props.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   705
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   706
        self selectionDo:[:aView |
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   707
            objects add:aView.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   708
            group add:aView
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   709
        ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   710
    ]
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   711
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   712
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   713
!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   714
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   715
groupRadioButtons
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   716
    |props name index group objects|
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   717
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   718
    selection isNil ifTrue:[^ self].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   719
    self selectionDo:[:aView |
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   720
        (aView isKindOf:RadioButton) ifFalse:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   721
            self warn:'select RadioButtons only !!'.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   722
            ^ self
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   723
        ]
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   724
    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   725
    self selectionHiddenDo:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   726
        group := RadioButtonGroup new.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   727
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   728
        props := GroupProperties new.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   729
        props elementClass:RadioButtonGroup.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   730
        props group:group.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   731
        index := self variableIndexForClass:RadioButtonGroup.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   732
        props nameIndex:index.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   733
        name := self variableNameForClass:RadioButtonGroup index:index.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   734
        props name:name.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   735
        group groupID:name asSymbol.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   736
        objects := OrderedCollection new.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   737
        props controlledObjects:objects.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   738
        viewProperties add:props.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   739
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   740
        self selectionDo:[:aView |
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   741
            aView turnOff.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   742
            objects add:aView.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   743
            group add:aView
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   744
        ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   745
    ]
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   746
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   747
    "Modified: 5.9.1995 / 16:06:15 / claus"
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   748
! !
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   749
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   750
!UIPainterView methodsFor:'initialization'!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   751
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   752
initialize
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   753
    super initialize.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   754
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   755
    superclassName := 'ApplicationModel'.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   756
    className      := 'NewApplication'.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   757
    methodName     := 'windowSpec'.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   758
    categoryName   := 'Applications'.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   759
    viewProperties := OrderedCollection new.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   760
    HandCursor     := Cursor leftHand.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   761
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   762
    "Modified: 5.9.1995 / 19:58:06 / claus"
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   763
! !
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   764
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   765
!UIPainterView methodsFor:'interface to Builder'!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   766
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   767
addOutletDefinitionFor:outletSymbol type:type value:outletValue for:aView
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   768
    |outletProps selectorProps viewProps|
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   769
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   770
    viewProps := self propertyOfView:aView.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   771
"/    outletProps := viewProps at:#outlets ifAbsent:[nil].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   772
"/    outletProps isNil ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   773
"/        outletProps := Dictionary new.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   774
"/        viewProps at:#outlets put:outletProps
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   775
"/    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   776
"/    selectorProps := outletProps at:outletSymbol ifAbsent:[nil].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   777
"/    selectorProps isNil ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   778
"/        selectorProps := Dictionary new.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   779
"/        outletProps at:outletSymbol put:selectorProps
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   780
"/    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   781
"/
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   782
"/    selectorProps at:#selector put:outletSymbol.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   783
"/    selectorProps at:#type put:type.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   784
"/    selectorProps at:#value put:outletValue
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   785
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   786
!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   787
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   788
addSpec:specOrSpecArray
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   789
    |spec builder|
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   790
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   791
    spec := UISpecification from:specOrSpecArray.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   792
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   793
    builder := UIBuilder new.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   794
    builder componentCreationHook:[:view :spec :aBuilder |
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   795
                self createdComponent:view forSpec:spec
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   796
            ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   797
    builder applicationClass:(Smalltalk classNamed:className).
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   798
    spec setupView:self for:builder.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   799
    self realizeAllSubViews.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   800
    inputView raise.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   801
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   802
"/    viewProperties := OrderedCollection new.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   803
"/    self generatePropertiesFor:(self subViews select:[:v | v ~~ inputView]).
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   804
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   805
    self changed:#tree.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   806
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   807
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   808
    "Modified: 5.9.1995 / 23:36:55 / claus"
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   809
!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   810
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   811
applicationName
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   812
    ^ className
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   813
!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   814
53
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   815
aspectAt:aSymbol
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   816
    self halt.
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   817
    ^ nil
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   818
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   819
    "Modified: 6.9.1995 / 00:45:35 / claus"
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   820
!
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   821
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   822
aspectSelectorForView:aView
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   823
    |props aspect|
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   824
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   825
    props := self propertyOfView:aView.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   826
    props isNil ifTrue:[^ nil].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   827
    ^ props aspectSelector
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   828
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   829
!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   830
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   831
changeSelectorForView:aView
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   832
    |props aspect|
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   833
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   834
    props := self propertyOfView:aView.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   835
    props isNil ifTrue:[^ nil].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   836
"/    ^ props changeSelector
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   837
    ^ nil
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   838
!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   839
53
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   840
createdComponent:newView forSpec:aSpec
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   841
    "callBack from UISpec view building"
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   842
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   843
    |props|
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   844
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   845
    props := self propertiesForNewView:newView.
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   846
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   847
    aSpec name notNil ifTrue:[
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   848
        (self propertyOfName:(aSpec name)) isNil ifTrue:[
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   849
            props name:aSpec name
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   850
        ]
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   851
    ].
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   852
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   853
    props labelSelector:(aSpec labelSelector).
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   854
    props aspectSelector:(aSpec modelSelector).
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   855
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   856
    viewProperties add:props.
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   857
!
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   858
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   859
generatePropertiesFor:aCollectionOfViews
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   860
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   861
    "/ done as two loops, to get bread-first naming
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   862
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   863
    aCollectionOfViews do:[:aView|
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   864
        |props|
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   865
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   866
        props := self propertiesForNewView:aView.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   867
        viewProperties add:props.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   868
        aView name:(props name).
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   869
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   870
        aView geometryLayout isNil ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   871
            aView geometryLayout:(aView bounds asLayout).
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   872
        ]
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   873
    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   874
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   875
    aCollectionOfViews do:[:aView |
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   876
        |subs|
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   877
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   878
        subs := aView subViews.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   879
        subs notNil ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   880
            self generatePropertiesFor:subs
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   881
        ]
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   882
    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   883
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   884
!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   885
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   886
inspectAttributes
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   887
    |p|
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   888
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   889
    self singleSelectionDo:[:aView |
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   890
        p := self propertyOfView:aView.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   891
        p inspect
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   892
    ]
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   893
!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   894
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   895
setAspectSelector:aspectSymbol forView:aView
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   896
    |props|
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   897
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   898
    props := self propertyOfView:aView.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   899
53
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   900
    props notNil ifTrue:[
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   901
        self transaction:#aspect selectionDo:[:aView|
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   902
            |oldAspect|
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   903
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   904
            oldAspect := props aspectSelector.
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   905
53
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   906
            undoHistory addUndoBlock:[
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   907
                props aspectSelector:oldAspect.
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   908
                aView superView sizeChanged:nil
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   909
            ]
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   910
        ].
53
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   911
        props aspectSelector:aspectSymbol
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   912
    ]
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   913
!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   914
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   915
setChangeSelector:changeSymbol forView:aView
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   916
    |props|
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   917
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   918
    props := self propertyOfView:aView.
53
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   919
    props notNil ifTrue:[
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   920
        props changeSelector:changeSymbol
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   921
    ]
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   922
!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   923
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   924
setupFromSpec:specOrSpecArray
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   925
    self removeAll.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   926
    self addSpec:specOrSpecArray
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   927
!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   928
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   929
showFontPanel
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   930
    |action|
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   931
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   932
    fontPanel isNil ifTrue:[
52
40a98a1507b4 *** empty log message ***
ca
parents: 51
diff changeset
   933
	fontPanel := FontPanel new 
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   934
    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   935
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   936
    selection notNil ifTrue:[
52
40a98a1507b4 *** empty log message ***
ca
parents: 51
diff changeset
   937
	action := [:family :face :style :size |
40a98a1507b4 *** empty log message ***
ca
parents: 51
diff changeset
   938
		       self changeFontFamily:family face:face
40a98a1507b4 *** empty log message ***
ca
parents: 51
diff changeset
   939
				       style:style size:size
40a98a1507b4 *** empty log message ***
ca
parents: 51
diff changeset
   940
		  ].
40a98a1507b4 *** empty log message ***
ca
parents: 51
diff changeset
   941
	fontPanel action:action.
40a98a1507b4 *** empty log message ***
ca
parents: 51
diff changeset
   942
	fontPanel showAtPointer
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   943
    ]
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   944
! !
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
   945
53
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   946
!UIPainterView methodsFor:'menu & submenus'!
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   947
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   948
menu
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   949
    testMode ifFalse:[
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   950
        selection notNil ifTrue:[^ self menuSelection ]
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   951
                        ifFalse:[^ self menuPainter   ]
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   952
    ].
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   953
    ^ nil
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   954
!
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   955
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   956
menuPainter
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   957
    "menu in case of non empty selection; for views
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   958
    "
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   959
    |menu gridMenu|
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   960
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   961
    menu := PopUpMenu labels:( 
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   962
                resources array:#(
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   963
                                  'paste' 
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   964
                                  '-' 
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   965
                                  'undo'
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   966
                                  'grid'
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   967
                                 ) 
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   968
                              )
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   969
                   selectors:#( 
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   970
                                #pasteBuffer
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   971
                                nil 
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   972
                                #undo
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   973
                                #grid
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   974
                              )
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   975
                     receiver:self.
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   976
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   977
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   978
    undoHistory isEmpty ifTrue:[
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   979
        menu disable:#undo
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   980
    ] ifFalse:[
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   981
        menu subMenuAt:#undo put:(undoHistory popupMenu)
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   982
    ].
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   983
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   984
    gridMenu := PopUpMenu labels:(
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   985
                            resources array:#(
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   986
                                    '\c show' 
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   987
                                    '\c align'
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   988
                                  )
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   989
                                )
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   990
                      selectors:#(
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   991
                                    #gridShown:
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   992
                                    #gridAlign:
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   993
                                ).
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   994
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   995
    gridMenu checkToggleAt:#gridShown: put:(self gridShown).
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   996
    gridMenu checkToggleAt:#gridAlign: put:aligning.
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   997
    menu subMenuAt:#grid put:gridMenu.
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   998
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
   999
  ^ menu
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1000
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1001
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1002
!
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1003
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1004
menuSelection
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1005
    "menu in case of non empty selection; for views
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1006
    "
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1007
    |menu arrangeMenu subMenuAlign|
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1008
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1009
    menu := PopUpMenu labels:( resources array:#(
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1010
                                  'copy' 
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1011
                                  'cut' 
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1012
                                  'paste' 
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1013
                                  '-' 
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1014
                                  'arrange'
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1015
                                  'dimension'
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1016
                                )
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1017
                              )
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1018
                   selectors:#(   #copySelection
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1019
                                  #deleteSelection
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1020
                                  #pasteBuffer
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1021
                                  nil
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1022
                                  #arrange
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1023
                                  #dimension
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1024
                              )
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1025
                     receiver:self.
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1026
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1027
    (self supportsSubComponents:selection) ifFalse:[
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1028
        menu disable:#pasteBuffer
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1029
    ].
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1030
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1031
    arrangeMenu := PopUpMenu labels:#( 'to front' 'to back' )
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1032
                          selectors:#( #raiseSelection  #lowerSelection )
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1033
                           receiver:self.
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1034
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1035
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1036
    menu subMenuAt:#arrange put:arrangeMenu.
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1037
    menu subMenuAt:#dimension put:(self subMenuDimension).
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1038
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1039
    selection size > 1 ifTrue:[
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1040
        menu addLabels:( resources array:#('align') )
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1041
             selectors:#( align ).
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1042
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1043
        menu subMenuAt:#align put:self subMenuAlign
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1044
    ].
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1045
  ^ menu
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1046
!
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1047
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1048
subMenuAlign
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1049
    "returns submenu alignment
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1050
    "
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1051
    |menu|
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1052
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1053
    menu := PopUpMenu labels:(
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1054
                resources array:#(
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1055
                                    'align left' 
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1056
                                    'align right'
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1057
                                    'align left & right'
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1058
                                    'align top' 
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1059
                                    'align bottom'
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1060
                                    'align centered vertical'
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1061
                                    'align centered horizontal'
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1062
                                    '-'
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1063
                                    'spread horizontal'
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1064
                                    'spread vertical'
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1065
                                    'center horizontal in frame'
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1066
                                    'center vertical in frame'
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1067
                                  )
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1068
                         )
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1069
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1070
              selectors:#(  
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1071
                            alignSelectionLeft
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1072
                            alignSelectionRight
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1073
                            alignSelectionLeftAndRight
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1074
                            alignSelectionTop
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1075
                            alignSelectionBottom
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1076
                            alignSelectionCenterHor
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1077
                            alignSelectionCenterVer
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1078
                            nil
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1079
                            spreadSelectionHor
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1080
                            spreadSelectionVer
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1081
                            centerSelectionHor
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1082
                            centerSelectionVer
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1083
                         )
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1084
               receiver:self.
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1085
    ^ menu    
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1086
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1087
!
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1088
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1089
subMenuDimension
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1090
    "returns submenu dimension
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1091
    "
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1092
    |menu|
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1093
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1094
    menu := PopUpMenu labels:( 
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1095
                resources array:#(
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1096
                                    'default extent' 
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1097
                                    'default width' 
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1098
                                    'default height'
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1099
                                    '-'
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1100
                                    'copy extent'
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1101
                                    '-'
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1102
                                    'paste extent'
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1103
                                    'paste width'
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1104
                                    'paste height'
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1105
                                 )
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1106
                              )
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1107
                   selectors:#(
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1108
                                    setToDefaultExtent
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1109
                                    setToDefaultWidth
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1110
                                    setToDefaultHeight
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1111
                                    nil
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1112
                                    copyExtent
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1113
                                    nil
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1114
                                    pasteExtent
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1115
                                    pasteWidth
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1116
                                    pasteHeight
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1117
                              )
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1118
                     receiver:self.
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1119
  ^ menu
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1120
! !
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1121
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1122
!UIPainterView methodsFor:'menu actions'!
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1123
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1124
copySelection
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1125
    "copy the selection into the cut&paste-buffer
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1126
    "
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1127
    |specs|
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1128
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1129
    specs := self generateSpecFor:selection.
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1130
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1131
    specs notNil ifTrue:[
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1132
        self setSelection:specs
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1133
    ].
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1134
    self unselect.
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1135
!
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1136
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1137
deleteSelection
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1138
    "delete the selection
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1139
    "
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1140
    |specs text|
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1141
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1142
    selection notNil ifTrue:[
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1143
        specs := self generateSpecFor:selection.
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1144
        text := self transactionTextFor:selection.
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1145
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1146
        undoHistory transaction:#cut text:text do:[
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1147
            super deleteSelection
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1148
        ].
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1149
        self setSelection:specs
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1150
    ]
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1151
!
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1152
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1153
gridAlign:aBool
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1154
    aBool ifTrue:[self alignOn]
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1155
         ifFalse:[self alignOff]
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1156
!
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1157
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1158
gridShown:aBool
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1159
    aBool ifTrue:[self showGrid]
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1160
         ifFalse:[self hideGrid]
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1161
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1162
!
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1163
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1164
lowerSelection
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1165
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1166
    self selectionDo:[:aView| aView lower ].
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1167
!
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1168
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1169
pasteBuffer
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1170
    "add the objects in the paste-buffer
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1171
    "
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1172
    |sel firstEntry builder frame|
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1173
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1174
    sel   := self getSelection.
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1175
    frame := self.
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1176
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1177
    selection notNil ifTrue:[
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1178
        (self supportsSubComponents:selection) ifTrue:[
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1179
            frame := selection
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1180
        ].
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1181
        self unselect
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1182
    ].
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1183
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1184
    sel size == 0 ifTrue:[firstEntry := sel]
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1185
                 ifFalse:[firstEntry := sel at:1].
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1186
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1187
    (firstEntry isKindOf:UISpecification) ifFalse:[
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1188
        ^ self
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1189
    ].
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1190
    builder   := UIBuilder new.
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1191
    selection := OrderedCollection new.
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1192
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1193
    sel do:[:aSpec||v|
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1194
        builder componentCreationHook:[:view :spec :aBuilder |
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1195
            self createdComponent:view forSpec:spec
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1196
        ].
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1197
        builder applicationClass:(Smalltalk classNamed:className).
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1198
        v := aSpec buildViewWithLayoutFor:builder in:frame.
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1199
        v realize.
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1200
        selection add:v.
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1201
    ].
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1202
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1203
    self transaction:#paste selectionDo:[:v|
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1204
        self undoCreate:((self propertyOfView:v) identifier)
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1205
    ].
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1206
    selection size == 1 ifTrue:[
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1207
        selection := selection at:1
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1208
    ].
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1209
    self showSelection.
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1210
    self realizeAllSubViews.
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1211
    inputView raise.
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1212
    self changed:#tree
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1213
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1214
!
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1215
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1216
raiseSelection
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1217
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1218
    self selectionDo:[:aView|
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1219
        aView raise.
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1220
        inputView raise.
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1221
    ].
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1222
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1223
! !
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1224
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1225
!UIPainterView methodsFor:'misc'!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1226
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1227
changeFontFamily:family face:face style:style size:size
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1228
    |f|
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1229
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1230
    f := Font family:family
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1231
                face:face
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1232
               style:style
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1233
                size:size.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1234
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1235
    f notNil ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1236
        self selectionHiddenDo:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1237
            self selectionDo:[:aView |
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1238
                aView font:f.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1239
                self elementChanged:aView.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1240
            ]
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1241
        ]
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1242
    ]
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1243
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1244
    "Modified: 5.9.1995 / 12:13:27 / claus"
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1245
!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1246
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1247
changeVariableNameOf:aView to:newName
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1248
    |prop|
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1249
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1250
    prop := self propertyOf:aView.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1251
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1252
    prop isNil ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1253
        ^ self error:'no such view'
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1254
    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1255
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1256
    ((aView respondsTo:#label:) and:[aView label = prop name]) ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1257
        self selectionHiddenDo:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1258
            |layout|
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1259
            layout := aView geometryLayout copy.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1260
            aView label:newName.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1261
            aView geometryLayout:layout.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1262
        ]
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1263
    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1264
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1265
    prop  name:newName.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1266
    aView name:newName.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1267
    self changed:#widgetName
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1268
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1269
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1270
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1271
!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1272
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1273
variableIndexForClass:aClass
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1274
    |max|
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1275
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1276
    max := 0.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1277
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1278
    viewProperties do:[:p|
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1279
        p elementClass == aClass ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1280
            max := max max:(p nameIndex)
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1281
        ]
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1282
    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1283
    ^ max + 1
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1284
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1285
!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1286
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1287
variableNameForClass:aClass index:index
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1288
    |n|
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1289
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1290
    n := (aClass name) , index printString.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1291
    n at:1 put:(n at:1) asLowercase.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1292
  ^ n
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1293
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1294
!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1295
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1296
variableNameOf:aView
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1297
    |prop|
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1298
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1299
    aView notNil ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1300
        prop := self propertyOf:aView
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1301
    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1302
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1303
    prop notNil ifTrue:[^ prop name]
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1304
               ifFalse:[^ 'self']
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1305
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1306
! !
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1307
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1308
!UIPainterView methodsFor:'removing components'!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1309
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1310
remove:something
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1311
    "remove something, anObject or a collection of objects from the contents
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1312
     do redraw"
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1313
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1314
    self forEach:something do:[:anObject |
52
40a98a1507b4 *** empty log message ***
ca
parents: 51
diff changeset
  1315
	self removeObject:anObject
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1316
    ]
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1317
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1318
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1319
!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1320
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1321
removeAll
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1322
    "remove the argument, anObject"
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1323
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1324
    self unselect.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1325
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1326
    subViews notNil ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1327
        subViews copy do:[:sub |
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1328
            sub ~~ inputView ifTrue:[   
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1329
                self removeTreeFrom:sub
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1330
            ]
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1331
        ]
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1332
    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1333
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1334
    viewProperties := OrderedCollection new.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1335
    undoHistory reinitialize.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1336
    self changed:#tree
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1337
!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1338
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1339
removeObject:anObject
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1340
    "remove the argument, anObject"
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1341
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1342
    self removeTreeFrom:anObject.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1343
    self changed:#tree
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1344
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1345
    "Modified: 5.9.1995 / 20:51:28 / claus"
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1346
!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1347
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1348
removeTreeFrom:anObject
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1349
    "remove the argument, anObject and all of its children
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1350
    "
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1351
    |props|
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1352
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1353
    anObject notNil ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1354
        (anObject subViews notNil) ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1355
            anObject subViews copy do:[:sub |
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1356
                self removeTreeFrom:sub
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1357
            ]
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1358
        ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1359
        props := self propertyOf:anObject.
53
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1360
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1361
        props notNil ifTrue:[
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1362
            self undoRemove:props.
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1363
            viewProperties remove:props
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1364
        ].
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1365
        anObject destroy
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1366
    ]
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1367
! !
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1368
53
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1369
!UIPainterView methodsFor:'searching'!
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1370
53
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1371
findObjectAt:aPoint
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1372
    "find the origin/corner of the currentWidget
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1373
    "
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1374
    |view|
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1375
53
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1376
    view := super findObjectAt:aPoint.
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1377
53
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1378
    view notNil ifTrue:[
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1379
        "can be a view within a view not visible
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1380
        "
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1381
        [ (self propertyOfView:view) isNil ] whileTrue:[
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1382
            (view := view superView) == self ifTrue:[^ nil]
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1383
        ]
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1384
    ].
53
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1385
    ^ view
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1386
! !
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1387
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1388
!UIPainterView methodsFor:'seraching property'!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1389
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1390
propertyOf:something
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1391
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1392
    ^ viewProperties detect:[:p| (p view == something or:[p group == something])]
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1393
                     ifNone:nil
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1394
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1395
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1396
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1397
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1398
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1399
!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1400
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1401
propertyOfGroup:aGroup
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1402
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1403
    ^ viewProperties detect:[:p| p group == aGroup] ifNone:nil
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1404
!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1405
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1406
propertyOfIdentifier:anIdentifier
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1407
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1408
    ^ viewProperties detect:[:p| p identifier == anIdentifier] ifNone:nil.
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1409
!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1410
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1411
propertyOfName:aString
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1412
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1413
    aString = 'self' ifFalse:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1414
        ^ viewProperties detect:[:p| p name = aString] ifNone:nil
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1415
    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1416
    ^ nil
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1417
!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1418
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1419
propertyOfView:aView
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1420
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1421
    aView == self ifFalse:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1422
        ^ viewProperties detect:[:p| p view == aView] ifNone:nil
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1423
    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1424
    ^ nil
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1425
! !
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1426
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1427
!UIPainterView methodsFor:'testing'!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1428
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1429
isHorizontalResizable:aComponent
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1430
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1431
    (aComponent isKindOf:ScrollBar) ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1432
        ^ aComponent orientation == #horizontal
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1433
    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1434
    (aComponent isKindOf:Scroller) ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1435
        ^ aComponent orientation == #horizontal
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1436
    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1437
    (aComponent isKindOf:Slider) ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1438
        ^ aComponent orientation == #horizontal
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1439
    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1440
    ^ true
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1441
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1442
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1443
!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1444
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1445
isVerticalResizable:aComponent
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1446
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1447
    (aComponent isKindOf:EditField) ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1448
        ^ false
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1449
    ].
53
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1450
    (aComponent isKindOf:ComboBoxView) ifTrue:[
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1451
        ^ false
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1452
    ].
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1453
    (aComponent isKindOf:CheckBox) ifTrue:[
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1454
        ^ false
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1455
    ].
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1456
    (aComponent isKindOf:ScrollBar) ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1457
        ^ aComponent orientation == #vertical
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1458
    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1459
    (aComponent isKindOf:Scroller) ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1460
        ^ aComponent orientation == #vertical
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1461
    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1462
    (aComponent isKindOf:Slider) ifTrue:[
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1463
        ^ aComponent orientation == #vertical
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1464
    ].
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1465
    ^ true
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1466
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1467
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1468
! !
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
  1469
53
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1470
!UIPainterView methodsFor:'transaction & undo'!
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1471
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1472
transaction:aType objects:something do:aOneArgBlock
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1473
    "opens a transaction and evaluates a block within the transaction; the
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1474
     argument to the block is a view from derived from something
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1475
    "
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1476
    |text|
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1477
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1478
    something notNil ifTrue:[
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1479
        text := self transactionTextFor:something.
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1480
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1481
        undoHistory transaction:aType text:text do:[
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1482
            something isCollection ifTrue:[
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1483
                something do:[:aView| aOneArgBlock value:aView ]
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1484
            ] ifFalse:[
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1485
                aOneArgBlock value:something
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1486
            ]
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1487
        ]
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1488
    ]
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1489
!
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1490
d03569a6ff03 checkin from browser
ca
parents: 52
diff changeset
  1491
transactionTextFor:anElementOrCollection