UIPainter.st
changeset 1230 23e5d0c133e8
parent 1211 53cfc272acc9
child 1247 6fb170b75302
equal deleted inserted replaced
1229:49777692d309 1230:23e5d0c133e8
  1334 
  1334 
  1335     ^
  1335     ^
  1336      
  1336      
  1337        #(#Menu
  1337        #(#Menu
  1338           
  1338           
  1339 	   #(
  1339            #(
  1340 	     #(#MenuItem
  1340              #(#MenuItem
  1341 		#label: 'Undo'
  1341                 #label: 'Undo'
  1342 		#translateLabel: true
  1342                 #translateLabel: true
  1343 		#nameKey: #undo
  1343                 #nameKey: #undo
  1344 		#value: #undoLast
  1344                 #value: #undoLast
  1345 		#activeHelpKey: #editUndo
  1345                 #activeHelpKey: #editUndo
  1346 		#enabled: #hasUndoHistory
  1346                 #enabled: #hasUndoHistory
  1347 		#shortcutKeyCharacter: #Cmdu
  1347                 #shortcutKeyCharacter: #Cmdu
  1348 	    )
  1348             )
  1349 	     #(#MenuItem
  1349              #(#MenuItem
  1350 		#label: '-'
  1350                 #label: '-'
  1351 	    )
  1351             )
  1352 	     #(#MenuItem
  1352              #(#MenuItem
  1353 		#label: 'Cut'
  1353                 #label: 'Cut'
  1354 		#translateLabel: true
  1354                 #translateLabel: true
  1355 		#value: #deleteSelection
  1355                 #value: #deleteSelection
  1356 		#activeHelpKey: #editCut
  1356                 #activeHelpKey: #editCut
  1357 		#enabled: #valueOfCanCut
  1357                 #enabled: #valueOfCanCut
  1358 		#shortcutKeyCharacter: #Cut
  1358                 #shortcutKeyCharacter: #Cut
  1359 	    )
  1359             )
  1360 	     #(#MenuItem
  1360              #(#MenuItem
  1361 		#label: 'Copy'
  1361                 #label: 'Copy'
  1362 		#translateLabel: true
  1362                 #translateLabel: true
  1363 		#value: #copySelection
  1363                 #value: #copySelection
  1364 		#activeHelpKey: #editCopy
  1364                 #activeHelpKey: #editCopy
  1365 		#enabled: #valueOfCanCopy
  1365                 #enabled: #valueOfCanCopy
  1366 		#shortcutKeyCharacter: #Copy
  1366                 #shortcutKeyCharacter: #Copy
  1367 	    )
  1367             )
  1368 	     #(#MenuItem
  1368              #(#MenuItem
  1369 		#label: 'Paste'
  1369                 #label: 'Paste'
  1370 		#translateLabel: true
  1370                 #translateLabel: true
  1371 		#value: #pasteBuffer
  1371                 #value: #pasteBuffer
  1372 		#activeHelpKey: #pasteBuffer
  1372                 #activeHelpKey: #pasteBuffer
  1373 		#enabled: #valueOfCanPaste
  1373                 #enabled: #valueOfCanPaste
  1374 		#shortcutKeyCharacter: #Paste
  1374                 #shortcutKeyCharacter: #Paste
  1375 	    )
  1375             )
  1376 	     #(#MenuItem
  1376              #(#MenuItem
  1377 		#label: 'Delete'
  1377                 #label: 'Delete'
  1378 		#translateLabel: true
  1378                 #translateLabel: true
  1379 		#value: #deleteTotalSelection
  1379                 #value: #deleteTotalSelection
  1380 		#activeHelpKey: #editDelete
  1380                 #activeHelpKey: #editDelete
  1381 		#enabled: #valueOfCanCut
  1381                 #enabled: #valueOfCanCut
  1382 		#shortcutKeyCharacter: #Delete
  1382                 #shortcutKeyCharacter: #Delete
  1383 	    )
  1383             )
  1384 	     #(#MenuItem
  1384              #(#MenuItem
  1385 		#label: '-'
  1385                 #label: '-'
  1386 	    )
  1386             )
  1387 	     #(#MenuItem
  1387              #(#MenuItem
  1388 		#label: 'Paste With Layout'
  1388                 #label: 'Paste With Layout'
  1389 		#translateLabel: true
  1389                 #translateLabel: true
  1390 		#value: #pasteWithLayout
  1390                 #value: #pasteWithLayout
  1391 		#activeHelpKey: #pasteWithLayout
  1391                 #activeHelpKey: #pasteWithLayout
  1392 		#enabled: #valueOfCanPasteWithKeepingLayout
  1392                 #enabled: #valueOfCanPasteWithKeepingLayout
  1393 	    )
  1393             )
  1394 	     #(#MenuItem
  1394              #(#MenuItem
  1395 		#label: '-'
  1395                 #label: '-'
  1396 	    )
  1396             )
  1397 	     #(#MenuItem
  1397              #(#MenuItem
  1398 		#label: 'Move'
  1398                 #label: 'Move'
  1399 		#translateLabel: true
  1399                 #translateLabel: true
  1400 		#enabled: #canMoveSelection
  1400                 #enabled: #canMoveSelection
  1401 		#submenuChannel: #menuMove
  1401                 #submenuChannel: #menuMove
  1402 	    )
  1402             )
  1403 	     #(#MenuItem
  1403              #(#MenuItem
  1404 		#label: 'Dimension'
  1404                 #label: 'Dimension'
  1405 		#translateLabel: true
  1405                 #translateLabel: true
  1406 		#enabled: #hasSelection
  1406                 #enabled: #hasSelection
  1407 		#submenu: 
  1407                 #submenu: 
  1408 		 #(#Menu
  1408                  #(#Menu
  1409                     
  1409                     
  1410 		     #(
  1410                      #(
  1411 		       #(#MenuItem
  1411                        #(#MenuItem
  1412 			  #label: 'Default Extent'
  1412                           #label: 'Default Extent'
  1413 			  #translateLabel: true
  1413                           #translateLabel: true
  1414 			  #value: #setToDefaultExtent
  1414                           #value: #setToDefaultExtent
  1415 			  #activeHelpKey: #editDimensionDefaultExtent
  1415                           #activeHelpKey: #editDimensionDefaultExtent
  1416 			  #enabled: #canMoveOrAlignSelection
  1416                           #enabled: #canMoveOrAlignSelection
  1417 		      )
  1417                       )
  1418 		       #(#MenuItem
  1418                        #(#MenuItem
  1419 			  #label: 'Default Width'
  1419                           #label: 'Default Width'
  1420 			  #translateLabel: true
  1420                           #translateLabel: true
  1421 			  #value: #setToDefaultWidth
  1421                           #value: #setToDefaultWidth
  1422 			  #activeHelpKey: #editDimensionDefaultWidth
  1422                           #activeHelpKey: #editDimensionDefaultWidth
  1423 			  #enabled: #canMoveOrAlignSelection
  1423                           #enabled: #canMoveOrAlignSelection
  1424 		      )
  1424                       )
  1425 		       #(#MenuItem
  1425                        #(#MenuItem
  1426 			  #label: 'Default Height'
  1426                           #label: 'Default Height'
  1427 			  #translateLabel: true
  1427                           #translateLabel: true
  1428 			  #value: #setToDefaultHeight
  1428                           #value: #setToDefaultHeight
  1429 			  #activeHelpKey: #editDimensionDefaultHeight
  1429                           #activeHelpKey: #editDimensionDefaultHeight
  1430 			  #enabled: #canMoveOrAlignSelection
  1430                           #enabled: #canMoveOrAlignSelection
  1431 		      )
  1431                       )
  1432 		       #(#MenuItem
  1432                        #(#MenuItem
  1433 			  #label: '-'
  1433                           #label: '-'
  1434 		      )
  1434                       )
  1435 		       #(#MenuItem
  1435                        #(#MenuItem
  1436 			  #label: 'Copy Layout'
  1436                           #label: 'Copy Layout'
  1437 			  #translateLabel: true
  1437                           #translateLabel: true
  1438 			  #value: #copyLayout
  1438                           #value: #copyLayout
  1439 			  #activeHelpKey: #editDimensionCopyLayout
  1439                           #activeHelpKey: #editDimensionCopyLayout
  1440 			  #enabled: #hasSingleSelection
  1440                           #enabled: #hasSingleSelection
  1441 		      )
  1441                       )
  1442 		       #(#MenuItem
  1442                        #(#MenuItem
  1443 			  #label: 'Copy Extent'
  1443                           #label: 'Paste Layout'
  1444 			  #translateLabel: true
  1444                           #translateLabel: true
  1445 			  #value: #copyExtent
  1445                           #value: #pasteLayout
  1446 			  #activeHelpKey: #editDimensionCopyExtent
  1446                           #activeHelpKey: #editDimensionPasteLayout
  1447 			  #enabled: #hasSingleSelection
  1447                           #enabled: #canMoveOrAlignSelection
  1448 		      )
  1448                       )
  1449 		       #(#MenuItem
  1449                        #(#MenuItem
  1450 			  #label: '-'
  1450                           #label: 'Exchange Layouts'
  1451 		      )
  1451                           #translateLabel: true
  1452 		       #(#MenuItem
  1452                           #value: #exchangeLayouts
  1453 			  #label: 'Paste Layout'
  1453                           #activeHelpKey: #editDimensionExchangeLayouts
  1454 			  #translateLabel: true
  1454                           #enabled: #canExchangeSelectionLayouts
  1455 			  #value: #pasteLayout
  1455                       )
  1456 			  #activeHelpKey: #editDimensionPasteLayout
  1456                        #(#MenuItem
  1457 			  #enabled: #canMoveOrAlignSelection
  1457                           #label: '-'
  1458 		      )
  1458                       )
  1459 		       #(#MenuItem
  1459                        #(#MenuItem
  1460 			  #label: 'Paste Extent'
  1460                           #label: 'Copy Extent'
  1461 			  #translateLabel: true
  1461                           #translateLabel: true
  1462 			  #value: #pasteExtent
  1462                           #value: #copyExtent
  1463 			  #activeHelpKey: #editDimensionPasteExtent
  1463                           #activeHelpKey: #editDimensionCopyExtent
  1464 			  #enabled: #canMoveOrAlignSelection
  1464                           #enabled: #hasSingleSelection
  1465 		      )
  1465                       )
  1466 		       #(#MenuItem
  1466                        #(#MenuItem
  1467 			  #label: 'Paste Width'
  1467                           #label: 'Paste Extent'
  1468 			  #translateLabel: true
  1468                           #translateLabel: true
  1469 			  #value: #pasteWidth
  1469                           #value: #pasteExtent
  1470 			  #activeHelpKey: #editDimensionPasteWidth
  1470                           #activeHelpKey: #editDimensionPasteExtent
  1471 			  #enabled: #canMoveOrAlignSelection
  1471                           #enabled: #canMoveOrAlignSelection
  1472 		      )
  1472                       )
  1473 		       #(#MenuItem
  1473                        #(#MenuItem
  1474 			  #label: 'Paste Height'
  1474                           #label: 'Paste Width'
  1475 			  #translateLabel: true
  1475                           #translateLabel: true
  1476 			  #value: #pasteHeight
  1476                           #value: #pasteWidth
  1477 			  #activeHelpKey: #editDimensionPasteHeight
  1477                           #activeHelpKey: #editDimensionPasteWidth
  1478 			  #enabled: #canMoveOrAlignSelection
  1478                           #enabled: #canMoveOrAlignSelection
  1479 		      )
  1479                       )
  1480 		    ) nil
  1480                        #(#MenuItem
  1481 		    nil
  1481                           #label: 'Paste Height'
  1482 		)
  1482                           #translateLabel: true
  1483 	    )
  1483                           #value: #pasteHeight
  1484 	     #(#MenuItem
  1484                           #activeHelpKey: #editDimensionPasteHeight
  1485 		#label: '-'
  1485                           #enabled: #canMoveOrAlignSelection
  1486 	    )
  1486                       )
  1487 	     #(#MenuItem
  1487                     ) nil
  1488 		#label: 'Open Widget Documentation'
  1488                     nil
  1489 		#translateLabel: true
  1489                 )
  1490 		#value: #doOpenWidgetDocumentation
  1490             )
  1491 		#activeHelpKey: #editOpenSpecDocumentation
  1491              #(#MenuItem
  1492 	    )
  1492                 #label: '-'
  1493 	     #(#MenuItem
  1493             )
  1494 		#label: '-'
  1494              #(#MenuItem
  1495 	    )
  1495                 #label: 'Open Widget Documentation'
  1496 	     #(#MenuItem
  1496                 #translateLabel: true
  1497 		#label: 'Inspect View'
  1497                 #value: #doOpenWidgetDocumentation
  1498 		#translateLabel: true
  1498                 #activeHelpKey: #editOpenSpecDocumentation
  1499 		#value: #doInspectView
  1499             )
  1500 		#activeHelpKey: #editInspectView
  1500              #(#MenuItem
  1501 		#enabled: #hasOneSelectionOtherThanCanvas
  1501                 #label: '-'
  1502 	    )
  1502             )
  1503 	     #(#MenuItem
  1503              #(#MenuItem
  1504 		#label: 'Inspect Spec'
  1504                 #label: 'Inspect View'
  1505 		#translateLabel: true
  1505                 #translateLabel: true
  1506 		#value: #doInspectSpec
  1506                 #value: #doInspectView
  1507 		#activeHelpKey: #editInspectSpec
  1507                 #activeHelpKey: #editInspectView
  1508 	    )
  1508                 #enabled: #hasOneSelectionOtherThanCanvas
  1509 	  ) nil
  1509             )
  1510 	  nil
  1510              #(#MenuItem
       
  1511                 #label: 'Inspect Spec'
       
  1512                 #translateLabel: true
       
  1513                 #value: #doInspectSpec
       
  1514                 #activeHelpKey: #editInspectSpec
       
  1515             )
       
  1516           ) nil
       
  1517           nil
  1511       )
  1518       )
  1512 
  1519 
  1513     "Modified: / 20.5.1998 / 01:46:00 / cg"
  1520     "Modified: / 20.5.1998 / 01:46:00 / cg"
  1514 !
  1521 !
  1515 
  1522 
  1787 canChangeOrderInContainer
  1794 canChangeOrderInContainer
  1788     "returns a boolean value holder which is true if the widget order can be changed 
  1795     "returns a boolean value holder which is true if the widget order can be changed 
  1789      within their container"
  1796      within their container"
  1790 
  1797 
  1791     ^ builder booleanValueAspectFor:#canChangeOrderInContainer
  1798     ^ builder booleanValueAspectFor:#canChangeOrderInContainer
       
  1799 !
       
  1800 
       
  1801 canExchangeSelectionLayouts
       
  1802     "returns a boolean value holder which is true in case that the selection 
       
  1803      consists of exactly 2 components
       
  1804      and all widgets in the selection can change its layout through to a move or
       
  1805      align operation"
       
  1806 
       
  1807     ^ builder booleanValueAspectFor:#canExchangeSelectionLayouts
  1792 !
  1808 !
  1793 
  1809 
  1794 canMoveOrAlignSelection
  1810 canMoveOrAlignSelection
  1795     "returns a boolean value holder which is true in case that any selection exists
  1811     "returns a boolean value holder which is true in case that any selection exists
  1796      and all widgets in the selection can change its layout through to a move or
  1812      and all widgets in the selection can change its layout through to a move or
  2213     "updates the channels"
  2229     "updates the channels"
  2214 
  2230 
  2215     |canCutOrCopy canPaste clipboard sel treeSelection|
  2231     |canCutOrCopy canPaste clipboard sel treeSelection|
  2216 
  2232 
  2217     self canMoveOrAlignSelection        value:(treeView canMoveOrAlignSelection).
  2233     self canMoveOrAlignSelection        value:(treeView canMoveOrAlignSelection).
       
  2234     self canExchangeSelectionLayouts    value:(treeView canExchangeSelectionLayouts).
  2218     self canChangeOrderInContainer      value:(treeView canChangeOrderInContainer).
  2235     self canChangeOrderInContainer      value:(treeView canChangeOrderInContainer).
  2219     self canMoveSelectionIntoContainer  value:(treeView canMoveSelectionIntoContainer).
  2236     self canMoveSelectionIntoContainer  value:(treeView canMoveSelectionIntoContainer).
  2220     self canMoveSelectionOutOfContainer value:(treeView canMoveSelectionOutOfContainer).
  2237     self canMoveSelectionOutOfContainer value:(treeView canMoveSelectionOutOfContainer).
  2221     self hasOneSelectionOtherThanCanvas value:(treeView hasOneSelectionOtherThanCanvas).
  2238     self hasOneSelectionOtherThanCanvas value:(treeView hasOneSelectionOtherThanCanvas).
  2222 
  2239 
  2223     treeView notNil
  2240     treeView notNil
  2224     ifTrue:
  2241     ifTrue:
  2225     [
  2242     [
  2226 	treeSelection := treeView selection.
  2243         treeSelection := treeView selection.
  2227 	"/ the top-node cannot be cut, copied or pasted.
  2244         "/ the top-node cannot be cut, copied or pasted.
  2228 	canCutOrCopy := treeSelection size >= 1 and:[treeSelection first ~~ 1].
  2245         canCutOrCopy := treeSelection size >= 1 and:[treeSelection first ~~ 1].
  2229 	clipboard := self getSelection.
  2246         clipboard := self getSelection.
  2230 
  2247 
  2231 	clipboard isCollection ifTrue:[clipboard notEmpty ifTrue:[sel := clipboard first]]
  2248         clipboard isCollection ifTrue:[clipboard notEmpty ifTrue:[sel := clipboard first]]
  2232 			      ifFalse:[sel := clipboard].
  2249                               ifFalse:[sel := clipboard].
  2233 
  2250 
  2234 	canPaste := (sel isKindOf:UISpecification) and: 
  2251         canPaste := (sel isKindOf:UISpecification) and: 
  2235 		    [treeSelection size  = 1 
  2252                     [treeSelection size  = 1 
  2236 		    and:[treeSelection first == 1 
  2253                     and:[treeSelection first == 1 
  2237 		    or: [self canPasteInto: treeView selectedNode contents view]]]
  2254                     or: [self canPasteInto: treeView selectedNode contents view]]]
  2238     ].
  2255     ].
  2239 
  2256 
  2240     self valueOfCanCut value: canCutOrCopy.
  2257     self valueOfCanCut value: canCutOrCopy.
  2241     self valueOfCanCopy value: canCutOrCopy.
  2258     self valueOfCanCopy value: canCutOrCopy.
  2242     self valueOfCanPaste value: canPaste.            
  2259     self valueOfCanPaste value: canPaste.            
  4021     [self selectedNode parent children size > 1]] 
  4038     [self selectedNode parent children size > 1]] 
  4022 
  4039 
  4023 
  4040 
  4024 !
  4041 !
  4025 
  4042 
       
  4043 canExchangeSelectionLayouts 
       
  4044     "returns true if the selections size is exactly 2
       
  4045      and all widgets in the selection
       
  4046      can change their layout through to a move or align operation"
       
  4047 
       
  4048     selection size == 2 ifFalse:[
       
  4049         ^ false
       
  4050     ].
       
  4051     ^ self canMoveOrAlignSelection
       
  4052 !
       
  4053 
  4026 canMoveOrAlignSelection
  4054 canMoveOrAlignSelection
  4027     "returns true if any selection exists and all widgets in the selection
  4055     "returns true if any selection exists and all widgets in the selection
  4028      can change their layout through to a move or align operation"
  4056      can change their layout through to a move or align operation"
  4029 
  4057 
  4030     selection size == 0 ifTrue:[
  4058     selection size == 0 ifTrue:[