Code

NR::Maybe => boost::optional
[inkscape.git] / src / widgets / sp-color-icc-selector.cpp
index 9e4edc5344cc4d9bdb866c4a45b66d8980efddd7..43a2a3cbe7ef7a573aef17ab06cb22e5442976b3 100644 (file)
@@ -3,6 +3,7 @@
 #endif
 #include <math.h>
 #include <gtk/gtkbutton.h>
+#include <gtk/gtkcombobox.h>
 #include <gtk/gtksignal.h>
 #include <gtk/gtklabel.h>
 #include <gtk/gtktable.h>
@@ -12,7 +13,9 @@
 #include "sp-color-icc-selector.h"
 #include "sp-color-scales.h"
 #include "svg/svg-icc-color.h"
+#include "document.h"
 #include "inkscape.h"
+#include "profile-manager.h"
 
 #define noDEBUG_LCMS
 
@@ -124,6 +127,7 @@ sp_color_icc_selector_class_init (SPColorICCSelectorClass *klass)
     widget_class->hide_all = sp_color_icc_selector_hide_all;
 }
 
+
 ColorICCSelector::ColorICCSelector( SPColorSelector* csel )
     : ColorSelector( csel ),
       _updating( FALSE ),
@@ -143,13 +147,9 @@ ColorICCSelector::ColorICCSelector( SPColorSelector* csel )
 #if ENABLE_LCMS
     ,
       _profileName(""),
-      _profIntent(Inkscape::RENDERING_INTENT_UNKNOWN),
-      _profileSpace(icSigRgbData),
-      _profileClass(icSigInputClass),
-      _prof(0),
-      _destProf(0),
-      _transf(0),
-      _profChannelCount(0)
+      _prof(),
+      _profChannelCount(0),
+      _profChangedID(0)
 #endif // ENABLE_LCMS
 {
 }
@@ -195,7 +195,7 @@ struct MapMap {
     DWORD inForm;
 };
 
