]> git.lyx.org Git - features.git/commitdiff
Distinguish between "Apply" when the dialog should be refreshed afterwards
authorAngus Leeming <leeming@lyx.org>
Tue, 4 Sep 2001 10:50:31 +0000 (10:50 +0000)
committerAngus Leeming <leeming@lyx.org>
Tue, 4 Sep 2001 10:50:31 +0000 (10:50 +0000)
and "Ok" when it shouldn't.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2679 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/controllers/ControlButtons.C
src/frontends/controllers/ControlButtons.h
src/frontends/controllers/ControlInset.h

index 9453659548af38599341f28295a6418768ce2a7a..0e381f8247301f6293a81ed34ca7838d685adfd2 100644 (file)
 #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();
 }
index c252bcd7e9682fe1b17d8ad7caaab54fd573af1b..25547338eb3e0728b44c8ae96d258cee9a731457 100644 (file)
@@ -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
index fa16d78123e17d31406330c44b6dc9ad7f77b816..c1dce1f94025d39a39901868e886b580c218d838 100644 (file)
@@ -195,11 +195,13 @@ void ControlInset<Inset, Params>::apply()
        else
                applyParamsNoInset();
 
-       *params_ = getParams(string());
-       inset_ = 0;
-       ih_.disconnect();
+       if (!isClosing()) {
+               *params_ = getParams(string());
+               inset_ = 0;
+               ih_.disconnect();
 
-       view().update();
+               view().update();
+       }
 }