UIPainterView.st
author ca
Fri, 23 May 1997 16:07:52 +0200
changeset 119 39acd704ad51
parent 115 e4200c506aad
child 121 96d6feeeb049
permissions -rw-r--r--
testMode is now a ValueHolder
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
     1
"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
     2
 COPYRIGHT (c) 1995 by Claus Gittinger
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
     3
	      All Rights Reserved
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
     4
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
     5
 This software is furnished under a license and may be used
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
     6
 only in accordance with the terms of that license and with the
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
     8
 be provided or otherwise made available to, or used by, any
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
     9
 other person.  No title to or ownership of the software is
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    10
 hereby transferred.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    11
"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    12
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    13
UIObjectView subclass:#UIPainterView
111
ca
parents: 103
diff changeset
    14
	instanceVariableNames:'listHolder superclassName className methodName categoryName'
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    15
	classVariableNames:'HandCursor'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    16
	poolDictionaries:''
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    17
	category:'Interface-UIPainter'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    18
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    19
119
39acd704ad51 testMode is now a ValueHolder
ca
parents: 115
diff changeset
    20
MultiSelectionInList subclass:#ListHolder
39acd704ad51 testMode is now a ValueHolder
ca
parents: 115
diff changeset
    21
	instanceVariableNames:'painter propertyList masterElement disabledChanged'
39acd704ad51 testMode is now a ValueHolder
ca
parents: 115
diff changeset
    22
	classVariableNames:''
39acd704ad51 testMode is now a ValueHolder
ca
parents: 115
diff changeset
    23
	poolDictionaries:''
39acd704ad51 testMode is now a ValueHolder
ca
parents: 115
diff changeset
    24
	privateIn:UIPainterView
39acd704ad51 testMode is now a ValueHolder
ca
parents: 115
diff changeset
    25
!
39acd704ad51 testMode is now a ValueHolder
ca
parents: 115
diff changeset
    26
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    27
Object subclass:#ViewProperty
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
    28
	instanceVariableNames:'view spec identifier'
52
40a98a1507b4 *** empty log message ***
ca
parents: 51
diff changeset
    29
	classVariableNames:'Identifier'
40a98a1507b4 *** empty log message ***
ca
parents: 51
diff changeset
    30
	poolDictionaries:''
40a98a1507b4 *** empty log message ***
ca
parents: 51
diff changeset
    31
	privateIn:UIPainterView
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    32
!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    33
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    34
UIPainterView::ViewProperty subclass:#GroupProperties
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
    35
	instanceVariableNames:'controlledObjects group name'
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    36
	classVariableNames:''
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    37
	poolDictionaries:''
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    38
	privateIn:UIPainterView
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    39
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    40
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    41
!UIPainterView class methodsFor:'documentation'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    42
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    43
copyright
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    44
"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    45
 COPYRIGHT (c) 1995 by Claus Gittinger
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    46
	      All Rights Reserved
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    47
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    48
 This software is furnished under a license and may be used
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    49
 only in accordance with the terms of that license and with the
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    50
 inclusion of the above copyright notice.   This software may not
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    51
 be provided or otherwise made available to, or used by, any
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    52
 other person.  No title to or ownership of the software is
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    53
 hereby transferred.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    54
"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    55
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    56
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    57
documentation
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    58
"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    59
    not yet finished, not yet published, not yet released.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    60
"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    61
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    62
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    63
!UIPainterView class methodsFor:'defaults'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    64
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    65
defaultMenuMessage   
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    66
    "This message is the default yo be sent to the menuHolder to get a menu
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    67
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    68
    ^ #menu
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    69
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    70
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    71
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    72
111
ca
parents: 103
diff changeset
    73
!UIPainterView class methodsFor:'menu specs'!
ca
parents: 103
diff changeset
    74
ca
parents: 103
diff changeset
    75
menu
ca
parents: 103
diff changeset
    76
ca
parents: 103
diff changeset
    77
  ^ #(#Menu #(
ca
parents: 103
diff changeset
    78
        #(#MenuItem
ca
parents: 103
diff changeset
    79
                #'label:' 'copy'
115
e4200c506aad menu & handling
ca
parents: 111
diff changeset
    80
                #'value:' #copySelection
111
ca
parents: 103
diff changeset
    81
                #'shortcutKeyCharacter:' #Copy
ca
parents: 103
diff changeset
    82
         )
ca
parents: 103
diff changeset
    83
        #(#MenuItem
ca
parents: 103
diff changeset
    84
                #'label:' 'cut'
115
e4200c506aad menu & handling
ca
parents: 111
diff changeset
    85
                #'value:' #deleteSelection
111
ca
parents: 103
diff changeset
    86
                #'shortcutKeyCharacter:' #Cut
ca
parents: 103
diff changeset
    87
         )
ca
parents: 103
diff changeset
    88
        #(#MenuItem
115
e4200c506aad menu & handling
ca
parents: 111
diff changeset
    89
                #'label:'   'paste'
111
ca
parents: 103
diff changeset
    90
                #'nameKey:' #paste
115
e4200c506aad menu & handling
ca
parents: 111
diff changeset
    91
                #'value:'   #paste
111
ca
parents: 103
diff changeset
    92
                #'submenu:'
ca
parents: 103
diff changeset
    93
                        #(#Menu #(
ca
parents: 103
diff changeset
    94
                                #(#MenuItem
ca
parents: 103
diff changeset
    95
                                        #'label:' 'paste'
115
e4200c506aad menu & handling
ca
parents: 111
diff changeset
    96
                                        #'value:' #pasteBuffer
111
ca
parents: 103
diff changeset
    97
                                        #'shortcutKeyCharacter:' #Paste
ca
parents: 103
diff changeset
    98
                                 )
ca
parents: 103
diff changeset
    99
                                #(#MenuItem
ca
parents: 103
diff changeset
   100
                                        #'label:' 'keep layout'
115
e4200c506aad menu & handling
ca
parents: 111
diff changeset
   101
                                        #'value:' #pasteWithLayout
111
ca
parents: 103
diff changeset
   102
                                 )
ca
parents: 103
diff changeset
   103
                                )
ca
parents: 103
diff changeset
   104
                                nil 
ca
parents: 103
diff changeset
   105
                                nil
ca
parents: 103
diff changeset
   106
                         )
ca
parents: 103
diff changeset
   107
          )
ca
parents: 103
diff changeset
   108
         #(#MenuItem
115
e4200c506aad menu & handling
ca
parents: 111
diff changeset
   109
                #'label:'   'undo'
e4200c506aad menu & handling
ca
parents: 111
diff changeset
   110
                #'nameKey:' #undo
e4200c506aad menu & handling
ca
parents: 111
diff changeset
   111
                #'value:'   #undoLast)
111
ca
parents: 103
diff changeset
   112
         #(#MenuItem
ca
parents: 103
diff changeset
   113
                #'label:' 'arrange'
115
e4200c506aad menu & handling
ca
parents: 111
diff changeset
   114
                #'value:' #arrange
111
ca
parents: 103
diff changeset
   115
                #'submenu:'
ca
parents: 103
diff changeset
   116
                        #(#Menu #(
ca
parents: 103
diff changeset
   117
                                #(#MenuItem
ca
parents: 103
diff changeset
   118
                                        #'label:' 'to front'
115
e4200c506aad menu & handling
ca
parents: 111
diff changeset
   119
                                        #'value:' #raiseSelection
111
ca
parents: 103
diff changeset
   120
                                 )
ca
parents: 103
diff changeset
   121
                                #(#MenuItem
ca
parents: 103
diff changeset
   122
                                        #'label:' 'to back'
115
e4200c506aad menu & handling
ca
parents: 111
diff changeset
   123
                                        #'value:' #lowerSelection
111
ca
parents: 103
diff changeset
   124
                                 )
ca
parents: 103
diff changeset
   125
                                )
ca
parents: 103
diff changeset
   126
                                nil
ca
parents: 103
diff changeset
   127
                                nil
ca
parents: 103
diff changeset
   128
                          )
ca
parents: 103
diff changeset
   129
          )
ca
parents: 103
diff changeset
   130
         #(#MenuItem
ca
parents: 103
diff changeset
   131
                #'label:' 'dimension'
115
e4200c506aad menu & handling
ca
parents: 111
diff changeset
   132
                #'value:' #dimension
111
ca
parents: 103
diff changeset
   133
                #'submenu:'
