Code

preserve icc on color wheel selector
authorJucaBlues <JucaBlues@users.sourceforge.net>
Thu, 13 Aug 2009 04:03:19 +0000 (04:03 +0000)
committerJucaBlues <JucaBlues@users.sourceforge.net>
Thu, 13 Aug 2009 04:03:19 +0000 (04:03 +0000)
src/widgets/sp-color-wheel-selector.cpp

index 174b071f972680d3a55be23dacd430500e3b1ecf..bc8c4763bc4826dd6ac38a3d42563978588e14c8 100644 (file)
@@ -10,7 +10,8 @@
 #include "../dialogs/dialog-events.h"
 #include "sp-color-wheel-selector.h"
 #include "sp-color-scales.h"
-
+#include "sp-color-icc-selector.h"
+#include "../svg/svg-icc-color.h"
 
 G_BEGIN_DECLS
 
@@ -237,6 +238,10 @@ void ColorWheelSelector::_adjustmentChanged( GtkAdjustment *adjustment, SPColorW
 
     wheelSelector->_updating = TRUE;
 
+    /* Preserve ICC color */
+    ColorSelector* selector = (ColorSelector*)(SP_COLOR_SELECTOR(cs)->base);
+    wheelSelector->_color.icc = selector->getColor().icc ? new SVGICCColor(*selector->getColor().icc) : 0;
+
     wheelSelector->_updateInternals( wheelSelector->_color, ColorScales::getScaled( wheelSelector->_adj ), wheelSelector->_dragging );
 
     wheelSelector->_updating = FALSE;
@@ -249,6 +254,11 @@ void ColorWheelSelector::_sliderGrabbed( SPColorSlider *slider, SPColorWheelSele
     if (!wheelSelector->_dragging) {
         wheelSelector->_dragging = TRUE;
         wheelSelector->_grabbed();
+
+        /* Preserve ICC color */
+        ColorSelector* selector = (ColorSelector*)(SP_COLOR_SELECTOR(cs)->base);
+        wheelSelector->_color.icc = selector->getColor().icc ? new SVGICCColor(*selector->getColor().icc) : 0;
+
         wheelSelector->_updateInternals( wheelSelector->_color, ColorScales::getScaled( wheelSelector->_adj ), wheelSelector->_dragging );
     }
 }
@@ -260,6 +270,11 @@ void ColorWheelSelector::_sliderReleased( SPColorSlider *slider, SPColorWheelSel
     if (wheelSelector->_dragging) {
         wheelSelector->_dragging = FALSE;
         wheelSelector->_released();
+
+        /* Preserve ICC color */
+        ColorSelector* selector = (ColorSelector*)(SP_COLOR_SELECTOR(cs)->base);
+        wheelSelector->_color.icc = selector->getColor().icc ? new SVGICCColor(*selector->getColor().icc) : 0;
+
         wheelSelector->_updateInternals( wheelSelector->_color, ColorScales::getScaled( wheelSelector->_adj ), wheelSelector->_dragging );
     }
 }
@@ -269,6 +284,10 @@ void ColorWheelSelector::_sliderChanged( SPColorSlider *slider, SPColorWheelSele
     (void)slider;
     ColorWheelSelector* wheelSelector = (ColorWheelSelector*)(SP_COLOR_SELECTOR(cs)->base);
 
+    /* Preserve ICC color */
+    ColorSelector* selector = (ColorSelector*)(SP_COLOR_SELECTOR(cs)->base);
+    wheelSelector->_color.icc = selector->getColor().icc ? new SVGICCColor(*selector->getColor().icc) : 0;
+
     wheelSelector->_updateInternals( wheelSelector->_color, ColorScales::getScaled( wheelSelector->_adj ), wheelSelector->_dragging );
 }
 
@@ -285,6 +304,10 @@ void ColorWheelSelector::_wheelChanged( SPColorWheel *wheel, SPColorWheelSelecto
 
     sp_color_slider_set_colors (SP_COLOR_SLIDER(wheelSelector->_slider), start, mid, end);
 
+    /* Preserve ICC color */
+    ColorSelector* selector = (ColorSelector*)(SP_COLOR_SELECTOR(cs)->base);
+    color.icc = selector->getColor().icc ? new SVGICCColor(*selector->getColor().icc) : 0;
+
     wheelSelector->_updateInternals( color, wheelSelector->_alpha, sp_color_wheel_is_adjusting( wheel ) );
 }