From dc34658683c226b5667d36433d854dc37d7522a1 Mon Sep 17 00:00:00 2001 From: Morgan Hardwood Date: Tue, 11 Sep 2018 20:08:01 +0200 Subject: [PATCH 1/2] Gray-out Retinex tool when editing non-raw image Closes #4795 --- rtgui/guiutils.cc | 5 +++++ rtgui/guiutils.h | 3 +++ rtgui/toolpanel.cc | 11 ++++++++++- rtgui/toolpanel.h | 1 + rtgui/toolpanelcoord.cc | 5 +++++ 5 files changed, 24 insertions(+), 1 deletion(-) diff --git a/rtgui/guiutils.cc b/rtgui/guiutils.cc index 1e4f4eac8..23c006d3b 100644 --- a/rtgui/guiutils.cc +++ b/rtgui/guiutils.cc @@ -917,6 +917,11 @@ bool MyExpander::on_enabled_change(GdkEventButton* event) return false; } +void MyExpander::setSensitive(bool makeSensitive) +{ + set_sensitive(makeSensitive); +} + /* * * Derived class of some widgets to properly handle the scroll wheel ; diff --git a/rtgui/guiutils.h b/rtgui/guiutils.h index fb627a78a..fbc2ef999 100644 --- a/rtgui/guiutils.h +++ b/rtgui/guiutils.h @@ -268,6 +268,9 @@ public: /// Set the collapsed/expanded state of the expander void set_expanded( bool expanded ); + // Set whether the expander should be grayed-out. + void setSensitive(bool makeSensitive); + /// Get the collapsed/expanded state of the expander bool get_expanded(); diff --git a/rtgui/toolpanel.cc b/rtgui/toolpanel.cc index 0d441e01f..515fb60ef 100644 --- a/rtgui/toolpanel.cc +++ b/rtgui/toolpanel.cc @@ -146,5 +146,14 @@ void FoldableToolPanel::setEnabledTooltipText(Glib::ustring tooltipText) } } - +void FoldableToolPanel::setGrayedOut(bool doGrayOut) +{ + if (doGrayOut) { + exp->setEnabled(false); + exp->set_expanded(false); + exp->setSensitive(false); + } else { + exp->setSensitive(true); + } +} diff --git a/rtgui/toolpanel.h b/rtgui/toolpanel.h index d3d7439a9..fd7d27fbe 100644 --- a/rtgui/toolpanel.h +++ b/rtgui/toolpanel.h @@ -205,6 +205,7 @@ public: void setEnabledTooltipText(Glib::ustring tooltipText); bool get_inconsistent(); // related to the enabled/disabled state void set_inconsistent(bool isInconsistent); // related to the enabled/disabled state + void setGrayedOut(bool doGrayOut); // Set whether the tool should be disabled, collapsed and grayed-out. void setLevel (int level); diff --git a/rtgui/toolpanelcoord.cc b/rtgui/toolpanelcoord.cc index 5a69119c2..5d35a9ad5 100644 --- a/rtgui/toolpanelcoord.cc +++ b/rtgui/toolpanelcoord.cc @@ -275,6 +275,7 @@ void ToolPanelCoordinator::imageTypeChanged (bool isRaw, bool isBayer, bool isXt self->sensorbayer->FoldableToolPanel::show(); self->preprocess->FoldableToolPanel::show(); self->flatfield->FoldableToolPanel::show(); + self->retinex->FoldableToolPanel::setGrayedOut(false); return FALSE; }; @@ -289,6 +290,7 @@ void ToolPanelCoordinator::imageTypeChanged (bool isRaw, bool isBayer, bool isXt self->sensorbayer->FoldableToolPanel::hide(); self->preprocess->FoldableToolPanel::show(); self->flatfield->FoldableToolPanel::show(); + self->retinex->FoldableToolPanel::setGrayedOut(false); return FALSE; }; @@ -303,6 +305,7 @@ void ToolPanelCoordinator::imageTypeChanged (bool isRaw, bool isBayer, bool isXt self->sensorxtrans->FoldableToolPanel::hide(); self->preprocess->FoldableToolPanel::hide(); self->flatfield->FoldableToolPanel::show(); + self->retinex->FoldableToolPanel::setGrayedOut(false); return FALSE; }; @@ -316,6 +319,7 @@ void ToolPanelCoordinator::imageTypeChanged (bool isRaw, bool isBayer, bool isXt self->sensorxtrans->FoldableToolPanel::hide(); self->preprocess->FoldableToolPanel::hide(); self->flatfield->FoldableToolPanel::hide(); + self->retinex->FoldableToolPanel::setGrayedOut(false); return FALSE; }; @@ -326,6 +330,7 @@ void ToolPanelCoordinator::imageTypeChanged (bool isRaw, bool isBayer, bool isXt ToolPanelCoordinator* const self = static_cast(data); self->rawPanelSW->set_sensitive (false); + self->retinex->FoldableToolPanel::setGrayedOut(true); return FALSE; }; From ef0d9fac99985a3c6adaa5ff720500784b084f4f Mon Sep 17 00:00:00 2001 From: Morgan Hardwood Date: Wed, 12 Sep 2018 13:16:17 +0200 Subject: [PATCH 2/2] Removed unnecessary method, PR #4796 --- rtgui/guiutils.cc | 5 ----- rtgui/guiutils.h | 3 --- rtgui/toolpanel.cc | 4 ++-- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/rtgui/guiutils.cc b/rtgui/guiutils.cc index 23c006d3b..1e4f4eac8 100644 --- a/rtgui/guiutils.cc +++ b/rtgui/guiutils.cc @@ -917,11 +917,6 @@ bool MyExpander::on_enabled_change(GdkEventButton* event) return false; } -void MyExpander::setSensitive(bool makeSensitive) -{ - set_sensitive(makeSensitive); -} - /* * * Derived class of some widgets to properly handle the scroll wheel ; diff --git a/rtgui/guiutils.h b/rtgui/guiutils.h index fbc2ef999..fb627a78a 100644 --- a/rtgui/guiutils.h +++ b/rtgui/guiutils.h @@ -268,9 +268,6 @@ public: /// Set the collapsed/expanded state of the expander void set_expanded( bool expanded ); - // Set whether the expander should be grayed-out. - void setSensitive(bool makeSensitive); - /// Get the collapsed/expanded state of the expander bool get_expanded(); diff --git a/rtgui/toolpanel.cc b/rtgui/toolpanel.cc index 515fb60ef..c9c4f823c 100644 --- a/rtgui/toolpanel.cc +++ b/rtgui/toolpanel.cc @@ -151,9 +151,9 @@ void FoldableToolPanel::setGrayedOut(bool doGrayOut) if (doGrayOut) { exp->setEnabled(false); exp->set_expanded(false); - exp->setSensitive(false); + exp->set_sensitive(false); } else { - exp->setSensitive(true); + exp->set_sensitive(true); } }