ca
parents: 103
diff changeset
   134
                        #(#Menu #(
ca
parents: 103
diff changeset
   135
                                #(#MenuItem
ca
parents: 103
diff changeset
   136
                                        #'label:' 'default extent'
115
e4200c506aad menu & handling
ca
parents: 111
diff changeset
   137
                                        #'value:' #setToDefaultExtent
111
ca
parents: 103
diff changeset
   138
                                 )
ca
parents: 103
diff changeset
   139
                                #(#MenuItem
ca
parents: 103
diff changeset
   140
                                        #'label:' 'default width'
115
e4200c506aad menu & handling
ca
parents: 111
diff changeset
   141
                                        #'value:' #setToDefaultWidth
111
ca
parents: 103
diff changeset
   142
                                 )
ca
parents: 103
diff changeset
   143
                                #(#MenuItem
ca
parents: 103
diff changeset
   144
                                        #'label:' 'default height'
115
e4200c506aad menu & handling
ca
parents: 111
diff changeset
   145
                                        #'value:' #setToDefaultHeight
111
ca
parents: 103
diff changeset
   146
                                 )
ca
parents: 103
diff changeset
   147
                                #(#MenuItem
ca
parents: 103
diff changeset
   148
                                        #'label:' 'copy extent'
115
e4200c506aad menu & handling
ca
parents: 111
diff changeset
   149
                                        #'value:' #copyExtent
111
ca
parents: 103
diff changeset
   150
                                 )
ca
parents: 103
diff changeset
   151
                                #(#MenuItem
ca
parents: 103
diff changeset
   152
                                        #'label:' 'paste extent'
115
e4200c506aad menu & handling
ca
parents: 111
diff changeset
   153
                                        #'value:' #pasteExtent
111
ca
parents: 103
diff changeset
   154
                                 )
ca
parents: 103
diff changeset
   155
                                #(#MenuItem
ca
parents: 103
diff changeset
   156
                                        #'label:' 'paste width'
115
e4200c506aad menu & handling
ca
parents: 111
diff changeset
   157
                                        #'value:' #pasteWidth
111
ca
parents: 103
diff changeset
   158
                                 )
ca
parents: 103
diff changeset
   159
                                #(#MenuItem
ca
parents: 103
diff changeset
   160
                                        #'label:' 'paste height'
115
e4200c506aad menu & handling
ca
parents: 111
diff changeset
   161
                                        #'value:' #pasteHeight
111
ca
parents: 103
diff changeset
   162
                                 )
ca
parents: 103
diff changeset
   163
                                #(#MenuItem
ca
parents: 103
diff changeset
   164
                                        #'label:' 'copy  layout'
115
e4200c506aad menu & handling
ca
parents: 111
diff changeset
   165
                                        #'value:' #copyLayout
111
ca
parents: 103
diff changeset
   166
                                 )
ca
parents: 103
diff changeset
   167
                                #(#MenuItem
ca
parents: 103
diff changeset
   168
                                        #'label:' 'paste layout'
115
e4200c506aad menu & handling
ca
parents: 111
diff changeset
   169
                                        #'value:' #pasteLayout
111
ca
parents: 103
diff changeset
   170
                                 )
ca
parents: 103
diff changeset
   171
                                )
ca
parents: 103
diff changeset
   172
                                #(3 1 3) 
ca
parents: 103
diff changeset
   173
                                nil
ca
parents: 103
diff changeset
   174
                        )
ca
parents: 103
diff changeset
   175
         )
ca
parents: 103
diff changeset
   176
        #(#MenuItem
ca
parents: 103
diff changeset
   177
                #'label:' 'align'
115
e4200c506aad menu & handling
ca
parents: 111
diff changeset
   178
                #'value:' #align
111
ca
parents: 103
diff changeset
   179
                #'submenu:'
ca
parents: 103
diff changeset
   180
                        #(#Menu #(
ca
parents: 103
diff changeset
   181
                                #(#MenuItem
115
e4200c506aad menu & handling
ca
parents: 111
diff changeset
   182
                                        #'value:' #alignSelectionLeft
119
39acd704ad51 testMode is now a ValueHolder
ca
parents: 115
diff changeset
   183
                                        #'labelImage:' #( ResourceRetriever UIPainter iconAlignL 'align left' )
111
ca
parents: 103
diff changeset
   184
                                 )
ca
parents: 103
diff changeset
   185
                                #(#MenuItem
115
e4200c506aad menu & handling
ca
parents: 111
diff changeset
   186
                                        #'value:' #alignSelectionRight
119
39acd704ad51 testMode is now a ValueHolder
ca
parents: 115
diff changeset
   187
                                        #'labelImage:' #( ResourceRetriever UIPainter iconAlignR 'align right' )
111
ca
parents: 103
diff changeset
   188
                                 )
ca
parents: 103
diff changeset
   189
                                #(#MenuItem
115
e4200c506aad menu & handling
ca
parents: 111
diff changeset
   190
                                        #'value:' #alignSelectionLeftAndRight
119
39acd704ad51 testMode is now a ValueHolder
ca
parents: 115
diff changeset
   191
                                        #'labelImage:' #( ResourceRetriever UIPainter iconAlignLR 'align left & right' )
111
ca
parents: 103
diff changeset
   192
                                 )
ca
parents: 103
diff changeset
   193
                                #(#MenuItem
115
e4200c506aad menu & handling
ca
parents: 111
diff changeset
   194
                                        #'value:' #alignSelectionTop
119
39acd704ad51 testMode is now a ValueHolder
ca
parents: 115
diff changeset
   195
                                        #'labelImage:' #( ResourceRetriever UIPainter iconAlignT 'align top' )
39acd704ad51 testMode is now a ValueHolder
ca
parents: 115
diff changeset
   196
                                 )
39acd704ad51 testMode is now a ValueHolder
ca
parents: 115
diff changeset
   197
                                #(#MenuItem
39acd704ad51 testMode is now a ValueHolder
ca
parents: 115
diff changeset
   198
                                        #'value:' #alignSelectionBottom
39acd704ad51 testMode is now a ValueHolder
ca
parents: 115
diff changeset
   199
                                        #'labelImage:' #( ResourceRetriever UIPainter iconAlignB 'align bottom' )
111
ca
parents: 103
diff changeset
   200
                                 )
ca
parents: 103
diff changeset
   201
                                #(#MenuItem
119
39acd704ad51 testMode is now a ValueHolder
ca
parents: 115
diff changeset
   202
                                        #'value:' #alignSelectionTopAndBottom
39acd704ad51 testMode is now a ValueHolder
ca
parents: 115
diff changeset
   203
                                        #'labelImage:' #( ResourceRetriever UIPainter iconAlignTB 'align top & bottom' )
111
ca
parents: 103
diff changeset
   204
                                 )
ca
parents: 103
diff changeset
   205
                                #(#MenuItem
115
e4200c506aad menu & handling
ca
parents: 111
diff changeset
   206
                                        #'value:' #alignSelectionCenterHor
119
39acd704ad51 testMode is now a ValueHolder
ca
parents: 115
diff changeset
   207
                                        #'labelImage:' #( ResourceRetriever UIPainter iconAlignCenterH 'align centered horizontal' )
111
ca
parents: 103
diff changeset
   208
                                 )
ca
parents: 103
diff changeset
   209
                                #(#MenuItem
115
e4200c506aad menu & handling
ca
parents: 111
diff changeset
   210
                                        #'value:' #alignSelectionCenterVer
119
39acd704ad51 testMode is now a ValueHolder
ca
parents: 115
diff changeset
   211
                                        #'labelImage:' #( ResourceRetriever UIPainter iconAlignCenterV 'align centered vertical' )
111
ca
parents: 103
diff changeset
   212
                                 )
ca
parents: 103
diff changeset
   213
                                #(#MenuItem
ca
parents: 103
diff changeset
   214
                                        #'label:' 'spread horizontal'
115
e4200c506aad menu & handling
ca
parents: 111
diff changeset
   215
                                        #'value:' #spreadSelectionHor
111
ca
parents: 103
diff changeset
   216
                                 )
ca
parents: 103
diff changeset
   217
                                #(#MenuItem
ca
parents: 103
diff changeset
   218
                                        #'label:' 'spread vertical'
115
e4200c506aad menu & handling
ca
parents: 111
diff changeset
   219
                                        #'value:' #spreadSelectionVer
