ImageEditor.st
changeset 2841 5f247fa01174
parent 2837 491837239003
child 2866 10f8ee0f23fe
equal deleted inserted replaced
2840:3fc46b951a0f 2841:5f247fa01174
  1739          (MenuItem
  1739          (MenuItem
  1740             enabled: hasColorSelectedHolder
  1740             enabled: hasColorSelectedHolder
  1741             label: 'Copy Color'
  1741             label: 'Copy Color'
  1742             itemValue: copyColorFromColormap
  1742             itemValue: copyColorFromColormap
  1743             translateLabel: true
  1743             translateLabel: true
       
  1744             shortcutKey: Copy
  1744           )
  1745           )
  1745          (MenuItem
  1746          (MenuItem
  1746             enabled: hasColormapAndColorSelected
  1747             enabled: hasColormapAndColorSelected
  1747             label: 'Pick and Paste Color...'
  1748             label: 'Pick and Paste Color...'
  1748             itemValue: pickAndPasteColor
  1749             itemValue: pickAndPasteColor
  1750           )
  1751           )
  1751          (MenuItem
  1752          (MenuItem
  1752             label: 'Paste Color'
  1753             label: 'Paste Color'
  1753             itemValue: pasteColorIntoColormap
  1754             itemValue: pasteColorIntoColormap
  1754             translateLabel: true
  1755             translateLabel: true
       
  1756             shortcutKey: Paste
  1755           )
  1757           )
  1756          (MenuItem
  1758          (MenuItem
  1757             label: '-'
  1759             label: '-'
  1758           )
  1760           )
  1759          (MenuItem
  1761          (MenuItem
  1782           )
  1784           )
  1783          (MenuItem
  1785          (MenuItem
  1784             label: '-'
  1786             label: '-'
  1785           )
  1787           )
  1786          (MenuItem
  1788          (MenuItem
       
  1789             enabled: hasColorSelectedHolder
  1787             label: 'Inspect Color'
  1790             label: 'Inspect Color'
  1788             itemValue: inspectColor
  1791             itemValue: inspectColor
  1789             translateLabel: true
  1792             translateLabel: true
  1790             enabled: hasColorSelectedHolder
       
  1791           )
  1793           )
  1792          (MenuItem
  1794          (MenuItem
  1793             enabled: hasColormapHolder
  1795             enabled: hasColormapHolder
  1794             label: 'Inspect Colormap'
  1796             label: 'Inspect Colormap'
  1795             itemValue: inspectColormap
  1797             itemValue: inspectColormap
  1797           )
  1799           )
  1798          )
  1800          )
  1799         nil
  1801         nil
  1800         nil
  1802         nil
  1801       )
  1803       )
  1802 
       
  1803     "Modified: / 04-07-2010 / 10:13:57 / cg"
       
  1804 !
  1804 !
  1805 
  1805 
  1806 menu
  1806 menu
  1807     "This resource specification was automatically generated
  1807     "This resource specification was automatically generated
  1808      by the MenuEditor of ST/X."
  1808      by the MenuEditor of ST/X."
  4016 !ImageEditor methodsFor:'event handling'!
  4016 !ImageEditor methodsFor:'event handling'!
  4017 
  4017 
  4018 processEvent:anEvent
  4018 processEvent:anEvent
  4019     "Return true, if I have eaten the event"
  4019     "Return true, if I have eaten the event"
  4020 
  4020 
  4021     |p|
  4021     |view focusView p transformation|
  4022 
  4022 
  4023     anEvent view == self imagePreView ifTrue:[
  4023     view := anEvent view.
  4024         ((anEvent isButtonPressEvent and:[ anEvent button == 1 ])
  4024     view notNil ifTrue:[
  4025         or:[ anEvent isButtonMotionEvent and:[ anEvent hasButton1 ]])  ifTrue:[
  4025         view == self imagePreView ifTrue:[
  4026             p := anEvent x @ anEvent y.
  4026             ((anEvent isButtonPressEvent and:[ anEvent button == 1 ])
  4027             anEvent view transformation notNil ifTrue:[
  4027             or:[ anEvent isButtonMotionEvent and:[ anEvent hasButton1 ]])  ifTrue:[
  4028                 p := anEvent view transformation applyInverseTo:p.
  4028                 p := anEvent x @ anEvent y.
       
  4029                 (transformation := view transformation) notNil ifTrue:[
       
  4030                     p := transformation applyInverseTo:p.
       
  4031                 ].
       
  4032                 self imageEditView scrollToMakeVisible:p.    
       
  4033                 ^ true.
  4029             ].
  4034             ].
  4030             self imageEditView scrollToMakeVisible:p.    
       
  4031             ^ true.
       
  4032         ].
  4035         ].
       
  4036 
       
  4037         anEvent isKeyPressEvent ifTrue:[
       
  4038             focusView := view windowGroup focusView ? view.
       
  4039             (focusView isComponentOf:(builder componentAt:#colorDataSetView)) ifTrue:[
       
  4040                 anEvent key == #Paste ifTrue:[
       
  4041                     self pasteColorIntoColormap.
       
  4042                     ^ true.
       
  4043                 ].
       
  4044                 anEvent key == #Copy ifTrue:[
       
  4045                     self copyColorFromColormap.
       
  4046                     ^ true.
       
  4047                 ].
       
  4048             ].
       
  4049         ].
  4033     ].
  4050     ].
  4034     ^ false.
  4051     ^ false.
       
  4052 
       
  4053     "Modified: / 04-04-2011 / 13:50:09 / cg"
  4035 ! !
  4054 ! !
  4036 
  4055 
  4037 !ImageEditor methodsFor:'help'!
  4056 !ImageEditor methodsFor:'help'!
  4038 
  4057 
  4039 defaultInfoLabel
  4058 defaultInfoLabel