From c8d9573606527f7eb10721a796899e1599a578b0 Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Thu, 7 Sep 2017 18:04:55 +0200 Subject: [PATCH] disable the selection of lensfun auto mode if no match is found in the db --- rtdata/languages/default | 6 +++++- rtgui/lensprofile.cc | 18 ++++++++++++++++-- rtgui/lensprofile.h | 1 + 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index 91eb5e2bf..083afc4df 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1654,7 +1654,7 @@ 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_LENSPROFILE_LABEL;Lens Correction Profile +TP_LENSPROFILE_LABEL;Profiled Lens Correction TP_LENSPROFILE_USECA;Chromatic aberration correction TP_LENSPROFILE_USEDIST;Distortion correction TP_LENSPROFILE_USEVIGN;Vignetting correction @@ -2152,3 +2152,7 @@ ZOOMPANEL_ZOOMFITCROPSCREEN;Fit crop to screen\nShortcut: Alt-f ZOOMPANEL_ZOOMFITSCREEN;Fit whole image to screen\nShortcut: f ZOOMPANEL_ZOOMIN;Zoom In\nShortcut: + ZOOMPANEL_ZOOMOUT;Zoom Out\nShortcut: - +LENSPROFILE_CORRECTION_OFF;None +LENSPROFILE_CORRECTION_AUTOMATCH;Auto-matched correction parameters +LENSPROFILE_CORRECTION_MANUAL;Manual correction parameters +LENSPROFILE_CORRECTION_LCPFILE;LCP File diff --git a/rtgui/lensprofile.cc b/rtgui/lensprofile.cc index 7ac67e106..bd518ffe0 100644 --- a/rtgui/lensprofile.cc +++ b/rtgui/lensprofile.cc @@ -36,6 +36,7 @@ LensProfilePanel::LensProfilePanel () : useVignChanged(false), useCAChanged(false), isRaw(true), + metadata(nullptr), lensgeomLcpFill(nullptr), useLensfunChanged(false), lensfunAutoChanged(false), @@ -64,14 +65,14 @@ LensProfilePanel::LensProfilePanel () : lensfunLenses->pack_start(lensfunModelLens.lens); Gtk::HBox *hb = Gtk::manage(new Gtk::HBox()); - hb->pack_start(*Gtk::manage(new Gtk::Label(M("LENSFUN_CAMERA"))), Gtk::PACK_SHRINK, 4); + hb->pack_start(*Gtk::manage(new Gtk::Label(M("EXIFFILTER_CAMERA"))), Gtk::PACK_SHRINK, 4); hb->pack_start(*lensfunCameras); pack_start(*hb); fillLensfunCameras(); hb = Gtk::manage(new Gtk::HBox()); - hb->pack_start(*Gtk::manage(new Gtk::Label(M("LENSFUN_LENS"))), Gtk::PACK_SHRINK, 4); + hb->pack_start(*Gtk::manage(new Gtk::Label(M("EXIFFILTER_LENS"))), Gtk::PACK_SHRINK, 4); hb->pack_start(*lensfunLenses); pack_start(*hb); @@ -140,6 +141,8 @@ void LensProfilePanel::read(const rtengine::procparams::ProcParams* pp, const Pa disableListener (); conUseDist.block(true); + corrLensfunAuto->set_sensitive(true); + if (pp->lensProf.useLensfun) { if (pp->lensProf.lfAutoMatch) { corrLensfunAuto->set_active(true); @@ -214,6 +217,16 @@ void LensProfilePanel::read(const rtengine::procparams::ProcParams* pp, const Pa lcpFileChanged = useDistChanged = useVignChanged = useCAChanged = false; useLensfunChanged = lensfunAutoChanged = lensfunCameraChanged = lensfunLensChanged = false; + if (!batchMode && metadata && pp->lensProf.useLensfun) { + std::unique_ptr mod(LFDatabase::findModifier(pp->lensProf, metadata, 100, 100, pp->coarse, -1)); + if (!mod) { + corrOff->set_active(true); + if (pp->lensProf.lfAutoMatch) { + corrLensfunAuto->set_sensitive(false); + } + } + } + enableListener (); conUseDist.block(false); } @@ -232,6 +245,7 @@ void LensProfilePanel::setRawMeta(bool raw, const rtengine::ImageMetaData* pMeta } isRaw = raw; + metadata = pMeta; } void LensProfilePanel::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pedited) diff --git a/rtgui/lensprofile.h b/rtgui/lensprofile.h index 34222932e..11e3bb219 100644 --- a/rtgui/lensprofile.h +++ b/rtgui/lensprofile.h @@ -39,6 +39,7 @@ protected: void updateDisabled(bool enable); bool allowFocusDep; bool isRaw; + const rtengine::ImageMetaData* metadata; LensGeometry *lensgeomLcpFill; Gtk::RadioButton::Group corrGroup;