mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-05 13:26:21 +00:00
John's controller patch
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2605 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
786cc35da8
commit
6da75c9cd8
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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) {}
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user