Flatten the ButtonController tree by splitting it into a Controller and

a View.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6410 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2003-03-10 03:13:28 +00:00
parent ce20b638ed
commit ba9cdda813
117 changed files with 1085 additions and 946 deletions

View File

@ -13,7 +13,6 @@
#include "Dialogs.h" #include "Dialogs.h"
#include "controllers/Dialog.h" #include "controllers/Dialog.h"
#include "controllers/ButtonControllerBase.h"
#include <boost/bind.hpp> #include <boost/bind.hpp>

View File

@ -0,0 +1,52 @@
/**
* \file BCView.C
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Angus Leeming
*
* Full author contact details are available in file CREDITS
*/
#include <config.h>
#include "BCView.h"
#include "ButtonController.h"
CheckedWidget::~CheckedWidget()
{}
BCView::BCView(ButtonController const & p)
: parent(p)
{}
ButtonPolicy & BCView::bp() const
{
return parent.bp();
}
void BCView::addCheckedWidget(CheckedWidget * ptr)
{
if (ptr)
checked_widgets.push_back(checked_widget_ptr(ptr));
}
bool BCView::checkWidgets()
{
bool valid = true;
checked_widget_list::const_iterator it = checked_widgets.begin();
checked_widget_list::const_iterator end = checked_widgets.end();
for (; it != end; ++it) {
valid &= (*it)->check();
}
// return valid status after checking ALL widgets
return valid;
}

View File

@ -0,0 +1,114 @@
// -*- C++ -*-
/**
* \file BCView.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Allan Rae
* \author Angus Leeming
* \author Baruch Even
*
* Full author contact details are available in file CREDITS
*/
#ifndef BCVIEW_H
#define BCVIEW_H
#include "LString.h"
#include <boost/shared_ptr.hpp>
#include <list>
class ButtonController;
class ButtonPolicy;
struct CheckedWidget {
///
virtual ~CheckedWidget();
/** Returns true if the widget is in a valid state.
* Might also change the visual appearance of the widget,
* to reflect this state.
*/
virtual bool check() const = 0;
};
class BCView {
public:
BCView(ButtonController const &);
///
virtual ~BCView() {}
///
virtual void refresh() = 0;
///
virtual void refreshReadOnly() = 0;
///
ButtonPolicy & bp() const;
///
void addCheckedWidget(CheckedWidget * ptr);
protected:
///
bool checkWidgets();
private:
///
typedef boost::shared_ptr<CheckedWidget> checked_widget_ptr;
typedef std::list<checked_widget_ptr> checked_widget_list;
///
checked_widget_list checked_widgets;
///
ButtonController const & parent;
};
/** A templatised instantiation of the ButtonController's View requiring the
* gui-frontend widgets.
*/
template <class Button, class Widget>
class GuiBC : public BCView {
public:
///
GuiBC(ButtonController const & parent,
string const & cancel, string const & close);
///
void setOK(Button * obj) { okay_ = obj; }
///
void setApply(Button * obj) { apply_ = obj; }
///
void setCancel(Button * obj) { cancel_ = obj; }
///
void setRestore(Button * obj) { restore_ = obj; }
///
void addReadOnly(Widget * obj) { read_only_.push_back(obj); }
///
void eraseReadOnly() { read_only_.clear(); }
/// Refresh the status of the Ok, Apply, Restore, Cancel buttons.
void refresh();
/// Refresh the status of any widgets in the read_only list
void refreshReadOnly();
private:
/// Enable/Disable a widget
virtual void setWidgetEnabled(Widget * obj, bool enable) = 0;
/// Enable/Disable a button
virtual void setButtonEnabled(Button * obj, bool enable) = 0;
/// Set the Label on the button
virtual void setButtonLabel(Button * obj, string const & label) = 0;
string cancel_label_;
string close_label_;
Button * okay_;
Button * apply_;
Button * cancel_;
Button * restore_;
typedef std::list<Widget *> Widgets;
Widgets read_only_;
};
#include "BCView.tmpl"
#endif // BCVIEW_H

View File

@ -15,12 +15,15 @@
* see, e.g., xforms/xformsBC.C * see, e.g., xforms/xformsBC.C
*/ */
#include "ButtonController.h" #include "BCView.h"
#include "ButtonPolicies.h"
#include "debug.h" #include "debug.h"
template <class Button, class Widget> template <class Button, class Widget>
GuiBC<Button, Widget>::GuiBC(string const & cancel, string const & close) GuiBC<Button, Widget>::GuiBC(ButtonController const & parent,
: ButtonControllerBase(cancel, close), string const & cancel, string const & close)
: BCView(parent),
cancel_label_(cancel), close_label_(close),
okay_(0), apply_(0), cancel_(0), restore_(0) okay_(0), apply_(0), cancel_(0), restore_(0)
{} {}
@ -70,10 +73,3 @@ void GuiBC<Button, Widget>::refreshReadOnly()
setWidgetEnabled(*iter, enable); setWidgetEnabled(*iter, enable);
} }
} }
template <class BP, class GUIBC>
ButtonController<BP, GUIBC>::ButtonController(string const & cancel,
string const & close)
: GUIBC(cancel, close)
{}

View File

@ -0,0 +1,132 @@
/**
* \file ButtonController.C
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Allan Rae
*
* Full author contact details are available in file CREDITS
*/
#include <config.h>
#include "ButtonController.h"
#include "BCView.h"
#include "support/LAssert.h"
#include "debug.h"
ButtonController::~ButtonController()
{}
BCView & ButtonController::view() const
{
lyx::Assert(view_.get());
return *view_.get();
}
void ButtonController::view(BCView * view)
{
view_.reset(view);
}
ButtonPolicy & ButtonController::bp() const
{
lyx::Assert(bp_.get());
return *bp_.get();
}
void ButtonController::bp(ButtonPolicy * bp)
{
bp_.reset(bp);
}
void ButtonController::refresh()
{
view().refresh();
}
void ButtonController::refreshReadOnly()
{
view().refreshReadOnly();
}
void ButtonController::ok()
{
input(ButtonPolicy::SMI_OKAY);
}
void ButtonController::input(ButtonPolicy::SMInput in)
{
if (ButtonPolicy::SMI_NOOP == in)
return;
bp().input(in);
view().refresh();
}
void ButtonController::apply()
{
input(ButtonPolicy::SMI_APPLY);
}
void ButtonController::cancel()
{
input(ButtonPolicy::SMI_CANCEL);
}
void ButtonController::restore()
{
input(ButtonPolicy::SMI_RESTORE);
}
void ButtonController::hide()
{
input(ButtonPolicy::SMI_HIDE);
}
void ButtonController::valid(bool v)
{
if (v) {
input(ButtonPolicy::SMI_VALID);
} else {
input(ButtonPolicy::SMI_INVALID);
}
}
void ButtonController::invalid()
{
input(ButtonPolicy::SMI_INVALID);
}
bool ButtonController::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);
}
view().refreshReadOnly();
view().refresh();
return ro;
}
void ButtonController::readWrite()
{
readOnly(false);
}

View File

@ -5,8 +5,6 @@
* Licence details can be found in the file COPYING. * Licence details can be found in the file COPYING.
* *
* \author Allan Rae * \author Allan Rae
* \author Angus Leeming
* \author Baruch Even
* *
* Full author contact details are available in file CREDITS * Full author contact details are available in file CREDITS
*/ */
@ -15,72 +13,71 @@
#define BUTTONCONTROLLER_H #define BUTTONCONTROLLER_H
#include "ButtonControllerBase.h" #include "ButtonPolicies.h"
#include "gettext.h"
#include <list>
/** A templatised instantiation of the ButtonController requiring the #include "LString.h"
* gui-frontend widgets. #include <boost/scoped_ptr.hpp>
* The template declarations are in ButtonController.tmpl, which should
* be #included in the gui-frontend BC class, see e.g. xforms/xformsBC.C
/** Controls the activation of the OK, Apply and Cancel buttons.
*
* Actually supports 4 buttons in all and it's up to the user to decide on
* the activation policy and which buttons correspond to which output of the
* state machine.
* Author: Allan Rae <rae@lyx.org>.
* This class stripped of xforms-specific code by
* Angus Leeming <leeming@lyx.org>
*/ */
template <class Button, class Widget> class BCView;
class GuiBC : public ButtonControllerBase {
class ButtonController : boost::noncopyable {
public: public:
/// ///
GuiBC(string const & cancel, string const & close); ~ButtonController();
/// ///
void setOK(Button * obj) { okay_ = obj; } BCView & view() const;
/// ///
void setApply(Button * obj) { apply_ = obj; } void view(BCView *);
///
void setCancel(Button * obj) { cancel_ = obj; }
///
void setRestore(Button * obj) { restore_ = obj; }
///
void addReadOnly(Widget * obj) { read_only_.push_back(obj); }
///
void eraseReadOnly() { read_only_.clear(); }
/// Refresh the status of the Ok, Apply, Restore, Cancel buttons. ///
ButtonPolicy & bp() const;
///
void bp(ButtonPolicy *);
///
void input(ButtonPolicy::SMInput);
///
void ok();
///
void apply();
///
void cancel();
///
void restore();
///
void hide();
///
void refresh(); void refresh();
/// Refresh the status of any widgets in the read_only list ///
void refreshReadOnly(); void refreshReadOnly();
/// Passthrough function -- returns its input value
bool readOnly(bool = true);
///
void readWrite();
///
void valid(bool = true);
///
void invalid();
private: private:
/// Enable/Disable a widget ///
virtual void setWidgetEnabled(Widget * obj, bool enable) = 0; boost::scoped_ptr<ButtonPolicy> bp_;
/// Enable/Disable a button ///
virtual void setButtonEnabled(Button * obj, bool enable) = 0; boost::scoped_ptr<BCView> view_;
/// Set the Label on the button
virtual void setButtonLabel(Button * obj, string const & label) = 0;
Button * okay_;
Button * apply_;
Button * cancel_;
Button * restore_;
typedef std::list<Widget *> Widgets;
Widgets read_only_;
}; };
template <class BP, class GUIBC>
class ButtonController: public GUIBC {
public:
///
ButtonController(string const & = _("Cancel"),
string const & = _("Close"));
///
~ButtonController() {}
///
virtual ButtonPolicy & bp() { return bp_; }
protected:
///
BP bp_;
};
#include "ButtonController.tmpl"
#endif // BUTTONCONTROLLER_H #endif // BUTTONCONTROLLER_H

View File

@ -1,124 +0,0 @@
/**
* \file ButtonControllerBase.C
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Allan Rae
*
* Full author contact details are available in file CREDITS
*/
#include <config.h>
#include "ButtonControllerBase.h"
#include "support/LAssert.h"
#include "debug.h"
CheckedWidget::~CheckedWidget()
{}
ButtonControllerBase::ButtonControllerBase(string const & cancel,
string const & close)
: cancel_label_(cancel), close_label_(close)
{}
void ButtonControllerBase::ok()
{
input(ButtonPolicy::SMI_OKAY);
}
void ButtonControllerBase::input(ButtonPolicy::SMInput in)
{
if (ButtonPolicy::SMI_NOOP == in)
return;
bp().input(in);
refresh();
}
void ButtonControllerBase::apply()
{
input(ButtonPolicy::SMI_APPLY);
}
void ButtonControllerBase::cancel()
{
input(ButtonPolicy::SMI_CANCEL);
}
void ButtonControllerBase::restore()
{
input(ButtonPolicy::SMI_RESTORE);
}
void ButtonControllerBase::hide()
{
input(ButtonPolicy::SMI_HIDE);
}
void ButtonControllerBase::valid(bool v)
{
if (v) {
input(ButtonPolicy::SMI_VALID);
} else {
input(ButtonPolicy::SMI_INVALID);
}
}
void ButtonControllerBase::invalid()
{
input(ButtonPolicy::SMI_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;
}
void ButtonControllerBase::readWrite()
{
readOnly(false);
}
void ButtonControllerBase::addCheckedWidget(CheckedWidget * ptr)
{
if (ptr)
checked_widgets.push_back(checked_widget_ptr(ptr));
}
bool ButtonControllerBase::checkWidgets()
{
bool valid = true;
checked_widget_list::const_iterator it = checked_widgets.begin();
checked_widget_list::const_iterator end = checked_widgets.end();
for (; it != end; ++it) {
valid &= (*it)->check();
}
// return valid status after checking ALL widgets
return valid;
}

View File

@ -1,103 +0,0 @@
// -*- C++ -*-
/**
* \file ButtonControllerBase.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Allan Rae
*
* Full author contact details are available in file CREDITS
*/
#ifndef BUTTONCONTROLLERBASE_H
#define BUTTONCONTROLLERBASE_H
#include "ButtonPolicies.h"
#include "LString.h"
#include <boost/shared_ptr.hpp>
#include <list>
struct CheckedWidget {
///
virtual ~CheckedWidget();
/** Returns true if the widget is in a valid state.
* Might also change the visual appearance of the widget,
* to reflect this state.
*/
virtual bool check() const = 0;
};
/** Abstract base class for a ButtonController
* Controls the activation of the OK, Apply and Cancel buttons.
* Actually supports 4 buttons in all and it's up to the user to decide on
* the activation policy and which buttons correspond to which output of the
* state machine.
* Author: Allan Rae <rae@lyx.org>.
* This abstract base class stripped of xforms-specific code by
* Angus Leeming <leeming@lyx.org>
*/
class ButtonControllerBase : boost::noncopyable {
public:
/** Constructor.
The cancel/close label entries are _not_ managed within the class
thereby allowing you to reassign at will and to use static labels.
It also means if you really don't want to have the Cancel button
label be different when there is nothing changed in the dialog then
you can just assign "Cancel" to both labels. Or even reuse this
class for something completely different.
*/
ButtonControllerBase(string const & cancel, string const & close);
///
virtual ~ButtonControllerBase() {}
///
virtual ButtonPolicy & bp() = 0;
///
virtual void input(ButtonPolicy::SMInput);
///
void ok();
///
void apply();
///
void cancel();
///
void restore();
///
void hide();
///
virtual void refresh() = 0;
///
virtual void refreshReadOnly() = 0;
/// Passthrough function -- returns its input value
bool readOnly(bool = true);
///
void readWrite();
///
void valid(bool = true);
///
void invalid();
///
void addCheckedWidget(CheckedWidget * ptr);
protected:
///
string cancel_label_;
///
string close_label_;
///
bool checkWidgets();
private:
///
typedef boost::shared_ptr<CheckedWidget> checked_widget_ptr;
typedef std::list<checked_widget_ptr> checked_widget_list;
///
checked_widget_list checked_widgets;
};
#endif // BUTTONCONTROLLERBASE_H

View File

@ -1,3 +1,16 @@
2003-03-09 Angus Leeming <leeming@lyx.org>
Flatten the ButtonController tree by splitting it into a Controller
and a View.
* BCView.[Ch], BCView.tmpl: new files containing the View part of the
ButtonController.
* ButtonController.[Ch]: just the controller, which needs know only
two methods of the View, refresh and refreshReadOnly.
* lots of files: associated changes.
2003-03-09 Angus Leeming <leeming@lyx.org> 2003-03-09 Angus Leeming <leeming@lyx.org>
* ControlChanges.[Ch]: rewrite to use the Dialog-based scheme. * ControlChanges.[Ch]: rewrite to use the Dialog-based scheme.

View File

@ -12,14 +12,20 @@
#include "ControlButtons.h" #include "ControlButtons.h"
#include "ButtonControllerBase.h" #include "ButtonController.h"
#include "BCView.h"
#include "ViewBase.h" #include "ViewBase.h"
#include "lyxrc.h" #include "lyxrc.h"
#include "support/LAssert.h" #include "support/LAssert.h"
ControlButtons::ControlButtons() ControlButtons::ControlButtons()
: emergency_exit_(false), is_closing_(false), bc_ptr_(0), view_ptr_(0) : emergency_exit_(false), is_closing_(false),
bc_ptr_(new ButtonController), view_ptr_(0)
{}
ControlButtons::~ControlButtons()
{} {}
@ -60,10 +66,10 @@ bool ControlButtons::IconifyWithMain() const
} }
ButtonControllerBase & ControlButtons::bc() ButtonController & ControlButtons::bc()
{ {
lyx::Assert(bc_ptr_); lyx::Assert(bc_ptr_.get());
return *bc_ptr_; return *bc_ptr_.get();
} }
@ -78,9 +84,3 @@ void ControlButtons::setView(ViewBase & v)
{ {
view_ptr_ = &v; view_ptr_ = &v;
} }
void ControlButtons::setButtonController(ButtonControllerBase & bc)
{
bc_ptr_ = &bc;
}

