From 9fccdd6ca539ffaa3c9520d6f7ff9fe8aa8a7279 Mon Sep 17 00:00:00 2001 From: Beep6581 Date: Mon, 30 May 2016 23:47:13 +0200 Subject: [PATCH 1/2] Automatically disable Auto-Fill when enabling LCP Disortion Correction, #1791 --- rtgui/lensgeom.cc | 16 ++++++++++++++++ rtgui/lensgeom.h | 1 + rtgui/lensprofile.cc | 10 ++++++++++ rtgui/lensprofile.h | 3 +++ rtgui/toolpanelcoord.cc | 1 + 5 files changed, 31 insertions(+) diff --git a/rtgui/lensgeom.cc b/rtgui/lensgeom.cc index 69c4737bc..d50a16f45 100644 --- a/rtgui/lensgeom.cc +++ b/rtgui/lensgeom.cc @@ -113,3 +113,19 @@ void LensGeometry::setBatchMode (bool batchMode) ToolPanel::setBatchMode (batchMode); removeIfThere (this, autoCrop); } + +void LensGeometry::disableAutoFillIfActive () +{ + + if (!batchMode) { + if (fill->get_active()) { + fillConn.block (true); + fill->set_active(false); + if (listener) { + listener->panelChanged (EvTransAutoFill, M("GENERAL_DISABLED")); + } + fillConn.block (false); + } + } + +} diff --git a/rtgui/lensgeom.h b/rtgui/lensgeom.h index f6b41b632..fe21feb6a 100644 --- a/rtgui/lensgeom.h +++ b/rtgui/lensgeom.h @@ -53,6 +53,7 @@ public: { rlistener = l; } + void disableAutoFillIfActive (); }; #endif diff --git a/rtgui/lensprofile.cc b/rtgui/lensprofile.cc index eda3992c3..5555d6dd7 100644 --- a/rtgui/lensprofile.cc +++ b/rtgui/lensprofile.cc @@ -142,6 +142,10 @@ void LensProfilePanel::write( rtengine::procparams::ProcParams* pp, ParamsEdited void LensProfilePanel::onLCPFileChanged() { + + // Disable Auto-Fill when enabling LCP Distortion Correction, #1791 + lensgeomLcpFill->disableAutoFillIfActive(); + lcpFileChanged = true; updateDisabled(lcpStore->isValidLCPFileName(fcbLCPFile->get_filename())); @@ -164,6 +168,12 @@ void LensProfilePanel::onLCPFileReset() void LensProfilePanel::onUseDistChanged() { + + // Disable Auto-Fill when enabling LCP Distortion Correction, #1791 + if (ckbUseDist->get_active()) { + lensgeomLcpFill->disableAutoFillIfActive(); + } + useDistChanged = true; if (listener) { diff --git a/rtgui/lensprofile.h b/rtgui/lensprofile.h index 0397388d5..23d02b9a2 100644 --- a/rtgui/lensprofile.h +++ b/rtgui/lensprofile.h @@ -22,6 +22,7 @@ #include #include "toolpanel.h" #include "guiutils.h" +#include "lensgeom.h" class LensProfilePanel : public ToolParamBlock, public FoldableToolPanel { @@ -38,6 +39,7 @@ protected: void updateDisabled(bool enable); bool allowFocusDep; bool isRaw; + LensGeometry *lensgeomLcpFill; public: @@ -52,6 +54,7 @@ public: void onUseDistChanged(); void onUseVignChanged(); void onUseCAChanged(); + void setLensGeomRef( LensGeometry *foo) { lensgeomLcpFill = foo ;}; }; #endif diff --git a/rtgui/toolpanelcoord.cc b/rtgui/toolpanelcoord.cc index a9f78273e..a13073018 100644 --- a/rtgui/toolpanelcoord.cc +++ b/rtgui/toolpanelcoord.cc @@ -53,6 +53,7 @@ ToolPanelCoordinator::ToolPanelCoordinator () : ipc(nullptr), editDataProvider(n colortoning = Gtk::manage (new ColorToning ()); lensgeom = Gtk::manage (new LensGeometry ()); lensProf = Gtk::manage (new LensProfilePanel ()); + lensProf->setLensGeomRef(lensgeom); distortion = Gtk::manage (new Distortion ()); rotate = Gtk::manage (new Rotate ()); vibrance = Gtk::manage (new Vibrance ()); From 21b9b15e45667f1fa4fcf3a2a630a69f7e0278a1 Mon Sep 17 00:00:00 2001 From: Beep6581 Date: Fri, 3 Jun 2016 14:00:26 +0200 Subject: [PATCH 2/2] Applied Floessie's changes to prevent mutex lock issues, PR #3318 issue #1791 --- rtgui/lensgeom.cc | 28 ++++++++++++++++++++-------- rtgui/lensgeom.h | 7 ++++++- rtgui/myflatcurve.cc | 1 + 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/rtgui/lensgeom.cc b/rtgui/lensgeom.cc index d50a16f45..1d39ced42 100644 --- a/rtgui/lensgeom.cc +++ b/rtgui/lensgeom.cc @@ -43,6 +43,11 @@ LensGeometry::LensGeometry () : FoldableToolPanel(this, "lensgeom", M("TP_LENSGE show_all (); } +LensGeometry::~LensGeometry () +{ + g_idle_remove_by_data(this); +} + void LensGeometry::read (const ProcParams* pp, const ParamsEdited* pedited) { @@ -116,16 +121,23 @@ void LensGeometry::setBatchMode (bool batchMode) void LensGeometry::disableAutoFillIfActive () { + g_idle_add(doDisableAutoFillIfActive, this); +} - if (!batchMode) { - if (fill->get_active()) { - fillConn.block (true); - fill->set_active(false); - if (listener) { - listener->panelChanged (EvTransAutoFill, M("GENERAL_DISABLED")); +int LensGeometry::doDisableAutoFillIfActive (void* data) +{ + GThreadLock lock; // Is this really needed? + + LensGeometry* const instance = static_cast(data); + + if (!instance->batchMode) { + if (instance->fill->get_active()) { + instance->fillConn.block (true); + instance->fill->set_active(false); + if (instance->listener) { + instance->listener->panelChanged (EvTransAutoFill, M("GENERAL_DISABLED")); } - fillConn.block (false); + instance->fillConn.block (false); } } - } diff --git a/rtgui/lensgeom.h b/rtgui/lensgeom.h index fe21feb6a..51a6e108c 100644 --- a/rtgui/lensgeom.h +++ b/rtgui/lensgeom.h @@ -32,11 +32,12 @@ protected: Gtk::CheckButton* fill; bool lastFill; sigc::connection fillConn; - ToolParamBlock* packBox; + ToolParamBlock* packBox; public: LensGeometry (); + ~LensGeometry (); Gtk::Box* getPackBox () { @@ -54,6 +55,10 @@ public: rlistener = l; } void disableAutoFillIfActive (); + +private: + static int doDisableAutoFillIfActive (void* data); + }; #endif diff --git a/rtgui/myflatcurve.cc b/rtgui/myflatcurve.cc index fe53565d2..0bc3bd533 100644 --- a/rtgui/myflatcurve.cc +++ b/rtgui/myflatcurve.cc @@ -1807,6 +1807,7 @@ void MyFlatCurve::setPoints (const std::vector& p) stopNumericalAdjustment(); FlatCurveType t = (FlatCurveType)p[ix++]; curve.type = t; + lit_point = -1; if (t == FCT_MinMaxCPoints) { curve.x.clear ();