ImageEditor.st
changeset 3404 cd90f4aece50
parent 3401 9f2865200e2f
child 3405 02c67d9a5e65
equal deleted inserted replaced
3403:5725611d7f35 3404:cd90f4aece50
  1605        window: 
  1605        window: 
  1606       (WindowSpec
  1606       (WindowSpec
  1607          label: 'Crop Border(s)'
  1607          label: 'Crop Border(s)'
  1608          name: 'Crop Border(s)'
  1608          name: 'Crop Border(s)'
  1609          min: (Point 10 10)
  1609          min: (Point 10 10)
  1610          bounds: (Rectangle 0 0 332 224)
  1610          bounds: (Rectangle 0 0 343 225)
  1611        )
  1611        )
  1612        component: 
  1612        component: 
  1613       (SpecCollection
  1613       (SpecCollection
  1614          collection: (
  1614          collection: (
  1615           (LabelSpec
  1615           (LabelSpec
  1616              label: 'Left:'
  1616              label: 'Left:'
  1617              name: 'GropLeftLabel'
  1617              name: 'GropLeftLabel'
  1618              layout: (LayoutFrame 14 0 24 0 90 0 46 0)
  1618              layout: (LayoutFrame 14 0 24 0 90 0 46 0)
  1619              activeHelpKey: gropLeft
  1619              activeHelpKey: gropLeft
  1620              translateLabel: true
  1620              translateLabel: true
  1621              adjust: right
  1621              adjust: left
  1622            )
  1622            )
  1623           (InputFieldSpec
  1623           (InputFieldSpec
  1624              name: 'GropLeftEntryField'
  1624              name: 'GropLeftEntryField'
  1625              layout: (LayoutFrame 95 0 24 0 132 0 46 0)
  1625              layout: (LayoutFrame 95 0 24 0 125 0 46 0)
  1626              activeHelpKey: gropLeft
  1626              activeHelpKey: gropLeft
  1627              tabable: true
  1627              tabable: true
  1628              model: gropLeftAmount
  1628              model: gropLeftAmount
  1629              type: number
  1629              type: number
  1630              acceptChannel: acceptChannel
  1630              acceptChannel: acceptChannel
  1631              acceptOnPointerLeave: false
  1631              acceptOnPointerLeave: false
  1632            )
  1632            )
  1633           (ActionButtonSpec
  1633           (ActionButtonSpec
  1634              label: 'Now'
  1634              label: 'Now'
  1635              name: 'GropLeftNowButton'
  1635              name: 'GropLeftNowButton'
  1636              layout: (LayoutFrame 148 0 21 0 202 0 50 0)
  1636              layout: (LayoutFrame 133 0 21 0 187 0 50 0)
  1637              activeHelpKey: gropLeft
  1637              activeHelpKey: gropLeft
  1638              translateLabel: true
  1638              translateLabel: true
  1639              resizeForLabel: true
  1639              resizeForLabel: true
  1640              tabable: true
  1640              tabable: true
  1641              model: gropLeftNow
  1641              model: gropLeftNow
  1646              label: 'Right:'
  1646              label: 'Right:'
  1647              name: 'GropRightLabel'
  1647              name: 'GropRightLabel'
  1648              layout: (LayoutFrame 14 0 55 0 90 0 77 0)
  1648              layout: (LayoutFrame 14 0 55 0 90 0 77 0)
  1649              activeHelpKey: gropRight
  1649              activeHelpKey: gropRight
  1650              translateLabel: true
  1650              translateLabel: true
  1651              adjust: right
  1651              adjust: left
  1652            )
  1652            )
  1653           (InputFieldSpec
  1653           (InputFieldSpec
  1654              name: 'GropRightEntryField'
  1654              name: 'GropRightEntryField'
  1655              layout: (LayoutFrame 95 0 55 0 132 0 77 0)
  1655              layout: (LayoutFrame 95 0 55 0 125 0 77 0)
  1656              activeHelpKey: gropRight
  1656              activeHelpKey: gropRight
  1657              tabable: true
  1657              tabable: true
  1658              model: gropRightAmount
  1658              model: gropRightAmount
  1659              type: number
  1659              type: number
  1660              acceptChannel: acceptChannel
  1660              acceptChannel: acceptChannel
  1661              acceptOnPointerLeave: false
  1661              acceptOnPointerLeave: false
  1662            )
  1662            )
  1663           (ActionButtonSpec
  1663           (ActionButtonSpec
  1664              label: 'Now'
  1664              label: 'Now'
  1665              name: 'GropRightButton'
  1665              name: 'GropRightButton'
  1666              layout: (LayoutFrame 148 0 51 0 202 0 80 0)
  1666              layout: (LayoutFrame 133 0 51 0 187 0 80 0)
  1667              activeHelpKey: gropRight
  1667              activeHelpKey: gropRight
  1668              translateLabel: true
  1668              translateLabel: true
  1669              resizeForLabel: true
  1669              resizeForLabel: true
  1670              tabable: true
  1670              tabable: true
  1671              model: gropRightNow
  1671              model: gropRightNow
  1676              label: 'Top:'
  1676              label: 'Top:'
  1677              name: 'GropTopLabel'
  1677              name: 'GropTopLabel'
  1678              layout: (LayoutFrame 14 0 85 0 90 0 107 0)
  1678              layout: (LayoutFrame 14 0 85 0 90 0 107 0)
  1679              activeHelpKey: gropTop
  1679              activeHelpKey: gropTop
  1680              translateLabel: true
  1680              translateLabel: true
  1681              adjust: right
  1681              adjust: left
  1682            )
  1682            )
  1683           (InputFieldSpec
  1683           (InputFieldSpec
  1684              name: 'GropTopEntryField'
  1684              name: 'GropTopEntryField'
  1685              layout: (LayoutFrame 95 0 85 0 132 0 107 0)
  1685              layout: (LayoutFrame 95 0 85 0 125 0 107 0)
  1686              activeHelpKey: gropTop
  1686              activeHelpKey: gropTop
  1687              tabable: true
  1687              tabable: true
  1688              model: gropTopAmount
  1688              model: gropTopAmount
  1689              type: number
  1689              type: number
  1690              acceptChannel: acceptChannel
  1690              acceptChannel: acceptChannel
  1691              acceptOnPointerLeave: false
  1691              acceptOnPointerLeave: false
  1692            )
  1692            )
  1693           (ActionButtonSpec
  1693           (ActionButtonSpec
  1694              label: 'Now'
  1694              label: 'Now'
  1695              name: 'GropTopButton'
  1695              name: 'GropTopButton'
  1696              layout: (LayoutFrame 148 0 81 0 202 0 110 0)
  1696              layout: (LayoutFrame 133 0 81 0 187 0 110 0)
  1697              activeHelpKey: gropTop
  1697              activeHelpKey: gropTop
  1698              translateLabel: true
  1698              translateLabel: true
  1699              resizeForLabel: true
  1699              resizeForLabel: true
  1700              tabable: true
  1700              tabable: true
  1701              model: gropTopNow
  1701              model: gropTopNow
  1706              label: 'Bottom:'
  1706              label: 'Bottom:'
  1707              name: 'GropBottomLabel'
  1707              name: 'GropBottomLabel'
  1708              layout: (LayoutFrame 14 0 115 0 90 0 137 0)
  1708              layout: (LayoutFrame 14 0 115 0 90 0 137 0)
  1709              activeHelpKey: gropBottom
  1709              activeHelpKey: gropBottom
  1710              translateLabel: true
  1710              translateLabel: true
  1711              adjust: right
  1711              adjust: left
  1712            )
  1712            )
  1713           (InputFieldSpec
  1713           (InputFieldSpec
  1714              name: 'GropBottomEntryField'
  1714              name: 'GropBottomEntryField'
  1715              layout: (LayoutFrame 95 0 115 0 132 0 137 0)
  1715              layout: (LayoutFrame 95 0 115 0 125 0 137 0)
  1716              activeHelpKey: gropBottom
  1716              activeHelpKey: gropBottom
  1717              tabable: true
  1717              tabable: true
  1718              model: gropBottomAmount
  1718              model: gropBottomAmount
  1719              type: number
  1719              type: number
  1720              acceptChannel: acceptChannel
  1720              acceptChannel: acceptChannel
  1721              acceptOnPointerLeave: false
  1721              acceptOnPointerLeave: false
  1722            )
  1722            )
  1723           (ActionButtonSpec
  1723           (ActionButtonSpec
  1724              label: 'Now'
  1724              label: 'Now'
  1725              name: 'GropBottomButton'
  1725              name: 'GropBottomButton'
  1726              layout: (LayoutFrame 148 0 111 0 202 0 140 0)
  1726              layout: (LayoutFrame 133 0 111 0 187 0 140 0)
  1727              activeHelpKey: gropBottom
  1727              activeHelpKey: gropBottom
  1728              translateLabel: true
  1728              translateLabel: true
  1729              resizeForLabel: true
  1729              resizeForLabel: true
  1730              tabable: true
  1730              tabable: true
  1731              model: gropBottomNow
  1731              model: gropBottomNow
  1750                    visibilityChannel: cropBoxIsDialog
  1750                    visibilityChannel: cropBoxIsDialog
  1751                    translateLabel: true
  1751                    translateLabel: true
  1752                    resizeForLabel: true
  1752                    resizeForLabel: true
  1753                    tabable: true
  1753                    tabable: true
  1754                    model: cancel
  1754                    model: cancel
  1755                    extent: (Point 100 28)
  1755                    extent: (Point 103 28)
  1756                  )
  1756                  )
  1757                 (ActionButtonSpec
  1757                 (ActionButtonSpec
  1758                    label: 'Apply'
  1758                    label: 'Apply'
  1759                    name: 'Button3'
  1759                    name: 'Button3'
  1760                    translateLabel: true
  1760                    translateLabel: true
  1761                    resizeForLabel: true
  1761                    resizeForLabel: true
  1762                    tabable: true
  1762                    tabable: true
  1763                    model: applyAction
  1763                    model: applyAction
  1764                    extent: (Point 100 28)
  1764                    extent: (Point 104 28)
  1765                  )
  1765                  )
  1766                 (ActionButtonSpec
  1766                 (ActionButtonSpec
  1767                    label: 'OK'
  1767                    label: 'OK'
  1768                    name: 'Button2'
  1768                    name: 'Button2'
  1769                    visibilityChannel: cropBoxIsDialog
  1769                    visibilityChannel: cropBoxIsDialog
  1770                    translateLabel: true
  1770                    translateLabel: true
  1771                    resizeForLabel: true
  1771                    resizeForLabel: true
  1772                    tabable: true
  1772                    tabable: true
  1773                    model: accept
  1773                    model: accept
  1774                    extent: (Point 100 28)
  1774                    extent: (Point 104 28)
  1775                  )
  1775                  )
  1776                 )
  1776                 )
  1777               
  1777               
  1778              )
  1778              )
  1779              keepSpaceForOSXResizeHandleH: true
  1779              keepSpaceForOSXResizeHandleH: true
  1780            )
  1780            )
  1781           )
  1781           )
  1782         
  1782         
  1783        )
  1783        )
  1784      )
  1784      )
  1785 
       
  1786     "Modified: / 13-02-2017 / 14:52:25 / cg"
       
  1787 !
  1785 !
  1788 
  1786 
  1789 dialogSpecForNewImage
  1787 dialogSpecForNewImage
  1790     "This resource specification was automatically generated
  1788     "This resource specification was automatically generated
  1791      by the UIPainter of ST/X."
  1789      by the UIPainter of ST/X."
  2182                          snapMode: both
  2180                          snapMode: both
  2183                          component: 
  2181                          component: 
  2184                         (SpecCollection
  2182                         (SpecCollection
  2185                            collection: (
  2183                            collection: (
  2186                             (ViewSpec
  2184                             (ViewSpec
  2187                                name: 'ColorBox'
  2185                                name: 'ColorAnCropBox'
  2188                                component: 
  2186                                component: 
  2189                               (SpecCollection
  2187                               (SpecCollection
  2190                                  collection: (
  2188                                  collection: (
  2191                                   (ViewSpec
  2189                                   (ViewSpec
  2192                                      name: 'CropBox'
  2190                                      name: 'CropBox'
  3762     ^ 
  3760     ^ 
  3763      #(Menu
  3761      #(Menu
  3764         (
  3762         (
  3765          (MenuItem
  3763          (MenuItem
  3766             activeHelpKey: drawModePoint
  3764             activeHelpKey: drawModePoint
  3767             enabled: imageIsLoadedAndNotReadonlyHolder
  3765             enabled: canDrawPointsHolder
  3768             label: 'Point'
  3766             label: 'Point'
  3769             translateLabel: true
  3767             translateLabel: true
  3770             isButton: true
  3768             isButton: true
  3771             labelImage: (ResourceRetriever ImageEditor pointIcon)
  3769             labelImage: (ResourceRetriever ImageEditor pointIcon)
  3772             choice: editMode
  3770             choice: editMode
  3773             choiceValue: point
  3771             choiceValue: point
  3774           )
  3772           )
  3775          (MenuItem
  3773          (MenuItem
  3776             activeHelpKey: drawModeSpray
  3774             activeHelpKey: drawModeSpray
  3777             enabled: imageIsLoadedAndNotReadonlyHolder
  3775             enabled: canSprayHolder
  3778             label: 'Spray'
  3776             label: 'Spray'
  3779             translateLabel: true
  3777             translateLabel: true
  3780             isButton: true
  3778             isButton: true
  3781             labelImage: (ResourceRetriever ImageEditor sprayIcon)
  3779             labelImage: (ResourceRetriever ImageEditor sprayIcon)
  3782             choice: editMode
  3780             choice: editMode
  3783             choiceValue: spray
  3781             choiceValue: spray
  3784           )
  3782           )
  3785          (MenuItem
  3783          (MenuItem
  3786             activeHelpKey: drawModeBox
  3784             activeHelpKey: drawModeBox
  3787             enabled: imageIsLoadedAndNotReadonlyHolder
  3785             enabled: canDrawRectsHolder
  3788             label: 'Rect'
  3786             label: 'Rect'
  3789             translateLabel: true
  3787             translateLabel: true
  3790             isButton: true
  3788             isButton: true
  3791             labelImage: (ResourceRetriever ImageEditor rectIcon)
  3789             labelImage: (ResourceRetriever ImageEditor rectIcon)
  3792             choice: editMode
  3790             choice: editMode
  3793             choiceValue: box
  3791             choiceValue: box
  3794           )
  3792           )
  3795          (MenuItem
  3793          (MenuItem
  3796             activeHelpKey: drawModeFilledBox
  3794             activeHelpKey: drawModeFilledBox
  3797             enabled: imageIsLoadedAndNotReadonlyHolder
  3795             enabled: canFillRectsHolder
  3798             label: 'FillRect'
  3796             label: 'FillRect'
  3799             translateLabel: true
  3797             translateLabel: true
  3800             isButton: true
  3798             isButton: true
  3801             labelImage: (ResourceRetriever ImageEditor fillRectIcon)
  3799             labelImage: (ResourceRetriever ImageEditor fillRectIcon)
  3802             choice: editMode
  3800             choice: editMode
  3803             choiceValue: filledBox
  3801             choiceValue: filledBox
  3804           )
  3802           )
  3805          (MenuItem
  3803          (MenuItem
  3806             activeHelpKey: drawModeCircle
  3804             activeHelpKey: drawModeCircle
  3807             enabled: imageIsLoadedAndNotReadonlyHolder
  3805             enabled: canDrawCirclesHolder
  3808             label: 'Circle'
  3806             label: 'Circle'
  3809             translateLabel: true
  3807             translateLabel: true
  3810             isButton: true
  3808             isButton: true
  3811             labelImage: (ResourceRetriever ImageEditor circleIcon)
  3809             labelImage: (ResourceRetriever ImageEditor circleIcon)
  3812             choice: editMode
  3810             choice: editMode
  3813             choiceValue: circle
  3811             choiceValue: circle
  3814           )
  3812           )
  3815          (MenuItem
  3813          (MenuItem
  3816             activeHelpKey: drawModeFill
  3814             activeHelpKey: drawModeFill
  3817             enabled: imageIsLoadedAndNotReadonlyHolder
  3815             enabled: canFloodFillHolder
  3818             label: 'Fill'
  3816             label: 'Fill'
  3819             translateLabel: true
  3817             translateLabel: true
  3820             isButton: true
  3818             isButton: true
  3821             labelImage: (ResourceRetriever ImageEditor fillIcon)
  3819             labelImage: (ResourceRetriever ImageEditor fillIcon)
  3822             choice: editMode
  3820             choice: editMode
  3874           )
  3872           )
  3875          )
  3873          )
  3876         nil
  3874         nil
  3877         nil
  3875         nil
  3878       )
  3876       )
       
  3877 
       
  3878     "Modified: / 16-02-2017 / 01:45:04 / cg"
  3879 ! !
  3879 ! !
  3880 
  3880 
  3881 !ImageEditor class methodsFor:'tableColumns specs'!
  3881 !ImageEditor class methodsFor:'tableColumns specs'!
  3882 
  3882 
  3883 colorTableColumns
  3883 colorTableColumns
  4974         imageEditView resourceSelector:aSelector.
  4974         imageEditView resourceSelector:aSelector.
  4975     ].
  4975     ].
  4976     self updateLabelsAndHistory.
  4976     self updateLabelsAndHistory.
  4977 
  4977 
  4978     "Modified: / 16.3.1999 / 21:45:07 / cg"
  4978     "Modified: / 16.3.1999 / 21:45:07 / cg"
       
  4979 ! !
       
  4980 
       
  4981 !ImageEditor methodsFor:'menu aspects'!
       
  4982 
       
  4983 canDrawCirclesHolder
       
  4984     ^ self imageIsLoadedAndNotReadonlyHolder
       
  4985 
       
  4986     "Created: / 16-02-2017 / 01:41:31 / cg"
       
  4987 !
       
  4988 
       
  4989 canDrawPointsHolder
       
  4990     ^ self imageIsLoadedAndNotReadonlyHolder
       
  4991 
       
  4992     "Created: / 16-02-2017 / 01:39:37 / cg"
       
  4993 !
       
  4994 
       
  4995 canDrawRectsHolder
       
  4996     ^ self imageIsLoadedAndNotReadonlyHolder
       
  4997 
       
  4998     "Created: / 16-02-2017 / 01:40:17 / cg"
       
  4999 !
       
  5000 
       
  5001 canFillRectsHolder
       
  5002     ^ self imageIsLoadedAndNotReadonlyHolder
       
  5003 
       
  5004     "Created: / 16-02-2017 / 01:40:21 / cg"
       
  5005 !
       
  5006 
       
  5007 canFloodFillHolder
       
  5008     ^ self imageIsLoadedAndNotReadonlyHolder
       
  5009 
       
  5010     "Created: / 16-02-2017 / 01:41:33 / cg"
       
  5011 !
       
  5012 
       
  5013 canSprayHolder
       
  5014     ^ self imageIsLoadedAndNotReadonlyHolder
       
  5015 
       
  5016     "Created: / 16-02-2017 / 01:44:47 / cg"
  4979 ! !
  5017 ! !
  4980 
  5018 
  4981 !ImageEditor methodsFor:'menu item visibility'!
  5019 !ImageEditor methodsFor:'menu item visibility'!
  4982 
  5020 
  4983 isNotStandAloneAndMethodSaveAndLoadMenuItemsVisible
  5021 isNotStandAloneAndMethodSaveAndLoadMenuItemsVisible
  6845         ].
  6883         ].
  6846 
  6884 
  6847     bindings := IdentityDictionary new.
  6885     bindings := IdentityDictionary new.
  6848     bindings at:#gropLeftAmount put:(left := 1 asValue).
  6886     bindings at:#gropLeftAmount put:(left := 1 asValue).
  6849     bindings at:#gropRightAmount put:(right := 1 asValue).
  6887     bindings at:#gropRightAmount put:(right := 1 asValue).
  6850     bindings at:#gropTop put:(top := 1 asValue).
  6888     bindings at:#gropTopAmount put:(top := 1 asValue).
  6851     bindings at:#gropBottomAmount put:(bottom := 1 asValue).
  6889     bindings at:#gropBottomAmount put:(bottom := 1 asValue).
  6852     bindings at:#acceptChannel put:acceptChannel.
  6890     bindings at:#acceptChannel put:acceptChannel.
  6853 
  6891 
  6854     bindings at:#gropLeftNow   put:[ gropAction value:left value:0 value:0 value:0 ].
  6892     bindings at:#gropLeftNow   put:[ gropAction value:left value:0 value:0 value:0 ].
  6855     bindings at:#gropRightNow  put:[ gropAction value:0 value:right value:0 value:0 ].
  6893     bindings at:#gropRightNow  put:[ gropAction value:0 value:right value:0 value:0 ].
  6865             self updateImagePreView.
  6903             self updateImagePreView.
  6866         ]
  6904         ]
  6867     ].
  6905     ].
  6868 
  6906 
  6869     "Created: / 07-09-1998 / 18:16:07 / cg"
  6907     "Created: / 07-09-1998 / 18:16:07 / cg"
  6870     "Modified: / 13-02-2017 / 14:51:10 / cg"
  6908     "Modified: / 16-02-2017 / 01:33:36 / cg"
  6871 !
  6909 !
  6872 
  6910 
  6873 doCropRight
  6911 doCropRight
  6874     "find a right border and cut it off"
  6912     "find a right border and cut it off"
  6875 
  6913