View File

@ -28,9 +28,10 @@
#include <boost/utility.hpp> #include <boost/utility.hpp>
#include <boost/scoped_ptr.hpp>
class ViewBase; class ViewBase;
class ButtonControllerBase; class ButtonController;
/** Abstract base class for Controllers with a ButtonController. /** Abstract base class for Controllers with a ButtonController.
*/ */
@ -39,7 +40,7 @@ public:
/// ///
ControlButtons(); ControlButtons();
/// ///
virtual ~ControlButtons() {} virtual ~ControlButtons();
/** These functions are called by the view when the appropriate buttons /** These functions are called by the view when the appropriate buttons
* are pressed. * are pressed.
@ -57,12 +58,10 @@ public:
bool IconifyWithMain() const; bool IconifyWithMain() const;
/// ///
ButtonControllerBase & bc(); ButtonController & bc();
/// ///
void setView(ViewBase &); void setView(ViewBase &);
///
void setButtonController(ButtonControllerBase &);
/** When Applying it's useful to know whether the dialog is about /** When Applying it's useful to know whether the dialog is about
to close or not (no point refreshing the display for example). */ to close or not (no point refreshing the display for example). */
bool isClosing() const { return is_closing_; } bool isClosing() const { return is_closing_; }
@ -84,9 +83,9 @@ protected:
private: private:
/// ///
bool is_closing_; bool is_closing_;
/// We own neither of these pointers.
ButtonControllerBase * bc_ptr_;
/// ///
boost::scoped_ptr<ButtonController> bc_ptr_;
/// We do not own this pointer.
ViewBase * view_ptr_; ViewBase * view_ptr_;
}; };

View File

@ -17,7 +17,6 @@
#include "BufferView.h" #include "BufferView.h"
#include "funcrequest.h" #include "funcrequest.h"
#include "lyxfind.h" #include "lyxfind.h"
#include "lyxfunc.h"
#include "author.h" #include "author.h"
#include "support/lstrings.h" #include "support/lstrings.h"

View File

@ -14,7 +14,7 @@
#include "ControlCharacter.h" #include "ControlCharacter.h"
#include "ViewBase.h" #include "ViewBase.h"
#include "ButtonControllerBase.h" #include "ButtonController.h"
#include "buffer.h" #include "buffer.h"
#include "bufferview_funcs.h" // ToggleAndShow #include "bufferview_funcs.h" // ToggleAndShow

View File

@ -14,7 +14,7 @@
#include "ControlDialog.h" #include "ControlDialog.h"
#include "ButtonControllerBase.h" #include "ButtonController.h"
#include "ViewBase.h" #include "ViewBase.h"

View File

@ -29,6 +29,7 @@
#include "frontends/LyXView.h" #include "frontends/LyXView.h"
#include "frontends/Alert.h" #include "frontends/Alert.h"
#include "support/LAssert.h"
#include "support/lstrings.h" #include "support/lstrings.h"
#include "support/filetools.h" #include "support/filetools.h"

View File

@ -14,6 +14,8 @@
#include "ControlMath.h" #include "ControlMath.h"
#include "ViewBase.h" #include "ViewBase.h"
#include "BCView.h"
#include "debug.h" #include "debug.h"
#include "funcrequest.h" #include "funcrequest.h"
@ -50,12 +52,13 @@ void ControlMath::insertSymbol(string const & sym, bool bs) const
void ControlMath::addDaughter(void * key, ViewBase * v, void ControlMath::addDaughter(void * key, ViewBase * v,
ButtonControllerBase * bc) BCView * bcview, ButtonPolicy * bcpolicy)
{ {
if (daughters_.find(key) != daughters_.end()) if (daughters_.find(key) != daughters_.end())
return; return;
daughters_[key] = DaughterPtr(new GUIMathSub(lv_, d_, *this, v, bc)); daughters_[key] = DaughterPtr(new GUIMathSub(lv_, d_, *this,
v, bcview, bcpolicy));
} }
@ -104,12 +107,14 @@ void ControlMathSub::insertSymbol(string const & sym, bool bs) const
GUIMathSub::GUIMathSub(LyXView & lv, Dialogs & d, GUIMathSub::GUIMathSub(LyXView & lv, Dialogs & d,
ControlMath const & p, ControlMath const & p,
ViewBase * v, ViewBase * v,
ButtonControllerBase * bc) BCView * bcview,
: controller_(lv, d, p), bc_(bc), view_(v) ButtonPolicy * bcpolicy)
: controller_(lv, d, p), view_(v)
{ {
controller_.setView(*view_); controller_.setView(*view_);
controller_.setButtonController(*bc_);
view_->setController(controller_); view_->setController(controller_);
controller_.bc().view(bcview);
controller_.bc().bp(bcpolicy);
} }

View File

@ -18,7 +18,6 @@
#include "ControlDialog_impl.h" #include "ControlDialog_impl.h"
#include "ButtonController.h" #include "ButtonController.h"
#include "ButtonPolicies.h"
#include "LString.h" #include "LString.h"
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
@ -26,6 +25,7 @@
class GUIMathSub; class GUIMathSub;
class BCView;
class ControlMath : public ControlDialogBD { class ControlMath : public ControlDialogBD {
@ -39,7 +39,8 @@ public:
void insertSymbol(string const & sym, bool bs = true) const; void insertSymbol(string const & sym, bool bs = true) const;
/// ///
void addDaughter(void * key, ViewBase * v, ButtonControllerBase * bc); void addDaughter(void * key, ViewBase * v,
BCView * bc, ButtonPolicy * bcpolicy);
/// ///
void showDaughter(void *); void showDaughter(void *);
@ -86,7 +87,8 @@ public:
GUIMathSub(LyXView & lv, Dialogs & d, GUIMathSub(LyXView & lv, Dialogs & d,
ControlMath const & p, ControlMath const & p,
ViewBase * v, ViewBase * v,
ButtonControllerBase * bc); BCView * bcview,
ButtonPolicy * bcpolicy);
/// ///
ControlMathSub & controller() { return controller_; } ControlMathSub & controller() { return controller_; }
@ -94,7 +96,7 @@ private:
/// ///
ControlMathSub controller_; ControlMathSub controller_;
/// ///
boost::scoped_ptr<ButtonControllerBase> bc_; boost::scoped_ptr<ButtonController> bc_;
/// ///
boost::scoped_ptr<ViewBase> view_; boost::scoped_ptr<ViewBase> view_;
}; };

View File

@ -14,7 +14,7 @@
#include "ControlParagraph.h" #include "ControlParagraph.h"
#include "ButtonControllerBase.h" #include "ButtonController.h"
#include "ViewBase.h" #include "ViewBase.h"
#include "buffer.h" #include "buffer.h"

View File

@ -14,7 +14,7 @@
#include "ControlPrint.h" #include "ControlPrint.h"
#include "ViewBase.h" #include "ViewBase.h"
#include "ButtonControllerBase.h" #include "ButtonController.h"
#include "buffer.h" #include "buffer.h"
#include "gettext.h" #include "gettext.h"

View File

@ -13,7 +13,7 @@
#include "ControlVCLog.h" #include "ControlVCLog.h"
#include "ButtonControllerBase.h" #include "ButtonController.h"
#include "buffer.h" #include "buffer.h"
#include "lyxrc.h" #include "lyxrc.h"
#include "gettext.h" #include "gettext.h"

View File

