UIPainter.st
changeset 177 eefd69a52f5b
parent 176 a9e5b1615761
child 179 72eec92090f6
equal deleted inserted replaced
176:a9e5b1615761 177:eefd69a52f5b
   337     ^
   337     ^
   338      
   338      
   339        #(#FullSpec
   339        #(#FullSpec
   340           #'window:' 
   340           #'window:' 
   341            #(#WindowSpec
   341            #(#WindowSpec
   342               #'name:' 'Painter'
   342               #'name:' 'uIPainterView'
   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:' 'Painter'
   344               #'label:' 'Painter'
   345               #'bounds:' #(#Rectangle 0 0 334 158)
   345               #'bounds:' #(#Rectangle 0 0 391 170)
   346           )
   346           )
   347           #'component:' 
   347           #'component:' 
   348            #(#SpecCollection
   348            #(#SpecCollection
   349               #'collection:' 
   349               #'collection:' 
   350                #(
   350                #(
   351                  #(#LabelSpec
   351                  #(#LabelSpec
   352                     #'name:' 'classLabel'
   352                     #'name:' 'classLabel'
   353                     #'layout:' #(#AlignmentOrigin 43 0 58 0 0 1)
   353                     #'layout:' #(#AlignmentOrigin 45 0.11 51 0 1 0.5)
   354                     #'label:' 'class:'
   354                     #'label:' 'class:'
   355                     #'adjust:' #right
   355                     #'adjust:' #right
   356                     #'resizeForLabel:' true
   356                     #'resizeForLabel:' true
   357                 )
   357                 )
   358                  #(#LabelSpec
   358                  #(#LabelSpec
   359                     #'name:' 'superClassLabel'
   359                     #'name:' 'superClassLabel'
   360                     #'layout:' #(#AlignmentOrigin 12 0 84 0 0 1)
   360                     #'layout:' #(#AlignmentOrigin 45 0.11 77 0 1 0.5)
   361                     #'label:' 'superclass:'
   361                     #'label:' 'superclass:'
   362                     #'adjust:' #right
   362                     #'adjust:' #right
   363                     #'resizeForLabel:' true
   363                     #'resizeForLabel:' true
   364                 )
   364                 )
   365                  #(#LabelSpec
   365                  #(#LabelSpec
   366                     #'name:' 'selectorLabel'
   366                     #'name:' 'selectorLabel'
   367                     #'layout:' #(#AlignmentOrigin 27 0 112 0 0 1)
   367                     #'layout:' #(#AlignmentOrigin 45 0.11 105 0 1 0.5)
   368                     #'label:' 'selector:'
   368                     #'label:' 'selector:'
   369                     #'adjust:' #right
   369                     #'adjust:' #right
   370                     #'resizeForLabel:' true
   370                     #'resizeForLabel:' true
   371                 )
   371                 )
   372                  #(#InputFieldSpec
   372                  #(#InputFieldSpec
   373                     #'name:' 'methodNameField'
   373                     #'name:' 'methodNameField'
   374                     #'layout:' #(#LayoutFrame 90 0 95 0 -5 1.0 117 0)
   374                     #'layout:' #(#LayoutFrame 47 0.11 95 0 -5 1.0 117 0)
   375                     #'tabable:' true
   375                     #'tabable:' true
   376                     #'model:' #methodNameChannel
   376                     #'model:' #methodNameChannel
   377                 )
   377                 )
   378                  #(#LabelSpec
   378                  #(#LabelSpec
   379                     #'name:' 'boxLabel'
   379                     #'name:' 'boxLabel'
   382                     #'adjust:' #left
   382                     #'adjust:' #left
   383                     #'resizeForLabel:' true
   383                     #'resizeForLabel:' true
   384                 )
   384                 )
   385                  #(#InputFieldSpec
   385                  #(#InputFieldSpec
   386                     #'name:' 'classNameField'
   386                     #'name:' 'classNameField'
   387                     #'layout:' #(#LayoutFrame 90 0 39 0 -5 1.0 61 0)
   387                     #'layout:' #(#LayoutFrame 47 0.11 39 0 -5 1.0 61 0)
   388                     #'tabable:' true
   388                     #'tabable:' true
   389                     #'model:' #classNameChannel
   389                     #'model:' #classNameChannel
   390                 )
   390                 )
   391                  #(#ComboBoxSpec
   391                  #(#ComboBoxSpec
   392                     #'name:' 'comboBox1'
   392                     #'name:' 'comboBox1'
   393                     #'layout:' #(#LayoutFrame 90 0 67 0 -5 1.0 89 0)
   393                     #'layout:' #(#LayoutFrame 47 0.11 67 0 -5 1.0 89 0)
   394                     #'tabable:' true
   394                     #'tabable:' true
   395                     #'model:' #superclassNameChannel
   395                     #'model:' #superclassNameChannel
   396                     #'comboList:' #superclassNameDefaults
   396                     #'comboList:' #superclassNameDefaults
   397                 )
   397                 )
   398                  #(#HorizontalPanelViewSpec
   398                  #(#HorizontalPanelViewSpec
   405                            #(#ActionButtonSpec
   405                            #(#ActionButtonSpec
   406                               #'name:' 'button1'
   406                               #'name:' 'button1'
   407                               #'label:' 'cancel'
   407                               #'label:' 'cancel'
   408                               #'tabable:' true
   408                               #'tabable:' true
   409                               #'model:' #cancel
   409                               #'model:' #cancel
   410                               #'extent:' #(#Point 162 24)
   410                               #'extent:' #(#Point 191 24)
   411                           )
   411                           )
   412                            #(#ActionButtonSpec
   412                            #(#ActionButtonSpec
   413                               #'name:' 'button2'
   413                               #'name:' 'button2'
   414                               #'label:' 'ok'
   414                               #'label:' 'ok'
   415                               #'tabable:' true
   415                               #'tabable:' true
   416                               #'isDefault:' true
   416                               #'isDefault:' true
   417                               #'model:' #accept
   417                               #'model:' #accept
   418                               #'extent:' #(#Point 163 24)
   418                               #'extent:' #(#Point 191 24)
   419                           )
   419                           )
   420                         )
   420                         )
   421                     )
   421                     )
   422                     #'horizontalLayout:' #fitSpace
   422                     #'horizontalLayout:' #fitSpace
   423                     #'verticalLayout:' #fit
   423                     #'verticalLayout:' #fit
   425                     #'verticalSpace:' 3
   425                     #'verticalSpace:' 3
   426                 )
   426                 )
   427               )
   427               )
   428           )
   428           )
   429       )
   429       )
       
   430 
       
   431     "Modified: 24.6.1997 / 18:50:14 / cg"
   430 !
   432 !
   431 
   433 
   432 windowSpec
   434 windowSpec
   433     "this window spec was automatically generated by the ST/X UIPainter"
   435     "this window spec was automatically generated by the ST/X UIPainter"
   434 
   436 
   989 !
   991 !
   990 
   992 
   991 raiseUIView:aView
   993 raiseUIView:aView
   992     aView map.
   994     aView map.
   993     aView bePartner.
   995     aView bePartner.
       
   996 !
       
   997 
       
   998 setClass:cls selector:selector
       
   999     |clsName superClassName|
       
  1000 
       
  1001     clsName := cls name.
       
  1002     superClassName := cls superclass name.
       
  1003 
       
  1004     (self aspectFor:#classNameChannel) value:clsName.
       
  1005     (self aspectFor:#methodNameChannel) value:(selector ? '').
       
  1006     (self aspectFor:#superclassNameChannel) value:superClassName.
       
  1007 
       
  1008     self painter 
       
  1009             className:clsName 
       
  1010             superclassName:superClassName
       
  1011             selector:(selector ? '').
       
  1012 
       
  1013     specClass := clsName.
       
  1014     specSelector := (selector ? '').
       
  1015     specSuperclass := superClassName.
       
  1016 
       
  1017     "Modified: 24.6.1997 / 19:07:01 / cg"
   994 ! !
  1018 ! !
   995 
  1019 
   996 !UIPainter methodsFor:'queries'!
  1020 !UIPainter methodsFor:'queries'!
   997 
  1021 
   998 isHelpToolSelected
  1022 isHelpToolSelected
  1159 
  1183 
  1160     self openInterface.
  1184     self openInterface.
  1161 
  1185 
  1162     aClass notNil ifTrue:[
  1186     aClass notNil ifTrue:[
  1163         painter        := self painter.
  1187         painter        := self painter.
  1164         specClass      := aClass name.
  1188 
  1165         specSuperclass := aClass superclass name.
  1189         self setClass:aClass selector:aSelector.
  1166         specSelector   := aSelector.
  1190 "/        specClass      := aClass name.
  1167 
  1191 "/        specSuperclass := aClass superclass name.
  1168         (aspects at:#classNameChannel) value:specClass.
  1192 "/        specSelector   := aSelector.
  1169         (aspects at:#superclassNameChannel) value:specSuperclass.
  1193 "/
  1170         (aspects at:#methodNameChannel) value:specSelector asSymbol.
  1194 "/        (aspects at:#classNameChannel) value:specClass.
  1171 
  1195 "/        (aspects at:#superclassNameChannel) value:specSuperclass.
  1172         painter className:aClass name.
  1196 "/        (aspects at:#methodNameChannel) value:specSelector asSymbol.
  1173         painter methodName:aSelector.
  1197 "/
       
  1198 "/        painter 
       
  1199 "/            className:aClass name 
       
  1200 "/            superclassName:aClass superclass name
       
  1201 "/            selector:aSelector.
       
  1202 
  1174         painter setupFromSpec:(aClass perform:aSelector).
  1203         painter setupFromSpec:(aClass perform:aSelector).
  1175     ]
  1204     ]
  1176 
  1205 
  1177     "Modified: 17.6.1997 / 14:41:25 / cg"
  1206     "Modified: 24.6.1997 / 19:07:05 / cg"
  1178 ! !
  1207 ! !
  1179 
  1208 
  1180 !UIPainter methodsFor:'user interaction - dialog'!
  1209 !UIPainter methodsFor:'user interaction - dialog'!
  1181 
  1210 
  1182 checkClassAndSelector
  1211 checkClassAndSelector
  1301         (self confirm:'edit another interface without saving your modifications ?') ifFalse:[
  1330         (self confirm:'edit another interface without saving your modifications ?') ifFalse:[
  1302             ^ self
  1331             ^ self
  1303         ]
  1332         ]
  1304     ].
  1333     ].
  1305 
  1334 
  1306     className  := '' asValue.
  1335     className  := (specClass ? '') asValue.
  1307     methodName := '' asValue.
  1336     methodName := (specSelector ? '') asValue.
  1308     painter    := self painter.
  1337     painter    := self painter.
  1309 
  1338 
  1310     (s := painter className) notNil ifTrue:[
  1339     (s := painter className) notNil ifTrue:[
  1311         className value:s
  1340         className value:s
  1312     ].
  1341     ].
  1343                     spec isArray ifFalse:[
  1372                     spec isArray ifFalse:[
  1344                         failed := true.
  1373                         failed := true.
  1345                         self warn:'not a windowSpec method'    
  1374                         self warn:'not a windowSpec method'    
  1346                     ].
  1375                     ].
  1347                     "/ ok, got it
  1376                     "/ ok, got it
  1348                     painter className:className value.
  1377                 
  1349                     painter methodName:methodName value.
  1378                     self setClass:cls selector:sel.
       
  1379 
  1350                     painter setupFromSpec:spec.
  1380                     painter setupFromSpec:spec.
  1351                   ^ self
  1381 
       
  1382                     ^ self
  1352                  ]
  1383                  ]
  1353             ]
  1384             ]
  1354          ]
  1385          ]
  1355     ] doWhile:[accepted and:[failed]].
  1386     ] doWhile:[accepted and:[failed]].
  1356 
  1387 
  1357     "Modified: 17.6.1997 / 12:33:36 / cg"
  1388     "Modified: 24.6.1997 / 18:59:29 / cg"
  1358 !
  1389 !
  1359 
  1390 
  1360 doInstallAspects
  1391 doInstallAspects
  1361     |code|
  1392     |code|
  1362 
  1393 
  1450 
  1481 
  1451     "Modified: 17.6.1997 / 12:33:31 / cg"
  1482     "Modified: 17.6.1997 / 12:33:31 / cg"
  1452 !
  1483 !
  1453 
  1484 
  1454 doPickAView
  1485 doPickAView
  1455     |painter view className methodName cls sel accepted spec s|
  1486     |painter view cls spec|
  1456 
  1487 
  1457     objectList painter isModified ifTrue:[
  1488     objectList painter isModified ifTrue:[
  1458         (self confirm:'pick another interface without saving your modifications ?') ifFalse:[
  1489         (self confirm:'pick another interface without saving your modifications ?') ifFalse:[
  1459             ^ self
  1490             ^ self
  1460         ]
  1491         ]
  1464         view == Screen current rootView ifFalse:[
  1495         view == Screen current rootView ifFalse:[
  1465             painter := self painter.
  1496             painter := self painter.
  1466             spec    := UISpecification fromView:view topView.
  1497             spec    := UISpecification fromView:view topView.
  1467 
  1498 
  1468          "/ ok, got it
  1499          "/ ok, got it
       
  1500 
       
  1501             view application notNil ifTrue:[
       
  1502                 cls := view application class
       
  1503             ] ifFalse:[
       
  1504                 cls := view class
       
  1505             ].
       
  1506             self setClass:cls selector:nil.
       
  1507 
  1469             painter setupFromSpec:spec.
  1508             painter setupFromSpec:spec.
  1470             painter className:view class name.
       
  1471             painter methodName:#newSpec.
       
  1472         ]
  1509         ]
  1473     ]
  1510     ]
       
  1511 
       
  1512     "Modified: 24.6.1997 / 19:02:57 / cg"
  1474 !
  1513 !
  1475 
  1514 
  1476 doRaise
  1515 doRaise
  1477     |top x|
  1516     |top x|
  1478 
  1517