diff --git a/rtdata/languages/default b/rtdata/languages/default index a4b2d0442..0a99ae040 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1347,6 +1347,7 @@ TP_COLORAPP_TCMODE_LABEL2;Curve mode 2 TP_COLORAPP_TCMODE_LABEL3;Curve chroma mode TP_COLORAPP_TCMODE_LIGHTNESS;Lightness TP_COLORAPP_TCMODE_SATUR;Saturation +TP_COLORAPP_TEMP_TOOLTIP;To select an illuminant always Tint=1.\nA temp=2856\nD50 temp=5001\nD55 temp=5500\nD65 temp=6504\nD75 temp=7500 TP_COLORAPP_TONECIE;Tone mapping using CIECAM02 TP_COLORAPP_TONECIE_TOOLTIP;If this option is disabled, tone mapping is done in L*a*b* space.\nIf this option is enabled, tone mapping is done using CIECAM02.\nThe Tone Mapping tool must be enabled for this setting to take effect. TP_COLORAPP_WBCAM;WB [RT+CAT02] + [output] diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 441c7a47d..df75e7a0e 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -962,10 +962,10 @@ void Crop::update (int todo) parent->ipf.ciecam_02float (cieCrop, float (adap), begh, endh, 1, 2, labnCrop, ¶ms, parent->customColCurve1, parent->customColCurve2, parent->customColCurve3, dummy, dummy, parent->CAMBrightCurveJ, parent->CAMBrightCurveQ, parent->CAMMean, 5, skip, execsharp, d, dj, yb, 1); } else { - double dd, dj; // not used after this block + double dd, dj, yb; // not used after this block parent->ipf.ciecam_02 (cieCrop, adap, begh, endh, 1, 2, labnCrop, ¶ms, parent->customColCurve1, parent->customColCurve2, parent->customColCurve3, - dummy, dummy, parent->CAMBrightCurveJ, parent->CAMBrightCurveQ, parent->CAMMean, 5, skip, execsharp, dd, dj, 1); + dummy, dummy, parent->CAMBrightCurveJ, parent->CAMBrightCurveQ, parent->CAMMean, 5, skip, execsharp, dd, dj, yb, 1); } } else { // CIECAM is disbaled, we free up its image buffer to save some space diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index f63b6ba48..d288a23c1 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -772,10 +772,14 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) acListener->autoCamChanged(100.*(double)d, 100.*(double)dj); } - if((params.colorappearance.autoadapscen || params.colorappearance.autoybscen) && acListener && params.colorappearance.enabled) { - acListener->adapCamChanged(adap, (int) yb); //real value of adapt scene luminosity and Yb scene + if(params.colorappearance.autoadapscen && acListener && params.colorappearance.enabled) { + acListener->adapCamChanged(adap); //real value of adapt scene } + if(params.colorappearance.autoybscen && acListener && params.colorappearance.enabled) { + acListener->ybCamChanged((int) yb); //real value Yb scene + } + readyphase++; } else { // CIECAM is disabled, we free up its image buffer to save some space diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index dadf0cd2b..f67ba3660 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -210,7 +210,7 @@ void ImProcFunctions::firstAnalysis (const Imagefloat* const original, const Pro // Copyright (c) 2012 Jacques Desmis void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh, int pW, int pwb, LabImage* lab, const ProcParams* params, const ColorAppearance & customColCurve1, const ColorAppearance & customColCurve2, const ColorAppearance & customColCurve3, - LUTu & histLCAM, LUTu & histCCAM, LUTf & CAMBrightCurveJ, LUTf & CAMBrightCurveQ, float &mean, int Iterates, int scale, bool execsharp, double &d, double &dj, int rtt) + LUTu & histLCAM, LUTu & histCCAM, LUTf & CAMBrightCurveJ, LUTf & CAMBrightCurveQ, float &mean, int Iterates, int scale, bool execsharp, double &d, double &dj, double &yb, int rtt) { if (params->colorappearance.enabled) { //int lastskip; @@ -266,7 +266,7 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh double Xwout, Zwout; double Xwsc, Zwsc; - double f, c, nc, yb = 0., la, xw, yw, zw, f2 = 0., c2 = 0., nc2 = 0., yb2 = 0., la2; + double f = 0., c = 0., nc = 0., yb = 0., la, xw, yw, zw, f2 = 0., c2 = 0., nc2 = 0., yb2 = 0., la2; double fl, n, nbb, ncb, aw; double xwd = 0., ywd, zwd = 0.; double xws, yws, zws; @@ -280,36 +280,50 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh ColorTemp::temp2mulxyz (params->colorappearance.tempout, params->colorappearance.greenout, "Custom", Xwout, Zwout); ColorTemp::temp2mulxyz (params->colorappearance.tempsc, params->colorappearance.greensc, "Custom", Xwsc, Zwsc); - //viewing condition for surround - if (params->colorappearance.surround == "Average") { + //viewing condition for surrsrc + if (params->colorappearance.surrsrc == "Average") { f = 1.00; c = 0.69; nc = 1.00; + } else if (params->colorappearance.surrsrc == "Dim") { + f = 0.9; + c = 0.59; + nc = 0.9; + } else if (params->colorappearance.surrsrc == "Dark") { + f = 0.8; + c = 0.525; + nc = 0.8; + } else if (params->colorappearance.surrsrc == "ExtremelyDark") { + f = 0.8; + c = 0.41; + nc = 0.8; + } + + + //viewing condition for surround + if (params->colorappearance.surround == "Average") { f2 = 1.0, c2 = 0.69, nc2 = 1.0; } else if (params->colorappearance.surround == "Dim") { f2 = 0.9; c2 = 0.59; nc2 = 0.9; - f = 1.0, c = 0.69, nc = 1.0; } else if (params->colorappearance.surround == "Dark") { f2 = 0.8; c2 = 0.525; nc2 = 0.8; - f = 1.0, c = 0.69, nc = 1.0; } else if (params->colorappearance.surround == "ExtremelyDark") { f2 = 0.8; c2 = 0.41; nc2 = 0.8; - f = 1.0, c = 0.69, nc = 1.0; } - +/* //scene condition for surround if (params->colorappearance.surrsource) { f = 0.85; // if user => source image has surround very dark c = 0.55; nc = 0.85; } - +*/ //with which algorithme if (params->colorappearance.algo == "JC") { alg = 0; @@ -513,7 +527,9 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh } } - if (settings->viewinggreySc == 0) { //auto + // if (settings->viewinggreySc == 0) { //auto + if (params->colorappearance.autoybscen && pwb == 2) {//auto + if (mean < 15.f) { yb = 3.0; } else if (mean < 30.f) { @@ -537,7 +553,9 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh } else { yb = 90.0; } - } + } else { + yb = params->colorappearance.ybscen; + } if (settings->viewinggreySc == 1) { yb = 18.0; @@ -1514,7 +1532,7 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int float Yw; Yw = 1.0; double Xw, Zw; - float f, nc, la, c, xw, yw, zw, f2 = 1.f, c2 = 1.f, nc2 = 1.f, yb2; + float f = 0.f, nc = 0.f, la, c = 0.f, xw, yw, zw, f2 = 1.f, c2 = 1.f, nc2 = 1.f, yb2; float fl, n, nbb, ncb, aw; //d float xwd, ywd, zwd, xws, yws, zws; int alg = 0; @@ -1531,36 +1549,50 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int ColorTemp::temp2mulxyz (params->colorappearance.tempout, params->colorappearance.greenout, "Custom", Xwout, Zwout); ColorTemp::temp2mulxyz (params->colorappearance.tempsc, params->colorappearance.greensc, "Custom", Xwsc, Zwsc); - //viewing condition for surround - if (params->colorappearance.surround == "Average") { + //viewing condition for surrsrc + if (params->colorappearance.surrsrc == "Average") { f = 1.00f; c = 0.69f; nc = 1.00f; + } else if (params->colorappearance.surrsrc == "Dim") { + f = 0.9f; + c = 0.59f; + nc = 0.9f; + } else if (params->colorappearance.surrsrc == "Dark") { + f = 0.8f; + c = 0.525f; + nc = 0.8f; + } else if (params->colorappearance.surrsrc == "ExtremelyDark") { + f = 0.8f; + c = 0.41f; + nc = 0.8f; + } + + + //viewing condition for surround + if (params->colorappearance.surround == "Average") { f2 = 1.0f, c2 = 0.69f, nc2 = 1.0f; } else if (params->colorappearance.surround == "Dim") { f2 = 0.9f; c2 = 0.59f; nc2 = 0.9f; - f = 1.0f, c = 0.69f, nc = 1.0f; } else if (params->colorappearance.surround == "Dark") { f2 = 0.8f; c2 = 0.525f; nc2 = 0.8f; - f = 1.0f, c = 0.69f, nc = 1.0f; } else if (params->colorappearance.surround == "ExtremelyDark") { f2 = 0.8f; c2 = 0.41f; nc2 = 0.8f; - f = 1.0f, c = 0.69f, nc = 1.0f; } - +/* //scene condition for surround if (params->colorappearance.surrsource) { f = 0.85f; // if user => source image has surround very dark c = 0.55f; nc = 0.85f; } - +*/ //with which algorithm if (params->colorappearance.algo == "JC") { alg = 0; diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index 115046067..d9cd17ef5 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -229,7 +229,7 @@ public: LUTu &histLCAM, LUTu &histCCAM, LUTf & CAMBrightCurveJ, LUTf & CAMBrightCurveQ, float &mean, int Iterates, int scale, bool execsharp, float &d, float &dj, float &yb, int rtt); void ciecam_02 (CieImage* ncie, double adap, int begh, int endh, int pW, int pwb, LabImage* lab, const ProcParams* params, const ColorAppearance & customColCurve1, const ColorAppearance & customColCurve, const ColorAppearance & customColCurve3, - LUTu &histLCAM, LUTu &histCCAM, LUTf & CAMBrightCurveJ, LUTf & CAMBrightCurveQ, float &mean, int Iterates, int scale, bool execsharp, double &d, double &dj, int rtt); + LUTu &histLCAM, LUTu &histCCAM, LUTf & CAMBrightCurveJ, LUTf & CAMBrightCurveQ, float &mean, int Iterates, int scale, bool execsharp, double &d, double &dj, double &yb, int rtt); void chromiLuminanceCurve (PipetteBuffer *pipetteBuffer, int pW, LabImage* lold, LabImage* lnew, LUTf &acurve, LUTf &bcurve, LUTf & satcurve, LUTf & satclcurve, LUTf &clcurve, LUTf &curve, bool utili, bool autili, bool butili, bool ccutili, bool cclutili, bool clcutili, LUTu &histCCurve, LUTu &histLurve); void vibrance (LabImage* lab);//Jacques' vibrance void colorCurve (LabImage* lold, LabImage* lnew); diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index fa97d5f7d..6114dc1b5 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -1155,6 +1155,7 @@ void ProcParams::setDefaults () colorappearance.degreeout = 90; colorappearance.autodegreeout = true; colorappearance.surround = "Average"; + colorappearance.surrsrc = "Average"; colorappearance.adaplum = 16; colorappearance.badpixsl = 0; colorappearance.adapscen = 2000.0; @@ -2110,6 +2111,10 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b keyFile.set_string ("Color appearance", "Surround", colorappearance.surround); } + if (!pedited || pedited->colorappearance.surrsrc) { + keyFile.set_string ("Color appearance", "Surrsrc", colorappearance.surrsrc); + } + // if (!pedited || pedited->colorappearance.backgrd) keyFile.set_integer ("Color appearance", "Background", colorappearance.backgrd); if (!pedited || pedited->colorappearance.adaplum) { keyFile.set_double ("Color appearance", "AdaptLum", colorappearance.adaplum); @@ -5025,6 +5030,14 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) } } + if (keyFile.has_key ("Color appearance", "Surrsrc")) { + colorappearance.surrsrc = keyFile.get_string ("Color appearance", "Surrsrc"); + + if (pedited) { + pedited->colorappearance.surrsrc = true; + } + } + // if (keyFile.has_key ("Color appearance", "Background")) {colorappearance.backgrd = keyFile.get_integer ("Color appearance", "Background"); if (pedited) pedited->colorappearance.backgrd = true; } if (keyFile.has_key ("Color appearance", "AdaptLum")) { colorappearance.adaplum = keyFile.get_double ("Color appearance", "AdaptLum"); @@ -8326,6 +8339,7 @@ bool ProcParams::operator== (const ProcParams& other) && colorappearance.degreeout == other.colorappearance.degreeout && colorappearance.autodegreeout == other.colorappearance.autodegreeout && colorappearance.surround == other.colorappearance.surround + && colorappearance.surrsrc == other.colorappearance.surrsrc && colorappearance.adapscen == other.colorappearance.adapscen && colorappearance.autoadapscen == other.colorappearance.autoadapscen && colorappearance.ybscen == other.colorappearance.ybscen diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 405609823..53561ce16 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -595,6 +595,7 @@ public: eCTCModeId curveMode3; Glib::ustring surround; + Glib::ustring surrsrc; double adapscen; bool autoadapscen; int ybscen; diff --git a/rtengine/rtengine.h b/rtengine/rtengine.h index 6678ac1fd..cd4cd4942 100644 --- a/rtengine/rtengine.h +++ b/rtengine/rtengine.h @@ -274,7 +274,9 @@ class AutoCamListener public : virtual ~AutoCamListener() {} virtual void autoCamChanged (double ccam, double ccamout) {} - virtual void adapCamChanged (double cadap, int ybscn) {} + virtual void adapCamChanged (double cadap) {} + virtual void ybCamChanged (int yb) {} + }; class AutoChromaListener diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index de13cfc0e..9d5daa936 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -1125,16 +1125,16 @@ private: float d, dj, yb; ipf.ciecam_02float (cieView, float(adap), begh, endh, 1, 2, labView, ¶ms, customColCurve1, customColCurve2, customColCurve3, dummy, dummy, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, 1, true, d, dj, yb, 1); } else { - double dd, dj; - ipf.ciecam_02 (cieView, adap, begh, endh, 1, 2, labView, ¶ms, customColCurve1, customColCurve2, customColCurve3, dummy, dummy, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, 1, true, dd, dj, 1); + double dd, dj, yb; + ipf.ciecam_02 (cieView, adap, begh, endh, 1, 2, labView, ¶ms, customColCurve1, customColCurve2, customColCurve3, dummy, dummy, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, 1, true, dd, dj, yb, 1); } } else { if(settings->ciecamfloat) { float d, dj, yb; ipf.ciecam_02float (cieView, float(adap), begh, endh, 1, 2, labView, ¶ms, customColCurve1, customColCurve2, customColCurve3, dummy, dummy, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, 1, true, d, dj, yb, 1); } else { - double dd, dj; - ipf.ciecam_02 (cieView, adap, begh, endh, 1, 2, labView, ¶ms, customColCurve1, customColCurve2, customColCurve3, dummy, dummy, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, 1, true, dd, dj, 1); + double dd, dj, yb; + ipf.ciecam_02 (cieView, adap, begh, endh, 1, 2, labView, ¶ms, customColCurve1, customColCurve2, customColCurve3, dummy, dummy, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, 1, true, dd, dj, yb, 1); } } } diff --git a/rtgui/colorappearance.cc b/rtgui/colorappearance.cc index 95caa1450..91172cf6a 100644 --- a/rtgui/colorappearance.cc +++ b/rtgui/colorappearance.cc @@ -147,9 +147,25 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel (this, "colorappearance" degree->set_tooltip_markup (M ("TP_COLORAPP_DEGREE_TOOLTIP")); p1VBox->pack_start (*degree); - surrsource = Gtk::manage (new Gtk::CheckButton (M ("TP_COLORAPP_SURSOURCE"))); - surrsource->set_tooltip_markup (M ("TP_COLORAPP_SURSOURCE_TOOLTIP")); - p1VBox->pack_start (*surrsource, Gtk::PACK_SHRINK); + // surrsource = Gtk::manage (new Gtk::CheckButton (M ("TP_COLORAPP_SURSOURCE"))); + // surrsource->set_tooltip_markup (M ("TP_COLORAPP_SURSOURCE_TOOLTIP")); + + + Gtk::HBox* surrHBox1 = Gtk::manage (new Gtk::HBox ()); + surrHBox1->set_spacing (2); + surrHBox1->set_tooltip_markup (M ("TP_COLORAPP_SURROUND_TOOLTIP")); + Gtk::Label* surrLabel1 = Gtk::manage (new Gtk::Label (M ("TP_COLORAPP_SURROUND") + ":")); + surrHBox1->pack_start (*surrLabel1, Gtk::PACK_SHRINK); + surrsrc = Gtk::manage (new MyComboBoxText ()); + surrsrc->append (M ("TP_COLORAPP_SURROUND_AVER")); + surrsrc->append (M ("TP_COLORAPP_SURROUND_DIM")); + surrsrc->append (M ("TP_COLORAPP_SURROUND_DARK")); + surrsrc->append (M ("TP_COLORAPP_SURROUND_EXDARK")); + surrsrc->set_active (0); + surrHBox1->pack_start (*surrsrc); + p1VBox->pack_start (*surrHBox1); + + // p1VBox->pack_start (*surrsource, Gtk::PACK_SHRINK); Gtk::HBox* wbmHBox = Gtk::manage (new Gtk::HBox ()); wbmHBox->set_spacing (2); @@ -173,6 +189,7 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel (this, "colorappearance" tempsc = Gtk::manage (new Adjuster (M ("TP_WBALANCE_TEMPERATURE"), MINTEMP0, MAXTEMP0, 5, CENTERTEMP0, itempL, itempR, &wbSlider2Temp, &wbTemp2Slider)); greensc = Gtk::manage (new Adjuster (M ("TP_WBALANCE_GREEN"), MINGREEN0, MAXGREEN0, 0.001, 1.0, igreenL, igreenR)); + tempsc->set_tooltip_markup (M ("TP_COLORAPP_TEMP_TOOLTIP")); tempsc->show(); greensc->show(); @@ -502,6 +519,7 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel (this, "colorappearance" tempout = Gtk::manage (new Adjuster (M ("TP_WBALANCE_TEMPERATURE"), MINTEMP0, MAXTEMP0, 5, CENTERTEMP0, itempR1, itempL1, &wbSlider2Temp, &wbTemp2Slider)); greenout = Gtk::manage (new Adjuster (M ("TP_WBALANCE_GREEN"), MINGREEN0, MAXGREEN0, 0.001, 1.0, igreenR1, igreenL1)); ybout = Gtk::manage (new Adjuster (M ("TP_COLORAPP_YB"), 5, 90, 1, 18)); + tempout->set_tooltip_markup (M ("TP_COLORAPP_TEMP_TOOLTIP")); tempout->show(); greenout->show(); @@ -572,10 +590,11 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel (this, "colorappearance" // ------------------------ Listening events - surrconn = surrsource->signal_toggled().connect ( sigc::mem_fun (*this, &ColorAppearance::surrsource_toggled) ); + // surrconn = surrsource->signal_toggled().connect ( sigc::mem_fun (*this, &ColorAppearance::surrsource_toggled) ); wbmodelconn = wbmodel->signal_changed().connect ( sigc::mem_fun (*this, &ColorAppearance::wbmodelChanged) ); algoconn = algo->signal_changed().connect ( sigc::mem_fun (*this, &ColorAppearance::algoChanged) ); surroundconn = surround->signal_changed().connect ( sigc::mem_fun (*this, &ColorAppearance::surroundChanged) ); + surrsrcconn = surrsrc->signal_changed().connect ( sigc::mem_fun (*this, &ColorAppearance::surrsrcChanged) ); degree->setAdjusterListener (this); degreeout->setAdjusterListener (this); @@ -654,6 +673,9 @@ void ColorAppearance::neutral_pressed () shape->reset(); shape2->reset(); shape3->reset(); + gamutconn.block (true); + gamut->set_active (true); + gamutconn.block (false); degree->setAutoValue (true); degree->resetValue (false); adapscen->resetValue (false); @@ -710,7 +732,7 @@ void ColorAppearance::read (const ProcParams* pp, const ParamsEdited* pedited) contrast->setEditedState (pedited->colorappearance.contrast ? Edited : UnEdited); qcontrast->setEditedState (pedited->colorappearance.qcontrast ? Edited : UnEdited); colorh->setEditedState (pedited->colorappearance.colorh ? Edited : UnEdited); - surrsource->set_inconsistent (!pedited->colorappearance.surrsource); +// surrsource->set_inconsistent (!pedited->colorappearance.surrsource); gamut->set_inconsistent (!pedited->colorappearance.gamut); // badpix->set_inconsistent (!pedited->colorappearance.badpix); datacie->set_inconsistent (!pedited->colorappearance.datacie); @@ -744,6 +766,25 @@ void ColorAppearance::read (const ProcParams* pp, const ParamsEdited* pedited) setEnabled (pp->colorappearance.enabled); + surrsrcconn.block (true); + + if (pedited && !pedited->colorappearance.surrsrc) { + surrsrc->set_active (4); + } else if (pp->colorappearance.surrsrc == "Average") { + surrsrc->set_active (0); + } else if (pp->colorappearance.surrsrc == "Dim") { + surrsrc->set_active (1); + } else if (pp->colorappearance.surrsrc == "Dark") { + surrsrc->set_active (2); + } else if (pp->colorappearance.surrsrc == "ExtremelyDark") { + surrsrc->set_active (3); + } + + surrsrcconn.block (false); + // Have to be manually called to handle initial state update + surrsrcChanged(); + + surroundconn.block (true); if (pedited && !pedited->colorappearance.surround) { @@ -762,6 +803,8 @@ void ColorAppearance::read (const ProcParams* pp, const ParamsEdited* pedited) // Have to be manually called to handle initial state update surroundChanged(); + + wbmodelconn.block (true); if (pedited && !pedited->colorappearance.wbmodel) { @@ -796,9 +839,9 @@ void ColorAppearance::read (const ProcParams* pp, const ParamsEdited* pedited) // Have to be manually called to handle initial state update algoChanged(); - surrconn.block (true); - surrsource->set_active (pp->colorappearance.surrsource); - surrconn.block (false); + // surrconn.block (true); + // surrsource->set_active (pp->colorappearance.surrsource); + // surrconn.block (false); gamutconn.block (true); gamut->set_active (pp->colorappearance.gamut); gamutconn.block (false); @@ -815,7 +858,7 @@ void ColorAppearance::read (const ProcParams* pp, const ParamsEdited* pedited) // sharpcie->set_active (pp->colorappearance.sharpcie); // sharpcieconn.block (false); - lastsurr = pp->colorappearance.surrsource; + // lastsurr = pp->colorappearance.surrsource; lastgamut = pp->colorappearance.gamut; // lastbadpix=pp->colorappearance.badpix; lastdatacie = pp->colorappearance.datacie; @@ -890,7 +933,7 @@ void ColorAppearance::write (ProcParams* pp, ParamsEdited* pedited) pp->colorappearance.qcontrast = qcontrast->getValue (); pp->colorappearance.colorh = colorh->getValue (); pp->colorappearance.rstprotection = rstprotection->getValue (); - pp->colorappearance.surrsource = surrsource->get_active(); + // pp->colorappearance.surrsource = surrsource->get_active(); pp->colorappearance.gamut = gamut->get_active(); // pp->colorappearance.badpix = badpix->get_active(); pp->colorappearance.datacie = datacie->get_active(); @@ -953,9 +996,10 @@ void ColorAppearance::write (ProcParams* pp, ParamsEdited* pedited) pedited->colorappearance.autoybscen = !ybscen->getAutoInconsistent(); pedited->colorappearance.enabled = !get_inconsistent(); pedited->colorappearance.surround = surround->get_active_text() != M ("GENERAL_UNCHANGED"); + pedited->colorappearance.surrsrc = surrsrc->get_active_text() != M ("GENERAL_UNCHANGED"); pedited->colorappearance.wbmodel = wbmodel->get_active_text() != M ("GENERAL_UNCHANGED"); pedited->colorappearance.algo = algo->get_active_text() != M ("GENERAL_UNCHANGED"); - pedited->colorappearance.surrsource = !surrsource->get_inconsistent(); + // pedited->colorappearance.surrsource = !surrsource->get_inconsistent(); pedited->colorappearance.gamut = !gamut->get_inconsistent(); // pedited->colorappearance.badpix = !badpix->get_inconsistent(); pedited->colorappearance.datacie = !datacie->get_inconsistent(); @@ -975,6 +1019,17 @@ void ColorAppearance::write (ProcParams* pp, ParamsEdited* pedited) } + if (surrsrc->get_active_row_number() == 0) { + pp->colorappearance.surrsrc = "Average"; + } else if (surrsrc->get_active_row_number() == 1) { + pp->colorappearance.surrsrc = "Dim"; + } else if (surrsrc->get_active_row_number() == 2) { + pp->colorappearance.surrsrc = "Dark"; + } else if (surrsrc->get_active_row_number() == 3) { + pp->colorappearance.surrsrc = "ExtremelyDark"; + } + + if (surround->get_active_row_number() == 0) { pp->colorappearance.surround = "Average"; } else if (surround->get_active_row_number() == 1) { @@ -1079,7 +1134,7 @@ bool ColorAppearance::curveMode3Changed_ () return false; } - +/* void ColorAppearance::surrsource_toggled () { @@ -1104,7 +1159,7 @@ void ColorAppearance::surrsource_toggled () } } } - +*/ void ColorAppearance::gamut_toggled () { @@ -1326,10 +1381,9 @@ bool ColorAppearance::autoCamComputed_ () return false; } -void ColorAppearance::adapCamChanged (double cadap, int ybsc) +void ColorAppearance::adapCamChanged (double cadap) { nextCadap = cadap; - nextYbscn = ybsc; const auto func = [] (gpointer data) -> gboolean { static_cast (data)->adapCamComputed_(); @@ -1345,12 +1399,35 @@ bool ColorAppearance::adapCamComputed_ () disableListener (); // degree->setEnabled (true); adapscen->setValue (nextCadap); - ybscen->setValue (nextYbscn); +// ybscen->setValue (nextYbscn); enableListener (); return false; } +void ColorAppearance::ybCamChanged (int ybsc) +{ + nextYbscn = ybsc; + + const auto func = [] (gpointer data) -> gboolean { + static_cast (data)->ybCamComputed_(); + return FALSE; + }; + + idle_register.add (func, this); +} + +bool ColorAppearance::ybCamComputed_ () +{ + + disableListener (); +// degree->setEnabled (true); +// adapscen->setValue (nextCadap); + ybscen->setValue (nextYbscn); + enableListener (); + + return false; +} void ColorAppearance::colorForValue (double valX, double valY, enum ColorCaller::ElemType elemType, int callerId, ColorCaller *caller) { @@ -1528,6 +1605,15 @@ void ColorAppearance::enabledChanged () } } +void ColorAppearance::surrsrcChanged () +{ + + if (listener && (multiImage || getEnabled()) ) { + listener->panelChanged (EvCATsurr, surrsrc->get_active_text ()); + } +} + + void ColorAppearance::surroundChanged () { @@ -1652,6 +1738,7 @@ void ColorAppearance::setBatchMode (bool batchMode) greensc->showEditedCB (); surround->append (M ("GENERAL_UNCHANGED")); + surrsrc->append (M ("GENERAL_UNCHANGED")); wbmodel->append (M ("GENERAL_UNCHANGED")); algo->append (M ("GENERAL_UNCHANGED")); toneCurveMode->append (M ("GENERAL_UNCHANGED")); diff --git a/rtgui/colorappearance.h b/rtgui/colorappearance.h index 9c2a84d67..4afed28cb 100644 --- a/rtgui/colorappearance.h +++ b/rtgui/colorappearance.h @@ -49,6 +49,7 @@ public: // void adjusterAdapToggled (Adjuster* a, bool newval); void enabledChanged (); void surroundChanged (); + void surrsrcChanged (); void wbmodelChanged (); void algoChanged (); void surrsource_toggled (); @@ -59,8 +60,10 @@ public: // void sharpcie_toggled (); void autoCamChanged (double ccam, double ccamout); bool autoCamComputed_ (); - void adapCamChanged (double cadap, int ybscn); + void adapCamChanged (double cadap); bool adapCamComputed_ (); + void ybCamChanged (int yb); + bool ybCamComputed_ (); void curveChanged (CurveEditor* ce); void curveMode1Changed (); @@ -127,6 +130,8 @@ private: Gtk::CheckButton* tonecie; // Gtk::CheckButton* sharpcie; Gtk::Button* neutral; + MyComboBoxText* surrsrc; + sigc::connection surrsrcconn; MyComboBoxText* surround; sigc::connection surroundconn; diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 6de9cbb0c..eb0b77085 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -178,6 +178,7 @@ void ParamsEdited::set (bool v) colorappearance.degreeout = v; colorappearance.autodegreeout = v; colorappearance.surround = v; + colorappearance.surrsrc = v; colorappearance.adapscen = v; colorappearance.autoadapscen = v; colorappearance.ybscen = v; @@ -708,6 +709,7 @@ void ParamsEdited::initFrom (const std::vector colorappearance.degreeout = colorappearance.degreeout && p.colorappearance.degreeout == other.colorappearance.degreeout; colorappearance.autodegreeout = colorappearance.autodegreeout && p.colorappearance.autodegreeout == other.colorappearance.autodegreeout; colorappearance.surround = colorappearance.surround && p.colorappearance.surround == other.colorappearance.surround; + colorappearance.surrsrc = colorappearance.surrsrc && p.colorappearance.surrsrc == other.colorappearance.surrsrc; colorappearance.adapscen = colorappearance.adapscen && p.colorappearance.adapscen == other.colorappearance.adapscen; colorappearance.autoadapscen = colorappearance.autoadapscen && p.colorappearance.autoadapscen == other.colorappearance.autoadapscen; colorappearance.ybscen = colorappearance.ybscen && p.colorappearance.ybscen == other.colorappearance.ybscen; @@ -1735,6 +1737,10 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten toEdit.colorappearance.surround = mods.colorappearance.surround; } + if (colorappearance.surrsrc) { + toEdit.colorappearance.surrsrc = mods.colorappearance.surrsrc; + } + if (colorappearance.autoadapscen) { toEdit.colorappearance.autoadapscen = mods.colorappearance.autoadapscen; } diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index ef32bea63..35e3c80b8 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -294,6 +294,7 @@ public: bool autoadapscen; bool autoybscen; bool surround; + bool surrsrc; bool adapscen; bool adaplum; bool ybscen;