diff --git a/src/frontends/controllers/ControlButtons.C b/src/frontends/controllers/ControlButtons.C index 9453659548..0e381f8247 100644 --- a/src/frontends/controllers/ControlButtons.C +++ b/src/frontends/controllers/ControlButtons.C @@ -21,6 +21,11 @@ #include "ButtonControllerBase.h" #include "ViewBase.h" +ControlButtons::ControlButtons() + : is_closing_(false) +{} + + void ControlButtons::ApplyButton() { apply(); @@ -30,7 +35,9 @@ void ControlButtons::ApplyButton() void ControlButtons::OKButton() { + is_closing_ = true; apply(); + is_closing_ = false; hide(); bc().ok(); } diff --git a/src/frontends/controllers/ControlButtons.h b/src/frontends/controllers/ControlButtons.h index c252bcd7e9..25547338eb 100644 --- a/src/frontends/controllers/ControlButtons.h +++ b/src/frontends/controllers/ControlButtons.h @@ -42,9 +42,9 @@ class ButtonControllerBase; */ class ControlButtons : public DialogBase { -public: // methods +public: /// - ControlButtons() {} + ControlButtons(); /// virtual ~ControlButtons() {} @@ -64,6 +64,10 @@ public: // methods virtual ButtonControllerBase & bc() = 0; protected: + /** When Applying it's useful to know whether the dialog is about + to close or not (no point refreshing the display for example). */ + bool isClosing() const { return is_closing_; } + /// Get changed parameters and Dispatch them to the kernel. virtual void apply() = 0; /// Disconnect signals and hide View. @@ -75,6 +79,11 @@ protected: instantiated in a daughter class that creates the actual instance of the View. */ virtual ViewBase & view() = 0; + +private: + /// + bool is_closing_; + }; #endif // CONTROLBUTTONS_H diff --git a/src/frontends/controllers/ControlInset.h b/src/frontends/controllers/ControlInset.h index fa16d78123..c1dce1f940 100644 --- a/src/frontends/controllers/ControlInset.h +++ b/src/frontends/controllers/ControlInset.h @@ -195,11 +195,13 @@ void ControlInset::apply() else applyParamsNoInset(); - *params_ = getParams(string()); - inset_ = 0; - ih_.disconnect(); + if (!isClosing()) { + *params_ = getParams(string()); + inset_ = 0; + ih_.disconnect(); - view().update(); + view().update(); + } }