@ -13,12 +13,18 @@
#include "Dialog.h" #include "Dialog.h"
#include "ButtonControllerBase.h" #include "ButtonController.h"
#include "BCView.h"
#include "support/LAssert.h" #include "support/LAssert.h"
Dialog::Dialog(LyXView & lv, string const & name) Dialog::Dialog(LyXView & lv, string const & name)
: is_closing_(false), kernel_(lv), name_(name) : is_closing_(false), kernel_(lv), name_(name),
bc_ptr_(new ButtonController)
{}
Dialog::~Dialog()
{} {}
@ -123,7 +129,7 @@ void Dialog::redraw()
} }
ButtonControllerBase & Dialog::bc() const ButtonController & Dialog::bc() const
{ {
lyx::Assert(bc_ptr_.get()); lyx::Assert(bc_ptr_.get());
return *bc_ptr_.get(); return *bc_ptr_.get();
@ -144,13 +150,6 @@ Dialog::View & Dialog::view() const
} }
void Dialog::setButtonController(ButtonControllerBase * bc)
{
lyx::Assert(bc && !bc_ptr_.get());
bc_ptr_.reset(bc);
}
void Dialog::setController(Controller * i) void Dialog::setController(Controller * i)
{ {
lyx::Assert(i && !controller_ptr_.get()); lyx::Assert(i && !controller_ptr_.get());

View File

@ -23,7 +23,7 @@
class LyXView; class LyXView;
class ButtonControllerBase; class ButtonController;
class Dialog : boost::noncopyable { class Dialog : boost::noncopyable {
@ -32,6 +32,8 @@ public:
* itself to the kernel. * itself to the kernel.
*/ */
Dialog(LyXView &, string const & name); Dialog(LyXView &, string const & name);
///
~Dialog();
/// ///
string const & name() const { return name_; } string const & name() const { return name_; }
@ -94,13 +96,11 @@ public:
void setController(Controller *); void setController(Controller *);
/// ///
void setView(View *); void setView(View *);
///
void setButtonController(ButtonControllerBase *);
/// ///
Controller & controller() const; Controller & controller() const;
/// ///
ButtonControllerBase & bc() const; ButtonController & bc() const;
/// ///
View & view() const; View & view() const;
//@} //@}
@ -116,7 +116,7 @@ private:
/// ///
string name_; string name_;
/// ///
boost::scoped_ptr<ButtonControllerBase> bc_ptr_; boost::scoped_ptr<ButtonController> bc_ptr_;
/// ///
boost::scoped_ptr<Controller> controller_ptr_; boost::scoped_ptr<Controller> controller_ptr_;
/// ///
@ -196,6 +196,11 @@ public:
/// ///
Controller const & getController() const { return p_.controller(); } Controller const & getController() const { return p_.controller(); }
///
ButtonController & bc() { return p_.bc(); }
///
ButtonController const & bc() const { return p_.bc(); }
protected: protected:
/// ///
Dialog & p_; Dialog & p_;

View File

@ -12,7 +12,7 @@
#ifndef GUI_H #ifndef GUI_H
#define GUI_H #define GUI_H
#include "ButtonController.h" #include "BCView.h"
#include <boost/utility.hpp> #include <boost/utility.hpp>
@ -32,8 +32,6 @@ private:
/// ///
Controller controller_; Controller controller_;
/// ///
ButtonController<Policy, GUIbc> bc_;
///
GUIview view_; GUIview view_;
}; };
@ -45,8 +43,9 @@ GUI<Controller, GUIview, Policy, GUIbc>::GUI(LyXView & lv, Dialogs & d)
view_() view_()
{ {
controller_.setView(view_); controller_.setView(view_);
controller_.setButtonController(bc_);
view_.setController(controller_); view_.setController(controller_);
controller_.bc().view(new GUIbc(controller_.bc()));
controller_.bc().bp(new Policy);
} }
#endif // GUI_H #endif // GUI_H

View File

@ -5,7 +5,7 @@ noinst_LTLIBRARIES = libcontrollers.la
INCLUDES = -I$(top_srcdir)/src \ INCLUDES = -I$(top_srcdir)/src \
$(BOOST_INCLUDES) $(BOOST_INCLUDES)
EXTRA_DIST = ButtonController.tmpl ControlDialog.tmpl EXTRA_DIST = BCView.tmpl ControlDialog.tmpl
libcontrollers_la_SOURCES= \ libcontrollers_la_SOURCES= \
Dialog.C \ Dialog.C \
@ -20,9 +20,10 @@ libcontrollers_la_SOURCES= \
frnt_lang.h \ frnt_lang.h \
tex_helpers.C \ tex_helpers.C \
tex_helpers.h \ tex_helpers.h \
BCView.h \
BCView.C \
ButtonController.C \
ButtonController.h \ ButtonController.h \
ButtonControllerBase.C \
ButtonControllerBase.h \
ButtonPolicies.C \ ButtonPolicies.C \
ButtonPolicies.h \ ButtonPolicies.h \
ControlAboutlyx.C \ ControlAboutlyx.C \
@ -102,6 +103,7 @@ libcontrollers_la_SOURCES= \
ControlWrap.h \ ControlWrap.h \
GUI.h \ GUI.h \
ViewBase.h \ ViewBase.h \
ViewBase.C \
helper_funcs.C \ helper_funcs.C \
helper_funcs.h helper_funcs.h

View File

@ -0,0 +1,46 @@
/**
* \file ViewBase.C
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Angus Leeming
*
* Full author contact details are available in file CREDITS
*/
#include <config.h>
#include "ViewBase.h"
#include "ControlButtons.h"
#include "support/LAssert.h"
ViewBase::ViewBase()
: controller_ptr_(0)
{}
void ViewBase::setController(ControlButtons & c)
{
controller_ptr_ = &c;
}
ControlButtons & ViewBase::getController()
{
lyx::Assert(controller_ptr_);
return *controller_ptr_;
}
ControlButtons const & ViewBase::getController() const
{
lyx::Assert(controller_ptr_);
return *controller_ptr_;
}
ButtonController & ViewBase::bc()
{
return getController().bc();
}

View File

@ -12,17 +12,15 @@
#ifndef VIEWBASE_H #ifndef VIEWBASE_H
#define VIEWBASE_H #define VIEWBASE_H
#include "support/LAssert.h" class ControlButtons;
class ButtonController;
#include <boost/utility.hpp> #include <boost/utility.hpp>
class ControlButtons;
class ViewBase : boost::noncopyable { class ViewBase : boost::noncopyable {
public: public:
/// ///
ViewBase() : controller_ptr_(0) {} ViewBase();
/// ///
virtual ~ViewBase() {} virtual ~ViewBase() {}
@ -50,22 +48,17 @@ public:
/** This should be set by the GUI class that owns both the controller /** This should be set by the GUI class that owns both the controller
* and the view * and the view
*/ */
void setController(ControlButtons & c) { controller_ptr_ = &c; } void setController(ControlButtons &);
/// ///
ControlButtons & getController() { ControlButtons & getController();
lyx::Assert(controller_ptr_);
return *controller_ptr_;
}
/// ///
ControlButtons const & getController() const { ControlButtons const & getController() const;
lyx::Assert(controller_ptr_); ///
return *controller_ptr_; ButtonController & bc();
}
protected: protected:
/// We don't own this. /// We don't own this.
ControlButtons * controller_ptr_; ControlButtons * controller_ptr_;
}; };
#endif // VIEWBASE_H #endif // VIEWBASE_H

View File

@ -1,3 +1,8 @@
2003-03-09 Angus Leeming <leeming@lyx.org>
* lots of files: changes associated with the clean-up of the
ButtonController.
2003-03-09 Angus Leeming <leeming@lyx.org> 2003-03-09 Angus Leeming <leeming@lyx.org>
* Dialogs.C: * Dialogs.C:

View File

@ -11,6 +11,7 @@
#include <config.h> #include <config.h>
#include "Dialogs_impl.h" #include "Dialogs_impl.h"
#include "ButtonController.h"
void Dialogs::init_pimpl() void Dialogs::init_pimpl()

View File

@ -78,18 +78,6 @@
#include "qt_helpers.h" #include "qt_helpers.h"
typedef ButtonController<OkCancelPolicy, Qt2BC>
OkCancelBC;
typedef ButtonController<OkCancelReadOnlyPolicy, Qt2BC>
OkCancelReadOnlyBC;
typedef ButtonController<OkApplyCancelReadOnlyPolicy, Qt2BC>
OkApplyCancelReadOnlyBC;
typedef ButtonController<NoRepeatedApplyReadOnlyPolicy, Qt2BC>
NoRepeatedApplyReadOnlyBC;
namespace { namespace {
char const * const dialognames[] = { "about", "bibitem", "bibtex", "changes", char const * const dialognames[] = { "about", "bibitem", "bibtex", "changes",
@ -127,91 +115,92 @@ Dialog * Dialogs::build(string const & name)
return 0; return 0;
Dialog * dialog = new Dialog(lyxview_, name); Dialog * dialog = new Dialog(lyxview_, name);
dialog->bc().view(new Qt2BC(dialog->bc()));
if (name == "about") { if (name == "about") {
dialog->setController(new ControlAboutlyx(*dialog)); dialog->setController(new ControlAboutlyx(*dialog));
dialog->setView(new QAbout(*dialog)); dialog->setView(new QAbout(*dialog));
dialog->setButtonController(new OkCancelBC); dialog->bc().bp(new OkCancelPolicy);
} else if (name == "bibitem") { } else if (name == "bibitem") {
dialog->setController(new ControlCommand(*dialog, name)); dialog->setController(new ControlCommand(*dialog, name));
dialog->setView(new QBibitem(*dialog)); dialog->setView(new QBibitem(*dialog));
dialog->setButtonController(new OkCancelReadOnlyBC); dialog->bc().bp(new OkCancelReadOnlyPolicy);
} else if (name == "bibtex") { } else if (name == "bibtex") {
dialog->setController(new ControlBibtex(*dialog)); dialog->setController(new ControlBibtex(*dialog));
dialog->setView(new QBibtex(*dialog)); dialog->setView(new QBibtex(*dialog));
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
} else if (name == "changes") { } else if (name == "changes") {
dialog->setController(new ControlChanges(*dialog)); dialog->setController(new ControlChanges(*dialog));
dialog->setView(new QChanges(*dialog)); dialog->setView(new QChanges(*dialog));
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
} else if (name == "citation") { } else if (name == "citation") {
dialog->setController(new ControlCitation(*dialog)); dialog->setController(new ControlCitation(*dialog));
dialog->setView(new QCitation(*dialog)); dialog->setView(new QCitation(*dialog));
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
} else if (name == "error") { } else if (name == "error") {
dialog->setController(new ControlError(*dialog)); dialog->setController(new ControlError(*dialog));
dialog->setView(new QError(*dialog)); dialog->setView(new QError(*dialog));
dialog->setButtonController(new OkCancelBC); dialog->bc().bp(new OkCancelPolicy);
} else if (name == "ert") { } else if (name == "ert") {
dialog->setController(new ControlERT(*dialog)); dialog->setController(new ControlERT(*dialog));
dialog->setView(new QERT(*dialog)); dialog->setView(new QERT(*dialog));
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
} else if (name == "external") { } else if (name == "external") {
dialog->setController(new ControlExternal(*dialog)); dialog->setController(new ControlExternal(*dialog));
dialog->setView(new QExternal(*dialog)); dialog->setView(new QExternal(*dialog));
dialog->setButtonController(new OkApplyCancelReadOnlyBC); dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
} else if (name == "float") { } else if (name == "float") {
dialog->setController(new ControlFloat(*dialog)); dialog->setController(new ControlFloat(*dialog));
dialog->setView(new QFloat(*dialog)); dialog->setView(new QFloat(*dialog));
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
} else if (name == "graphics") { } else if (name == "graphics") {
dialog->setController(new ControlGraphics(*dialog)); dialog->setController(new ControlGraphics(*dialog));
dialog->setView(new QGraphics(*dialog)); dialog->setView(new QGraphics(*dialog));
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
} else if (name == "include") { } else if (name == "include") {
dialog->setController(new ControlInclude(*dialog)); dialog->setController(new ControlInclude(*dialog));
dialog->setView(new QInclude(*dialog)); dialog->setView(new QInclude(*dialog));
dialog->setButtonController(new OkApplyCancelReadOnlyBC); dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
} else if (name == "index") { } else if (name == "index") {
dialog->setController(new ControlCommand(*dialog, name)); dialog->setController(new ControlCommand(*dialog, name));
dialog->setView(new QIndex(*dialog, dialog->setView(new QIndex(*dialog,
qt_("LyX: Insert Index Entry"), qt_("LyX: Insert Index Entry"),
qt_("&Keyword"))); qt_("&Keyword")));
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
} else if (name == "label") { } else if (name == "label") {
dialog->setController(new ControlCommand(*dialog, name)); dialog->setController(new ControlCommand(*dialog, name));
dialog->setView(new QIndex(*dialog, dialog->setView(new QIndex(*dialog,
qt_("LyX: Insert Label"), qt_("LyX: Insert Label"),
qt_("&Label"))); qt_("&Label")));
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
} else if (name == "minipage") { } else if (name == "minipage") {
dialog->setController(new ControlMinipage(*dialog)); dialog->setController(new ControlMinipage(*dialog));
dialog->setView(new QMinipage(*dialog)); dialog->setView(new QMinipage(*dialog));
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
} else if (name == "ref") { } else if (name == "ref") {
dialog->setController(new ControlRef(*dialog)); dialog->setController(new ControlRef(*dialog));
dialog->setView(new QRef(*dialog)); dialog->setView(new QRef(*dialog));
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
} else if (name == "tabular") { } else if (name == "tabular") {
dialog->setController(new ControlTabular(*dialog)); dialog->setController(new ControlTabular(*dialog));
dialog->setView(new QTabular(*dialog)); dialog->setView(new QTabular(*dialog));
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
} else if (name == "tabularcreate") { } else if (name == "tabularcreate") {
dialog->setController(new ControlTabularCreate(*dialog)); dialog->setController(new ControlTabularCreate(*dialog));
dialog->setView(new QTabularCreate(*dialog)); dialog->setView(new QTabularCreate(*dialog));
dialog->setButtonController(new OkApplyCancelReadOnlyBC); dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
} else if (name == "toc") { } else if (name == "toc") {
dialog->setController(new ControlToc(*dialog)); dialog->setController(new ControlToc(*dialog));
dialog->setView(new QToc(*dialog)); dialog->setView(new QToc(*dialog));
dialog->setButtonController(new OkCancelBC); dialog->bc().bp(new OkCancelPolicy);
} else if (name == "url") { } else if (name == "url") {
dialog->setController(new ControlCommand(*dialog, name)); dialog->setController(new ControlCommand(*dialog, name));
dialog->setView(new QURL(*dialog)); dialog->setView(new QURL(*dialog));
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
} else if (name == "wrap") { } else if (name == "wrap") {
dialog->setController(new ControlWrap(*dialog)); dialog->setController(new ControlWrap(*dialog));
dialog->setView(new QWrap(*dialog)); dialog->setView(new QWrap(*dialog));
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
} }
return dialog; return dialog;

View File

@ -16,7 +16,7 @@
#include "debug.h" #include "debug.h"
#include "qt_helpers.h" #include "qt_helpers.h"
#include "LyXView.h" #include "LyXView.h"
#include "ButtonControllerBase.h" #include "ButtonController.h"
#include "ControlAboutlyx.h" #include "ControlAboutlyx.h"
#include <qlabel.h> #include <qlabel.h>
@ -106,6 +106,6 @@ void QAbout::build_dialog()
dialog_->setMinimumSize(dialog_->sizeHint()); dialog_->setMinimumSize(dialog_->sizeHint());
// Manage the cancel/close button // Manage the cancel/close button
bc().setCancel(dialog_->closePB); bcview().setCancel(dialog_->closePB);
bc().refresh(); bc().refresh();
} }

View File

@ -37,10 +37,10 @@ void QBibitem::build_dialog()
{ {
dialog_.reset(new QBibitemDialog(this)); dialog_.reset(new QBibitemDialog(this));
bc().setOK(dialog_->okPB); bcview().setOK(dialog_->okPB);
bc().setCancel(dialog_->closePB); bcview().setCancel(dialog_->closePB);
bc().addReadOnly(dialog_->keyED); bcview().addReadOnly(dialog_->keyED);
bc().addReadOnly(dialog_->labelED); bcview().addReadOnly(dialog_->labelED);
} }

View File

@ -46,15 +46,15 @@ void QBibtex::build_dialog()
{ {
dialog_.reset(new QBibtexDialog(this)); dialog_.reset(new QBibtexDialog(this));
bc().setOK(dialog_->okPB); bcview().setOK(dialog_->okPB);
bc().setCancel(dialog_->closePB); bcview().setCancel(dialog_->closePB);
bc().addReadOnly(dialog_->databaseLB); bcview().addReadOnly(dialog_->databaseLB);
bc().addReadOnly(dialog_->databasePB); bcview().addReadOnly(dialog_->databasePB);
bc().addReadOnly(dialog_->stylePB); bcview().addReadOnly(dialog_->stylePB);
bc().addReadOnly(dialog_->styleCB); bcview().addReadOnly(dialog_->styleCB);
bc().addReadOnly(dialog_->bibtocCB); bcview().addReadOnly(dialog_->bibtocCB);
bc().addReadOnly(dialog_->databasePB); bcview().addReadOnly(dialog_->databasePB);
bc().addReadOnly(dialog_->deletePB); bcview().addReadOnly(dialog_->deletePB);
} }

View File

@ -33,9 +33,9 @@ void QChanges::build_dialog()
{ {
dialog_.reset(new QChangesDialog(this)); dialog_.reset(new QChangesDialog(this));
bc().setCancel(dialog_->closePB); bcview().setCancel(dialog_->closePB);
bc().addReadOnly(dialog_->acceptPB); bcview().addReadOnly(dialog_->acceptPB);
bc().addReadOnly(dialog_->rejectPB); bcview().addReadOnly(dialog_->rejectPB);
} }

View File

@ -80,18 +80,18 @@ void QCharacter::build_dialog()
dialog_->langCO->insertItem(toqstr(cit->first), -1); dialog_->langCO->insertItem(toqstr(cit->first), -1);
} }
bc().setOK(dialog_->okPB); bcview().setOK(dialog_->okPB);
bc().setApply(dialog_->applyPB); bcview().setApply(dialog_->applyPB);
bc().setCancel(dialog_->closePB); bcview().setCancel(dialog_->closePB);
bc().addReadOnly(dialog_->familyCO); bcview().addReadOnly(dialog_->familyCO);
bc().addReadOnly(dialog_->seriesCO); bcview().addReadOnly(dialog_->seriesCO);
bc().addReadOnly(dialog_->sizeCO); bcview().addReadOnly(dialog_->sizeCO);
bc().addReadOnly(dialog_->shapeCO); bcview().addReadOnly(dialog_->shapeCO);
bc().addReadOnly(dialog_->miscCO); bcview().addReadOnly(dialog_->miscCO);
bc().addReadOnly(dialog_->langCO); bcview().addReadOnly(dialog_->langCO);
bc().addReadOnly(dialog_->colorCO); bcview().addReadOnly(dialog_->colorCO);
bc().addReadOnly(dialog_->toggleallCB); bcview().addReadOnly(dialog_->toggleallCB);
bc().addReadOnly(dialog_->autoapplyCB); bcview().addReadOnly(dialog_->autoapplyCB);
} }

View File

@ -83,21 +83,21 @@ void QCitation::build_dialog()
dialog_->searchCaseCB->setChecked(false); dialog_->searchCaseCB->setChecked(false);
// Manage the ok, apply, restore and cancel/close buttons // Manage the ok, apply, restore and cancel/close buttons
bc().setOK(dialog_->okPB); bcview().setOK(dialog_->okPB);
bc().setApply(dialog_->applyPB); bcview().setApply(dialog_->applyPB);
bc().setCancel(dialog_->closePB); bcview().setCancel(dialog_->closePB);
bc().setRestore(dialog_->restorePB); bcview().setRestore(dialog_->restorePB);
bc().addReadOnly(dialog_->addPB); bcview().addReadOnly(dialog_->addPB);
bc().addReadOnly(dialog_->delPB); bcview().addReadOnly(dialog_->delPB);
bc().addReadOnly(dialog_->upPB); bcview().addReadOnly(dialog_->upPB);
bc().addReadOnly(dialog_->downPB); bcview().addReadOnly(dialog_->downPB);
bc().addReadOnly(dialog_->citationStyleCO); bcview().addReadOnly(dialog_->citationStyleCO);
bc().addReadOnly(dialog_->forceuppercaseCB); bcview().addReadOnly(dialog_->forceuppercaseCB);
bc().addReadOnly(dialog_->fulllistCB); bcview().addReadOnly(dialog_->fulllistCB);
// add when enabled ! // add when enabled !
//bc().addReadOnly(dialog_->textBeforeED); //bcview().addReadOnly(dialog_->textBeforeED);
bc().addReadOnly(dialog_->textAfterED); bcview().addReadOnly(dialog_->textAfterED);
} }

View File

@ -18,6 +18,7 @@
#include "QtLyXView.h" #include "QtLyXView.h"
#include "QDialogView.h" #include "QDialogView.h"
#include "Qt2BC.h" #include "Qt2BC.h"
#include "ButtonController.h"
#include "support/LAssert.h" #include "support/LAssert.h"
@ -26,9 +27,9 @@ QDialogView::QDialogView(Dialog & parent, QString const & t)
{} {}
Qt2BC & QDialogView::bc() Qt2BC & QDialogView::bcview()
{ {
return static_cast<Qt2BC &>(dialog().bc()); return static_cast<Qt2BC &>(dialog().bc().view());
} }

View File

@ -56,7 +56,7 @@ protected:
virtual bool isValid(); virtual bool isValid();
/// ///
Qt2BC & bc(); Qt2BC & bcview();
/// are we updating ? /// are we updating ?
bool updating_; bool updating_;

View File

