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