UILayoutTool.st
changeset 2022 746cc87a768e
parent 1955 91610d2b87f7
child 2207 7f16eb639cc1
equal deleted inserted replaced
2021:5b7cc72d8226 2022:746cc87a768e
   873 ! !
   873 ! !
   874 
   874 
   875 !UILayoutTool methodsFor:'selection'!
   875 !UILayoutTool methodsFor:'selection'!
   876 
   876 
   877 selectedSlice
   877 selectedSlice
   878     "returns slice assigned to selection or nil
   878     "returns the slice assigned to the selection or nil"
   879     "
   879 
   880     selection notNil ifTrue:[
   880     selection isNil ifTrue:[^ nil].
   881         self class slices do:[:aSlice|
   881     ^ self class slices detect:[:aSlice | aSlice first = selection] ifNone:nil
   882             aSlice first = selection ifTrue:[
   882 
   883                 ^ aSlice
   883 "/    selection notNil ifTrue:[
   884             ]
   884 "/        self class slices do:[:aSlice|
   885         ]
   885 "/            aSlice first = selection ifTrue:[
   886     ].
   886 "/                ^ aSlice
   887     ^ nil
   887 "/            ]
   888 
   888 "/        ]
       
   889 "/    ].
       
   890 "/    ^ nil
   889 !
   891 !
   890 
   892 
   891 selection
   893 selection
   892     ^ selection
   894     ^ selection
   893 !
   895 !
  1487            (FramedBoxSpec
  1489            (FramedBoxSpec
  1488               label: 'Extent'
  1490               label: 'Extent'
  1489               name: 'FramedBox'
  1491               name: 'FramedBox'
  1490               layout: (LayoutFrame 0 0.0 6 0.0 0 1.0 145 0)
  1492               layout: (LayoutFrame 0 0.0 6 0.0 0 1.0 145 0)
  1491               labelPosition: topLeft
  1493               labelPosition: topLeft
  1492                     translateLabel: true
  1494               translateLabel: true
  1493               component: 
  1495               component: 
  1494              (SpecCollection
  1496              (SpecCollection
  1495                 collection: (
  1497                 collection: (
  1496                  (LabelSpec
  1498                  (LabelSpec
  1497                     label: 'Width:'
  1499                     label: 'Width:'
  1498                     name: 'labelWidth'
  1500                     name: 'labelWidth'
  1499                     layout: (AlignmentOrigin 89 0 24 0 1 0.5)
  1501                     layout: (AlignmentOrigin 89 0 24 0 1 0.5)
       
  1502                     translateLabel: true
  1500                     adjust: right
  1503                     adjust: right
  1501                     translateLabel: true
       
  1502                   )
  1504                   )
  1503                  (InputFieldSpec
  1505                  (InputFieldSpec
  1504                     name: 'fieldLeftOffset'
  1506                     name: 'fieldLeftOffset'
  1505                     layout: (LayoutFrame 90 0 13 0 140 0 35 0)
  1507                     layout: (LayoutFrame 90 0 13 0 140 0 35 0)
  1506                     activeHelpKey: hrzExtent
  1508                     activeHelpKey: hrzExtent
  1516                   )
  1518                   )
  1517                  (LabelSpec
  1519                  (LabelSpec
  1518                     label: 'Height:'
  1520                     label: 'Height:'
  1519                     name: 'labelHeight'
  1521                     name: 'labelHeight'
  1520                     layout: (AlignmentOrigin 89 0 49 0 1 0.5)
  1522                     layout: (AlignmentOrigin 89 0 49 0 1 0.5)
       
  1523                     translateLabel: true
  1521                     adjust: right
  1524                     adjust: right
  1522                     translateLabel: true
       
  1523                   )
  1525                   )
  1524                  (InputFieldSpec
  1526                  (InputFieldSpec
  1525                     name: 'fieldRightOffset'
  1527                     name: 'fieldRightOffset'
  1526                     layout: (LayoutFrame 90 0 38 0 140 0 60 0)
  1528                     layout: (LayoutFrame 90 0 38 0 140 0 60 0)
  1527                     activeHelpKey: vrtExtent
  1529                     activeHelpKey: vrtExtent
  1528                     enableChannel: notUsingDefaultExtent
  1530                     enableChannel: notUsingDefaultExtent
  1529                     tabable: true
  1531                     tabable: true
  1530                     model: rightOffset
  1532                     model: topOffset
  1531                     group: inputGroup
  1533                     group: inputGroup
  1532                     type: numberOrNil
  1534                     type: numberOrNil
  1533                     acceptOnLostFocus: true
  1535                     acceptOnLostFocus: true
  1534                     acceptChannel: acceptChannel
  1536                     acceptChannel: acceptChannel
  1535                     modifiedChannel: modifiedChannel
  1537                     modifiedChannel: modifiedChannel
  1546                   )
  1548                   )
  1547                  )
  1549                  )
  1548                
  1550                
  1549               )
  1551               )
  1550             )
  1552             )
       
  1553            (PopUpListSpec
       
  1554               label: 'Common Extents'
       
  1555               name: 'CommonExtentsPopUpList'
       
  1556               layout: (LayoutFrame 179 0 35 0 304 0 57 0)
       
  1557               tabable: true
       
  1558               menu: listOfCommonExtents
       
  1559               useIndex: true
       
  1560               ignoreReselect: false
       
  1561               stateChangeCallBackSelector: commonExtentSelected:
       
  1562             )
  1551            )
  1563            )
  1552          
  1564          
  1553         )
  1565         )
  1554       )
  1566       )
  1555 ! !
  1567 ! !
  1556 
  1568 
  1557 !UILayoutTool::Extent methodsFor:'accessing'!
  1569 !UILayoutTool::Extent methodsFor:'accessing'!
  1558 
  1570 
  1559 fetch:aView spec:aSpec
  1571 fetch:aView spec:aSpec
  1560     "fetch extent
  1572     "fetch the extent from aView"
  1561     "
  1573 
  1562     |extent|
  1574     |extent|
  1563 
  1575 
  1564     extent  := aView computeExtent.
  1576     extent  := aView computeExtent.
  1565 
  1577 
  1566     (self aspectFor:#leftOffset)  value:(extent x).
  1578     (self aspectFor:#leftOffset)  value:(extent x).
  1567     (self aspectFor:#rightOffset) value:(extent y).
  1579     (self aspectFor:#topOffset)   value:(extent y).
  1568 
  1580 
  1569     (self aspectFor:#useDefaultExtent) value:aSpec useDefaultExtent 
  1581     (self aspectFor:#useDefaultExtent) value:aSpec useDefaultExtent 
  1570 !
  1582 !
  1571 
  1583 
  1572 layout
  1584 layout
  1573     "returns current extent
  1585     "returns the current extent"
  1574     "
  1586 
  1575   ^ Smalltalk::Point x:(((self aspectFor:#leftOffset)   value) ? 0)
  1587     ^ (((self aspectFor:#leftOffset) value) ? 0) @ (((self aspectFor:#topOffset)  value) ? 0)
  1576                      y:(((self aspectFor:#rightOffset)  value) ? 0)
  1588 ! !
  1577 
  1589 
       
  1590 !UILayoutTool::Extent methodsFor:'aspects'!
       
  1591 
       
  1592 commonExtentsSpec
       
  1593     ^ #( 
       
  1594         ('200 x 100'  (200 100) ) 
       
  1595         ('300 x 300'  (300 300) ) 
       
  1596         ('640 x 400'  (640 400) ) 
       
  1597         ('800 x 600'  (800 600) ) 
       
  1598       )
       
  1599 !
       
  1600 
       
  1601 listOfCommonExtents
       
  1602     ^ self commonExtentsSpec collect:[:eachRow | eachRow first].
       
  1603 ! !
       
  1604 
       
  1605 !UILayoutTool::Extent methodsFor:'user actions'!
       
  1606 
       
  1607 commonExtentSelected:index
       
  1608     |xy x y|
       
  1609 
       
  1610     xy := (self commonExtentsSpec at:index) second. 
       
  1611     x := xy at:1.
       
  1612     y := xy at:2.
       
  1613 
       
  1614     (self aspectFor:#leftOffset)  value:x.
       
  1615     (self aspectFor:#topOffset)   value:y.
       
  1616 
       
  1617     (builder componentAt:#CommonExtentsPopUpList) 
       
  1618         label:(resources string:'Common Extents').
  1578 ! !
  1619 ! !
  1579 
  1620 
  1580 !UILayoutTool::LayoutFrame class methodsFor:'defaults'!
  1621 !UILayoutTool::LayoutFrame class methodsFor:'defaults'!
  1581 
  1622 
  1582 defaultFixPartHeight
  1623 defaultFixPartHeight
  1641 
  1682 
  1642 #makeBottomRelative
  1683 #makeBottomRelative
  1643 'Compute pure-fractional y.'
  1684 'Compute pure-fractional y.'
  1644 
  1685 
  1645 #makeBottomRelativeFromBottom
  1686 #makeBottomRelativeFromBottom
  1646 'Compute fraction+offset for y relative to container.'
  1687 'Compute fraction+offset for y relative to containers bottom.'
  1647 
  1688 
  1648 #makeRightAbsolute
  1689 #makeRightAbsolute
  1649 'Compute pure-absolute x.'
  1690 'Compute pure-absolute x.'
  1650 
  1691 
  1651 #makeRightRelative
  1692 #makeRightRelative
  1707 
  1748 
  1708     <resource: #image>
  1749     <resource: #image>
  1709 
  1750 
  1710     ^Icon
  1751     ^Icon
  1711         constantNamed:#'UILayoutTool::LayoutFrame class setBigBottomFixPartIcon'
  1752         constantNamed:#'UILayoutTool::LayoutFrame class setBigBottomFixPartIcon'
  1712         ifAbsentPut:[(Depth4Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
  1753         ifAbsentPut:[(Depth4Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#(4)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
  1713 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"H"H@H"H"@BDQDP@QDQH@HQDQ@ADQD @!!DQD@DQDR@BDQDP@QDQH@HQ
  1754 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"H"H"H"H"@BDQDQDQDQH@HQDQDQDQD @!!DQDQDQDR@BDQDQDQDQH@HQ
  1714 DQ@ADQD @!!DQD@DQDR@BDQDP@QDQH@H"H"@BH"H @@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 255 0 0 255 255 255]; mask:((Depth1Image new) width: 16; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??>@@X@A @F@@_????????????????????????????<b') ; yourself); yourself]
  1755 DQDQDQD @!!DQDQDQDR@BDQDQDQDQH@H"H"H"H"H @@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 255 0 0 255 255 255]; mask:((Depth1Image new) width: 16; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??>A XFA XFA _????????????????????????????<b') ; yourself); yourself]
  1715 !
  1756 !
  1716 
  1757 
  1717 setBigHorizontalFixPartIcon
  1758 setBigHorizontalFixPartIcon
  1718     "This resource specification was automatically generated
  1759     "This resource specification was automatically generated
  1719      by the ImageEditor of ST/X."
  1760      by the ImageEditor of ST/X."
  1729 
  1770 
  1730     <resource: #image>
  1771     <resource: #image>
  1731 
  1772 
  1732     ^Icon
  1773     ^Icon
  1733         constantNamed:#'UILayoutTool::LayoutFrame class setBigHorizontalFixPartIcon'
  1774         constantNamed:#'UILayoutTool::LayoutFrame class setBigHorizontalFixPartIcon'
  1734         ifAbsentPut:[(Depth4Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
  1775         ifAbsentPut:[(Depth4Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#(4)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
  1735 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@BH"H @"H"H@HQDQ@ADQD @!!DQD@DQDR@BDQDP@QDQH@HQDQ@ADQD @!!DQD@DQDR@BDQDP@QDQH@H"
  1776 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@BH"H"H"H"H@HQDQDQDQD @!!DQDQDQDR@BDQDQDQDQH@HQDQDQDQD @!!DQDQDQDR@BDQDQDQDQH@H"
  1736 H"@BH"H @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 255 0 0 255 255 255]; mask:((Depth1Image new) width: 16; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??>@@X@A??????????????????????????>@@X@A??<b') ; yourself); yourself]
  1777 H"H"H"H @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 255 0 0 255 255 255]; mask:((Depth1Image new) width: 16; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??>A XFA??????????????????????????>A XFA??<b') ; yourself); yourself]
  1737 !
  1778 !
  1738 
  1779 
  1739 setBigTopFixPartIcon
  1780 setBigTopFixPartIcon
  1740     "This resource specification was automatically generated
  1781     "This resource specification was automatically generated
  1741      by the ImageEditor of ST/X."
  1782      by the ImageEditor of ST/X."
  1751 
  1792 
  1752     <resource: #image>
  1793     <resource: #image>
  1753 
  1794 
  1754     ^Icon
  1795     ^Icon
  1755         constantNamed:#'UILayoutTool::LayoutFrame class setBigTopFixPartIcon'
  1796         constantNamed:#'UILayoutTool::LayoutFrame class setBigTopFixPartIcon'
  1756         ifAbsentPut:[(Depth4Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
  1797         ifAbsentPut:[(Depth4Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#(4)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
  1757 @@@@@@@@@@@BH"H @"H"H@HQDQ@ADQD @!!DQD@DQDR@BDQDP@QDQH@HQDQ@ADQD @!!DQD@DQDR@BDQDP@QDQH@HQDQ@ADQD @"H"H@H"H"@@@@@@@@@@@@@@
  1798 @@@@@@@@@@@BH"H"H"H"H@HQDQDQDQD @!!DQDQDQDR@BDQDQDQDQH@HQDQDQDQD @!!DQDQDQDR@BDQDQDQDQH@HQDQDQDQD @"H"H"H"H"@@@@@@@@@@@@@@
  1758 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 255 0 0 255 255 255]; mask:((Depth1Image new) width: 16; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'?????????????????????????????8@A @F@@X@A??<b') ; yourself); yourself]
  1799 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 255 0 0 255 255 255]; mask:((Depth1Image new) width: 16; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'?????????????????????????????8FA XFA XFA??<b') ; yourself); yourself]
  1759 !
  1800 !
  1760 
  1801 
  1761 setBottomFixPartIcon
  1802 setBottomFixPartIcon
  1762     "This resource specification was automatically generated
  1803     "This resource specification was automatically generated
  1763      by the ImageEditor of ST/X."
  1804      by the ImageEditor of ST/X."
  2969 
  3010 
  2970 
  3011 
  2971 !
  3012 !
  2972 
  3013 
  2973 layout
  3014 layout
  2974     "returns current layout as rectangle
  3015     "returns current layout as rectangle"
  2975     "
  3016 
  2976   ^ Smalltalk::Rectangle left:(((self aspectFor:#leftOffset)   value) ? 0)
  3017     ^ Smalltalk::Rectangle 
  2977                           top:(((self aspectFor:#topOffset)    value) ? 0)
  3018         left:(((self aspectFor:#leftOffset)   value) ? 0)
  2978                         right:(((self aspectFor:#rightOffset)  value) ? 0)
  3019         top:(((self aspectFor:#topOffset)    value) ? 0)
  2979                        bottom:(((self aspectFor:#bottomOffset) value) ? 0)
  3020         right:(((self aspectFor:#rightOffset)  value) ? 0)
  2980 
  3021         bottom:(((self aspectFor:#bottomOffset) value) ? 0)
  2981 
       
  2982 ! !
  3022 ! !
  2983 
  3023 
  2984 !UILayoutTool class methodsFor:'documentation'!
  3024 !UILayoutTool class methodsFor:'documentation'!
  2985 
  3025 
  2986 version
  3026 version