From: joncruz Date: Fri, 5 Oct 2007 03:45:35 +0000 (+0000) Subject: Enabled custom out of gamut warning color X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d49c7420c14dd51944a6db7d6053dea41396ee53;p=inkscape.git Enabled custom out of gamut warning color --- diff --git a/src/color-profile.cpp b/src/color-profile.cpp index 609c14cc1..eb8f7754c 100644 --- a/src/color-profile.cpp +++ b/src/color-profile.cpp @@ -14,6 +14,7 @@ #include #include +#include #ifdef DEBUG_LCMS #include @@ -548,6 +549,7 @@ int errorHandlerCB(int ErrorCode, const char *ErrorText) } static bool gamutWarn = false; +static Gdk::Color lastGamutColor("#00ff00"); static bool lastBPC = false; static bool lastPreserveBlack = false; static int lastIntent = INTENT_PERCEPTUAL; @@ -646,6 +648,8 @@ cmsHPROFILE Inkscape::colorprofile_get_proof_profile_handle() icColorSpaceSignature space = cmsGetColorSpace(theOne); icProfileClassSignature profClass = cmsGetDeviceClass(theOne); + (void)space; + (void)profClass; /* if ( profClass != icSigDisplayClass ) { g_warning("Not a display profile"); @@ -683,12 +687,15 @@ cmsHTRANSFORM Inkscape::colorprofile_get_display_transform() int proofIntent = prefs_get_int_attribute_limited( "options.softproof", "intent", 0, 0, 3 ); bool bpc = prefs_get_int_attribute_limited( "options.softproof", "bpc", 0, 0, 1 ); bool preserveBlack = prefs_get_int_attribute_limited( "options.softproof", "preserveblack", 0, 0, 1 ); + gchar const* colorStr = prefs_get_string_attribute("options.softproof", "gamutcolor"); + Gdk::Color gamutColor( (colorStr && colorStr[0]) ? colorStr : "#00ff00"); if ( (warn != gamutWarn) || (lastIntent != intent) || (lastProofIntent != proofIntent) || (bpc != lastBPC) || (preserveBlack != lastPreserveBlack) + || (gamutColor != lastGamutColor) ) { gamutWarn = warn; if ( transf ) { @@ -699,6 +706,7 @@ cmsHTRANSFORM Inkscape::colorprofile_get_display_transform() lastProofIntent = proofIntent; lastBPC = bpc; lastPreserveBlack = preserveBlack; + lastGamutColor = gamutColor; } // Fecth these now, as they might clear the transform as a side effect. @@ -713,7 +721,7 @@ cmsHTRANSFORM Inkscape::colorprofile_get_display_transform() DWORD dwFlags = cmsFLAGS_SOFTPROOFING; if ( gamutWarn ) { dwFlags |= cmsFLAGS_GAMUTCHECK; - cmsSetAlarmCodes(0, 255, 0); + cmsSetAlarmCodes(gamutColor.get_red() >> 8, gamutColor.get_green() >> 8, gamutColor.get_blue() >> 8); } if ( bpc ) { dwFlags |= cmsFLAGS_BLACKPOINTCOMPENSATION; diff --git a/src/preferences-skeleton.h b/src/preferences-skeleton.h index 242a9d919..ab40f4c00 100644 --- a/src/preferences-skeleton.h +++ b/src/preferences-skeleton.h @@ -190,6 +190,7 @@ static char const preferences_skeleton[] = " id=\"softproof\"\n" " enable=\"0\"\n" " intent=\"0\"\n" +" gamutcolor=\"#00FF00\"\n" " gamutwarn=\"0\"\n" " bpc=\"0\"\n" " preserveblack=\"0\"\n" diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 9a3125381..9ca4b54cb 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -656,6 +656,19 @@ static void proofComboChanged( Gtk::ComboBoxText* combo ) forceUpdates(); } } + +static void gamutColorChanged( Gtk::ColorButton* btn ) { + Gdk::Color color = btn->get_color(); + gushort r = color.get_red(); + gushort g = color.get_green(); + gushort b = color.get_blue(); + + gchar* tmp = g_strdup_printf("#%02x%02x%02x", (r >> 8), (g >> 8), (b >> 8) ); + + prefs_set_string_attribute( "options.softproof", "gamutcolor", tmp ); + g_free(tmp); + forceUpdates(); +} #endif // ENABLE_LCMS void InkscapePreferences::initPageCMS() @@ -692,9 +705,9 @@ void InkscapePreferences::initPageCMS() _page_cms.add_line( false, "", _cms_gamutwarn, "", _("Highlights colors that are out of gamut for the target device."), false); - Gdk::Color tmpColor("#00ff00"); + gchar const* colorStr = prefs_get_string_attribute("options.softproof", "gamutcolor"); + Gdk::Color tmpColor( (colorStr && colorStr[0]) ? colorStr : "#00ff00"); _cms_gamutcolor.set_color( tmpColor ); - _cms_gamutcolor.set_sensitive( false ); _page_cms.add_line( true, "Out of gamut warning color:", _cms_gamutcolor, "", _("Selects the color used for out of gamut warning."), false); @@ -745,6 +758,7 @@ void InkscapePreferences::initPageCMS() _cms_display.signal_toggled().connect( sigc::ptr_fun(forceUpdates) ); _cms_softproof.signal_toggled().connect( sigc::ptr_fun(forceUpdates) ); _cms_gamutwarn.signal_toggled().connect( sigc::ptr_fun(forceUpdates) ); + _cms_gamutcolor.signal_color_set().connect( sigc::bind( sigc::ptr_fun(gamutColorChanged), &_cms_gamutcolor) ); _cms_proof_blackpoint.signal_toggled().connect( sigc::ptr_fun(forceUpdates) ); _cms_proof_preserveblack.signal_toggled().connect( sigc::ptr_fun(forceUpdates) );