UIPainter.st
changeset 42 877a25e8f5aa
child 46 8301d6b9e67c
equal deleted inserted replaced
41:4c080ce0d465 42:877a25e8f5aa
       
     1 "
       
     2  COPYRIGHT (c) 1995 by Claus Gittinger
       
     3 	      All Rights Reserved
       
     4 
       
     5  This software is furnished under a license and may be used
       
     6  only in accordance with the terms of that license and with the
       
     7  inclusion of the above copyright notice.   This software may not
       
     8  be provided or otherwise made available to, or used by, any
       
     9  other person.  No title to or ownership of the software is
       
    10  hereby transferred.
       
    11 "
       
    12 
       
    13 ApplicationModel subclass:#UIPainter
       
    14 	instanceVariableNames:'menu nameField elementMenu workView treeView outletView stringBox
       
    15 		actionBox listBox fileBox currentFileName topView propertyFrame
       
    16 		whichProperty changeSelectorHolder changeChannel
       
    17 		aspectSelectorHolder aspectChannel nameChannel fgChannel
       
    18 		bgChannel applyAction leftFractionHolder leftOffsetHolder
       
    19 		rightFractionHolder rightOffsetHolder topFractionHolder
       
    20 		topOffsetHolder bottomFractionHolder bottomOffsetHolder specClass
       
    21 		specSelector leftAlignmentFractionHolder
       
    22 		topAlignmentFractionHolder propertyShown specShown'
       
    23 	classVariableNames:''
       
    24 	poolDictionaries:''
       
    25 	category:'Interface-UIPainter'
       
    26 !
       
    27 
       
    28 !UIPainter class methodsFor:'documentation'!
       
    29 
       
    30 copyright
       
    31 "
       
    32  COPYRIGHT (c) 1995 by Claus Gittinger
       
    33 	      All Rights Reserved
       
    34 
       
    35  This software is furnished under a license and may be used
       
    36  only in accordance with the terms of that license and with the
       
    37  inclusion of the above copyright notice.   This software may not
       
    38  be provided or otherwise made available to, or used by, any
       
    39  other person.  No title to or ownership of the software is
       
    40  hereby transferred.
       
    41 "
       
    42 !
       
    43 
       
    44 documentation
       
    45 "
       
    46     not yet finished, not yet published, not yet released.
       
    47 
       
    48     [start with:]
       
    49         Builder open
       
    50 
       
    51     [st80 compatibility:]
       
    52         UIPainter := Builder. UIPainter open
       
    53 "
       
    54 ! !
       
    55 
       
    56 !UIPainter class methodsFor:'interface specs'!
       
    57 
       
    58 actionButtonModelSpec
       
    59     "UIPainter new openOnClass:self andSelector:#actionButtonModelSpec"
       
    60 
       
    61     <resource: #canvas>
       
    62 
       
    63     ^
       
    64      
       
    65        #(#FullSpec
       
    66           #'component:' 
       
    67            #(#SpecCollection
       
    68               #'collection:' 
       
    69                #(
       
    70                  #(#FramedBoxSpec
       
    71                     #'layout:' #(#LayoutFrame 0 0 -1 0 251 0 289 0)
       
    72                     #'component:' 
       
    73                      #(#SpecCollection
       
    74                         #'collection:' 
       
    75                          #(
       
    76                            #(#VerticalPanelViewSpec
       
    77                               #'layout:' #(#LayoutFrame 6 0 26 0 78 0 216 0)
       
    78                               #'component:' 
       
    79                                #(#SpecCollection
       
    80                                   #'collection:' 
       
    81                                    #(
       
    82                                      #(#LabelSpec
       
    83                                         #'name:' 'label'
       
    84                                         #'layout:' #(#LayoutFrame 0 0 47 0 57 0 71 0)
       
    85                                         #'label:' 'aspect:'
       
    86                                     )
       
    87                                      #(#LabelSpec
       
    88                                         #'name:' 'label'
       
    89                                         #'layout:' #(#LayoutFrame 0 0 119 0 62 0 143 0)
       
    90                                         #'label:' 'change:'
       
    91                                     )
       
    92                                   )
       
    93                               )
       
    94                               #'horizontalLayout:' #left
       
    95                               #'verticalLayout:' #spreadSpace
       
    96                           )
       
    97                            #(#VerticalPanelViewSpec
       
    98                               #'layout:' #(#LayoutFrame 80 0 24 0 231 0 214 0)
       
    99                               #'component:' 
       
   100                                #(#SpecCollection
       
   101                                   #'collection:' 
       
   102                                    #(
       
   103                                      #(#InputFieldSpec
       
   104                                         #'name:' 'aspectInput'
       
   105                                         #'layout:' #(#LayoutFrame 0 0 49 0 163 0 69 0)
       
   106                                         #model: #aspectChannel
       
   107                                         #acceptOnLostFocus: true
       
   108                                         #tabable: true
       
   109                                     )
       
   110                                      #(#InputFieldSpec
       
   111                                         #'name:' 'changeInput'
       
   112                                         #'layout:' #(#LayoutFrame 0 0 119 0 163 0 142 0)
       
   113                                         #model: #changeChannel
       
   114                                         #acceptOnLostFocus: true
       
   115                                         #tabable: true
       
   116                                     )
       
   117                                   )
       
   118                               )
       
   119                               #'horizontalLayout:' #fit
       
   120                               #'verticalLayout:' #spreadSpace
       
   121                           )
       
   122                            #(#ActionButtonSpec
       
   123                               #'name:' 'button'
       
   124                               #'layout:' #(#LayoutFrame 102 0 246 0 153 0 272 0)
       
   125                               #'label:' 'apply'
       
   126                               #'model:' #setModelAspects
       
   127                           )
       
   128                         )
       
   129                     )
       
   130                     #'labelPosition:' #topLeft
       
   131                     #'showFrame:' false
       
   132                 )
       
   133               )
       
   134           )
       
   135           #'window:' 
       
   136            #(#WindowSpec
       
   137               #'label:' 'unnamed'
       
   138               #'bounds:' #(#Rectangle 0 0 255 292)
       
   139           )
       
   140       )
       
   141 !
       
   142 
       
   143 colorSpec
       
   144     "UIBuilder new openOnClass:self andSelector:#colorSpec"
       
   145     "Builder new openInterface:#colorSpec"
       
   146 
       
   147     <resource: #canvas>
       
   148 
       
   149     ^
       
   150      
       
   151        #(#FullSpec
       
   152           #'component:' 
       
   153            #(#SpecCollection
       
   154               #'collection:' 
       
   155                #(
       
   156                  #(#FramedBoxSpec
       
   157                     #'layout:' #(#LayoutFrame 0 0 -1 0 252 0 290 0)
       
   158                     #'component:' 
       
   159                      #(#SpecCollection
       
   160                         #'collection:' 
       
   161                          #(
       
   162                            #(#VerticalPanelViewSpec
       
   163                               #'layout:' #(#LayoutFrame 6 0 26 0 100 0 215 0)
       
   164                               #'component:' 
       
   165                                #(#SpecCollection
       
   166                                   #'collection:' 
       
   167                                    #(
       
   168                                      #(#LabelSpec
       
   169                                         #'name:' 'label'
       
   170                                         #'layout:' #(#LayoutFrame 0 0 47 0 87 0 71 0)
       
   171                                         #'label:' 'foreground:'
       
   172                                     )
       
   173                                      #(#LabelSpec
       
   174                                         #'name:' 'label'
       
   175                                         #'layout:' #(#LayoutFrame 0 0 119 0 93 0 143 0)
       
   176                                         #'label:' 'background:'
       
   177                                     )
       
   178                                   )
       
   179                               )
       
   180                               #'horizontalLayout:' #left
       
   181                               #'verticalLayout:' #spreadSpace
       
   182                           )
       
   183                            #(#VerticalPanelViewSpec
       
   184                               #'layout:' #(#LayoutFrame 114 0 24 0 233 0 213 0)
       
   185                               #'component:' 
       
   186                                #(#SpecCollection
       
   187                                   #'collection:' 
       
   188                                    #(
       
   189                                      #(#InputFieldSpec
       
   190                                         #'layout:' #(#LayoutFrame 0 0 49 0 163 0 69 0)
       
   191                                         #model: #foregroundChannel
       
   192                                     )
       
   193                                      #(#InputFieldSpec
       
   194                                         #'layout:' #(#LayoutFrame 0 0 119 0 163 0 142 0)
       
   195                                         #model: #backgroundChannel
       
   196                                     )
       
   197                                   )
       
   198                               )
       
   199                               #'horizontalLayout:' #fit
       
   200                               #'verticalLayout:' #spreadSpace
       
   201                           )
       
   202                            #(#ActionButtonSpec
       
   203                               #'name:' 'button'
       
   204                               #'layout:' #(#LayoutFrame 102 0 246 0 153 0 272 0)
       
   205                               #'label:' 'apply'
       
   206                               #'model:' #setColors
       
   207                           )
       
   208                         )
       
   209                     )
       
   210                     #'labelPosition:' #topLeft
       
   211                     #'showFrame:' false
       
   212                 )
       
   213               )
       
   214           )
       
   215           #'window:' 
       
   216            #(#WindowSpec
       
   217               #'label:' 'unnamed'
       
   218               #'bounds:' #(#Rectangle 0 0 255 292)
       
   219           )
       
   220       )
       
   221 !
       
   222 
       
   223 geometrySpecForAlignmentOrigin
       
   224     "UIBuilder new openOnClass:self andSelector:#geometrySpecForAlignmentOrigin"
       
   225     "Builder new openInterface:#geometrySpecForAlignmentOrigin"
       
   226 
       
   227     <resource: #canvas>
       
   228 
       
   229     ^
       
   230      
       
   231        #(#FullSpec
       
   232           #'component:' 
       
   233            #(#SpecCollection
       
   234               #'collection:' 
       
   235                #(
       
   236                  #(#FramedBoxSpec
       
   237                     #'layout:' #(#LayoutFrame 0 0 -1 0 253 0 291 0)
       
   238                     #'component:' 
       
   239                      #(#SpecCollection
       
   240                         #'collection:' 
       
   241                          #(
       
   242                            #(#VerticalPanelViewSpec
       
   243                               #'layout:' #(#LayoutFrame 6 0 26 0 85 0 219 0)
       
   244                               #'component:' 
       
   245                                #(#SpecCollection
       
   246                                   #'collection:' 
       
   247                                    #(
       
   248                                      #(#LabelSpec
       
   249                                         #'layout:' #(#LayoutFrame 0 0 19 0 30 0 43 0)
       
   250                                         #'label:' 'left'
       
   251                                         #'adjust:' #left
       
   252                                     )
       
   253                                      #(#LabelSpec
       
   254                                         #'layout:' #(#LayoutFrame 0 0 63 0 31 0 87 0)
       
   255                                         #'label:' 'top'
       
   256                                         #'adjust:' #left
       
   257                                     )
       
   258                                      #(#LabelSpec
       
   259                                         #'layout:' #(#LayoutFrame 0 0 107 0 41 0 131 0)
       
   260                                         #'label:' 'align H'
       
   261                                         #'adjust:' #left
       
   262                                     )
       
   263                                      #(#LabelSpec
       
   264                                         #'layout:' #(#LayoutFrame 0 0 151 0 61 0 175 0)
       
   265                                         #'label:' 'align V'
       
   266                                         #'adjust:' #left
       
   267                                     )
       
   268                                   )
       
   269                               )
       
   270                               #'horizontalLayout:' #left
       
   271                               #'verticalLayout:' #spreadSpace
       
   272                           )
       
   273                            #(#VerticalPanelViewSpec
       
   274                               #'layout:' #(#LayoutFrame 80 0 24 0 124 0 217 0)
       
   275                               #'component:' 
       
   276                                #(#SpecCollection
       
   277                                   #'collection:' 
       
   278                                    #(
       
   279                                      #(#InputFieldSpec
       
   280                                         #'layout:' #(#LayoutFrame 0 0 21 0 71 0 42 0)
       
   281                                         #'type:' #numberOrNil
       
   282                                         #model: #leftFractionChannel
       
   283                                         #acceptOnLostFocus: true
       
   284                                         #tabable: true
       
   285                                     )
       
   286                                      #(#InputFieldSpec
       
   287                                         #'layout:' #(#LayoutFrame 0 0 64 0 71 0 85 0)
       
   288                                         #'type:' #numberOrNil
       
   289                                         #'model:' #'topFractionChannel'
       
   290                                         #acceptOnLostFocus: true
       
   291                                         #tabable: true
       
   292                                     )
       
   293                                      #(#InputFieldSpec
       
   294                                         #'layout:' #(#LayoutFrame 0 0 107 0 71 0 128 0)
       
   295                                         #'type:' #numberOrNil
       
   296                                         #model:  #'leftAlignmentFractionChannel'
       
   297                                         #acceptOnLostFocus: true
       
   298                                         #tabable: true
       
   299                                     )
       
   300                                      #(#InputFieldSpec
       
   301                                         #'layout:' #(#LayoutFrame 0 0 150 0 71 0 171 0)
       
   302                                         #'type:' #numberOrNil
       
   303                                         #'model:' #'topAlignmentFractionChannel'
       
   304                                         #acceptOnLostFocus: true
       
   305                                         #tabable: true
       
   306                                     )
       
   307                                   )
       
   308                               )
       
   309                               #'horizontalLayout:' #fit
       
   310                               #'verticalLayout:' #spreadSpace
       
   311                           )
       
   312                            #(#VerticalPanelViewSpec
       
   313                               #'layout:' #(#LayoutFrame 150 0 24 0 220 0 216 0)
       
   314                               #'component:' 
       
   315                                #(#SpecCollection
       
   316                                   #'collection:' 
       
   317                                    #(
       
   318                                      #(#InputFieldSpec
       
   319                                         #'layout:' #(#LayoutFrame 0 0 21 0 114 0 42 0)
       
   320                                         #'type:' #numberOrNil
       
   321                                         #model: #leftOffsetChannel
       
   322                                         #acceptOnLostFocus: true
       
   323                                         #tabable: true
       
   324                                     )
       
   325                                      #(#InputFieldSpec
       
   326                                         #'layout:' #(#LayoutFrame 0 0 64 0 114 0 85 0)
       
   327                                         #'type:' #numberOrNil
       
   328                                         #model: #topOffsetChannel
       
   329                                         #acceptOnLostFocus: true
       
   330                                         #tabable: true
       
   331                                     )
       
   332                                   )
       
   333                               )
       
   334                               #'horizontalLayout:' #fit
       
   335                               #'verticalLayout:' #spreadSpace
       
   336                           )
       
   337                            #(#ActionButtonSpec
       
   338                               #'name:' 'button'
       
   339                               #'layout:' #(#LayoutFrame 16 0 210 0 76 0 240 0)
       
   340                               #'label:' 'frame'
       
   341                               #'model:' #setLayoutFrame
       
   342                           )
       
   343                            #(#ActionButtonSpec
       
   344                               #'name:' 'button'
       
   345                               #'layout:' #(#LayoutFrame 96 0 210 0 156 0 240 0)
       
   346                               #'label:' 'origin'
       
   347                               #'model:' #setLayoutOrigin
       
   348                           )
       
   349                            #(#ActionButtonSpec
       
   350                               #'name:' 'button'
       
   351                               #'layout:' #(#LayoutFrame 176 0 210 0 236 0 240 0)
       
   352                               #'label:' 'align'
       
   353                               #'model:' #setAlignmentOrigin
       
   354                               #'initiallyDisabled:' true
       
   355                           )
       
   356 
       
   357                            #(#ActionButtonSpec
       
   358                               #'layout:' #(#LayoutFrame 96 0 260 0 156 0 290 0)
       
   359                               #'label:' 'apply'
       
   360                               #'model:' #setDimensionForAlignmentOrigin
       
   361                               #tabable: true
       
   362                           )
       
   363                            #(#LabelSpec
       
   364                               #'layout:' #(#LayoutFrame 77 0 9 0 137 0 31 0)
       
   365                               #'label:' 'relative'
       
   366                           )
       
   367                            #(#LabelSpec
       
   368                               #'layout:' #(#LayoutFrame 167 0 9 0 213 0 30 0)
       
   369                               #'label:' 'offset'
       
   370                           )
       
   371                         )
       
   372                     )
       
   373                     #'labelPosition:' #topLeft
       
   374                     #'showFrame:' false
       
   375                 )
       
   376               )
       
   377           )
       
   378           #'window:' 
       
   379            #(#WindowSpec
       
   380               #'label:' 'indy: unnamed'
       
   381               #'bounds:' #(#Rectangle 0 0 255 292)
       
   382           )
       
   383       )
       
   384 !
       
   385 
       
   386 geometrySpecForLayoutFrame
       
   387     "UIBuilder new openOnClass:self andSelector:#geometrySpecForLayoutFrame"
       
   388     "Builder new openInterface:#geometrySpecForLayoutFrame"
       
   389 
       
   390     <resource: #canvas>
       
   391 
       
   392     ^
       
   393      
       
   394        #(#FullSpec
       
   395           #'component:' 
       
   396            #(#SpecCollection
       
   397               #'collection:' 
       
   398                #(
       
   399                  #(#FramedBoxSpec
       
   400                     #'layout:' #(#LayoutFrame 0 0 -1 0 253 0 291 0)
       
   401                     #'component:' 
       
   402                      #(#SpecCollection
       
   403                         #'collection:' 
       
   404                          #(
       
   405                            #(#VerticalPanelViewSpec
       
   406                               #'layout:' #(#LayoutFrame 6 0 26 0 85 0 219 0)
       
   407                               #'component:' 
       
   408                                #(#SpecCollection
       
   409                                   #'collection:' 
       
   410                                    #(
       
   411                                      #(#LabelSpec
       
   412                                         #'layout:' #(#LayoutFrame 0 0 19 0 30 0 43 0)
       
   413                                         #'label:' 'left'
       
   414                                         #'adjust:' #left
       
   415                                     )
       
   416                                      #(#LabelSpec
       
   417                                         #'layout:' #(#LayoutFrame 0 0 63 0 30 0 87 0)
       
   418                                         #'label:' 'top'
       
   419                                         #'adjust:' #left
       
   420                                     )
       
   421                                      #(#LabelSpec
       
   422                                         #'layout:' #(#LayoutFrame 0 0 107 0 40 0 131 0)
       
   423                                         #'label:' 'right'
       
   424                                         #'adjust:' #left
       
   425                                     )
       
   426                                      #(#LabelSpec
       
   427                                         #'layout:' #(#LayoutFrame 0 0 151 0 40 0 175 0)
       
   428                                         #'label:' 'bottom'
       
   429                                         #'adjust:' #left
       
   430                                     )
       
   431                                   )
       
   432                               )
       
   433                               #'horizontalLayout:' #left
       
   434                               #'verticalLayout:' #spreadSpace
       
   435                           )
       
   436                            #(#VerticalPanelViewSpec
       
   437                               #'layout:' #(#LayoutFrame 80 0 24 0 124 0 217 0)
       
   438                               #'component:' 
       
   439                                #(#SpecCollection
       
   440                                   #'collection:' 
       
   441                                    #(
       
   442                                      #(#InputFieldSpec
       
   443                                         #'layout:' #(#LayoutFrame 0 0 21 0 71 0 42 0)
       
   444                                         #'type:' #numberOrNil
       
   445                                         #model: #leftFractionChannel
       
   446                                         #acceptOnLostFocus: true
       
   447                                         #tabable: true
       
   448                                     )
       
   449                                      #(#InputFieldSpec
       
   450                                         #'layout:' #(#LayoutFrame 0 0 64 0 71 0 85 0)
       
   451                                         #'type:' #numberOrNil
       
   452                                         #'model:' #'topFractionChannel'
       
   453                                         #acceptOnLostFocus: true
       
   454                                         #tabable: true
       
   455                                     )
       
   456                                      #(#InputFieldSpec
       
   457                                         #'layout:' #(#LayoutFrame 0 0 107 0 71 0 128 0)
       
   458                                         #'type:' #numberOrNil
       
   459                                         #model:  #'rightFractionChannel'
       
   460                                         #acceptOnLostFocus: true
       
   461                                         #tabable: true
       
   462                                     )
       
   463                                      #(#InputFieldSpec
       
   464                                         #'layout:' #(#LayoutFrame 0 0 150 0 71 0 171 0)
       
   465                                         #'type:' #numberOrNil
       
   466                                         #'model:' #'bottomFractionChannel'
       
   467                                         #acceptOnLostFocus: true
       
   468                                         #tabable: true
       
   469                                     )
       
   470                                   )
       
   471                               )
       
   472                               #'horizontalLayout:' #fit
       
   473                               #'verticalLayout:' #spreadSpace
       
   474                           )
       
   475                            #(#VerticalPanelViewSpec
       
   476                               #'layout:' #(#LayoutFrame 150 0 24 0 220 0 216 0)
       
   477                               #'component:' 
       
   478                                #(#SpecCollection
       
   479                                   #'collection:' 
       
   480                                    #(
       
   481                                      #(#InputFieldSpec
       
   482                                         #'layout:' #(#LayoutFrame 0 0 21 0 114 0 42 0)
       
   483                                         #'type:' #numberOrNil
       
   484                                         #model: #leftOffsetChannel
       
   485                                         #acceptOnLostFocus: true
       
   486                                         #tabable: true
       
   487                                     )
       
   488                                      #(#InputFieldSpec
       
   489                                         #'layout:' #(#LayoutFrame 0 0 64 0 114 0 85 0)
       
   490                                         #'type:' #numberOrNil
       
   491                                         #model: #topOffsetChannel
       
   492                                         #acceptOnLostFocus: true
       
   493                                         #tabable: true
       
   494                                     )
       
   495                                      #(#InputFieldSpec
       
   496                                         #'layout:' #(#LayoutFrame 0 0 107 0 114 0 128 0)
       
   497                                         #'type:' #numberOrNil
       
   498                                         #'model:' #rightOffsetChannel
       
   499                                         #acceptOnLostFocus: true
       
   500                                         #tabable: true
       
   501                                     )
       
   502                                      #(#InputFieldSpec
       
   503                                         #'layout:' #(#LayoutFrame 0 0 150 0 114 0 171 0)
       
   504                                         #'type:' #numberOrNil
       
   505                                         #'model:' #bottomOffsetChannel
       
   506                                         #acceptOnLostFocus: true
       
   507                                         #tabable: true
       
   508                                     )
       
   509                                   )
       
   510                               )
       
   511                               #'horizontalLayout:' #fit
       
   512                               #'verticalLayout:' #spreadSpace
       
   513                           )
       
   514 
       
   515                            #(#ActionButtonSpec
       
   516                               #'name:' 'button'
       
   517                               #'layout:' #(#LayoutFrame 16 0 210 0 76 0 240 0)
       
   518                               #'label:' 'frame'
       
   519                               #'model:' #setLayoutFrame
       
   520                               #'initiallyDisabled:' true
       
   521                           )
       
   522                            #(#ActionButtonSpec
       
   523                               #'name:' 'button'
       
   524                               #'layout:' #(#LayoutFrame 96 0 210 0 156 0 240 0)
       
   525                               #'label:' 'origin'
       
   526                               #'model:' #setLayoutOrigin
       
   527                           )
       
   528                            #(#ActionButtonSpec
       
   529                               #'name:' 'button'
       
   530                               #'layout:' #(#LayoutFrame 176 0 210 0 236 0 240 0)
       
   531                               #'label:' 'align'
       
   532                               #'model:' #setAlignmentOrigin
       
   533                           )
       
   534 
       
   535                            #(#ActionButtonSpec
       
   536                               #'layout:' #(#LayoutFrame 96 0 260 0 156 0 290 0)
       
   537                               #'label:' 'apply'
       
   538                               #'model:' #setDimensionForLayoutFrame
       
   539                               #tabable: true
       
   540                           )
       
   541                            #(#LabelSpec
       
   542                               #'layout:' #(#LayoutFrame 77 0 9 0 137 0 31 0)
       
   543                               #'label:' 'relative'
       
   544                           )
       
   545                            #(#LabelSpec
       
   546                               #'layout:' #(#LayoutFrame 167 0 9 0 213 0 30 0)
       
   547                               #'label:' 'offset'
       
   548                           )
       
   549                         )
       
   550                     )
       
   551                     #'labelPosition:' #topLeft
       
   552                     #'showFrame:' false
       
   553                 )
       
   554               )
       
   555           )
       
   556           #'window:' 
       
   557            #(#WindowSpec
       
   558               #'label:' 'indy: unnamed'
       
   559               #'bounds:' #(#Rectangle 0 0 255 292)
       
   560           )
       
   561       )
       
   562 !
       
   563 
       
   564 geometrySpecForLayoutOrigin
       
   565     "UIPainter new openOnClass:self andSelector:#geometrySpecForLayoutOrigin"
       
   566     "Builder new openInterface:#geometrySpecForLayoutOrigin"
       
   567 
       
   568     <resource: #canvas>
       
   569 
       
   570     ^
       
   571 
       
   572        #(#FullSpec
       
   573           #'component:' 
       
   574            #(#SpecCollection
       
   575               #'collection:' 
       
   576                #(
       
   577                  #(#FramedBoxSpec
       
   578                     #'name:' 'framedBox'
       
   579                     #'layout:' #(#LayoutFrame 0 0 -1 0 253 0 291 0)
       
   580                     #'component:' 
       
   581                      #(#SpecCollection
       
   582                         #'collection:' 
       
   583                          #(
       
   584                            #(#VerticalPanelViewSpec
       
   585                               #'name:' 'verticalPanelView'
       
   586                               #'layout:' #(#LayoutFrame 6 0 26 0 85 0 219 0)
       
   587                               #'component:' 
       
   588                                #(#SpecCollection
       
   589                                   #'collection:' 
       
   590                                    #(
       
   591                                      #(#LabelSpec
       
   592                                         #'name:' 'label'
       
   593                                         #'layout:' #(#LayoutFrame 0 0 19 0 30 0 43 0)
       
   594                                         #'label:' 'left'
       
   595                                         #'adjust:' #left
       
   596                                     )
       
   597                                      #(#LabelSpec
       
   598                                         #'name:' 'label'
       
   599                                         #'layout:' #(#LayoutFrame 0 0 63 0 31 0 87 0)
       
   600                                         #'label:' 'top'
       
   601                                         #'adjust:' #left
       
   602                                     )
       
   603                                   )
       
   604                               )
       
   605                               #'horizontalLayout:' #left
       
   606                               #'verticalLayout:' #spreadSpace
       
   607                           )
       
   608                            #(#VerticalPanelViewSpec
       
   609                               #'name:' 'verticalPanelView'
       
   610                               #'layout:' #(#LayoutFrame 80 0 24 0 124 0 217 0)
       
   611                               #'component:' 
       
   612                                #(#SpecCollection
       
   613                                   #'collection:' 
       
   614                                    #(
       
   615                                      #(#InputFieldSpec
       
   616                                         #'layout:' #(#LayoutFrame 0 0 21 0 71 0 42 0)
       
   617                                         #'type:' #numberOrNil
       
   618                                         #model: #leftFractionChannel
       
   619                                         #'acceptOnLostFocus:' true
       
   620                                         #tabable: true
       
   621                                     )
       
   622                                      #(#InputFieldSpec
       
   623                                         #'layout:' #(#LayoutFrame 0 0 64 0 71 0 85 0)
       
   624                                         #'type:' #numberOrNil
       
   625                                         #'model:' #'topFractionChannel'
       
   626                                         #acceptOnLostFocus: true
       
   627                                         #tabable: true
       
   628                                     )
       
   629                                   )
       
   630                               )
       
   631                               #'horizontalLayout:' #fit
       
   632                               #'verticalLayout:' #spreadSpace
       
   633                           )
       
   634                            #(#VerticalPanelViewSpec
       
   635                               #'name:' 'verticalPanelView'
       
   636                               #'layout:' #(#LayoutFrame 150 0 24 0 220 0 216 0)
       
   637                               #'component:' 
       
   638                                #(#SpecCollection
       
   639                                   #'collection:' 
       
   640                                    #(
       
   641                                      #(#InputFieldSpec
       
   642                                         #'layout:' #(#LayoutFrame 0 0 21 0 114 0 42 0)
       
   643                                         #'type:' #numberOrNil
       
   644                                         #model: #leftOffsetChannel
       
   645                                         #acceptOnLostFocus: true
       
   646                                         #tabable: true
       
   647                                     )
       
   648                                      #(#InputFieldSpec
       
   649                                         #'layout:' #(#LayoutFrame 0 0 64 0 114 0 85 0)
       
   650                                         #'type:' #numberOrNil
       
   651                                         #model: #topOffsetChannel
       
   652                                         #acceptOnLostFocus: true
       
   653                                         #tabable: true
       
   654                                     )
       
   655                                   )
       
   656                               )
       
   657                               #'horizontalLayout:' #fit
       
   658                               #'verticalLayout:' #spreadSpace
       
   659                           )
       
   660                            #(#ActionButtonSpec
       
   661                               #'name:' 'button'
       
   662                               #'layout:' #(#LayoutFrame 16 0 210 0 76 0 240 0)
       
   663                               #'label:' 'frame'
       
   664                               #'model:' #setLayoutFrame
       
   665                           )
       
   666                            #(#ActionButtonSpec
       
   667                               #'name:' 'button'
       
   668                               #'layout:' #(#LayoutFrame 96 0 210 0 156 0 240 0)
       
   669                               #'label:' 'origin'
       
   670                               #'model:' #setLayoutOrigin
       
   671                               #'initiallyDisabled:' true
       
   672                           )
       
   673                            #(#ActionButtonSpec
       
   674                               #'name:' 'button'
       
   675                               #'layout:' #(#LayoutFrame 176 0 210 0 236 0 240 0)
       
   676                               #'label:' 'align'
       
   677                               #'model:' #setAlignmentOrigin
       
   678                           )
       
   679                            #(#ActionButtonSpec
       
   680                               #'name:' 'button'
       
   681                               #'layout:' #(#LayoutFrame 96 0 260 0 156 0 290 0)
       
   682                               #'label:' 'apply'
       
   683                               #'model:' #setDimensionForLayoutOrigin
       
   684                           )
       
   685                            #(#LabelSpec
       
   686                               #'name:' 'label'
       
   687                               #'layout:' #(#LayoutFrame 77 0 9 0 137 0 31 0)
       
   688                               #'label:' 'relative'
       
   689                           )
       
   690                            #(#LabelSpec
       
   691                               #'name:' 'label'
       
   692                               #'layout:' #(#LayoutFrame 159 0 9 0 205 0 30 0)
       
   693                               #'label:' 'offset'
       
   694                           )
       
   695                         )
       
   696                     )
       
   697                     #'labelPosition:' #topLeft
       
   698                     #'showFrame:' false
       
   699                 )
       
   700               )
       
   701           )
       
   702           #'window:' 
       
   703            #(#WindowSpec
       
   704               #'label:' 'indy: unnamed'
       
   705               #'bounds:' #(#Rectangle 0 0 255 292)
       
   706           )
       
   707       )
       
   708 
       
   709 !
       
   710 
       
   711 miscSpec
       
   712     "UIBuilder new openOnClass:self andSelector:#miscSpec"
       
   713     "Builder new openInterface:#miscSpec"
       
   714 
       
   715     <resource: #canvas>
       
   716 
       
   717     ^
       
   718      
       
   719        #(#FullSpec
       
   720           #'component:' 
       
   721            #(#SpecCollection
       
   722               #'collection:' 
       
   723                #(
       
   724                  #(#FramedBoxSpec
       
   725                     #'layout:' #(#LayoutFrame 0 0 -1 0 251 0 289 0)
       
   726                     #'component:' 
       
   727                      #(#SpecCollection
       
   728                         #'collection:' 
       
   729                          #(
       
   730                            #(#VerticalPanelViewSpec
       
   731                               #'layout:' #(#LayoutFrame 6 0 26 0 61 0 215 0)
       
   732                               #'component:' 
       
   733                                #(#SpecCollection
       
   734                                   #'collection:' 
       
   735                                    #(
       
   736                                      #(#LabelSpec
       
   737                                         #'layout:' #(#LayoutFrame 0 0 47 0 57 0 71 0)
       
   738                                         #'label:' 'name:'
       
   739                                     )
       
   740                                   )
       
   741                               )
       
   742                               #'horizontalLayout:' #left
       
   743                               #'verticalLayout:' #spreadSpace
       
   744                           )
       
   745                            #(#VerticalPanelViewSpec
       
   746                               #'layout:' #(#LayoutFrame 60 0 24 0 230 0 213 0)
       
   747                               #'component:' 
       
   748                                #(#SpecCollection
       
   749                                   #'collection:' 
       
   750                                    #(
       
   751                                      #(#InputFieldSpec
       
   752                                         #model: #nameChannel
       
   753                                         #'layout:' #(#LayoutFrame 0 0 49 0 163 0 69 0)
       
   754                                         #acceptOnLostFocus: true
       
   755                                         #tabable: true
       
   756                                     )
       
   757                                   )
       
   758                               )
       
   759                               #'horizontalLayout:' #fit
       
   760                               #'verticalLayout:' #spreadSpace
       
   761                           )
       
   762                            #(#ActionButtonSpec
       
   763                               #'layout:' #(#LayoutFrame 102 0 246 0 153 0 272 0)
       
   764                               #'label:' 'apply'
       
   765                               #'model:' #setMiscAspects
       
   766                               #tabable: true
       
   767                           )
       
   768                         )
       
   769                     )
       
   770                     #'labelPosition:' #topLeft
       
   771                     #'showFrame:' false
       
   772                 )
       
   773               )
       
   774           )
       
   775           #'window:' 
       
   776            #(#WindowSpec
       
   777               #'label:' 'unnamed'
       
   778               #'bounds:' #(#Rectangle 0 0 255 292)
       
   779           )
       
   780       )
       
   781 !
       
   782 
       
   783 modelSpec
       
   784     "UIBuilder new openOnClass:self andSelector:#modelSpec"
       
   785     "Builder new openInterface:#modelSpec"
       
   786 
       
   787     <resource: #canvas>
       
   788 
       
   789     ^
       
   790      
       
   791        #(#FullSpec
       
   792           #'component:' 
       
   793            #(#SpecCollection
       
   794               #'collection:' 
       
   795                #(
       
   796                  #(#FramedBoxSpec
       
   797                     #'layout:' #(#LayoutFrame 0 0 -1 0 251 0 289 0)
       
   798                     #'component:' 
       
   799                      #(#SpecCollection
       
   800                         #'collection:' 
       
   801                          #(
       
   802                            #(#VerticalPanelViewSpec
       
   803                               #'layout:' #(#LayoutFrame 6 0 26 0 78 0 216 0)
       
   804                               #'component:' 
       
   805                                #(#SpecCollection
       
   806                                   #'collection:' 
       
   807                                    #(
       
   808                                      #(#LabelSpec
       
   809                                         #'name:' 'label'
       
   810                                         #'layout:' #(#LayoutFrame 0 0 47 0 57 0 71 0)
       
   811                                         #'label:' 'aspect:'
       
   812                                     )
       
   813                                      #(#LabelSpec
       
   814                                         #'name:' 'label'
       
   815                                         #'layout:' #(#LayoutFrame 0 0 119 0 62 0 143 0)
       
   816                                         #'label:' 'change:'
       
   817                                     )
       
   818                                   )
       
   819                               )
       
   820                               #'horizontalLayout:' #left
       
   821                               #'verticalLayout:' #spreadSpace
       
   822                           )
       
   823                            #(#VerticalPanelViewSpec
       
   824                               #'layout:' #(#LayoutFrame 80 0 24 0 231 0 214 0)
       
   825                               #'component:' 
       
   826                                #(#SpecCollection
       
   827                                   #'collection:' 
       
   828                                    #(
       
   829                                      #(#InputFieldSpec
       
   830                                         #'name:' 'aspectInput'
       
   831                                         #'layout:' #(#LayoutFrame 0 0 49 0 163 0 69 0)
       
   832                                         #model: #aspectChannel
       
   833                                         #acceptOnLostFocus: true
       
   834                                         #tabable: true
       
   835                                     )
       
   836                                      #(#InputFieldSpec
       
   837                                         #'name:' 'changeInput'
       
   838                                         #'layout:' #(#LayoutFrame 0 0 119 0 163 0 142 0)
       
   839                                         #model: #changeChannel
       
   840                                         #acceptOnLostFocus: true
       
   841                                         #tabable: true
       
   842                                     )
       
   843                                   )
       
   844                               )
       
   845                               #'horizontalLayout:' #fit
       
   846                               #'verticalLayout:' #spreadSpace
       
   847                           )
       
   848                            #(#ActionButtonSpec
       
   849                               #'name:' 'button'
       
   850                               #'layout:' #(#LayoutFrame 102 0 246 0 153 0 272 0)
       
   851                               #'label:' 'apply'
       
   852                               #'model:' #setModelAspects
       
   853                           )
       
   854                         )
       
   855                     )
       
   856                     #'labelPosition:' #topLeft
       
   857                     #'showFrame:' false
       
   858                 )
       
   859               )
       
   860           )
       
   861           #'window:' 
       
   862            #(#WindowSpec
       
   863               #'label:' 'unnamed'
       
   864               #'bounds:' #(#Rectangle 0 0 255 292)
       
   865           )
       
   866       )
       
   867 ! !
       
   868 
       
   869 !UIPainter methodsFor:'BuilderView interface'!
       
   870 
       
   871 setUndoLabel:aString
       
   872     aString isNil ifTrue:[
       
   873         (menu menuAt:#edit) labelAt:#undoAction put:'undo'.
       
   874         (menu menuAt:#edit) disable:#undoAction
       
   875     ] ifFalse:[
       
   876         (menu menuAt:#edit) labelAt:#undoAction put:'undo: ' , aString.
       
   877         (menu menuAt:#edit) enable:#undoAction
       
   878     ]
       
   879 !
       
   880 
       
   881 update:something with:parameter
       
   882     |singleSelection|
       
   883 
       
   884     elementMenu deselect.
       
   885 
       
   886     something == #undoHistory ifTrue:[
       
   887         ^ self setUndoLabel:parameter
       
   888     ].
       
   889 
       
   890     singleSelection := workView singleSelection.
       
   891 
       
   892     (something == #layout or:[something == #any]) ifTrue:[
       
   893         singleSelection notNil ifTrue:[
       
   894             self fetchLayoutFrom:singleSelection
       
   895         ].
       
   896         ^ self
       
   897     ].
       
   898 
       
   899     (something == #aspects or:[something == #any]) ifTrue:[
       
   900         singleSelection notNil ifTrue:[
       
   901             self fetchModelAspectsFrom:singleSelection
       
   902         ].
       
   903         ^ self
       
   904     ].
       
   905 
       
   906     (something == #selection or:[something == #any]) ifTrue:[
       
   907         self showPropertyView.
       
   908         self showOutletsFor:(workView selection).
       
   909 
       
   910         singleSelection isNil ifFalse:[
       
   911             nameChannel isNil ifTrue:[self nameChannel].
       
   912             nameChannel value:singleSelection name.
       
   913 
       
   914             self fetchLayoutFrom:singleSelection.
       
   915             self fetchModelAspectsFrom:singleSelection.
       
   916         ].
       
   917         ^ self
       
   918     ].
       
   919 ! !
       
   920 
       
   921 !UIPainter methodsFor:'aspects'!
       
   922 
       
   923 aspectChannel
       
   924     ^ aspectChannel
       
   925 
       
   926     "Modified: 6.9.1995 / 01:00:30 / claus"
       
   927 !
       
   928 
       
   929 backgroundChannel
       
   930     ^ bgChannel
       
   931 !
       
   932 
       
   933 bottomFractionChannel
       
   934     ^ bottomFractionHolder
       
   935 !
       
   936 
       
   937 bottomOffsetChannel
       
   938     ^ bottomOffsetHolder
       
   939 
       
   940 !
       
   941 
       
   942 changeChannel
       
   943     ^ changeChannel
       
   944 
       
   945     "Modified: 6.9.1995 / 01:00:33 / claus"
       
   946 !
       
   947 
       
   948 foregroundChannel
       
   949     ^ fgChannel
       
   950 !
       
   951 
       
   952 leftAlignmentFractionChannel
       
   953     ^ leftAlignmentFractionHolder
       
   954 
       
   955 !
       
   956 
       
   957 leftFractionChannel
       
   958     ^ leftFractionHolder
       
   959 
       
   960 !
       
   961 
       
   962 leftOffsetChannel
       
   963     ^ leftOffsetHolder
       
   964 
       
   965 !
       
   966 
       
   967 nameChannel
       
   968     nameChannel isNil ifTrue:[
       
   969 	nameChannel := '' asValue.
       
   970     ].
       
   971     ^ nameChannel
       
   972 
       
   973     "Modified: 6.9.1995 / 00:38:00 / claus"
       
   974 !
       
   975 
       
   976 rightFractionChannel
       
   977     ^ rightFractionHolder
       
   978 
       
   979 !
       
   980 
       
   981 rightOffsetChannel
       
   982     ^ rightOffsetHolder
       
   983 
       
   984 !
       
   985 
       
   986 topAlignmentFractionChannel
       
   987     ^ topAlignmentFractionHolder
       
   988 
       
   989 !
       
   990 
       
   991 topFractionChannel
       
   992     ^ topFractionHolder
       
   993 
       
   994 !
       
   995 
       
   996 topOffsetChannel
       
   997     ^ topOffsetHolder
       
   998 
       
   999 ! !
       
  1000 
       
  1001 !UIPainter methodsFor:'filein & fileout'!
       
  1002 
       
  1003 openFile:aFileName
       
  1004     |aStream |
       
  1005 
       
  1006     aStream := FileStream readonlyFileNamed:aFileName.
       
  1007     aStream notNil ifTrue:[
       
  1008 	workView fileInContentsFrom:aStream.
       
  1009 	aStream close.
       
  1010 	currentFileName := aFileName
       
  1011     ]
       
  1012 
       
  1013 !
       
  1014 
       
  1015 saveAs:aFileName
       
  1016     |aStream|
       
  1017 
       
  1018     aStream := FileStream newFileNamed:aFileName.
       
  1019     aStream notNil ifTrue:[
       
  1020 	workView storeContentsOn:aStream.
       
  1021 	aStream close
       
  1022     ].
       
  1023     currentFileName := aFileName
       
  1024 
       
  1025 ! !
       
  1026 
       
  1027 !UIPainter methodsFor:'help'!
       
  1028 
       
  1029 helpTextFor:aComponent
       
  1030     |sel|
       
  1031 
       
  1032     (aComponent isKindOf:Button) ifTrue:[
       
  1033 	(sel := aComponent changeMessage) notNil ifTrue:[
       
  1034 	    "/ take the buttons change symbol as resource-key
       
  1035 	    ^ resources string:(sel asString)
       
  1036 	]
       
  1037     ].
       
  1038     ^ nil
       
  1039 
       
  1040     "Modified: 31.8.1995 / 20:49:58 / claus"
       
  1041 ! !
       
  1042 
       
  1043 !UIPainter methodsFor:'initialization'!
       
  1044 
       
  1045 buttonPanelSpec
       
  1046     "return a spec for the buttons in the panel;
       
  1047      entries consists of selector and bitmap-filename.
       
  1048      nil selectors are taken as separators (see setupButtonPanel)"
       
  1049 
       
  1050     ^ #(
       
  1051         #(alignSelectionLeft         true 'b_alignL.xbm'  nil false)
       
  1052         #(alignSelectionRight        true 'b_alignR.xbm'  nil false)
       
  1053         #(alignSelectionLeftAndRight true 'b_alignLR.xbm' nil false)
       
  1054         #(nil                        nil  nil nil)
       
  1055         #(alignSelectionTop          true 'b_alignT.xbm'  nil false)
       
  1056         #(alignSelectionBottom       true 'b_alignB.xbm'  nil false)
       
  1057         #(alignSelectionTopAndBottom true 'b_alignTB.xbm' nil false)
       
  1058         #(nil                        nil  nil nil)
       
  1059         #(alignSelectionCenterHor    true 'b_alignCH.xbm' nil false)
       
  1060         #(alignSelectionCenterVer    true 'b_alignCV.xbm' nil false)
       
  1061         #(nil                        nil  nil nil)
       
  1062         #(moveSelectionLeft          true 'b_moveLeft.xbm'  nil true)
       
  1063         #(moveSelectionRight         true 'b_moveRight.xbm' nil true)
       
  1064         #(moveSelectionUp            true 'b_moveUp.xbm'    nil true)
       
  1065         #(moveSelectionDown          true 'b_moveDown.xbm'  nil true)
       
  1066         #(moveSelectionLeft10        true 'b_moveLeft2.xbm'  nil true)
       
  1067         #(moveSelectionRight10       true 'b_moveRight2.xbm' nil true)
       
  1068         #(moveSelectionUp10          true 'b_moveUp2.xbm'    nil true)
       
  1069         #(moveSelectionDown10        true 'b_moveDown2.xbm'  nil true)
       
  1070      )
       
  1071 
       
  1072     "Modified: 5.9.1995 / 22:20:36 / claus"
       
  1073 !
       
  1074 
       
  1075 createCanvas 
       
  1076     |topView|
       
  1077 
       
  1078     super initialize.
       
  1079 
       
  1080     topView := StandardSystemView new.
       
  1081     topView label:'unnamed'.
       
  1082     topView extent:300@300.
       
  1083 
       
  1084     workView := UIPainterView in:topView.
       
  1085     workView layout:(0.0 @ 0.0 corner:1.0 @ 1.0) asLayout.
       
  1086 
       
  1087     ^ workView.
       
  1088 
       
  1089     "Builder new createCanvas open"
       
  1090 !
       
  1091 
       
  1092 createPaletteIn:aViewOrNil
       
  1093     |topView v|
       
  1094 
       
  1095     aViewOrNil isNil ifTrue:[
       
  1096         topView := StandardSystemView new.
       
  1097         topView label:'element palette'.
       
  1098         topView extent:200@400.
       
  1099     ] ifFalse:[
       
  1100         topView := aViewOrNil
       
  1101     ].
       
  1102     v := HVScrollableView for:SelectionInListView miniScrollerH:true in:topView.
       
  1103     v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
       
  1104     elementMenu := v scrolledView.
       
  1105 
       
  1106     ^ elementMenu.
       
  1107 
       
  1108     "(Builder new createPaletteIn:nil) topView open"
       
  1109 
       
  1110     "Modified: 5.9.1995 / 23:52:57 / claus"
       
  1111 !
       
  1112 
       
  1113 initChannels
       
  1114 
       
  1115     bottomFractionHolder        := nil asValue.
       
  1116     bottomOffsetHolder          := nil asValue.
       
  1117     leftFractionHolder          := nil asValue.
       
  1118     leftOffsetHolder            := nil asValue.
       
  1119     rightFractionHolder         := nil asValue.
       
  1120     rightOffsetHolder           := nil asValue.
       
  1121     topFractionHolder           := nil asValue.
       
  1122     topOffsetHolder             := nil asValue.
       
  1123     leftAlignmentFractionHolder := nil asValue.
       
  1124     topAlignmentFractionHolder  := nil asValue.
       
  1125 
       
  1126     fgChannel := nil asValue.
       
  1127     bgChannel := nil asValue.
       
  1128 
       
  1129     aspectChannel := nil asValue.
       
  1130     changeChannel := nil asValue.
       
  1131 
       
  1132 !
       
  1133 
       
  1134 initPullDownMenu
       
  1135     menu labels:(resources  array:#(
       
  1136                                     'file'
       
  1137                                     'edit'
       
  1138                                     'font'
       
  1139                                     'type'
       
  1140                                     'align'
       
  1141                                     'dimension'
       
  1142                                     'form'
       
  1143                                     'special'
       
  1144                                     'code'
       
  1145                                     'debug'
       
  1146                                     'test'
       
  1147                                  )).
       
  1148 
       
  1149     menu selectors:#(#file
       
  1150                      #edit
       
  1151                      #font
       
  1152                      #type
       
  1153                      #align 
       
  1154                      #dimension 
       
  1155                      #form
       
  1156                      #special
       
  1157                      #code
       
  1158                      #debugging
       
  1159                      #test
       
  1160                     ).
       
  1161 
       
  1162     menu at:#file 
       
  1163             putLabels:(resources  array:
       
  1164                       #('new'
       
  1165                         'from class' 
       
  1166                         'pick a view ' 
       
  1167                         '-'
       
  1168                         'save' 
       
  1169                         'save as ...' 
       
  1170                         '-'
       
  1171                         'compile' 
       
  1172                         '-'
       
  1173                         'source' 
       
  1174                         'windowSpec' 
       
  1175                         'inspect me' 
       
  1176                         '-'
       
  1177                         'print'
       
  1178                         '-'
       
  1179                         'quit'
       
  1180                        ))
       
  1181             selectors:#(doNew 
       
  1182                         doFromClass
       
  1183                         doPickAView
       
  1184                         nil
       
  1185                         doSave 
       
  1186                         doSaveAs 
       
  1187                         nil 
       
  1188                         doCompile 
       
  1189                         nil 
       
  1190                         doSource 
       
  1191                         doWindowSpec 
       
  1192                         inspect
       
  1193                         nil 
       
  1194                         doPrint
       
  1195                         nil 
       
  1196                         doFinish
       
  1197                        )
       
  1198              receiver:self.
       
  1199 
       
  1200     menu at:#edit 
       
  1201             putLabels:(resources  array:#(
       
  1202                         'undo' 
       
  1203 "/                        'copy' 
       
  1204                         'cut'
       
  1205 "/                        'paste'
       
  1206                        ))
       
  1207             selectors:#(
       
  1208                         undoAction
       
  1209 "/                        copySelection 
       
  1210                         deleteSelection
       
  1211 "/                        pasteBuffer
       
  1212                        )
       
  1213              receiver:workView.
       
  1214 
       
  1215     menu at:#font 
       
  1216             putLabels:(resources  array:#(
       
  1217                         'larger' 
       
  1218                         'smaller'
       
  1219                         '-'
       
  1220                         'normal'
       
  1221                         'bold'
       
  1222                         'italic'
       
  1223                         'bold italic'
       
  1224                         '-'
       
  1225                         'font panel'
       
  1226                        ) )
       
  1227             selectors:#(largerFont 
       
  1228                         smallerFont
       
  1229                         nil
       
  1230                         normalFont
       
  1231                         boldFont
       
  1232                         italicFont
       
  1233                         boldItalicFont
       
  1234                         nil
       
  1235                         showFontPanel
       
  1236                        )
       
  1237              receiver:workView.
       
  1238 
       
  1239     menu at:#type 
       
  1240             putLabels:(resources  array:#(
       
  1241                         'basic widgets' 
       
  1242                         'layout'
       
  1243                         'text'
       
  1244                         'interactors'
       
  1245                         'modal'
       
  1246                         'other'
       
  1247                         '-'
       
  1248                         'all'
       
  1249                        ) )
       
  1250             selectors:#(showBasicWidgets 
       
  1251                         showLayoutWidgets
       
  1252                         showTextWidgets
       
  1253                         showInteractorWidgets
       
  1254                         showModalWidgets
       
  1255                         showOtherWidgets
       
  1256                         nil
       
  1257                         showAllWidgets
       
  1258                        )
       
  1259              receiver:self.
       
  1260 
       
  1261     menu at:#align 
       
  1262             putLabels:(resources  array:#(
       
  1263 "/                        'raise' 
       
  1264 "/                        'lower'
       
  1265 "/                        '-'
       
  1266                         'align left' 
       
  1267                         'align right'
       
  1268                         'align left & right'
       
  1269                         'align top' 
       
  1270                         'align bottom'
       
  1271                         'align centered vertical'
       
  1272                         'align centered horizontal'
       
  1273                         '-'
       
  1274                         'spread horizontal'
       
  1275                         'spread vertical'
       
  1276                         'center horizontal in frame'
       
  1277                         'center vertical in frame'
       
  1278                        ) )
       
  1279             selectors:#(
       
  1280 "/                        raiseSelection 
       
  1281 "/                        lowerSelection
       
  1282 "/                        nil
       
  1283                         alignSelectionLeft
       
  1284                         alignSelectionRight
       
  1285                         alignSelectionLeftAndRight
       
  1286                         alignSelectionTop
       
  1287                         alignSelectionBottom
       
  1288                         alignSelectionCenterHor
       
  1289                         alignSelectionCenterVer
       
  1290                         nil
       
  1291                         spreadSelectionHor
       
  1292                         spreadSelectionVer
       
  1293                         centerSelectionHor
       
  1294                         centerSelectionVer
       
  1295                        )
       
  1296              receiver:workView.
       
  1297 
       
  1298     menu at:#dimension 
       
  1299             putLabels:(resources  array:#(
       
  1300                         'default extent' 
       
  1301                         'default width' 
       
  1302                         'default height'
       
  1303                         '-'
       
  1304                         'copy extent' 
       
  1305                         'paste extent'
       
  1306                         'paste width'
       
  1307                         'paste height'
       
  1308                         '-'
       
  1309                         'insert'
       
  1310                        ) )
       
  1311             selectors:#(
       
  1312                         setToDefaultExtent
       
  1313                         setToDefaultWidth
       
  1314                         setToDefaultHeight
       
  1315                         nil
       
  1316                         copyExtent
       
  1317                         pasteExtent
       
  1318                         pasteWidth
       
  1319                         pasteHeight
       
  1320                         nil
       
  1321                         insertSelection
       
  1322                        )
       
  1323              receiver:workView.
       
  1324 
       
  1325     menu at:#form 
       
  1326             putLabels:(resources  array:#(
       
  1327                         'align to grid'
       
  1328                         'show grid' 
       
  1329                        ) )
       
  1330             selectors:#(
       
  1331                         alignOn
       
  1332                         toggleGrid
       
  1333                        )
       
  1334              receiver:self.
       
  1335 
       
  1336     menu at:#special 
       
  1337             putLabels:(resources  array:#(
       
  1338                         'group radioButtons' 
       
  1339                         'group enterFields' 
       
  1340                        ) )
       
  1341             selectors:#(
       
  1342                         groupRadioButtons 
       
  1343                         groupEnterFields
       
  1344                        )
       
  1345              receiver:workView.
       
  1346 
       
  1347     menu at:#code 
       
  1348             putLabels:(resources  array:#(
       
  1349                         'class' 
       
  1350                         'method' 
       
  1351 "/                        'variables' 
       
  1352                        ) )
       
  1353             selectors:#(
       
  1354                         changeClass
       
  1355                         changeMethod
       
  1356 "/                        changeVariables
       
  1357                        )
       
  1358              receiver:self.
       
  1359 
       
  1360     menu at:#debugging 
       
  1361             putLabels:(resources array:#(
       
  1362                         'inspect'
       
  1363                         'inspect attributes'
       
  1364                        ) )
       
  1365             selectors:#(
       
  1366                         inspectSelection
       
  1367                         inspectAttributes
       
  1368                        )
       
  1369              receiver:workView.
       
  1370 
       
  1371     menu at:#test 
       
  1372             putLabels:(resources array:#(
       
  1373                         'test on' 
       
  1374                        ) )
       
  1375             selectors:#(toggleTest 
       
  1376                        )
       
  1377              receiver:self.
       
  1378 
       
  1379     self setUndoLabel:nil.
       
  1380 !
       
  1381 
       
  1382 openInterface 
       
  1383     |list panel topPane botPanel v 
       
  1384      leftPanel middlePanel rightPanel buttonPanel propSelector|
       
  1385 
       
  1386     super initialize.
       
  1387 
       
  1388     self initChannels.
       
  1389 
       
  1390     whichProperty := SelectionInList new.
       
  1391     whichProperty list:#('dimension' 'colors' 'model' 'misc' 'attribute list').
       
  1392     whichProperty onChangeSend:#propertySelectionChanged to:self.
       
  1393 
       
  1394     workView :=self createCanvas.
       
  1395 
       
  1396     topView := StandardSystemView new.
       
  1397     topView label:'Interface Builder'.
       
  1398     topView icon:(Image fromFile:'bitmaps/Builder.xbm' resolution:100).
       
  1399     topView extent:(600 @ 400).
       
  1400 
       
  1401     menu := PullDownMenu in:topView.
       
  1402 
       
  1403     buttonPanel := self setupButtonPanelIn:topView below:menu.
       
  1404 
       
  1405     leftPanel := View in:topView.
       
  1406     leftPanel origin:(0.0 @ 0.0) corner:0.3@1.0.
       
  1407     leftPanel topInset:menu height + buttonPanel height + View viewSpacing.
       
  1408 
       
  1409     middlePanel := View in:topView.
       
  1410     middlePanel origin:(0.3 @ 0.0) corner:0.6@1.0.
       
  1411     middlePanel topInset:menu height + buttonPanel height + View viewSpacing.
       
  1412 
       
  1413     rightPanel := View in:topView.
       
  1414     rightPanel origin:(0.6 @ 0.0) corner:1.0@1.0.
       
  1415     rightPanel topInset:menu height + buttonPanel height + View viewSpacing.
       
  1416 
       
  1417     v := HVScrollableView for:UIPainterView miniScrollerH:true in:middlePanel.
       
  1418     v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
       
  1419     treeView := v scrolledView.
       
  1420 
       
  1421     propSelector := PopUpList label:'properties' in:rightPanel.
       
  1422     propSelector origin:(0.0 @ 0.0) corner:1.0@(propSelector preferredExtent y).
       
  1423     propSelector horizontalInset:View viewSpacing.
       
  1424     propSelector model:whichProperty.
       
  1425 
       
  1426     propertyFrame := View in:rightPanel.
       
  1427     propertyFrame origin:(0.0 @ 0.0) corner:1.0@1.0.
       
  1428     propertyFrame topInset:propSelector height + View viewSpacing.
       
  1429 
       
  1430 "/    panel := VariableVerticalPanel in:topView.
       
  1431 "/    panel origin:(0.0 @ 0.0) corner:0.5@1.0.
       
  1432 "/    panel topInset:menu height + buttonPanel height + View viewSpacing.
       
  1433 
       
  1434 "/    topPane := View in:panel.
       
  1435 "/    topPane origin:(0.0 @ 0.0) corner:(1.0 @ 0.5).
       
  1436 "/    topPane borderWidth:0.
       
  1437 
       
  1438 "/    botPanel := VariableHorizontalPanel in:panel.
       
  1439 "/    botPanel origin:(0.0 @ 0.5) corner:(1.0 @ 1.0).
       
  1440 "/    botPanel borderWidth:0.
       
  1441 
       
  1442     elementMenu := self createPaletteIn:leftPanel.
       
  1443 
       
  1444 "/    v := ScrollableView for:UIPainterView in:botPanel.
       
  1445 "/    v origin:(0.0 @ 0.0) corner:(0.5 @ 1.0).
       
  1446 "/    treeView := v scrolledView.
       
  1447 
       
  1448 "/    v := ScrollableView for:SelectionInListView in:botPanel.
       
  1449 "/    v origin:(0.5 @ 0.0) corner:(1.0 @ 1.0).
       
  1450 "/    outletView := v scrolledView.
       
  1451 "/    outletView action:[:lineNr | self selectOutlet:lineNr].
       
  1452 
       
  1453 "/    v := ScrollableView for:TextCollector in:topPane.
       
  1454 "/    v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
       
  1455 "/    infoView := v scrolledView.
       
  1456 
       
  1457     treeView builderView:workView.  "link workview with treeview"
       
  1458 
       
  1459     workView addDependent:treeView.
       
  1460     workView addDependent:self.
       
  1461 
       
  1462     self initPullDownMenu.
       
  1463 
       
  1464     elementMenu action:[:selection |
       
  1465         workView testMode ifTrue:[
       
  1466             elementMenu deselect
       
  1467         ] ifFalse:[
       
  1468             selection notNil ifTrue:[
       
  1469                 workView createWidgetWithClass:
       
  1470                         (Smalltalk at:(elementMenu selectionValue asSymbol))
       
  1471             ]
       
  1472         ]
       
  1473     ].
       
  1474     topView application:self.   
       
  1475     builder window:topView.
       
  1476 
       
  1477     topView beMaster.
       
  1478     workView topView beSlave.
       
  1479 
       
  1480     "/ can be created as embedded or side-menu
       
  1481     elementMenu topView ~~ topView ifTrue:[
       
  1482         elementMenu topView beSlave.
       
  1483     ].
       
  1484 
       
  1485     topView open.
       
  1486     workView topView openInGroup:(topView windowGroup).
       
  1487     elementMenu topView ~~ topView ifTrue:[
       
  1488         elementMenu topView openInGroup:(topView windowGroup).
       
  1489     ]
       
  1490 
       
  1491     "
       
  1492      Builder open
       
  1493     "
       
  1494 
       
  1495     "Modified: 6.9.1995 / 00:26:59 / claus"
       
  1496 !
       
  1497 
       
  1498 openNewWindowCanvas
       
  1499     self open.
       
  1500 
       
  1501 
       
  1502 !
       
  1503 
       
  1504 openOnClass:aClass andSelector:aSelector
       
  1505     "open up an interface builder, fetching a spec from someClass
       
  1506      via some selector"
       
  1507 
       
  1508     |specArray|
       
  1509 
       
  1510     specClass := aClass.
       
  1511     specSelector :=  aSelector.
       
  1512     self openInterface.
       
  1513     workView className:aClass name.
       
  1514     workView methodName:aSelector.
       
  1515     workView setupFromSpec:(aClass perform:aSelector).
       
  1516 !
       
  1517 
       
  1518 openOnSpec:aSpecOrSpecArray
       
  1519     "open up an interface builder, given some specArray"
       
  1520 
       
  1521     |newBuilder|
       
  1522 
       
  1523     newBuilder := self new.
       
  1524 !
       
  1525 
       
  1526 setupButtonPanelIn:aTopView below:aMenu
       
  1527     "create the buttonPanel"
       
  1528 
       
  1529     |spc mh buttonPanel|
       
  1530 
       
  1531     spc := View viewSpacing // 2.
       
  1532     buttonPanel := HorizontalPanelView in:aTopView.
       
  1533     buttonPanel level:-1; borderWidth:0.
       
  1534     buttonPanel horizontalLayout:#leftSpace.
       
  1535 
       
  1536     self buttonPanelSpec do:[:entry |
       
  1537 	|sel toCanvas imgFile label b sep autoRepeat|
       
  1538 
       
  1539 	sel := entry at:1.
       
  1540 	sel isNil ifTrue:[
       
  1541 	    sep := View in:buttonPanel.
       
  1542 	    sep extent:20@1; borderWidth:0.
       
  1543 	] ifFalse:[
       
  1544 	    toCanvas := entry at:2.
       
  1545 	    imgFile := entry at:3.
       
  1546 	    label := entry at:4.
       
  1547 	    autoRepeat := entry at:5.
       
  1548 	    b := Button in:buttonPanel.
       
  1549 	    autoRepeat ifTrue:[
       
  1550 		b autoRepeat:autoRepeat.
       
  1551 		b controller beTriggerOnDown.
       
  1552 	    ].
       
  1553 	    imgFile notNil ifTrue:[
       
  1554 		b logo:(Image fromFile:imgFile).
       
  1555 	    ] ifFalse:[
       
  1556 		b logo:label
       
  1557 	    ].
       
  1558 	    toCanvas ifTrue:[
       
  1559 		b model:workView 
       
  1560 	    ] ifFalse:[
       
  1561 		b model:self
       
  1562 	    ].
       
  1563 	    b changeMessage:sel
       
  1564 	]
       
  1565     ].
       
  1566 
       
  1567     mh := aMenu height.
       
  1568     buttonPanel origin:0.0 @ (mh + spc)
       
  1569 		corner:(1.0 @ (mh + spc + buttonPanel preferredExtent y)).
       
  1570 
       
  1571     buttonPanel leftInset:spc; rightInset:spc.
       
  1572     ^ buttonPanel
       
  1573 
       
  1574     "Modified: 5.9.1995 / 22:23:13 / claus"
       
  1575 ! !
       
  1576 
       
  1577 !UIPainter methodsFor:'misc'!
       
  1578 
       
  1579 listOfOutletsFor:aViewClass
       
  1580     "return a list of outlets for a view-class"
       
  1581 
       
  1582     |l1 l2 all rej|
       
  1583 
       
  1584     (aViewClass == Object) ifTrue:[^ nil].
       
  1585 
       
  1586     l1 := self listOfOutletsFor:(aViewClass superclass).
       
  1587     l2 := self listOfOutletsForClass:aViewClass.
       
  1588 
       
  1589     l2 isNil ifTrue:[
       
  1590 	all := l1
       
  1591     ] ifFalse:[
       
  1592 	l1 isNil ifTrue:[
       
  1593 	    all := l2
       
  1594 	] ifFalse:[
       
  1595 	    all := l1 , l2
       
  1596 	]
       
  1597     ].
       
  1598     rej := self rejectOutletsForClass:aViewClass.
       
  1599     rej notNil ifTrue:[
       
  1600 	rej do:[:x |
       
  1601 	    all := all copyWithout:x
       
  1602 	]
       
  1603     ].
       
  1604     ^ all
       
  1605 !
       
  1606 
       
  1607 listOfOutletsForClass:aViewClass
       
  1608     "return a list of outlets for a view-class"
       
  1609 
       
  1610     "could this be done automatically ?"
       
  1611 
       
  1612     (aViewClass == Label) ifTrue:[
       
  1613 	^ #('label'
       
  1614 	    'iconic-label'
       
  1615 	    'label layout'
       
  1616 	    'fixed size'
       
  1617 	    'foreground-color'
       
  1618 	    'background-color'
       
  1619 	   )
       
  1620     ].
       
  1621     (aViewClass == Button) ifTrue:[
       
  1622 	^ #(
       
  1623 	    'active foreground-color'
       
  1624 	    'active background-color'
       
  1625 	    'active level'
       
  1626 	    'passive level'
       
  1627 	    'press action'
       
  1628 	   )
       
  1629     ].
       
  1630     (aViewClass == Toggle) ifTrue:[
       
  1631 	^ #(
       
  1632 	    'release action'
       
  1633 	   )
       
  1634     ].
       
  1635     (aViewClass == CheckBox) ifTrue:[
       
  1636 	^ #(
       
  1637 	    'label'
       
  1638 	   )
       
  1639     ].
       
  1640     (aViewClass == FramedBox) ifTrue:[
       
  1641 	^ #(
       
  1642 	    'label'
       
  1643 	    'label position'
       
  1644 	    'frame shown'
       
  1645 	   )
       
  1646     ].
       
  1647     (aViewClass == VerticalPanelView) ifTrue:[
       
  1648 	^ #(
       
  1649 	    'horizontal layout'
       
  1650 	    'vertical layout'
       
  1651 	   )
       
  1652     ].
       
  1653     (aViewClass == HorizontalPanelView) ifTrue:[
       
  1654 	^ #(
       
  1655 	    'horizontal layout'
       
  1656 	    'vertical layout'
       
  1657 	   )
       
  1658     ].
       
  1659     (aViewClass == VariableVerticalPanel) ifTrue:[
       
  1660 	^ #(
       
  1661 	    'handle position'
       
  1662 	    'style'
       
  1663 	   )
       
  1664     ].
       
  1665     (aViewClass == ListView) ifTrue:[
       
  1666 	^ #(
       
  1667 	    'contents'
       
  1668 	   )
       
  1669     ].
       
  1670     (aViewClass == SelectionInListView) ifTrue:[
       
  1671 	^ #(
       
  1672 	    'press action'
       
  1673 	   )
       
  1674     ].
       
  1675     (aViewClass == EditField) ifTrue:[
       
  1676 	^#(
       
  1677 	   'initialText'
       
  1678 	   'field type'
       
  1679 	   'field length'
       
  1680 	  )
       
  1681     ].
       
  1682     (aViewClass == View) ifTrue:[
       
  1683 	^ #(
       
  1684 	    'level'
       
  1685 	    'view background-color'
       
  1686 	   )
       
  1687     ].
       
  1688     (aViewClass == Scroller) ifTrue:[
       
  1689 	^ #(
       
  1690 	    'scroll action'
       
  1691 	    'asynchronous'
       
  1692 	    'synchronous'
       
  1693 	   )
       
  1694     ].
       
  1695     (aViewClass == ScrollBar) ifTrue:[
       
  1696 	^ #(
       
  1697 	    'scroll action'
       
  1698 	    'scrollDown action'
       
  1699 	    'scrollUp action'
       
  1700 	    'asynchronous'
       
  1701 	    'synchronous'
       
  1702 	   )
       
  1703     ].
       
  1704     (aViewClass == HorizontalScrollBar) ifTrue:[
       
  1705 	^ #(
       
  1706 	    'scrollLeft action'
       
  1707 	    'scrollRight action'
       
  1708 	   )
       
  1709     ].
       
  1710     (aViewClass == PullDownMenu) ifTrue:[
       
  1711 	^ #(
       
  1712 	    'labels'
       
  1713 	    'actions'
       
  1714 	   )
       
  1715     ].
       
  1716     (aViewClass == Separator) ifTrue:[
       
  1717 	^ #(
       
  1718 	    'orientation'
       
  1719 	   )
       
  1720     ].
       
  1721     ^ nil
       
  1722 
       
  1723     "Modified: 6.9.1995 / 13:42:09 / claus"
       
  1724 !
       
  1725 
       
  1726 rejectOutletsForClass:aViewClass
       
  1727     "return a list of suppressed outlets for a view-class"
       
  1728 
       
  1729     "could this be done automatically ?"
       
  1730 
       
  1731     (aViewClass == CheckToggle) ifTrue:[
       
  1732 	^ #(
       
  1733 	    'iconic-label'
       
  1734 	   )
       
  1735     ].
       
  1736     (aViewClass == CheckBox) ifTrue:[
       
  1737 	^ #(
       
  1738 	    'horizontal layout'
       
  1739 	    'vertical layout'
       
  1740 	   )
       
  1741     ].
       
  1742     (aViewClass == HorizontalScrollBar) ifTrue:[
       
  1743 	^ #(
       
  1744 	    'scrollUp action'
       
  1745 	    'scrollDown action'
       
  1746 	   )
       
  1747     ].
       
  1748     ^ nil
       
  1749 
       
  1750     "Modified: 4.9.1995 / 18:55:03 / claus"
       
  1751 !
       
  1752 
       
  1753 setupPropertyFromSpec:aSpec
       
  1754     "setup menu from spec
       
  1755     "
       
  1756     outletView := nil.
       
  1757 
       
  1758     specShown ~= aSpec ifTrue:[
       
  1759         propertyFrame destroySubViews.
       
  1760         builder buildFromSpec:aSpec in:propertyFrame.
       
  1761         propertyFrame realizeAllSubViews.
       
  1762     ].
       
  1763     specShown := aSpec
       
  1764 !
       
  1765 
       
  1766 showOutletsFor:aView
       
  1767     |c outlets|
       
  1768 
       
  1769     outletView isNil ifTrue:[^ self].
       
  1770 
       
  1771     (aView isKindOf:SimpleView) ifFalse:[
       
  1772 	outletView list:nil.
       
  1773 	^ self
       
  1774     ].
       
  1775     c := aView class.
       
  1776 
       
  1777     outlets := self listOfOutletsFor:c.
       
  1778     outletView list:outlets
       
  1779 
       
  1780     "Modified: 5.9.1995 / 21:51:57 / claus"
       
  1781 ! !
       
  1782 
       
  1783 !UIPainter methodsFor:'private - fetch'!
       
  1784 
       
  1785 fetchLayoutFrom:aView
       
  1786     |layout extent|
       
  1787 
       
  1788     layout := aView geometryLayout.
       
  1789     layout isNil ifTrue:[^ self].
       
  1790 
       
  1791     layout isLayout ifFalse:[
       
  1792         layout isRectangle ifTrue:[
       
  1793             leftOffsetHolder   value:(layout left).
       
  1794             rightOffsetHolder  value:(layout right).
       
  1795             topOffsetHolder    value:(layout top).
       
  1796             bottomOffsetHolder value:(layout bottom).
       
  1797             ^ self
       
  1798         ].
       
  1799         layout isPoint ifTrue:[
       
  1800             leftOffsetHolder   value:(layout left).
       
  1801             rightOffsetHolder  value:(layout right).
       
  1802             ^ self
       
  1803         ].
       
  1804     ].
       
  1805 
       
  1806     leftOffsetHolder   value:(layout leftOffset).
       
  1807     leftFractionHolder value:(layout leftFraction).
       
  1808     topFractionHolder  value:(layout topFraction).
       
  1809     topOffsetHolder    value:(layout topOffset).
       
  1810 
       
  1811     layout isLayoutFrame ifTrue:[
       
  1812         rightOffsetHolder    value:(layout rightOffset).
       
  1813         bottomOffsetHolder   value:(layout bottomOffset).
       
  1814         rightFractionHolder  value:(layout rightFraction).
       
  1815         bottomFractionHolder value:(layout bottomFraction).
       
  1816 
       
  1817         leftAlignmentFractionHolder value:0.
       
  1818         topAlignmentFractionHolder  value:0.
       
  1819 
       
  1820     ] ifFalse:[
       
  1821         extent := aView extent.
       
  1822 
       
  1823         rightOffsetHolder    value:(layout leftOffset + extent x).
       
  1824         bottomOffsetHolder   value:(layout topOffset  + extent y).
       
  1825 
       
  1826         rightFractionHolder  value:0.
       
  1827         bottomFractionHolder value:0.
       
  1828 
       
  1829         layout isAlignmentOrigin ifTrue:[
       
  1830             leftAlignmentFractionHolder value:(layout leftAlignmentFraction).
       
  1831             topAlignmentFractionHolder  value:(layout topAlignmentFraction)
       
  1832         ] ifFalse:[
       
  1833             leftAlignmentFractionHolder value:0.
       
  1834             topAlignmentFractionHolder  value:0
       
  1835         ]
       
  1836     ].
       
  1837 
       
  1838 
       
  1839 !
       
  1840 
       
  1841 fetchModelAspectsFrom:aView
       
  1842     aspectChannel value:(workView aspectSelectorForView:aView).
       
  1843     changeChannel value:(workView changeSelectorForView:aView).
       
  1844 
       
  1845 ! !
       
  1846 
       
  1847 !UIPainter methodsFor:'setup choices'!
       
  1848 
       
  1849 showAllWidgets
       
  1850     "create list of basic widgets"
       
  1851 
       
  1852     self showWidgetsWhere:[:class | true]
       
  1853 !
       
  1854 
       
  1855 showBasicWidgets
       
  1856     "create list of basic widgets"
       
  1857 
       
  1858     self showWidgetsInCategory:'Views-Basic' 
       
  1859 			butNot:[:class | class isKindOf:ModalBox class]
       
  1860 !
       
  1861 
       
  1862 showInteractorWidgets
       
  1863     "create list of interactor widgets"
       
  1864 
       
  1865     self showWidgetsInCategory:'Views-Interactors'
       
  1866 			butNot:[:class | class isKindOf:ModalBox class]
       
  1867 !
       
  1868 
       
  1869 showLayoutWidgets
       
  1870     "create list of basic widgets"
       
  1871 
       
  1872     self showWidgetsInCategory:'Views-Layout'
       
  1873 			butNot:[:class | class isKindOf:ModalBox class]
       
  1874 !
       
  1875 
       
  1876 showModalWidgets
       
  1877     "create list of modal widgets"
       
  1878 
       
  1879     self showWidgetsWhere:[:class | class isKindOf:ModalBox class]
       
  1880 !
       
  1881 
       
  1882 showOtherWidgets
       
  1883     "create list of other widgets"
       
  1884 
       
  1885     |check cat|
       
  1886 
       
  1887     check := [:class |
       
  1888 		(#('Views-Basic' 
       
  1889 		   'Views-Interactors'
       
  1890 		   'Views-Layout'
       
  1891 		   'Views-Text') includes:class category) not].
       
  1892     self showWidgetsWhere:check
       
  1893 		   butNot:[:class | class isKindOf:ModalBox class]
       
  1894 !
       
  1895 
       
  1896 showTextWidgets
       
  1897     "create list of basic widgets"
       
  1898 
       
  1899     self showWidgetsInCategory:'Views-Text'
       
  1900 			butNot:[:class | class isKindOf:ModalBox class]
       
  1901 !
       
  1902 
       
  1903 showWidgetsInCategory:aCategory
       
  1904     "create list of basic widgets"
       
  1905 
       
  1906     self showWidgetsWhere:[:class | class category = aCategory]
       
  1907 !
       
  1908 
       
  1909 showWidgetsInCategory:aCategory butNot:excludeBlock
       
  1910     "create list of basic widgets"
       
  1911 
       
  1912     self showWidgetsWhere:[:class | class category = aCategory]
       
  1913 		   butNot:excludeBlock
       
  1914 !
       
  1915 
       
  1916 showWidgetsWhere:aBlock
       
  1917     "create list of widgets where aBlock avaluates to true"
       
  1918 
       
  1919     self showWidgetsWhere:aBlock butNot:[:class | false]
       
  1920 !
       
  1921 
       
  1922 showWidgetsWhere:aBlock butNot:excludeBlock
       
  1923     "create list of widgets where aBlock evaluates to true and excludeBlock
       
  1924      evaluates to false"
       
  1925 
       
  1926     |list|
       
  1927 
       
  1928     list := OrderedCollection new:0.
       
  1929     SimpleView allSubclassesDo:[:aSubclass |
       
  1930         (aBlock value:aSubclass) ifTrue:[
       
  1931             (excludeBlock value:aSubclass) ifFalse:[
       
  1932                 list add:(aSubclass name)
       
  1933             ]
       
  1934         ]
       
  1935     ].
       
  1936     (aBlock value:View) ifTrue:[
       
  1937         (excludeBlock value:View) ifFalse:[
       
  1938             list add:'View'
       
  1939         ]
       
  1940     ].
       
  1941     (list size == 0) ifFalse:[
       
  1942         list sort
       
  1943     ].
       
  1944     elementMenu list:list
       
  1945 ! !
       
  1946 
       
  1947 !UIPainter methodsFor:'user actions - dimension'!
       
  1948 
       
  1949 setAlignmentOrigin
       
  1950     "apply is pressed in the geometry-sub view, with a alignmentOrigin selected
       
  1951     "
       
  1952     self setupPropertyFromSpec:(self class geometrySpecForAlignmentOrigin)
       
  1953 !
       
  1954 
       
  1955 setDimensionForAlignmentOrigin
       
  1956     |view layout|
       
  1957 
       
  1958     view := workView singleSelection.
       
  1959 
       
  1960     view notNil ifTrue:[
       
  1961         layout := AlignmentOrigin new.
       
  1962 
       
  1963         layout   leftOffset:(leftOffsetHolder   value) ? 0.
       
  1964         layout    topOffset:(topOffsetHolder    value) ? 0.
       
  1965         layout leftFraction:(leftFractionHolder value) ? 0.
       
  1966         layout  topFraction:(topFractionHolder  value) ? 0.
       
  1967 
       
  1968         layout leftAlignmentFraction:(leftAlignmentFractionHolder value) ? 0.
       
  1969         layout  topAlignmentFraction:(topAlignmentFractionHolder  value) ? 0.
       
  1970 
       
  1971         workView setDimension:layout.
       
  1972     ]
       
  1973 !
       
  1974 
       
  1975 setDimensionForLayoutFrame
       
  1976     |view layout|
       
  1977 
       
  1978     view := workView singleSelection.
       
  1979 
       
  1980     view notNil ifTrue:[
       
  1981         layout := LayoutFrame new.
       
  1982 
       
  1983         layout leftOffset:(leftOffsetHolder value) ? 0.
       
  1984         layout rightOffset:(rightOffsetHolder value) ? 0.
       
  1985         layout topOffset:(topOffsetHolder value) ? 0.
       
  1986         layout bottomOffset:(bottomOffsetHolder value) ? 0.
       
  1987         layout leftFraction:(leftFractionHolder value) ? 0.
       
  1988         layout rightFraction:(rightFractionHolder value) ? 0.
       
  1989         layout topFraction:(topFractionHolder value) ? 0.
       
  1990         layout bottomFraction:(bottomFractionHolder value) ? 0.
       
  1991 
       
  1992         workView setDimension:layout.
       
  1993     ]
       
  1994 !
       
  1995 
       
  1996 setDimensionForLayoutOrigin
       
  1997     |view layout|
       
  1998 
       
  1999     view := workView singleSelection.
       
  2000 
       
  2001     view notNil ifTrue:[
       
  2002         layout := LayoutOrigin new.
       
  2003 
       
  2004         layout leftOffset:(leftOffsetHolder value) ? 0.
       
  2005         layout topOffset:(topOffsetHolder value) ? 0.
       
  2006 
       
  2007         layout leftFraction:(leftFractionHolder value) ? 0.
       
  2008         layout topFraction:(topFractionHolder value) ? 0.
       
  2009 
       
  2010         workView setDimension:layout.
       
  2011     ]
       
  2012 !
       
  2013 
       
  2014 setLayoutFrame
       
  2015     "apply is pressed in the geometry-sub view, with a layoutFrame selected
       
  2016     "
       
  2017     self setupPropertyFromSpec:(self class geometrySpecForLayoutFrame)
       
  2018 !
       
  2019 
       
  2020 setLayoutOrigin
       
  2021     "apply is pressed in the geometry-sub view, with a layoutOrigin selected
       
  2022     "
       
  2023     self setupPropertyFromSpec:(self class geometrySpecForLayoutOrigin)
       
  2024 ! !
       
  2025 
       
  2026 !UIPainter methodsFor:'user actions - form'!
       
  2027 
       
  2028 alignOff
       
  2029     |m|
       
  2030 
       
  2031     m := menu menuAt:#form.
       
  2032     m labelAt:#alignOff put:(resources string:'align to grid').
       
  2033     m selectorAt:#alignOff put:#alignOn.
       
  2034     workView alignOff
       
  2035 !
       
  2036 
       
  2037 alignOn
       
  2038     |m|
       
  2039 
       
  2040     m := menu menuAt:#form.
       
  2041     m labelAt:#alignOn put:(resources string:'do not align to grid').
       
  2042     m selectorAt:#alignOn put:#alignOff.
       
  2043     workView alignOn
       
  2044 !
       
  2045 
       
  2046 toggleGrid
       
  2047     |m|
       
  2048 
       
  2049     m := menu menuAt:#form.
       
  2050 
       
  2051     workView gridShown ifFalse:[
       
  2052         m labelAt:#toggleGrid put:(resources string:'hide grid').
       
  2053         workView showGrid
       
  2054     ] ifTrue:[
       
  2055         m labelAt:#toggleGrid put:(resources string:'show grid').
       
  2056         workView hideGrid
       
  2057     ]
       
  2058 ! !
       
  2059 
       
  2060 !UIPainter methodsFor:'user interaction'!
       
  2061 
       
  2062 closeRequest
       
  2063     workView  notNil ifTrue:[workView  release].
       
  2064     fileBox   notNil ifTrue:[fileBox   destroy].
       
  2065     stringBox notNil ifTrue:[stringBox destroy].
       
  2066     actionBox notNil ifTrue:[actionBox destroy].
       
  2067     listBox   notNil ifTrue:[listBox   destroy].
       
  2068     super closeRequest
       
  2069 !
       
  2070 
       
  2071 doCompile
       
  2072    |code|
       
  2073 
       
  2074    code := workView generateCode.
       
  2075    (ReadStream on:code) fileIn.
       
  2076 
       
  2077     "Modified: 4.9.1995 / 17:06:10 / claus"
       
  2078 !
       
  2079 
       
  2080 doFinish
       
  2081     self closeRequest
       
  2082 !
       
  2083 
       
  2084 doFromClass
       
  2085         |className methodName cls sel accepted failed spec s|
       
  2086 
       
  2087         className := '' asValue.
       
  2088         methodName := '' asValue.
       
  2089         (s := workView className) notNil ifTrue:[
       
  2090             className value:s
       
  2091         ].
       
  2092         (s := workView methodName) notNil ifTrue:[
       
  2093             methodName value:s
       
  2094         ].
       
  2095 
       
  2096         failed := false.
       
  2097         [
       
  2098             accepted :=
       
  2099                 (DialogBox new
       
  2100                     addTextLabel:'Classes name:';
       
  2101                     addInputFieldOn:className; 
       
  2102                     addVerticalSpace;
       
  2103                     addTextLabel:'methods name:';
       
  2104                     addInputFieldOn:methodName; 
       
  2105                     addAbortButton; 
       
  2106                     addOkButton; 
       
  2107                     open
       
  2108                 ) accepted.
       
  2109 
       
  2110              accepted ifTrue:[
       
  2111                 cls := Smalltalk classNamed:className value.
       
  2112                 cls isNil ifTrue:[
       
  2113                     failed := true.
       
  2114                     self warn:'no such class'.
       
  2115                 ] ifFalse:[
       
  2116                     sel := methodName value asSymbol.
       
  2117                     (cls respondsTo:sel ) ifFalse:[
       
  2118                         failed := true.
       
  2119                         self warn:'no such method'
       
  2120                     ] ifTrue:[
       
  2121                         spec := cls perform:sel.
       
  2122                         spec isArray ifFalse:[
       
  2123                             failed := true.
       
  2124                             self warn:'not a windowSpec method'    
       
  2125                         ].
       
  2126                         "/ ok, got it
       
  2127                         workView className:className value.
       
  2128                         workView methodName:methodName value.
       
  2129                         workView setupFromSpec:spec.
       
  2130                         ^ self
       
  2131                      ]
       
  2132                 ]
       
  2133              ]
       
  2134         ] doWhile:[accepted and:[failed]].
       
  2135 
       
  2136     "Modified: 5.9.1995 / 18:47:57 / claus"
       
  2137 !
       
  2138 
       
  2139 doNew
       
  2140     workView removeAll.
       
  2141     ^ self
       
  2142 
       
  2143     "Modified: 5.9.1995 / 20:52:21 / claus"
       
  2144 !
       
  2145 
       
  2146 doOpen
       
  2147     fileBox isNil ifTrue:[
       
  2148 	fileBox := FileSelectionBox
       
  2149 			title:''
       
  2150 			"pattern:'*.sib'"
       
  2151 			okText:''
       
  2152 			abortText:(Resource name:'BUILDER_ABORT_LABEL'
       
  2153 					fromFile:'Builder.rs')
       
  2154 			action:[nil]
       
  2155     ].
       
  2156     fileBox title:(Resource name:'BUILDER_OPEN_TITLE' fromFile:'Builder.rs').
       
  2157     fileBox action:[:fileName | self openFile:fileName].
       
  2158     fileBox okText:(Resource name:'BUILDER_OPEN_OK_LABEL' fromFile:'Builder.rs').
       
  2159     fileBox showAtPointer
       
  2160 !
       
  2161 
       
  2162 doPickAView
       
  2163     |view className methodName cls sel accepted spec s|
       
  2164 
       
  2165     view := Display viewFromUser.
       
  2166     view isNil ifTrue:[^ self].
       
  2167 
       
  2168     spec := UISpecification fromView:view topView.
       
  2169 
       
  2170     "/ ok, got it
       
  2171     workView setupFromSpec:spec.
       
  2172     workView className:view class name.
       
  2173     workView methodName:#newSpec.
       
  2174     ^ self
       
  2175 
       
  2176     "Modified: 5.9.1995 / 23:25:53 / claus"
       
  2177 !
       
  2178 
       
  2179 doPrint
       
  2180     ^ self
       
  2181 !
       
  2182 
       
  2183 doSave
       
  2184     currentFileName notNil ifTrue:[
       
  2185 	self saveAs:currentFileName
       
  2186     ] ifFalse:[
       
  2187 	self doSaveAs
       
  2188     ]
       
  2189 !
       
  2190 
       
  2191 doSaveAs
       
  2192     fileBox isNil ifTrue:[
       
  2193 	fileBox := FileSelectionBox
       
  2194 			title:''
       
  2195 			"pattern:'*.draw'"
       
  2196 			okText:''
       
  2197 			abortText:(Resource name:'BUILDER_ABORT_LABEL'
       
  2198 					fromFile:'Builder.rs')
       
  2199 			action:[nil]
       
  2200     ].
       
  2201     fileBox title:(Resource name:'BUILDER_SAVE_TITLE' fromFile:'Builder.rs').
       
  2202     fileBox action:[:fileName | self saveAs:fileName].
       
  2203     fileBox okText:(Resource name:'BUILDER_SAVE_OK_LABEL' fromFile:'Builder.rs').
       
  2204     fileBox showAtPointer
       
  2205 !
       
  2206 
       
  2207 doSource
       
  2208    |code v|
       
  2209 
       
  2210    code := workView generateCode.
       
  2211    v := CodeView open.
       
  2212    v contents:code.
       
  2213    v label:(workView applicationName).
       
  2214     ^ self
       
  2215 
       
  2216     "Modified: 5.9.1995 / 21:02:05 / claus"
       
  2217 !
       
  2218 
       
  2219 doWindowSpec
       
  2220    |code v|
       
  2221 
       
  2222    code := workView generateWindowSpec.
       
  2223    v := CodeView open.
       
  2224    v contents:code.
       
  2225    v label:'windowSpec'.
       
  2226     ^ self
       
  2227 
       
  2228     "Modified: 5.9.1995 / 21:04:14 / claus"
       
  2229 !
       
  2230 
       
  2231 propertySelectionChanged
       
  2232     workView singleSelectionDo:[:selectedView |
       
  2233         propertyShown   := whichProperty selection.
       
  2234         self showPropertyView
       
  2235     ]
       
  2236 !
       
  2237 
       
  2238 selectOutlet:nr
       
  2239     |outlet type sel text box action initialText initialList
       
  2240      view prop t val|
       
  2241 
       
  2242     outlet := outletView selectionValue.
       
  2243     outletView deselect.
       
  2244     view := workView selection.
       
  2245     view isNil ifTrue:[
       
  2246         self notify:'select something first'.
       
  2247         ^ self
       
  2248     ].
       
  2249     action := [:s | self setOutlet:sel type:type to:s in:view].
       
  2250     (outlet = 'label') ifTrue:[
       
  2251         type := #string.
       
  2252         sel := #label:.
       
  2253         text := 'label-text:'.
       
  2254         initialText := view label
       
  2255     ].
       
  2256     (outlet = 'fixed size') ifTrue:[
       
  2257         type := #boolean.
       
  2258         sel := #sizeFixed:.
       
  2259         text := 'size is fix:'.
       
  2260     ].
       
  2261     (outlet = 'frame shown') ifTrue:[
       
  2262         type := #boolean.
       
  2263         sel := #showFrame:.
       
  2264         text := 'frame is to be drawn:'.
       
  2265     ].
       
  2266     (outlet = 'labels') ifTrue:[
       
  2267         type := #strings.
       
  2268         sel := #labels:.
       
  2269         initialText := view labels
       
  2270     ].
       
  2271     (outlet = 'contents') ifTrue:[
       
  2272         type := #text.
       
  2273         sel := #contents:.
       
  2274         initialText := view contents
       
  2275     ].
       
  2276     (outlet = 'initialText') ifTrue:[
       
  2277         type := #string.
       
  2278         sel := #initialText:.
       
  2279         initialText := view contents
       
  2280     ].
       
  2281     (outlet = 'field type') ifTrue:[
       
  2282         type := #fieldTypeSymbol.
       
  2283         sel := #type:.
       
  2284         initialList := #(number    
       
  2285                          string
       
  2286                          password
       
  2287                         ).
       
  2288         initialText := view converter isNil ifTrue:[#string] ifFalse:[view converter type].
       
  2289     ].
       
  2290     (outlet = 'field length') ifTrue:[
       
  2291         type := #numberOrNil.
       
  2292         sel := #maxChars:.
       
  2293         text := 'field length (empty -> unlimited)'.
       
  2294         initialText := view maxChars isNil ifTrue:[''] ifFalse:[view maxChars printString].
       
  2295     ].
       
  2296     (outlet = 'level') ifTrue:[
       
  2297         type := #number.
       
  2298         sel := #level:.
       
  2299         initialText := view level printString
       
  2300     ].
       
  2301     (outlet = 'active level') ifTrue:[
       
  2302         type := #number.
       
  2303         sel := #onLevel:.
       
  2304         initialText := view onLevel printString
       
  2305     ].
       
  2306     (outlet = 'passive level') ifTrue:[
       
  2307         type := #number.
       
  2308         sel := #offLevel:.
       
  2309         initialText := view offLevel printString
       
  2310     ].
       
  2311     (outlet = 'iconic-label') ifTrue:[
       
  2312         type := #form.
       
  2313         sel := #label:.
       
  2314         text := 'label-icon:'
       
  2315     ].
       
  2316     (outlet = 'view background-color') ifTrue:[
       
  2317         type := #color.
       
  2318         sel := #viewBackground:.
       
  2319         text := 'view background color'.
       
  2320         initialText := 'Black'
       
  2321     ].
       
  2322     (outlet = 'foreground-color') ifTrue:[
       
  2323         type := #color.
       
  2324         sel := #foregroundColor:.
       
  2325         text := 'foreground color'.
       
  2326         initialText := 'Black'
       
  2327     ].
       
  2328     (outlet = 'background-color') ifTrue:[
       
  2329         type := #color.
       
  2330         sel := #backgroundColor:.
       
  2331         text := 'background color'.
       
  2332         initialText := 'Grey'
       
  2333     ].
       
  2334     (outlet = 'active foreground-color') ifTrue:[
       
  2335         type := #color.
       
  2336         sel := #activeForegroundColor:.
       
  2337         text := 'active foreground color'.
       
  2338         initialText := 'Yellow'
       
  2339     ].
       
  2340     (outlet = 'active background-color') ifTrue:[
       
  2341         type := #color.
       
  2342         sel := #activeBackgroundColor:.
       
  2343         text := 'active background color'.
       
  2344         initialText := 'Grey'
       
  2345     ].
       
  2346     (outlet = 'scroll action') ifTrue:[
       
  2347         type := #block.
       
  2348         sel := #scrollAction:.
       
  2349         text := 'action block when scrolled'
       
  2350     ].
       
  2351     (outlet = 'scrollUp action') ifTrue:[
       
  2352         type := #block.
       
  2353         sel := #scrollUpAction:.
       
  2354         text := 'action block when scrolled up'
       
  2355     ].
       
  2356     (outlet = 'scrollDown action') ifTrue:[
       
  2357         type := #block.
       
  2358         sel := #scrollDownAction:.
       
  2359         text := 'action block when scrolled down'
       
  2360     ].
       
  2361     (outlet = 'scrollLeft action') ifTrue:[
       
  2362         type := #block.
       
  2363         sel := #scrollLeftAction:.
       
  2364         text := 'action block when scrolled left'
       
  2365     ].
       
  2366     (outlet = 'scrollRight action') ifTrue:[
       
  2367         type := #block.
       
  2368         sel := #scrollRightAction:.
       
  2369         text := 'action block when scrolled right'
       
  2370     ].
       
  2371     (outlet = 'press action') ifTrue:[
       
  2372         type := #block.
       
  2373         sel := #pressAction:.
       
  2374         text := 'action block when pressed'
       
  2375     ].
       
  2376     (outlet = 'release action') ifTrue:[
       
  2377         type := #block.
       
  2378         sel := #releaseAction:.
       
  2379         text := 'action block when released'
       
  2380     ].
       
  2381     (outlet = 'style') ifTrue:[
       
  2382         type := #symbol.
       
  2383         sel := #style:.
       
  2384         initialList := #(motif next)
       
  2385     ].
       
  2386     (outlet = 'handle position') ifTrue:[
       
  2387         type := #symbol.
       
  2388         sel := #handlePosition:.
       
  2389         initialList := #(left center right)
       
  2390     ].
       
  2391     (outlet = 'horizontal layout') ifTrue:[
       
  2392         type := #symbol.
       
  2393         sel := #horizontalLayout:.
       
  2394         text := 'horizontal components layout'.
       
  2395         initialList := #(left
       
  2396                          leftSpace
       
  2397                          leftMax
       
  2398                          leftSpaceMax
       
  2399                          center 
       
  2400                          centerMax 
       
  2401                          right 
       
  2402                          rightSpace 
       
  2403                          rightMax 
       
  2404                          rightSpaceMax 
       
  2405                          spread 
       
  2406                          spreadSpace 
       
  2407                          spreadMax 
       
  2408                          spreadSpaceMax 
       
  2409                          fit
       
  2410                          fitSpace).
       
  2411         initialText := view horizontalLayout printString
       
  2412     ].
       
  2413     (outlet = 'vertical layout') ifTrue:[
       
  2414         type := #symbol.
       
  2415         sel := #verticalLayout:.
       
  2416         text := 'vertical components layout'.
       
  2417         initialList := #(top    
       
  2418                          topSpace
       
  2419                          center 
       
  2420                          bottom 
       
  2421                          bottomSpace 
       
  2422                          spread 
       
  2423                          spreadSpace 
       
  2424                          fit
       
  2425                          fitSpace).
       
  2426         initialText := view verticalLayout printString
       
  2427     ].
       
  2428     (outlet = 'label position') ifTrue:[
       
  2429         type := #symbol.
       
  2430         sel := #labelPosition:.
       
  2431         initialList := #(topLeft topCenter topRight bottomLeft bottomCenter bottomRight).
       
  2432         initialText := view labelPosition printString
       
  2433     ].
       
  2434     (outlet = 'label layout') ifTrue:[
       
  2435         type := #symbol.
       
  2436         sel := #adjust:.
       
  2437         initialList := #( left right center centerLeft centerRight fit ).
       
  2438         initialText := view adjust printString
       
  2439     ].
       
  2440     (outlet = 'orientation') ifTrue:[
       
  2441         type := #symbol.
       
  2442         sel := #orientation:.
       
  2443         initialList := #( horizontal vertical ).
       
  2444         initialText := view orientation printString
       
  2445     ].
       
  2446 
       
  2447     (type == #color) ifTrue:[
       
  2448         initialList := #('Black'
       
  2449                          'White'
       
  2450                          'LightGrey'
       
  2451                          'Grey'
       
  2452                          'DarkGrey'
       
  2453                          'Yellow'
       
  2454                          'Red'
       
  2455                          'Green'
       
  2456                          'Blue'
       
  2457                         )
       
  2458     ].
       
  2459 
       
  2460     text isNil ifTrue:[
       
  2461         text := outlet
       
  2462     ].
       
  2463 
       
  2464     "what type of box do we need"
       
  2465 
       
  2466     t := type.
       
  2467     ((type == #color) or:[type == #symbol or:[type == #fieldTypeSymbol]]) ifTrue:[
       
  2468         t := #list
       
  2469     ].
       
  2470     ((type == #number) or:[type == #numberOrNil]) ifTrue:[
       
  2471         t := #string
       
  2472     ].
       
  2473     (type == #strings) ifTrue:[
       
  2474         t := #text
       
  2475     ].
       
  2476     (type == #block) ifTrue:[
       
  2477         t := #text.
       
  2478         initialText := workView outletValueOf:sel for:view.
       
  2479         initialText isNil ifTrue:[initialText := '[statements]']
       
  2480     ].
       
  2481     (type == #block1) ifTrue:[
       
  2482         t := #text.
       
  2483         type := #block.
       
  2484         initialText := workView outletValueOf:sel for:view.
       
  2485         initialText isNil ifTrue:[initialText := '[:argument | statements ]']
       
  2486     ].
       
  2487     (type == #block2) ifTrue:[
       
  2488         t := #text.
       
  2489         type := #block.
       
  2490         initialText := workView outletValueOf:sel for:view.
       
  2491         initialText isNil ifTrue:[initialText := '[:arg1 :arg2 | statements ]']
       
  2492     ].
       
  2493 
       
  2494     "show a box to enter thing"
       
  2495 
       
  2496     (t == #boolean) ifTrue:[
       
  2497         val := Dialog confirmWithCancel:text.
       
  2498         (val == true or:[val == false]) ifTrue:[
       
  2499             action value:val
       
  2500         ].
       
  2501         ^ self
       
  2502     ].
       
  2503     (t == #string) ifTrue:[
       
  2504 "/        stringBox isNil ifTrue:[
       
  2505             stringBox := EnterBox new.
       
  2506 "/        ].
       
  2507         box := stringBox
       
  2508     ].
       
  2509     (t == #list) ifTrue:[
       
  2510 "/        listBox isNil ifTrue:[
       
  2511             listBox := ListSelectionBox new.
       
  2512 "/        ].
       
  2513         listBox list:initialList.
       
  2514         box := listBox
       
  2515     ].
       
  2516     (t == #text) ifTrue:[
       
  2517 "/        actionBox isNil ifTrue:[
       
  2518             actionBox := TextBox new.
       
  2519 "/        ].
       
  2520         actionBox initialText:initialText.
       
  2521         box := actionBox
       
  2522     ].
       
  2523 "
       
  2524 Transcript show:'outlet: '. Transcript showCR:outlet.
       
  2525 Transcript show:'type:   '. Transcript showCR:type.
       
  2526 Transcript show:'sel:    '. Transcript showCR:sel.
       
  2527 Transcript show:'text:   '. Transcript showCR:text.
       
  2528 "
       
  2529 
       
  2530     box isNil ifTrue:[
       
  2531         self notify:'not yet implemented'
       
  2532     ] ifFalse:[
       
  2533         box initialText:initialText.
       
  2534         box title:text.
       
  2535         box action:action.
       
  2536         box showAtPointer
       
  2537     ]
       
  2538 
       
  2539     "Modified: 6.9.1995 / 13:46:29 / claus"
       
  2540 !
       
  2541 
       
  2542 setColors
       
  2543     |fg bg|
       
  2544 
       
  2545     fg := fgChannel value.
       
  2546     (fg notNil and:[fg notEmpty]) ifTrue:[
       
  2547         fg := Color readFrom:fg.
       
  2548         workView singleSelectionDo:[:selectedView |
       
  2549             selectedView ~~ workView ifTrue:[
       
  2550                 selectedView foregroundColor:fg
       
  2551             ].
       
  2552         ].
       
  2553     ].
       
  2554     bg := bgChannel value.
       
  2555     (bg notNil and:[bg notEmpty]) ifTrue:[
       
  2556         bg := Color readFrom:bg.
       
  2557         workView singleSelectionDo:[:selectedView |
       
  2558             selectedView ~~ workView ifTrue:[
       
  2559                 selectedView backgroundColor:bg
       
  2560             ].
       
  2561         ].
       
  2562     ].
       
  2563 !
       
  2564 
       
  2565 setMiscAspects
       
  2566     "sent when apply is pressen in the misc-sub view"
       
  2567 
       
  2568     workView singleSelectionDo:[:selectedView |
       
  2569         selectedView ~~ workView ifTrue:[
       
  2570             workView changeVariableNameOf:selectedView to:nameChannel value
       
  2571         ]
       
  2572     ].
       
  2573 !
       
  2574 
       
  2575 setModelAspects
       
  2576     "sent when apply is pressen in the model-sub view"
       
  2577 
       
  2578     |aspectSymbol|
       
  2579 
       
  2580     aspectSymbol := aspectChannel value.
       
  2581     (aspectSymbol notNil and:[aspectSymbol notEmpty]) ifTrue:[
       
  2582         aspectSymbol := aspectSymbol asSymbol.
       
  2583         workView singleSelectionDo:[:selectedView |
       
  2584             selectedView ~~ workView ifTrue:[
       
  2585                 workView setAspectSelector:aspectSymbol forView:selectedView
       
  2586             ].
       
  2587         ].
       
  2588     ].
       
  2589 !
       
  2590 
       
  2591 setOutlet:outletSymbol type:type to:outletValue in:aView
       
  2592     |block val messageSymbol|
       
  2593 
       
  2594     messageSymbol := outletSymbol.
       
  2595     val := outletValue.
       
  2596     (type == #block) ifTrue:[
       
  2597 	block := Compiler evaluate:val.
       
  2598 	(block == #Error) ifTrue:[
       
  2599 	    self warn:'action will not work in test-mode'.
       
  2600 	    workView addOutletDefinitionFor:outletSymbol
       
  2601 				       type:type
       
  2602 				      value:outletValue
       
  2603 					for:aView.
       
  2604 	    ^ self
       
  2605 	].
       
  2606 	val := block
       
  2607     ].
       
  2608     (type == #number) ifTrue:[
       
  2609 	val := Number readFromString:outletValue onError:0 
       
  2610     ].
       
  2611     (type == #numberOrNil) ifTrue:[
       
  2612 	val := Number readFromString:outletValue onError:nil
       
  2613     ].
       
  2614     (type == #text) ifTrue:[
       
  2615 	val := outletValue asString
       
  2616     ].
       
  2617     (type == #strings) ifTrue:[
       
  2618 	val := outletValue asText
       
  2619     ].
       
  2620     (type == #symbol) ifTrue:[
       
  2621 	val := outletValue asSymbol.
       
  2622     ].
       
  2623     (type == #fieldTypeSymbol) ifTrue:[
       
  2624 	val := outletValue asSymbol.
       
  2625 	val == #password ifTrue:[
       
  2626 	    aView passwordCharacter:$*
       
  2627 	] ifFalse:[
       
  2628 	    aView passwordCharacter:nil
       
  2629 	].
       
  2630 	val := (PrintConverter new initFor:val).
       
  2631 	messageSymbol := #converter:
       
  2632     ].
       
  2633     (type == #color) ifTrue:[
       
  2634 	val := Color name:outletValue.
       
  2635 	val isNil ifTrue:[
       
  2636 	    self warn:('no such color:' , outletValue).
       
  2637 	    ^ self
       
  2638 	]
       
  2639     ].
       
  2640 Transcript show:(val printString).
       
  2641 Transcript showCR:('(' , val class printString , ')').
       
  2642 
       
  2643     workView selectionHiddenDo:[
       
  2644 	aView perform:messageSymbol with:val.
       
  2645 	workView elementChanged:aView.
       
  2646 	aView redraw.
       
  2647     ].
       
  2648     workView addOutletDefinitionFor:outletSymbol
       
  2649 			       type:type
       
  2650 			      value:outletValue
       
  2651 				for:aView
       
  2652 
       
  2653     "Modified: 6.9.1995 / 13:44:46 / claus"
       
  2654 !
       
  2655 
       
  2656 showPropertyView
       
  2657     |v l spec|
       
  2658 
       
  2659     workView singleSelectionDo:[:selectedView |
       
  2660         propertyShown = 'dimension' ifTrue:[
       
  2661             (l := selectedView geometryLayout) notNil ifTrue:[
       
  2662                 l isLayout ifTrue:[
       
  2663                     l isAlignmentOrigin ifTrue:[
       
  2664                         spec := self class geometrySpecForAlignmentOrigin
       
  2665                     ] ifFalse:[
       
  2666                         l isLayoutFrame ifFalse:[
       
  2667                             spec := self class geometrySpecForLayoutOrigin
       
  2668                         ]
       
  2669                     ]
       
  2670                 ]
       
  2671             ].
       
  2672             spec isNil ifTrue:[
       
  2673                 spec := self class geometrySpecForLayoutFrame
       
  2674             ].
       
  2675             ^ self setupPropertyFromSpec:spec
       
  2676         ].
       
  2677 
       
  2678         propertyShown = 'colors' ifTrue:[
       
  2679             ^ self setupPropertyFromSpec:(self class colorSpec)
       
  2680         ].
       
  2681 
       
  2682         propertyShown = 'model' ifTrue:[
       
  2683             ^ self setupPropertyFromSpec:(self class modelSpec)
       
  2684         ].
       
  2685 
       
  2686         propertyShown = 'misc' ifTrue:[
       
  2687             ^ self setupPropertyFromSpec:(self class miscSpec)
       
  2688         ].
       
  2689 
       
  2690         propertyShown = 'attribute list' ifTrue:[
       
  2691             specShown ~~ #attributeList ifTrue:[
       
  2692                 propertyFrame destroySubViews.
       
  2693                 v := ScrollableView for:SelectionInListView in:propertyFrame.
       
  2694                 v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
       
  2695                 outletView := v scrolledView.
       
  2696                 outletView action:[:lineNr | lineNr notNil ifTrue:[self selectOutlet:lineNr]].
       
  2697                 propertyFrame realizeAllSubViews.
       
  2698                 specShown := #attributeList.
       
  2699             ].
       
  2700             self showOutletsFor:(workView selection).
       
  2701             ^ self
       
  2702         ].
       
  2703     ].
       
  2704 
       
  2705     propertyFrame destroySubViews.
       
  2706     outletView := nil.
       
  2707     specShown := nil.
       
  2708 
       
  2709 !
       
  2710 
       
  2711 toggleTest
       
  2712     |m t|
       
  2713 
       
  2714     m := menu menuAt:#test.
       
  2715     t := workView testMode not.
       
  2716 
       
  2717     t ifTrue:[
       
  2718         m labelAt:#toggleTest put:(resources string:'test off')
       
  2719     ] ifFalse:[
       
  2720         m labelAt:#toggleTest put:(resources string:'test on')
       
  2721     ].
       
  2722     workView testMode:t
       
  2723 ! !
       
  2724 
       
  2725 !UIPainter class methodsFor:'documentation'!
       
  2726 
       
  2727 version
       
  2728     ^ '$Header$'
       
  2729 ! !