From 6da75c9cd889e2635bb748d6247d01220c4f8ab1 Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Tue, 28 Aug 2001 12:24:03 +0000 Subject: [PATCH] John's controller patch git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2605 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/controllers/ButtonController.h | 3 +++ .../controllers/ButtonControllerBase.C | 4 ++++ src/frontends/controllers/ButtonPolicies.C | 5 +++++ src/frontends/controllers/ChangeLog | 16 ++++++++++++++-- src/frontends/controllers/ControlDialogs.h | 15 +++++++-------- src/frontends/controllers/ControlInset.h | 17 ++++++++--------- src/frontends/controllers/GUI.h | 4 ++-- 7 files changed, 43 insertions(+), 21 deletions(-) diff --git a/src/frontends/controllers/ButtonController.h b/src/frontends/controllers/ButtonController.h index 62e9d18974..dee049628c 100644 --- a/src/frontends/controllers/ButtonController.h +++ b/src/frontends/controllers/ButtonController.h @@ -21,6 +21,7 @@ #include "gettext.h" #include "ButtonControllerBase.h" +#include "debug.h" template class GuiBC : public ButtonControllerBase @@ -75,6 +76,8 @@ GuiBC::GuiBC(string const & cancel, string const & close) template void GuiBC::refresh() { + lyxerr[Debug::GUI] << "Calling BC refresh()" << std::endl; + if (okay_) { bool const enabled = bp().buttonStatus(ButtonPolicy::OKAY); setButtonEnabled(okay_, enabled); diff --git a/src/frontends/controllers/ButtonControllerBase.C b/src/frontends/controllers/ButtonControllerBase.C index a7898f1ca6..551c26e5a1 100644 --- a/src/frontends/controllers/ButtonControllerBase.C +++ b/src/frontends/controllers/ButtonControllerBase.C @@ -18,6 +18,7 @@ #include #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; } diff --git a/src/frontends/controllers/ButtonPolicies.C b/src/frontends/controllers/ButtonPolicies.C index 67c970e5d4..a1510d6327 100644 --- a/src/frontends/controllers/ButtonPolicies.C +++ b/src/frontends/controllers/ButtonPolicies.C @@ -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 { diff --git a/src/frontends/controllers/ChangeLog b/src/frontends/controllers/ChangeLog index 1ee0085858..081ba5d661 100644 --- a/src/frontends/controllers/ChangeLog +++ b/src/frontends/controllers/ChangeLog @@ -1,7 +1,19 @@ -2001-08-26 John Levon +2001-08-25 John Levon - * 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 * ControlInset.h (apply): tentative fix for the press Apply multiple diff --git a/src/frontends/controllers/ControlDialogs.h b/src/frontends/controllers/ControlDialogs.h index 65d87f3101..049c4ef64c 100644 --- a/src/frontends/controllers/ControlDialogs.h +++ b/src/frontends/controllers/ControlDialogs.h @@ -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 ControlDialog::ControlDialog(LyXView & lv, Dialogs & d) - : Base(lv, d) + : Base(lv, d), dialog_built_(false) {} @@ -64,10 +68,9 @@ void ControlDialog::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::update() setParams(); bc().readOnly(isReadonly()); - // Reset the Button Controller to it's initial state - bc().invalid(); - bc().restore(); - view().update(); } diff --git a/src/frontends/controllers/ControlInset.h b/src/frontends/controllers/ControlInset.h index 9b9209f932..fa16d78123 100644 --- a/src/frontends/controllers/ControlInset.h +++ b/src/frontends/controllers/ControlInset.h @@ -96,13 +96,17 @@ private: Memory is allocated only whilst the dialog is visible. */ Params * params_; + + /// is the dialog built ? + bool dialog_built_; + }; template ControlInset::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::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::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::update() params_ = new Params(); bc().readOnly(isReadonly()); - // Reset the Button Controller to it's initial state - bc().invalid(); - bc().restore(); - view().update(); } diff --git a/src/frontends/controllers/GUI.h b/src/frontends/controllers/GUI.h index c46bec4842..3f075ff3d0 100644 --- a/src/frontends/controllers/GUI.h +++ b/src/frontends/controllers/GUI.h @@ -159,11 +159,11 @@ class ControlExternal; template class GUIExternal : - public GUI { + public GUI { public: /// GUIExternal(LyXView & lv, Dialogs & d) - : GUI(lv, d) {} + : GUI(lv, d) {} }; -- 2.39.2