[gimp] Bug 593848 - FG color changed to black when FG-BG Editor tab created



commit 659cf3743e3c48e18a08ba41c83c7ef77c841410
Author: Michael Natterer <mitch gimp org>
Date:   Sun Nov 8 14:22:26 2009 +0100

    Bug 593848 - FG color changed to black when FG-BG Editor tab created
    
    When a color gets set on the module via GimpColorSelector::set_color(),
    make sure that the result of its transformation to CMYK doesn't
    get set back on GIMP. Also, when the color profile changes, make
    sure we only re-transform the RGB value to CMYK and don't set that
    result back on GIMP either.

 modules/color-selector-cmyk-lcms.c |   25 ++++++++++++++++++++-----
 1 files changed, 20 insertions(+), 5 deletions(-)
---
diff --git a/modules/color-selector-cmyk-lcms.c b/modules/color-selector-cmyk-lcms.c
index d468908..0d5d20f 100644
--- a/modules/color-selector-cmyk-lcms.c
+++ b/modules/color-selector-cmyk-lcms.c
@@ -244,6 +244,8 @@ colorsel_cmyk_set_color (GimpColorSelector *selector,
                          const GimpHSV     *hsv)
 {
   ColorselCmyk *module = COLORSEL_CMYK (selector);
+  gdouble       values[4];
+  gint          i;
 
   if (module->rgb2cmyk)
     {
@@ -266,10 +268,23 @@ colorsel_cmyk_set_color (GimpColorSelector *selector,
       gimp_rgb_to_cmyk (rgb, 1.0, &module->cmyk);
     }
 
-  gtk_adjustment_set_value (module->adj[0], module->cmyk.c * 100.0);
-  gtk_adjustment_set_value (module->adj[1], module->cmyk.m * 100.0);
-  gtk_adjustment_set_value (module->adj[2], module->cmyk.y * 100.0);
-  gtk_adjustment_set_value (module->adj[3], module->cmyk.k * 100.0);
+  values[0] = module->cmyk.c * 100.0;
+  values[1] = module->cmyk.m * 100.0;
+  values[2] = module->cmyk.y * 100.0;
+  values[3] = module->cmyk.k * 100.0;
+
+  for (i = 0; i < 4; i++)
+    {
+      g_signal_handlers_block_by_func (module->adj[i],
+                                       colorsel_cmyk_adj_update,
+                                       module);
+
+      gtk_adjustment_set_value (module->adj[i], values[i]);
+
+      g_signal_handlers_unblock_by_func (module->adj[i],
+                                         colorsel_cmyk_adj_update,
+                                         module);
+    }
 }
 
 static void
@@ -442,5 +457,5 @@ colorsel_cmyk_config_changed (ColorselCmyk *module)
 
  out:
   if (! module->in_destruction)
-    gimp_color_selector_set_color (selector, &selector->rgb, &selector->hsv);
+    colorsel_cmyk_set_color (selector, &selector->rgb, &selector->hsv);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]