@ -158,10 +158,10 @@ void QDocument::build_dialog()
dialog_->setMargins(0); dialog_->setMargins(0);
// Manage the restore, ok, apply, restore and cancel/close buttons // Manage the restore, ok, apply, restore and cancel/close buttons
bc().setOK(dialog_->okPB); bcview().setOK(dialog_->okPB);
bc().setApply(dialog_->applyPB); bcview().setApply(dialog_->applyPB);
bc().setCancel(dialog_->closePB); bcview().setCancel(dialog_->closePB);
bc().setRestore(dialog_->restorePB); bcview().setRestore(dialog_->restorePB);
} }

View File

@ -34,8 +34,8 @@ void QERT::build_dialog()
{ {
dialog_.reset(new QERTDialog(this)); dialog_.reset(new QERTDialog(this));
bc().setOK(dialog_->okPB); bcview().setOK(dialog_->okPB);
bc().setCancel(dialog_->closePB); bcview().setCancel(dialog_->closePB);
} }

View File

@ -34,7 +34,7 @@ void QError::build_dialog()
{ {
dialog_.reset(new QErrorDialog(this)); dialog_.reset(new QErrorDialog(this));
bc().setCancel(dialog_->closePB); bcview().setCancel(dialog_->closePB);
} }

View File

@ -38,12 +38,12 @@ void QExternal::build_dialog()
{ {
dialog_.reset(new QExternalDialog(this)); dialog_.reset(new QExternalDialog(this));
bc().setOK(dialog_->okPB); bcview().setOK(dialog_->okPB);
bc().setApply(dialog_->applyPB); bcview().setApply(dialog_->applyPB);
bc().setCancel(dialog_->closePB); bcview().setCancel(dialog_->closePB);
bc().addReadOnly(dialog_->externalCO); bcview().addReadOnly(dialog_->externalCO);
bc().addReadOnly(dialog_->fileED); bcview().addReadOnly(dialog_->fileED);
bc().addReadOnly(dialog_->browsePB); bcview().addReadOnly(dialog_->browsePB);
std::vector<string> templates(controller().getTemplates()); std::vector<string> templates(controller().getTemplates());

View File

@ -35,19 +35,19 @@ void QFloat::build_dialog()
{ {
dialog_.reset(new QFloatDialog(this)); dialog_.reset(new QFloatDialog(this));
bc().setCancel(dialog_->closePB); bcview().setCancel(dialog_->closePB);
bc().setApply(dialog_->applyPB); bcview().setApply(dialog_->applyPB);
bc().setOK(dialog_->okPB); bcview().setOK(dialog_->okPB);
bc().setRestore(dialog_->restorePB); bcview().setRestore(dialog_->restorePB);
bc().addReadOnly(dialog_->topCB); bcview().addReadOnly(dialog_->topCB);
bc().addReadOnly(dialog_->bottomCB); bcview().addReadOnly(dialog_->bottomCB);
bc().addReadOnly(dialog_->herepossiblyCB); bcview().addReadOnly(dialog_->herepossiblyCB);
bc().addReadOnly(dialog_->heredefinitelyCB); bcview().addReadOnly(dialog_->heredefinitelyCB);
bc().addReadOnly(dialog_->pageCB); bcview().addReadOnly(dialog_->pageCB);
bc().addReadOnly(dialog_->ignoreCB); bcview().addReadOnly(dialog_->ignoreCB);
bc().addReadOnly(dialog_->defaultsCB); bcview().addReadOnly(dialog_->defaultsCB);
bc().addReadOnly(dialog_->spanCB); bcview().addReadOnly(dialog_->spanCB);
} }

View File

@ -56,45 +56,45 @@ void QGraphics::build_dialog()
{ {
dialog_.reset(new QGraphicsDialog(this)); dialog_.reset(new QGraphicsDialog(this));
bc().setOK(dialog_->okPB); bcview().setOK(dialog_->okPB);
bc().setApply(dialog_->applyPB); bcview().setApply(dialog_->applyPB);
bc().setRestore(dialog_->restorePB); bcview().setRestore(dialog_->restorePB);
bc().setCancel(dialog_->closePB); bcview().setCancel(dialog_->closePB);
bc().addReadOnly(dialog_->rotateGB); bcview().addReadOnly(dialog_->rotateGB);
bc().addReadOnly(dialog_->latexoptions); bcview().addReadOnly(dialog_->latexoptions);
bc().addReadOnly(dialog_->subfigure); bcview().addReadOnly(dialog_->subfigure);
bc().addReadOnly(dialog_->subcaption); bcview().addReadOnly(dialog_->subcaption);
bc().addReadOnly(dialog_->filenameL); bcview().addReadOnly(dialog_->filenameL);
bc().addReadOnly(dialog_->filename); bcview().addReadOnly(dialog_->filename);
bc().addReadOnly(dialog_->browsePB); bcview().addReadOnly(dialog_->browsePB);
bc().addReadOnly(dialog_->unzipCB); bcview().addReadOnly(dialog_->unzipCB);
bc().addReadOnly(dialog_->filename); bcview().addReadOnly(dialog_->filename);
bc().addReadOnly(dialog_->lbX); bcview().addReadOnly(dialog_->lbX);
bc().addReadOnly(dialog_->lbY); bcview().addReadOnly(dialog_->lbY);
bc().addReadOnly(dialog_->rtX); bcview().addReadOnly(dialog_->rtX);
bc().addReadOnly(dialog_->rtY); bcview().addReadOnly(dialog_->rtY);
bc().addReadOnly(dialog_->lbXunit); bcview().addReadOnly(dialog_->lbXunit);
bc().addReadOnly(dialog_->lbYunit); bcview().addReadOnly(dialog_->lbYunit);
bc().addReadOnly(dialog_->rtXunit); bcview().addReadOnly(dialog_->rtXunit);
bc().addReadOnly(dialog_->rtYunit); bcview().addReadOnly(dialog_->rtYunit);
bc().addReadOnly(dialog_->draftCB); bcview().addReadOnly(dialog_->draftCB);
bc().addReadOnly(dialog_->clip); bcview().addReadOnly(dialog_->clip);
bc().addReadOnly(dialog_->unzipCB); bcview().addReadOnly(dialog_->unzipCB);
bc().addReadOnly(dialog_->subfigure); bcview().addReadOnly(dialog_->subfigure);
bc().addReadOnly(dialog_->subcaption); bcview().addReadOnly(dialog_->subcaption);
bc().addReadOnly(dialog_->showCB); bcview().addReadOnly(dialog_->showCB);
bc().addReadOnly(dialog_->width); bcview().addReadOnly(dialog_->width);
bc().addReadOnly(dialog_->height); bcview().addReadOnly(dialog_->height);
bc().addReadOnly(dialog_->displayCB); bcview().addReadOnly(dialog_->displayCB);
bc().addReadOnly(dialog_->displayscale); bcview().addReadOnly(dialog_->displayscale);
bc().addReadOnly(dialog_->widthUnit); bcview().addReadOnly(dialog_->widthUnit);
bc().addReadOnly(dialog_->heightUnit); bcview().addReadOnly(dialog_->heightUnit);
bc().addReadOnly(dialog_->aspectratio); bcview().addReadOnly(dialog_->aspectratio);
bc().addReadOnly(dialog_->angle); bcview().addReadOnly(dialog_->angle);
bc().addReadOnly(dialog_->origin); bcview().addReadOnly(dialog_->origin);
bc().addReadOnly(dialog_->latexoptions); bcview().addReadOnly(dialog_->latexoptions);
bc().addReadOnly(dialog_->getPB); bcview().addReadOnly(dialog_->getPB);
} }

View File

@ -37,12 +37,12 @@ void QInclude::build_dialog()
{ {
dialog_.reset(new QIncludeDialog(this)); dialog_.reset(new QIncludeDialog(this));
bc().setOK(dialog_->okPB); bcview().setOK(dialog_->okPB);
bc().setCancel(dialog_->closePB); bcview().setCancel(dialog_->closePB);
bc().addReadOnly(dialog_->filenameED); bcview().addReadOnly(dialog_->filenameED);
bc().addReadOnly(dialog_->browsePB); bcview().addReadOnly(dialog_->browsePB);
bc().addReadOnly(dialog_->visiblespaceCB); bcview().addReadOnly(dialog_->visiblespaceCB);
bc().addReadOnly(dialog_->typeCO); bcview().addReadOnly(dialog_->typeCO);
} }

View File

@ -17,6 +17,7 @@
#include "QIndexDialog.h" #include "QIndexDialog.h"
#include "QIndex.h" #include "QIndex.h"
#include "Qt2BC.h" #include "Qt2BC.h"
#include "ButtonController.h"
#include <qlabel.h> #include <qlabel.h>
#include <qlineedit.h> #include <qlineedit.h>
#include <qpushbutton.h> #include <qpushbutton.h>
@ -36,9 +37,9 @@ void QIndex::build_dialog()
dialog_->keywordLA->setText(label_); dialog_->keywordLA->setText(label_);
bc().setOK(dialog_->okPB); bcview().setOK(dialog_->okPB);
bc().setCancel(dialog_->closePB); bcview().setCancel(dialog_->closePB);
bc().addReadOnly(dialog_->keywordED); bcview().addReadOnly(dialog_->keywordED);
} }

View File

@ -40,7 +40,7 @@ void QLog::build_dialog()
{ {
dialog_.reset(new QLogDialog(this)); dialog_.reset(new QLogDialog(this));
bc().setCancel(dialog_->closePB); bcview().setCancel(dialog_->closePB);
} }

View File

@ -39,14 +39,14 @@ void QMinipage::build_dialog()
{ {
dialog_.reset(new QMinipageDialog(this)); dialog_.reset(new QMinipageDialog(this));
bc().setRestore(dialog_->restorePB); bcview().setRestore(dialog_->restorePB);
bc().setOK(dialog_->okPB); bcview().setOK(dialog_->okPB);
bc().setApply(dialog_->applyPB); bcview().setApply(dialog_->applyPB);
bc().setCancel(dialog_->closePB); bcview().setCancel(dialog_->closePB);
bc().addReadOnly(dialog_->widthED); bcview().addReadOnly(dialog_->widthED);
bc().addReadOnly(dialog_->unitsLC); bcview().addReadOnly(dialog_->unitsLC);
bc().addReadOnly(dialog_->valignCO); bcview().addReadOnly(dialog_->valignCO);
} }

View File

@ -67,11 +67,11 @@ void QParagraph::build_dialog()
} }
// Manage the ok, apply, restore and cancel/close buttons // Manage the ok, apply, restore and cancel/close buttons
bc().setOK(dialog_->okPB); bcview().setOK(dialog_->okPB);
bc().setApply(dialog_->applyPB); bcview().setApply(dialog_->applyPB);
bc().setCancel(dialog_->closePB); bcview().setCancel(dialog_->closePB);
bc().setRestore(dialog_->restorePB); bcview().setRestore(dialog_->restorePB);
bc().addReadOnly(dialog_->paragraphTab); bcview().addReadOnly(dialog_->paragraphTab);
} }

View File

@ -15,6 +15,7 @@
#include "Qt2Base.h" #include "Qt2Base.h"
#include "LString.h"
#include <vector> #include <vector>
class ControlParagraph; class ControlParagraph;

View File