-void getThings( DWORD space, gchar const**& namers, gchar const**& tippies, guint const*& scalies, DWORD& inputFormat ) {
+void getThings( DWORD space, gchar const**& namers, gchar const**& tippies, guint const*& scalies ) {
     MapMap possible[] = {
         {icSigXYZData,   TYPE_XYZ_16},
         {icSigLabData,   TYPE_Lab_16},
@@ -260,7 +260,6 @@ void getThings( DWORD space, gchar const**& namers, gchar const**& tippies, guin
         }
     }
 
-    inputFormat = possible[index].inForm;
     namers = names[index];
     tippies = tips[index];
     scalies = scales[index];
@@ -283,11 +282,10 @@ void ColorICCSelector::init()
     gtk_box_pack_start (GTK_BOX (_csel), t, TRUE, TRUE, 0);
 
 #if ENABLE_LCMS
-    DWORD inputFormat = TYPE_RGB_16;
     //guint partCount = _cmsChannelsOf( icSigRgbData );
     gchar const** names = 0;
     gchar const** tips = 0;
-    getThings( icSigRgbData, names, tips, _fooScales, inputFormat );
+    getThings( icSigRgbData, names, tips, _fooScales );
 #endif // ENABLE_LCMS
 
     /* Create components */
@@ -302,6 +300,20 @@ void ColorICCSelector::init()
     gtk_widget_show( _fixupBtn );
     gtk_table_attach( GTK_TABLE (t), _fixupBtn, 0, 1, row, row + 1, GTK_FILL, GTK_FILL, XPAD, YPAD );
 
+
+    _profileSel = gtk_combo_box_new_text();
+    gtk_combo_box_append_text( GTK_COMBO_BOX(_profileSel), "<none>" );
+    gtk_widget_show( _profileSel );
+    gtk_combo_box_set_active( GTK_COMBO_BOX(_profileSel), 0 );
+    gtk_table_attach( GTK_TABLE(t), _profileSel, 1, 2, row, row + 1, GTK_FILL, GTK_FILL, XPAD, YPAD );
+
+#if ENABLE_LCMS
+    _profChangedID = g_signal_connect( G_OBJECT(_profileSel), "changed", G_CALLBACK(_profileSelected), (gpointer)this );
+#else
+    gtk_widget_set_sensitive( _profileSel, false );
+#endif // ENABLE_LCMS
+
+
     row++;
 
     _fooCount = 4;
@@ -434,39 +446,183 @@ sp_color_icc_selector_new (void)
 }
 
 
-void ColorICCSelector::_fixupHit( GtkWidget* src, gpointer data )
+void ColorICCSelector::_fixupHit( GtkWidget* /*src*/, gpointer data )
 {
-    (void)src;
     ColorICCSelector* self = reinterpret_cast<ColorICCSelector*>(data);
     gtk_widget_set_sensitive( self->_fixupBtn, FALSE );
     self->_adjustmentChanged( self->_fooAdj[0], SP_COLOR_ICC_SELECTOR(self->_csel) );
 }
 
+#if ENABLE_LCMS
+void ColorICCSelector::_profileSelected( GtkWidget* /*src*/, gpointer data )
+{
+    ColorICCSelector* self = reinterpret_cast<ColorICCSelector*>(data);
+    gint activeIndex = gtk_combo_box_get_active( GTK_COMBO_BOX(self->_profileSel) );
+    gchar* name = (activeIndex != 0) ? gtk_combo_box_get_active_text( GTK_COMBO_BOX(self->_profileSel) ) : 0;
+    self->_switchToProfile( name );
+    if ( name ) {
+        g_free( name );
+    }
+}
+#endif // ENABLE_LCMS
+
+#ifdef ENABLE_LCMS
+void ColorICCSelector::_switchToProfile( gchar const* name )
+{
+    bool dirty = false;
+    SPColor tmp( _color );
+
+    if ( name ) {
+        if ( tmp.icc && tmp.icc->colorProfile == name ) {
+#ifdef DEBUG_LCMS
+             g_message("Already at name [%s]", name );
+#endif // DEBUG_LCMS
+        } else {
+#ifdef DEBUG_LCMS
+             g_message("Need to switch to profile [%s]", name );
+#endif // DEBUG_LCMS
+            if ( tmp.icc ) {
+                tmp.icc->colors.clear();
+            } else {
+                tmp.icc = new SVGICCColor();
+            }
+            tmp.icc->colorProfile = name;
+            Inkscape::ColorProfile* newProf = SP_ACTIVE_DOCUMENT->profileManager->find(name);
+            if ( newProf ) {
+                cmsHTRANSFORM trans = newProf->getTransfFromSRGB8();
+                if ( trans ) {
+                    guint32 val = _color.toRGBA32(0);
+                    guchar pre[4] = {
+                        SP_RGBA32_R_U(val),
+                        SP_RGBA32_G_U(val),
+                        SP_RGBA32_B_U(val),
+                        255};
+#ifdef DEBUG_LCMS
+                    g_message("Shoving in [%02x] [%02x] [%02x]", pre[0], pre[1], pre[2]);
+#endif // DEBUG_LCMS
+                    icUInt16Number post[4] = {0,0,0,0};
+                    cmsDoTransform( trans, pre, post, 1 );
+#ifdef DEBUG_LCMS
+                    g_message("got on out [%04x] [%04x] [%04x] [%04x]", post[0], post[1], post[2], post[3]);
+#endif // DEBUG_LCMS
+                    guint count = _cmsChannelsOf( newProf->getColorSpace() );
+
+                    gchar const** names = 0;
+                    gchar const** tips = 0;
+                    guint const* scales = 0;
+                    getThings( newProf->getColorSpace(), names, tips, scales );
+
+                    for ( guint i = 0; i < count; i++ ) {
+                        gdouble val = (((gdouble)post[i])/65535.0) * (gdouble)scales[i];
+#ifdef DEBUG_LCMS
+                        g_message("     scaled %d by %d to be %f", i, scales[i], val);
+#endif // DEBUG_LCMS
+                        tmp.icc->colors.push_back(val);
+                    }
+                    cmsHTRANSFORM retrans = newProf->getTransfToSRGB8();
+                    if ( retrans ) {
+                        cmsDoTransform( retrans, post, pre, 1 );
+#ifdef DEBUG_LCMS
+                        g_message("  back out [%02x] [%02x] [%02x]", pre[0], pre[1], pre[2]);
+#endif // DEBUG_LCMS
+                        tmp.set(SP_RGBA32_U_COMPOSE(pre[0], pre[1], pre[2], 0xff));
+                    }
+                }
+            }
+            dirty = true;
+        }
+    } else {
+#ifdef DEBUG_LCMS
+         g_message("NUKE THE ICC");
+#endif // DEBUG_LCMS
+        if ( tmp.icc ) {
+            delete tmp.icc;
+            tmp.icc = 0;
+            dirty = true;
+            _fixupHit( 0, this );
+        } else {
+#ifdef DEBUG_LCMS
+             g_message("No icc to nuke");
+#endif // DEBUG_LCMS
+        }
+    }
+
+    if ( dirty ) {
+#ifdef DEBUG_LCMS
+        g_message("+----------------");
+        g_message("+   new color is [%s]", tmp.toString().c_str());
+#endif // DEBUG_LCMS
+        _setProfile( tmp.icc );
+        //_adjustmentChanged( _fooAdj[0], SP_COLOR_ICC_SELECTOR(_csel) );
+        setColorAlpha( tmp, _alpha, true );
+#ifdef DEBUG_LCMS
+        g_message("+_________________");
+#endif // DEBUG_LCMS
+    }
+}
+#endif // ENABLE_LCMS
+
+void ColorICCSelector::_profilesChanged( std::string const & name )
+{
+#ifdef ENABLE_LCMS
+    GtkComboBox* combo = GTK_COMBO_BOX(_profileSel);
+
+    g_signal_handler_block( G_OBJECT(_profileSel), _profChangedID );
+
+    GtkTreeModel* model = gtk_combo_box_get_model( combo );
+    GtkTreeIter iter;
+    while ( gtk_tree_model_get_iter_first( model, &iter ) ) {
+        gtk_combo_box_remove_text( combo, 0 );
+    }
+
+    gtk_combo_box_append_text( combo, "<none>");
+
+    gtk_combo_box_set_active( combo, 0 );
+
+    int index = 1;
+    const GSList *current = sp_document_get_resource_list( SP_ACTIVE_DOCUMENT, "iccprofile" );
+    while ( current ) {
+        SPObject* obj = SP_OBJECT(current->data);
+        Inkscape::ColorProfile* prof = reinterpret_cast<Inkscape::ColorProfile*>(obj);
+        gtk_combo_box_append_text( combo, prof->name );
+        if ( name == prof->name ) {
+            gtk_combo_box_set_active( combo, index );
+        }
+
+        index++;
+        current = g_slist_next(current);
+    }
+
+    g_signal_handler_unblock( G_OBJECT(_profileSel), _profChangedID );
+#endif // ENABLE_LCMS
+}
+
 /* Helpers for setting color value */
 
-void ColorICCSelector::_colorChanged( const SPColor& color, gfloat alpha )
+void ColorICCSelector::_colorChanged()
 {
     _updating = TRUE;
 //     sp_color_icc_set_color( SP_COLOR_ICC( _icc ), &color );
 
 #ifdef DEBUG_LCMS
     g_message( "/^^^^^^^^^  %p::_colorChanged(%08x:%s)", this,
-               color.toRGBA32(alpha), ( (color.icc) ? color.icc->colorProfile.c_str(): "<null>" )
+               _color.toRGBA32(_alpha), ( (_color.icc) ? _color.icc->colorProfile.c_str(): "<null>" )
                );
 #endif // DEBUG_LCMS
 
 #ifdef DEBUG_LCMS
-    g_message("FLIPPIES!!!!     %p   '%s'", color.icc, (color.icc?color.icc->colorProfile.c_str():"<null>"));
+    g_message("FLIPPIES!!!!     %p   '%s'", _color.icc, (_color.icc ? _color.icc->colorProfile.c_str():"<null>"));
 #endif // DEBUG_LCMS
 
-    ColorScales::setScaled( _adj, alpha );
+    _profilesChanged( (_color.icc) ? _color.icc->colorProfile : std::string("") );
+    ColorScales::setScaled( _adj, _alpha );
 
 #if ENABLE_LCMS
-    _setProfile( color.icc );
+    _setProfile( _color.icc );
     _fixupNeeded = 0;
     gtk_widget_set_sensitive( _fixupBtn, FALSE );
 
-    if ( _transf ) {
+    if ( _prof && _prof->getTransfToSRGB8() ) {
         icUInt16Number tmp[4];
         for ( guint i = 0; i < _profChannelCount; i++ ) {
             gdouble val = 0.0;
@@ -480,15 +636,18 @@ void ColorICCSelector::_colorChanged( const SPColor& color, gfloat alpha )
             tmp[i] = val * 0x0ffff;
         }
         guchar post[4] = {0,0,0,0};
-        cmsDoTransform( _transf, tmp, post, 1 );
+        cmsDoTransform( _prof->getTransfToSRGB8(), tmp, post, 1 );
         guint32 other = SP_RGBA32_U_COMPOSE(post[0], post[1], post[2], 255 );
-        if ( other != color.toRGBA32(255) ) {
+        if ( other != _color.toRGBA32(255) ) {
             _fixupNeeded = other;
             gtk_widget_set_sensitive( _fixupBtn, TRUE );
-            //g_message("Color needs to change 0x%06x to 0x%06x", color.toRGBA32(255) >> 8, other >> 8 );
+#ifdef DEBUG_LCMS
+            g_message("Color needs to change 0x%06x to 0x%06x", _color.toRGBA32(255) >> 8, other >> 8 );
+#endif // DEBUG_LCMS
         }
     }
-
+#else
+    //(void)color;
 #endif // ENABLE_LCMS
     _updateSliders( -1 );
 
@@ -512,18 +671,7 @@ void ColorICCSelector::_setProfile( SVGICCColor* profile )
         // Need to clear out the prior one
         profChanged = true;
         _profileName.clear();
-        _profIntent = Inkscape::RENDERING_INTENT_UNKNOWN;
-        _profileSpace = icSigRgbData;
-        _profileClass = icSigInputClass;
         _prof = 0;
-        if ( _transf ) {
-            cmsDeleteTransform( _transf );
-            _transf = 0;
-        }
-        if ( _destProf ) {
-            cmsCloseProfile( _destProf );
-            _destProf = 0;
-        }
         _profChannelCount = 0;
     } else if ( profile && !_prof ) {
         profChanged = true;
@@ -533,80 +681,51 @@ void ColorICCSelector::_setProfile( SVGICCColor* profile )
         gtk_widget_hide( _fooLabel[i] );
         gtk_widget_hide( _fooSlider[i] );
         gtk_widget_hide( _fooBtn[i] );
-        gtk_adjustment_set_value( _fooAdj[i], 0.0 );
     }
 
     if ( profile ) {
-        _prof = Inkscape::colorprofile_get_handle( inkscape_active_document(),//SP_OBJECT_DOCUMENT( object ),
-                                                   &_profIntent,
-                                                   profile->colorProfile.c_str() );
-        if ( _prof ) {
-            _profileSpace = cmsGetColorSpace( _prof );
-            _profileClass = cmsGetDeviceClass( _prof );
-            if ( _profileClass != icSigNamedColorClass ) {
-                int intent = INTENT_PERCEPTUAL;
-                switch ( _profIntent ) {
-                    case Inkscape::RENDERING_INTENT_RELATIVE_COLORIMETRIC:
-                        intent = INTENT_RELATIVE_COLORIMETRIC;
-                        break;
-                    case Inkscape::RENDERING_INTENT_SATURATION:
-                        intent = INTENT_SATURATION;
-                        break;
-                    case Inkscape::RENDERING_INTENT_ABSOLUTE_COLORIMETRIC:
-                        intent = INTENT_ABSOLUTE_COLORIMETRIC;
-                        break;
-                    case Inkscape::RENDERING_INTENT_PERCEPTUAL:
-                    case Inkscape::RENDERING_INTENT_UNKNOWN:
-                    case Inkscape::RENDERING_INTENT_AUTO:
-                    default:
-                        intent = INTENT_PERCEPTUAL;
-                }
-                _destProf = cmsCreate_sRGBProfile();
-
-                _profChannelCount = _cmsChannelsOf( _profileSpace );
+        _prof = SP_ACTIVE_DOCUMENT->profileManager->find(profile->colorProfile.c_str());
+        if ( _prof && _prof->getProfileClass() != icSigNamedColorClass ) {
+            _profChannelCount = _cmsChannelsOf( _prof->getColorSpace() );
 
-                DWORD inputFormat = TYPE_RGB_16;
-                gchar const** names = 0;
-                gchar const** tips = 0;
-                getThings( _profileSpace, names, tips, _fooScales, inputFormat );
+            gchar const** names = 0;
+            gchar const** tips = 0;
+            getThings( _prof->getColorSpace(), names, tips, _fooScales );
 
-                _transf = cmsCreateTransform( _prof, inputFormat, _destProf, TYPE_RGBA_8, intent, 0 );
-                if ( profChanged ) {
-                    for ( guint i = 0; i < _profChannelCount; i++ ) {
-                        gtk_label_set_text_with_mnemonic( GTK_LABEL(_fooLabel[i]), names[i]);
+            if ( profChanged ) {
+                for ( guint i = 0; i < _profChannelCount; i++ ) {
+                    gtk_label_set_text_with_mnemonic( GTK_LABEL(_fooLabel[i]), names[i]);
 
-                        gtk_tooltips_set_tip( _tt, _fooSlider[i], tips[i], NULL );
-                        gtk_tooltips_set_tip( _tt, _fooBtn[i], tips[i], NULL );
+                    gtk_tooltips_set_tip( _tt, _fooSlider[i], tips[i], NULL );
+                    gtk_tooltips_set_tip( _tt, _fooBtn[i], tips[i], NULL );
 
-                        sp_color_slider_set_colors( SP_COLOR_SLIDER(_fooSlider[i]),
-                                                    SPColor(0.0, 0.0, 0.0).toRGBA32(0xff),
-                                                    SPColor(0.5, 0.5, 0.5).toRGBA32(0xff),
-                                                    SPColor(1.0, 1.0, 1.0).toRGBA32(0xff) );
+                    sp_color_slider_set_colors( SP_COLOR_SLIDER(_fooSlider[i]),
+                                                SPColor(0.0, 0.0, 0.0).toRGBA32(0xff),
+                                                SPColor(0.5, 0.5, 0.5).toRGBA32(0xff),
+                                                SPColor(1.0, 1.0, 1.0).toRGBA32(0xff) );
 /*
-                        _fooAdj[i] = GTK_ADJUSTMENT( gtk_adjustment_new( val, 0.0, _fooScales[i],  step, page, page ) );
-                        gtk_signal_connect( GTK_OBJECT( _fooAdj[i] ), "value_changed", GTK_SIGNAL_FUNC( _adjustmentChanged ), _csel );
+                    _fooAdj[i] = GTK_ADJUSTMENT( gtk_adjustment_new( val, 0.0, _fooScales[i],  step, page, page ) );
+                    gtk_signal_connect( GTK_OBJECT( _fooAdj[i] ), "value_changed", GTK_SIGNAL_FUNC( _adjustmentChanged ), _csel );
 
-                        sp_color_slider_set_adjustment( SP_COLOR_SLIDER(_fooSlider[i]), _fooAdj[i] );
-                        gtk_spin_button_set_adjustment( GTK_SPIN_BUTTON(_fooBtn[i]), _fooAdj[i] );
-                        gtk_spin_button_set_digits( GTK_SPIN_BUTTON(_fooBtn[i]), digits );
+                    sp_color_slider_set_adjustment( SP_COLOR_SLIDER(_fooSlider[i]), _fooAdj[i] );
+                    gtk_spin_button_set_adjustment( GTK_SPIN_BUTTON(_fooBtn[i]), _fooAdj[i] );
+                    gtk_spin_button_set_digits( GTK_SPIN_BUTTON(_fooBtn[i]), digits );
 */
-                        gtk_widget_show( _fooLabel[i] );
-                        gtk_widget_show( _fooSlider[i] );
-                        gtk_widget_show( _fooBtn[i] );
-                        gtk_adjustment_set_value( _fooAdj[i], 0.0 );
-                        //gtk_adjustment_set_value( _fooAdj[i], val );
-                    }
-                    for ( guint i = _profChannelCount; i < _fooCount; i++ ) {
-                        gtk_widget_hide( _fooLabel[i] );
-                        gtk_widget_hide( _fooSlider[i] );
-                        gtk_widget_hide( _fooBtn[i] );
-                        gtk_adjustment_set_value( _fooAdj[i], 0.0 );
-                    }
+                    gtk_widget_show( _fooLabel[i] );
+                    gtk_widget_show( _fooSlider[i] );
+                    gtk_widget_show( _fooBtn[i] );
+                    //gtk_adjustment_set_value( _fooAdj[i], 0.0 );
+                    //gtk_adjustment_set_value( _fooAdj[i], val );
+                }
+                for ( guint i = _profChannelCount; i < _fooCount; i++ ) {
+                    gtk_widget_hide( _fooLabel[i] );
+                    gtk_widget_hide( _fooSlider[i] );
+                    gtk_widget_hide( _fooBtn[i] );
                 }
-            } else {
-                // Give up for now on named colors
-                _prof = 0;
             }
+        } else {
+            // Give up for now on named colors
+            _prof = 0;
         }
     }
 
@@ -633,7 +752,7 @@ void ColorICCSelector::_updateSliders( gint ignore )
             gtk_adjustment_set_value( _fooAdj[i], val );
         }
 
-        if ( _transf ) {
+        if ( _prof->getTransfToSRGB8() ) {
             for ( guint i = 0; i < _profChannelCount; i++ ) {
                 if ( static_cast<gint>(i) != ignore ) {
                     icUInt16Number* scratch = getScratch();
@@ -653,12 +772,14 @@ void ColorICCSelector::_updateSliders( gint ignore )
                         }
                     }
 
-                    cmsDoTransform( _transf, scratch, _fooMap[i], 1024 );
+                    cmsDoTransform( _prof->getTransfToSRGB8(), scratch, _fooMap[i], 1024 );
                     sp_color_slider_set_map( SP_COLOR_SLIDER(_fooSlider[i]), _fooMap[i] );
                 }
             }
         }
     }
+#else
+    (void)ignore;
 #endif // ENABLE_LCMS
 
     guint32 start = _color.toRGBA32( 0x00 );
@@ -698,6 +819,7 @@ void ColorICCSelector::_adjustmentChanged( GtkAdjustment *adjustment, SPColorICC
          g_message("ALPHA");
 #endif // DEBUG_LCMS
      } else {
+#if ENABLE_LCMS
          for ( guint i = 0; i < iccSelector->_fooCount; i++ ) {
              if ( iccSelector->_fooAdj[i] == adjustment ) {
                  match = i;
@@ -717,7 +839,7 @@ void ColorICCSelector::_adjustmentChanged( GtkAdjustment *adjustment, SPColorICC
          }
          guchar post[4] = {0,0,0,0};
 
-         cmsDoTransform( iccSelector->_transf, tmp, post, 1 );
+         cmsDoTransform( iccSelector->_prof->getTransfToSRGB8(), tmp, post, 1 );
 
          SPColor other( SP_RGBA32_U_COMPOSE(post[0], post[1], post[2], 255) );
          other.icc = new SVGICCColor();
@@ -746,7 +868,7 @@ void ColorICCSelector::_adjustmentChanged( GtkAdjustment *adjustment, SPColorICC
                  newColor.icc->colors.push_back( val );
              }
          }
-
+#endif // ENABLE_LCMS
      }
      iccSelector->_updateInternals( newColor, scaled, iccSelector->_dragging );
      iccSelector->_updateSliders( match );
@@ -757,10 +879,8 @@ void ColorICCSelector::_adjustmentChanged( GtkAdjustment *adjustment, SPColorICC
 #endif // DEBUG_LCMS
 }
 
-void ColorICCSelector::_sliderGrabbed( SPColorSlider *slider, SPColorICCSelector *cs )
+void ColorICCSelector::_sliderGrabbed( SPColorSlider */*slider*/, SPColorICCSelector */*cs*/ )
 {
-    (void)slider;
-    (void)cs;
 //    ColorICCSelector* iccSelector = (ColorICCSelector*)(SP_COLOR_SELECTOR(cs)->base);
 //     if (!iccSelector->_dragging) {
 //         iccSelector->_dragging = TRUE;
@@ -769,10 +889,8 @@ void ColorICCSelector::_sliderGrabbed( SPColorSlider *slider, SPColorICCSelector
 //     }
 }
 
-void ColorICCSelector::_sliderReleased( SPColorSlider *slider, SPColorICCSelector *cs )
+void ColorICCSelector::_sliderReleased( SPColorSlider */*slider*/, SPColorICCSelector */*cs*/ )
 {
-    (void)slider;
-    (void)cs;
 //     ColorICCSelector* iccSelector = (ColorICCSelector*)(SP_COLOR_SELECTOR(cs)->base);
 //     if (iccSelector->_dragging) {
 //         iccSelector->_dragging = FALSE;
@@ -781,10 +899,12 @@ void ColorICCSelector::_sliderReleased( SPColorSlider *slider, SPColorICCSelecto
 //     }
 }
 
+#ifdef DEBUG_LCMS
 void ColorICCSelector::_sliderChanged( SPColorSlider *slider, SPColorICCSelector *cs )
+#else
+void ColorICCSelector::_sliderChanged( SPColorSlider */*slider*/, SPColorICCSelector */*cs*/ )
+#endif // DEBUG_LCMS
 {
-    (void)slider;
-    (void)cs;
 #ifdef DEBUG_LCMS
     g_message("Changed  %p and %p", slider, cs );
 #endif // DEBUG_LCMS