UIPainter.st
changeset 513 a0d00fecb49a
parent 512 1648b541aab5
child 518 435dcb241555
equal deleted inserted replaced
512:1648b541aab5 513:a0d00fecb49a
  1498 moveSelectionUp
  1498 moveSelectionUp
  1499     "move selected components up
  1499     "move selected components up
  1500     "
  1500     "
  1501     self painter moveSelectionUp
  1501     self painter moveSelectionUp
  1502 
  1502 
  1503 !
  1503 ! !
       
  1504 
       
  1505 !UIPainter methodsFor:'active help'!
       
  1506 
       
  1507 showHelp:aHelpText for:view
       
  1508     "display active help texts in my own info area."
       
  1509 
       
  1510     |txt|
       
  1511 
       
  1512     aHelpText isNil ifTrue:[
       
  1513         txt := nil
       
  1514     ] ifFalse:[
       
  1515         txt := self class 
       
  1516                 convertString:(aHelpText asString)
       
  1517                 maxLineSize:(transcript width // transcript font width)
       
  1518                skipLineFeed:true
       
  1519     ].
       
  1520     transcript hideCursor.
       
  1521     transcript contents:txt.
       
  1522     ^ true
       
  1523 
       
  1524     "Modified: / 29.10.1997 / 22:33:55 / cg"
       
  1525 ! !
       
  1526 
       
  1527 !UIPainter methodsFor:'aspects'!
       
  1528 
       
  1529 canMoveOrAlignSelection
       
  1530     "returns a boolean value holder which is true in case that any selection exists
       
  1531      and all widgets in the selection can change its layout through to a move or
       
  1532      align operation
       
  1533     "
       
  1534     ^ builder booleanValueAspectFor:#canMoveOrAlignSelection
       
  1535 !
       
  1536 
       
  1537 canMoveSelectionIntoContainer
       
  1538     "returns a boolean value holder which is true in case that one component is selected
       
  1539      and can change its container widget to the next element in the list which will have
       
  1540      the same container.
       
  1541     "
       
  1542     ^ builder booleanValueAspectFor:#canMoveSelectionIntoContainer
       
  1543 !
       
  1544 
       
  1545 canMoveSelectionOutOfContainer
       
  1546     "returns a boolean value holder which is true in case that one component is selected
       
  1547      which is contained within another component
       
  1548     "
       
  1549     ^ builder booleanValueAspectFor:#canMoveSelectionOutOfContainer
       
  1550 !
       
  1551 
       
  1552 enableChannel
       
  1553     "true if modifications are allowed otherwise running test
       
  1554     "
       
  1555   ^ self painter enableChannel
       
  1556 !
       
  1557 
       
  1558 galleryShown
       
  1559     "returns a boolean value holder which is set to true if the gallery is shown
       
  1560     "
       
  1561     |holder|
       
  1562 
       
  1563     (holder := builder bindingAt:#galleryShown) isNil ifTrue:[
       
  1564         builder aspectAt:#galleryShown put:(holder :=  true asValue).
       
  1565         holder addDependent:self
       
  1566     ].
       
  1567     ^ holder
       
  1568 
       
  1569 !
       
  1570 
       
  1571 hasOneSelectionOtherThanCanvas
       
  1572     "returns a value holder which is true in case that one component is selected
       
  1573      other than the canvas.
       
  1574     "
       
  1575     ^ builder booleanValueAspectFor:#hasOneSelectionOtherThanCanvas
       
  1576 !
       
  1577 
       
  1578 modifiedChannel
       
  1579     "returns a boolean value holder which is set to true if something is modified
       
  1580      and not accepted
       
  1581     "
       
  1582     ^ builder booleanValueAspectFor:#modifiedChannel
       
  1583 !
       
  1584 
       
  1585 noteBookView
       
  1586     "returns the notebook view; initialize components within the notebook
       
  1587     "
       
  1588     |noteBook channel helpTool layoutTool specTool|
       
  1589 
       
  1590     (noteBook := builder bindingAt:#noteBookView) isNil ifTrue:[
       
  1591         noteBook   := View new.
       
  1592         layoutTool := UILayoutTool new.
       
  1593         helpTool   := UIHelpTool   new.
       
  1594         helpTool helpSpecFrom:specClass.
       
  1595         specTool   := UISpecificationTool new.
       
  1596         channel    := self modifiedChannel.
       
  1597 
       
  1598         layoutTool masterApplication:self.
       
  1599         specTool   masterApplication:self.
       
  1600         helpTool   masterApplication:self.
       
  1601 
       
  1602         layoutCanvas := SubCanvas origin:0.0@0.0 corner:1.0@1.0 in:noteBook.
       
  1603         helpCanvas   := SubCanvas origin:0.0@0.0 corner:1.0@1.0 in:noteBook.
       
  1604         specCanvas   := SubCanvas origin:0.0@0.0 corner:1.0@1.0 in:noteBook.
       
  1605 
       
  1606         layoutCanvas client:layoutTool.
       
  1607         helpCanvas   client:helpTool.
       
  1608         specTool builder:(specCanvas client:specTool).
       
  1609 
       
  1610         layoutTool masterApplication:self.
       
  1611         specTool   masterApplication:self.
       
  1612         helpTool   masterApplication:self.
       
  1613 
       
  1614         layoutTool modifiedHolder:channel.
       
  1615         helpTool   modifiedHolder:channel.
       
  1616         specTool   modifiedHolder:channel.
       
  1617 
       
  1618         builder aspectAt:#noteBookView put:noteBook.
       
  1619     ].
       
  1620     ^ noteBook
       
  1621 !
       
  1622 
       
  1623 painterShown
       
  1624     "returns a boolean value holder which is set to true if the painter is shown
       
  1625     "
       
  1626     |holder|
       
  1627 
       
  1628     (holder := builder bindingAt:#painterShown) isNil ifTrue:[
       
  1629         builder aspectAt:#painterShown put:(holder :=  true asValue).
       
  1630         holder addDependent:self
       
  1631     ].
       
  1632     ^ holder
       
  1633 
       
  1634 !
       
  1635 
       
  1636 tabList
       
  1637     "returns a value holder which keeps a list of labels assigned to the tabs
       
  1638     "
       
  1639     |holder|
       
  1640 
       
  1641     (holder := builder bindingAt:#tabList) isNil ifTrue:[
       
  1642         builder aspectAt:#tabList put:(holder :=  ValueHolder new).
       
  1643         holder value:#( 'Properties' ).
       
  1644     ].
       
  1645     ^ holder
       
  1646 !
       
  1647 
       
  1648 tabModel
       
  1649     "returns a value holder which keeps the current name of the tab selected
       
  1650     "
       
  1651     |holder|
       
  1652 
       
  1653     (holder := builder bindingAt:#tabModel) isNil ifTrue:[
       
  1654         holder := AspectAdaptor new subject:self; forAspect:#tabSelection.
       
  1655         builder aspectAt:#tabModel put:holder.
       
  1656     ].
       
  1657     ^ holder
       
  1658 !
       
  1659 
       
  1660 treeView
       
  1661     "returns the selection tree view which holds all widget identifiers
       
  1662     "
       
  1663     ^ treeView
       
  1664 ! !
       
  1665 
       
  1666 !UIPainter methodsFor:'binding access'!
       
  1667 
       
  1668 aspectFor:aKey
       
  1669     "aspect for a key
       
  1670     "
       
  1671   ^ aspects at:aKey ifAbsent:[ super aspectFor:aKey ]
       
  1672 ! !
       
  1673 
       
  1674 !UIPainter methodsFor:'buildin editors'!
  1504 
  1675 
  1505 openDataSetColumnEditor
  1676 openDataSetColumnEditor
  1506     "opens a column editor
  1677     "opens a column editor
  1507     "
  1678     "
  1508     |cls aspect editor columns|
  1679     |cls aspect editor columns|
  1606             self specTool specification hierarchicalList:editor selectorName asSymbol.
  1777             self specTool specification hierarchicalList:editor selectorName asSymbol.
  1607             self modifiedChannel value:true.
  1778             self modifiedChannel value:true.
  1608             self accept
  1779             self accept
  1609         ]
  1780         ]
  1610     ]
  1781     ]
  1611 ! !
  1782 !
  1612 
  1783 
  1613 !UIPainter methodsFor:'active help'!
  1784 openTabItemEditor
  1614 
  1785     "opens a column editor
  1615 showHelp:aHelpText for:view
  1786     "
  1616     "display active help texts in my own info area."
  1787     |cls aspect editor columns|
  1617 
  1788 
  1618     |txt|
  1789     cls := self resolveName:specClass.
  1619 
  1790 
  1620     aHelpText isNil ifTrue:[
  1791     cls isNil ifTrue:[
  1621         txt := nil
  1792         ^ self information:'no application class defined yet'
  1622     ] ifFalse:[
  1793     ].
  1623         txt := self class 
  1794     aspect := self specTool specification listSelector.
  1624                 convertString:(aHelpText asString)
  1795     editor := TabItemEditor new.
  1625                 maxLineSize:(transcript width // transcript font width)
  1796     editor masterApplication:self.
  1626                skipLineFeed:true
  1797 
  1627     ].
  1798     editor openModalOnClass:cls andSelector:aspect.
  1628     transcript hideCursor.
  1799 
  1629     transcript contents:txt.
  1800     editor selector ~= aspect ifTrue:[
  1630     ^ true
  1801         editor didInstall ifTrue:[
  1631 
  1802             self specTool specification listSelector:(editor selector).
  1632     "Modified: / 29.10.1997 / 22:33:55 / cg"
  1803             self modifiedChannel value:true.
  1633 ! !
  1804             self accept.
  1634 
  1805         ]
  1635 !UIPainter methodsFor:'aspects'!
  1806     ]
  1636 
       
  1637 canMoveOrAlignSelection
       
  1638     "returns a boolean value holder which is true in case that any selection exists
       
  1639      and all widgets in the selection can change its layout through to a move or
       
  1640      align operation
       
  1641     "
       
  1642     ^ builder booleanValueAspectFor:#canMoveOrAlignSelection
       
  1643 !
       
  1644 
       
  1645 canMoveSelectionIntoContainer
       
  1646     "returns a boolean value holder which is true in case that one component is selected
       
  1647      and can change its container widget to the next element in the list which will have
       
  1648      the same container.
       
  1649     "
       
  1650     ^ builder booleanValueAspectFor:#canMoveSelectionIntoContainer
       
  1651 !
       
  1652 
       
  1653 canMoveSelectionOutOfContainer
       
  1654     "returns a boolean value holder which is true in case that one component is selected
       
  1655      which is contained within another component
       
  1656     "
       
  1657     ^ builder booleanValueAspectFor:#canMoveSelectionOutOfContainer
       
  1658 !
       
  1659 
       
  1660 enableChannel
       
  1661     "true if modifications are allowed otherwise running test
       
  1662     "
       
  1663   ^ self painter enableChannel
       
  1664 !
       
  1665 
       
  1666 galleryShown
       
  1667     "returns a boolean value holder which is set to true if the gallery is shown
       
  1668     "
       
  1669     |holder|
       
  1670 
       
  1671     (holder := builder bindingAt:#galleryShown) isNil ifTrue:[
       
  1672         builder aspectAt:#galleryShown put:(holder :=  true asValue).
       
  1673         holder addDependent:self
       
  1674     ].
       
  1675     ^ holder
       
  1676 
       
  1677 !
       
  1678 
       
  1679 hasOneSelectionOtherThanCanvas
       
  1680     "returns a value holder which is true in case that one component is selected
       
  1681      other than the canvas.
       
  1682     "
       
  1683     ^ builder booleanValueAspectFor:#hasOneSelectionOtherThanCanvas
       
  1684 !
       
  1685 
       
  1686 modifiedChannel
       
  1687     "returns a boolean value holder which is set to true if something is modified
       
  1688      and not accepted
       
  1689     "
       
  1690     ^ builder booleanValueAspectFor:#modifiedChannel
       
  1691 !
       
  1692 
       
  1693 noteBookView
       
  1694     "returns the notebook view; initialize components within the notebook
       
  1695     "
       
  1696     |noteBook channel helpTool layoutTool specTool|
       
  1697 
       
  1698     (noteBook := builder bindingAt:#noteBookView) isNil ifTrue:[
       
  1699         noteBook   := View new.
       
  1700         layoutTool := UILayoutTool new.
       
  1701         helpTool   := UIHelpTool   new.
       
  1702         helpTool helpSpecFrom:specClass.
       
  1703         specTool   := UISpecificationTool new.
       
  1704         channel    := self modifiedChannel.
       
  1705 
       
  1706         layoutTool masterApplication:self.
       
  1707         specTool   masterApplication:self.
       
  1708         helpTool   masterApplication:self.
       
  1709 
       
  1710         layoutCanvas := SubCanvas origin:0.0@0.0 corner:1.0@1.0 in:noteBook.
       
  1711         helpCanvas   := SubCanvas origin:0.0@0.0 corner:1.0@1.0 in:noteBook.
       
  1712         specCanvas   := SubCanvas origin:0.0@0.0 corner:1.0@1.0 in:noteBook.
       
  1713 
       
  1714         layoutCanvas client:layoutTool.
       
  1715         helpCanvas   client:helpTool.
       
  1716         specTool builder:(specCanvas client:specTool).
       
  1717 
       
  1718         layoutTool masterApplication:self.
       
  1719         specTool   masterApplication:self.
       
  1720         helpTool   masterApplication:self.
       
  1721 
       
  1722         layoutTool modifiedHolder:channel.
       
  1723         helpTool   modifiedHolder:channel.
       
  1724         specTool   modifiedHolder:channel.
       
  1725 
       
  1726         builder aspectAt:#noteBookView put:noteBook.
       
  1727     ].
       
  1728     ^ noteBook
       
  1729 !
       
  1730 
       
  1731 painterShown
       
  1732     "returns a boolean value holder which is set to true if the painter is shown
       
  1733     "
       
  1734     |holder|
       
  1735 
       
  1736     (holder := builder bindingAt:#painterShown) isNil ifTrue:[
       
  1737         builder aspectAt:#painterShown put:(holder :=  true asValue).
       
  1738         holder addDependent:self
       
  1739     ].
       
  1740     ^ holder
       
  1741 
       
  1742 !
       
  1743 
       
  1744 tabList
       
  1745     "returns a value holder which keeps a list of labels assigned to the tabs
       
  1746     "
       
  1747     |holder|
       
  1748 
       
  1749     (holder := builder bindingAt:#tabList) isNil ifTrue:[
       
  1750         builder aspectAt:#tabList put:(holder :=  ValueHolder new).
       
  1751         holder value:#( 'Properties' ).
       
  1752     ].
       
  1753     ^ holder
       
  1754 !
       
  1755 
       
  1756 tabModel
       
  1757     "returns a value holder which keeps the current name of the tab selected
       
  1758     "
       
  1759     |holder|
       
  1760 
       
  1761     (holder := builder bindingAt:#tabModel) isNil ifTrue:[
       
  1762         holder := AspectAdaptor new subject:self; forAspect:#tabSelection.
       
  1763         builder aspectAt:#tabModel put:holder.
       
  1764     ].
       
  1765     ^ holder
       
  1766 !
       
  1767 
       
  1768 treeView
       
  1769     "returns the selection tree view which holds all widget identifiers
       
  1770     "
       
  1771     ^ treeView
       
  1772 ! !
       
  1773 
       
  1774 !UIPainter methodsFor:'binding access'!
       
  1775 
       
  1776 aspectFor:aKey
       
  1777     "aspect for a key
       
  1778     "
       
  1779   ^ aspects at:aKey ifAbsent:[ super aspectFor:aKey ]
       
  1780 ! !
  1807 ! !
  1781 
  1808 
  1782 !UIPainter methodsFor:'change & update'!
  1809 !UIPainter methodsFor:'change & update'!
  1783 
  1810 
  1784 layoutChanged
  1811 layoutChanged
  2174         super closeRequestFor:aTopView
  2201         super closeRequestFor:aTopView
  2175     ] ifFalse:[
  2202     ] ifFalse:[
  2176         aTopView = selectionPanel window ifTrue:[
  2203         aTopView = selectionPanel window ifTrue:[
  2177             self galleryShown value:false
  2204             self galleryShown value:false
  2178         ] ifFalse:[
  2205         ] ifFalse:[
  2179             self painterShown value:false
  2206             aTopView == (self painter topView) ifTrue:[
       
  2207                 self painterShown value:false
       
  2208             ] ifFalse:[
       
  2209                 aTopView closeRequest
       
  2210             ]
  2180         ].
  2211         ].
  2181         topView raise.
  2212         topView raise.
  2182     ].
  2213     ].
  2183 !
  2214 !
  2184 
  2215