UIPainter.st
changeset 884 a291fc248a8b
parent 877 f31f41b29710
child 889 39d326722589
equal deleted inserted replaced
883:10afc79658a6 884:a291fc248a8b
  1501                 #label: 'Up'
  1501                 #label: 'Up'
  1502                 #translateLabel: true
  1502                 #translateLabel: true
  1503                 #value: #doStepUp
  1503                 #value: #doStepUp
  1504                 #activeHelpKey: #moveWidgetUp
  1504                 #activeHelpKey: #moveWidgetUp
  1505                 #enabled: #canChangeOrderInContainer
  1505                 #enabled: #canChangeOrderInContainer
  1506                 #labelImage: #(#ResourceRetriever #ToolApplicationModel #upIcon 'Up')
  1506                 #labelImage: #(#ResourceRetriever #Icon #upIcon 'Up')
  1507             )
  1507             )
  1508              #(#MenuItem
  1508              #(#MenuItem
  1509                 #label: 'Down'
  1509                 #label: 'Down'
  1510                 #translateLabel: true
  1510                 #translateLabel: true
  1511                 #value: #doStepDown
  1511                 #value: #doStepDown
  1512                 #activeHelpKey: #moveWidgetDown
  1512                 #activeHelpKey: #moveWidgetDown
  1513                 #enabled: #canChangeOrderInContainer
  1513                 #enabled: #canChangeOrderInContainer
  1514                 #labelImage: #(#ResourceRetriever #ToolApplicationModel #downIcon 'Down')
  1514                 #labelImage: #(#ResourceRetriever #Icon #downIcon 'Down')
  1515             )
  1515             )
  1516              #(#MenuItem
  1516              #(#MenuItem
  1517                 #label: 'Into'
  1517                 #label: 'Into'
  1518                 #translateLabel: true
  1518                 #translateLabel: true
  1519                 #value: #doStepIn
  1519                 #value: #doStepIn
  1520                 #activeHelpKey: #moveWidgetInto
  1520                 #activeHelpKey: #moveWidgetInto
  1521                 #enabled: #canMoveSelectionIntoContainer
  1521                 #enabled: #canMoveSelectionIntoContainer
  1522                 #labelImage: #(#ResourceRetriever #ToolApplicationModel #downRightIcon 'Into')
  1522                 #labelImage: #(#ResourceRetriever #Icon #downRightIcon 'Into')
  1523             )
  1523             )
  1524              #(#MenuItem
  1524              #(#MenuItem
  1525                 #label: 'Out'
  1525                 #label: 'Out'
  1526                 #translateLabel: true
  1526                 #translateLabel: true
  1527                 #value: #doStepOut
  1527                 #value: #doStepOut
  1528                 #activeHelpKey: #moveWidgetOut
  1528                 #activeHelpKey: #moveWidgetOut
  1529                 #enabled: #canMoveSelectionOutOfContainer
  1529                 #enabled: #canMoveSelectionOutOfContainer
  1530                 #labelImage: #(#ResourceRetriever #ToolApplicationModel #leftDownIcon 'Out')
  1530                 #labelImage: #(#ResourceRetriever #Icon #leftDownIcon 'Out')
  1531             )
  1531             )
  1532           ) nil
  1532           ) nil
  1533           nil
  1533           nil
  1534       )
  1534       )
  1535 
       
  1536     "Modified: / 20.5.1998 / 01:47:48 / cg"
       
  1537 !
  1535 !
  1538 
  1536 
  1539 menuToolbar
  1537 menuToolbar
  1540     "This resource specification was automatically generated
  1538     "This resource specification was automatically generated
  1541      by the MenuEditor of ST/X."
  1539      by the MenuEditor of ST/X."
  1558              #(#MenuItem
  1556              #(#MenuItem
  1559                 #label: 'Start'
  1557                 #label: 'Start'
  1560                 #isButton: true
  1558                 #isButton: true
  1561                 #value: #doStartApplication
  1559                 #value: #doStartApplication
  1562                 #activeHelpKey: #testStartApplication
  1560                 #activeHelpKey: #testStartApplication
  1563                 #labelImage: #(#ResourceRetriever nil #startIcon)
  1561                 #labelImage: #(#ResourceRetriever #Icon #startIcon)
  1564             )
  1562             )
  1565              #(#MenuItem
  1563              #(#MenuItem
  1566                 #label: ''
  1564                 #label: ''
  1567             )
  1565             )
  1568              #(#MenuItem
  1566              #(#MenuItem
  1569                 #label: 'New'
  1567                 #label: 'New'
  1570                 #isButton: true
  1568                 #isButton: true
  1571                 #value: #doNew
  1569                 #value: #doNew
  1572                 #activeHelpKey: #fileNew
  1570                 #activeHelpKey: #fileNew
  1573                 #labelImage: #(#ResourceRetriever nil #newIcon)
  1571                 #labelImage: #(#ResourceRetriever #Icon #newIcon)
  1574             )
  1572             )
  1575              #(#MenuItem
  1573              #(#MenuItem
  1576                 #label: 'Load'
  1574                 #label: 'Load'
  1577                 #isButton: true
  1575                 #isButton: true
  1578                 #value: #doLoad
  1576                 #value: #doLoad
  1579                 #activeHelpKey: #fileLoad
  1577                 #activeHelpKey: #fileLoad
  1580                 #labelImage: #(#ResourceRetriever nil #loadIcon)
  1578                 #labelImage: #(#ResourceRetriever #Icon #loadIcon)
  1581             )
  1579             )
  1582              #(#MenuItem
  1580              #(#MenuItem
  1583                 #label: 'Save'
  1581                 #label: 'Save'
  1584                 #isButton: true
  1582                 #isButton: true
  1585                 #value: #doSave
  1583                 #value: #doSave
  1586                 #activeHelpKey: #fileSave
  1584                 #activeHelpKey: #fileSave
  1587                 #labelImage: #(#ResourceRetriever nil #saveIcon)
  1585                 #labelImage: #(#ResourceRetriever #Icon #saveIcon)
  1588             )
  1586             )
  1589              #(#MenuItem
  1587              #(#MenuItem
  1590                 #label: ''
  1588                 #label: ''
  1591             )
  1589             )
  1592              #(#MenuItem
  1590              #(#MenuItem
  1593                 #label: 'Cut'
  1591                 #label: 'Cut'
  1594                 #isButton: true
  1592                 #isButton: true
  1595                 #value: #deleteSelection
  1593                 #value: #deleteSelection
  1596                 #activeHelpKey: #editCut
  1594                 #activeHelpKey: #editCut
  1597                 #enabled: #valueOfCanCut
  1595                 #enabled: #valueOfCanCut
  1598                 #labelImage: #(#ResourceRetriever nil #cutIcon)
  1596                 #labelImage: #(#ResourceRetriever #Icon #cutIcon)
  1599             )
  1597             )
  1600              #(#MenuItem
  1598              #(#MenuItem
  1601                 #label: 'Copy'
  1599                 #label: 'Copy'
  1602                 #isButton: true
  1600                 #isButton: true
  1603                 #value: #copySelection
  1601                 #value: #copySelection
  1604                 #activeHelpKey: #editCopy
  1602                 #activeHelpKey: #editCopy
  1605                 #enabled: #valueOfCanCopy
  1603                 #enabled: #valueOfCanCopy
  1606                 #labelImage: #(#ResourceRetriever nil #copyIcon)
  1604                 #labelImage: #(#ResourceRetriever #Icon #copyIcon)
  1607             )
  1605             )
  1608              #(#MenuItem
  1606              #(#MenuItem
  1609                 #label: 'Paste With Layout'
  1607                 #label: 'Paste With Layout'
  1610                 #isButton: true
  1608                 #isButton: true
  1611                 #value: #pasteWithLayout
  1609                 #value: #pasteWithLayout
  1612                 #activeHelpKey: #editPaste
  1610                 #activeHelpKey: #editPaste
  1613                 #enabled: #valueOfCanPasteWithKeepingLayout
  1611                 #enabled: #valueOfCanPasteWithKeepingLayout
  1614                 #labelImage: #(#ResourceRetriever nil #pasteIcon)
  1612                 #labelImage: #(#ResourceRetriever #Icon #pasteIcon)
  1615             )
  1613             )
  1616              #(#MenuItem
  1614              #(#MenuItem
  1617                 #label: 'Delete'
  1615                 #label: 'Delete'
  1618                 #isButton: true
  1616                 #isButton: true
  1619                 #value: #deleteTotalSelection
  1617                 #value: #deleteTotalSelection
  1620                 #activeHelpKey: #editDelete
  1618                 #activeHelpKey: #editDelete
  1621                 #enabled: #valueOfCanCut
  1619                 #enabled: #valueOfCanCut
  1622                 #labelImage: #(#ResourceRetriever nil #deleteIcon)
  1620                 #labelImage: #(#ResourceRetriever #Icon #deleteIcon)
  1623             )
  1621             )
  1624              #(#MenuItem
  1622              #(#MenuItem
  1625                 #label: ''
  1623                 #label: ''
  1626             )
  1624             )
  1627              #(#MenuItem
  1625              #(#MenuItem
  1628                 #label: 'Move Up'
  1626                 #label: 'Move Up'
  1629                 #isButton: true
  1627                 #isButton: true
  1630                 #value: #doStepUp
  1628                 #value: #doStepUp
  1631                 #activeHelpKey: #moveWidgetUp
  1629                 #activeHelpKey: #moveWidgetUp
  1632                 #enabled: #canChangeOrderInContainer
  1630                 #enabled: #canChangeOrderInContainer
  1633                 #labelImage: #(#ResourceRetriever nil #upIcon)
  1631                 #labelImage: #(#ResourceRetriever #Icon #upIcon)
  1634             )
  1632             )
  1635              #(#MenuItem
  1633              #(#MenuItem
  1636                 #label: 'Move Down'
  1634                 #label: 'Move Down'
  1637                 #isButton: true
  1635                 #isButton: true
  1638                 #value: #doStepDown
  1636                 #value: #doStepDown
  1639                 #activeHelpKey: #moveWidgetDown
  1637                 #activeHelpKey: #moveWidgetDown
  1640                 #enabled: #canChangeOrderInContainer
  1638                 #enabled: #canChangeOrderInContainer
  1641                 #labelImage: #(#ResourceRetriever nil #downIcon)
  1639                 #labelImage: #(#ResourceRetriever #Icon #downIcon)
  1642             )
  1640             )
  1643              #(#MenuItem
  1641              #(#MenuItem
  1644                 #label: 'Move Into'
  1642                 #label: 'Move Into'
  1645                 #isButton: true
  1643                 #isButton: true
  1646                 #value: #doStepIn
  1644                 #value: #doStepIn
  1647                 #activeHelpKey: #moveWidgetInto
  1645                 #activeHelpKey: #moveWidgetInto
  1648                 #enabled: #canMoveSelectionIntoContainer
  1646                 #enabled: #canMoveSelectionIntoContainer
  1649                 #labelImage: #(#ResourceRetriever nil #downRightIcon)
  1647                 #labelImage: #(#ResourceRetriever #Icon #downRightIcon)
  1650             )
  1648             )
  1651              #(#MenuItem
  1649              #(#MenuItem
  1652                 #label: 'Move Out'
  1650                 #label: 'Move Out'
  1653                 #isButton: true
  1651                 #isButton: true
  1654                 #value: #doStepOut
  1652                 #value: #doStepOut
  1655                 #activeHelpKey: #moveWidgetOut
  1653                 #activeHelpKey: #moveWidgetOut
  1656                 #enabled: #canMoveSelectionOutOfContainer
  1654                 #enabled: #canMoveSelectionOutOfContainer
  1657                 #labelImage: #(#ResourceRetriever nil #leftDownIcon)
  1655                 #labelImage: #(#ResourceRetriever #Icon #leftDownIcon)
  1658             )
  1656             )
  1659              #(#MenuItem
  1657              #(#MenuItem
  1660                 #label: ''
  1658                 #label: ''
  1661             )
  1659             )
  1662              #(#MenuItem
  1660              #(#MenuItem
  1810 hasOneSelectionOtherThanCanvas
  1808 hasOneSelectionOtherThanCanvas
  1811     "returns a value holder which is true in case that one widget is selected
  1809     "returns a value holder which is true in case that one widget is selected
  1812      other than the root"
  1810      other than the root"
  1813 
  1811 
  1814     ^ builder booleanValueAspectFor:#hasOneSelectionOtherThanCanvas
  1812     ^ builder booleanValueAspectFor:#hasOneSelectionOtherThanCanvas
       
  1813 !
       
  1814 
       
  1815 helpIcon
       
  1816 
       
  1817     ^Icon helpIcon
  1815 !
  1818 !
  1816 
  1819 
  1817 modifiedChannel
  1820 modifiedChannel
  1818     "returns a boolean value holder which is set to true if something is modified
  1821     "returns a boolean value holder which is set to true if something is modified
  1819      and not accepted"
  1822      and not accepted"
  2142         ].
  2145         ].
  2143       ^ self
  2146       ^ self
  2144     ].
  2147     ].
  2145 
  2148 
  2146     "Modified: / 29.10.1997 / 17:48:19 / cg"
  2149     "Modified: / 29.10.1997 / 17:48:19 / cg"
       
  2150 !
       
  2151 
       
  2152 updateChannels
       
  2153     "updates the channels"
       
  2154 
       
  2155     |canCutOrCopy canPaste clipboard sel|
       
  2156 
       
  2157     self canMoveOrAlignSelection        value:(treeView canMoveOrAlignSelection).
       
  2158     self canChangeOrderInContainer      value:(treeView canChangeOrderInContainer).
       
  2159     self canMoveSelectionIntoContainer  value:(treeView canMoveSelectionIntoContainer).
       
  2160     self canMoveSelectionOutOfContainer value:(treeView canMoveSelectionOutOfContainer).
       
  2161     self hasOneSelectionOtherThanCanvas value:(treeView hasOneSelectionOtherThanCanvas).
       
  2162 
       
  2163     treeView notNil
       
  2164     ifTrue:
       
  2165     [
       
  2166         canCutOrCopy := treeView selection size >= 1 and:[treeView selection first ~~ 1].
       
  2167         clipboard := self getSelection.
       
  2168 
       
  2169         clipboard isCollection ifTrue:[clipboard notEmpty ifTrue:[sel := clipboard first]]
       
  2170                               ifFalse:[sel := clipboard].
       
  2171 
       
  2172         canPaste := (sel isKindOf:UISpecification) and: 
       
  2173                     [treeView selection size  = 1 
       
  2174                     and:[treeView selection first == 1 
       
  2175                     or: [self canPasteInto: treeView selectedNode contents view]]]
       
  2176     ].
       
  2177 
       
  2178     self valueOfCanCut value: canCutOrCopy.
       
  2179     self valueOfCanCopy value: canCutOrCopy.
       
  2180     self valueOfCanPaste value: canPaste.            
       
  2181     self valueOfCanPasteWithKeepingLayout value: (canPaste "&  self canKeepLayoutInSelection").
  2147 ! !
  2182 ! !
  2148 
  2183 
  2149 !UIPainter methodsFor:'event handling'!
  2184 !UIPainter methodsFor:'event handling'!
  2150 
  2185 
  2151 doesNotUnderstand:aMessage
  2186 doesNotUnderstand:aMessage
  2513     self isModified ifTrue:[
  2548     self isModified ifTrue:[
  2514         (self confirm:'Accept modifications in section ' , tabSelection printString asBoldText, '?') ifTrue:[
  2549         (self confirm:'Accept modifications in section ' , tabSelection printString asBoldText, '?') ifTrue:[
  2515             self accept
  2550             self accept
  2516         ]
  2551         ]
  2517     ].
  2552     ].
  2518 
       
  2519     self canMoveOrAlignSelection        value:(treeView canMoveOrAlignSelection).
       
  2520     self canChangeOrderInContainer      value:(treeView canChangeOrderInContainer).
       
  2521     self canMoveSelectionIntoContainer  value:(treeView canMoveSelectionIntoContainer).
       
  2522     self canMoveSelectionOutOfContainer value:(treeView canMoveSelectionOutOfContainer).
       
  2523     self hasOneSelectionOtherThanCanvas value:(treeView hasOneSelectionOtherThanCanvas).
       
  2524 
  2553 
  2525     treeView isCanvasSelected ifTrue:[
  2554     treeView isCanvasSelected ifTrue:[
  2526         spec := treeView canvasSpec.
  2555         spec := treeView canvasSpec.
  2527         view := self painter topView.
  2556         view := self painter topView.
  2528     ] ifFalse:[
  2557     ] ifFalse:[
  2574         tabComponent enabled:false.
  2603         tabComponent enabled:false.
  2575         self defaultInfoLabel.
  2604         self defaultInfoLabel.
  2576     ].
  2605     ].
  2577     self modifiedChannel value:false.
  2606     self modifiedChannel value:false.
  2578 
  2607 
  2579     treeView notNil
  2608     self updateChannels
  2580     ifTrue:
       
  2581     [
       
  2582         canCutOrCopy := treeView selection size >= 1 and:[treeView selection first ~~ 1].
       
  2583         clipboard := self getSelection.
       
  2584 
       
  2585         clipboard isCollection ifTrue:[clipboard notEmpty ifTrue:[sel := clipboard first]]
       
  2586                               ifFalse:[sel := clipboard].
       
  2587 
       
  2588         canPaste := (sel isKindOf:UISpecification) and: 
       
  2589                     [treeView selection size  = 1 
       
  2590                     and:[treeView selection first == 1 
       
  2591                     or: [self canPasteInto: treeView selectedNode contents view]]]
       
  2592     ].
       
  2593 
       
  2594     self valueOfCanCut value: canCutOrCopy.
       
  2595     self valueOfCanCopy value: canCutOrCopy.
       
  2596     self valueOfCanPaste value: canPaste.            
       
  2597     self valueOfCanPasteWithKeepingLayout value: (canPaste &  self canKeepLayoutInSelection).
       
  2598 ! !
  2609 ! !
  2599 
  2610 
  2600 !UIPainter methodsFor:'settings'!
  2611 !UIPainter methodsFor:'settings'!
  2601 
  2612 
  2602 redefineAspectMethods
  2613 redefineAspectMethods