UIPainter.st
changeset 54 d0b5a33e6df0
parent 50 fb4359c9bdc4
child 55 19e021c8f1ef
equal deleted inserted replaced
53:d03569a6ff03 54:d0b5a33e6df0
   950           )
   950           )
   951       )
   951       )
   952 
   952 
   953 
   953 
   954 
   954 
       
   955 !
       
   956 
       
   957 propertyFrameSpec
       
   958     "this window spec was automatically generated by the ST/X UIPainter"
       
   959 
       
   960     "do not manually edit this - the painter/builder may not be able to
       
   961      handle the specification if its corrupted."
       
   962 
       
   963     "UIPainter new openOnClass:UIPainter andSelector:#propertyFrameSpec"
       
   964     "UIPainter new openInterface:#propertyFrameSpec"
       
   965 
       
   966     <resource: #canvas>
       
   967 
       
   968     ^
       
   969      
       
   970        #(#FullSpec
       
   971           #'window:' 
       
   972            #(#WindowSpec
       
   973               #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
       
   974               #'label:' 'unnamed'
       
   975               #'bounds:' #(#Rectangle 0 0 309 326)
       
   976           )
       
   977           #'component:' 
       
   978            #(#SpecCollection
       
   979               #'collection:' 
       
   980                #(
       
   981                  #(#ArbitraryComponentSpec
       
   982                     #'name:' 'view1'
       
   983                     #'layout:' #(#LayoutFrame 0 0 0 0 0 1.0 -40 1.0)
       
   984                 )
       
   985                  #(#ActionButtonSpec
       
   986                     #'name:' 'button1'
       
   987                     #'layout:' #(#LayoutFrame 108 0 291 0 200 0 323 0)
       
   988                     #'label:' 'apply'
       
   989                 )
       
   990               )
       
   991           )
       
   992       )
   955 ! !
   993 ! !
   956 
   994 
   957 !UIPainter methodsFor:'BuilderView interface'!
   995 !UIPainter methodsFor:'BuilderView interface'!
   958 
   996 
   959 setUndoLabel:aString
   997 update:something
   960     aString isNil ifTrue:[
       
   961         (menu menuAt:#edit) labelAt:#undoAction put:'undo'.
       
   962         (menu menuAt:#edit) disable:#undoAction
       
   963     ] ifFalse:[
       
   964         (menu menuAt:#edit) labelAt:#undoAction put:'undo: ' , aString.
       
   965         (menu menuAt:#edit) enable:#undoAction
       
   966     ]
       
   967 !
       
   968 
       
   969 update:something with:parameter
       
   970     |singleSelection|
   998     |singleSelection|
   971 
   999 
   972     elementMenu deselect.
  1000     elementMenu deselect.
   973 
       
   974     something == #undoHistory ifTrue:[
       
   975         ^ self setUndoLabel:parameter
       
   976     ].
       
   977 
  1001 
   978     singleSelection := workView singleSelection.
  1002     singleSelection := workView singleSelection.
   979 
  1003 
   980     (something == #layout or:[something == #any]) ifTrue:[
  1004     (something == #layout or:[something == #any]) ifTrue:[
   981         singleSelection notNil ifTrue:[
  1005         singleSelection notNil ifTrue:[
  1218 !
  1242 !
  1219 
  1243 
  1220 initPullDownMenu
  1244 initPullDownMenu
  1221     menu labels:(resources  array:#(
  1245     menu labels:(resources  array:#(
  1222                                     'file'
  1246                                     'file'
  1223                                     'edit'
       
  1224                                     'font'
  1247                                     'font'
  1225                                     'type'
  1248                                     'type'
  1226                                     'align'
  1249                                     'align'
  1227                                     'dimension'
  1250                                     'dimension'
  1228                                     'form'
       
  1229                                     'special'
  1251                                     'special'
  1230                                     'code'
  1252                                     'code'
  1231                                     'debug'
  1253                                     'debug'
  1232                                     'test'
  1254                                     'test'
  1233                                  )).
  1255                                  )).
  1234 
  1256 
  1235     menu selectors:#(#file
  1257     menu selectors:#(#file
  1236                      #edit
       
  1237                      #font
  1258                      #font
  1238                      #type
  1259                      #type
  1239                      #align 
  1260                      #align 
  1240                      #dimension 
  1261                      #dimension 
  1241                      #form
       
  1242                      #special
  1262                      #special
  1243                      #code
  1263                      #code
  1244                      #debugging
       
  1245                      #test
  1264                      #test
  1246                     ).
  1265                     ).
  1247 
  1266 
  1248     menu at:#file 
  1267     menu at:#file 
  1249             putLabels:(resources  array:
  1268             putLabels:(resources  array:
  1281                         nil 
  1300                         nil 
  1282                         doFinish
  1301                         doFinish
  1283                        )
  1302                        )
  1284              receiver:self.
  1303              receiver:self.
  1285 
  1304 
  1286     menu at:#edit 
       
  1287             putLabels:(resources  array:#(
       
  1288                         'undo' 
       
  1289 "/                        'copy' 
       
  1290                         'cut'
       
  1291 "/                        'paste'
       
  1292                        ))
       
  1293             selectors:#(
       
  1294                         undoAction
       
  1295 "/                        copySelection 
       
  1296                         deleteSelection
       
  1297 "/                        pasteBuffer
       
  1298                        )
       
  1299              receiver:workView.
       
  1300 
       
  1301     menu at:#font 
  1305     menu at:#font 
  1302             putLabels:(resources  array:#(
  1306             putLabels:(resources  array:#(
  1303                         'larger' 
  1307                         'larger' 
  1304                         'smaller'
  1308                         'smaller'
  1305                         '-'
  1309                         '-'
  1342                         nil
  1346                         nil
  1343                         showAllWidgets
  1347                         showAllWidgets
  1344                        )
  1348                        )
  1345              receiver:self.
  1349              receiver:self.
  1346 
  1350 
  1347     menu at:#align 
  1351     menu at:#align     putMenu:(workView subMenuAlign menuView).
  1348             putLabels:(resources  array:#(
  1352     menu at:#dimension putMenu:(workView subMenuDimension menuView).
  1349 "/                        'raise' 
       
  1350 "/                        'lower'
       
  1351 "/                        '-'
       
  1352                         'align left' 
       
  1353                         'align right'
       
  1354                         'align left & right'
       
  1355                         'align top' 
       
  1356                         'align bottom'
       
  1357                         'align centered vertical'
       
  1358                         'align centered horizontal'
       
  1359                         '-'
       
  1360                         'spread horizontal'
       
  1361                         'spread vertical'
       
  1362                         'center horizontal in frame'
       
  1363                         'center vertical in frame'
       
  1364                        ) )
       
  1365             selectors:#(
       
  1366 "/                        raiseSelection 
       
  1367 "/                        lowerSelection
       
  1368 "/                        nil
       
  1369                         alignSelectionLeft
       
  1370                         alignSelectionRight
       
  1371                         alignSelectionLeftAndRight
       
  1372                         alignSelectionTop
       
  1373                         alignSelectionBottom
       
  1374                         alignSelectionCenterHor
       
  1375                         alignSelectionCenterVer
       
  1376                         nil
       
  1377                         spreadSelectionHor
       
  1378                         spreadSelectionVer
       
  1379                         centerSelectionHor
       
  1380                         centerSelectionVer
       
  1381                        )
       
  1382              receiver:workView.
       
  1383 
       
  1384     menu at:#dimension 
       
  1385             putLabels:(resources  array:#(
       
  1386                         'default extent' 
       
  1387                         'default width' 
       
  1388                         'default height'
       
  1389                         '-'
       
  1390                         'copy extent' 
       
  1391                         'paste extent'
       
  1392                         'paste width'
       
  1393                         'paste height'
       
  1394                         '-'
       
  1395                         'insert'
       
  1396                        ) )
       
  1397             selectors:#(
       
  1398                         setToDefaultExtent
       
  1399                         setToDefaultWidth
       
  1400                         setToDefaultHeight
       
  1401                         nil
       
  1402                         copyExtent
       
  1403                         pasteExtent
       
  1404                         pasteWidth
       
  1405                         pasteHeight
       
  1406                         nil
       
  1407                         insertSelection
       
  1408                        )
       
  1409              receiver:workView.
       
  1410 
       
  1411     menu at:#form 
       
  1412             putLabels:(resources  array:#(
       
  1413                         'align to grid'
       
  1414                         'show grid' 
       
  1415                        ) )
       
  1416             selectors:#(
       
  1417                         alignOn
       
  1418                         toggleGrid
       
  1419                        )
       
  1420              receiver:self.
       
  1421 
  1353 
  1422     menu at:#special 
  1354     menu at:#special 
  1423             putLabels:(resources  array:#(
  1355             putLabels:(resources  array:#(
  1424                         'group radioButtons' 
  1356                         'group radioButtons' 
  1425                         'group enterFields' 
  1357                         'group enterFields' 
  1437             selectors:#(
  1369             selectors:#(
  1438                         defineClassAndSelector
  1370                         defineClassAndSelector
  1439                        )
  1371                        )
  1440              receiver:self.
  1372              receiver:self.
  1441 
  1373 
  1442     menu at:#debugging 
       
  1443             putLabels:(resources array:#(
       
  1444                         'inspect'
       
  1445                         'inspect attributes'
       
  1446                        ) )
       
  1447             selectors:#(
       
  1448                         inspectSelection
       
  1449                         inspectAttributes
       
  1450                        )
       
  1451              receiver:workView.
       
  1452 
       
  1453     menu at:#test 
  1374     menu at:#test 
  1454             putLabels:(resources array:#(
  1375             putLabels:(resources array:#(
  1455                         'test on' 
  1376                         'test on' 
  1456                        ) )
  1377                        ) )
  1457             selectors:#(toggleTest 
  1378             selectors:#(toggleTest 
  1458                        )
  1379                        )
  1459              receiver:self.
  1380              receiver:self.
  1460 
       
  1461     self setUndoLabel:nil.
       
  1462 !
  1381 !
  1463 
  1382 
  1464 openInterface 
  1383 openInterface 
  1465     |list panel topPane botPanel v 
  1384     |list panel topPane botPanel v 
  1466      leftPanel middlePanel rightPanel buttonPanel propSelector|
  1385      leftPanel middlePanel rightPanel buttonPanel propSelector|
  2104     "apply is pressed in the geometry-sub view, with a layoutOrigin selected
  2023     "apply is pressed in the geometry-sub view, with a layoutOrigin selected
  2105     "
  2024     "
  2106     self setupPropertyFromSpec:(self class geometrySpecForLayoutOrigin)
  2025     self setupPropertyFromSpec:(self class geometrySpecForLayoutOrigin)
  2107 ! !
  2026 ! !
  2108 
  2027 
  2109 !UIPainter methodsFor:'user actions - form'!
       
  2110 
       
  2111 alignOff
       
  2112     |m|
       
  2113 
       
  2114     m := menu menuAt:#form.
       
  2115     m labelAt:#alignOff put:(resources string:'align to grid').
       
  2116     m selectorAt:#alignOff put:#alignOn.
       
  2117     workView alignOff
       
  2118 !
       
  2119 
       
  2120 alignOn
       
  2121     |m|
       
  2122 
       
  2123     m := menu menuAt:#form.
       
  2124     m labelAt:#alignOn put:(resources string:'do not align to grid').
       
  2125     m selectorAt:#alignOn put:#alignOff.
       
  2126     workView alignOn
       
  2127 !
       
  2128 
       
  2129 toggleGrid
       
  2130     |m|
       
  2131 
       
  2132     m := menu menuAt:#form.
       
  2133 
       
  2134     workView gridShown ifFalse:[
       
  2135         m labelAt:#toggleGrid put:(resources string:'hide grid').
       
  2136         workView showGrid
       
  2137     ] ifTrue:[
       
  2138         m labelAt:#toggleGrid put:(resources string:'show grid').
       
  2139         workView hideGrid
       
  2140     ]
       
  2141 ! !
       
  2142 
       
  2143 !UIPainter methodsFor:'user interaction'!
  2028 !UIPainter methodsFor:'user interaction'!
  2144 
  2029 
  2145 closeRequest
  2030 closeRequest
  2146     workView  notNil ifTrue:[workView  release. workView := nil].
  2031     workView  notNil ifTrue:[workView  release. workView := nil].
  2147     super closeRequest
  2032     super closeRequest