@ -71,10 +71,10 @@ void QPrefs::build_dialog()
{ {
dialog_.reset(new QPrefsDialog(this)); dialog_.reset(new QPrefsDialog(this));
bc().setOK(dialog_->savePB); bcview().setOK(dialog_->savePB);
bc().setApply(dialog_->applyPB); bcview().setApply(dialog_->applyPB);
bc().setCancel(dialog_->closePB); bcview().setCancel(dialog_->closePB);
bc().setRestore(dialog_->restorePB); bcview().setRestore(dialog_->restorePB);
QPrefLanguageModule * langmod(dialog_->languageModule); QPrefLanguageModule * langmod(dialog_->languageModule);

View File

@ -42,8 +42,8 @@ void QPrint::build_dialog()
{ {
dialog_.reset(new QLPrintDialog(this)); dialog_.reset(new QLPrintDialog(this));
bc().setOK(dialog_->printPB); bcview().setOK(dialog_->printPB);
bc().setCancel(dialog_->closePB); bcview().setCancel(dialog_->closePB);
} }

View File

@ -49,15 +49,15 @@ void QRef::build_dialog()
{ {
dialog_.reset(new QRefDialog(this)); dialog_.reset(new QRefDialog(this));
bc().setOK(dialog_->okPB); bcview().setOK(dialog_->okPB);
bc().setApply(dialog_->applyPB); bcview().setApply(dialog_->applyPB);
bc().setCancel(dialog_->closePB); bcview().setCancel(dialog_->closePB);
bc().addReadOnly(dialog_->refsLB); bcview().addReadOnly(dialog_->refsLB);
bc().addReadOnly(dialog_->sortCB); bcview().addReadOnly(dialog_->sortCB);
bc().addReadOnly(dialog_->nameED); bcview().addReadOnly(dialog_->nameED);
bc().addReadOnly(dialog_->referenceED); bcview().addReadOnly(dialog_->referenceED);
bc().addReadOnly(dialog_->typeCO); bcview().addReadOnly(dialog_->typeCO);
bc().addReadOnly(dialog_->bufferCO); bcview().addReadOnly(dialog_->bufferCO);
} }

View File

@ -37,13 +37,13 @@ void QSearch::build_dialog()
{ {
dialog_.reset(new QSearchDialog(this)); dialog_.reset(new QSearchDialog(this));
bc().setCancel(dialog_->closePB); bcview().setCancel(dialog_->closePB);
bc().addReadOnly(dialog_->replaceCO); bcview().addReadOnly(dialog_->replaceCO);
bc().addReadOnly(dialog_->replacePB); bcview().addReadOnly(dialog_->replacePB);
bc().addReadOnly(dialog_->replaceallPB); bcview().addReadOnly(dialog_->replaceallPB);
bc().addReadOnly(dialog_->caseCB); bcview().addReadOnly(dialog_->caseCB);
bc().addReadOnly(dialog_->wordsCB); bcview().addReadOnly(dialog_->wordsCB);
bc().addReadOnly(dialog_->backwardsCB); bcview().addReadOnly(dialog_->backwardsCB);
dialog_->replacePB->setEnabled(false); dialog_->replacePB->setEnabled(false);
dialog_->replaceallPB->setEnabled(false); dialog_->replaceallPB->setEnabled(false);

View File

@ -41,9 +41,9 @@ void QSendto::build_dialog()
dialog_.reset(new QSendtoDialog(this)); dialog_.reset(new QSendtoDialog(this));
// Manage the ok, apply, restore and cancel/close buttons // Manage the ok, apply, restore and cancel/close buttons
bc().setOK(dialog_->okPB); bcview().setOK(dialog_->okPB);
bc().setApply(dialog_->applyPB); bcview().setApply(dialog_->applyPB);
bc().setCancel(dialog_->closePB); bcview().setCancel(dialog_->closePB);
} }

View File

@ -34,7 +34,7 @@ void QShowFile::build_dialog()
{ {
dialog_.reset(new QShowFileDialog(this)); dialog_.reset(new QShowFileDialog(this));
bc().setCancel(dialog_->closePB); bcview().setCancel(dialog_->closePB);
} }

View File

@ -38,7 +38,7 @@ void QSpellchecker::build_dialog()
{ {
dialog_.reset(new QSpellcheckerDialog(this)); dialog_.reset(new QSpellcheckerDialog(this));
bc().setCancel(dialog_->closePB); bcview().setCancel(dialog_->closePB);
dialog_->wordED->setReadOnly(true); dialog_->wordED->setReadOnly(true);
} }

View File

@ -22,6 +22,7 @@
#include "QTabularDialog.h" #include "QTabularDialog.h"
#include "QTabular.h" #include "QTabular.h"
#include "Qt2BC.h" #include "Qt2BC.h"
#include "ButtonController.h"
#include <qpushbutton.h> #include <qpushbutton.h>
#include <qlineedit.h> #include <qlineedit.h>
@ -41,39 +42,39 @@ void QTabular::build_dialog()
{ {
dialog_.reset(new QTabularDialog(this)); dialog_.reset(new QTabularDialog(this));
bc().setCancel(dialog_->closePB); bcview().setCancel(dialog_->closePB);
bc().addReadOnly(dialog_->multicolumnCB); bcview().addReadOnly(dialog_->multicolumnCB);
bc().addReadOnly(dialog_->rotateCellCB); bcview().addReadOnly(dialog_->rotateCellCB);
bc().addReadOnly(dialog_->rotateTabularCB); bcview().addReadOnly(dialog_->rotateTabularCB);
bc().addReadOnly(dialog_->specialAlignmentED); bcview().addReadOnly(dialog_->specialAlignmentED);
bc().addReadOnly(dialog_->widthED); bcview().addReadOnly(dialog_->widthED);
bc().addReadOnly(dialog_->widthUnit); bcview().addReadOnly(dialog_->widthUnit);
bc().addReadOnly(dialog_->hAlignCB); bcview().addReadOnly(dialog_->hAlignCB);
bc().addReadOnly(dialog_->vAlignCB); bcview().addReadOnly(dialog_->vAlignCB);
bc().addReadOnly(dialog_->columnAddPB); bcview().addReadOnly(dialog_->columnAddPB);
bc().addReadOnly(dialog_->columnDeletePB); bcview().addReadOnly(dialog_->columnDeletePB);
bc().addReadOnly(dialog_->rowAddPB); bcview().addReadOnly(dialog_->rowAddPB);
bc().addReadOnly(dialog_->rowDeletePB); bcview().addReadOnly(dialog_->rowDeletePB);
bc().addReadOnly(dialog_->borderSetPB); bcview().addReadOnly(dialog_->borderSetPB);
bc().addReadOnly(dialog_->borderUnsetPB); bcview().addReadOnly(dialog_->borderUnsetPB);
bc().addReadOnly(dialog_->borders); bcview().addReadOnly(dialog_->borders);
bc().addReadOnly(dialog_->longTabularCB); bcview().addReadOnly(dialog_->longTabularCB);
bc().addReadOnly(dialog_->headerStatusCB); bcview().addReadOnly(dialog_->headerStatusCB);
bc().addReadOnly(dialog_->headerBorderAboveCB); bcview().addReadOnly(dialog_->headerBorderAboveCB);
bc().addReadOnly(dialog_->headerBorderBelowCB); bcview().addReadOnly(dialog_->headerBorderBelowCB);
bc().addReadOnly(dialog_->firstheaderStatusCB); bcview().addReadOnly(dialog_->firstheaderStatusCB);
bc().addReadOnly(dialog_->firstheaderBorderAboveCB); bcview().addReadOnly(dialog_->firstheaderBorderAboveCB);
bc().addReadOnly(dialog_->firstheaderBorderBelowCB); bcview().addReadOnly(dialog_->firstheaderBorderBelowCB);
bc().addReadOnly(dialog_->firstheaderNoContentsCB); bcview().addReadOnly(dialog_->firstheaderNoContentsCB);
bc().addReadOnly(dialog_->footerStatusCB); bcview().addReadOnly(dialog_->footerStatusCB);
bc().addReadOnly(dialog_->footerBorderAboveCB); bcview().addReadOnly(dialog_->footerBorderAboveCB);
bc().addReadOnly(dialog_->footerBorderBelowCB); bcview().addReadOnly(dialog_->footerBorderBelowCB);
bc().addReadOnly(dialog_->lastfooterStatusCB); bcview().addReadOnly(dialog_->lastfooterStatusCB);
bc().addReadOnly(dialog_->lastfooterBorderAboveCB); bcview().addReadOnly(dialog_->lastfooterBorderAboveCB);
bc().addReadOnly(dialog_->lastfooterBorderBelowCB); bcview().addReadOnly(dialog_->lastfooterBorderBelowCB);
bc().addReadOnly(dialog_->lastfooterNoContentsCB); bcview().addReadOnly(dialog_->lastfooterNoContentsCB);
bc().addReadOnly(dialog_->newpageCB); bcview().addReadOnly(dialog_->newpageCB);
} }

View File

@ -34,8 +34,8 @@ void QTabularCreate::build_dialog()
{ {
dialog_.reset(new QTabularCreateDialog(this)); dialog_.reset(new QTabularCreateDialog(this));
bc().setOK(dialog_->okPB); bcview().setOK(dialog_->okPB);
bc().setCancel(dialog_->closePB); bcview().setCancel(dialog_->closePB);
} }

View File

@ -42,7 +42,7 @@ void QTexinfo::build_dialog()
updateStyles(ControlTexinfo::cls); updateStyles(ControlTexinfo::cls);
bc().setCancel(dialog_->closePB); bcview().setCancel(dialog_->closePB);
} }

View File

@ -34,10 +34,10 @@ void QThesaurus::build_dialog()
{ {
dialog_.reset(new QThesaurusDialog(this)); dialog_.reset(new QThesaurusDialog(this));
bc().setCancel(dialog_->closePB); bcview().setCancel(dialog_->closePB);
bc().setApply(dialog_->replacePB); bcview().setApply(dialog_->replacePB);
bc().addReadOnly(dialog_->replaceED); bcview().addReadOnly(dialog_->replaceED);
bc().addReadOnly(dialog_->replacePB); bcview().addReadOnly(dialog_->replacePB);
} }

View File

@ -45,7 +45,7 @@ void QToc::build_dialog()
dialog_.reset(new QTocDialog(this)); dialog_.reset(new QTocDialog(this));
// Manage the cancel/close button // Manage the cancel/close button
bc().setCancel(dialog_->closePB); bcview().setCancel(dialog_->closePB);
} }

View File

@ -17,6 +17,7 @@
#include "QURL.h" #include "QURL.h"
#include "QURLDialog.h" #include "QURLDialog.h"
#include "Qt2BC.h" #include "Qt2BC.h"
#include "ButtonController.h"
#include <qcheckbox.h> #include <qcheckbox.h>
#include <qpushbutton.h> #include <qpushbutton.h>
@ -34,11 +35,11 @@ void QURL::build_dialog()
{ {
dialog_.reset(new QURLDialog(this)); dialog_.reset(new QURLDialog(this));
bc().setOK(dialog_->okPB); bcview().setOK(dialog_->okPB);
bc().setCancel(dialog_->closePB); bcview().setCancel(dialog_->closePB);
bc().addReadOnly(dialog_->urlED); bcview().addReadOnly(dialog_->urlED);
bc().addReadOnly(dialog_->nameED); bcview().addReadOnly(dialog_->nameED);
bc().addReadOnly(dialog_->hyperlinkCB); bcview().addReadOnly(dialog_->hyperlinkCB);
} }

View File

@ -38,7 +38,7 @@ void QVCLog::build_dialog()
{ {
dialog_.reset(new QVCLogDialog(this)); dialog_.reset(new QVCLogDialog(this));
bc().setCancel(dialog_->closePB); bcview().setCancel(dialog_->closePB);
} }

View File

@ -41,14 +41,14 @@ void QWrap::build_dialog()
{ {
dialog_.reset(new QWrapDialog(this)); dialog_.reset(new QWrapDialog(this));
bc().setRestore(dialog_->restorePB); bcview().setRestore(dialog_->restorePB);
bc().setOK(dialog_->okPB); bcview().setOK(dialog_->okPB);
bc().setApply(dialog_->applyPB); bcview().setApply(dialog_->applyPB);
bc().setCancel(dialog_->closePB); bcview().setCancel(dialog_->closePB);
bc().addReadOnly(dialog_->widthED); bcview().addReadOnly(dialog_->widthED);
bc().addReadOnly(dialog_->unitsLC); bcview().addReadOnly(dialog_->unitsLC);
bc().addReadOnly(dialog_->valignCO); bcview().addReadOnly(dialog_->valignCO);
} }

View File

@ -11,7 +11,6 @@
#include <config.h> #include <config.h>
#include "Qt2BC.h" #include "Qt2BC.h"
#include "debug.h" #include "debug.h"
#include "qt_helpers.h" #include "qt_helpers.h"
@ -20,8 +19,9 @@
#include <qlineedit.h> #include <qlineedit.h>
Qt2BC::Qt2BC(string const & cancel, string const & close) Qt2BC::Qt2BC(ButtonController const & parent,
: GuiBC<QButton, QWidget>(cancel, close) string const & cancel, string const & close)
: GuiBC<QButton, QWidget>(parent, cancel, close)
{} {}

View File

