diff --git a/rtdata/languages/default b/rtdata/languages/default index 49ec00878..412aad101 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -2158,3 +2158,4 @@ ZOOMPANEL_ZOOMOUT;Zoom Out\nShortcut: - LENSPROFILE_CORRECTION_AUTOMATCH;Auto-matched correction parameters LENSPROFILE_CORRECTION_MANUAL;Manual correction parameters LENSPROFILE_CORRECTION_LCPFILE;LCP File +LENSPROFILE_LENS_WARNING;Warning: the crop factor used for lens profiling is larger than the crop factor of the camera, the results might be wrong. \ No newline at end of file diff --git a/rtengine/rtlensfun.cc b/rtengine/rtlensfun.cc index 15ec001eb..2f70aabac 100644 --- a/rtengine/rtlensfun.cc +++ b/rtengine/rtlensfun.cc @@ -206,6 +206,16 @@ Glib::ustring LFLens::getLens() const } +float LFLens::getCropFactor() const +{ + if (data_) { + return data_->CropFactor; + } else { + return 0; + } +} + + //----------------------------------------------------------------------------- // LFDatabase //----------------------------------------------------------------------------- diff --git a/rtengine/rtlensfun.h b/rtengine/rtlensfun.h index 2ea893302..a862c7b2a 100644 --- a/rtengine/rtlensfun.h +++ b/rtengine/rtlensfun.h @@ -75,6 +75,7 @@ public: Glib::ustring getMake() const; Glib::ustring getLens() const; Glib::ustring getDisplayString() const { return getLens(); } + float getCropFactor() const; private: friend class LFDatabase; const lfLens *data_; diff --git a/rtgui/lensprofile.cc b/rtgui/lensprofile.cc index b402cdfe3..3927ef225 100644 --- a/rtgui/lensprofile.cc +++ b/rtgui/lensprofile.cc @@ -86,6 +86,11 @@ LensProfilePanel::LensProfilePanel () : hb = Gtk::manage(new Gtk::HBox()); hb->pack_start(*Gtk::manage(new Gtk::Label(M("EXIFFILTER_LENS"))), Gtk::PACK_SHRINK, 4); hb->pack_start(*lensfunLenses); + warning = Gtk::manage(new Gtk::Image()); + warning->set_from_icon_name("dialog-warning", Gtk::ICON_SIZE_LARGE_TOOLBAR); + warning->set_tooltip_text(M("LENSPROFILE_LENS_WARNING")); + warning->hide(); + hb->pack_start(*warning, Gtk::PACK_SHRINK, 4); pack_start(*hb); corrLcpFile = Gtk::manage(new Gtk::RadioButton(corrGroup)); @@ -219,10 +224,35 @@ void LensProfilePanel::read(const rtengine::procparams::ProcParams* pp, const Pa corrOff->set_active(true); } + updateLensfunWarning(); + enableListener (); conUseDist.block(false); } + +void LensProfilePanel::updateLensfunWarning() +{ + warning->hide(); + if (corrLensfunManual->get_active()) { + const LFDatabase *db = LFDatabase::getInstance(); + + auto itc = lensfunCameras->get_active(); + if (!itc) { + return; + } + LFCamera c = db->findCamera((*itc)[lf->lensfunModelCam.make], (*itc)[lf->lensfunModelCam.model]); + auto itl = lensfunLenses->get_active(); + if (!itl) { + return; + } + LFLens l = db->findLens(LFCamera(), (*itl)[lf->lensfunModelLens.lens]); + if (l.getCropFactor() - c.getCropFactor() >= 0.01) { + warning->show(); + } + } +} + void LensProfilePanel::setRawMeta(bool raw, const rtengine::ImageMetaData* pMeta) { if (!raw || pMeta->getFocusDist() <= 0) { @@ -430,6 +460,8 @@ void LensProfilePanel::onLensfunCameraChanged() listener->panelChanged(EvLensCorrLensfunCamera, name); } } + + updateLensfunWarning(); } @@ -449,6 +481,8 @@ void LensProfilePanel::onLensfunLensChanged() listener->panelChanged(EvLensCorrLensfunLens, name); } } + + updateLensfunWarning(); } @@ -526,6 +560,8 @@ void LensProfilePanel::onCorrModeChanged() mode = M("GENERAL_UNCHANGED"); } + updateLensfunWarning(); + if (listener) { listener->panelChanged(EvLensCorrMode, mode); } diff --git a/rtgui/lensprofile.h b/rtgui/lensprofile.h index 5e2a5b484..aca8f16ef 100644 --- a/rtgui/lensprofile.h +++ b/rtgui/lensprofile.h @@ -49,6 +49,7 @@ protected: Gtk::RadioButton *corrUnchanged; MyComboBox *lensfunCameras; MyComboBox *lensfunLenses; + Gtk::Image *warning; class LFDbHelper { public: @@ -86,6 +87,7 @@ protected: bool setLensfunCamera(const Glib::ustring &make, const Glib::ustring &model); bool setLensfunLens(const Glib::ustring &lens); bool checkLensfunCanCorrect(bool automatch); + void updateLensfunWarning(); public: