From: Angus Leeming Date: Tue, 4 Sep 2001 10:50:31 +0000 (+0000) Subject: Distinguish between "Apply" when the dialog should be refreshed afterwards X-Git-Tag: 1.6.10~20667 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=f3562a2398b0a1cc2d1c35404deb17ea0651c796;p=features.git Distinguish between "Apply" when the dialog should be refreshed afterwards and "Ok" when it shouldn't. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2679 a592a061-630c-0410-9148-cb99ea01b6c8 --- 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(); + } }