ImageEditor.st
changeset 3376 c508738114fa
parent 3375 d2a64b772792
child 3377 6177e2e703fb
equal deleted inserted replaced
3375:d2a64b772792 3376:c508738114fa
    60 ! !
    60 ! !
    61 
    61 
    62 !ImageEditor class methodsFor:'instance creation'!
    62 !ImageEditor class methodsFor:'instance creation'!
    63 
    63 
    64 openLoadingImageWith:aBlock modal:modalBoolean
    64 openLoadingImageWith:aBlock modal:modalBoolean
    65     "opens an Image Editor on anImage"
    65     "opens an Image Editor on anImage.
       
    66      returns the editor (to access its attributes)"
    66 
    67 
    67     |editor|
    68     |editor|
    68 
    69 
    69     editor := self new.
    70     editor := self new.
    70     editor allButOpen.
    71     editor allButOpen.
   442 #fileSaveMethod
   443 #fileSaveMethod
   443 'Save the image as resource method in the current class and selector'
   444 'Save the image as resource method in the current class and selector'
   444 
   445 
   445 #fileSaveMethodAs
   446 #fileSaveMethodAs
   446 'Save the image as resource method in a class'
   447 'Save the image as resource method in a class'
       
   448 
       
   449 #gropBottom
       
   450 'Cut off the specified number of pixels at the bottom'
       
   451 
       
   452 #gropLeft
       
   453 'Cut off the specified number of pixels at the left'
       
   454 
       
   455 #gropRight
       
   456 'Cut off the specified number of pixels at the right'
       
   457 
       
   458 #gropTop
       
   459 'Cut off the specified number of pixels at the top'
   447 
   460 
   448 #magnificationNumber
   461 #magnificationNumber
   449 'Shows the current magnification'
   462 'Shows the current magnification'
   450 
   463 
   451 #magnifyImageDown
   464 #magnifyImageDown
  1585     "
  1598     "
  1586 
  1599 
  1587     <resource: #canvas>
  1600     <resource: #canvas>
  1588 
  1601 
  1589     ^ 
  1602     ^ 
  1590      #(FullSpec
  1603     #(FullSpec
  1591         name: cropDialogSpec
  1604        name: cropDialogSpec
  1592         window: 
  1605        window: 
  1593        (WindowSpec
  1606       (WindowSpec
  1594           label: 'Crop Border(s)'
  1607          label: 'Crop Border(s)'
  1595           name: 'Crop Border(s)'
  1608          name: 'Crop Border(s)'
  1596           min: (Point 10 10)
  1609          min: (Point 10 10)
  1597           bounds: (Rectangle 14 46 259 229)
  1610          bounds: (Rectangle 0 0 290 199)
  1598         )
  1611        )
  1599         component: 
  1612        component: 
  1600        (SpecCollection
  1613       (SpecCollection
  1601           collection: (
  1614          collection: (
  1602            (LabelSpec
  1615           (LabelSpec
  1603               label: 'Left:'
  1616              label: 'Left:'
  1604               name: 'GropLeftLabel'
  1617              name: 'GropLeftLabel'
  1605               layout: (LayoutFrame 14 0 21 0 90 0 43 0)
  1618              layout: (LayoutFrame 14 0 24 0 90 0 46 0)
  1606               translateLabel: true
  1619              activeHelpKey: gropLeft
  1607               adjust: right
  1620              translateLabel: true
  1608             )
  1621              adjust: right
  1609            (InputFieldSpec
  1622            )
  1610               name: 'GropLeftEntryField'
  1623           (InputFieldSpec
  1611               layout: (LayoutFrame 95 0 21 0 132 0 43 0)
  1624              name: 'GropLeftEntryField'
  1612               tabable: true
  1625              layout: (LayoutFrame 95 0 24 0 132 0 46 0)
  1613               model: left
  1626              activeHelpKey: gropLeft
  1614               type: number
  1627              tabable: true
  1615               acceptChannel: acceptChannel
  1628              model: left
  1616               acceptOnPointerLeave: false
  1629              type: number
  1617             )
  1630              acceptChannel: acceptChannel
  1618            (ActionButtonSpec
  1631              acceptOnPointerLeave: false
  1619               label: 'Now'
  1632            )
  1620               name: 'GropLeftNowButton'
  1633           (ActionButtonSpec
  1621               layout: (LayoutFrame 148 0 21 0 221 0 43 0)
  1634              label: 'Now'
  1622               translateLabel: true
  1635              name: 'GropLeftNowButton'
  1623               tabable: true
  1636              layout: (LayoutFrame 148 0 21 0 221 0 50 0)
  1624               model: gropLeftNow
  1637              activeHelpKey: gropLeft
  1625               autoRepeat: true
  1638              translateLabel: true
  1626             )
  1639              resizeForLabel: true
  1627            (LabelSpec
  1640              tabable: true
  1628               label: 'Right:'
  1641              model: gropLeftNow
  1629               name: 'GropRightLabel'
  1642              autoRepeat: true
  1630               layout: (LayoutFrame 14 0 51 0 90 0 73 0)
  1643              usePreferredWidth: true
  1631               translateLabel: true
  1644            )
  1632               adjust: right
  1645           (LabelSpec
  1633             )
  1646              label: 'Right:'
  1634            (InputFieldSpec
  1647              name: 'GropRightLabel'
  1635               name: 'GropRightEntryField'
  1648              layout: (LayoutFrame 14 0 55 0 90 0 77 0)
  1636               layout: (LayoutFrame 95 0 51 0 132 0 73 0)
  1649              activeHelpKey: gropRight
  1637               tabable: true
  1650              translateLabel: true
  1638               model: right
  1651              adjust: right
  1639               type: number
  1652            )
  1640               acceptChannel: acceptChannel
  1653           (InputFieldSpec
  1641               acceptOnPointerLeave: false
  1654              name: 'GropRightEntryField'
  1642             )
  1655              layout: (LayoutFrame 95 0 55 0 132 0 77 0)
  1643            (ActionButtonSpec
  1656              activeHelpKey: gropRight
  1644               label: 'Now'
  1657              tabable: true
  1645               name: 'GropRightButton'
  1658              model: right
  1646               layout: (LayoutFrame 148 0 51 0 221 0 73 0)
  1659              type: number
  1647               translateLabel: true
  1660              acceptChannel: acceptChannel
  1648               tabable: true
  1661              acceptOnPointerLeave: false
  1649               model: gropRightNow
  1662            )
  1650               autoRepeat: true
  1663           (ActionButtonSpec
  1651             )
  1664              label: 'Now'
  1652            (LabelSpec
  1665              name: 'GropRightButton'
  1653               label: 'Top:'
  1666              layout: (LayoutFrame 148 0 51 0 221 0 80 0)
  1654               name: 'GropTopLabel'
  1667              activeHelpKey: gropRight
  1655               layout: (LayoutFrame 14 0 81 0 90 0 103 0)
  1668              translateLabel: true
  1656               translateLabel: true
  1669              resizeForLabel: true
  1657               adjust: right
  1670              tabable: true
  1658             )
  1671              model: gropRightNow
  1659            (InputFieldSpec
  1672              autoRepeat: true
  1660               name: 'GropTopEntryField'
  1673              usePreferredWidth: true
  1661               layout: (LayoutFrame 95 0 81 0 132 0 103 0)
  1674            )
  1662               tabable: true
  1675           (LabelSpec
  1663               model: top
  1676              label: 'Top:'
  1664               type: number
  1677              name: 'GropTopLabel'
  1665               acceptChannel: acceptChannel
  1678              layout: (LayoutFrame 14 0 85 0 90 0 107 0)
  1666               acceptOnPointerLeave: false
  1679              activeHelpKey: gropTop
  1667             )
  1680              translateLabel: true
  1668            (ActionButtonSpec
  1681              adjust: right
  1669               label: 'Now'
  1682            )
  1670               name: 'GropTopButton'
  1683           (InputFieldSpec
  1671               layout: (LayoutFrame 148 0 81 0 221 0 103 0)
  1684              name: 'GropTopEntryField'
  1672               translateLabel: true
  1685              layout: (LayoutFrame 95 0 85 0 132 0 107 0)
  1673               tabable: true
  1686              activeHelpKey: gropTop
  1674               model: gropTopNow
  1687              tabable: true
  1675               autoRepeat: true
  1688              model: top
  1676             )
  1689              type: number
  1677            (LabelSpec
  1690              acceptChannel: acceptChannel
  1678               label: 'Bottom:'
  1691              acceptOnPointerLeave: false
  1679               name: 'GropBottomLabel'
  1692            )
  1680               layout: (LayoutFrame 14 0 111 0 90 0 133 0)
  1693           (ActionButtonSpec
  1681               translateLabel: true
  1694              label: 'Now'
  1682               adjust: right
  1695              name: 'GropTopButton'
  1683             )
  1696              layout: (LayoutFrame 148 0 81 0 221 0 110 0)
  1684            (InputFieldSpec
  1697              activeHelpKey: gropTop
  1685               name: 'GropBottomEntryField'
  1698              translateLabel: true
  1686               layout: (LayoutFrame 95 0 111 0 132 0 133 0)
  1699              resizeForLabel: true
  1687               tabable: true
  1700              tabable: true
  1688               model: bottom
  1701              model: gropTopNow
  1689               type: number
  1702              autoRepeat: true
  1690               acceptChannel: acceptChannel
  1703              usePreferredWidth: true
  1691               acceptOnPointerLeave: false
  1704            )
  1692             )
  1705           (LabelSpec
  1693            (ActionButtonSpec
  1706              label: 'Bottom:'
  1694               label: 'Now'
  1707              name: 'GropBottomLabel'
  1695               name: 'GropBottomButton'
  1708              layout: (LayoutFrame 14 0 115 0 90 0 137 0)
  1696               layout: (LayoutFrame 148 0 111 0 221 0 133 0)
  1709              activeHelpKey: gropBottom
  1697               translateLabel: true
  1710              translateLabel: true
  1698               tabable: true
  1711              adjust: right
  1699               model: gropBottomNow
  1712            )
  1700               autoRepeat: true
  1713           (InputFieldSpec
  1701             )
  1714              name: 'GropBottomEntryField'
  1702            (HorizontalPanelViewSpec
  1715              layout: (LayoutFrame 95 0 115 0 132 0 137 0)
  1703               name: 'HorizontalPanel1'
  1716              activeHelpKey: gropBottom
  1704               layout: (LayoutFrame 0 0.0 -30 1 0 1.0 0 1)
  1717              tabable: true
  1705               horizontalLayout: fitSpace
  1718              model: bottom
  1706               verticalLayout: center
  1719              type: number
  1707               horizontalSpace: 3
  1720              acceptChannel: acceptChannel
  1708               verticalSpace: 3
  1721              acceptOnPointerLeave: false
  1709               reverseOrderIfOKAtLeft: true
  1722            )
  1710               component: 
  1723           (ActionButtonSpec
  1711              (SpecCollection
  1724              label: 'Now'
  1712                 collection: (
  1725              name: 'GropBottomButton'
  1713                  (ActionButtonSpec
  1726              layout: (LayoutFrame 148 0 111 0 221 0 140 0)
  1714                     label: 'Cancel'
  1727              activeHelpKey: gropBottom
  1715                     name: 'Button1'
  1728              translateLabel: true
  1716                     translateLabel: true
  1729              resizeForLabel: true
  1717                     tabable: true
  1730              tabable: true
  1718                     model: cancel
  1731              model: gropBottomNow
  1719                     extent: (Point 77 22)
  1732              autoRepeat: true
  1720                   )
  1733              usePreferredWidth: true
  1721                  (ActionButtonSpec
  1734            )
  1722                     label: 'Apply'
  1735           (HorizontalPanelViewSpec
  1723                     name: 'Button3'
  1736              name: 'HorizontalPanel1'
  1724                     translateLabel: true
  1737              layout: (LayoutFrame 0 0.0 -30 1 0 1.0 0 1)
  1725                     tabable: true
  1738              horizontalLayout: fitSpace
  1726                     model: applyAction
  1739              verticalLayout: center
  1727                     extent: (Point 78 22)
  1740              horizontalSpace: 3
  1728                   )
  1741              verticalSpace: 3
  1729                  (ActionButtonSpec
  1742              reverseOrderIfOKAtLeft: true
  1730                     label: 'OK'
  1743              component: 
  1731                     name: 'Button2'
  1744             (SpecCollection
  1732                     translateLabel: true
  1745                collection: (
  1733                     tabable: true
  1746                 (ActionButtonSpec
  1734                     model: accept
  1747                    label: 'Cancel'
  1735                     extent: (Point 78 22)
  1748                    name: 'Button1'
  1736                   )
  1749                    translateLabel: true
       
  1750                    resizeForLabel: true
       
  1751                    tabable: true
       
  1752                    model: cancel
       
  1753                    extent: (Point 91 22)
  1737                  )
  1754                  )
  1738                
  1755                 (ActionButtonSpec
  1739               )
  1756                    label: 'Apply'
  1740             )
  1757                    name: 'Button3'
       
  1758                    translateLabel: true
       
  1759                    resizeForLabel: true
       
  1760                    tabable: true
       
  1761                    model: applyAction
       
  1762                    extent: (Point 91 22)
       
  1763                  )
       
  1764                 (ActionButtonSpec
       
  1765                    label: 'OK'
       
  1766                    name: 'Button2'
       
  1767                    translateLabel: true
       
  1768                    resizeForLabel: true
       
  1769                    tabable: true
       
  1770                    model: accept
       
  1771                    extent: (Point 92 22)
       
  1772                  )
       
  1773                 )
       
  1774               
       
  1775              )
       
  1776              keepSpaceForOSXResizeHandleH: true
  1741            )
  1777            )
  1742          
  1778           )
  1743         )
  1779         
  1744       )
  1780        )
       
  1781      )
  1745 !
  1782 !
  1746 
  1783 
  1747 dialogSpecForNewImage
  1784 dialogSpecForNewImage
  1748     "This resource specification was automatically generated
  1785     "This resource specification was automatically generated
  1749      by the UIPainter of ST/X."
  1786      by the UIPainter of ST/X."
  3932 
  3969 
  3933     ^self componentAt: #coordLabel
  3970     ^self componentAt: #coordLabel
  3934 !
  3971 !
  3935 
  3972 
  3936 imageEditView
  3973 imageEditView
  3937     "returns the view of the image"
  3974     "returns the editor view of the image"
  3938 
  3975 
  3939     imageEditView isNil ifTrue:[
  3976     imageEditView isNil ifTrue:[
  3940         imageEditView := (self componentAt: #imageEditView) scrolledView.
  3977         imageEditView := (self componentAt: #imageEditView) scrolledView.
  3941         imageEditView addDependent:self.
  3978         imageEditView addDependent:self.
  3942     ].
  3979     ].