=== modified file 'src/widgets/sp-color-icc-selector.cpp' --- src/widgets/sp-color-icc-selector.cpp 2013-03-25 17:42:31 +0000 +++ src/widgets/sp-color-icc-selector.cpp 2013-05-10 16:59:22 +0000 @@ -13,6 +13,7 @@ #include "document.h" #include "inkscape.h" #include "profile-manager.h" +#include "cms-color-types.h" #define noDEBUG_LCMS @@ -72,6 +73,7 @@ G_END_DECLS static SPColorSelectorClass *parent_class; +int CMYK=0; #define XPAD 4 #define YPAD 1 @@ -125,6 +127,7 @@ : ColorSelector( csel ), _updating( FALSE ), _dragging( FALSE ), + _isCMYK ( FALSE ), _fixupNeeded(0), _fixupBtn(0), _profileSel(0), @@ -134,6 +137,8 @@ _fooSlider(0), _fooBtn(0), _fooLabel(0), + _fooDisplay(0), + _fooDisplayValue(0), _fooMap(0), _adj(0), _slider(0), @@ -260,6 +265,18 @@ scalies = scales[index]; } +void ColorICCSelector::getAdjustmentValue( GtkAdjustment *_adj, GtkEntryBuffer *_buf ) +{ + //if () { + char arr[4]; + gdouble temp=gtk_adjustment_get_value(_adj); + int _valInt=(int)((double)temp * 100.0 + 0.5); + itoa(_valInt,arr,10); + gtk_entry_buffer_set_text(_buf, arr, strlen(arr) ); + //} + //} + //gtk_entry_buffer_set_text(_buf, "---", 3 ); +} void getThings( Inkscape::ColorProfile *prof, gchar const**& namers, gchar const**& tippies, guint const*& scalies ) { getThings( asICColorSpaceSig(prof->getColorSpace()), namers, tippies, scalies ); @@ -289,6 +306,12 @@ gchar const** names = 0; gchar const** tips = 0; getThings( cmsSigRgbData, names, tips, _fooScales ); + + //if( asICColorSpaceSig(_prof->getColorSpace() ) == cmsSigCmykData ) { + + //} + + #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) /* Create components */ @@ -351,6 +374,8 @@ _fooSlider = new GtkWidget*[_fooCount]; _fooBtn = new GtkWidget*[_fooCount]; _fooLabel = new GtkWidget*[_fooCount]; + _fooDisplay = new GtkWidget*[_fooCount]; + _fooDisplayValue = new GtkEntryBuffer*[_fooCount]; _fooMap = new guchar*[_fooCount]; for ( guint i = 0; i < _fooCount; i++ ) { @@ -427,6 +452,33 @@ /* Signals */ g_signal_connect( G_OBJECT( _fooAdj[i] ), "value_changed", G_CALLBACK( _adjustmentChanged ), _csel ); + + _fooDisplayValue[i]=gtk_entry_buffer_new("000",3); + _fooDisplay[i]=gtk_entry_new_with_buffer(_fooDisplayValue[i]); + + gtk_entry_set_width_chars((GtkEntry*)_fooDisplay[i], 3); + gtk_entry_set_editable((GtkEntry*)_fooDisplay[i], FALSE ) ; + getAdjustmentValue( (GtkAdjustment*)_fooAdj[i],/*(GtkEntryBuffer*)*/_fooDisplayValue[i]); + + if(_isCMYK) + gtk_widget_show( _fooDisplay[i] ); + + + + +#if GTK_CHECK_VERSION(3,0,0) + gtk_widget_set_margin_left(_fooDisplay[i], XPAD); + gtk_widget_set_margin_right(_fooDisplay[i], 0); + gtk_widget_set_margin_top(_fooDisplay[i], YPAD); + gtk_widget_set_margin_bottom(_fooDisplay[i], YPAD); + gtk_widget_set_halign(_fooDisplay[i], GTK_ALIGN_CENTER); + gtk_widget_set_valign(_fooDisplay[i], GTK_ALIGN_CENTER); + gtk_grid_attach(GTK_GRID(t),_fooDisplay[i], 3, row, 1, 1); +#else + gtk_table_attach( GTK_TABLE (t), _fooDisplay[i], 3, 4, row, row + 1, GTK_SHRINK +/*(GtkAttachOptions)0*/, GTK_SHRINK +/*(GtkAttachOptions)0*/, 0/*XPAD*/, 0/*YPAD*/ ); +#endif g_signal_connect( G_OBJECT( _fooSlider[i] ), "grabbed", G_CALLBACK( _sliderGrabbed ), _csel ); g_signal_connect( G_OBJECT( _fooSlider[i] ), "released", G_CALLBACK( _sliderReleased ), _csel ); @@ -586,7 +638,7 @@ tmp.icc->colorProfile = name; Inkscape::ColorProfile* newProf = SP_ACTIVE_DOCUMENT->profileManager->find(name); if ( newProf ) { - cmsHTRANSFORM trans = newProf->getTransfFromSRGB8(); + cmsHTRANSFORM trans = newProf->getTransfFromSRGB8(); if ( trans ) { guint32 val = _color.toRGBA32(0); guchar pre[4] = { @@ -612,8 +664,15 @@ gchar const** tips = 0; guint const* scales = 0; getThings( asICColorSpaceSig(newProf->getColorSpace()), names, tips, scales ); - - for ( guint i = 0; i < count; i++ ) { + + if ( asICColorSpaceSig(newProf->getColorSpace()) == cmsSigCmykData ) + { + _isCMYK=TRUE; + } + else { + _isCMYK=FALSE; + } + 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); @@ -684,12 +743,19 @@ while ( current ) { SPObject* obj = SP_OBJECT(current->data); Inkscape::ColorProfile* prof = reinterpret_cast(obj); - - gtk_list_store_append (store, &iter); + + gtk_list_store_append (store, &iter); gtk_list_store_set (store, &iter, 0, gr_ellipsize_text(prof->name, 25).c_str(), 1, prof->name, -1); if ( name == prof->name ) { gtk_combo_box_set_active( combo, index ); + if ( asICColorSpaceSig(prof->getColorSpace()) == cmsSigCmykData ) + { + _isCMYK=TRUE; + } + else { + _isCMYK=FALSE; + } gtk_widget_set_tooltip_text(_profileSel, prof->name ); } @@ -732,6 +798,13 @@ if (_prof) { if (_prof->getTransfToSRGB8() ) { + if( asICColorSpaceSig(_prof->getColorSpace() ) == cmsSigCmykData ) { + _isCMYK = TRUE ; + + } + else { + _isCMYK = FALSE ; + } cmsUInt16Number tmp[4]; for ( guint i = 0; i < _profChannelCount; i++ ) { gdouble val = 0.0; @@ -794,6 +867,7 @@ gtk_widget_hide( _fooLabel[i] ); gtk_widget_hide( _fooSlider[i] ); gtk_widget_hide( _fooBtn[i] ); + gtk_widget_hide( _fooDisplay[i] ); } if ( profile ) { @@ -808,6 +882,14 @@ gchar const** names = 0; gchar const** tips = 0; getThings( asICColorSpaceSig(_prof->getColorSpace()), names, tips, _fooScales ); + + if ( asICColorSpaceSig(_prof->getColorSpace()) == cmsSigCmykData ) + { + _isCMYK=TRUE; + } + else { + _isCMYK=FALSE; + } if ( profChanged ) { for ( guint i = 0; i < _profChannelCount; i++ ) { @@ -831,6 +913,10 @@ gtk_widget_show( _fooLabel[i] ); gtk_widget_show( _fooSlider[i] ); gtk_widget_show( _fooBtn[i] ); + if(_isCMYK) { + gtk_widget_show( _fooDisplay[i] ); + } + //gtk_adjustment_set_value( _fooAdj[i], 0.0 ); //gtk_adjustment_set_value( _fooAdj[i], val ); } @@ -838,6 +924,7 @@ gtk_widget_hide( _fooLabel[i] ); gtk_widget_hide( _fooSlider[i] ); gtk_widget_hide( _fooBtn[i] ); + gtk_widget_hide( _fooDisplay[i] ); } } } else { @@ -867,6 +954,7 @@ } } gtk_adjustment_set_value( _fooAdj[i], val ); + getAdjustmentValue((GtkAdjustment*)_fooAdj[i], _fooDisplayValue[i]); } if ( _prof) { @@ -894,6 +982,7 @@ if ( trans ) { cmsDoTransform( trans, scratch, _fooMap[i], 1024 ); sp_color_slider_set_map( SP_COLOR_SLIDER(_fooSlider[i]), _fooMap[i] ); + getAdjustmentValue((GtkAdjustment*)_fooAdj[i], _fooDisplayValue[i]); } } } === modified file 'src/widgets/sp-color-icc-selector.h' --- src/widgets/sp-color-icc-selector.h 2012-02-13 09:27:56 +0000 +++ src/widgets/sp-color-icc-selector.h 2013-05-10 14:30:50 +0000 @@ -23,7 +23,7 @@ virtual ~ColorICCSelector(); virtual void init(); - + protected: virtual void _colorChanged(); @@ -43,9 +43,12 @@ #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) void _updateSliders( gint ignore ); void _profilesChanged( std::string const & name ); + void getAdjustmentValue( GtkAdjustment *_adj, GtkEntryBuffer *_buf ); + gboolean _updating : 1; gboolean _dragging : 1; + gboolean _isCMYK : 1; guint32 _fixupNeeded; GtkWidget* _fixupBtn; @@ -57,6 +60,8 @@ GtkWidget** _fooSlider; GtkWidget** _fooBtn; GtkWidget** _fooLabel; + GtkWidget** _fooDisplay; + GtkEntryBuffer** _fooDisplayValue; guchar** _fooMap; GtkAdjustment* _adj; /* Channel adjustment */