From be82e1bde28fa0253b283da542a2cf50218acd2a Mon Sep 17 00:00:00 2001 From: Desmis Date: Sun, 13 Aug 2017 13:07:39 +0200 Subject: [PATCH] Some changes requested by Elle --- rtdata/languages/default | 10 ++- rtengine/dcrop.cc | 4 +- rtengine/improccoordinator.cc | 10 +-- rtengine/improcfun.cc | 15 ++-- rtengine/improcfun.h | 2 +- rtengine/procevents.h | 2 + rtengine/procparams.cc | 28 +++++++ rtengine/procparams.h | 2 + rtengine/refreshmap.cc | 4 +- rtengine/rtengine.h | 2 +- rtengine/rtthumbnail.cc | 4 +- rtengine/simpleprocess.cc | 8 +- rtgui/colorappearance.cc | 136 ++++++++++++++++++++++++++++++++-- rtgui/colorappearance.h | 14 +++- rtgui/paramsedited.cc | 12 +++ rtgui/paramsedited.h | 2 + 16 files changed, 223 insertions(+), 32 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index 346c96a2d..a4b2d0442 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1276,9 +1276,9 @@ TP_COARSETRAF_TOOLTIP_HFLIP;Flip horizontally. TP_COARSETRAF_TOOLTIP_ROTLEFT;Rotate left.\n\nShortcuts:\n[ - Multiple Editor Tabs Mode,\nAlt-[ - Single Editor Tab Mode. TP_COARSETRAF_TOOLTIP_ROTRIGHT;Rotate right.\n\nShortcuts:\n] - Multiple Editor Tabs Mode,\nAlt-] - Single Editor Tab Mode. TP_COARSETRAF_TOOLTIP_VFLIP;Flip vertically. -TP_COLORAPP_ADAPTSCENE;Scene luminosity +TP_COLORAPP_ADAPTSCENE;Scene absolute luminance TP_COLORAPP_ADAPTSCENE_TOOLTIP;Absolute luminance of the scene environement (cd/m²).\n1) Calculated from the Exif data:\nShutter speed - ISO speed - F number - camera exposure correction.\n2) Calculated from the raw white point and RT's Exposure Compensation slider. -TP_COLORAPP_ADAPTVIEWING;Viewing luminosity (cd/m²) +TP_COLORAPP_ADAPTVIEWING;Viewing absolute luminance (cd/m²) TP_COLORAPP_ADAPTVIEWING_TOOLTIP;Absolute luminance of the viewing environnement\n(usually 16cd/m²). TP_COLORAPP_ADAP_AUTO_TOOLTIP;If the checkbox is checked (recommended) RawTherapee calculates an optimum value from Exif data.\nTo set the value manually, uncheck the checkbox first. TP_COLORAPP_ALGO;Algorithm @@ -1325,6 +1325,8 @@ TP_COLORAPP_LIGHT;Lightness (J) TP_COLORAPP_LIGHT_TOOLTIP;Lightness in CIECAM02 differs from L*a*b* and RGB lightness. TP_COLORAPP_MODEL;WP Model TP_COLORAPP_MODEL_TOOLTIP;White-Point Model.\n\nWB [RT] + [output]: RT's white balance is used for the scene, CIECAM02 is set to D50, and the output device's white balance is set in Viewing Conditions.\n\nWB [RT+CAT02] + [output]: RT's white balance settings are used by CAT02 and the output device's white balance is set in Viewing Conditions.\n\nFree temp+green + CAT02 + [output]: temp and green are selected bu user, output device's white balance is set in Viewing Conditions. +TP_COLORAPP_NEUTRAL;Reset +TP_COLORAPP_NEUTRAL_TIP;Reset all sliders checkbox and curves to their default values TP_COLORAPP_RSTPRO;Red & skin-tones protection TP_COLORAPP_RSTPRO_TOOLTIP;Red and skin-tones protection affects both sliders and curves. TP_COLORAPP_SHARPCIE;--unused-- @@ -1349,7 +1351,9 @@ 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] TP_COLORAPP_WBRT;WB [RT] + [output] -TP_COLORAPP_YB;Yb (mean luminance) +TP_COLORAPP_YB;Yb%(mean luminance) +TP_COLORAPP_YBSCENE;Yb%(mean luminance) +TP_COLORAPP_YBSCENE_TOOLTIP;if auto enable, Yb is calculated from the mean value of actual image luminance TP_COLORTONING_AB;o C/L TP_COLORTONING_AUTOSAT;Automatic TP_COLORTONING_BALANCE;Balance diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index a93238664..441c7a47d 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -958,9 +958,9 @@ void Crop::update (int todo) } if (settings->ciecamfloat) { - float d, dj; // not used after this block + float d, dj, yb; // not used after this block 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, 1); + dummy, dummy, parent->CAMBrightCurveJ, parent->CAMBrightCurveQ, parent->CAMMean, 5, skip, execsharp, d, dj, yb, 1); } else { double dd, dj; // not used after this block diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index e3ee91540..f63b6ba48 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -746,7 +746,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) int begh = 0; int endh = pH; - float d, dj; + float d, dj, yb; bool execsharp = false; if(!ncie) { @@ -766,14 +766,14 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) CAMBrightCurveJ.dirty = true; CAMBrightCurveQ.dirty = true; - ipf.ciecam_02float (ncie, float(adap), begh, endh, pW, 2, nprevl, ¶ms, customColCurve1, customColCurve2, customColCurve3, histLCAM, histCCAM, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, scale, execsharp, d, dj, 1); + ipf.ciecam_02float (ncie, float(adap), begh, endh, pW, 2, nprevl, ¶ms, customColCurve1, customColCurve2, customColCurve3, histLCAM, histCCAM, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, scale, execsharp, d, dj, yb, 1); - if(params.colorappearance.autodegree && acListener && params.colorappearance.enabled) { + if((params.colorappearance.autodegree || params.colorappearance.autodegreeout) && acListener && params.colorappearance.enabled) { acListener->autoCamChanged(100.*(double)d, 100.*(double)dj); } - if(params.colorappearance.autoadapscen && acListener && params.colorappearance.enabled) { - acListener->adapCamChanged(adap); //real value of adapt scene luminosity + 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 } readyphase++; diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index 5d56f01fd..dadf0cd2b 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -1487,7 +1487,7 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh // Copyright (c) 2012 Jacques Desmis void ImProcFunctions::ciecam_02float (CieImage* ncie, float 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, float &d, float &dj, int rtt) + LUTu & histLCAM, LUTu & histCCAM, LUTf & CAMBrightCurveJ, LUTf & CAMBrightCurveQ, float &mean, int Iterates, int scale, bool execsharp, float &d, float &dj, float &yb, int rtt) { if (params->colorappearance.enabled) { @@ -1514,7 +1514,7 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int float Yw; Yw = 1.0; double Xw, Zw; - float f, nc, yb = 0.f, la, c, xw, yw, zw, f2 = 1.f, c2 = 1.f, nc2 = 1.f, yb2; + float f, nc, la, c, 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; @@ -1834,7 +1834,11 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int //evaluate lightness, contrast } - if (settings->viewinggreySc == 0) { //auto + + + // if (settings->viewinggreySc == 0) { //auto + if (params->colorappearance.autoybscen && pwb == 2) {//auto + if (mean < 15.f) { yb = 3.0f; } else if (mean < 30.f) { @@ -1858,8 +1862,9 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int } else { yb = 90.0f; } - } else if (settings->viewinggreySc == 1) { - yb = 18.0f; //fixed +// } else if (settings->viewinggreySc == 1) { + } else { + yb = (float) params->colorappearance.ybscen; } const bool highlight = params->toneCurve.hrenabled; //Get the value if "highlight reconstruction" is activated diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index 5ef287139..115046067 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -226,7 +226,7 @@ public: void luminanceCurve (LabImage* lold, LabImage* lnew, LUTf &curve); void ciecam_02float (CieImage* ncie, float 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, float &d, float &dj, int rtt); + 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); diff --git a/rtengine/procevents.h b/rtengine/procevents.h index 88aaf0e3f..cf7f50704 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -509,6 +509,8 @@ enum ProcEvent { EvCATAutoDegreeout = 479, EvCATtempsc = 480, EvCATgreensc = 481, + EvCATybscen = 482, + EvCATAutoyb = 483, NUMOFEVENTS diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 071732243..fa97d5f7d 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -1159,6 +1159,8 @@ void ProcParams::setDefaults () colorappearance.badpixsl = 0; colorappearance.adapscen = 2000.0; colorappearance.autoadapscen = true; + colorappearance.ybscen = 18; + colorappearance.autoybscen = true; colorappearance.algo = "No"; colorappearance.wbmodel = "RawT"; colorappearance.jlight = 0.0; @@ -2169,6 +2171,14 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b keyFile.set_boolean ("Color appearance", "AutoAdapscen", colorappearance.autoadapscen); } + if (!pedited || pedited->colorappearance.ybscen) { + keyFile.set_integer ("Color appearance", "YbScene", colorappearance.ybscen); + } + + if (!pedited || pedited->colorappearance.autoybscen) { + keyFile.set_boolean ("Color appearance", "Autoybscen", colorappearance.autoybscen); + } + if (!pedited || pedited->colorappearance.surrsource) { keyFile.set_boolean ("Color appearance", "SurrSource", colorappearance.surrsource); } @@ -5136,6 +5146,22 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) } } + if (keyFile.has_key ("Color appearance", "YbScene")) { + colorappearance.ybscen = keyFile.get_integer ("Color appearance", "YbScene"); + + if (pedited) { + pedited->colorappearance.ybscen = true; + } + } + + if (keyFile.has_key ("Color appearance", "Autoybscen")) { + colorappearance.autoybscen = keyFile.get_boolean ("Color appearance", "Autoybscen"); + + if (pedited) { + pedited->colorappearance.autoybscen = true; + } + } + if (keyFile.has_key ("Color appearance", "SurrSource")) { colorappearance.surrsource = keyFile.get_boolean ("Color appearance", "SurrSource"); @@ -8302,6 +8328,8 @@ bool ProcParams::operator== (const ProcParams& other) && colorappearance.surround == other.colorappearance.surround && colorappearance.adapscen == other.colorappearance.adapscen && colorappearance.autoadapscen == other.colorappearance.autoadapscen + && colorappearance.ybscen == other.colorappearance.ybscen + && colorappearance.autoybscen == other.colorappearance.autoybscen && colorappearance.adaplum == other.colorappearance.adaplum && colorappearance.badpixsl == other.colorappearance.badpixsl && colorappearance.wbmodel == other.colorappearance.wbmodel diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 636308800..405609823 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -597,6 +597,8 @@ public: Glib::ustring surround; double adapscen; bool autoadapscen; + int ybscen; + bool autoybscen; double adaplum; int badpixsl; diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 732e2e05d..5400a2e47 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -508,7 +508,9 @@ int refreshmap[rtengine::NUMOFEVENTS] = { LUMINANCECURVE, // EvCATDegreeout LUMINANCECURVE, // EvCATAutoDegreeout LUMINANCECURVE, // EvCATtempsc - LUMINANCECURVE // EvCATgreensc + LUMINANCECURVE, // EvCATgreensc + LUMINANCECURVE, // EvCATybscen + LUMINANCECURVE // EvCATAutoyb }; diff --git a/rtengine/rtengine.h b/rtengine/rtengine.h index fb93f8715..6678ac1fd 100644 --- a/rtengine/rtengine.h +++ b/rtengine/rtengine.h @@ -274,7 +274,7 @@ class AutoCamListener public : virtual ~AutoCamListener() {} virtual void autoCamChanged (double ccam, double ccamout) {} - virtual void adapCamChanged (double cadap) {} + virtual void adapCamChanged (double cadap, int ybscn) {} }; class AutoChromaListener diff --git a/rtengine/rtthumbnail.cc b/rtengine/rtthumbnail.cc index 41e52a16e..4388b6184 100644 --- a/rtengine/rtthumbnail.cc +++ b/rtengine/rtthumbnail.cc @@ -1260,7 +1260,7 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, int rhei 16); int begh = 0, endh = labView->H; bool execsharp = false; - float d, dj; + float d, dj, yb; float fnum = fnumber;// F number float fiso = iso;// ISO float fspeed = shutter;//speed @@ -1296,7 +1296,7 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, int rhei CAMMean = NAN; CAMBrightCurveJ.dirty = true; CAMBrightCurveQ.dirty = true; - ipf.ciecam_02float (cieView, adap, begh, endh, 1, 2, labView, ¶ms, customColCurve1, customColCurve2, customColCurve3, dummy, dummy, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, sk, execsharp, d, dj, rtt); + ipf.ciecam_02float (cieView, adap, begh, endh, 1, 2, labView, ¶ms, customColCurve1, customColCurve2, customColCurve3, dummy, dummy, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, sk, execsharp, d, dj, yb, rtt); delete cieView; } diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index d72a69bab..de13cfc0e 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -1122,16 +1122,16 @@ private: if (params.sharpening.enabled) { if(settings->ciecamfloat) { - float d, dj; - 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, 1); + 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); } } else { if(settings->ciecamfloat) { - float d, dj; - 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, 1); + 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); diff --git a/rtgui/colorappearance.cc b/rtgui/colorappearance.cc index ddf120c1a..95caa1450 100644 --- a/rtgui/colorappearance.cc +++ b/rtgui/colorappearance.cc @@ -191,6 +191,17 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel (this, "colorappearance" adapscen->set_tooltip_markup (M ("TP_COLORAPP_ADAPTSCENE_TOOLTIP")); p1VBox->pack_start (*adapscen); + ybscen = Gtk::manage (new Adjuster (M ("TP_COLORAPP_YBSCENE"), 1, 90, 1, 18)); + + if (ybscen->delay < options.adjusterMaxDelay) { + ybscen->delay = options.adjusterMaxDelay; + } + + ybscen->throwOnButtonRelease(); + ybscen->addAutoButton (M ("TP_COLORAPP_ADAP_AUTO_TOOLTIP")); + ybscen->set_tooltip_markup (M ("TP_COLORAPP_YBSCENE_TOOLTIP")); + p1VBox->pack_start (*ybscen); + p1Frame->add (*p1VBox); pack_start (*p1Frame, Gtk::PACK_EXPAND_WIDGET, 4); @@ -199,12 +210,19 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel (this, "colorappearance" // Process 1 frame + + expadjust = Gtk::manage(new MyExpander(false, M ("TP_COLORAPP_LABEL_CAM02"))); + setExpandAlignProperties (expadjust, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + expadjust->signal_button_release_event().connect_notify ( sigc::bind ( sigc::mem_fun (this, &ColorAppearance::foldAllButMe), expadjust) ); +/* Gtk::Frame *p2Frame; // Vertical box container for the content of the Process 1 frame Gtk::VBox *p2VBox; p2Frame = Gtk::manage (new Gtk::Frame (M ("TP_COLORAPP_LABEL_CAM02")) ); p2Frame->set_label_align (0.025, 0.5); +*/ + Gtk::VBox *p2VBox; p2VBox = Gtk::manage ( new Gtk::VBox()); p2VBox->set_spacing (2); @@ -429,10 +447,12 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel (this, "colorappearance" - p2Frame->add (*p2VBox); +// p2Frame->add (*p2VBox); + expadjust->add (*p2VBox, false); + expadjust->setLevel(2); + pack_start (*expadjust); - - pack_start (*p2Frame, Gtk::PACK_EXPAND_WIDGET, 4); +// pack_start (*p2Frame, Gtk::PACK_EXPAND_WIDGET, 4); @@ -450,7 +470,7 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel (this, "colorappearance" p3VBox = Gtk::manage ( new Gtk::VBox()); p3VBox->set_spacing (2); - adaplum = Gtk::manage (new Adjuster (M ("TP_COLORAPP_ADAPTVIEWING"), 0.1, 1000., 0.1, 16.)); + adaplum = Gtk::manage (new Adjuster (M ("TP_COLORAPP_ADAPTVIEWING"), 0.1, 16384., 0.1, 16.)); if (adaplum->delay < options.adjusterMaxDelay) { adaplum->delay = options.adjusterMaxDelay; @@ -481,7 +501,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, 50, 1, 18)); + ybout = Gtk::manage (new Adjuster (M ("TP_COLORAPP_YB"), 5, 90, 1, 18)); tempout->show(); greenout->show(); @@ -533,6 +553,21 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel (this, "colorappearance" badpixsl->throwOnButtonRelease(); badpixsl->set_tooltip_markup (M ("TP_COLORAPP_BADPIXSL_TOOLTIP")); pack_start (*badpixsl, Gtk::PACK_SHRINK); + + + //reset button + neutral = Gtk::manage (new Gtk::Button (M ("TP_COLORAPP_NEUTRAL"))); + setExpandAlignProperties (neutral, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + RTImage *resetImg = Gtk::manage (new RTImage ("gtk-undo-ltr-small.png", "gtk-undo-rtl-small.png")); + setExpandAlignProperties (resetImg, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); + neutral->set_image (*resetImg); + neutral->set_tooltip_text (M ("TP_COLORAPP_NEUTRAL_TIP")); + neutralconn = neutral->signal_pressed().connect ( sigc::mem_fun (*this, &ColorAppearance::neutral_pressed) ); + neutral->show(); + + //------------- + + pack_start (*neutral); // ------------------------ Listening events @@ -545,6 +580,7 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel (this, "colorappearance" degree->setAdjusterListener (this); degreeout->setAdjusterListener (this); adapscen->setAdjusterListener (this); + ybscen->setAdjusterListener (this); adaplum->setAdjusterListener (this); badpixsl->setAdjusterListener (this); jlight->setAdjusterListener (this); @@ -575,7 +611,58 @@ ColorAppearance::~ColorAppearance () delete curveEditorG3; } +void ColorAppearance::foldAllButMe (GdkEventButton* event, MyExpander *expander) +{ + if (event->button == 3) { + expadjust->set_expanded(expadjust == expander); + } +} +void ColorAppearance::writeOptions(std::vector &tpOpen) +{ + tpOpen.push_back (expadjust->get_expanded ()); +} + +void ColorAppearance::updateToolState(std::vector &tpOpen) +{ + if(tpOpen.size() >= 1) { + expadjust->set_expanded(tpOpen.at(0)); + } +} + +void ColorAppearance::neutral_pressed () +{ + jlight->resetValue (false); + qbright->resetValue (false); + chroma->resetValue (false); + schroma->resetValue (false); + mchroma->resetValue (false); + rstprotection->resetValue (false); + contrast->resetValue (false); + qcontrast->resetValue (false); + colorh->resetValue (false); + tempout->resetValue (false); + greenout->resetValue (false); + ybout->resetValue (false); + tempsc->resetValue (false); + greensc->resetValue (false); + badpixsl->resetValue (false); + wbmodel->set_active (0); + toneCurveMode->set_active (0); + toneCurveMode2->set_active (0); + toneCurveMode3->set_active (0); + shape->reset(); + shape2->reset(); + shape3->reset(); + degree->setAutoValue (true); + degree->resetValue (false); + adapscen->resetValue (false); + adapscen->setAutoValue (true); + degreeout->resetValue (false); + degreeout->setAutoValue (true); + ybscen->resetValue (false); + ybscen->setAutoValue (true); +} bool ColorAppearance::bgTTipQuery (int x, int y, bool keyboard_tooltip, const Glib::RefPtr& tooltip) { @@ -606,6 +693,7 @@ void ColorAppearance::read (const ProcParams* pp, const ParamsEdited* pedited) degree->setEditedState (pedited->colorappearance.degree ? Edited : UnEdited); degreeout->setEditedState (pedited->colorappearance.degreeout ? Edited : UnEdited); adapscen->setEditedState (pedited->colorappearance.adapscen ? Edited : UnEdited); + ybscen->setEditedState (pedited->colorappearance.ybscen ? Edited : UnEdited); adaplum->setEditedState (pedited->colorappearance.adaplum ? Edited : UnEdited); badpixsl->setEditedState (pedited->colorappearance.badpixsl ? Edited : UnEdited); jlight->setEditedState (pedited->colorappearance.jlight ? Edited : UnEdited); @@ -632,6 +720,7 @@ void ColorAppearance::read (const ProcParams* pp, const ParamsEdited* pedited) degree->setAutoInconsistent (multiImage && !pedited->colorappearance.autodegree); degreeout->setAutoInconsistent (multiImage && !pedited->colorappearance.autodegreeout); adapscen->setAutoInconsistent (multiImage && !pedited->colorappearance.autoadapscen); + ybscen->setAutoInconsistent (multiImage && !pedited->colorappearance.autoybscen); set_inconsistent (multiImage && !pedited->colorappearance.enabled); shape->setUnChanged (!pedited->colorappearance.curve); @@ -736,6 +825,7 @@ void ColorAppearance::read (const ProcParams* pp, const ParamsEdited* pedited) lastAutoDegree = pp->colorappearance.autodegree; lastAutoAdapscen = pp->colorappearance.autoadapscen; lastAutoDegreeout = pp->colorappearance.autodegreeout; + lastAutoybscen = pp->colorappearance.autoybscen; degree->setValue (pp->colorappearance.degree); degree->setAutoValue (pp->colorappearance.autodegree); @@ -743,6 +833,8 @@ void ColorAppearance::read (const ProcParams* pp, const ParamsEdited* pedited) adapscen->setAutoValue (pp->colorappearance.autoadapscen); degreeout->setValue (pp->colorappearance.degreeout); degreeout->setAutoValue (pp->colorappearance.autodegreeout); + ybscen->setValue (pp->colorappearance.ybscen); + ybscen->setAutoValue (pp->colorappearance.autoybscen); adaplum->setValue (pp->colorappearance.adaplum); badpixsl->setValue (pp->colorappearance.badpixsl); @@ -785,6 +877,8 @@ void ColorAppearance::write (ProcParams* pp, ParamsEdited* pedited) pp->colorappearance.enabled = getEnabled(); pp->colorappearance.adapscen = adapscen->getValue (); pp->colorappearance.autoadapscen = adapscen->getAutoValue (); + pp->colorappearance.ybscen = ybscen->getValue (); + pp->colorappearance.autoybscen = ybscen->getAutoValue (); pp->colorappearance.adaplum = adaplum->getValue (); pp->colorappearance.badpixsl = badpixsl->getValue (); pp->colorappearance.jlight = jlight->getValue (); @@ -842,6 +936,7 @@ void ColorAppearance::write (ProcParams* pp, ParamsEdited* pedited) pedited->colorappearance.degreeout = degreeout->getEditedState (); pedited->colorappearance.adapscen = adapscen->getEditedState (); pedited->colorappearance.adaplum = adaplum->getEditedState (); + pedited->colorappearance.ybscen = ybscen->getEditedState (); pedited->colorappearance.badpixsl = badpixsl->getEditedState (); pedited->colorappearance.jlight = jlight->getEditedState (); pedited->colorappearance.qbright = qbright->getEditedState (); @@ -855,6 +950,7 @@ void ColorAppearance::write (ProcParams* pp, ParamsEdited* pedited) pedited->colorappearance.autodegree = !degree->getAutoInconsistent(); pedited->colorappearance.autodegreeout = !degreeout->getAutoInconsistent(); pedited->colorappearance.autoadapscen = !adapscen->getAutoInconsistent(); + pedited->colorappearance.autoybscen = !ybscen->getAutoInconsistent(); pedited->colorappearance.enabled = !get_inconsistent(); pedited->colorappearance.surround = surround->get_active_text() != M ("GENERAL_UNCHANGED"); pedited->colorappearance.wbmodel = wbmodel->get_active_text() != M ("GENERAL_UNCHANGED"); @@ -1140,6 +1236,7 @@ void ColorAppearance::setDefaults (const ProcParams* defParams, const ParamsEdit degree->setDefault (defParams->colorappearance.degree); degreeout->setDefault (defParams->colorappearance.degreeout); adapscen->setDefault (defParams->colorappearance.adapscen); + ybscen->setDefault (defParams->colorappearance.ybscen); adaplum->setDefault (defParams->colorappearance.adaplum); badpixsl->setDefault (defParams->colorappearance.badpixsl); jlight->setDefault (defParams->colorappearance.jlight); @@ -1161,6 +1258,7 @@ void ColorAppearance::setDefaults (const ProcParams* defParams, const ParamsEdit degree->setDefaultEditedState (pedited->colorappearance.degree ? Edited : UnEdited); degreeout->setDefaultEditedState (pedited->colorappearance.degreeout ? Edited : UnEdited); adapscen->setDefaultEditedState (pedited->colorappearance.adapscen ? Edited : UnEdited); + ybscen->setDefaultEditedState (pedited->colorappearance.ybscen ? Edited : UnEdited); adaplum->setDefaultEditedState (pedited->colorappearance.adaplum ? Edited : UnEdited); badpixsl->setDefaultEditedState (pedited->colorappearance.badpixsl ? Edited : UnEdited); jlight->setDefaultEditedState (pedited->colorappearance.jlight ? Edited : UnEdited); @@ -1182,6 +1280,7 @@ void ColorAppearance::setDefaults (const ProcParams* defParams, const ParamsEdit degree->setDefaultEditedState (Irrelevant); degreeout->setDefaultEditedState (Irrelevant); adapscen->setDefaultEditedState (Irrelevant); + ybscen->setDefaultEditedState (Irrelevant); adaplum->setDefaultEditedState (Irrelevant); badpixsl->setDefaultEditedState (Irrelevant); jlight->setDefaultEditedState (Irrelevant); @@ -1227,9 +1326,10 @@ bool ColorAppearance::autoCamComputed_ () return false; } -void ColorAppearance::adapCamChanged (double cadap) +void ColorAppearance::adapCamChanged (double cadap, int ybsc) { nextCadap = cadap; + nextYbscn = ybsc; const auto func = [] (gpointer data) -> gboolean { static_cast (data)->adapCamComputed_(); @@ -1245,6 +1345,7 @@ bool ColorAppearance::adapCamComputed_ () disableListener (); // degree->setEnabled (true); adapscen->setValue (nextCadap); + ybscen->setValue (nextYbscn); enableListener (); return false; @@ -1283,6 +1384,8 @@ void ColorAppearance::adjusterChanged (Adjuster* a, double newval) listener->panelChanged (EvCATDegreeout, a->getTextValue()); } else if (a == adapscen) { listener->panelChanged (EvCATAdapscen, a->getTextValue()); + } else if (a == ybscen) { + listener->panelChanged (EvCATybscen, a->getTextValue()); } else if (a == adaplum) { listener->panelChanged (EvCATAdapLum, a->getTextValue()); } else if (a == badpixsl) { @@ -1352,6 +1455,15 @@ void ColorAppearance::adjusterAutoToggled (Adjuster* a, bool newval) lastAutoAdapscen = adapscen->getAutoValue(); + if (ybscen->getAutoInconsistent()) { + ybscen->setAutoInconsistent (false); + ybscen->setAutoValue (false); + } else if (lastAutoybscen) { + ybscen->setAutoInconsistent (true); + } + + lastAutoybscen = ybscen->getAutoValue(); + } if (listener && (multiImage || getEnabled()) ) { @@ -1387,6 +1499,16 @@ void ColorAppearance::adjusterAutoToggled (Adjuster* a, bool newval) } } + if (a == ybscen) { + if (ybscen->getAutoInconsistent()) { + listener->panelChanged (EvCATAutoyb, M ("GENERAL_UNCHANGED")); + } else if (ybscen->getAutoValue()) { + listener->panelChanged (EvCATAutoyb, M ("GENERAL_ENABLED")); + } else { + listener->panelChanged (EvCATAutoyb, M ("GENERAL_DISABLED")); + } + } + } } @@ -1512,6 +1634,7 @@ void ColorAppearance::setBatchMode (bool batchMode) degreeout->showEditedCB (); adapscen->showEditedCB (); adaplum->showEditedCB (); + ybscen->showEditedCB (); badpixsl->showEditedCB (); jlight->showEditedCB (); qbright->showEditedCB (); @@ -1573,6 +1696,7 @@ void ColorAppearance::trimValues (rtengine::procparams::ProcParams* pp) degree->trimValue (pp->colorappearance.degree); degreeout->trimValue (pp->colorappearance.degreeout); adapscen->trimValue (pp->colorappearance.adapscen); + ybscen->trimValue (pp->colorappearance.ybscen); adaplum->trimValue (pp->colorappearance.adaplum); badpixsl->trimValue (pp->colorappearance.badpixsl); jlight->trimValue (pp->colorappearance.jlight); diff --git a/rtgui/colorappearance.h b/rtgui/colorappearance.h index f5102be95..9c2a84d67 100644 --- a/rtgui/colorappearance.h +++ b/rtgui/colorappearance.h @@ -59,7 +59,7 @@ public: // void sharpcie_toggled (); void autoCamChanged (double ccam, double ccamout); bool autoCamComputed_ (); - void adapCamChanged (double cadap); + void adapCamChanged (double cadap, int ybscn); bool adapCamComputed_ (); void curveChanged (CurveEditor* ce); @@ -69,6 +69,7 @@ public: bool curveMode2Changed_ (); void curveMode3Changed (); bool curveMode3Changed_ (); + void neutral_pressed (); void expandCurve (bool isExpanded); bool isCurveExpanded (); @@ -78,10 +79,13 @@ public: void trimValues (rtengine::procparams::ProcParams* pp); void updateCurveBackgroundHistogram (LUTu & histToneCurve, LUTu & histLCurve, LUTu & histCCurve,/* LUTu & histCLurve, LUTu & histLLCurve,*/ LUTu & histLCAM, LUTu & histCCAM, LUTu & histRed, LUTu & histGreen, LUTu & histBlue, LUTu & histLuma, LUTu & histLRETI); virtual void colorForValue (double valX, double valY, enum ColorCaller::ElemType elemType, int callerId, ColorCaller *caller); + void updateToolState (std::vector &tpOpen); + void writeOptions (std::vector &tpOpen); private: bool bgTTipQuery (int x, int y, bool keyboard_tooltip, const Glib::RefPtr& tooltip); bool srTTipQuery (int x, int y, bool keyboard_tooltip, const Glib::RefPtr& tooltip); + void foldAllButMe (GdkEventButton* event, MyExpander *expander); Glib::RefPtr bgTTips; Glib::RefPtr srTTips; @@ -90,6 +94,7 @@ private: Adjuster* degree; Adjuster* adapscen; + Adjuster* ybscen; Adjuster* adaplum; Adjuster* degreeout; Adjuster* badpixsl; @@ -108,6 +113,8 @@ private: Adjuster* tempsc; Adjuster* greensc; + MyExpander* expadjust; + MyComboBoxText* toneCurveMode; MyComboBoxText* toneCurveMode2; MyComboBoxText* toneCurveMode3; @@ -119,6 +126,7 @@ private: Gtk::CheckButton* datacie; Gtk::CheckButton* tonecie; // Gtk::CheckButton* sharpcie; + Gtk::Button* neutral; MyComboBoxText* surround; sigc::connection surroundconn; @@ -128,7 +136,7 @@ private: sigc::connection algoconn; sigc::connection surrconn; sigc::connection gamutconn, datacieconn, tonecieconn /*,badpixconn , sharpcieconn*/; - sigc::connection tcmodeconn, tcmode2conn, tcmode3conn; + sigc::connection tcmodeconn, tcmode2conn, tcmode3conn, neutralconn; CurveEditorGroup* curveEditorG; CurveEditorGroup* curveEditorG2; CurveEditorGroup* curveEditorG3; @@ -137,9 +145,11 @@ private: DiagonalCurveEditor* shape2; DiagonalCurveEditor* shape3; double nextCcam, nextCcamout, nextCadap; + int nextYbscn; bool lastAutoDegree; bool lastAutoAdapscen; bool lastAutoDegreeout; + bool lastAutoybscen; bool lastsurr; bool lastgamut; bool lastdatacie; diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index d3e17b810..6de9cbb0c 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -180,6 +180,8 @@ void ParamsEdited::set (bool v) colorappearance.surround = v; colorappearance.adapscen = v; colorappearance.autoadapscen = v; + colorappearance.ybscen = v; + colorappearance.autoybscen = v; colorappearance.adaplum = v; colorappearance.badpixsl = v; colorappearance.wbmodel = v; @@ -708,6 +710,8 @@ void ParamsEdited::initFrom (const std::vector colorappearance.surround = colorappearance.surround && p.colorappearance.surround == other.colorappearance.surround; 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; + colorappearance.autoybscen = colorappearance.autoybscen && p.colorappearance.autoybscen == other.colorappearance.autoybscen; colorappearance.adaplum = colorappearance.adaplum && p.colorappearance.adaplum == other.colorappearance.adaplum; colorappearance.badpixsl = colorappearance.badpixsl && p.colorappearance.badpixsl == other.colorappearance.badpixsl; colorappearance.wbmodel = colorappearance.wbmodel && p.colorappearance.wbmodel == other.colorappearance.wbmodel; @@ -1739,6 +1743,14 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten toEdit.colorappearance.adapscen = mods.colorappearance.adapscen; } + if (colorappearance.autoybscen) { + toEdit.colorappearance.autoybscen = mods.colorappearance.autoybscen; + } + + if (colorappearance.ybscen) { + toEdit.colorappearance.ybscen = mods.colorappearance.ybscen; + } + if (colorappearance.adaplum) { toEdit.colorappearance.adaplum = dontforceSet && options.baBehav[ADDSET_CAT_ADAPTVIEWING] ? toEdit.colorappearance.adaplum + mods.colorappearance.adaplum : mods.colorappearance.adaplum; } diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 4c0bcd38e..ef32bea63 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -292,9 +292,11 @@ public: bool degreeout; bool autodegreeout; bool autoadapscen; + bool autoybscen; bool surround; bool adapscen; bool adaplum; + bool ybscen; bool badpixsl; bool wbmodel; bool algo;