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