diff --git a/rtdata/languages/default b/rtdata/languages/default index 5004bf25c..922c50c51 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -787,6 +787,7 @@ HISTORY_MSG_SH_COLORSPACE;S/H - Colorspace HISTORY_MSG_SOFTLIGHT_ENABLED;Soft light HISTORY_MSG_SOFTLIGHT_STRENGTH;Soft light - Strength HISTORY_MSG_TM_FATTAL_ANCHOR;DRC - Anchor +HISTORY_MSG_TRANS_Method;Geometry - Method HISTORY_NEWSNAPSHOT;Add HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s HISTORY_SNAPSHOT;Snapshot @@ -1775,6 +1776,8 @@ TP_LABCURVE_RSTPRO_TOOLTIP;Works on the Chromaticity slider and the CC curve. TP_LENSGEOM_AUTOCROP;Auto-Crop TP_LENSGEOM_FILL;Auto-fill TP_LENSGEOM_LABEL;Lens / Geometry +TP_LENSGEOM_LIN;Linear +TP_LENSGEOM_LOG;Logarithmic TP_LENSPROFILE_CORRECTION_AUTOMATCH;Automatically selected TP_LENSPROFILE_CORRECTION_LCPFILE;LCP file TP_LENSPROFILE_CORRECTION_MANUAL;Manually selected diff --git a/rtengine/iptransform.cc b/rtengine/iptransform.cc index c9f88caf0..39f270d51 100644 --- a/rtengine/iptransform.cc +++ b/rtengine/iptransform.cc @@ -1054,7 +1054,7 @@ void ImProcFunctions::transformGeneral(bool highQuality, Imagefloat *original, I const double ascale = params->commonTrans.autofill ? getTransformAutoFill(oW, oH, pLCPMap) : 1.0; const bool darkening = (params->vignetting.amount <= 0.0); - const bool useLog = params->pdsharpening.enabled && highQuality; + const bool useLog = params->commonTrans.method == "log" && highQuality; const double centerFactorx = cx - w2; const double centerFactory = cy - h2; @@ -1215,7 +1215,7 @@ void ImProcFunctions::transformGeneral(bool highQuality, Imagefloat *original, I void ImProcFunctions::transformLCPCAOnly(Imagefloat *original, Imagefloat *transformed, int cx, int cy, const LensCorrection *pLCPMap, bool useOriginalBuffer) { assert(pLCPMap && params->lensProf.useCA && pLCPMap->isCACorrectionAvailable()); - const bool useLog = params->pdsharpening.enabled; + const bool useLog = params->commonTrans.method == "log"; float** chOrig[3]; chOrig[0] = original->r.ptrs; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index ba6fc237b..99f4f4404 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -1732,13 +1732,14 @@ bool CoarseTransformParams::operator !=(const CoarseTransformParams& other) cons } CommonTransformParams::CommonTransformParams() : + method("log"), autofill(true) { } bool CommonTransformParams::operator ==(const CommonTransformParams& other) const { - return autofill == other.autofill; + return method == other.method && autofill == other.autofill; } bool CommonTransformParams::operator !=(const CommonTransformParams& other) const @@ -3322,6 +3323,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || pedited->coarse.vflip, "Coarse Transformation", "VerticalFlip", coarse.vflip, keyFile); // Common properties for transformations + saveToKeyfile(!pedited || pedited->commonTrans.method, "Common Properties for Transformations", "Method", commonTrans.method, keyFile); saveToKeyfile(!pedited || pedited->commonTrans.autofill, "Common Properties for Transformations", "AutoFill", commonTrans.autofill, keyFile); // Rotation @@ -4360,6 +4362,11 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) } if (keyFile.has_group("Common Properties for Transformations")) { + if (keyFile.has_key("Common Properties for Transformations", "Method")) { + assignFromKeyfile(keyFile, "Common Properties for Transformations", "Method", pedited, commonTrans.method, pedited->commonTrans.method); + } else { + commonTrans.method = "lin"; + } assignFromKeyfile(keyFile, "Common Properties for Transformations", "AutoFill", pedited, commonTrans.autofill, pedited->commonTrans.autofill); } diff --git a/rtengine/procparams.h b/rtengine/procparams.h index c41e55872..0b6b2dc46 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -837,6 +837,7 @@ struct CoarseTransformParams { * Common transformation parameters */ struct CommonTransformParams { + Glib::ustring method; bool autofill; CommonTransformParams(); diff --git a/rtgui/lensgeom.cc b/rtgui/lensgeom.cc index 76e0635eb..762726107 100644 --- a/rtgui/lensgeom.cc +++ b/rtgui/lensgeom.cc @@ -17,6 +17,8 @@ * along with RawTherapee. If not, see . */ #include "lensgeom.h" + +#include "eventmapper.h" #include "guiutils.h" #include "rtimage.h" @@ -28,6 +30,18 @@ using namespace rtengine::procparams; LensGeometry::LensGeometry () : FoldableToolPanel(this, "lensgeom", M("TP_LENSGEOM_LABEL")), rlistener(nullptr), lastFill(false) { + auto m = ProcEventMapper::getInstance(); + EvTransMethod = m->newEvent(TRANSFORM, "HISTORY_MSG_TRANS_METHOD"); + + Gtk::HBox* hb1 = Gtk::manage (new Gtk::HBox ()); + hb1->pack_start (*Gtk::manage (new Gtk::Label ( M("TP_RAW_DMETHOD") + ": ")), Gtk::PACK_SHRINK, 4); + method = Gtk::manage (new MyComboBoxText ()); + method->append(M("TP_LENSGEOM_LOG")); + method->append(M("TP_LENSGEOM_LIN")); + method->set_active(0); + hb1->pack_end (*method, Gtk::PACK_EXPAND_WIDGET, 4); + pack_start( *hb1, Gtk::PACK_SHRINK, 4); + fill = Gtk::manage (new Gtk::CheckButton (M("TP_LENSGEOM_FILL"))); pack_start (*fill); @@ -39,8 +53,9 @@ LensGeometry::LensGeometry () : FoldableToolPanel(this, "lensgeom", M("TP_LENSGE packBox = Gtk::manage (new ToolParamBlock ()); pack_start (*packBox); - autoCrop->signal_pressed().connect( sigc::mem_fun(*this, &LensGeometry::autoCropPressed) ); - fillConn = fill->signal_toggled().connect( sigc::mem_fun(*this, &LensGeometry::fillPressed) ); + method->connect(method->signal_changed().connect(sigc::mem_fun(*this, &LensGeometry::methodChanged))); + autoCrop->signal_pressed().connect(sigc::mem_fun(*this, &LensGeometry::autoCropPressed)); + fillConn = fill->signal_toggled().connect(sigc::mem_fun(*this, &LensGeometry::fillPressed)); fill->set_active (true); show_all (); @@ -55,8 +70,14 @@ void LensGeometry::read (const ProcParams* pp, const ParamsEdited* pedited) { disableListener (); + method->block (true); + method->set_active(pp->commonTrans.method == "log" ? 0 : 1); if (pedited) { + if(!pedited->commonTrans.method) { + method->set_active_text(M("GENERAL_UNCHANGED")); + } + fill->set_inconsistent (!pedited->commonTrans.autofill); } @@ -67,15 +88,20 @@ void LensGeometry::read (const ProcParams* pp, const ParamsEdited* pedited) lastFill = pp->commonTrans.autofill; + method->block (false); enableListener (); } void LensGeometry::write (ProcParams* pp, ParamsEdited* pedited) { - + int currentRow = method->get_active_row_number(); + if( currentRow >= 0 && method->get_active_text() != M("GENERAL_UNCHANGED")) { + pp->commonTrans.method = currentRow == 0 ? "log" : "lin"; + } pp->commonTrans.autofill = fill->get_active (); if (pedited) { + pedited->commonTrans.method = method->get_active_text() != M("GENERAL_UNCHANGED"); pedited->commonTrans.autofill = !fill->get_inconsistent(); } } @@ -115,6 +141,14 @@ void LensGeometry::fillPressed () } } +void LensGeometry::methodChanged () +{ + + if (listener && method->get_active_row_number() >= 0) { + listener->panelChanged(EvTransMethod, method->get_active_text()); + } +} + void LensGeometry::setBatchMode (bool batchMode) { diff --git a/rtgui/lensgeom.h b/rtgui/lensgeom.h index 18b31a619..73c28b006 100644 --- a/rtgui/lensgeom.h +++ b/rtgui/lensgeom.h @@ -29,6 +29,7 @@ class LensGeometry final : { protected: + MyComboBoxText* method; Gtk::Button* autoCrop; LensGeomListener* rlistener; Gtk::CheckButton* fill; @@ -36,6 +37,7 @@ protected: sigc::connection fillConn; ToolParamBlock* packBox; + rtengine::ProcEvent EvTransMethod; public: LensGeometry (); @@ -50,6 +52,7 @@ public: void write (rtengine::procparams::ProcParams* pp, ParamsEdited* pedited = nullptr) override; void setBatchMode (bool batchMode) override; + void methodChanged(); void fillPressed (); void autoCropPressed (); void setLensGeomListener (LensGeomListener* l) diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 82132008a..d41bd472c 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -321,6 +321,7 @@ void ParamsEdited::set(bool v) coarse.rotate = v; coarse.hflip = v; coarse.vflip = v; + commonTrans.method = v; commonTrans.autofill = v; rotate.degree = v; distortion.amount = v; @@ -904,6 +905,7 @@ void ParamsEdited::initFrom(const std::vector& coarse.rotate = coarse.rotate && p.coarse.rotate == other.coarse.rotate; coarse.hflip = coarse.hflip && p.coarse.hflip == other.coarse.hflip; coarse.vflip = coarse.vflip && p.coarse.vflip == other.coarse.vflip; + commonTrans.method = commonTrans.method && p.commonTrans.method == other.commonTrans.method; commonTrans.autofill = commonTrans.autofill && p.commonTrans.autofill == other.commonTrans.autofill; rotate.degree = rotate.degree && p.rotate.degree == other.rotate.degree; distortion.amount = distortion.amount && p.distortion.amount == other.distortion.amount; @@ -2265,6 +2267,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.coarse.vflip = mods.coarse.vflip; } + if (commonTrans.method) { + toEdit.commonTrans.method = mods.commonTrans.method; + } + if (commonTrans.autofill) { toEdit.commonTrans.autofill = mods.commonTrans.autofill; } diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 01a3e4efe..153dd7bb6 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -365,6 +365,7 @@ struct CoarseTransformParamsEdited { }; struct CommonTransformParamsEdited { + bool method; bool autofill; };