111
ca
parents: 103
diff changeset
   220
                                 )
ca
parents: 103
diff changeset
   221
                                #(#MenuItem
ca
parents: 103
diff changeset
   222
                                        #'label:' 'center horizontal in frame'
115
e4200c506aad menu & handling
ca
parents: 111
diff changeset
   223
                                        #'value:' #centerSelectionHor
111
ca
parents: 103
diff changeset
   224
                                 )
ca
parents: 103
diff changeset
   225
                                #(#MenuItem
ca
parents: 103
diff changeset
   226
                                        #'label:' 'center vertical in frame'
115
e4200c506aad menu & handling
ca
parents: 111
diff changeset
   227
                                        #'value:' #centerSelectionVer
111
ca
parents: 103
diff changeset
   228
                                 )
ca
parents: 103
diff changeset
   229
                                )
119
39acd704ad51 testMode is now a ValueHolder
ca
parents: 115
diff changeset
   230
                               #(8 2)
111
ca
parents: 103
diff changeset
   231
                               nil
ca
parents: 103
diff changeset
   232
                        )
ca
parents: 103
diff changeset
   233
         )
ca
parents: 103
diff changeset
   234
        )
ca
parents: 103
diff changeset
   235
        #(4) 
ca
parents: 103
diff changeset
   236
        nil
ca
parents: 103
diff changeset
   237
    )
ca
parents: 103
diff changeset
   238
! !
ca
parents: 103
diff changeset
   239
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   240
!UIPainterView methodsFor:'accessing'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   241
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   242
application
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   243
    self halt.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   244
    ^ nil
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   245
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   246
    "Modified: 6.9.1995 / 00:46:44 / claus"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   247
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   248
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   249
applicationName
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   250
    ^ self className
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   251
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   252
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   253
applicationName:aName
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   254
    self className:aName
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   255
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   256
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   257
className
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   258
    ^ className
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   259
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   260
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   261
className:aName
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   262
    className := aName
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   263
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   264
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   265
className:aClassName superclassName:aSuperclassName selector:aSelector
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   266
    className      := aClassName.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   267
    superclassName := aSuperclassName.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   268
    methodName     := aSelector.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   269
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   270
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   271
111
ca
parents: 103
diff changeset
   272
listHolder
ca
parents: 103
diff changeset
   273
    ^ listHolder
ca
parents: 103
diff changeset
   274
