diff --git a/rtdata/languages/default b/rtdata/languages/default index a807ba9ea..59de4bb40 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -728,6 +728,7 @@ HISTORY_MSG_491;White Balance HISTORY_MSG_492;RGB Curves HISTORY_MSG_493;L*a*b* Adjustments HISTORY_MSG_494;Capture Sharpening +HISTORY_MSG_CAT02PRESET;Cat02 automatic preset HISTORY_MSG_CLAMPOOG;Clip out-of-gamut colors HISTORY_MSG_COLORTONING_LABGRID_VALUE;CT - Color correction HISTORY_MSG_COLORTONING_LABREGION_AB;CT - Color correction @@ -1447,6 +1448,8 @@ 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 by the user, the 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_PRESETCAT02;Preset cat02 automatic +TP_COLORAPP_PRESETCAT02_TIP;Set combobox, sliders, temp, green so that Cat02 automatic is preset.\nYou must change Cat02 adaptation Viewing conditions if need, and other settings if need. TP_COLORAPP_RSTPRO;Red & skin-tones protection TP_COLORAPP_RSTPRO_TOOLTIP;Red & skin-tones protection affects both sliders and curves. TP_COLORAPP_SURROUND;Surround diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 0ed8b1f97..2a5d7cf8f 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -1160,15 +1160,15 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) ipf.ciecam_02float(ncie, float (adap), pW, 2, nprevl, params.get(), customColCurve1, customColCurve2, customColCurve3, histLCAM, histCCAM, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 0 , scale, execsharp, d, dj, yb, 1); - if ((params->colorappearance.autodegree || params->colorappearance.autodegreeout) && acListener && params->colorappearance.enabled) { + if ((params->colorappearance.autodegree || params->colorappearance.autodegreeout) && acListener && params->colorappearance.enabled && !params->colorappearance.presetcat02) { acListener->autoCamChanged(100.* (double)d, 100.* (double)dj); } - if (params->colorappearance.autoadapscen && acListener && params->colorappearance.enabled) { + if (params->colorappearance.autoadapscen && acListener && params->colorappearance.enabled && !params->colorappearance.presetcat02) { acListener->adapCamChanged(adap); //real value of adapt scene } - if (params->colorappearance.autoybscen && acListener && params->colorappearance.enabled) { + if (params->colorappearance.autoybscen && acListener && params->colorappearance.enabled && !params->colorappearance.presetcat02) { acListener->ybCamChanged((int) yb); //real value Yb scene } } else { diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 7d83b50d2..a4502b470 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -1398,7 +1398,8 @@ ColorAppearanceParams::ColorAppearanceParams() : ybout(18), greenout(1.0), tempsc(5000), - greensc(1.0) + greensc(1.0), + presetcat02(false) { } @@ -1443,7 +1444,8 @@ bool ColorAppearanceParams::operator ==(const ColorAppearanceParams& other) cons && ybout == other.ybout && greenout == other.greenout && tempsc == other.tempsc - && greensc == other.greensc; + && greensc == other.greensc + && presetcat02 == other.presetcat02; } bool ColorAppearanceParams::operator !=(const ColorAppearanceParams& other) const @@ -3239,6 +3241,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || pedited->colorappearance.ybout, "Color appearance", "Ybout", colorappearance.ybout, keyFile); saveToKeyfile(!pedited || pedited->colorappearance.datacie, "Color appearance", "Datacie", colorappearance.datacie, keyFile); saveToKeyfile(!pedited || pedited->colorappearance.tonecie, "Color appearance", "Tonecie", colorappearance.tonecie, keyFile); + saveToKeyfile(!pedited || pedited->colorappearance.presetcat02, "Color appearance", "Presetcat02", colorappearance.presetcat02, keyFile); const std::map ca_mapping = { {ColorAppearanceParams::TcMode::LIGHT, "Lightness"}, @@ -4229,6 +4232,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Color appearance", "Ybout", pedited, colorappearance.ybout, pedited->colorappearance.ybout); assignFromKeyfile(keyFile, "Color appearance", "Datacie", pedited, colorappearance.datacie, pedited->colorappearance.datacie); assignFromKeyfile(keyFile, "Color appearance", "Tonecie", pedited, colorappearance.tonecie, pedited->colorappearance.tonecie); + assignFromKeyfile(keyFile, "Color appearance", "Presetcat02", pedited, colorappearance.presetcat02, pedited->colorappearance.presetcat02); const std::map tc_mapping = { {"Lightness", ColorAppearanceParams::TcMode::LIGHT}, diff --git a/rtengine/procparams.h b/rtengine/procparams.h index e6828f570..034577cb6 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -680,6 +680,7 @@ struct ColorAppearanceParams { double greenout; int tempsc; double greensc; + bool presetcat02; ColorAppearanceParams(); diff --git a/rtgui/colorappearance.cc b/rtgui/colorappearance.cc index 9468770fc..eed1c074b 100644 --- a/rtgui/colorappearance.cc +++ b/rtgui/colorappearance.cc @@ -25,6 +25,7 @@ #include "guiutils.h" #include "options.h" #include "rtimage.h" +#include "eventmapper.h" #include "../rtengine/color.h" #include "../rtengine/procparams.h" @@ -217,8 +218,16 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel (this, "colorappearance" milestones.push_back ( GradientMilestone (0., 0., 0., 0.) ); milestones.push_back ( GradientMilestone (1., 1., 1., 1.) ); + auto m = ProcEventMapper::getInstance(); + Evcatpreset = m->newEvent(LUMINANCECURVE, "HISTORY_MSG_CAT02PRESET"); - // ------------------------ Process #1: Converting to CIECAM + //preset button cat02 + presetcat02 = Gtk::manage (new Gtk::CheckButton (M ("TP_COLORAPP_PRESETCAT02"))); + presetcat02->set_tooltip_markup (M("TP_COLORAPP_PRESETCAT02_TIP")); + presetcat02conn = presetcat02->signal_toggled().connect( sigc::mem_fun(*this, &ColorAppearance::presetcat02pressed)); + pack_start (*presetcat02, Gtk::PACK_SHRINK); + + // ----------------------- Process #1: Converting to CIECAM // Process 1 frame @@ -801,6 +810,7 @@ void ColorAppearance::read (const ProcParams* pp, const ParamsEdited* pedited) tcmodeconn.block (true); tcmode2conn.block (true); tcmode3conn.block (true); + presetcat02conn.block (true); shape->setCurve (pp->colorappearance.curve); shape2->setCurve (pp->colorappearance.curve2); shape3->setCurve (pp->colorappearance.curve3); @@ -808,7 +818,12 @@ void ColorAppearance::read (const ProcParams* pp, const ParamsEdited* pedited) toneCurveMode2->set_active (toUnderlying(pp->colorappearance.curveMode2)); toneCurveMode3->set_active (toUnderlying(pp->colorappearance.curveMode3)); curveMode3Changed(); // This will set the correct sensitive state of depending Adjusters + presetcat02->set_active(pp->colorappearance.presetcat02); + nexttemp = pp->wb.temperature; + nextgreen = pp->wb.green; + + printf("temp=%f green=%f\n", nexttemp, nextgreen); if (pedited) { degree->setEditedState (pedited->colorappearance.degree ? Edited : UnEdited); degreeout->setEditedState (pedited->colorappearance.degreeout ? Edited : UnEdited); @@ -858,6 +873,7 @@ void ColorAppearance::read (const ProcParams* pp, const ParamsEdited* pedited) if (!pedited->colorappearance.curveMode3) { toneCurveMode3->set_active (3); } + presetcat02->set_inconsistent(!pedited->colorappearance.presetcat02); } @@ -993,6 +1009,10 @@ void ColorAppearance::read (const ProcParams* pp, const ParamsEdited* pedited) ybout->setValue (pp->colorappearance.ybout); tempsc->setValue (pp->colorappearance.tempsc); greensc->setValue (pp->colorappearance.greensc); + presetcat02conn.block (true); + presetcat02->set_active (pp->colorappearance.presetcat02); + presetcat02conn.block (false); + lastpresetcat02 = pp->colorappearance.presetcat02; tcmode3conn.block (false); tcmode2conn.block (false); @@ -1045,6 +1065,7 @@ void ColorAppearance::write (ProcParams* pp, ParamsEdited* pedited) pp->colorappearance.ybout = ybout->getValue (); pp->colorappearance.tempsc = tempsc->getValue (); pp->colorappearance.greensc = greensc->getValue (); + pp->colorappearance.presetcat02 = presetcat02->get_active(); int tcMode = toneCurveMode->get_active_row_number(); @@ -1114,6 +1135,7 @@ void ColorAppearance::write (ProcParams* pp, ParamsEdited* pedited) pedited->colorappearance.ybout = ybout->getEditedState (); pedited->colorappearance.tempsc = tempsc->getEditedState (); pedited->colorappearance.greensc = greensc->getEditedState (); + pedited->colorappearance.presetcat02 = presetcat02->get_inconsistent (); } @@ -1309,6 +1331,130 @@ void ColorAppearance::badpix_toggled () { } */ +void ColorAppearance::presetcat02pressed () +{ + if (presetcat02->get_active ()) { + disableListener(); + 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(); + gamutconn.block (true); + gamut->set_active (true); + gamutconn.block (false); + degree->setAutoValue (true); + degree->resetValue (false); + adapscen->resetValue (false); + adapscen->setAutoValue (true); + degreeout->resetValue (false); + degreeout->setAutoValue (true); + ybscen->resetValue (false); + ybscen->setAutoValue (true); + surrsrc->set_active (0); + wbmodel->set_active (2); + tempsc->resetValue (false); + greensc->resetValue (false); + adapscen->setValue(400.); + ybscen->setValue(18); + surround->set_active (0); + adaplum->setValue(400.); + degreeout->setValue(70); + ybout->setValue(18); + tempout->setValue (nexttemp); + greenout->setValue (nextgreen); + enableListener(); + } else { + disableListener(); +/* 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(); + gamutconn.block (true); + gamut->set_active (true); + gamutconn.block (false); +*/ + degree->setAutoValue (true); + degree->resetValue (false); + adapscen->resetValue (false); + adapscen->setAutoValue (true); + degreeout->resetValue (false); + degreeout->setAutoValue (true); + ybscen->resetValue (false); + ybscen->setAutoValue (true); + surrsrc->set_active (0); + wbmodel->set_active (0); + tempsc->resetValue (false); + greensc->resetValue (false); + adapscen->resetValue (false); + ybscen->resetValue (false); + surround->set_active (0); + adaplum->resetValue (false); + degreeout->resetValue (false); + ybout->resetValue (false); + tempout->resetValue (false); + greenout->resetValue (false); + enableListener(); + + } + if (batchMode) { + if (presetcat02->get_inconsistent()) { + presetcat02->set_inconsistent (false); + presetcat02conn.block (true); + presetcat02->set_active (false); + presetcat02conn.block (false); + } else if (lastpresetcat02) { + presetcat02->set_inconsistent (true); + } + + lastpresetcat02 = presetcat02->get_active (); + } + + if (listener) { + if (presetcat02->get_active ()) { + listener->panelChanged (Evcatpreset, M ("GENERAL_ENABLED")); + } else { + listener->panelChanged (Evcatpreset, M ("GENERAL_DISABLED")); + } + } + +} + void ColorAppearance::datacie_toggled () { @@ -1470,6 +1616,10 @@ void ColorAppearance::autoCamChanged (double ccam, double ccamout) void ColorAppearance::adapCamChanged (double cadap) { + if(presetcat02->get_active()){ + return; + } + idle_register.add( [this, cadap]() -> bool { @@ -1483,6 +1633,10 @@ void ColorAppearance::adapCamChanged (double cadap) void ColorAppearance::ybCamChanged (int ybsc) { + if(presetcat02->get_active()){ + return; + } + idle_register.add( [this, ybsc]() -> bool { diff --git a/rtgui/colorappearance.h b/rtgui/colorappearance.h index c42bca774..7379eb9b0 100644 --- a/rtgui/colorappearance.h +++ b/rtgui/colorappearance.h @@ -66,7 +66,7 @@ public: bool adapCamComputed_ (); void ybCamChanged (int yb) override; bool ybCamComputed_ (); - + void presetcat02pressed (); void curveChanged (CurveEditor* ce) override; void curveMode1Changed (); bool curveMode1Changed_ (); @@ -99,6 +99,8 @@ public: void writeOptions (std::vector &tpOpen); private: + rtengine::ProcEvent Evcatpreset; + 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); @@ -143,6 +145,9 @@ private: Gtk::CheckButton* tonecie; // Gtk::CheckButton* sharpcie; Gtk::Button* neutral; + Gtk::CheckButton* presetcat02; + sigc::connection presetcat02conn; + MyComboBoxText* surrsrc; sigc::connection surrsrcconn; @@ -172,6 +177,9 @@ private: bool lastgamut; bool lastdatacie; bool lasttonecie; + bool lastpresetcat02; + double nexttemp; + double nextgreen; IdleRegister idle_register; }; diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index f39c73e03..448b1316c 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -247,6 +247,7 @@ void ParamsEdited::set(bool v) colorappearance.ybout = v; colorappearance.tempsc = v; colorappearance.greensc = v; + colorappearance.presetcat02 = v; //colorBoost.amount = v; //colorBoost.avoidclip = v; @@ -837,6 +838,7 @@ void ParamsEdited::initFrom(const std::vector& colorappearance.ybout = colorappearance.ybout && p.colorappearance.ybout == other.colorappearance.ybout; colorappearance.tempsc = colorappearance.tempsc && p.colorappearance.tempsc == other.colorappearance.tempsc; colorappearance.greensc = colorappearance.greensc && p.colorappearance.greensc == other.colorappearance.greensc; + colorappearance.presetcat02 = colorappearance.presetcat02 && p.colorappearance.presetcat02 == other.colorappearance.presetcat02; //colorBoost.amount = colorBoost.amount && p.colorBoost.amount == other.colorBoost.amount; //colorBoost.avoidclip = colorBoost.avoidclip && p.colorBoost.avoidclip == other.colorBoost.avoidclip; @@ -2083,6 +2085,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.colorappearance.tonecie = mods.colorappearance.tonecie; } + if (colorappearance.presetcat02) { + toEdit.colorappearance.presetcat02 = mods.colorappearance.presetcat02; + } + // if (colorappearance.sharpcie) toEdit.colorappearance.sharpcie = mods.colorappearance.sharpcie; if (impulseDenoise.enabled) { toEdit.impulseDenoise.enabled = mods.impulseDenoise.enabled; diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 23e90635e..47985400e 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -294,6 +294,7 @@ struct ColorAppearanceParamsEdited { bool ybout; bool tempsc; bool greensc; + bool presetcat02; }; struct DirPyrDenoiseParamsEdited {