changed: expecco_2_0_0 expecco_2_0_0_0
authorClaus Gittinger <cg@exept.de>
Mon, 04 Apr 2011 14:05:56 +0200
changeset 2841 5f247fa01174
parent 2840 3fc46b951a0f
child 2842 ed699545a9e7
changed: #colorMapMenu #processEvent:
ImageEditor.st
--- a/ImageEditor.st	Fri Apr 01 18:12:37 2011 +0200
+++ b/ImageEditor.st	Mon Apr 04 14:05:56 2011 +0200
@@ -1741,6 +1741,7 @@
             label: 'Copy Color'
             itemValue: copyColorFromColormap
             translateLabel: true
+            shortcutKey: Copy
           )
          (MenuItem
             enabled: hasColormapAndColorSelected
@@ -1752,6 +1753,7 @@
             label: 'Paste Color'
             itemValue: pasteColorIntoColormap
             translateLabel: true
+            shortcutKey: Paste
           )
          (MenuItem
             label: '-'
@@ -1784,10 +1786,10 @@
             label: '-'
           )
          (MenuItem
+            enabled: hasColorSelectedHolder
             label: 'Inspect Color'
             itemValue: inspectColor
             translateLabel: true
-            enabled: hasColorSelectedHolder
           )
          (MenuItem
             enabled: hasColormapHolder
@@ -1799,8 +1801,6 @@
         nil
         nil
       )
-
-    "Modified: / 04-07-2010 / 10:13:57 / cg"
 !
 
 menu
@@ -4018,20 +4018,39 @@
 processEvent:anEvent
     "Return true, if I have eaten the event"
 
-    |p|
-
-    anEvent view == self imagePreView ifTrue:[
-        ((anEvent isButtonPressEvent and:[ anEvent button == 1 ])
-        or:[ anEvent isButtonMotionEvent and:[ anEvent hasButton1 ]])  ifTrue:[
-            p := anEvent x @ anEvent y.
-            anEvent view transformation notNil ifTrue:[
-                p := anEvent view transformation applyInverseTo:p.
+    |view focusView p transformation|
+
+    view := anEvent view.
+    view notNil ifTrue:[
+        view == self imagePreView ifTrue:[
+            ((anEvent isButtonPressEvent and:[ anEvent button == 1 ])
+            or:[ anEvent isButtonMotionEvent and:[ anEvent hasButton1 ]])  ifTrue:[
+                p := anEvent x @ anEvent y.
+                (transformation := view transformation) notNil ifTrue:[
+                    p := transformation applyInverseTo:p.
+                ].
+                self imageEditView scrollToMakeVisible:p.    
+                ^ true.
             ].
-            self imageEditView scrollToMakeVisible:p.    
-            ^ true.
+        ].
+
+        anEvent isKeyPressEvent ifTrue:[
+            focusView := view windowGroup focusView ? view.
+            (focusView isComponentOf:(builder componentAt:#colorDataSetView)) ifTrue:[
+                anEvent key == #Paste ifTrue:[
+                    self pasteColorIntoColormap.
+                    ^ true.
+                ].
+                anEvent key == #Copy ifTrue:[
+                    self copyColorFromColormap.
+                    ^ true.
+                ].
+            ].
         ].
     ].
     ^ false.
+
+    "Modified: / 04-04-2011 / 13:50:09 / cg"
 ! !
 
 !ImageEditor methodsFor:'help'!