ImageEditor.st
changeset 3421 f46643590cb1
parent 3420 8b82ed312055
child 3422 005c4ce2070d
--- a/ImageEditor.st	Thu Feb 23 09:49:16 2017 +0100
+++ b/ImageEditor.st	Thu Feb 23 15:54:15 2017 +0100
@@ -291,6 +291,12 @@
 
     ^ #(
 
+#drawingColor1
+'The color associated to the left mouse button.\Also the color used in fill operations'
+
+#drawingColor2
+'The color associated to the right mouse button.\Also the second color used in gradient fill operations'
+
 #autoCropAll
 'Find and remove all borders'
 
@@ -560,7 +566,7 @@
 
 )
 
-    "Modified: / 23-02-2017 / 09:48:23 / cg"
+    "Modified: / 23-02-2017 / 10:23:21 / cg"
 !
 
 helpSpec
@@ -2447,6 +2453,20 @@
                                            level: 0
                                            menu: menuMouseButtonColors
                                          )
+                                        (ViewSpec
+                                           name: 'Box1'
+                                           layout: (LayoutFrame -40 1.0 4 0 -26 1.0 18 0)
+                                           activeHelpKey: drawingColor1
+                                           level: -1
+                                           backgroundChannel: drawingColor1Holder
+                                         )
+                                        (ViewSpec
+                                           name: 'Box2'
+                                           layout: (LayoutFrame -25 1.0 4 0 -11 1.0 18 0)
+                                           activeHelpKey: drawingColor2
+                                           level: -1
+                                           backgroundChannel: drawingColor2Holder
+                                         )
                                         (DataSetSpec
                                            name: 'colorDataSetView'
                                            layout: (LayoutFrame 0 0.0 26 0.0 0 1.0 0 1.0)
@@ -3912,6 +3932,7 @@
                (MenuItem
                   activeHelpKey: drawModeFill
                   enabled: imageIsLoadedHolder
+                  isVisible: false
                   label: 'Diagonal'
                   labelImage: (ResourceRetriever ImageEditor fillDiagonalGradientRectIcon 'Diagonal')
                   choice: editMode
@@ -3992,7 +4013,7 @@
         nil
       )
 
-    "Modified: / 22-02-2017 / 20:38:36 / cg"
+    "Modified: / 23-02-2017 / 15:53:17 / cg"
 !
 
 previewMenu
@@ -4549,6 +4570,32 @@
     "Created: / 19-02-2017 / 23:34:12 / cg"
 !
 
+drawingColor1Holder
+    "returns a valueHolder for the current selected mouse-button-1 color"
+
+    |holder|
+
+    (holder := builder bindingAt:#drawingColor1Holder) isNil ifTrue:[
+        builder aspectAt:#drawingColor1Holder put:(holder := IndirectValue new)
+    ].
+    ^ holder
+
+    "Created: / 23-02-2017 / 10:18:25 / cg"
+!
+
+drawingColor2Holder
+    "returns a valueHolder for the current selected mouse-button-2 color"
+
+    |holder|
+
+    (holder := builder bindingAt:#drawingColor2Holder) isNil ifTrue:[
+        builder aspectAt:#drawingColor2Holder put:(holder := IndirectValue new)
+    ].
+    ^ holder
+
+    "Created: / 23-02-2017 / 10:18:33 / cg"
+!
+
 floodFillBoxVisibleHolder
     |holder|
 
@@ -4610,10 +4657,13 @@
 !
 
 hasColormap
-    ^ self image notNil and:[self image colorMap notNil]
+    |img|
+    
+    ^ (img := self image) notNil 
+        and:[img colorMap notNil or:[ drawingColormap notNil or:[ self listOfColors notEmptyOrNil ]]]
 
     "Created: / 30-09-1998 / 23:53:55 / cg"
-    "Modified: / 04-07-2010 / 10:13:26 / cg"
+    "Modified: / 23-02-2017 / 09:57:45 / cg"
 !
 
 hasColormapAndColorSelected
@@ -5877,7 +5927,10 @@
     self windowGroup addPreEventHook:self.
     self colorCropTabSelectionIndexChanged.
 
-    "Modified: / 19-02-2017 / 23:39:10 / cg"
+    self drawingColor1Holder valueHolder:(imageEditView drawingColorHolders at:1).
+    self drawingColor2Holder valueHolder:(imageEditView drawingColorHolders at:2).
+
+    "Modified: / 23-02-2017 / 10:19:27 / cg"
 ! !
 
 !ImageEditor methodsFor:'user actions-colormap'!