!
ca
parents: 103
diff changeset
   275
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   276
methodName
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   277
    ^ methodName
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   278
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   279
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   280
methodName:aName
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   281
    methodName := aName
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   282
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   283
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   284
selectNames:aStringOrCollection
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   285
    |prop coll s|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   286
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   287
    (aStringOrCollection isNil or:[aStringOrCollection isEmpty]) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   288
        ^ self unselect
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   289
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   290
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   291
    (s := aStringOrCollection) isString ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   292
        s size == 1 ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   293
            s := s first
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   294
        ] ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   295
            coll := OrderedCollection new.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   296
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   297
            s do:[:aName|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   298
                (prop := self propertyOfName:aName) notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   299
                    coll add:(prop view)
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   300
                ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   301
            ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   302
            coll size == 1 ifTrue:[ ^ self select:(coll at:1) ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   303
            coll size == 0 ifTrue:[ ^ self unselect ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   304
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   305
          ^ self select:coll.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   306
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   307
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   308
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   309
    prop := self propertyOfName:s.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   310
    prop isNil ifTrue:[^ self unselect]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   311
              ifFalse:[^ self select:(prop view)]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   312
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   313
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   314
111
ca
parents: 103
diff changeset
   315
!UIPainterView methodsFor:'change & update'!
ca
parents: 103
diff changeset
   316
ca
parents: 103
diff changeset
   317
changed:aParameter
ca
parents: 103
diff changeset
   318
    aParameter == #layout ifTrue:[
ca
parents: 103
diff changeset
   319
        listHolder removeDependent:self.
ca
parents: 103
diff changeset
   320
        listHolder changed:aParameter.
ca
parents: 103
diff changeset
   321
        listHolder addDependent:self.
ca
parents: 103
diff changeset
   322
    ] ifFalse:[
ca
parents: 103
diff changeset
   323
        super changed:aParameter
ca
parents: 103
diff changeset
   324
    ]
ca
parents: 103
diff changeset
   325
!
ca
parents: 103
diff changeset
   326
ca
parents: 103
diff changeset
   327
selectionChanged
ca
parents: 103
diff changeset
   328
    "selection has changed
ca
parents: 103
diff changeset
   329
    "
ca
parents: 103
diff changeset
   330
    |newSel|
ca
parents: 103
diff changeset
   331
ca
parents: 103
diff changeset
   332
    selection notNil ifTrue:[
ca
parents: 103
diff changeset
   333
        self selectionDo:[:aView||p|
ca
parents: 103
diff changeset
   334
            (p := self propertyOfView:aView) notNil ifTrue:[
ca
parents: 103
diff changeset
   335
                newSel isNil ifTrue:[
ca
parents: 103
diff changeset
   336
                    newSel := OrderedCollection new
ca
parents: 103
diff changeset
   337
                ].
ca
parents: 103
diff changeset
   338
                newSel add:(listHolder indexOfName:(p name))
ca
parents: 103
diff changeset
   339
            ]
ca
parents: 103
diff changeset
   340
        ]
ca
parents: 103
diff changeset
   341
    ].
ca
parents: 103
diff changeset
   342
    listHolder removeDependent:self.
ca
parents: 103
diff changeset
   343
    listHolder selectionIndex:newSel.
ca
parents: 103
diff changeset
   344
    listHolder addDependent:self.
ca
parents: 103
diff changeset
   345
!
ca
parents: 103
diff changeset
   346
ca
parents: 103
diff changeset
   347
update:what with:aParm from:aSender
ca
parents: 103
diff changeset
   348
    |loIdx newSel|
ca
parents: 103
diff changeset
   349
ca
parents: 103
diff changeset
   350
    (what == #selectionIndex and:[aSender == listHolder]) ifFalse:[
ca
parents: 103
diff changeset
   351
        ^ self
ca
parents: 103
diff changeset
   352
    ].
ca
parents: 103
diff changeset
   353
    loIdx := listHolder selectionIndex.
ca
parents: 103
diff changeset
   354
ca
parents: 103
diff changeset
   355
    loIdx size ~~ 0 ifTrue:[
ca
parents: 103
diff changeset
   356
        newSel := loIdx collect:[:i|(listHolder propertyAt:i) view]
ca
parents: 103
diff changeset
   357
    ].
ca
parents: 103
diff changeset
   358
    self withSelectionHiddenDo:[
ca
parents: 103
diff changeset
   359
        selection := newSel
ca
parents: 103
diff changeset
   360
    ].
ca
parents: 103
diff changeset
   361
ca
parents: 103
diff changeset
   362
! !
ca
parents: 103
diff changeset
   363
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   364
!UIPainterView methodsFor:'copy & cut & paste'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   365
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   366
copySelection
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   367
    "copy the selection into the cut&paste-buffer
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   368
    "
71
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   369
    |specs coll|
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   370
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   371
    coll := self minSetOfSuperViews:selection.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   372
71
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   373
    coll notNil ifTrue:[
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   374
        self unselect.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   375
        specs := coll collect:[:aView| self fullSpecFor:aView ].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   376
        self setSelection:specs
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   377
    ].
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   378
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   379
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   380
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   381
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   382
deleteSelection
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   383
    "delete the selection; copy the selection into the cut&paste-buffer
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   384
     and open a transaction
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   385
    "
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   386
    |text specs coll|
71
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   387
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   388
    coll := self minSetOfSuperViews:selection.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   389
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   390
    coll notNil ifTrue:[
111
ca
parents: 103
diff changeset
   391
        listHolder disableNotificationsWhileEvaluating:[
ca
parents: 103
diff changeset
   392
            self unselect.
ca
parents: 103
diff changeset
   393
            specs := coll collect:[:aView| self fullSpecFor:aView ].
ca
parents: 103
diff changeset
   394
            text  := self transactionTextFor:coll.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   395
111
ca
parents: 103
diff changeset
   396
            undoHistory transaction:#cut text:text do:[
ca
parents: 103
diff changeset
   397
                coll reverseDo:[:o||p|
ca
parents: 103
diff changeset
   398
                    (p := self propertyOfView:o) notNil ifTrue:[
ca
parents: 103
diff changeset
   399
                        self undoRemove:(p identifier)
ca
parents: 103
diff changeset
   400
                    ].
ca
parents: 103
diff changeset
   401
                    self remove:o
ca
parents: 103
diff changeset
   402
                ]
ca
parents: 103
diff changeset
   403
            ].
ca
parents: 103
diff changeset
   404
            self setSelection:specs.
ca
parents: 103
diff changeset
   405
        ]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   406
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   407
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   408
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   409
pasteBuffer
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   410
    "add the objects in the paste-buffer to the object view
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   411
    "
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   412
    self pasteSpecifications:(self getSelection) keepLayout:false
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   413
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   414
!
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   415
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   416
pasteSpecifications:aSpecificationOrList keepLayout:keepLayout
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   417
    "add the specs to the object view
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   418
    "
111
ca
parents: 103
diff changeset
   419
    |paste frame pasteOrigin pasteOffset builder newSel|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   420
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   421
    (self canPaste:aSpecificationOrList) ifFalse:[
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   422
        ^ self
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   423
    ].
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   424
    aSpecificationOrList isCollection ifTrue:[
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   425
        paste := aSpecificationOrList
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   426
    ] ifFalse:[
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   427
        paste := Array with:aSpecificationOrList
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   428
    ].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   429
    frame := self singleSelection.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   430
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   431
    (self canPasteInto:frame) ifFalse:[
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   432
        frame := self
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   433
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   434
    self unselect.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   435
111
ca
parents: 103
diff changeset
   436
    newSel  := OrderedCollection new.
ca
parents: 103
diff changeset
   437
    builder := UIBuilder new.
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   438
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   439
    keepLayout ifFalse:[
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   440
        pasteOffset := 0@0.
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   441
        pasteOrigin := self sensor mousePoint.
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   442
        pasteOrigin := device translatePoint:pasteOrigin from:device rootView id to:frame id.
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   443
    ].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   444
111
ca
parents: 103
diff changeset
   445
    listHolder disableNotificationsWhileEvaluating:[
ca
parents: 103
diff changeset
   446
        paste do:[:aSpec|
ca
parents: 103
diff changeset
   447
            |view|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   448
111
ca
parents: 103
diff changeset
   449
            view := self addSpec:aSpec builder:builder in:frame.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   450
111
ca
parents: 103
diff changeset
   451
            keepLayout ifFalse:[
ca
parents: 103
diff changeset
   452
                (frame bounds containsPoint:pasteOrigin) ifFalse:[
ca
parents: 103
diff changeset
   453
                    self moveObject:view to:pasteOffset.
ca
parents: 103
diff changeset
   454
                ] ifTrue:[
ca
parents: 103
diff changeset
   455
                    self moveObject:view to:pasteOrigin + pasteOffset.
ca
parents: 103
diff changeset
   456
                ].
ca
parents: 103
diff changeset
   457
                pasteOffset := pasteOffset + 4
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   458
            ].
111
ca
parents: 103
diff changeset
   459
            view realize.
ca
parents: 103
diff changeset
   460
            newSel add:view.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   461
        ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   462
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   463
111
ca
parents: 103
diff changeset
   464
    self transaction:#paste objects:newSel do:[:v|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   465
        self undoCreate:((self propertyOfView:v) identifier)
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   466
    ].
111
ca
parents: 103
diff changeset
   467
    newSel size == 1 ifTrue:[
ca
parents: 103
diff changeset
   468
        newSel := newSel at:1
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   469
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   470
    self realizeAllSubViews.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   471
    inputView raise.
111
ca
parents: 103
diff changeset
   472
    self select:newSel.
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   473
    self elementChangedSize:frame.
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   474
!
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   475
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   476
pasteWithLayout
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   477
    "add the objects in the paste-buffer to the object view; don't change the
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   478
     layout
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   479
    "
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   480
    self pasteSpecifications:(self getSelection) keepLayout:true
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   481
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   482
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   483
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   484
!UIPainterView methodsFor:'drag & drop'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   485
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   486
canDrop:anObjectOrCollection
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   487
    |spec|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   488
119
39acd704ad51 testMode is now a ValueHolder
ca
parents: 115
diff changeset
   489
    self enabled ifTrue:[
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   490
        anObjectOrCollection size == 1 ifTrue:[
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   491
            spec := (anObjectOrCollection at:1) theObject.
96
73725336b4fe dont paste into scrollable selectionInListViews ...
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   492
            ^ (spec isKindOf:UISpecification)
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   493
        ]
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   494
    ].
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   495
    ^ false
96
73725336b4fe dont paste into scrollable selectionInListViews ...
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   496
73725336b4fe dont paste into scrollable selectionInListViews ...
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   497
    "Modified: 8.4.1997 / 01:01:50 / cg"
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   498
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   499
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   500
drop:anObjectOrCollection at:aPoint
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   501
    |spec|
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   502
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   503
    spec := (anObjectOrCollection at:1) theObject.
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   504
    self pasteSpecifications:spec keepLayout:false.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   505
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   506
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   507
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   508
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   509
!UIPainterView methodsFor:'generating output'!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   510
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   511
generateActionMethodFor:aspect spec:protoSpec inClass:targetClass
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   512
    ^ ('!!' , targetClass name , ' methodsFor:''actions''!!\\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   513
      aspect , '\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   514
      '    "automatically generated by UIPainter ..."\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   515
      '\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   516
      '    "action to be added ..."\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   517
      '    Transcript showCR:''action for ' , aspect , ' ...''.\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   518
      '!! !!\\') withCRs
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   519
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   520
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   521
generateAspectMethodFor:aspect spec:protoSpec inClass:targetClass
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   522
    ^ ('!!' , targetClass name , ' methodsFor:''aspects''!!\\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   523
      aspect , '\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   524
      '    "automatically generated by UIPainter ..."\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   525
      '\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   526
      '    |holder|\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   527
      '\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   528
      '    (holder := builder bindingAt:#' , aspect , ') isNil ifTrue:[\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   529
      '        builder aspectAt:#' , aspect , ' put:(holder := ' , ' ValueHolder new' , ').\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   530
      '    ].\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   531
      '    ^ holder\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   532
      '!! !!\\') withCRs
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   533
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   534
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   535
generateAspectMethods
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   536
    |cls code|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   537
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   538
    code := ''.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   539
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   540
    className isNil ifTrue:[
69
e533f77871dd generateAspectMethods: code2
ca
parents: 62
diff changeset
   541
        self warn:'set the class first'.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   542
        ^ code
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   543
    ].
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   544
    cls := Smalltalk classNamed:className.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   545
111
ca
parents: 103
diff changeset
   546
    listHolder propertiesDo:[:aProp |
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   547
        |modelSelector menuSelector protoSpec thisCode|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   548
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   549
        (modelSelector := aProp model) notNil ifTrue:[
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   550
            (cls implements:modelSelector asSymbol) ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   551
                protoSpec := aProp view specClass basicNew.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   552
                "/ kludge ..
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   553
                (protoSpec isMemberOf:ActionButtonSpec) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   554
                    thisCode := (self generateActionMethodFor:modelSelector spec:protoSpec inClass:cls).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   555
                ] ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   556
                    thisCode := (self generateAspectMethodFor:modelSelector spec:protoSpec inClass:cls).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   557
                ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   558
                code := code , thisCode
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   559
            ].
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   560
        ].
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   561
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   562
        (menuSelector := aProp menu) notNil ifTrue:[
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   563
            (cls implements:menuSelector asSymbol) ifFalse:[
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   564
                protoSpec := aProp view specClass basicNew.
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   565
                "/ kludge ..
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   566
                thisCode := (self generateAspectMethodFor:menuSelector spec:protoSpec inClass:cls).
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   567
                code := code , thisCode
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   568
            ]
111
ca
parents: 103
diff changeset
   569
        ].
ca
parents: 103
diff changeset
   570
ca
parents: 103
diff changeset
   571
        aProp spec aspectSelectors do:[:aSel|
ca
parents: 103
diff changeset
   572
            (cls implements:aSel asSymbol) ifFalse:[
ca
parents: 103
diff changeset
   573
                protoSpec := aProp view specClass basicNew.
ca
parents: 103
diff changeset
   574
                "/ kludge ..
ca
parents: 103
diff changeset
   575
                thisCode := (self generateAspectMethodFor:aSel spec:protoSpec inClass:cls).
ca
parents: 103
diff changeset
   576
                code := code , thisCode
ca
parents: 103
diff changeset
   577
            ]
ca
parents: 103
diff changeset
   578
        ].
ca
parents: 103
diff changeset
   579
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   580
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   581
    ^ code
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   582
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   583
!
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   584
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   585
generateClassDefinition
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   586
    |defCode|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   587
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   588
    defCode := superclassName , ' subclass:#' , className , '\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   589
    defCode := defCode , '  instanceVariableNames:'''.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   590
    defCode := defCode , self subviewVariableNames , '''\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   591
    defCode := defCode , '  classVariableNames:''''\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   592
    defCode := defCode , '  poolDictionaries:''''\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   593
    defCode := defCode , '  category:''' , categoryName , '''\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   594
    defCode := defCode , Character excla asString , '\\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   595
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   596
    ^ defCode withCRs
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   597
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   598
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   599
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   600
!
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   601
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   602
generateCode
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   603
    "generate code for the windowSpec method"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   604
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   605
    |code|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   606
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   607
    code := ''.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   608
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   609
"/    (Smalltalk classNamed:className asSymbol) isNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   610
"/        code := code , self generateClassDefinition.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   611
"/    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   612
"/    code := code , self generateInitMethod.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   613
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   614
    code := code , self generateWindowSpecMethodSource.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   615
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   616
"/    code := code , self generateAspectMethods.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   617
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   618
    ^ code withCRs
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   619
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   620
    "Modified: 5.9.1995 / 20:57:53 / claus"
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   621
!
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   622
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   623
generateInitCodeForGroup:aGroup
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   624
    |code c name p objects outlets moreCode sym typ val|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   625
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   626
    " <name> := <GroupClass> in:<name-of-superview>"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   627
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   628
    code := ''.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   629
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   630
    p := self propertyOfGroup:aGroup.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   631
    name := p at:#variableName.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   632
    c := '  ' , name , ' := ' , (aGroup class name) , ' new.\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   633
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   634
    code := code , c withCRs.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   635
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   636
    " <name> <symbol>:<value>"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   637
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   638
    objects := p at:#controlledObjects ifAbsent:[nil].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   639
    objects notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   640
        objects do:[:controlledObject |
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   641
            c := c , name , ' add:' , (self uniqueNameOf:controlledObject) , '.\'
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   642
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   643
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   644
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   645
    code := code , c withCRs
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   646
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   647
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   648
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   649
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   650
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   651
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   652
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   653
generateInitCodeForOtherStuff
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   654
    |code g c name p outlets moreCode sym typ val|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   655
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   656
    code := ''.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   657
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   658
    "generate code for groups"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   659
111
ca
parents: 103
diff changeset
   660
    listHolder propertiesDo:[:props|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   661
        g := props at:#group ifAbsent:[nil].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   662
        g notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   663
            code := code , (self generateInitCodeForGroup:g)
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   664
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   665
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   666
    ^ code
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   667
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   668
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   669
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   670
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   671
generateInitCodeForView:aView
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   672
    |code c name p outlets moreCode sym typ val|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   673
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   674
    " <name> := <ViewClass> in:<name-of-superview>"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   675
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   676
    code := ''.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   677
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   678
    p := self propertyOfView:aView.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   679
    name := p at:#variableName.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   680
    c := '    ' , name , ' := ' ,
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   681
         (aView class name) , ' in:' , (self uniqueNameOf:(aView superView)) , '.\'.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   682
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   683
    " <name> origin:(...) extent:(...)"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   684
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   685
    c := c , '    ' , name , ' origin:(', aView origin printString , ')'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   686
                    , ' extent:(', aView extent printString , ').\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   687
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   688
    moreCode := p at:#initCode ifAbsent:nil.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   689
    moreCode notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   690
        c := c , moreCode , '\' withCRs
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   691
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   692
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   693
    code := code , c withCRs.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   694
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   695
    " <name> <symbol>:<value>"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   696
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   697
    outlets := p at:#outlets ifAbsent:[nil].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   698
    outlets notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   699
        outlets do:[:selectorOutlet |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   700
            sym := selectorOutlet at:#selector.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   701
            typ := selectorOutlet at:#type.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   702
            val := selectorOutlet at:#value.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   703
            c :=  '    ' , name , ' ' , sym.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   704
            (typ == #number) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   705
                c := c , val printString
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   706
            ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   707
            (typ == #string) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   708
                c := c , '''' , val , ''''
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   709
            ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   710
            (typ == #text) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   711
                c := c , '''' , val asString , ''''
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   712
            ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   713
            (typ == #strings) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   714
                c := c , '#( '.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   715
                val asText do:[:aString |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   716
                    c := c , '''' , aString , ''' '
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   717
                ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   718
                c := c , ')'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   719
            ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   720
            (typ == #block) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   721
                c := c , val
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   722
            ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   723
            (typ == #color) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   724
                c := c , '(Color name:''' , val , ''')'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   725
            ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   726
            c := c , '.' , Character cr asString.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   727
            code := code , c
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   728
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   729
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   730
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   731
    self subviewsOf:aView do:[:v |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   732
        code := code , (self generateInitCodeForView:v)
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   733
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   734
    ^ code.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   735
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   736
    "Modified: 5.9.1995 / 20:06:07 / claus"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   737
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   738
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   739
generateInitMethod
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   740
    |defCode code|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   741
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   742
    defCode := Character excla asString ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   743
               className , ' methodsFor:''initialization''' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   744
               Character excla asString , '\\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   745
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   746
    defCode := defCode , 'initialize\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   747
    defCode := defCode , '    super initialize.\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   748
    defCode := defCode , '    self setupSubViews.\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   749
    defCode := defCode , '    self setupLocalStuff\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   750
    defCode := defCode , Character excla asString , '\\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   751
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   752
    defCode := defCode , 'setupSubViews\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   753
    code := defCode withCRs.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   754
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   755
    self subviewsOf:self do:[:v |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   756
        code := code , (self generateInitCodeForView:v)
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   757
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   758
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   759
    code := code , (self generateInitCodeForOtherStuff).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   760
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   761
    code := code , '    ^ self\' withCRs.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   762
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   763
    defCode := Character excla asString , '\\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   764
    defCode := defCode , 'setupLocalStuff\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   765
    defCode := defCode , '    ^ self\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   766
    defCode := defCode , Character excla asString , ' ' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   767
                         Character excla asString , '\\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   768
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   769
    code := code , defCode withCRs.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   770
    ^ code.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   771
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   772
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   773
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   774
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   775
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   776
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   777
generateOutlets
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   778
    ^ self
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   779
!
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   780
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   781
generateWindowSpecMethodSource
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   782
    |t s spec specArray str code|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   783
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   784
    specArray := OrderedCollection new.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   785
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   786
    self subViews do:[:aView|
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   787
        aView ~~ inputView ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   788
            specArray add:(self fullSpecFor:aView)
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   789
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   790
    ].
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   791
    spec := FullSpec new.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   792
    spec fromBuilder:self components:(SpecCollection new collection:specArray).
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   793
    specArray := spec literalArrayEncoding.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   794
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   795
    str := WriteStream on:String new.
86
06bdbae8bd8e prettyPrintSpecArray:on:indent: to UISpecification class
ca
parents: 82
diff changeset
   796
    UISpecification prettyPrintSpecArray:specArray on:str indent:5.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   797
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   798
    code := Character excla asString 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   799
            , className , ' class methodsFor:''interface specs'''
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   800
            , Character excla asString , '\\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   801
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   802
            , methodName , '\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   803
            , '    "this window spec was automatically generated by the ST/X UIPainter"\\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   804
            , '    "do not manually edit this - the painter/builder may not be able to\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   805
            , '     handle the specification if its corrupted."\\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   806
            , '    "\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   807
            , '     UIPainter new openOnClass:' , className , ' andSelector:#' , methodName , '\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   808
            , '     ' , className , ' new openInterface:#' , methodName , '\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   809
            , '    "\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   810
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   811
    methodName = 'windowSpec' ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   812
        code := code , '    "' , className , ' open"\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   813
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   814
    code := code 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   815
            , '\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   816
            , '    <resource: #canvas>\\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   817
            , '    ^\' 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   818
            , '     ', str contents
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   819
            , '\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   820
            , Character excla asString
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   821
            , ' '
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   822
            , Character excla asString
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   823
            , '\\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   824
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   825
    ^ code withCRs
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   826
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   827
    "Modified: 5.9.1995 / 21:01:35 / claus"
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   828
!
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   829
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   830
nameOfClass
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   831
    ^ 'NewView'
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   832
!
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   833
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   834
outletValueOf:aSymbol for:aView
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   835
"/    |c name p outlets moreCode sym typ val|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   836
"/
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   837
"/    p := self propertyOfView:aView.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   838
"/    outlets := p at:#outlets ifAbsent:[^ nil].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   839
"/    outlets notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   840
"/        outlets do:[:selectorOutlet |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   841
"/            sym := selectorOutlet at:#selector.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   842
"/            (sym == aSymbol) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   843
"/                typ := selectorOutlet at:#type.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   844
"/                val := selectorOutlet at:#value.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   845
"/                ^ val
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   846
"/            ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   847
"/        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   848
"/    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   849
    ^ nil
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   850
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   851
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   852
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   853
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   854
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   855
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   856
storeContentsOn:aStream
111
ca
parents: 103
diff changeset
   857
    listHolder propertiesDo:[:p| p storeOn:aStream]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   858
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   859
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   860
subviewsOf:aView do:aBlock
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   861
    |subs v|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   862
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   863
    (subs := aView subViews) notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   864
        subs do:[:v|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   865
            (v ~~ inputView and:[v notNil]) ifTrue:[
111
ca
parents: 103
diff changeset
   866
                (listHolder detectProperty:[:p|p view == v]) notNil ifTrue:[ 
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   867
                    (v superView == aView) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   868
                        aBlock value:v
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   869
                    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   870
                ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   871
            ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   872
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   873
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   874
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   875
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   876
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   877
!UIPainterView methodsFor:'group manipulations'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   878
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   879
groupEnterFields
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   880
    |props group objects|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   881
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   882
    selection isNil ifTrue:[^ self].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   883
    self selectionDo:[:aView |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   884
        (aView isKindOf:EditField) ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   885
            self warn:'select EditFields only !!'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   886
            ^ self
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   887
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   888
    ].
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   889
    self withSelectionHiddenDo:[
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   890
        group := EnterFieldGroup new.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   891
        props := GroupProperties new.
111
ca
parents: 103
diff changeset
   892
        name  := self uniqueNameFor:(EnterFieldGroup className).
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   893
        props group:group.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   894
        props name:name.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   895
        group groupID:name asSymbol.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   896
        objects := OrderedCollection new.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   897
        props controlledObjects:objects.
111
ca
parents: 103
diff changeset
   898
        listHolder add:props.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   899
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   900
        self selectionDo:[:aView |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   901
            objects add:aView.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   902
            group add:aView
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   903
        ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   904
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   905
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   906
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   907
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   908
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   909
groupRadioButtons
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   910
    |props name group objects|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   911
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   912
    selection isNil ifTrue:[^ self].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   913
    self selectionDo:[:aView |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   914
        (aView isKindOf:RadioButton) ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   915
            self warn:'select RadioButtons only !!'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   916
            ^ self
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   917
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   918
    ].
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   919
    self withSelectionHiddenDo:[
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   920
        group := RadioButtonGroup new.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   921
        props := GroupProperties new.
111
ca
parents: 103
diff changeset
   922
        name  := self uniqueNameFor:(RadioButtonGroup className).
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   923
        props group:group.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   924
        props name:name.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   925
        group groupID:name asSymbol.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   926
        objects := OrderedCollection new.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   927
        props controlledObjects:objects.
111
ca
parents: 103
diff changeset
   928
        listHolder add:props.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   929
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   930
        self selectionDo:[:aView |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   931
            aView turnOff.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   932
            objects add:aView.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   933
            group add:aView
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   934
        ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   935
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   936
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   937
    "Modified: 5.9.1995 / 16:06:15 / claus"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   938
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   939
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   940
!UIPainterView methodsFor:'initialization'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   941
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   942
initialize
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   943
    "setup attributes
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   944
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   945
    super initialize.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   946
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   947
    superclassName := 'ApplicationModel'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   948
    className      := 'NewApplication'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   949
    methodName     := 'windowSpec'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   950
    categoryName   := 'Applications'.
111
ca
parents: 103
diff changeset
   951
    listHolder     := ListHolder for:self.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   952
    HandCursor     := Cursor leftHand.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   953
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   954
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   955
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   956
initializeCreatedObject:anObject
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   957
    "set default properties for a created object
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   958
    "
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   959
    |props spec cls|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   960
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   961
    cls   := anObject class.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   962
    spec  := anObject specClass fromView:anObject.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   963
    props := ViewProperty new.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   964
    props view:anObject.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   965
    props spec:spec.
111
ca
parents: 103
diff changeset
   966
    props name:(self uniqueNameFor:spec).
ca
parents: 103
diff changeset
   967
    listHolder add:props.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   968
82
99dc76d66eab checkin from browser
ca
parents: 80
diff changeset
   969
    ((spec respondsTo:#label:) and:[self supportsLabel:anObject]) ifTrue:[
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   970
        anObject label:(props name).
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   971
        spec label:(props name)
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   972
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   973
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   974
    undoHistory transaction:#create text:(props name) do:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   975
        self undoCreate:(props identifier).
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   976
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   977
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   978
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   979
setupFromSpec:specOrSpecArray
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   980
    |spec builder|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   981
111
ca
parents: 103
diff changeset
   982
    listHolder disableNotificationsWhileEvaluating:[
ca
parents: 103
diff changeset
   983
        self removeAll.
ca
parents: 103
diff changeset
   984
        spec    := UISpecification from:specOrSpecArray.
ca
parents: 103
diff changeset
   985
        builder := UIBuilder new.
ca
parents: 103
diff changeset
   986
        spec window setupView:self topView for:builder.
ca
parents: 103
diff changeset
   987
        self addSpec:(spec component) builder:builder in:self.
ca
parents: 103
diff changeset
   988
        self realizeAllSubViews.
ca
parents: 103
diff changeset
   989
        inputView raise.
ca
parents: 103
diff changeset
   990
    ]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   991
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   992
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   993
!UIPainterView methodsFor:'menus'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   994
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   995
menu
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   996
    "returns middle-button menu dependent on the selection
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   997
    "
111
ca
parents: 103
diff changeset
   998
    |menu canPaste|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   999
119
39acd704ad51 testMode is now a ValueHolder
ca
parents: 115
diff changeset
  1000
    self enabled ifFalse:[^ nil ].
111
ca
parents: 103
diff changeset
  1001
    menu := MenuPanel fromSpec:(self class menu) receiver:self.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1002
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1003
    canPaste := self canPaste:(self getSelection).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1004
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1005
    selection isNil ifTrue:[
111
ca
parents: 103
diff changeset
  1006
        menu disableAll
ca
parents: 103
diff changeset
  1007
    ] ifFalse:[
ca
parents: 103
diff changeset
  1008
        canPaste := (canPaste and:[self canPasteInto:selection])
ca
parents: 103
diff changeset
  1009
    ].
ca
parents: 103
diff changeset
  1010
    menu enabledAt:#paste put:[|can|
ca
parents: 103
diff changeset
  1011
        can := self canPaste:(self getSelection).
ca
parents: 103
diff changeset
  1012
        selection isNil ifTrue:[can]
ca
parents: 103
diff changeset
  1013
                       ifFalse:[(can and:[self canPasteInto:selection])]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1014
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1015
115
e4200c506aad menu & handling
ca
parents: 111
diff changeset
  1016
    menu enabledAt:#undo put:(undoHistory notEmpty).
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1017
  ^ menu
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1018
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
  1019
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
  1020
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1021
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1022
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1023
showFontPanel
103
139c7537c6b6 dont keep fontPanel.
Claus Gittinger <cg@exept.de>
parents: 102
diff changeset
  1024
    |action theFont fontPanel|
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1025
103
139c7537c6b6 dont keep fontPanel.
Claus Gittinger <cg@exept.de>
parents: 102
diff changeset
  1026
    fontPanel := FontPanel new. 
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1027
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1028
    selection notNil ifTrue:[
102
6fa9c1f05564 fontPanels actionblock passes a fontDescription
Claus Gittinger <cg@exept.de>
parents: 96
diff changeset
  1029
        action := [:aFontDescription | theFont := aFontDescription].
6fa9c1f05564 fontPanels actionblock passes a fontDescription
Claus Gittinger <cg@exept.de>
parents: 96
diff changeset
  1030
        fontPanel action:action.
6fa9c1f05564 fontPanels actionblock passes a fontDescription
Claus Gittinger <cg@exept.de>
parents: 96
diff changeset
  1031
        fontPanel showAtPointer.
6fa9c1f05564 fontPanels actionblock passes a fontDescription
Claus Gittinger <cg@exept.de>
parents: 96
diff changeset
  1032
        fontPanel destroy.
6fa9c1f05564 fontPanels actionblock passes a fontDescription
Claus Gittinger <cg@exept.de>
parents: 96
diff changeset
  1033
        theFont notNil ifTrue:[
6fa9c1f05564 fontPanels actionblock passes a fontDescription
Claus Gittinger <cg@exept.de>
parents: 96
diff changeset
  1034
            self changeFont:theFont
6fa9c1f05564 fontPanels actionblock passes a fontDescription
Claus Gittinger <cg@exept.de>
parents: 96
diff changeset
  1035
        ]
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1036
    ]
102
6fa9c1f05564 fontPanels actionblock passes a fontDescription
Claus Gittinger <cg@exept.de>
parents: 96
diff changeset
  1037
103
139c7537c6b6 dont keep fontPanel.
Claus Gittinger <cg@exept.de>
parents: 102
diff changeset
  1038
    "Modified: 10.4.1997 / 10:06:15 / cg"
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1039
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1040
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1041
!UIPainterView methodsFor:'misc'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1042
102
6fa9c1f05564 fontPanels actionblock passes a fontDescription
Claus Gittinger <cg@exept.de>
parents: 96
diff changeset
  1043
changeFont:aFontDescription
6fa9c1f05564 fontPanels actionblock passes a fontDescription
Claus Gittinger <cg@exept.de>
parents: 96
diff changeset
  1044
    |f|
6fa9c1f05564 fontPanels actionblock passes a fontDescription
Claus Gittinger <cg@exept.de>
parents: 96
diff changeset
  1045
6fa9c1f05564 fontPanels actionblock passes a fontDescription
Claus Gittinger <cg@exept.de>
parents: 96
diff changeset
  1046
    f := aFontDescription onDevice:device.
6fa9c1f05564 fontPanels actionblock passes a fontDescription
Claus Gittinger <cg@exept.de>
parents: 96
diff changeset
  1047
"/    f := Font family:family
6fa9c1f05564 fontPanels actionblock passes a fontDescription
Claus Gittinger <cg@exept.de>
parents: 96
diff changeset
  1048
"/                face:face
6fa9c1f05564 fontPanels actionblock passes a fontDescription
Claus Gittinger <cg@exept.de>
parents: 96
diff changeset
  1049
"/               style:style
6fa9c1f05564 fontPanels actionblock passes a fontDescription
Claus Gittinger <cg@exept.de>
parents: 96
diff changeset
  1050
"/                size:size.
6fa9c1f05564 fontPanels actionblock passes a fontDescription
Claus Gittinger <cg@exept.de>
parents: 96
diff changeset
  1051
6fa9c1f05564 fontPanels actionblock passes a fontDescription
Claus Gittinger <cg@exept.de>
parents: 96
diff changeset
  1052
    f notNil ifTrue:[
6fa9c1f05564 fontPanels actionblock passes a fontDescription
Claus Gittinger <cg@exept.de>
parents: 96
diff changeset
  1053
        self withSelectionHiddenDo:[
6fa9c1f05564 fontPanels actionblock passes a fontDescription
Claus Gittinger <cg@exept.de>
parents: 96
diff changeset
  1054
            self selectionDo:[:aView |
6fa9c1f05564 fontPanels actionblock passes a fontDescription
Claus Gittinger <cg@exept.de>
parents: 96
diff changeset
  1055
                aView font:f.
6fa9c1f05564 fontPanels actionblock passes a fontDescription
Claus Gittinger <cg@exept.de>
parents: 96
diff changeset
  1056
                self elementChangedSize:aView.
6fa9c1f05564 fontPanels actionblock passes a fontDescription
Claus Gittinger <cg@exept.de>
parents: 96
diff changeset
  1057
            ]
6fa9c1f05564 fontPanels actionblock passes a fontDescription
Claus Gittinger <cg@exept.de>
parents: 96
diff changeset
  1058
        ].
6fa9c1f05564 fontPanels actionblock passes a fontDescription
Claus Gittinger <cg@exept.de>
parents: 96
diff changeset
  1059
    ]
6fa9c1f05564 fontPanels actionblock passes a fontDescription
Claus Gittinger <cg@exept.de>
parents: 96
diff changeset
  1060
6fa9c1f05564 fontPanels actionblock passes a fontDescription
Claus Gittinger <cg@exept.de>
parents: 96
diff changeset
  1061
    "Modified: 5.9.1995 / 12:13:27 / claus"
6fa9c1f05564 fontPanels actionblock passes a fontDescription
Claus Gittinger <cg@exept.de>
parents: 96
diff changeset
  1062
    "Created: 10.4.1997 / 09:56:16 / cg"
6fa9c1f05564 fontPanels actionblock passes a fontDescription
Claus Gittinger <cg@exept.de>
parents: 96
diff changeset
  1063
!
6fa9c1f05564 fontPanels actionblock passes a fontDescription
Claus Gittinger <cg@exept.de>
parents: 96
diff changeset
  1064
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1065
changeFontFamily:family face:face style:style size:size
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1066
    |f|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1067
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1068
    f := Font family:family
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1069
                face:face
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1070
               style:style
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1071
                size:size.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1072
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1073
    f notNil ifTrue:[
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
  1074
        self withSelectionHiddenDo:[
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1075
            self selectionDo:[:aView |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1076
                aView font:f.
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
  1077
                self elementChangedSize:aView.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1078
            ]
111
ca
parents: 103
diff changeset
  1079
        ]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1080
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1081
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1082
    "Modified: 5.9.1995 / 12:13:27 / claus"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1083
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1084
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1085
!UIPainterView methodsFor:'removing components'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1086
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1087
remove:anObject
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1088
    "remove anObject from the contents do redraw
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1089
    "
111
ca
parents: 103
diff changeset
  1090
    listHolder remove:anObject.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1091
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1092
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1093
removeAll
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
  1094
    "remove all objects and properties
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
  1095
    "
111
ca
parents: 103
diff changeset
  1096
    listHolder disableNotificationsWhileEvaluating:[
ca
parents: 103
diff changeset
  1097
        self unselect.
ca
parents: 103
diff changeset
  1098
        listHolder  removeAll.
ca
parents: 103
diff changeset
  1099
        undoHistory reinitialize.
ca
parents: 103
diff changeset
  1100
    ]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1101
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1102
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1103
!UIPainterView methodsFor:'searching'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1104
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
  1105
findContainerViewAt:aPoint
35c5711729c2 so far so good
ca
parents: 86
diff changeset
  1106
    "find container view responds to aPoint.
35c5711729c2 so far so good
ca
parents: 86
diff changeset
  1107
    "
35c5711729c2 so far so good
ca
parents: 86
diff changeset
  1108
    |view|
35c5711729c2 so far so good
ca
parents: 86
diff changeset
  1109
35c5711729c2 so far so good
ca
parents: 86
diff changeset
  1110
    (view := self findObjectAt:aPoint) isNil ifTrue:[
35c5711729c2 so far so good
ca
parents: 86
diff changeset
  1111
        ^ self
35c5711729c2 so far so good
ca
parents: 86
diff changeset
  1112
    ].
35c5711729c2 so far so good
ca
parents: 86
diff changeset
  1113
35c5711729c2 so far so good
ca
parents: 86
diff changeset
  1114
    [(view specClass supportsSubComponents or:[(view := view superView) == self])
35c5711729c2 so far so good
ca
parents: 86
diff changeset
  1115
    ] whileFalse:[
35c5711729c2 so far so good
ca
parents: 86
diff changeset
  1116
        [(self propertyOfView:view) isNil] whileTrue:[
35c5711729c2 so far so good
ca
parents: 86
diff changeset
  1117
            (view := view superView) == self ifTrue:[^ self]
35c5711729c2 so far so good
ca
parents: 86
diff changeset
  1118
        ].
35c5711729c2 so far so good
ca
parents: 86
diff changeset
  1119
    ].
35c5711729c2 so far so good
ca
parents: 86
diff changeset
  1120
    ^ view
35c5711729c2 so far so good
ca
parents: 86
diff changeset
  1121
!
35c5711729c2 so far so good
ca
parents: 86
diff changeset
  1122
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1123
findObjectAt:aPoint
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1124
    "find the origin/corner of the currentWidget
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1125
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1126
    |view|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1127
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1128
    view := super findObjectAt:aPoint.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1129
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1130
    view notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1131
        "can be a view within a view not visible
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1132
        "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1133
        [ (self propertyOfView:view) isNil ] whileTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1134
            (view := view superView) == self ifTrue:[^ nil]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1135
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1136
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1137
    ^ view
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1138
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1139
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1140
findViewWithId:aViewId
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
  1141
    "finds view assigned to identifier and returns the view or nil
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1142
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1143
    |prop|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1144
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1145
    prop := self propertyOfIdentifier:aViewId.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1146
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1147
    prop notNil ifTrue:[^ prop view]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1148
               ifFalse:[^ nil]
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1149
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1150
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1151
propertyOfGroup:aGroup
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1152
    "returns property assigned to group
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1153
    "
111
ca
parents: 103
diff changeset
  1154
    ^ listHolder detectProperty:[:p| p group == aGroup ]
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1155
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1156
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1157
propertyOfIdentifier:anId
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1158
    "returns property assigned to unique identifier
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1159
    "
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1160
    anId notNil ifTrue:[
111
ca
parents: 103
diff changeset
  1161
        ^ listHolder detectProperty:[:p| p identifier == anId ]
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1162
    ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1163
    ^ nil
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1164
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1165
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1166
propertyOfName:aString
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1167
    "returns property assigned to name
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1168
    "
111
ca
parents: 103
diff changeset
  1169
    |name|
ca
parents: 103
diff changeset
  1170
ca
parents: 103
diff changeset
  1171
    aString isNil ifFalse:[
ca
parents: 103
diff changeset
  1172
        name := aString string withoutSeparators.
ca
parents: 103
diff changeset
  1173
ca
parents: 103
diff changeset
  1174
        name = 'self' ifFalse:[
ca
parents: 103
diff changeset
  1175
            ^ listHolder detectProperty:[:p| p name = name ].
ca
parents: 103
diff changeset
  1176
        ]
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1177
    ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1178
    ^ nil
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1179
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1180
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1181
propertyOfView:aView
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1182
    "returns property assigned to view
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1183
    "
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1184
    (aView isNil or:[aView == self]) ifFalse:[
111
ca
parents: 103
diff changeset
  1185
        ^ listHolder detectProperty:[:p| p view == aView ]
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1186
    ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1187
    ^ nil
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1188
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1189
111
ca
parents: 103
diff changeset
  1190
uniqueNameFor:aSpecOrString
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1191
    "generate and return an unique name for a class
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1192
    "
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1193
    |next name size|
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1194
111
ca
parents: 103
diff changeset
  1195
    aSpecOrString isString ifFalse:[name := aSpecOrString className asString]
ca
parents: 103
diff changeset
  1196
                            ifTrue:[name := aSpecOrString].
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1197
111
ca
parents: 103
diff changeset
  1198
    (name endsWith:'Spec') ifTrue:[
ca
parents: 103
diff changeset
  1199
        name := name copyFrom:1 to:(name size - 4).
ca
parents: 103
diff changeset
  1200
    ] ifFalse:[
ca
parents: 103
diff changeset
  1201
        name := name copy
ca
parents: 103
diff changeset
  1202
    ].
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1203
    name at:1 put:(name at:1) asLowercase.
111
ca
parents: 103
diff changeset
  1204
    size  := name size + 1.
ca
parents: 103
diff changeset
  1205
    next  := 0.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1206
111
ca
parents: 103
diff changeset
  1207
    listHolder propertiesDo:[:p|
ca
parents: 103
diff changeset
  1208
        |n|
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1209
        n := p name.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1210
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1211
        (n size >= size and:[n startsWith:name]) ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1212
            next := next max:(p extractNumberStartingAt:size)
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1213
        ]
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1214
    ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1215
    next := next + 1.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1216
    name := name, next printString.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1217
  ^ name
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1218
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1219
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1220
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1221
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1222
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1223
uniqueNameOf:aView
111
ca
parents: 103
diff changeset
  1224
    |prop|
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1225
111
ca
parents: 103
diff changeset
  1226
    (prop := self propertyOfView:aView) notNil ifTrue:[
ca
parents: 103
diff changeset
  1227
        prop name isNil ifTrue:[
ca
parents: 103
diff changeset
  1228
            prop name:(self uniqueNameFor:(prop spec)).
ca
parents: 103
diff changeset
  1229
        ].
ca
parents: 103
diff changeset
  1230
        ^ prop name
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1231
    ].
111
ca
parents: 103
diff changeset
  1232
    ^ 'self'
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1233
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1234
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1235
71
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1236
!UIPainterView methodsFor:'selection'!
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1237
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1238
addTreeFrom:aView to:aCollection
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1239
    "add aView and contained subcomponents to collection
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1240
    "
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1241
    (self propertyOfView:aView) notNil ifTrue:[
71
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1242
        aCollection add:aView.
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1243
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1244
        (aView subViews notNil) ifTrue:[
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1245
            aView subViews do:[:subView|
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1246
                self addTreeFrom:subView to:aCollection
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1247
            ]
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1248
        ].
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1249
    ]
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1250
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1251
!
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1252
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1253
selectSubComponents
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1254
    "select all subcomponents for current selection
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1255
    "
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1256
    |startAtView aCollection|
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1257
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1258
    aCollection := OrderedCollection new.
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1259
    startAtView := self singleSelection.
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1260
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1261
    startAtView isNil ifTrue:[
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1262
        self subViews notNil ifTrue:[
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1263
            self subViews do:[:subView|
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1264
                subView ~~ inputView ifTrue:[
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1265
                    self addTreeFrom:subView to:aCollection
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1266
                ]
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1267
            ]
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1268
        ]
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1269
    ] ifFalse:[
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1270
        self addTreeFrom:startAtView to:aCollection
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1271
    ].
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1272
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1273
    aCollection size > 1 ifTrue:[
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1274
        self withSelectionHiddenDo:[
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1275
            selection := aCollection
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1276
        ].
111
ca
parents: 103
diff changeset
  1277
        self selectionChanged
71
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1278
    ]
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1279
! !
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1280
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1281
!UIPainterView methodsFor:'specification'!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1282
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1283
addSpec:aSpecification builder:aBuilder in:aFrame
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1284
    "build view and subviews from aSpecification into a frame. The top view
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1285
     is returned. The contained components of a spec are set to nil
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1286
    "
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1287
    aBuilder applicationClass:(Smalltalk classNamed:className).
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1288
111
ca
parents: 103
diff changeset
  1289
    aBuilder componentCreationHook:[:aView :aSpec :aBdr||sv p s n|
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1290
        p := ViewProperty new.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1291
        s := aSpec copy.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1292
        p spec:s.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1293
        p view:aView.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1294
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1295
        s class supportsSubComponents ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1296
            s component:nil
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1297
        ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1298
111
ca
parents: 103
diff changeset
  1299
        n := s name.
ca
parents: 103
diff changeset
  1300
ca
parents: 103
diff changeset
  1301
        (n isNil or:[(self propertyOfName:n) notNil]) ifTrue:[
ca
parents: 103
diff changeset
  1302
            s name:(self uniqueNameFor:s)
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1303
        ].
111
ca
parents: 103
diff changeset
  1304
        listHolder add:p
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1305
    ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1306
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1307
    ^ aSpecification buildViewWithLayoutFor:aBuilder in:aFrame.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1308
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1309
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1310
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1311
fullSpecFor:anObject
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1312
    "generate a full spec for an object
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
  1313
    "
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1314
    |mySpec subSpecs|
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1315
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1316
    mySpec := self specFor:anObject.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1317
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1318
    (mySpec notNil and:[mySpec class supportsSubComponents]) ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1319
        (anObject subViews notNil) ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1320
            anObject subViews do:[:aSubView||spec|
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1321
                spec := self fullSpecFor:aSubView.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1322
                spec notNil ifTrue:[