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