@ -15,7 +15,8 @@
#define QT2BC_H #define QT2BC_H
#include "ButtonController.h" #include "BCView.h"
#include "gettext.h"
class QWidget; class QWidget;
class QButton; class QButton;
@ -29,7 +30,8 @@ class QButton;
class Qt2BC : public GuiBC<QButton, QWidget> { class Qt2BC : public GuiBC<QButton, QWidget> {
public: public:
/// ///
Qt2BC(string const &, string const &); Qt2BC(ButtonController const &,
string const & = _("Cancel"), string const & = _("Close"));
private: private:
/// Updates the button sensitivity (enabled/disabled) /// Updates the button sensitivity (enabled/disabled)
void setButtonEnabled(QButton *, bool enabled); void setButtonEnabled(QButton *, bool enabled);

View File

@ -17,6 +17,7 @@
#include "QtLyXView.h" #include "QtLyXView.h"
#include "Qt2Base.h" #include "Qt2Base.h"
#include "Qt2BC.h" #include "Qt2BC.h"
#include "ButtonController.h"
#include "ControlButtons.h" #include "ControlButtons.h"
#include "support/LAssert.h" #include "support/LAssert.h"
@ -26,10 +27,10 @@ Qt2Base::Qt2Base(QString const & t)
{} {}
Qt2BC & Qt2Base::bc() Qt2BC & Qt2Base::bcview()
{ {
return static_cast<Qt2BC &>(getController().bc()); return static_cast<Qt2BC &>(bc().view());
// return dynamic_cast<Qt2BC &>(getController().bc()); // return dynamic_cast<Qt2BC &>(bc());
} }

View File

@ -51,7 +51,7 @@ protected:
virtual bool isValid(); virtual bool isValid();
/// ///
Qt2BC & bc(); Qt2BC & bcview();
/// are we updating ? /// are we updating ?
bool updating_; bool updating_;

View File

@ -14,6 +14,7 @@
#include "ToolbarDefaults.h" #include "ToolbarDefaults.h"
#include "debug.h" #include "debug.h"
#include "gettext.h"
#include "lyxfunc.h" #include "lyxfunc.h"
#include "FuncStatus.h" #include "FuncStatus.h"
#include "BufferView.h" #include "BufferView.h"

View File

@ -1,3 +1,8 @@
2003-03-09 Angus Leeming <leeming@lyx.org>
* lots of files: changes associated with the clean-up of the
ButtonController.
2003-03-09 Angus Leeming <leeming@lyx.org> 2003-03-09 Angus Leeming <leeming@lyx.org>
* Dialogs.C: * Dialogs.C:

View File

@ -11,6 +11,7 @@
#include <config.h> #include <config.h>
#include "Dialogs_impl.h" #include "Dialogs_impl.h"
#include "ButtonController.h"
void Dialogs::init_pimpl() void Dialogs::init_pimpl()

View File

@ -76,19 +76,6 @@
#include "ButtonController.h" #include "ButtonController.h"
typedef ButtonController<OkCancelPolicy, xformsBC>
OkCancelBC;
typedef ButtonController<OkCancelReadOnlyPolicy, xformsBC>
OkCancelReadOnlyBC;
typedef ButtonController<OkApplyCancelReadOnlyPolicy, xformsBC>
OkApplyCancelReadOnlyBC;
typedef ButtonController<NoRepeatedApplyReadOnlyPolicy, xformsBC>
NoRepeatedApplyReadOnlyBC;
namespace { namespace {
char const * const dialognames[] = { "about", "bibitem", "bibtex", "citation", char const * const dialognames[] = { "about", "bibitem", "bibtex", "citation",
@ -127,89 +114,90 @@ Dialog * Dialogs::build(string const & name)
return 0; return 0;
Dialog * dialog = new Dialog(lyxview_, name); Dialog * dialog = new Dialog(lyxview_, name);
dialog->bc().view(new xformsBC(dialog->bc()));
if (name == "about") { if (name == "about") {
dialog->setController(new ControlAboutlyx(*dialog)); dialog->setController(new ControlAboutlyx(*dialog));
dialog->setView(new FormAboutlyx(*dialog)); dialog->setView(new FormAboutlyx(*dialog));
dialog->setButtonController(new OkCancelBC); dialog->bc().bp(new OkCancelPolicy);
} else if (name == "bibitem") { } else if (name == "bibitem") {
dialog->setController(new ControlCommand(*dialog, name)); dialog->setController(new ControlCommand(*dialog, name));
dialog->setView(new FormBibitem(*dialog)); dialog->setView(new FormBibitem(*dialog));
dialog->setButtonController(new OkCancelReadOnlyBC); dialog->bc().bp(new OkCancelReadOnlyPolicy);
} else if (name == "bibtex") { } else if (name == "bibtex") {
dialog->setController(new ControlBibtex(*dialog)); dialog->setController(new ControlBibtex(*dialog));
dialog->setView(new FormBibtex(*dialog)); dialog->setView(new FormBibtex(*dialog));
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
} else if (name == "changes") { } else if (name == "changes") {
dialog->setController(new ControlChanges(*dialog)); dialog->setController(new ControlChanges(*dialog));
dialog->setView(new FormChanges(*dialog)); dialog->setView(new FormChanges(*dialog));
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
} else if (name == "citation") { } else if (name == "citation") {
dialog->setController(new ControlCitation(*dialog)); dialog->setController(new ControlCitation(*dialog));
dialog->setView(new FormCitation(*dialog)); dialog->setView(new FormCitation(*dialog));
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
} else if (name == "error") { } else if (name == "error") {
dialog->setController(new ControlError(*dialog)); dialog->setController(new ControlError(*dialog));
dialog->setView(new FormError(*dialog)); dialog->setView(new FormError(*dialog));
dialog->setButtonController(new OkCancelBC); dialog->bc().bp(new OkCancelPolicy);
} else if (name == "ert") { } else if (name == "ert") {
dialog->setController(new ControlERT(*dialog)); dialog->setController(new ControlERT(*dialog));
dialog->setView(new FormERT(*dialog)); dialog->setView(new FormERT(*dialog));
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
} else if (name == "external") { } else if (name == "external") {
dialog->setController(new ControlExternal(*dialog)); dialog->setController(new ControlExternal(*dialog));
dialog->setView(new FormExternal(*dialog)); dialog->setView(new FormExternal(*dialog));
dialog->setButtonController(new OkApplyCancelReadOnlyBC); dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
} else if (name == "float") { } else if (name == "float") {
dialog->setController(new ControlFloat(*dialog)); dialog->setController(new ControlFloat(*dialog));
dialog->setView(new FormFloat(*dialog)); dialog->setView(new FormFloat(*dialog));
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
} else if (name == "graphics") { } else if (name == "graphics") {
dialog->setController(new ControlGraphics(*dialog)); dialog->setController(new ControlGraphics(*dialog));
dialog->setView(new FormGraphics(*dialog)); dialog->setView(new FormGraphics(*dialog));
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
} else if (name == "include") { } else if (name == "include") {
dialog->setController(new ControlInclude(*dialog)); dialog->setController(new ControlInclude(*dialog));
dialog->setView(new FormInclude(*dialog)); dialog->setView(new FormInclude(*dialog));
dialog->setButtonController(new OkApplyCancelReadOnlyBC); dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
} else if (name == "index") { } else if (name == "index") {
dialog->setController(new ControlCommand(*dialog, name)); dialog->setController(new ControlCommand(*dialog, name));
dialog->setView(new FormText(*dialog, dialog->setView(new FormText(*dialog,
_("Index"), _("Keyword:|#K"))); _("Index"), _("Keyword:|#K")));
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
} else if (name == "label") { } else if (name == "label") {
dialog->setController(new ControlCommand(*dialog, name)); dialog->setController(new ControlCommand(*dialog, name));
dialog->setView(new FormText(*dialog, dialog->setView(new FormText(*dialog,
_("Label"), _("Label:|#L"))); _("Label"), _("Label:|#L")));
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
} else if (name == "minipage") { } else if (name == "minipage") {
dialog->setController(new ControlMinipage(*dialog)); dialog->setController(new ControlMinipage(*dialog));
dialog->setView(new FormMinipage(*dialog)); dialog->setView(new FormMinipage(*dialog));
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
} else if (name == "ref") { } else if (name == "ref") {
dialog->setController(new ControlRef(*dialog)); dialog->setController(new ControlRef(*dialog));
dialog->setView(new FormRef(*dialog)); dialog->setView(new FormRef(*dialog));
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
} else if (name == "tabular") { } else if (name == "tabular") {
dialog->setController(new ControlTabular(*dialog)); dialog->setController(new ControlTabular(*dialog));
dialog->setView(new FormTabular(*dialog)); dialog->setView(new FormTabular(*dialog));
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
} else if (name == "tabularcreate") { } else if (name == "tabularcreate") {
dialog->setController(new ControlTabularCreate(*dialog)); dialog->setController(new ControlTabularCreate(*dialog));
dialog->setView(new FormTabularCreate(*dialog)); dialog->setView(new FormTabularCreate(*dialog));
dialog->setButtonController(new OkApplyCancelReadOnlyBC); dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
} else if (name == "toc") { } else if (name == "toc") {
dialog->setController(new ControlToc(*dialog)); dialog->setController(new ControlToc(*dialog));
dialog->setView(new FormToc(*dialog)); dialog->setView(new FormToc(*dialog));
dialog->setButtonController(new OkCancelBC); dialog->bc().bp(new OkCancelPolicy);
} else if (name == "url") { } else if (name == "url") {
dialog->setController(new ControlCommand(*dialog, name)); dialog->setController(new ControlCommand(*dialog, name));
dialog->setView(new FormUrl(*dialog)); dialog->setView(new FormUrl(*dialog));
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
} else if (name == "wrap") { } else if (name == "wrap") {
dialog->setController(new ControlWrap(*dialog)); dialog->setController(new ControlWrap(*dialog));
dialog->setView(new FormWrap(*dialog)); dialog->setView(new FormWrap(*dialog));
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
} }
return dialog; return dialog;

View File

@ -75,5 +75,5 @@ void FormAboutlyx::build()
setPrehandler(dialog_->tabfolder); setPrehandler(dialog_->tabfolder);
// Manage the cancel/close button // Manage the cancel/close button
bc().setCancel(dialog_->button_close); bcview().setCancel(dialog_->button_close);
} }

View File

@ -15,6 +15,7 @@
#include "ControlButtons.h" #include "ControlButtons.h"
#include "xformsBC.h" #include "xformsBC.h"
#include "ButtonController.h"
#include "xforms_resize.h" #include "xforms_resize.h"
#include "Tooltips.h" #include "Tooltips.h"
#include "xforms_helpers.h" // formatted #include "xforms_helpers.h" // formatted
@ -81,10 +82,9 @@ void FormBase::redraw()
} }
xformsBC & FormBase::bc() xformsBC & FormBase::bcview()
{ {
return static_cast<xformsBC &>(getController().bc()); return static_cast<xformsBC &>(bc().view());
// return dynamic_cast<GUIbc &>(controller_ptr_->bc());
} }

View File

@ -86,7 +86,7 @@ protected:
void clearMessage(); void clearMessage();
/// ///
xformsBC & bc(); xformsBC & bcview();
private: private:
/// Pointer to the actual instantiation of xform's form /// Pointer to the actual instantiation of xform's form

View File

@ -38,11 +38,11 @@ void FormBibitem::build()
setPrehandler(dialog_->input_label); setPrehandler(dialog_->input_label);
// Manage the ok, apply, restore and cancel/close buttons // Manage the ok, apply, restore and cancel/close buttons
bc().setOK(dialog_->button_ok); bcview().setOK(dialog_->button_ok);
bc().setCancel(dialog_->button_close); bcview().setCancel(dialog_->button_close);
bc().addReadOnly(dialog_->input_key); bcview().addReadOnly(dialog_->input_key);
bc().addReadOnly(dialog_->input_label); bcview().addReadOnly(dialog_->input_label);
// set up the tooltips // set up the tooltips
string str = _("Key used within LyX document."); string str = _("Key used within LyX document.");

View File

@ -44,18 +44,18 @@ void FormBibtex::build()
dialog_.reset(build_bibtex(this)); dialog_.reset(build_bibtex(this));
// Manage the ok, apply, restore and cancel/close buttons // Manage the ok, apply, restore and cancel/close buttons
bc().setOK(dialog_->button_ok); bcview().setOK(dialog_->button_ok);
bc().setApply(dialog_->button_apply); bcview().setApply(dialog_->button_apply);
bc().setCancel(dialog_->button_close); bcview().setCancel(dialog_->button_close);
bc().setRestore(dialog_->button_restore); bcview().setRestore(dialog_->button_restore);
// disable for read-only documents // disable for read-only documents
bc().addReadOnly(dialog_->input_database); bcview().addReadOnly(dialog_->input_database);
bc().addReadOnly(dialog_->button_database_browse); bcview().addReadOnly(dialog_->button_database_browse);
bc().addReadOnly(dialog_->button_style_browse); bcview().addReadOnly(dialog_->button_style_browse);
bc().addReadOnly(dialog_->button_rescan); bcview().addReadOnly(dialog_->button_rescan);
bc().addReadOnly(dialog_->input_style); bcview().addReadOnly(dialog_->input_style);
bc().addReadOnly(dialog_->check_bibtotoc); bcview().addReadOnly(dialog_->check_bibtotoc);
// trigger an input event for cut&paste with middle mouse button. // trigger an input event for cut&paste with middle mouse button.
setPrehandler(dialog_->input_database); setPrehandler(dialog_->input_database);

View File

@ -25,5 +25,5 @@ void FormBrowser::build()
dialog_.reset(build_browser(this)); dialog_.reset(build_browser(this));
// Manage the close button // Manage the close button
bc().setCancel(dialog_->button_close); bcview().setCancel(dialog_->button_close);
} }

View File

@ -28,9 +28,9 @@ void FormChanges::build()
{ {
dialog_.reset(build_changes(this)); dialog_.reset(build_changes(this));
bc().setCancel(dialog_->button_close); bcview().setCancel(dialog_->button_close);
bc().addReadOnly(dialog_->button_accept); bcview().addReadOnly(dialog_->button_accept);
bc().addReadOnly(dialog_->button_reject); bcview().addReadOnly(dialog_->button_reject);
} }

View File

@ -15,6 +15,7 @@
#include <config.h> #include <config.h>
#include "xformsBC.h" #include "xformsBC.h"
#include "ButtonController.h"
#include "ControlCharacter.h" #include "ControlCharacter.h"
#include "FormCharacter.h" #include "FormCharacter.h"
#include "forms/form_character.h" #include "forms/form_character.h"
@ -112,9 +113,9 @@ void FormCharacter::build()
combo_language2_->select(1); combo_language2_->select(1);
// Manage the ok, apply and cancel/close buttons // Manage the ok, apply and cancel/close buttons
bc().setApply(dialog_->button_apply); bcview().setApply(dialog_->button_apply);
bc().setCancel(dialog_->button_close); bcview().setCancel(dialog_->button_close);
bc().addReadOnly(dialog_->check_toggle_all); bcview().addReadOnly(dialog_->check_toggle_all);
} }

View File

@ -134,21 +134,21 @@ void FormCitation::build()
dialog_.reset(build_citation(this)); dialog_.reset(build_citation(this));
// Manage the ok, apply, restore and cancel/close buttons // Manage the ok, apply, restore and cancel/close buttons
bc().setOK(dialog_->button_ok); bcview().setOK(dialog_->button_ok);
bc().setApply(dialog_->button_apply); bcview().setApply(dialog_->button_apply);
bc().setCancel(dialog_->button_close); bcview().setCancel(dialog_->button_close);
bc().setRestore(dialog_->button_restore); bcview().setRestore(dialog_->button_restore);
// disable for read-only documents // disable for read-only documents
bc().addReadOnly(dialog_->button_add); bcview().addReadOnly(dialog_->button_add);
bc().addReadOnly(dialog_->button_del); bcview().addReadOnly(dialog_->button_del);
bc().addReadOnly(dialog_->button_up); bcview().addReadOnly(dialog_->button_up);
bc().addReadOnly(dialog_->button_down); bcview().addReadOnly(dialog_->button_down);
bc().addReadOnly(dialog_->choice_style); bcview().addReadOnly(dialog_->choice_style);
bc().addReadOnly(dialog_->input_before); bcview().addReadOnly(dialog_->input_before);
bc().addReadOnly(dialog_->input_after); bcview().addReadOnly(dialog_->input_after);
bc().addReadOnly(dialog_->check_full_author_list); bcview().addReadOnly(dialog_->check_full_author_list);
bc().addReadOnly(dialog_->check_force_uppercase); bcview().addReadOnly(dialog_->check_force_uppercase);
// trigger an input event for cut&paste with middle mouse button. // trigger an input event for cut&paste with middle mouse button.
setPrehandler(dialog_->input_search); setPrehandler(dialog_->input_search);

View File

@ -15,6 +15,7 @@
#include "Dialog.h" #include "Dialog.h"
#include "xformsBC.h" #include "xformsBC.h"
#include "ButtonController.h"
#include "xforms_resize.h" #include "xforms_resize.h"
#include "Tooltips.h" #include "Tooltips.h"
#include "xforms_helpers.h" // formatted #include "xforms_helpers.h" // formatted
@ -83,9 +84,9 @@ void FormDialogView::redraw()
} }
xformsBC & FormDialogView::bc() xformsBC & FormDialogView::bcview()
{ {
return static_cast<xformsBC &>(dialog().bc()); return static_cast<xformsBC &>(dialog().bc().view());
} }

View File

@ -85,7 +85,7 @@ protected:
void clearMessage(); void clearMessage();
/// ///
xformsBC & bc(); xformsBC & bcview();
private: private:
/// Pointer to the actual instantiation of xform's form /// Pointer to the actual instantiation of xform's form

View File

