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