UIPainter.st
changeset 176 a9e5b1615761
parent 174 0e87610c2768
child 177 eefd69a52f5b
equal deleted inserted replaced
175:0b0b4d99e3e7 176:a9e5b1615761
   337     ^
   337     ^
   338      
   338      
   339        #(#FullSpec
   339        #(#FullSpec
   340           #'window:' 
   340           #'window:' 
   341            #(#WindowSpec
   341            #(#WindowSpec
   342               #'name:' 'uIPainterView'
   342               #'name:' 'Painter'
   343               #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
   343               #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
   344               #'label:' 'unnamed canvas'
   344               #'label:' 'Painter'
   345               #'bounds:' #(#Rectangle 0 0 392 223)
   345               #'bounds:' #(#Rectangle 0 0 334 158)
   346           )
   346           )
   347           #'component:' 
   347           #'component:' 
   348            #(#SpecCollection
   348            #(#SpecCollection
   349               #'collection:' 
   349               #'collection:' 
   350                #(
   350                #(
   351                  #(#LabelSpec
   351                  #(#LabelSpec
   352                     #'name:' 'label1'
   352                     #'name:' 'classLabel'
   353                     #'layout:' #(#LayoutFrame 10 0 50 0 110 0 70 0)
   353                     #'layout:' #(#AlignmentOrigin 43 0 58 0 0 1)
   354                     #'label:' 'class:'
   354                     #'label:' 'class:'
   355                     #'adjust:' #right
   355                     #'adjust:' #right
       
   356                     #'resizeForLabel:' true
   356                 )
   357                 )
   357                  #(#LabelSpec
   358                  #(#LabelSpec
   358                     #'name:' 'label2'
   359                     #'name:' 'superClassLabel'
   359                     #'layout:' #(#LayoutFrame 10 0 90 0 110 0 110 0)
   360                     #'layout:' #(#AlignmentOrigin 12 0 84 0 0 1)
   360                     #'label:' 'superclass:'
   361                     #'label:' 'superclass:'
   361                     #'adjust:' #right
   362                     #'adjust:' #right
       
   363                     #'resizeForLabel:' true
   362                 )
   364                 )
   363                  #(#LabelSpec
   365                  #(#LabelSpec
   364                     #'name:' 'label3'
   366                     #'name:' 'selectorLabel'
   365                     #'layout:' #(#LayoutFrame 10 0 130 0 110 0 150 0)
   367                     #'layout:' #(#AlignmentOrigin 27 0 112 0 0 1)
   366                     #'label:' 'selector:'
   368                     #'label:' 'selector:'
   367                     #'adjust:' #right
   369                     #'adjust:' #right
       
   370                     #'resizeForLabel:' true
       
   371                 )
       
   372                  #(#InputFieldSpec
       
   373                     #'name:' 'methodNameField'
       
   374                     #'layout:' #(#LayoutFrame 90 0 95 0 -5 1.0 117 0)
       
   375                     #'tabable:' true
       
   376                     #'model:' #methodNameChannel
       
   377                 )
       
   378                  #(#LabelSpec
       
   379                     #'name:' 'boxLabel'
       
   380                     #'layout:' #(#Point 5 10)
       
   381                     #'label:' 'class & selector for code:'
       
   382                     #'adjust:' #left
       
   383                     #'resizeForLabel:' true
   368                 )
   384                 )
   369                  #(#InputFieldSpec
   385                  #(#InputFieldSpec
   370                     #'name:' 'classNameField'
   386                     #'name:' 'classNameField'
   371                     #'layout:' #(#LayoutFrame 120 0 50 0 -2 1.0 72 0)
   387                     #'layout:' #(#LayoutFrame 90 0 39 0 -5 1.0 61 0)
   372                     #'tabable:' true
   388                     #'tabable:' true
   373                     #'model:' #classNameChannel
   389                     #'model:' #classNameChannel
   374                 )
   390                 )
   375                  #(#InputFieldSpec
       
   376                     #'name:' 'methodNameField'
       
   377                     #'layout:' #(#LayoutFrame 120 0 130 0 -2 1.0 152 0)
       
   378                     #'tabable:' true
       
   379                     #'model:' #methodNameChannel
       
   380                 )
       
   381                  #(#ActionButtonSpec
       
   382                     #'name:' 'button1'
       
   383                     #'layout:' #(#AlignmentOrigin -2 0.5 195 0 1 0.5)
       
   384                     #'label:' 'cancel'
       
   385                     #'tabable:' true
       
   386                     #'model:' #cancel
       
   387                 )
       
   388                  #(#ActionButtonSpec
       
   389                     #'name:' 'button2'
       
   390                     #'layout:' #(#AlignmentOrigin 2 0.5 195 0 0 0.5)
       
   391                     #'label:' 'ok'
       
   392                     #'tabable:' true
       
   393                     #'isDefault:' true
       
   394                     #'model:' #accept
       
   395                 )
       
   396                  #(#LabelSpec
       
   397                     #'name:' 'boxLabel'
       
   398                     #'layout:' #(#LayoutFrame 0 0.0 11 0 0 1.0 32 0)
       
   399                     #'label:' 'class & selector for code:'
       
   400                     #'adjust:' #left
       
   401                 )
       
   402                  #(#ComboBoxSpec
   391                  #(#ComboBoxSpec
   403                     #'name:' 'comboBox1'
   392                     #'name:' 'comboBox1'
   404                     #'layout:' #(#LayoutFrame 120 0 90 0 -2 1.0 112 0)
   393                     #'layout:' #(#LayoutFrame 90 0 67 0 -5 1.0 89 0)
   405                     #'tabable:' true
   394                     #'tabable:' true
   406                     #'model:' #superclassNameChannel
   395                     #'model:' #superclassNameChannel
   407                     #'immediateAccept:' false
       
   408                     #'acceptOnLeave:' true
       
   409                     #'acceptOnLostFocus:' true
       
   410                     #'comboList:' #superclassNameDefaults
   396                     #'comboList:' #superclassNameDefaults
       
   397                 )
       
   398                  #(#HorizontalPanelViewSpec
       
   399                     #'name:' 'commitPanel'
       
   400                     #'layout:' #(#LayoutFrame 0 0.0 -24 1.0 0 1.0 0 1.0)
       
   401                     #'component:' 
       
   402                      #(#SpecCollection
       
   403                         #'collection:' 
       
   404                          #(
       
   405                            #(#ActionButtonSpec
       
   406                               #'name:' 'button1'
       
   407                               #'label:' 'cancel'
       
   408                               #'tabable:' true
       
   409                               #'model:' #cancel
       
   410                               #'extent:' #(#Point 162 24)
       
   411                           )
       
   412                            #(#ActionButtonSpec
       
   413                               #'name:' 'button2'
       
   414                               #'label:' 'ok'
       
   415                               #'tabable:' true
       
   416                               #'isDefault:' true
       
   417                               #'model:' #accept
       
   418                               #'extent:' #(#Point 163 24)
       
   419                           )
       
   420                         )
       
   421                     )
       
   422                     #'horizontalLayout:' #fitSpace
       
   423                     #'verticalLayout:' #fit
       
   424                     #'horizontalSpace:' 3
       
   425                     #'verticalSpace:' 3
   411                 )
   426                 )
   412               )
   427               )
   413           )
   428           )
   414       )
   429       )
   415 
       
   416     "Modified: 17.6.1997 / 13:02:12 / cg"
       
   417 !
   430 !
   418 
   431 
   419 windowSpec
   432 windowSpec
   420     "this window spec was automatically generated by the ST/X UIPainter"
   433     "this window spec was automatically generated by the ST/X UIPainter"
   421 
   434 
  1220 !
  1233 !
  1221 
  1234 
  1222 defineClassAndSelector
  1235 defineClassAndSelector
  1223     "launch a dialog to define class, superclass and method"
  1236     "launch a dialog to define class, superclass and method"
  1224 
  1237 
  1225     |again|
  1238     |again tmp|
  1226 
  1239 
  1227     [
  1240     [
  1228         again := false.
  1241         again := false.
  1229 
  1242 
  1230         aspects at:#classNameChannel put:specClass asValue.
  1243         (tmp := specClass) isNil ifTrue:[tmp := 'NewApplication'].
  1231         aspects at:#methodNameChannel put:specSelector asValue.
  1244         aspects at:#classNameChannel put:tmp asValue.
  1232         aspects at:#superclassNameChannel put:specSuperclass asValue.
  1245 
       
  1246         (tmp := specSelector) isNil ifTrue:[tmp := 'windowSpec'].
       
  1247         aspects at:#methodNameChannel put:tmp asValue.
       
  1248 
       
  1249         (tmp := specSuperclass) isNil ifTrue:[tmp := 'ApplicationModel'].
       
  1250         aspects at:#superclassNameChannel put:tmp asValue.
  1233 
  1251 
  1234         (self openDialogInterface:#nameAndSelectorSpec) ifTrue:[
  1252         (self openDialogInterface:#nameAndSelectorSpec) ifTrue:[
  1235 
  1253 
  1236             specClass := (self aspectFor:#classNameChannel) value.
  1254             specClass := (self aspectFor:#classNameChannel) value.
  1237             specSelector := (self aspectFor:#methodNameChannel) value.
  1255             specSelector := (self aspectFor:#methodNameChannel) value.
  1398     src := src contents.
  1416     src := src contents.
  1399     Compiler compile:src forClass:cls class inCategory:'help specs'
  1417     Compiler compile:src forClass:cls class inCategory:'help specs'
  1400 !
  1418 !
  1401 
  1419 
  1402 doInstallSpec
  1420 doInstallSpec
  1403     |code|
  1421     |code painter|
  1404 
  1422 
  1405     (specClass isNil or:[specSelector isNil]) ifTrue:[
  1423     (specClass isNil or:[specSelector isNil]) ifTrue:[
  1406         self defineClassAndSelector
  1424         self defineClassAndSelector
  1407     ].
  1425     ].
  1408 
  1426 
  1409     self checkClassAndSelector ifFalse:[
  1427     self checkClassAndSelector ifFalse:[
  1410         ^ self
  1428         ^ self
  1411     ].
  1429     ].
  1412 
  1430     painter := self painter.
  1413     self painter className:specClass
  1431 
  1414             superclassName:specSuperclass
  1432     painter className:specClass
  1415                   selector:specSelector.
  1433        superclassName:specSuperclass
  1416 
  1434              selector:specSelector.
  1417     code := self painter generateCode.
  1435 
       
  1436     code := painter generateWindowSpecMethodSource withCRs.
       
  1437     painter resetModification.
  1418     (ReadStream on:code) fileIn.
  1438     (ReadStream on:code) fileIn.
  1419 
  1439 
  1420 !
  1440 !
  1421 
  1441 
  1422 doNew
  1442 doNew