@ -16,6 +16,7 @@
#include "FormDocument.h" #include "FormDocument.h"
#include "forms/form_document.h" #include "forms/form_document.h"
#include "xformsBC.h" #include "xformsBC.h"
#include "ButtonController.h"
#include "bmtable.h" #include "bmtable.h"
#include "checkedwidgets.h" #include "checkedwidgets.h"
@ -81,32 +82,32 @@ void FormDocument::build()
setMessageWidget(dialog_->text_warning); setMessageWidget(dialog_->text_warning);
// Manage the restore, ok, apply, restore and cancel/close buttons // Manage the restore, ok, apply, restore and cancel/close buttons
bc().setOK(dialog_->button_ok); bcview().setOK(dialog_->button_ok);
bc().setApply(dialog_->button_apply); bcview().setApply(dialog_->button_apply);
bc().setCancel(dialog_->button_close); bcview().setCancel(dialog_->button_close);
bc().setRestore(dialog_->button_restore); bcview().setRestore(dialog_->button_restore);
// the document class form // the document class form
class_.reset(build_document_class(this)); class_.reset(build_document_class(this));
// disable for read-only documents // disable for read-only documents
bc().addReadOnly(class_->radio_doc_indent); bcview().addReadOnly(class_->radio_doc_indent);
bc().addReadOnly(class_->radio_doc_skip); bcview().addReadOnly(class_->radio_doc_skip);
bc().addReadOnly(class_->choice_doc_pagestyle); bcview().addReadOnly(class_->choice_doc_pagestyle);
bc().addReadOnly(class_->choice_doc_fonts); bcview().addReadOnly(class_->choice_doc_fonts);
bc().addReadOnly(class_->choice_doc_fontsize); bcview().addReadOnly(class_->choice_doc_fontsize);
bc().addReadOnly(class_->radio_doc_sides_one); bcview().addReadOnly(class_->radio_doc_sides_one);
bc().addReadOnly(class_->radio_doc_sides_two); bcview().addReadOnly(class_->radio_doc_sides_two);
bc().addReadOnly(class_->radio_doc_columns_one); bcview().addReadOnly(class_->radio_doc_columns_one);
bc().addReadOnly(class_->radio_doc_columns_two); bcview().addReadOnly(class_->radio_doc_columns_two);
bc().addReadOnly(class_->input_doc_extra); bcview().addReadOnly(class_->input_doc_extra);
bc().addReadOnly(class_->input_doc_skip); bcview().addReadOnly(class_->input_doc_skip);
bc().addReadOnly(class_->choice_doc_skip); bcview().addReadOnly(class_->choice_doc_skip);
bc().addReadOnly(class_->choice_doc_spacing); bcview().addReadOnly(class_->choice_doc_spacing);
bc().addReadOnly(class_->input_doc_spacing); bcview().addReadOnly(class_->input_doc_spacing);
// check validity of "length + unit" input // check validity of "length + unit" input
addCheckedGlueLength(bc(), class_->input_doc_skip, addCheckedGlueLength(bcview(), class_->input_doc_skip,
class_->choice_doc_skip); class_->choice_doc_skip);
// trigger an input event for cut&paste with middle mouse button. // trigger an input event for cut&paste with middle mouse button.
@ -164,38 +165,38 @@ void FormDocument::build()
fl_unsigned_float_filter); fl_unsigned_float_filter);
// disable for read-only documents // disable for read-only documents
bc().addReadOnly(dialog_->button_save_defaults); bcview().addReadOnly(dialog_->button_save_defaults);
bc().addReadOnly(dialog_->button_reset_defaults); bcview().addReadOnly(dialog_->button_reset_defaults);
// the document paper form // the document paper form
paper_.reset(build_document_paper(this)); paper_.reset(build_document_paper(this));
// disable for read-only documents // disable for read-only documents
bc().addReadOnly(paper_->choice_paperpackage); bcview().addReadOnly(paper_->choice_paperpackage);
bc().addReadOnly(paper_->radio_portrait); bcview().addReadOnly(paper_->radio_portrait);
bc().addReadOnly(paper_->radio_landscape); bcview().addReadOnly(paper_->radio_landscape);
bc().addReadOnly(paper_->choice_papersize); bcview().addReadOnly(paper_->choice_papersize);
bc().addReadOnly(paper_->check_use_geometry); bcview().addReadOnly(paper_->check_use_geometry);
bc().addReadOnly(paper_->input_custom_width); bcview().addReadOnly(paper_->input_custom_width);
bc().addReadOnly(paper_->input_custom_height); bcview().addReadOnly(paper_->input_custom_height);
bc().addReadOnly(paper_->input_top_margin); bcview().addReadOnly(paper_->input_top_margin);
bc().addReadOnly(paper_->input_bottom_margin); bcview().addReadOnly(paper_->input_bottom_margin);
bc().addReadOnly(paper_->input_inner_margin); bcview().addReadOnly(paper_->input_inner_margin);
bc().addReadOnly(paper_->input_outer_margin); bcview().addReadOnly(paper_->input_outer_margin);
bc().addReadOnly(paper_->input_head_height); bcview().addReadOnly(paper_->input_head_height);
bc().addReadOnly(paper_->input_head_sep); bcview().addReadOnly(paper_->input_head_sep);
bc().addReadOnly(paper_->input_foot_skip); bcview().addReadOnly(paper_->input_foot_skip);
// check validity of "length + unit" input // check validity of "length + unit" input
addCheckedGlueLength(bc(), paper_->input_custom_width); addCheckedGlueLength(bcview(), paper_->input_custom_width);
addCheckedGlueLength(bc(), paper_->input_custom_height); addCheckedGlueLength(bcview(), paper_->input_custom_height);
addCheckedGlueLength(bc(), paper_->input_top_margin); addCheckedGlueLength(bcview(), paper_->input_top_margin);
addCheckedGlueLength(bc(), paper_->input_bottom_margin); addCheckedGlueLength(bcview(), paper_->input_bottom_margin);
addCheckedGlueLength(bc(), paper_->input_inner_margin); addCheckedGlueLength(bcview(), paper_->input_inner_margin);
addCheckedGlueLength(bc(), paper_->input_outer_margin); addCheckedGlueLength(bcview(), paper_->input_outer_margin);
addCheckedGlueLength(bc(), paper_->input_head_height); addCheckedGlueLength(bcview(), paper_->input_head_height);
addCheckedGlueLength(bc(), paper_->input_head_sep); addCheckedGlueLength(bcview(), paper_->input_head_sep);
addCheckedGlueLength(bc(), paper_->input_foot_skip); addCheckedGlueLength(bcview(), paper_->input_foot_skip);
// trigger an input event for cut&paste with middle mouse button. // trigger an input event for cut&paste with middle mouse button.
setPrehandler(paper_->input_custom_width); setPrehandler(paper_->input_custom_width);
@ -241,10 +242,10 @@ void FormDocument::build()
language_.reset(build_document_language(this)); language_.reset(build_document_language(this));
// disable for read-only documents // disable for read-only documents
bc().addReadOnly(language_->choice_inputenc); bcview().addReadOnly(language_->choice_inputenc);
bc().addReadOnly(language_->choice_quotes_language); bcview().addReadOnly(language_->choice_quotes_language);
bc().addReadOnly(language_->radio_single); bcview().addReadOnly(language_->radio_single);
bc().addReadOnly(language_->radio_double); bcview().addReadOnly(language_->radio_double);
fl_addto_choice(language_->choice_inputenc, fl_addto_choice(language_->choice_inputenc,
"default|auto|latin1|latin2|latin3|latin4|latin5|latin9" "default|auto|latin1|latin2|latin3|latin4|latin5|latin9"
@ -279,13 +280,13 @@ void FormDocument::build()
options_.reset(build_document_options(this)); options_.reset(build_document_options(this));
// disable for read-only documents // disable for read-only documents
bc().addReadOnly(options_->counter_secnumdepth); bcview().addReadOnly(options_->counter_secnumdepth);
bc().addReadOnly(options_->counter_tocdepth); bcview().addReadOnly(options_->counter_tocdepth);
bc().addReadOnly(options_->choice_ams_math); bcview().addReadOnly(options_->choice_ams_math);
bc().addReadOnly(options_->check_use_natbib); bcview().addReadOnly(options_->check_use_natbib);
bc().addReadOnly(options_->choice_citation_format); bcview().addReadOnly(options_->choice_citation_format);
bc().addReadOnly(options_->input_float_placement); bcview().addReadOnly(options_->input_float_placement);
bc().addReadOnly(options_->choice_postscript_driver); bcview().addReadOnly(options_->choice_postscript_driver);
// trigger an input event for cut&paste with middle mouse button. // trigger an input event for cut&paste with middle mouse button.
setPrehandler(options_->input_float_placement); setPrehandler(options_->input_float_placement);
@ -306,19 +307,19 @@ void FormDocument::build()
bullets_.reset(build_document_bullet(this)); bullets_.reset(build_document_bullet(this));
// disable for read-only documents // disable for read-only documents
bc().addReadOnly(bullets_->radio_bullet_depth_1); bcview().addReadOnly(bullets_->radio_bullet_depth_1);
bc().addReadOnly(bullets_->radio_bullet_depth_2); bcview().addReadOnly(bullets_->radio_bullet_depth_2);
bc().addReadOnly(bullets_->radio_bullet_depth_3); bcview().addReadOnly(bullets_->radio_bullet_depth_3);
bc().addReadOnly(bullets_->radio_bullet_depth_4); bcview().addReadOnly(bullets_->radio_bullet_depth_4);
bc().addReadOnly(bullets_->radio_bullet_panel_standard); bcview().addReadOnly(bullets_->radio_bullet_panel_standard);
bc().addReadOnly(bullets_->radio_bullet_panel_maths); bcview().addReadOnly(bullets_->radio_bullet_panel_maths);
bc().addReadOnly(bullets_->radio_bullet_panel_ding1); bcview().addReadOnly(bullets_->radio_bullet_panel_ding1);
bc().addReadOnly(bullets_->radio_bullet_panel_ding2); bcview().addReadOnly(bullets_->radio_bullet_panel_ding2);
bc().addReadOnly(bullets_->radio_bullet_panel_ding3); bcview().addReadOnly(bullets_->radio_bullet_panel_ding3);
bc().addReadOnly(bullets_->radio_bullet_panel_ding4); bcview().addReadOnly(bullets_->radio_bullet_panel_ding4);
bc().addReadOnly(bullets_->bmtable_bullet_panel); bcview().addReadOnly(bullets_->bmtable_bullet_panel);
bc().addReadOnly(bullets_->choice_bullet_size); bcview().addReadOnly(bullets_->choice_bullet_size);
bc().addReadOnly(bullets_->input_bullet_latex); bcview().addReadOnly(bullets_->input_bullet_latex);
// trigger an input event for cut&paste with middle mouse button. // trigger an input event for cut&paste with middle mouse button.
setPrehandler(bullets_->input_bullet_latex); setPrehandler(bullets_->input_bullet_latex);

View File

@ -32,13 +32,13 @@ void FormERT::build()
dialog_.reset(build_ert(this)); dialog_.reset(build_ert(this));
// Manage the ok, apply and cancel/close buttons // Manage the ok, apply and cancel/close buttons
bc().setOK(dialog_->button_ok); bcview().setOK(dialog_->button_ok);
bc().setApply(dialog_->button_apply); bcview().setApply(dialog_->button_apply);
bc().setCancel(dialog_->button_close); bcview().setCancel(dialog_->button_close);
bc().addReadOnly(dialog_->radio_open); bcview().addReadOnly(dialog_->radio_open);
bc().addReadOnly(dialog_->radio_collapsed); bcview().addReadOnly(dialog_->radio_collapsed);
bc().addReadOnly(dialog_->radio_inlined); bcview().addReadOnly(dialog_->radio_inlined);
} }

View File

@ -30,7 +30,7 @@ void FormError::build()
dialog_.reset(build_error(this)); dialog_.reset(build_error(this));
// Manage the cancel/close button // Manage the cancel/close button
bc().setCancel(dialog_->button_close); bcview().setCancel(dialog_->button_close);
} }

View File

@ -59,13 +59,13 @@ void FormExternal::build()
setPrehandler(dialog_->input_filename); setPrehandler(dialog_->input_filename);
setPrehandler(dialog_->input_parameters); setPrehandler(dialog_->input_parameters);
bc().setOK(dialog_->button_ok); bcview().setOK(dialog_->button_ok);
bc().setApply(dialog_->button_apply); bcview().setApply(dialog_->button_apply);
bc().setCancel(dialog_->button_close); bcview().setCancel(dialog_->button_close);
bc().addReadOnly(dialog_->input_filename); bcview().addReadOnly(dialog_->input_filename);
bc().addReadOnly(dialog_->button_filenamebrowse); bcview().addReadOnly(dialog_->button_filenamebrowse);
bc().addReadOnly(dialog_->input_parameters); bcview().addReadOnly(dialog_->input_parameters);
} }

View File

@ -46,21 +46,21 @@ void FormFloat::build()
dialog_.reset(build_float(this)); dialog_.reset(build_float(this));
// Manage the ok, apply and cancel/close buttons // Manage the ok, apply and cancel/close buttons
bc().setOK(dialog_->button_ok); bcview().setOK(dialog_->button_ok);
bc().setApply(dialog_->button_apply); bcview().setApply(dialog_->button_apply);
bc().setCancel(dialog_->button_close); bcview().setCancel(dialog_->button_close);
bc().setRestore(dialog_->button_restore); bcview().setRestore(dialog_->button_restore);
// disable for read-only documents // disable for read-only documents
bc().addReadOnly(dialog_->radio_default); bcview().addReadOnly(dialog_->radio_default);
bc().addReadOnly(dialog_->radio_here_definitely); bcview().addReadOnly(dialog_->radio_here_definitely);
bc().addReadOnly(dialog_->radio_alternatives); bcview().addReadOnly(dialog_->radio_alternatives);
bc().addReadOnly(dialog_->check_top); bcview().addReadOnly(dialog_->check_top);
bc().addReadOnly(dialog_->check_bottom); bcview().addReadOnly(dialog_->check_bottom);
bc().addReadOnly(dialog_->check_page); bcview().addReadOnly(dialog_->check_page);
bc().addReadOnly(dialog_->check_here); bcview().addReadOnly(dialog_->check_here);
bc().addReadOnly(dialog_->check_force); bcview().addReadOnly(dialog_->check_force);
bc().addReadOnly(dialog_->check_wide); bcview().addReadOnly(dialog_->check_wide);
placement_.init(dialog_->radio_default, DOCUMENT_DEFAULTS); placement_.init(dialog_->radio_default, DOCUMENT_DEFAULTS);
placement_.init(dialog_->radio_here_definitely, HERE_DEFINITELY); placement_.init(dialog_->radio_here_definitely, HERE_DEFINITELY);

View File

@ -13,6 +13,7 @@
#include "xformsBC.h" #include "xformsBC.h"
#include "ButtonController.h"
#include "FormForks.h" #include "FormForks.h"
#include "ControlForks.h" #include "ControlForks.h"
#include "forms/form_forks.h" #include "forms/form_forks.h"
@ -45,9 +46,9 @@ void FormForks::build() {
fl_clear_browser(dialog_->browser_kill); fl_clear_browser(dialog_->browser_kill);
// Manage the ok, apply, restore and cancel/close buttons // Manage the ok, apply, restore and cancel/close buttons
bc().setOK(dialog_->button_ok); bcview().setOK(dialog_->button_ok);
bc().setApply(dialog_->button_apply); bcview().setApply(dialog_->button_apply);
bc().setCancel(dialog_->button_close); bcview().setCancel(dialog_->button_close);
bc().invalid(); bc().invalid();
// Set up the tooltip mechanism // Set up the tooltip mechanism

View File

@ -79,23 +79,23 @@ void FormGraphics::build()
dialog_.reset(build_graphics(this)); dialog_.reset(build_graphics(this));
// Manage the ok, apply, restore and cancel/close buttons // Manage the ok, apply, restore and cancel/close buttons
bc().setOK(dialog_->button_ok); bcview().setOK(dialog_->button_ok);
bc().setApply(dialog_->button_apply); bcview().setApply(dialog_->button_apply);
bc().setCancel(dialog_->button_close); bcview().setCancel(dialog_->button_close);
bc().setRestore(dialog_->button_restore); bcview().setRestore(dialog_->button_restore);
// the file section // the file section
file_.reset(build_graphics_file(this)); file_.reset(build_graphics_file(this));
// disable for read-only documents // disable for read-only documents
bc().addReadOnly(file_->button_browse); bcview().addReadOnly(file_->button_browse);
bc().addReadOnly(file_->check_aspectratio); bcview().addReadOnly(file_->check_aspectratio);
bc().addReadOnly(file_->check_draft); bcview().addReadOnly(file_->check_draft);
bc().addReadOnly(file_->check_nounzip); bcview().addReadOnly(file_->check_nounzip);
// check validity of "length + unit" input // check validity of "length + unit" input
addCheckedGlueLength(bc(), file_->input_width); addCheckedGlueLength(bcview(), file_->input_width);
addCheckedGlueLength(bc(), file_->input_height); addCheckedGlueLength(bcview(), file_->input_height);
// trigger an input event for cut&paste with middle mouse button. // trigger an input event for cut&paste with middle mouse button.
setPrehandler(file_->input_filename); setPrehandler(file_->input_filename);
@ -166,11 +166,11 @@ void FormGraphics::build()
bbox_.reset(build_graphics_bbox(this)); bbox_.reset(build_graphics_bbox(this));
// disable for read-only documents // disable for read-only documents
bc().addReadOnly(bbox_->button_getBB); bcview().addReadOnly(bbox_->button_getBB);
bc().addReadOnly(bbox_->check_clip); bcview().addReadOnly(bbox_->check_clip);
// check validity of "length + unit" input // check validity of "length + unit" input
addCheckedLyXLength(bc(), bbox_->input_bb_x1, bbox_->text_X); addCheckedLyXLength(bcview(), bbox_->input_bb_x1, bbox_->text_X);
// trigger an input event for cut&paste with middle mouse button. // trigger an input event for cut&paste with middle mouse button.
setPrehandler(bbox_->input_bb_x0); setPrehandler(bbox_->input_bb_x0);
@ -217,10 +217,10 @@ void FormGraphics::build()
extra_.reset(build_graphics_extra(this)); extra_.reset(build_graphics_extra(this));
// disable for read-only documents // disable for read-only documents
bc().addReadOnly(extra_->input_rotate_angle); bcview().addReadOnly(extra_->input_rotate_angle);
bc().addReadOnly(extra_->choice_origin); bcview().addReadOnly(extra_->choice_origin);
bc().addReadOnly(extra_->check_subcaption); bcview().addReadOnly(extra_->check_subcaption);
bc().addReadOnly(extra_->input_special); bcview().addReadOnly(extra_->input_special);
// trigger an input event for cut&paste with middle mouse button. // trigger an input event for cut&paste with middle mouse button.
setPrehandler(extra_->input_rotate_angle); setPrehandler(extra_->input_rotate_angle);

View File

@ -38,8 +38,8 @@ void FormInclude::build()
dialog_.reset(build_include(this)); dialog_.reset(build_include(this));
// Manage the ok and cancel buttons // Manage the ok and cancel buttons
bc().setOK(dialog_->button_ok); bcview().setOK(dialog_->button_ok);
bc().setCancel(dialog_->button_close); bcview().setCancel(dialog_->button_close);
// trigger an input event for cut&paste with middle mouse button. // trigger an input event for cut&paste with middle mouse button.
setPrehandler(dialog_->input_filename); setPrehandler(dialog_->input_filename);
@ -47,10 +47,10 @@ void FormInclude::build()
fl_set_input_return(dialog_->input_filename, FL_RETURN_CHANGED); fl_set_input_return(dialog_->input_filename, FL_RETURN_CHANGED);
// disable for read-only documents // disable for read-only documents
bc().addReadOnly(dialog_->button_browse); bcview().addReadOnly(dialog_->button_browse);
bc().addReadOnly(dialog_->radio_useinput); bcview().addReadOnly(dialog_->radio_useinput);
bc().addReadOnly(dialog_->radio_useinclude); bcview().addReadOnly(dialog_->radio_useinclude);
bc().addReadOnly(dialog_->radio_verbatim); bcview().addReadOnly(dialog_->radio_verbatim);
type_.init(dialog_->radio_useinput, ControlInclude::INPUT); type_.init(dialog_->radio_useinput, ControlInclude::INPUT);
type_.init(dialog_->radio_useinclude, ControlInclude::INCLUDE); type_.init(dialog_->radio_useinclude, ControlInclude::INCLUDE);

View File

@ -96,7 +96,7 @@ void FormMathsBitmap::build()
it < bitmaps_.end(); ++it) { it < bitmaps_.end(); ++it) {
FL_OBJECT * obj = buildBitmap(*it); FL_OBJECT * obj = buildBitmap(*it);
bc().addReadOnly(obj); bcview().addReadOnly(obj);
y_close = max(y_close, obj->y + obj->h); y_close = max(y_close, obj->y + obj->h);
} }
bitmaps_.clear(); bitmaps_.clear();
@ -116,7 +116,7 @@ void FormMathsBitmap::build()
fdui->form->fdui = fdui; fdui->form->fdui = fdui;
dialog_.reset(fdui); dialog_.reset(fdui);
bc().setCancel(dialog_->button_close); bcview().setCancel(dialog_->button_close);
} }

