]> git.lyx.org Git - features.git/commitdiff
John's controller patch
authorAngus Leeming <leeming@lyx.org>
Tue, 28 Aug 2001 12:24:03 +0000 (12:24 +0000)
committerAngus Leeming <leeming@lyx.org>
Tue, 28 Aug 2001 12:24:03 +0000 (12:24 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2605 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/controllers/ButtonController.h
src/frontends/controllers/ButtonControllerBase.C
src/frontends/controllers/ButtonPolicies.C
src/frontends/controllers/ChangeLog
src/frontends/controllers/ControlDialogs.h
src/frontends/controllers/ControlInset.h
src/frontends/controllers/GUI.h

index 62e9d18974a7db2f096e127b8638e923aa902a3f..dee049628c35f12d72b50ccac17e33e7978d8fd4 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "gettext.h"
 #include "ButtonControllerBase.h"
+#include "debug.h" 
 
 template <class Button, class Widget>
 class GuiBC : public ButtonControllerBase
@@ -75,6 +76,8 @@ GuiBC<Button, Widget>::GuiBC(string const & cancel, string const & close)
 template <class Button, class Widget>
 void GuiBC<Button, Widget>::refresh()
 {
+       lyxerr[Debug::GUI] << "Calling BC refresh()" << std::endl; 
        if (okay_) {
                bool const enabled = bp().buttonStatus(ButtonPolicy::OKAY);
                setButtonEnabled(okay_, enabled);
index a7898f1ca600bc1b442454c3aa0678e63cb164aa..551c26e5a12cee0477d4842c4499848bfca20b75 100644 (file)
@@ -18,6 +18,7 @@
 #include <config.h>
 #include "ButtonControllerBase.h"
 #include "support/LAssert.h"
+#include "debug.h" 
 
 
 ButtonControllerBase::ButtonControllerBase(string const & cancel,
@@ -82,12 +83,15 @@ void ButtonControllerBase::invalid()
 
 bool ButtonControllerBase::readOnly(bool ro)
 {
+       lyxerr[Debug::GUI] << "Setting controller ro: " << ro << std::endl;
        if (ro) {
                bp().input(ButtonPolicy::SMI_READ_ONLY);
        } else {
                bp().input(ButtonPolicy::SMI_READ_WRITE);
        }
        refreshReadOnly();
+       refresh();
        return ro;
 }
 
index 67c970e5d4b5c6dbcf2e94d0d76d08f89d090eb0..a1510d632744401fa920593e8ab1b26b41b61a85 100644 (file)
@@ -34,6 +34,11 @@ void nextState(ButtonPolicy::State & state,
        if (ButtonPolicy::SMI_NOOP == in) return;
 
        ButtonPolicy::State tmp = s_m[state][in];
+
+       lyxerr[Debug::GUI] << "Transition from state "
+               << state << " to state " << tmp << " after input "
+               << in << std::endl;
        if (ButtonPolicy::BOGUS != tmp) {
                state = tmp;
        } else {
index 1ee008585880e62a1d83ed2caee14f1b3c31b84f..081ba5d661d190df9312909494e64454797c25c1 100644 (file)
@@ -1,7 +1,19 @@
-2001-08-26  John Levon  <moz@compsoc.man.ac.uk>
+2001-08-25  John Levon  <moz@compsoc.man.ac.uk>
 
-       * character.C (getBarData): fix bar array.
+       * ControlInset.h:
+       * ControlDialogs.h: remove bc() hack, now fixed in
+         Qt2 frontend. use member dialog_built_ instead of shared
+         static.
+       * ButtonController.h: 
+       * ButtonPolicies.C: more debug info
+       * ButtonControllerBase.C: call refresh() when setting readOnly !
+       * GUI.h: External form has apply, use the right policy
 
+       * character.C: fix two off-by-one errors when latex font was removed
 2001-08-15  Angus Leeming  <a.leeming@ic.ac.uk>
 
        * ControlInset.h (apply): tentative fix for the press Apply multiple
index 65d87f3101f9d783cd21ac509b38896fc684e5ac..049c4ef64cf6a755e24461c90e545d6257ed91ba 100644 (file)
@@ -21,6 +21,7 @@
 #define CONTROLDIALOGS_H
 
 #include "ControlConnections.h"
+#include "debug.h"
 
 /** Base class to control connection/disconnection of signals with the LyX
     kernel for dialogs NOT used with insets.
@@ -45,6 +46,9 @@ protected:
        virtual void clearParams() {}
        /// set the params before show or update
        virtual void setParams() {}
+
+       /// is the dialog built ?
+       bool dialog_built_;
 };
 
 
@@ -52,7 +56,7 @@ protected:
 
 template <class Base>
 ControlDialog<Base>::ControlDialog(LyXView & lv, Dialogs & d)
-       : Base(lv, d)
+       : Base(lv, d), dialog_built_(false)
 {}
 
 
@@ -64,10 +68,9 @@ void ControlDialog<Base>::show()
 
        setParams();
 
-       static bool isBuilt = false;
-       if (!isBuilt) {
-               isBuilt = true;
+       if (!dialog_built_) {
                view().build();
+               dialog_built_ = true;
        }
 
        bc().readOnly(isReadonly());
@@ -83,10 +86,6 @@ void ControlDialog<Base>::update()
        setParams();
 
        bc().readOnly(isReadonly());
-       // Reset the Button Controller to it's initial state
-       bc().invalid();
-       bc().restore();
-
        view().update();
 }
 
index 9b9209f932d1adebdb260364b6c034041dd35abe..fa16d78123e17d31406330c44b6dc9ad7f77b816 100644 (file)
@@ -96,13 +96,17 @@ private:
            Memory is allocated only whilst the dialog is visible.
        */
        Params * params_;
+
+       /// is the dialog built ?
+       bool dialog_built_;
 };
 
 
 template <class Inset, class Params>
 ControlInset<Inset, Params>::ControlInset(LyXView & lv, Dialogs & d)
        : ControlConnectBD(lv, d),
-         inset_(0), ih_(0), params_(0)
+         inset_(0), ih_(0), params_(0), dialog_built_(false)
 {}
 
 
@@ -121,7 +125,7 @@ void ControlInset<Inset, Params>::createInset(string const & arg)
 {
        connectInset();
 
-       if ( !arg.empty() )
+       if (!arg.empty())
                bc().valid(); // so that the user can press Ok
 
        show(getParams(arg));
@@ -136,10 +140,9 @@ void ControlInset<Inset, Params>::show(Params const & params)
 
        setDaughterParams();
 
-       static bool isBuilt = false;
-       if (!isBuilt) {
-               isBuilt = true;
+       if (!dialog_built_) {
                view().build();
+               dialog_built_ = true;
        }
 
        bc().readOnly(isReadonly());
@@ -175,10 +178,6 @@ void ControlInset<Inset, Params>::update()
                params_ = new Params();
 
        bc().readOnly(isReadonly());
-       // Reset the Button Controller to it's initial state
-       bc().invalid();
-       bc().restore();
-
        view().update();
 }
 
index c46bec48428bd50979faaa2cd26505cb2ff89728..3f075ff3d0c34fa637b16d241a69f8b6d23bfa7c 100644 (file)
@@ -159,11 +159,11 @@ class ControlExternal;
 
 template <class GUIview, class GUIbc>
 class GUIExternal :
-       public GUI<ControlExternal, GUIview, OkCancelReadOnlyPolicy, GUIbc> {
+       public GUI<ControlExternal, GUIview, OkApplyCancelReadOnlyPolicy, GUIbc> {
 public:
        ///
        GUIExternal(LyXView & lv, Dialogs & d)
-               : GUI<ControlExternal, GUIview, OkCancelReadOnlyPolicy, GUIbc>(lv, d) {}
+               : GUI<ControlExternal, GUIview, OkApplyCancelReadOnlyPolicy, GUIbc>(lv, d) {}
 };