View File

@ -18,6 +18,7 @@
#include "forms/form_maths_delim.h" #include "forms/form_maths_delim.h"
#include "ControlMath.h" #include "ControlMath.h"
#include "xformsBC.h" #include "xformsBC.h"
#include "ButtonController.h"
#include "bmtable.h" #include "bmtable.h"
@ -70,15 +71,15 @@ void FormMathsDelim::build()
delim_width, delim_height, delim_bits); delim_width, delim_height, delim_bits);
fl_set_bmtable_maxitems(dialog_->bmtable, 23); fl_set_bmtable_maxitems(dialog_->bmtable, 23);
bc().setOK(dialog_->button_ok); bcview().setOK(dialog_->button_ok);
bc().setApply(dialog_->button_apply); bcview().setApply(dialog_->button_apply);
bc().setCancel(dialog_->button_close); bcview().setCancel(dialog_->button_close);
bc().addReadOnly(dialog_->bmtable); bcview().addReadOnly(dialog_->bmtable);
bc().addReadOnly(dialog_->radio_right); bcview().addReadOnly(dialog_->radio_right);
bc().addReadOnly(dialog_->radio_left); bcview().addReadOnly(dialog_->radio_left);
bc().addReadOnly(dialog_->radio_both); bcview().addReadOnly(dialog_->radio_both);
bc().addReadOnly(dialog_->button_pix); bcview().addReadOnly(dialog_->button_pix);
} }

View File

@ -18,6 +18,7 @@
#include "forms/form_maths_matrix.h" #include "forms/form_maths_matrix.h"
#include "ControlMath.h" #include "ControlMath.h"
#include "xformsBC.h" #include "xformsBC.h"
#include "ButtonController.h"
#include "support/LAssert.h" #include "support/LAssert.h"
#include "support/lyxalgo.h" // lyx::count #include "support/lyxalgo.h" // lyx::count
@ -72,14 +73,14 @@ void FormMathsMatrix::build()
C_FormMathsMatrixAlignFilter); C_FormMathsMatrixAlignFilter);
setPrehandler(dialog_->input_halign); setPrehandler(dialog_->input_halign);
bc().setOK(dialog_->button_ok); bcview().setOK(dialog_->button_ok);
bc().setApply(dialog_->button_apply); bcview().setApply(dialog_->button_apply);
bc().setCancel(dialog_->button_close); bcview().setCancel(dialog_->button_close);
bc().addReadOnly(dialog_->slider_rows); bcview().addReadOnly(dialog_->slider_rows);
bc().addReadOnly(dialog_->slider_columns); bcview().addReadOnly(dialog_->slider_columns);
bc().addReadOnly(dialog_->choice_valign); bcview().addReadOnly(dialog_->choice_valign);
bc().addReadOnly(dialog_->input_halign); bcview().addReadOnly(dialog_->input_halign);
} }

View File

@ -75,10 +75,9 @@ FormMathsBitmap * FormMathsPanel::addDaughter(void * key,
FormMathsBitmap * const view = FormMathsBitmap * const view =
new FormMathsBitmap(title, std::vector<string>(data, end)); new FormMathsBitmap(title, std::vector<string>(data, end));
typedef ButtonController<IgnorantPolicy, xformsBC> BC; controller().addDaughter(key, view,
BC * const bc = new BC; new xformsBC(controller().bc()),
new IgnorantPolicy);
controller().addDaughter(key, view, bc);
return view; return view;
} }
@ -112,17 +111,22 @@ void FormMathsPanel::build()
fl_set_pixmap_data(dialog_->button_equation, fl_set_pixmap_data(dialog_->button_equation,
const_cast<char**>(equation)); const_cast<char**>(equation));
typedef ButtonController<IgnorantPolicy, xformsBC> BC_ignorant;
typedef ButtonController<OkApplyCancelReadOnlyPolicy, xformsBC> BC_ok;
controller().addDaughter(dialog_->button_delim, controller().addDaughter(dialog_->button_delim,
new FormMathsDelim, new BC_ok); new FormMathsDelim,
new xformsBC(controller().bc()),
new OkApplyCancelReadOnlyPolicy);
controller().addDaughter(dialog_->button_matrix, controller().addDaughter(dialog_->button_matrix,
new FormMathsMatrix, new BC_ok); new FormMathsMatrix,
new xformsBC(controller().bc()),
new OkApplyCancelReadOnlyPolicy);
controller().addDaughter(dialog_->button_space, controller().addDaughter(dialog_->button_space,
new FormMathsSpace, new BC_ignorant); new FormMathsSpace,
new xformsBC(controller().bc()),
new IgnorantPolicy);
controller().addDaughter(dialog_->button_style, controller().addDaughter(dialog_->button_style,
new FormMathsStyle, new BC_ignorant); new FormMathsStyle,
new xformsBC(controller().bc()),
new IgnorantPolicy);
FormMathsBitmap * bitmap; FormMathsBitmap * bitmap;
bitmap = addDaughter(dialog_->button_deco, bitmap = addDaughter(dialog_->button_deco,

View File

@ -37,16 +37,16 @@ void FormMathsSpace::build()
space_ = -1; space_ = -1;
bc().setCancel(dialog_->button_close); bcview().setCancel(dialog_->button_close);
bc().addReadOnly(dialog_->button_negative); bcview().addReadOnly(dialog_->button_negative);
bc().addReadOnly(dialog_->button_negmedspace); bcview().addReadOnly(dialog_->button_negmedspace);
bc().addReadOnly(dialog_->button_negthickspace); bcview().addReadOnly(dialog_->button_negthickspace);
bc().addReadOnly(dialog_->button_thin); bcview().addReadOnly(dialog_->button_thin);
bc().addReadOnly(dialog_->button_medium); bcview().addReadOnly(dialog_->button_medium);
bc().addReadOnly(dialog_->button_thick); bcview().addReadOnly(dialog_->button_thick);
bc().addReadOnly(dialog_->button_quadratin); bcview().addReadOnly(dialog_->button_quadratin);
bc().addReadOnly(dialog_->button_twoquadratin); bcview().addReadOnly(dialog_->button_twoquadratin);
} }

View File

@ -52,24 +52,24 @@ void FormMathsStyle::build()
fl_set_bmtable_data(dialog_->bmtable_style1, 1, 1, fl_set_bmtable_data(dialog_->bmtable_style1, 1, 1,
style1_width, style1_height, style1_bits); style1_width, style1_height, style1_bits);
fl_set_bmtable_maxitems(dialog_->bmtable_style1, 1); fl_set_bmtable_maxitems(dialog_->bmtable_style1, 1);
bc().addReadOnly(dialog_->bmtable_style1); bcview().addReadOnly(dialog_->bmtable_style1);
fl_set_bmtable_data(dialog_->bmtable_style2, 1, 3, fl_set_bmtable_data(dialog_->bmtable_style2, 1, 3,
style2_width, style2_height, style2_bits); style2_width, style2_height, style2_bits);
fl_set_bmtable_maxitems(dialog_->bmtable_style2, 3); fl_set_bmtable_maxitems(dialog_->bmtable_style2, 3);
bc().addReadOnly(dialog_->bmtable_style2); bcview().addReadOnly(dialog_->bmtable_style2);
fl_set_bmtable_data(dialog_->bmtable_font1, 1, 5, fl_set_bmtable_data(dialog_->bmtable_font1, 1, 5,
font1_width, font1_height, font1_bits); font1_width, font1_height, font1_bits);
fl_set_bmtable_maxitems(dialog_->bmtable_font1, 5); fl_set_bmtable_maxitems(dialog_->bmtable_font1, 5);
bc().addReadOnly(dialog_->bmtable_font1); bcview().addReadOnly(dialog_->bmtable_font1);
fl_set_bmtable_data(dialog_->bmtable_font2, 1, 3, fl_set_bmtable_data(dialog_->bmtable_font2, 1, 3,
font2_width, font2_height, font2_bits); font2_width, font2_height, font2_bits);
fl_set_bmtable_maxitems(dialog_->bmtable_font2, 3); fl_set_bmtable_maxitems(dialog_->bmtable_font2, 3);
bc().addReadOnly(dialog_->bmtable_font2); bcview().addReadOnly(dialog_->bmtable_font2);
bc().setCancel(dialog_->button_close); bcview().setCancel(dialog_->button_close);
} }

View File

@ -42,16 +42,16 @@ void FormMinipage::build()
fl_addto_choice(dialog_->choice_width_units, subst(choice, "%", "%%").c_str()); fl_addto_choice(dialog_->choice_width_units, subst(choice, "%", "%%").c_str());
// Manage the ok, apply and cancel/close buttons // Manage the ok, apply and cancel/close buttons
bc().setOK(dialog_->button_ok); bcview().setOK(dialog_->button_ok);
bc().setApply(dialog_->button_apply); bcview().setApply(dialog_->button_apply);
bc().setCancel(dialog_->button_close); bcview().setCancel(dialog_->button_close);
bc().setRestore(dialog_->button_restore); bcview().setRestore(dialog_->button_restore);
bc().addReadOnly(dialog_->input_width); bcview().addReadOnly(dialog_->input_width);
bc().addReadOnly(dialog_->choice_width_units); bcview().addReadOnly(dialog_->choice_width_units);
bc().addReadOnly(dialog_->radio_top); bcview().addReadOnly(dialog_->radio_top);
bc().addReadOnly(dialog_->radio_middle); bcview().addReadOnly(dialog_->radio_middle);
bc().addReadOnly(dialog_->radio_bottom); bcview().addReadOnly(dialog_->radio_bottom);
} }

View File

@ -74,35 +74,35 @@ void FormParagraph::build()
dialog_.reset(build_paragraph(this)); dialog_.reset(build_paragraph(this));
// Manage the ok, apply, restore and cancel/close buttons // Manage the ok, apply, restore and cancel/close buttons
bc().setOK(dialog_->button_ok); bcview().setOK(dialog_->button_ok);
bc().setApply(dialog_->button_apply); bcview().setApply(dialog_->button_apply);
bc().setCancel(dialog_->button_close); bcview().setCancel(dialog_->button_close);
bc().setRestore(dialog_->button_restore); bcview().setRestore(dialog_->button_restore);
// disable for read-only documents // disable for read-only documents
bc().addReadOnly(dialog_->check_line_above); bcview().addReadOnly(dialog_->check_line_above);
bc().addReadOnly(dialog_->check_pagebreak_above); bcview().addReadOnly(dialog_->check_pagebreak_above);
bc().addReadOnly(dialog_->choice_space_above); bcview().addReadOnly(dialog_->choice_space_above);
bc().addReadOnly(dialog_->input_space_above); bcview().addReadOnly(dialog_->input_space_above);
bc().addReadOnly(dialog_->check_space_above); bcview().addReadOnly(dialog_->check_space_above);
bc().addReadOnly(dialog_->check_noindent); bcview().addReadOnly(dialog_->check_noindent);
bc().addReadOnly(dialog_->choice_linespacing); bcview().addReadOnly(dialog_->choice_linespacing);
bc().addReadOnly(dialog_->input_linespacing); bcview().addReadOnly(dialog_->input_linespacing);
bc().addReadOnly(dialog_->check_line_below); bcview().addReadOnly(dialog_->check_line_below);
bc().addReadOnly(dialog_->check_pagebreak_below); bcview().addReadOnly(dialog_->check_pagebreak_below);
bc().addReadOnly(dialog_->choice_space_below); bcview().addReadOnly(dialog_->choice_space_below);
bc().addReadOnly(dialog_->input_space_below); bcview().addReadOnly(dialog_->input_space_below);
bc().addReadOnly(dialog_->check_space_below); bcview().addReadOnly(dialog_->check_space_below);
bc().addReadOnly(dialog_->input_labelwidth); bcview().addReadOnly(dialog_->input_labelwidth);
// check validity of "length + unit" input // check validity of "length + unit" input
addCheckedGlueLength(bc(), addCheckedGlueLength(bcview(),
dialog_->input_space_above, dialog_->input_space_above,
dialog_->choice_space_above); dialog_->choice_space_above);
addCheckedGlueLength(bc(), addCheckedGlueLength(bcview(),
dialog_->input_space_below, dialog_->input_space_below,
dialog_->choice_space_below); dialog_->choice_space_below);

View File

@ -31,9 +31,9 @@ void FormPreamble::build()
dialog_.reset(build_preamble(this)); dialog_.reset(build_preamble(this));
// Manage the ok, apply and cancel/close buttons // Manage the ok, apply and cancel/close buttons
bc().setOK(dialog_->button_ok); bcview().setOK(dialog_->button_ok);
bc().setApply(dialog_->button_apply); bcview().setApply(dialog_->button_apply);
bc().setCancel(dialog_->button_close); bcview().setCancel(dialog_->button_close);
// trigger an input event for cut&paste with middle mouse button. // trigger an input event for cut&paste with middle mouse button.
setPrehandler(dialog_->input_preamble); setPrehandler(dialog_->input_preamble);

Some files were not shown because too many files have changed in this diff Show More