diff --git a/src/frontends/Dialogs.C b/src/frontends/Dialogs.C index dbc2aa8746..23907a8709 100644 --- a/src/frontends/Dialogs.C +++ b/src/frontends/Dialogs.C @@ -13,7 +13,6 @@ #include "Dialogs.h" #include "controllers/Dialog.h" -#include "controllers/ButtonControllerBase.h" #include diff --git a/src/frontends/controllers/BCView.C b/src/frontends/controllers/BCView.C new file mode 100644 index 0000000000..29a8b7006a --- /dev/null +++ b/src/frontends/controllers/BCView.C @@ -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 + +#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; +} diff --git a/src/frontends/controllers/BCView.h b/src/frontends/controllers/BCView.h new file mode 100644 index 0000000000..f4d66bb73b --- /dev/null +++ b/src/frontends/controllers/BCView.h @@ -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 +#include + +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 checked_widget_ptr; + typedef std::list 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 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 Widgets; + Widgets read_only_; +}; + + +#include "BCView.tmpl" + +#endif // BCVIEW_H diff --git a/src/frontends/controllers/ButtonController.tmpl b/src/frontends/controllers/BCView.tmpl similarity index 84% rename from src/frontends/controllers/ButtonController.tmpl rename to src/frontends/controllers/BCView.tmpl index a53af6c248..e97a1d2f92 100644 --- a/src/frontends/controllers/ButtonController.tmpl +++ b/src/frontends/controllers/BCView.tmpl @@ -15,12 +15,15 @@ * see, e.g., xforms/xformsBC.C */ -#include "ButtonController.h" +#include "BCView.h" +#include "ButtonPolicies.h" #include "debug.h" template -GuiBC::GuiBC(string const & cancel, string const & close) - : ButtonControllerBase(cancel, close), +GuiBC::GuiBC(ButtonController const & parent, + string const & cancel, string const & close) + : BCView(parent), + cancel_label_(cancel), close_label_(close), okay_(0), apply_(0), cancel_(0), restore_(0) {} @@ -70,10 +73,3 @@ void GuiBC::refreshReadOnly() setWidgetEnabled(*iter, enable); } } - - -template -ButtonController::ButtonController(string const & cancel, - string const & close) - : GUIBC(cancel, close) -{} diff --git a/src/frontends/controllers/ButtonController.C b/src/frontends/controllers/ButtonController.C new file mode 100644 index 0000000000..ea9c96d7db --- /dev/null +++ b/src/frontends/controllers/ButtonController.C @@ -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 +#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); +} diff --git a/src/frontends/controllers/ButtonController.h b/src/frontends/controllers/ButtonController.h index 53100c2b71..6fc1f967d9 100644 --- a/src/frontends/controllers/ButtonController.h +++ b/src/frontends/controllers/ButtonController.h @@ -5,8 +5,6 @@ * 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 */ @@ -15,72 +13,71 @@ #define BUTTONCONTROLLER_H -#include "ButtonControllerBase.h" -#include "gettext.h" -#include +#include "ButtonPolicies.h" -/** A templatised instantiation of the ButtonController requiring the - * gui-frontend widgets. - * The template declarations are in ButtonController.tmpl, which should - * be #included in the gui-frontend BC class, see e.g. xforms/xformsBC.C +#include "LString.h" +#include + + +/** 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 . + * This class stripped of xforms-specific code by + * Angus Leeming */ -template -class GuiBC : public ButtonControllerBase { +class BCView; + +class ButtonController : boost::noncopyable { 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 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(); } + void view(BCView *); - /// 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(); - /// Refresh the status of any widgets in the read_only list + /// void refreshReadOnly(); + + /// Passthrough function -- returns its input value + bool readOnly(bool = true); + /// + void readWrite(); + + /// + void valid(bool = true); + /// + void invalid(); + 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; - - Button * okay_; - Button * apply_; - Button * cancel_; - Button * restore_; - - typedef std::list Widgets; - Widgets read_only_; + /// + boost::scoped_ptr bp_; + /// + boost::scoped_ptr view_; }; - -template -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 diff --git a/src/frontends/controllers/ButtonControllerBase.C b/src/frontends/controllers/ButtonControllerBase.C deleted file mode 100644 index d35c4d6954..0000000000 --- a/src/frontends/controllers/ButtonControllerBase.C +++ /dev/null @@ -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 -#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; -} diff --git a/src/frontends/controllers/ButtonControllerBase.h b/src/frontends/controllers/ButtonControllerBase.h deleted file mode 100644 index 45c6a75e5a..0000000000 --- a/src/frontends/controllers/ButtonControllerBase.h +++ /dev/null @@ -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 -#include - -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 . - * This abstract base class stripped of xforms-specific code by - * Angus Leeming - */ -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 checked_widget_ptr; - typedef std::list checked_widget_list; - /// - checked_widget_list checked_widgets; -}; - -#endif // BUTTONCONTROLLERBASE_H diff --git a/src/frontends/controllers/ChangeLog b/src/frontends/controllers/ChangeLog index fd2a544242..4579834a2b 100644 --- a/src/frontends/controllers/ChangeLog +++ b/src/frontends/controllers/ChangeLog @@ -1,3 +1,16 @@ +2003-03-09 Angus Leeming + + 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 * ControlChanges.[Ch]: rewrite to use the Dialog-based scheme. diff --git a/src/frontends/controllers/ControlButtons.C b/src/frontends/controllers/ControlButtons.C index 43b72ea9bd..cf3745f1f3 100644 --- a/src/frontends/controllers/ControlButtons.C +++ b/src/frontends/controllers/ControlButtons.C @@ -12,14 +12,20 @@ #include "ControlButtons.h" -#include "ButtonControllerBase.h" +#include "ButtonController.h" +#include "BCView.h" #include "ViewBase.h" #include "lyxrc.h" #include "support/LAssert.h" 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_); - return *bc_ptr_; + lyx::Assert(bc_ptr_.get()); + return *bc_ptr_.get(); } @@ -78,9 +84,3 @@ void ControlButtons::setView(ViewBase & v) { view_ptr_ = &v; } - - -void ControlButtons::setButtonController(ButtonControllerBase & bc) -{ - bc_ptr_ = &bc; -} diff --git a/src/frontends/controllers/ControlButtons.h b/src/frontends/controllers/ControlButtons.h index f9ebcff63d..68119bdc57 100644 --- a/src/frontends/controllers/ControlButtons.h +++ b/src/frontends/controllers/ControlButtons.h @@ -28,9 +28,10 @@ #include +#include class ViewBase; -class ButtonControllerBase; +class ButtonController; /** Abstract base class for Controllers with a ButtonController. */ @@ -39,7 +40,7 @@ public: /// ControlButtons(); /// - virtual ~ControlButtons() {} + virtual ~ControlButtons(); /** These functions are called by the view when the appropriate buttons * are pressed. @@ -57,12 +58,10 @@ public: bool IconifyWithMain() const; /// - ButtonControllerBase & bc(); + ButtonController & bc(); /// void setView(ViewBase &); - /// - void setButtonController(ButtonControllerBase &); /** When Applying it's useful to know whether the dialog is about to close or not (no point refreshing the display for example). */ bool isClosing() const { return is_closing_; } @@ -84,9 +83,9 @@ protected: private: /// bool is_closing_; - /// We own neither of these pointers. - ButtonControllerBase * bc_ptr_; /// + boost::scoped_ptr bc_ptr_; + /// We do not own this pointer. ViewBase * view_ptr_; }; diff --git a/src/frontends/controllers/ControlChanges.C b/src/frontends/controllers/ControlChanges.C index 89b2a7fb83..96f744c9ad 100644 --- a/src/frontends/controllers/ControlChanges.C +++ b/src/frontends/controllers/ControlChanges.C @@ -17,7 +17,6 @@ #include "BufferView.h" #include "funcrequest.h" #include "lyxfind.h" -#include "lyxfunc.h" #include "author.h" #include "support/lstrings.h" diff --git a/src/frontends/controllers/ControlCharacter.C b/src/frontends/controllers/ControlCharacter.C index 2485e97c71..b593ec008d 100644 --- a/src/frontends/controllers/ControlCharacter.C +++ b/src/frontends/controllers/ControlCharacter.C @@ -14,7 +14,7 @@ #include "ControlCharacter.h" #include "ViewBase.h" -#include "ButtonControllerBase.h" +#include "ButtonController.h" #include "buffer.h" #include "bufferview_funcs.h" // ToggleAndShow diff --git a/src/frontends/controllers/ControlDialog.tmpl b/src/frontends/controllers/ControlDialog.tmpl index dffa2e7ecc..8777673d71 100644 --- a/src/frontends/controllers/ControlDialog.tmpl +++ b/src/frontends/controllers/ControlDialog.tmpl @@ -14,7 +14,7 @@ #include "ControlDialog.h" -#include "ButtonControllerBase.h" +#include "ButtonController.h" #include "ViewBase.h" diff --git a/src/frontends/controllers/ControlDocument.C b/src/frontends/controllers/ControlDocument.C index 8d4be13af9..d4fe5a5271 100644 --- a/src/frontends/controllers/ControlDocument.C +++ b/src/frontends/controllers/ControlDocument.C @@ -29,6 +29,7 @@ #include "frontends/LyXView.h" #include "frontends/Alert.h" +#include "support/LAssert.h" #include "support/lstrings.h" #include "support/filetools.h" diff --git a/src/frontends/controllers/ControlMath.C b/src/frontends/controllers/ControlMath.C index 10016e9f24..5be73f5e54 100644 --- a/src/frontends/controllers/ControlMath.C +++ b/src/frontends/controllers/ControlMath.C @@ -14,6 +14,8 @@ #include "ControlMath.h" #include "ViewBase.h" +#include "BCView.h" + #include "debug.h" #include "funcrequest.h" @@ -50,12 +52,13 @@ void ControlMath::insertSymbol(string const & sym, bool bs) const void ControlMath::addDaughter(void * key, ViewBase * v, - ButtonControllerBase * bc) + BCView * bcview, ButtonPolicy * bcpolicy) { if (daughters_.find(key) != daughters_.end()) 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, ControlMath const & p, ViewBase * v, - ButtonControllerBase * bc) - : controller_(lv, d, p), bc_(bc), view_(v) + BCView * bcview, + ButtonPolicy * bcpolicy) + : controller_(lv, d, p), view_(v) { controller_.setView(*view_); - controller_.setButtonController(*bc_); view_->setController(controller_); + controller_.bc().view(bcview); + controller_.bc().bp(bcpolicy); } diff --git a/src/frontends/controllers/ControlMath.h b/src/frontends/controllers/ControlMath.h index bc48caf4bb..346540dea0 100644 --- a/src/frontends/controllers/ControlMath.h +++ b/src/frontends/controllers/ControlMath.h @@ -18,7 +18,6 @@ #include "ControlDialog_impl.h" #include "ButtonController.h" -#include "ButtonPolicies.h" #include "LString.h" #include @@ -26,6 +25,7 @@ class GUIMathSub; +class BCView; class ControlMath : public ControlDialogBD { @@ -39,7 +39,8 @@ public: 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 *); @@ -86,7 +87,8 @@ public: GUIMathSub(LyXView & lv, Dialogs & d, ControlMath const & p, ViewBase * v, - ButtonControllerBase * bc); + BCView * bcview, + ButtonPolicy * bcpolicy); /// ControlMathSub & controller() { return controller_; } @@ -94,7 +96,7 @@ private: /// ControlMathSub controller_; /// - boost::scoped_ptr bc_; + boost::scoped_ptr bc_; /// boost::scoped_ptr view_; }; diff --git a/src/frontends/controllers/ControlParagraph.C b/src/frontends/controllers/ControlParagraph.C index 8dcc5886d8..4c4f51e621 100644 --- a/src/frontends/controllers/ControlParagraph.C +++ b/src/frontends/controllers/ControlParagraph.C @@ -14,7 +14,7 @@ #include "ControlParagraph.h" -#include "ButtonControllerBase.h" +#include "ButtonController.h" #include "ViewBase.h" #include "buffer.h" diff --git a/src/frontends/controllers/ControlPrint.C b/src/frontends/controllers/ControlPrint.C index d6fb502749..bcc51336dd 100644 --- a/src/frontends/controllers/ControlPrint.C +++ b/src/frontends/controllers/ControlPrint.C @@ -14,7 +14,7 @@ #include "ControlPrint.h" #include "ViewBase.h" -#include "ButtonControllerBase.h" +#include "ButtonController.h" #include "buffer.h" #include "gettext.h" diff --git a/src/frontends/controllers/ControlVCLog.C b/src/frontends/controllers/ControlVCLog.C index 0daeb89944..7048f79c3c 100644 --- a/src/frontends/controllers/ControlVCLog.C +++ b/src/frontends/controllers/ControlVCLog.C @@ -13,7 +13,7 @@ #include "ControlVCLog.h" -#include "ButtonControllerBase.h" +#include "ButtonController.h" #include "buffer.h" #include "lyxrc.h" #include "gettext.h" diff --git a/src/frontends/controllers/Dialog.C b/src/frontends/controllers/Dialog.C index f75686a950..29a4a141c7 100644 --- a/src/frontends/controllers/Dialog.C +++ b/src/frontends/controllers/Dialog.C @@ -13,12 +13,18 @@ #include "Dialog.h" -#include "ButtonControllerBase.h" +#include "ButtonController.h" +#include "BCView.h" #include "support/LAssert.h" 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()); 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) { lyx::Assert(i && !controller_ptr_.get()); diff --git a/src/frontends/controllers/Dialog.h b/src/frontends/controllers/Dialog.h index ef83ec5c14..e9200e4104 100644 --- a/src/frontends/controllers/Dialog.h +++ b/src/frontends/controllers/Dialog.h @@ -23,7 +23,7 @@ class LyXView; -class ButtonControllerBase; +class ButtonController; class Dialog : boost::noncopyable { @@ -32,6 +32,8 @@ public: * itself to the kernel. */ Dialog(LyXView &, string const & name); + /// + ~Dialog(); /// string const & name() const { return name_; } @@ -94,13 +96,11 @@ public: void setController(Controller *); /// void setView(View *); - /// - void setButtonController(ButtonControllerBase *); /// Controller & controller() const; /// - ButtonControllerBase & bc() const; + ButtonController & bc() const; /// View & view() const; //@} @@ -116,7 +116,7 @@ private: /// string name_; /// - boost::scoped_ptr bc_ptr_; + boost::scoped_ptr bc_ptr_; /// boost::scoped_ptr controller_ptr_; /// @@ -196,6 +196,11 @@ public: /// Controller const & getController() const { return p_.controller(); } + /// + ButtonController & bc() { return p_.bc(); } + /// + ButtonController const & bc() const { return p_.bc(); } + protected: /// Dialog & p_; diff --git a/src/frontends/controllers/GUI.h b/src/frontends/controllers/GUI.h index b8b364c9d1..2a1e7ebc77 100644 --- a/src/frontends/controllers/GUI.h +++ b/src/frontends/controllers/GUI.h @@ -12,7 +12,7 @@ #ifndef GUI_H #define GUI_H -#include "ButtonController.h" +#include "BCView.h" #include @@ -32,8 +32,6 @@ private: /// Controller controller_; /// - ButtonController bc_; - /// GUIview view_; }; @@ -45,8 +43,9 @@ GUI::GUI(LyXView & lv, Dialogs & d) view_() { controller_.setView(view_); - controller_.setButtonController(bc_); view_.setController(controller_); + controller_.bc().view(new GUIbc(controller_.bc())); + controller_.bc().bp(new Policy); } #endif // GUI_H diff --git a/src/frontends/controllers/Makefile.am b/src/frontends/controllers/Makefile.am index fee313842d..a6c195ccdc 100644 --- a/src/frontends/controllers/Makefile.am +++ b/src/frontends/controllers/Makefile.am @@ -5,7 +5,7 @@ noinst_LTLIBRARIES = libcontrollers.la INCLUDES = -I$(top_srcdir)/src \ $(BOOST_INCLUDES) -EXTRA_DIST = ButtonController.tmpl ControlDialog.tmpl +EXTRA_DIST = BCView.tmpl ControlDialog.tmpl libcontrollers_la_SOURCES= \ Dialog.C \ @@ -20,9 +20,10 @@ libcontrollers_la_SOURCES= \ frnt_lang.h \ tex_helpers.C \ tex_helpers.h \ + BCView.h \ + BCView.C \ + ButtonController.C \ ButtonController.h \ - ButtonControllerBase.C \ - ButtonControllerBase.h \ ButtonPolicies.C \ ButtonPolicies.h \ ControlAboutlyx.C \ @@ -102,6 +103,7 @@ libcontrollers_la_SOURCES= \ ControlWrap.h \ GUI.h \ ViewBase.h \ + ViewBase.C \ helper_funcs.C \ helper_funcs.h diff --git a/src/frontends/controllers/ViewBase.C b/src/frontends/controllers/ViewBase.C new file mode 100644 index 0000000000..a4cfa84b0c --- /dev/null +++ b/src/frontends/controllers/ViewBase.C @@ -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 + +#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(); +} diff --git a/src/frontends/controllers/ViewBase.h b/src/frontends/controllers/ViewBase.h index a3c3217a15..dd5994e556 100644 --- a/src/frontends/controllers/ViewBase.h +++ b/src/frontends/controllers/ViewBase.h @@ -12,17 +12,15 @@ #ifndef VIEWBASE_H #define VIEWBASE_H -#include "support/LAssert.h" +class ControlButtons; +class ButtonController; #include -class ControlButtons; - - class ViewBase : boost::noncopyable { public: /// - ViewBase() : controller_ptr_(0) {} + ViewBase(); /// virtual ~ViewBase() {} @@ -50,22 +48,17 @@ public: /** This should be set by the GUI class that owns both the controller * and the view */ - void setController(ControlButtons & c) { controller_ptr_ = &c; } + void setController(ControlButtons &); /// - ControlButtons & getController() { - lyx::Assert(controller_ptr_); - return *controller_ptr_; - } + ControlButtons & getController(); /// - ControlButtons const & getController() const { - lyx::Assert(controller_ptr_); - return *controller_ptr_; - } + ControlButtons const & getController() const; + /// + ButtonController & bc(); protected: /// We don't own this. ControlButtons * controller_ptr_; }; - #endif // VIEWBASE_H diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index 421c612886..471776a95f 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,3 +1,8 @@ +2003-03-09 Angus Leeming + + * lots of files: changes associated with the clean-up of the + ButtonController. + 2003-03-09 Angus Leeming * Dialogs.C: diff --git a/src/frontends/qt2/Dialogs.C b/src/frontends/qt2/Dialogs.C index 7175f4d4e1..bd466b5398 100644 --- a/src/frontends/qt2/Dialogs.C +++ b/src/frontends/qt2/Dialogs.C @@ -11,6 +11,7 @@ #include #include "Dialogs_impl.h" +#include "ButtonController.h" void Dialogs::init_pimpl() diff --git a/src/frontends/qt2/Dialogs3.C b/src/frontends/qt2/Dialogs3.C index a6b1ceb8d7..709a862c49 100644 --- a/src/frontends/qt2/Dialogs3.C +++ b/src/frontends/qt2/Dialogs3.C @@ -78,18 +78,6 @@ #include "qt_helpers.h" -typedef ButtonController - OkCancelBC; - -typedef ButtonController - OkCancelReadOnlyBC; - -typedef ButtonController - OkApplyCancelReadOnlyBC; - -typedef ButtonController - NoRepeatedApplyReadOnlyBC; - namespace { char const * const dialognames[] = { "about", "bibitem", "bibtex", "changes", @@ -127,91 +115,92 @@ Dialog * Dialogs::build(string const & name) return 0; Dialog * dialog = new Dialog(lyxview_, name); + dialog->bc().view(new Qt2BC(dialog->bc())); if (name == "about") { dialog->setController(new ControlAboutlyx(*dialog)); dialog->setView(new QAbout(*dialog)); - dialog->setButtonController(new OkCancelBC); + dialog->bc().bp(new OkCancelPolicy); } else if (name == "bibitem") { dialog->setController(new ControlCommand(*dialog, name)); dialog->setView(new QBibitem(*dialog)); - dialog->setButtonController(new OkCancelReadOnlyBC); + dialog->bc().bp(new OkCancelReadOnlyPolicy); } else if (name == "bibtex") { dialog->setController(new ControlBibtex(*dialog)); dialog->setView(new QBibtex(*dialog)); - dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); + dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy); } else if (name == "changes") { dialog->setController(new ControlChanges(*dialog)); dialog->setView(new QChanges(*dialog)); - dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); + dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy); } else if (name == "citation") { dialog->setController(new ControlCitation(*dialog)); dialog->setView(new QCitation(*dialog)); - dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); + dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy); } else if (name == "error") { dialog->setController(new ControlError(*dialog)); dialog->setView(new QError(*dialog)); - dialog->setButtonController(new OkCancelBC); + dialog->bc().bp(new OkCancelPolicy); } else if (name == "ert") { dialog->setController(new ControlERT(*dialog)); dialog->setView(new QERT(*dialog)); - dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); + dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy); } else if (name == "external") { dialog->setController(new ControlExternal(*dialog)); dialog->setView(new QExternal(*dialog)); - dialog->setButtonController(new OkApplyCancelReadOnlyBC); + dialog->bc().bp(new OkApplyCancelReadOnlyPolicy); } else if (name == "float") { dialog->setController(new ControlFloat(*dialog)); dialog->setView(new QFloat(*dialog)); - dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); + dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy); } else if (name == "graphics") { dialog->setController(new ControlGraphics(*dialog)); dialog->setView(new QGraphics(*dialog)); - dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); + dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy); } else if (name == "include") { dialog->setController(new ControlInclude(*dialog)); dialog->setView(new QInclude(*dialog)); - dialog->setButtonController(new OkApplyCancelReadOnlyBC); + dialog->bc().bp(new OkApplyCancelReadOnlyPolicy); } else if (name == "index") { dialog->setController(new ControlCommand(*dialog, name)); dialog->setView(new QIndex(*dialog, qt_("LyX: Insert Index Entry"), qt_("&Keyword"))); - dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); + dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy); } else if (name == "label") { dialog->setController(new ControlCommand(*dialog, name)); dialog->setView(new QIndex(*dialog, qt_("LyX: Insert Label"), qt_("&Label"))); - dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); + dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy); } else if (name == "minipage") { dialog->setController(new ControlMinipage(*dialog)); dialog->setView(new QMinipage(*dialog)); - dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); + dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy); } else if (name == "ref") { dialog->setController(new ControlRef(*dialog)); dialog->setView(new QRef(*dialog)); - dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); + dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy); } else if (name == "tabular") { dialog->setController(new ControlTabular(*dialog)); dialog->setView(new QTabular(*dialog)); - dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); + dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy); } else if (name == "tabularcreate") { dialog->setController(new ControlTabularCreate(*dialog)); dialog->setView(new QTabularCreate(*dialog)); - dialog->setButtonController(new OkApplyCancelReadOnlyBC); + dialog->bc().bp(new OkApplyCancelReadOnlyPolicy); } else if (name == "toc") { dialog->setController(new ControlToc(*dialog)); dialog->setView(new QToc(*dialog)); - dialog->setButtonController(new OkCancelBC); + dialog->bc().bp(new OkCancelPolicy); } else if (name == "url") { dialog->setController(new ControlCommand(*dialog, name)); dialog->setView(new QURL(*dialog)); - dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); + dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy); } else if (name == "wrap") { dialog->setController(new ControlWrap(*dialog)); dialog->setView(new QWrap(*dialog)); - dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); + dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy); } return dialog; diff --git a/src/frontends/qt2/QAbout.C b/src/frontends/qt2/QAbout.C index b464e4054f..a336c620ad 100644 --- a/src/frontends/qt2/QAbout.C +++ b/src/frontends/qt2/QAbout.C @@ -16,7 +16,7 @@ #include "debug.h" #include "qt_helpers.h" #include "LyXView.h" -#include "ButtonControllerBase.h" +#include "ButtonController.h" #include "ControlAboutlyx.h" #include @@ -106,6 +106,6 @@ void QAbout::build_dialog() dialog_->setMinimumSize(dialog_->sizeHint()); // Manage the cancel/close button - bc().setCancel(dialog_->closePB); + bcview().setCancel(dialog_->closePB); bc().refresh(); } diff --git a/src/frontends/qt2/QBibitem.C b/src/frontends/qt2/QBibitem.C index cb8c61cc6e..baaad5e1e1 100644 --- a/src/frontends/qt2/QBibitem.C +++ b/src/frontends/qt2/QBibitem.C @@ -37,10 +37,10 @@ void QBibitem::build_dialog() { dialog_.reset(new QBibitemDialog(this)); - bc().setOK(dialog_->okPB); - bc().setCancel(dialog_->closePB); - bc().addReadOnly(dialog_->keyED); - bc().addReadOnly(dialog_->labelED); + bcview().setOK(dialog_->okPB); + bcview().setCancel(dialog_->closePB); + bcview().addReadOnly(dialog_->keyED); + bcview().addReadOnly(dialog_->labelED); } diff --git a/src/frontends/qt2/QBibtex.C b/src/frontends/qt2/QBibtex.C index 3beb7eba33..ba737b88d7 100644 --- a/src/frontends/qt2/QBibtex.C +++ b/src/frontends/qt2/QBibtex.C @@ -46,15 +46,15 @@ void QBibtex::build_dialog() { dialog_.reset(new QBibtexDialog(this)); - bc().setOK(dialog_->okPB); - bc().setCancel(dialog_->closePB); - bc().addReadOnly(dialog_->databaseLB); - bc().addReadOnly(dialog_->databasePB); - bc().addReadOnly(dialog_->stylePB); - bc().addReadOnly(dialog_->styleCB); - bc().addReadOnly(dialog_->bibtocCB); - bc().addReadOnly(dialog_->databasePB); - bc().addReadOnly(dialog_->deletePB); + bcview().setOK(dialog_->okPB); + bcview().setCancel(dialog_->closePB); + bcview().addReadOnly(dialog_->databaseLB); + bcview().addReadOnly(dialog_->databasePB); + bcview().addReadOnly(dialog_->stylePB); + bcview().addReadOnly(dialog_->styleCB); + bcview().addReadOnly(dialog_->bibtocCB); + bcview().addReadOnly(dialog_->databasePB); + bcview().addReadOnly(dialog_->deletePB); } diff --git a/src/frontends/qt2/QChanges.C b/src/frontends/qt2/QChanges.C index 12e64834e0..98e2e3f4a6 100644 --- a/src/frontends/qt2/QChanges.C +++ b/src/frontends/qt2/QChanges.C @@ -33,9 +33,9 @@ void QChanges::build_dialog() { dialog_.reset(new QChangesDialog(this)); - bc().setCancel(dialog_->closePB); - bc().addReadOnly(dialog_->acceptPB); - bc().addReadOnly(dialog_->rejectPB); + bcview().setCancel(dialog_->closePB); + bcview().addReadOnly(dialog_->acceptPB); + bcview().addReadOnly(dialog_->rejectPB); } diff --git a/src/frontends/qt2/QCharacter.C b/src/frontends/qt2/QCharacter.C index 8b4ed13f8a..dac9c882f3 100644 --- a/src/frontends/qt2/QCharacter.C +++ b/src/frontends/qt2/QCharacter.C @@ -80,18 +80,18 @@ void QCharacter::build_dialog() dialog_->langCO->insertItem(toqstr(cit->first), -1); } - bc().setOK(dialog_->okPB); - bc().setApply(dialog_->applyPB); - bc().setCancel(dialog_->closePB); - bc().addReadOnly(dialog_->familyCO); - bc().addReadOnly(dialog_->seriesCO); - bc().addReadOnly(dialog_->sizeCO); - bc().addReadOnly(dialog_->shapeCO); - bc().addReadOnly(dialog_->miscCO); - bc().addReadOnly(dialog_->langCO); - bc().addReadOnly(dialog_->colorCO); - bc().addReadOnly(dialog_->toggleallCB); - bc().addReadOnly(dialog_->autoapplyCB); + bcview().setOK(dialog_->okPB); + bcview().setApply(dialog_->applyPB); + bcview().setCancel(dialog_->closePB); + bcview().addReadOnly(dialog_->familyCO); + bcview().addReadOnly(dialog_->seriesCO); + bcview().addReadOnly(dialog_->sizeCO); + bcview().addReadOnly(dialog_->shapeCO); + bcview().addReadOnly(dialog_->miscCO); + bcview().addReadOnly(dialog_->langCO); + bcview().addReadOnly(dialog_->colorCO); + bcview().addReadOnly(dialog_->toggleallCB); + bcview().addReadOnly(dialog_->autoapplyCB); } diff --git a/src/frontends/qt2/QCitation.C b/src/frontends/qt2/QCitation.C index 293b9d88eb..33112e529e 100644 --- a/src/frontends/qt2/QCitation.C +++ b/src/frontends/qt2/QCitation.C @@ -83,21 +83,21 @@ void QCitation::build_dialog() dialog_->searchCaseCB->setChecked(false); // Manage the ok, apply, restore and cancel/close buttons - bc().setOK(dialog_->okPB); - bc().setApply(dialog_->applyPB); - bc().setCancel(dialog_->closePB); - bc().setRestore(dialog_->restorePB); + bcview().setOK(dialog_->okPB); + bcview().setApply(dialog_->applyPB); + bcview().setCancel(dialog_->closePB); + bcview().setRestore(dialog_->restorePB); - bc().addReadOnly(dialog_->addPB); - bc().addReadOnly(dialog_->delPB); - bc().addReadOnly(dialog_->upPB); - bc().addReadOnly(dialog_->downPB); - bc().addReadOnly(dialog_->citationStyleCO); - bc().addReadOnly(dialog_->forceuppercaseCB); - bc().addReadOnly(dialog_->fulllistCB); + bcview().addReadOnly(dialog_->addPB); + bcview().addReadOnly(dialog_->delPB); + bcview().addReadOnly(dialog_->upPB); + bcview().addReadOnly(dialog_->downPB); + bcview().addReadOnly(dialog_->citationStyleCO); + bcview().addReadOnly(dialog_->forceuppercaseCB); + bcview().addReadOnly(dialog_->fulllistCB); // add when enabled ! - //bc().addReadOnly(dialog_->textBeforeED); - bc().addReadOnly(dialog_->textAfterED); + //bcview().addReadOnly(dialog_->textBeforeED); + bcview().addReadOnly(dialog_->textAfterED); } diff --git a/src/frontends/qt2/QDialogView.C b/src/frontends/qt2/QDialogView.C index 90de427ecb..d2fee7a643 100644 --- a/src/frontends/qt2/QDialogView.C +++ b/src/frontends/qt2/QDialogView.C @@ -18,6 +18,7 @@ #include "QtLyXView.h" #include "QDialogView.h" #include "Qt2BC.h" +#include "ButtonController.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(dialog().bc()); + return static_cast(dialog().bc().view()); } diff --git a/src/frontends/qt2/QDialogView.h b/src/frontends/qt2/QDialogView.h index a4ae9b9177..c2ab533e46 100644 --- a/src/frontends/qt2/QDialogView.h +++ b/src/frontends/qt2/QDialogView.h @@ -56,7 +56,7 @@ protected: virtual bool isValid(); /// - Qt2BC & bc(); + Qt2BC & bcview(); /// are we updating ? bool updating_; diff --git a/src/frontends/qt2/QDocument.C b/src/frontends/qt2/QDocument.C index ae3fb57819..358b1f0e3b 100644 --- a/src/frontends/qt2/QDocument.C +++ b/src/frontends/qt2/QDocument.C @@ -158,10 +158,10 @@ void QDocument::build_dialog() dialog_->setMargins(0); // Manage the restore, ok, apply, restore and cancel/close buttons - bc().setOK(dialog_->okPB); - bc().setApply(dialog_->applyPB); - bc().setCancel(dialog_->closePB); - bc().setRestore(dialog_->restorePB); + bcview().setOK(dialog_->okPB); + bcview().setApply(dialog_->applyPB); + bcview().setCancel(dialog_->closePB); + bcview().setRestore(dialog_->restorePB); } diff --git a/src/frontends/qt2/QERT.C b/src/frontends/qt2/QERT.C index 12ea8be4dd..fb92bac635 100644 --- a/src/frontends/qt2/QERT.C +++ b/src/frontends/qt2/QERT.C @@ -34,8 +34,8 @@ void QERT::build_dialog() { dialog_.reset(new QERTDialog(this)); - bc().setOK(dialog_->okPB); - bc().setCancel(dialog_->closePB); + bcview().setOK(dialog_->okPB); + bcview().setCancel(dialog_->closePB); } diff --git a/src/frontends/qt2/QError.C b/src/frontends/qt2/QError.C index 46748760cb..09e9b65d4d 100644 --- a/src/frontends/qt2/QError.C +++ b/src/frontends/qt2/QError.C @@ -34,7 +34,7 @@ void QError::build_dialog() { dialog_.reset(new QErrorDialog(this)); - bc().setCancel(dialog_->closePB); + bcview().setCancel(dialog_->closePB); } diff --git a/src/frontends/qt2/QExternal.C b/src/frontends/qt2/QExternal.C index fe43270ddc..dfde08ec85 100644 --- a/src/frontends/qt2/QExternal.C +++ b/src/frontends/qt2/QExternal.C @@ -38,12 +38,12 @@ void QExternal::build_dialog() { dialog_.reset(new QExternalDialog(this)); - bc().setOK(dialog_->okPB); - bc().setApply(dialog_->applyPB); - bc().setCancel(dialog_->closePB); - bc().addReadOnly(dialog_->externalCO); - bc().addReadOnly(dialog_->fileED); - bc().addReadOnly(dialog_->browsePB); + bcview().setOK(dialog_->okPB); + bcview().setApply(dialog_->applyPB); + bcview().setCancel(dialog_->closePB); + bcview().addReadOnly(dialog_->externalCO); + bcview().addReadOnly(dialog_->fileED); + bcview().addReadOnly(dialog_->browsePB); std::vector templates(controller().getTemplates()); diff --git a/src/frontends/qt2/QFloat.C b/src/frontends/qt2/QFloat.C index 7385809f74..bec143567b 100644 --- a/src/frontends/qt2/QFloat.C +++ b/src/frontends/qt2/QFloat.C @@ -35,19 +35,19 @@ void QFloat::build_dialog() { dialog_.reset(new QFloatDialog(this)); - bc().setCancel(dialog_->closePB); - bc().setApply(dialog_->applyPB); - bc().setOK(dialog_->okPB); - bc().setRestore(dialog_->restorePB); + bcview().setCancel(dialog_->closePB); + bcview().setApply(dialog_->applyPB); + bcview().setOK(dialog_->okPB); + bcview().setRestore(dialog_->restorePB); - bc().addReadOnly(dialog_->topCB); - bc().addReadOnly(dialog_->bottomCB); - bc().addReadOnly(dialog_->herepossiblyCB); - bc().addReadOnly(dialog_->heredefinitelyCB); - bc().addReadOnly(dialog_->pageCB); - bc().addReadOnly(dialog_->ignoreCB); - bc().addReadOnly(dialog_->defaultsCB); - bc().addReadOnly(dialog_->spanCB); + bcview().addReadOnly(dialog_->topCB); + bcview().addReadOnly(dialog_->bottomCB); + bcview().addReadOnly(dialog_->herepossiblyCB); + bcview().addReadOnly(dialog_->heredefinitelyCB); + bcview().addReadOnly(dialog_->pageCB); + bcview().addReadOnly(dialog_->ignoreCB); + bcview().addReadOnly(dialog_->defaultsCB); + bcview().addReadOnly(dialog_->spanCB); } diff --git a/src/frontends/qt2/QGraphics.C b/src/frontends/qt2/QGraphics.C index f644acb7fe..1884242d86 100644 --- a/src/frontends/qt2/QGraphics.C +++ b/src/frontends/qt2/QGraphics.C @@ -56,45 +56,45 @@ void QGraphics::build_dialog() { dialog_.reset(new QGraphicsDialog(this)); - bc().setOK(dialog_->okPB); - bc().setApply(dialog_->applyPB); - bc().setRestore(dialog_->restorePB); - bc().setCancel(dialog_->closePB); + bcview().setOK(dialog_->okPB); + bcview().setApply(dialog_->applyPB); + bcview().setRestore(dialog_->restorePB); + bcview().setCancel(dialog_->closePB); - bc().addReadOnly(dialog_->rotateGB); - bc().addReadOnly(dialog_->latexoptions); - bc().addReadOnly(dialog_->subfigure); - bc().addReadOnly(dialog_->subcaption); - bc().addReadOnly(dialog_->filenameL); - bc().addReadOnly(dialog_->filename); - bc().addReadOnly(dialog_->browsePB); - bc().addReadOnly(dialog_->unzipCB); - bc().addReadOnly(dialog_->filename); - bc().addReadOnly(dialog_->lbX); - bc().addReadOnly(dialog_->lbY); - bc().addReadOnly(dialog_->rtX); - bc().addReadOnly(dialog_->rtY); - bc().addReadOnly(dialog_->lbXunit); - bc().addReadOnly(dialog_->lbYunit); - bc().addReadOnly(dialog_->rtXunit); - bc().addReadOnly(dialog_->rtYunit); - bc().addReadOnly(dialog_->draftCB); - bc().addReadOnly(dialog_->clip); - bc().addReadOnly(dialog_->unzipCB); - bc().addReadOnly(dialog_->subfigure); - bc().addReadOnly(dialog_->subcaption); - bc().addReadOnly(dialog_->showCB); - bc().addReadOnly(dialog_->width); - bc().addReadOnly(dialog_->height); - bc().addReadOnly(dialog_->displayCB); - bc().addReadOnly(dialog_->displayscale); - bc().addReadOnly(dialog_->widthUnit); - bc().addReadOnly(dialog_->heightUnit); - bc().addReadOnly(dialog_->aspectratio); - bc().addReadOnly(dialog_->angle); - bc().addReadOnly(dialog_->origin); - bc().addReadOnly(dialog_->latexoptions); - bc().addReadOnly(dialog_->getPB); + bcview().addReadOnly(dialog_->rotateGB); + bcview().addReadOnly(dialog_->latexoptions); + bcview().addReadOnly(dialog_->subfigure); + bcview().addReadOnly(dialog_->subcaption); + bcview().addReadOnly(dialog_->filenameL); + bcview().addReadOnly(dialog_->filename); + bcview().addReadOnly(dialog_->browsePB); + bcview().addReadOnly(dialog_->unzipCB); + bcview().addReadOnly(dialog_->filename); + bcview().addReadOnly(dialog_->lbX); + bcview().addReadOnly(dialog_->lbY); + bcview().addReadOnly(dialog_->rtX); + bcview().addReadOnly(dialog_->rtY); + bcview().addReadOnly(dialog_->lbXunit); + bcview().addReadOnly(dialog_->lbYunit); + bcview().addReadOnly(dialog_->rtXunit); + bcview().addReadOnly(dialog_->rtYunit); + bcview().addReadOnly(dialog_->draftCB); + bcview().addReadOnly(dialog_->clip); + bcview().addReadOnly(dialog_->unzipCB); + bcview().addReadOnly(dialog_->subfigure); + bcview().addReadOnly(dialog_->subcaption); + bcview().addReadOnly(dialog_->showCB); + bcview().addReadOnly(dialog_->width); + bcview().addReadOnly(dialog_->height); + bcview().addReadOnly(dialog_->displayCB); + bcview().addReadOnly(dialog_->displayscale); + bcview().addReadOnly(dialog_->widthUnit); + bcview().addReadOnly(dialog_->heightUnit); + bcview().addReadOnly(dialog_->aspectratio); + bcview().addReadOnly(dialog_->angle); + bcview().addReadOnly(dialog_->origin); + bcview().addReadOnly(dialog_->latexoptions); + bcview().addReadOnly(dialog_->getPB); } diff --git a/src/frontends/qt2/QInclude.C b/src/frontends/qt2/QInclude.C index 352866a2e3..1c97d9c226 100644 --- a/src/frontends/qt2/QInclude.C +++ b/src/frontends/qt2/QInclude.C @@ -37,12 +37,12 @@ void QInclude::build_dialog() { dialog_.reset(new QIncludeDialog(this)); - bc().setOK(dialog_->okPB); - bc().setCancel(dialog_->closePB); - bc().addReadOnly(dialog_->filenameED); - bc().addReadOnly(dialog_->browsePB); - bc().addReadOnly(dialog_->visiblespaceCB); - bc().addReadOnly(dialog_->typeCO); + bcview().setOK(dialog_->okPB); + bcview().setCancel(dialog_->closePB); + bcview().addReadOnly(dialog_->filenameED); + bcview().addReadOnly(dialog_->browsePB); + bcview().addReadOnly(dialog_->visiblespaceCB); + bcview().addReadOnly(dialog_->typeCO); } diff --git a/src/frontends/qt2/QIndex.C b/src/frontends/qt2/QIndex.C index 2eceecf783..0f5e01aaca 100644 --- a/src/frontends/qt2/QIndex.C +++ b/src/frontends/qt2/QIndex.C @@ -17,6 +17,7 @@ #include "QIndexDialog.h" #include "QIndex.h" #include "Qt2BC.h" +#include "ButtonController.h" #include #include #include @@ -36,9 +37,9 @@ void QIndex::build_dialog() dialog_->keywordLA->setText(label_); - bc().setOK(dialog_->okPB); - bc().setCancel(dialog_->closePB); - bc().addReadOnly(dialog_->keywordED); + bcview().setOK(dialog_->okPB); + bcview().setCancel(dialog_->closePB); + bcview().addReadOnly(dialog_->keywordED); } diff --git a/src/frontends/qt2/QLog.C b/src/frontends/qt2/QLog.C index feb5bef3d2..b6dbfc0321 100644 --- a/src/frontends/qt2/QLog.C +++ b/src/frontends/qt2/QLog.C @@ -40,7 +40,7 @@ void QLog::build_dialog() { dialog_.reset(new QLogDialog(this)); - bc().setCancel(dialog_->closePB); + bcview().setCancel(dialog_->closePB); } diff --git a/src/frontends/qt2/QMinipage.C b/src/frontends/qt2/QMinipage.C index 7ab69fcfac..dcc807d458 100644 --- a/src/frontends/qt2/QMinipage.C +++ b/src/frontends/qt2/QMinipage.C @@ -39,14 +39,14 @@ void QMinipage::build_dialog() { dialog_.reset(new QMinipageDialog(this)); - bc().setRestore(dialog_->restorePB); - bc().setOK(dialog_->okPB); - bc().setApply(dialog_->applyPB); - bc().setCancel(dialog_->closePB); + bcview().setRestore(dialog_->restorePB); + bcview().setOK(dialog_->okPB); + bcview().setApply(dialog_->applyPB); + bcview().setCancel(dialog_->closePB); - bc().addReadOnly(dialog_->widthED); - bc().addReadOnly(dialog_->unitsLC); - bc().addReadOnly(dialog_->valignCO); + bcview().addReadOnly(dialog_->widthED); + bcview().addReadOnly(dialog_->unitsLC); + bcview().addReadOnly(dialog_->valignCO); } diff --git a/src/frontends/qt2/QParagraph.C b/src/frontends/qt2/QParagraph.C index ea298c7c20..fdf34ad6a0 100644 --- a/src/frontends/qt2/QParagraph.C +++ b/src/frontends/qt2/QParagraph.C @@ -67,11 +67,11 @@ void QParagraph::build_dialog() } // Manage the ok, apply, restore and cancel/close buttons - bc().setOK(dialog_->okPB); - bc().setApply(dialog_->applyPB); - bc().setCancel(dialog_->closePB); - bc().setRestore(dialog_->restorePB); - bc().addReadOnly(dialog_->paragraphTab); + bcview().setOK(dialog_->okPB); + bcview().setApply(dialog_->applyPB); + bcview().setCancel(dialog_->closePB); + bcview().setRestore(dialog_->restorePB); + bcview().addReadOnly(dialog_->paragraphTab); } diff --git a/src/frontends/qt2/QParagraph.h b/src/frontends/qt2/QParagraph.h index 4532eee7f5..305f56f03a 100644 --- a/src/frontends/qt2/QParagraph.h +++ b/src/frontends/qt2/QParagraph.h @@ -15,6 +15,7 @@ #include "Qt2Base.h" +#include "LString.h" #include class ControlParagraph; diff --git a/src/frontends/qt2/QPrefs.C b/src/frontends/qt2/QPrefs.C index 1ddf870d4e..e774d34a3b 100644 --- a/src/frontends/qt2/QPrefs.C +++ b/src/frontends/qt2/QPrefs.C @@ -71,10 +71,10 @@ void QPrefs::build_dialog() { dialog_.reset(new QPrefsDialog(this)); - bc().setOK(dialog_->savePB); - bc().setApply(dialog_->applyPB); - bc().setCancel(dialog_->closePB); - bc().setRestore(dialog_->restorePB); + bcview().setOK(dialog_->savePB); + bcview().setApply(dialog_->applyPB); + bcview().setCancel(dialog_->closePB); + bcview().setRestore(dialog_->restorePB); QPrefLanguageModule * langmod(dialog_->languageModule); diff --git a/src/frontends/qt2/QPrint.C b/src/frontends/qt2/QPrint.C index 276ad9e53a..8c9a4f7792 100644 --- a/src/frontends/qt2/QPrint.C +++ b/src/frontends/qt2/QPrint.C @@ -42,8 +42,8 @@ void QPrint::build_dialog() { dialog_.reset(new QLPrintDialog(this)); - bc().setOK(dialog_->printPB); - bc().setCancel(dialog_->closePB); + bcview().setOK(dialog_->printPB); + bcview().setCancel(dialog_->closePB); } diff --git a/src/frontends/qt2/QRef.C b/src/frontends/qt2/QRef.C index 797bfd089a..9cfc30233c 100644 --- a/src/frontends/qt2/QRef.C +++ b/src/frontends/qt2/QRef.C @@ -49,15 +49,15 @@ void QRef::build_dialog() { dialog_.reset(new QRefDialog(this)); - bc().setOK(dialog_->okPB); - bc().setApply(dialog_->applyPB); - bc().setCancel(dialog_->closePB); - bc().addReadOnly(dialog_->refsLB); - bc().addReadOnly(dialog_->sortCB); - bc().addReadOnly(dialog_->nameED); - bc().addReadOnly(dialog_->referenceED); - bc().addReadOnly(dialog_->typeCO); - bc().addReadOnly(dialog_->bufferCO); + bcview().setOK(dialog_->okPB); + bcview().setApply(dialog_->applyPB); + bcview().setCancel(dialog_->closePB); + bcview().addReadOnly(dialog_->refsLB); + bcview().addReadOnly(dialog_->sortCB); + bcview().addReadOnly(dialog_->nameED); + bcview().addReadOnly(dialog_->referenceED); + bcview().addReadOnly(dialog_->typeCO); + bcview().addReadOnly(dialog_->bufferCO); } diff --git a/src/frontends/qt2/QSearch.C b/src/frontends/qt2/QSearch.C index 9c2e66ba13..301ff1fe5e 100644 --- a/src/frontends/qt2/QSearch.C +++ b/src/frontends/qt2/QSearch.C @@ -37,13 +37,13 @@ void QSearch::build_dialog() { dialog_.reset(new QSearchDialog(this)); - bc().setCancel(dialog_->closePB); - bc().addReadOnly(dialog_->replaceCO); - bc().addReadOnly(dialog_->replacePB); - bc().addReadOnly(dialog_->replaceallPB); - bc().addReadOnly(dialog_->caseCB); - bc().addReadOnly(dialog_->wordsCB); - bc().addReadOnly(dialog_->backwardsCB); + bcview().setCancel(dialog_->closePB); + bcview().addReadOnly(dialog_->replaceCO); + bcview().addReadOnly(dialog_->replacePB); + bcview().addReadOnly(dialog_->replaceallPB); + bcview().addReadOnly(dialog_->caseCB); + bcview().addReadOnly(dialog_->wordsCB); + bcview().addReadOnly(dialog_->backwardsCB); dialog_->replacePB->setEnabled(false); dialog_->replaceallPB->setEnabled(false); diff --git a/src/frontends/qt2/QSendto.C b/src/frontends/qt2/QSendto.C index 22038d0b33..ba60678a9d 100644 --- a/src/frontends/qt2/QSendto.C +++ b/src/frontends/qt2/QSendto.C @@ -41,9 +41,9 @@ void QSendto::build_dialog() dialog_.reset(new QSendtoDialog(this)); // Manage the ok, apply, restore and cancel/close buttons - bc().setOK(dialog_->okPB); - bc().setApply(dialog_->applyPB); - bc().setCancel(dialog_->closePB); + bcview().setOK(dialog_->okPB); + bcview().setApply(dialog_->applyPB); + bcview().setCancel(dialog_->closePB); } diff --git a/src/frontends/qt2/QShowFile.C b/src/frontends/qt2/QShowFile.C index 6d8c92a681..924e9b4e6a 100644 --- a/src/frontends/qt2/QShowFile.C +++ b/src/frontends/qt2/QShowFile.C @@ -34,7 +34,7 @@ void QShowFile::build_dialog() { dialog_.reset(new QShowFileDialog(this)); - bc().setCancel(dialog_->closePB); + bcview().setCancel(dialog_->closePB); } diff --git a/src/frontends/qt2/QSpellchecker.C b/src/frontends/qt2/QSpellchecker.C index d0e57c75fb..cde1c18209 100644 --- a/src/frontends/qt2/QSpellchecker.C +++ b/src/frontends/qt2/QSpellchecker.C @@ -38,7 +38,7 @@ void QSpellchecker::build_dialog() { dialog_.reset(new QSpellcheckerDialog(this)); - bc().setCancel(dialog_->closePB); + bcview().setCancel(dialog_->closePB); dialog_->wordED->setReadOnly(true); } diff --git a/src/frontends/qt2/QTabular.C b/src/frontends/qt2/QTabular.C index da61f1aa31..3a620e3b16 100644 --- a/src/frontends/qt2/QTabular.C +++ b/src/frontends/qt2/QTabular.C @@ -22,6 +22,7 @@ #include "QTabularDialog.h" #include "QTabular.h" #include "Qt2BC.h" +#include "ButtonController.h" #include #include @@ -41,39 +42,39 @@ void QTabular::build_dialog() { dialog_.reset(new QTabularDialog(this)); - bc().setCancel(dialog_->closePB); + bcview().setCancel(dialog_->closePB); - bc().addReadOnly(dialog_->multicolumnCB); - bc().addReadOnly(dialog_->rotateCellCB); - bc().addReadOnly(dialog_->rotateTabularCB); - bc().addReadOnly(dialog_->specialAlignmentED); - bc().addReadOnly(dialog_->widthED); - bc().addReadOnly(dialog_->widthUnit); - bc().addReadOnly(dialog_->hAlignCB); - bc().addReadOnly(dialog_->vAlignCB); - bc().addReadOnly(dialog_->columnAddPB); - bc().addReadOnly(dialog_->columnDeletePB); - bc().addReadOnly(dialog_->rowAddPB); - bc().addReadOnly(dialog_->rowDeletePB); - bc().addReadOnly(dialog_->borderSetPB); - bc().addReadOnly(dialog_->borderUnsetPB); - bc().addReadOnly(dialog_->borders); - bc().addReadOnly(dialog_->longTabularCB); - bc().addReadOnly(dialog_->headerStatusCB); - bc().addReadOnly(dialog_->headerBorderAboveCB); - bc().addReadOnly(dialog_->headerBorderBelowCB); - bc().addReadOnly(dialog_->firstheaderStatusCB); - bc().addReadOnly(dialog_->firstheaderBorderAboveCB); - bc().addReadOnly(dialog_->firstheaderBorderBelowCB); - bc().addReadOnly(dialog_->firstheaderNoContentsCB); - bc().addReadOnly(dialog_->footerStatusCB); - bc().addReadOnly(dialog_->footerBorderAboveCB); - bc().addReadOnly(dialog_->footerBorderBelowCB); - bc().addReadOnly(dialog_->lastfooterStatusCB); - bc().addReadOnly(dialog_->lastfooterBorderAboveCB); - bc().addReadOnly(dialog_->lastfooterBorderBelowCB); - bc().addReadOnly(dialog_->lastfooterNoContentsCB); - bc().addReadOnly(dialog_->newpageCB); + bcview().addReadOnly(dialog_->multicolumnCB); + bcview().addReadOnly(dialog_->rotateCellCB); + bcview().addReadOnly(dialog_->rotateTabularCB); + bcview().addReadOnly(dialog_->specialAlignmentED); + bcview().addReadOnly(dialog_->widthED); + bcview().addReadOnly(dialog_->widthUnit); + bcview().addReadOnly(dialog_->hAlignCB); + bcview().addReadOnly(dialog_->vAlignCB); + bcview().addReadOnly(dialog_->columnAddPB); + bcview().addReadOnly(dialog_->columnDeletePB); + bcview().addReadOnly(dialog_->rowAddPB); + bcview().addReadOnly(dialog_->rowDeletePB); + bcview().addReadOnly(dialog_->borderSetPB); + bcview().addReadOnly(dialog_->borderUnsetPB); + bcview().addReadOnly(dialog_->borders); + bcview().addReadOnly(dialog_->longTabularCB); + bcview().addReadOnly(dialog_->headerStatusCB); + bcview().addReadOnly(dialog_->headerBorderAboveCB); + bcview().addReadOnly(dialog_->headerBorderBelowCB); + bcview().addReadOnly(dialog_->firstheaderStatusCB); + bcview().addReadOnly(dialog_->firstheaderBorderAboveCB); + bcview().addReadOnly(dialog_->firstheaderBorderBelowCB); + bcview().addReadOnly(dialog_->firstheaderNoContentsCB); + bcview().addReadOnly(dialog_->footerStatusCB); + bcview().addReadOnly(dialog_->footerBorderAboveCB); + bcview().addReadOnly(dialog_->footerBorderBelowCB); + bcview().addReadOnly(dialog_->lastfooterStatusCB); + bcview().addReadOnly(dialog_->lastfooterBorderAboveCB); + bcview().addReadOnly(dialog_->lastfooterBorderBelowCB); + bcview().addReadOnly(dialog_->lastfooterNoContentsCB); + bcview().addReadOnly(dialog_->newpageCB); } diff --git a/src/frontends/qt2/QTabularCreate.C b/src/frontends/qt2/QTabularCreate.C index 6cb5a47296..866dfddb8e 100644 --- a/src/frontends/qt2/QTabularCreate.C +++ b/src/frontends/qt2/QTabularCreate.C @@ -34,8 +34,8 @@ void QTabularCreate::build_dialog() { dialog_.reset(new QTabularCreateDialog(this)); - bc().setOK(dialog_->okPB); - bc().setCancel(dialog_->closePB); + bcview().setOK(dialog_->okPB); + bcview().setCancel(dialog_->closePB); } diff --git a/src/frontends/qt2/QTexinfo.C b/src/frontends/qt2/QTexinfo.C index 71f40a4d68..3833843818 100644 --- a/src/frontends/qt2/QTexinfo.C +++ b/src/frontends/qt2/QTexinfo.C @@ -42,7 +42,7 @@ void QTexinfo::build_dialog() updateStyles(ControlTexinfo::cls); - bc().setCancel(dialog_->closePB); + bcview().setCancel(dialog_->closePB); } diff --git a/src/frontends/qt2/QThesaurus.C b/src/frontends/qt2/QThesaurus.C index 70ffd921c5..88a53ec0d8 100644 --- a/src/frontends/qt2/QThesaurus.C +++ b/src/frontends/qt2/QThesaurus.C @@ -34,10 +34,10 @@ void QThesaurus::build_dialog() { dialog_.reset(new QThesaurusDialog(this)); - bc().setCancel(dialog_->closePB); - bc().setApply(dialog_->replacePB); - bc().addReadOnly(dialog_->replaceED); - bc().addReadOnly(dialog_->replacePB); + bcview().setCancel(dialog_->closePB); + bcview().setApply(dialog_->replacePB); + bcview().addReadOnly(dialog_->replaceED); + bcview().addReadOnly(dialog_->replacePB); } diff --git a/src/frontends/qt2/QToc.C b/src/frontends/qt2/QToc.C index 867b4a9419..d0fc232b48 100644 --- a/src/frontends/qt2/QToc.C +++ b/src/frontends/qt2/QToc.C @@ -45,7 +45,7 @@ void QToc::build_dialog() dialog_.reset(new QTocDialog(this)); // Manage the cancel/close button - bc().setCancel(dialog_->closePB); + bcview().setCancel(dialog_->closePB); } diff --git a/src/frontends/qt2/QURL.C b/src/frontends/qt2/QURL.C index 4201e4a82e..1fee2af643 100644 --- a/src/frontends/qt2/QURL.C +++ b/src/frontends/qt2/QURL.C @@ -17,6 +17,7 @@ #include "QURL.h" #include "QURLDialog.h" #include "Qt2BC.h" +#include "ButtonController.h" #include #include @@ -34,11 +35,11 @@ void QURL::build_dialog() { dialog_.reset(new QURLDialog(this)); - bc().setOK(dialog_->okPB); - bc().setCancel(dialog_->closePB); - bc().addReadOnly(dialog_->urlED); - bc().addReadOnly(dialog_->nameED); - bc().addReadOnly(dialog_->hyperlinkCB); + bcview().setOK(dialog_->okPB); + bcview().setCancel(dialog_->closePB); + bcview().addReadOnly(dialog_->urlED); + bcview().addReadOnly(dialog_->nameED); + bcview().addReadOnly(dialog_->hyperlinkCB); } diff --git a/src/frontends/qt2/QVCLog.C b/src/frontends/qt2/QVCLog.C index ed405a76ca..4645eaf963 100644 --- a/src/frontends/qt2/QVCLog.C +++ b/src/frontends/qt2/QVCLog.C @@ -38,7 +38,7 @@ void QVCLog::build_dialog() { dialog_.reset(new QVCLogDialog(this)); - bc().setCancel(dialog_->closePB); + bcview().setCancel(dialog_->closePB); } diff --git a/src/frontends/qt2/QWrap.C b/src/frontends/qt2/QWrap.C index c6080b7a6b..0e5dec9462 100644 --- a/src/frontends/qt2/QWrap.C +++ b/src/frontends/qt2/QWrap.C @@ -41,14 +41,14 @@ void QWrap::build_dialog() { dialog_.reset(new QWrapDialog(this)); - bc().setRestore(dialog_->restorePB); - bc().setOK(dialog_->okPB); - bc().setApply(dialog_->applyPB); - bc().setCancel(dialog_->closePB); + bcview().setRestore(dialog_->restorePB); + bcview().setOK(dialog_->okPB); + bcview().setApply(dialog_->applyPB); + bcview().setCancel(dialog_->closePB); - bc().addReadOnly(dialog_->widthED); - bc().addReadOnly(dialog_->unitsLC); - bc().addReadOnly(dialog_->valignCO); + bcview().addReadOnly(dialog_->widthED); + bcview().addReadOnly(dialog_->unitsLC); + bcview().addReadOnly(dialog_->valignCO); } diff --git a/src/frontends/qt2/Qt2BC.C b/src/frontends/qt2/Qt2BC.C index 40f900b913..a9e5a700fc 100644 --- a/src/frontends/qt2/Qt2BC.C +++ b/src/frontends/qt2/Qt2BC.C @@ -11,7 +11,6 @@ #include - #include "Qt2BC.h" #include "debug.h" #include "qt_helpers.h" @@ -20,8 +19,9 @@ #include -Qt2BC::Qt2BC(string const & cancel, string const & close) - : GuiBC(cancel, close) +Qt2BC::Qt2BC(ButtonController const & parent, + string const & cancel, string const & close) + : GuiBC(parent, cancel, close) {} diff --git a/src/frontends/qt2/Qt2BC.h b/src/frontends/qt2/Qt2BC.h index 4f9524dd3a..683c4dacf8 100644 --- a/src/frontends/qt2/Qt2BC.h +++ b/src/frontends/qt2/Qt2BC.h @@ -15,7 +15,8 @@ #define QT2BC_H -#include "ButtonController.h" +#include "BCView.h" +#include "gettext.h" class QWidget; class QButton; @@ -29,7 +30,8 @@ class QButton; class Qt2BC : public GuiBC { public: /// - Qt2BC(string const &, string const &); + Qt2BC(ButtonController const &, + string const & = _("Cancel"), string const & = _("Close")); private: /// Updates the button sensitivity (enabled/disabled) void setButtonEnabled(QButton *, bool enabled); diff --git a/src/frontends/qt2/Qt2Base.C b/src/frontends/qt2/Qt2Base.C index 44fe8c86dc..27ca0953b8 100644 --- a/src/frontends/qt2/Qt2Base.C +++ b/src/frontends/qt2/Qt2Base.C @@ -17,6 +17,7 @@ #include "QtLyXView.h" #include "Qt2Base.h" #include "Qt2BC.h" +#include "ButtonController.h" #include "ControlButtons.h" #include "support/LAssert.h" @@ -26,10 +27,10 @@ Qt2Base::Qt2Base(QString const & t) {} -Qt2BC & Qt2Base::bc() +Qt2BC & Qt2Base::bcview() { - return static_cast(getController().bc()); - // return dynamic_cast(getController().bc()); + return static_cast(bc().view()); + // return dynamic_cast(bc()); } diff --git a/src/frontends/qt2/Qt2Base.h b/src/frontends/qt2/Qt2Base.h index ca98ae6c42..e9f573b155 100644 --- a/src/frontends/qt2/Qt2Base.h +++ b/src/frontends/qt2/Qt2Base.h @@ -51,7 +51,7 @@ protected: virtual bool isValid(); /// - Qt2BC & bc(); + Qt2BC & bcview(); /// are we updating ? bool updating_; diff --git a/src/frontends/qt2/Toolbar_pimpl.C b/src/frontends/qt2/Toolbar_pimpl.C index b9ec240e3e..0c3bdc875e 100644 --- a/src/frontends/qt2/Toolbar_pimpl.C +++ b/src/frontends/qt2/Toolbar_pimpl.C @@ -14,6 +14,7 @@ #include "ToolbarDefaults.h" #include "debug.h" +#include "gettext.h" #include "lyxfunc.h" #include "FuncStatus.h" #include "BufferView.h" diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 541014829d..252fe1d293 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,8 @@ +2003-03-09 Angus Leeming + + * lots of files: changes associated with the clean-up of the + ButtonController. + 2003-03-09 Angus Leeming * Dialogs.C: diff --git a/src/frontends/xforms/Dialogs.C b/src/frontends/xforms/Dialogs.C index f7e615356b..63fc41a07f 100644 --- a/src/frontends/xforms/Dialogs.C +++ b/src/frontends/xforms/Dialogs.C @@ -11,6 +11,7 @@ #include #include "Dialogs_impl.h" +#include "ButtonController.h" void Dialogs::init_pimpl() diff --git a/src/frontends/xforms/Dialogs3.C b/src/frontends/xforms/Dialogs3.C index 82767197b8..8991456a32 100644 --- a/src/frontends/xforms/Dialogs3.C +++ b/src/frontends/xforms/Dialogs3.C @@ -76,19 +76,6 @@ #include "ButtonController.h" -typedef ButtonController - OkCancelBC; - -typedef ButtonController - OkCancelReadOnlyBC; - -typedef ButtonController - OkApplyCancelReadOnlyBC; - -typedef ButtonController - NoRepeatedApplyReadOnlyBC; - - namespace { char const * const dialognames[] = { "about", "bibitem", "bibtex", "citation", @@ -127,89 +114,90 @@ Dialog * Dialogs::build(string const & name) return 0; Dialog * dialog = new Dialog(lyxview_, name); + dialog->bc().view(new xformsBC(dialog->bc())); if (name == "about") { dialog->setController(new ControlAboutlyx(*dialog)); dialog->setView(new FormAboutlyx(*dialog)); - dialog->setButtonController(new OkCancelBC); + dialog->bc().bp(new OkCancelPolicy); } else if (name == "bibitem") { dialog->setController(new ControlCommand(*dialog, name)); dialog->setView(new FormBibitem(*dialog)); - dialog->setButtonController(new OkCancelReadOnlyBC); + dialog->bc().bp(new OkCancelReadOnlyPolicy); } else if (name == "bibtex") { dialog->setController(new ControlBibtex(*dialog)); dialog->setView(new FormBibtex(*dialog)); - dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); + dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy); } else if (name == "changes") { dialog->setController(new ControlChanges(*dialog)); dialog->setView(new FormChanges(*dialog)); - dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); + dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy); } else if (name == "citation") { dialog->setController(new ControlCitation(*dialog)); dialog->setView(new FormCitation(*dialog)); - dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); + dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy); } else if (name == "error") { dialog->setController(new ControlError(*dialog)); dialog->setView(new FormError(*dialog)); - dialog->setButtonController(new OkCancelBC); + dialog->bc().bp(new OkCancelPolicy); } else if (name == "ert") { dialog->setController(new ControlERT(*dialog)); dialog->setView(new FormERT(*dialog)); - dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); + dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy); } else if (name == "external") { dialog->setController(new ControlExternal(*dialog)); dialog->setView(new FormExternal(*dialog)); - dialog->setButtonController(new OkApplyCancelReadOnlyBC); + dialog->bc().bp(new OkApplyCancelReadOnlyPolicy); } else if (name == "float") { dialog->setController(new ControlFloat(*dialog)); dialog->setView(new FormFloat(*dialog)); - dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); + dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy); } else if (name == "graphics") { dialog->setController(new ControlGraphics(*dialog)); dialog->setView(new FormGraphics(*dialog)); - dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); + dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy); } else if (name == "include") { dialog->setController(new ControlInclude(*dialog)); dialog->setView(new FormInclude(*dialog)); - dialog->setButtonController(new OkApplyCancelReadOnlyBC); + dialog->bc().bp(new OkApplyCancelReadOnlyPolicy); } else if (name == "index") { dialog->setController(new ControlCommand(*dialog, name)); dialog->setView(new FormText(*dialog, _("Index"), _("Keyword:|#K"))); - dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); + dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy); } else if (name == "label") { dialog->setController(new ControlCommand(*dialog, name)); dialog->setView(new FormText(*dialog, _("Label"), _("Label:|#L"))); - dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); + dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy); } else if (name == "minipage") { dialog->setController(new ControlMinipage(*dialog)); dialog->setView(new FormMinipage(*dialog)); - dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); + dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy); } else if (name == "ref") { dialog->setController(new ControlRef(*dialog)); dialog->setView(new FormRef(*dialog)); - dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); + dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy); } else if (name == "tabular") { dialog->setController(new ControlTabular(*dialog)); dialog->setView(new FormTabular(*dialog)); - dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); + dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy); } else if (name == "tabularcreate") { dialog->setController(new ControlTabularCreate(*dialog)); dialog->setView(new FormTabularCreate(*dialog)); - dialog->setButtonController(new OkApplyCancelReadOnlyBC); + dialog->bc().bp(new OkApplyCancelReadOnlyPolicy); } else if (name == "toc") { dialog->setController(new ControlToc(*dialog)); dialog->setView(new FormToc(*dialog)); - dialog->setButtonController(new OkCancelBC); + dialog->bc().bp(new OkCancelPolicy); } else if (name == "url") { dialog->setController(new ControlCommand(*dialog, name)); dialog->setView(new FormUrl(*dialog)); - dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); + dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy); } else if (name == "wrap") { dialog->setController(new ControlWrap(*dialog)); dialog->setView(new FormWrap(*dialog)); - dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); + dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy); } return dialog; diff --git a/src/frontends/xforms/FormAboutlyx.C b/src/frontends/xforms/FormAboutlyx.C index 947de9bd41..4b6e6227c9 100644 --- a/src/frontends/xforms/FormAboutlyx.C +++ b/src/frontends/xforms/FormAboutlyx.C @@ -75,5 +75,5 @@ void FormAboutlyx::build() setPrehandler(dialog_->tabfolder); // Manage the cancel/close button - bc().setCancel(dialog_->button_close); + bcview().setCancel(dialog_->button_close); } diff --git a/src/frontends/xforms/FormBase.C b/src/frontends/xforms/FormBase.C index 27b2522f37..d0aad6c6de 100644 --- a/src/frontends/xforms/FormBase.C +++ b/src/frontends/xforms/FormBase.C @@ -15,6 +15,7 @@ #include "ControlButtons.h" #include "xformsBC.h" +#include "ButtonController.h" #include "xforms_resize.h" #include "Tooltips.h" #include "xforms_helpers.h" // formatted @@ -81,10 +82,9 @@ void FormBase::redraw() } -xformsBC & FormBase::bc() +xformsBC & FormBase::bcview() { - return static_cast(getController().bc()); - // return dynamic_cast(controller_ptr_->bc()); + return static_cast(bc().view()); } diff --git a/src/frontends/xforms/FormBase.h b/src/frontends/xforms/FormBase.h index ed8257dd86..bf5b9d4a71 100644 --- a/src/frontends/xforms/FormBase.h +++ b/src/frontends/xforms/FormBase.h @@ -86,7 +86,7 @@ protected: void clearMessage(); /// - xformsBC & bc(); + xformsBC & bcview(); private: /// Pointer to the actual instantiation of xform's form diff --git a/src/frontends/xforms/FormBibitem.C b/src/frontends/xforms/FormBibitem.C index cff49ed92a..51bc8ffa83 100644 --- a/src/frontends/xforms/FormBibitem.C +++ b/src/frontends/xforms/FormBibitem.C @@ -38,11 +38,11 @@ void FormBibitem::build() setPrehandler(dialog_->input_label); // Manage the ok, apply, restore and cancel/close buttons - bc().setOK(dialog_->button_ok); - bc().setCancel(dialog_->button_close); + bcview().setOK(dialog_->button_ok); + bcview().setCancel(dialog_->button_close); - bc().addReadOnly(dialog_->input_key); - bc().addReadOnly(dialog_->input_label); + bcview().addReadOnly(dialog_->input_key); + bcview().addReadOnly(dialog_->input_label); // set up the tooltips string str = _("Key used within LyX document."); diff --git a/src/frontends/xforms/FormBibtex.C b/src/frontends/xforms/FormBibtex.C index b69409217b..57e0c76113 100644 --- a/src/frontends/xforms/FormBibtex.C +++ b/src/frontends/xforms/FormBibtex.C @@ -44,18 +44,18 @@ void FormBibtex::build() dialog_.reset(build_bibtex(this)); // Manage the ok, apply, restore and cancel/close buttons - bc().setOK(dialog_->button_ok); - bc().setApply(dialog_->button_apply); - bc().setCancel(dialog_->button_close); - bc().setRestore(dialog_->button_restore); + bcview().setOK(dialog_->button_ok); + bcview().setApply(dialog_->button_apply); + bcview().setCancel(dialog_->button_close); + bcview().setRestore(dialog_->button_restore); // disable for read-only documents - bc().addReadOnly(dialog_->input_database); - bc().addReadOnly(dialog_->button_database_browse); - bc().addReadOnly(dialog_->button_style_browse); - bc().addReadOnly(dialog_->button_rescan); - bc().addReadOnly(dialog_->input_style); - bc().addReadOnly(dialog_->check_bibtotoc); + bcview().addReadOnly(dialog_->input_database); + bcview().addReadOnly(dialog_->button_database_browse); + bcview().addReadOnly(dialog_->button_style_browse); + bcview().addReadOnly(dialog_->button_rescan); + bcview().addReadOnly(dialog_->input_style); + bcview().addReadOnly(dialog_->check_bibtotoc); // trigger an input event for cut&paste with middle mouse button. setPrehandler(dialog_->input_database); diff --git a/src/frontends/xforms/FormBrowser.C b/src/frontends/xforms/FormBrowser.C index 2c8f445b75..19b670b2ea 100644 --- a/src/frontends/xforms/FormBrowser.C +++ b/src/frontends/xforms/FormBrowser.C @@ -25,5 +25,5 @@ void FormBrowser::build() dialog_.reset(build_browser(this)); // Manage the close button - bc().setCancel(dialog_->button_close); + bcview().setCancel(dialog_->button_close); } diff --git a/src/frontends/xforms/FormChanges.C b/src/frontends/xforms/FormChanges.C index bb2d592bf2..f6ef563d7f 100644 --- a/src/frontends/xforms/FormChanges.C +++ b/src/frontends/xforms/FormChanges.C @@ -28,9 +28,9 @@ void FormChanges::build() { dialog_.reset(build_changes(this)); - bc().setCancel(dialog_->button_close); - bc().addReadOnly(dialog_->button_accept); - bc().addReadOnly(dialog_->button_reject); + bcview().setCancel(dialog_->button_close); + bcview().addReadOnly(dialog_->button_accept); + bcview().addReadOnly(dialog_->button_reject); } diff --git a/src/frontends/xforms/FormCharacter.C b/src/frontends/xforms/FormCharacter.C index ad5099c544..2765515d31 100644 --- a/src/frontends/xforms/FormCharacter.C +++ b/src/frontends/xforms/FormCharacter.C @@ -15,6 +15,7 @@ #include #include "xformsBC.h" +#include "ButtonController.h" #include "ControlCharacter.h" #include "FormCharacter.h" #include "forms/form_character.h" @@ -112,9 +113,9 @@ void FormCharacter::build() combo_language2_->select(1); // Manage the ok, apply and cancel/close buttons - bc().setApply(dialog_->button_apply); - bc().setCancel(dialog_->button_close); - bc().addReadOnly(dialog_->check_toggle_all); + bcview().setApply(dialog_->button_apply); + bcview().setCancel(dialog_->button_close); + bcview().addReadOnly(dialog_->check_toggle_all); } diff --git a/src/frontends/xforms/FormCitation.C b/src/frontends/xforms/FormCitation.C index 14604da58b..6897380c65 100644 --- a/src/frontends/xforms/FormCitation.C +++ b/src/frontends/xforms/FormCitation.C @@ -134,21 +134,21 @@ void FormCitation::build() dialog_.reset(build_citation(this)); // Manage the ok, apply, restore and cancel/close buttons - bc().setOK(dialog_->button_ok); - bc().setApply(dialog_->button_apply); - bc().setCancel(dialog_->button_close); - bc().setRestore(dialog_->button_restore); + bcview().setOK(dialog_->button_ok); + bcview().setApply(dialog_->button_apply); + bcview().setCancel(dialog_->button_close); + bcview().setRestore(dialog_->button_restore); // disable for read-only documents - bc().addReadOnly(dialog_->button_add); - bc().addReadOnly(dialog_->button_del); - bc().addReadOnly(dialog_->button_up); - bc().addReadOnly(dialog_->button_down); - bc().addReadOnly(dialog_->choice_style); - bc().addReadOnly(dialog_->input_before); - bc().addReadOnly(dialog_->input_after); - bc().addReadOnly(dialog_->check_full_author_list); - bc().addReadOnly(dialog_->check_force_uppercase); + bcview().addReadOnly(dialog_->button_add); + bcview().addReadOnly(dialog_->button_del); + bcview().addReadOnly(dialog_->button_up); + bcview().addReadOnly(dialog_->button_down); + bcview().addReadOnly(dialog_->choice_style); + bcview().addReadOnly(dialog_->input_before); + bcview().addReadOnly(dialog_->input_after); + bcview().addReadOnly(dialog_->check_full_author_list); + bcview().addReadOnly(dialog_->check_force_uppercase); // trigger an input event for cut&paste with middle mouse button. setPrehandler(dialog_->input_search); diff --git a/src/frontends/xforms/FormDialogView.C b/src/frontends/xforms/FormDialogView.C index 7996633485..575f35af02 100644 --- a/src/frontends/xforms/FormDialogView.C +++ b/src/frontends/xforms/FormDialogView.C @@ -15,6 +15,7 @@ #include "Dialog.h" #include "xformsBC.h" +#include "ButtonController.h" #include "xforms_resize.h" #include "Tooltips.h" #include "xforms_helpers.h" // formatted @@ -83,9 +84,9 @@ void FormDialogView::redraw() } -xformsBC & FormDialogView::bc() +xformsBC & FormDialogView::bcview() { - return static_cast(dialog().bc()); + return static_cast(dialog().bc().view()); } diff --git a/src/frontends/xforms/FormDialogView.h b/src/frontends/xforms/FormDialogView.h index c76eed0c0f..7a34894d55 100644 --- a/src/frontends/xforms/FormDialogView.h +++ b/src/frontends/xforms/FormDialogView.h @@ -85,7 +85,7 @@ protected: void clearMessage(); /// - xformsBC & bc(); + xformsBC & bcview(); private: /// Pointer to the actual instantiation of xform's form diff --git a/src/frontends/xforms/FormDocument.C b/src/frontends/xforms/FormDocument.C index 95e8d9b617..83db26f279 100644 --- a/src/frontends/xforms/FormDocument.C +++ b/src/frontends/xforms/FormDocument.C @@ -16,6 +16,7 @@ #include "FormDocument.h" #include "forms/form_document.h" #include "xformsBC.h" +#include "ButtonController.h" #include "bmtable.h" #include "checkedwidgets.h" @@ -81,32 +82,32 @@ void FormDocument::build() setMessageWidget(dialog_->text_warning); // Manage the restore, ok, apply, restore and cancel/close buttons - bc().setOK(dialog_->button_ok); - bc().setApply(dialog_->button_apply); - bc().setCancel(dialog_->button_close); - bc().setRestore(dialog_->button_restore); + bcview().setOK(dialog_->button_ok); + bcview().setApply(dialog_->button_apply); + bcview().setCancel(dialog_->button_close); + bcview().setRestore(dialog_->button_restore); // the document class form class_.reset(build_document_class(this)); // disable for read-only documents - bc().addReadOnly(class_->radio_doc_indent); - bc().addReadOnly(class_->radio_doc_skip); - bc().addReadOnly(class_->choice_doc_pagestyle); - bc().addReadOnly(class_->choice_doc_fonts); - bc().addReadOnly(class_->choice_doc_fontsize); - bc().addReadOnly(class_->radio_doc_sides_one); - bc().addReadOnly(class_->radio_doc_sides_two); - bc().addReadOnly(class_->radio_doc_columns_one); - bc().addReadOnly(class_->radio_doc_columns_two); - bc().addReadOnly(class_->input_doc_extra); - bc().addReadOnly(class_->input_doc_skip); - bc().addReadOnly(class_->choice_doc_skip); - bc().addReadOnly(class_->choice_doc_spacing); - bc().addReadOnly(class_->input_doc_spacing); + bcview().addReadOnly(class_->radio_doc_indent); + bcview().addReadOnly(class_->radio_doc_skip); + bcview().addReadOnly(class_->choice_doc_pagestyle); + bcview().addReadOnly(class_->choice_doc_fonts); + bcview().addReadOnly(class_->choice_doc_fontsize); + bcview().addReadOnly(class_->radio_doc_sides_one); + bcview().addReadOnly(class_->radio_doc_sides_two); + bcview().addReadOnly(class_->radio_doc_columns_one); + bcview().addReadOnly(class_->radio_doc_columns_two); + bcview().addReadOnly(class_->input_doc_extra); + bcview().addReadOnly(class_->input_doc_skip); + bcview().addReadOnly(class_->choice_doc_skip); + bcview().addReadOnly(class_->choice_doc_spacing); + bcview().addReadOnly(class_->input_doc_spacing); // check validity of "length + unit" input - addCheckedGlueLength(bc(), class_->input_doc_skip, + addCheckedGlueLength(bcview(), class_->input_doc_skip, class_->choice_doc_skip); // trigger an input event for cut&paste with middle mouse button. @@ -164,38 +165,38 @@ void FormDocument::build() fl_unsigned_float_filter); // disable for read-only documents - bc().addReadOnly(dialog_->button_save_defaults); - bc().addReadOnly(dialog_->button_reset_defaults); + bcview().addReadOnly(dialog_->button_save_defaults); + bcview().addReadOnly(dialog_->button_reset_defaults); // the document paper form paper_.reset(build_document_paper(this)); // disable for read-only documents - bc().addReadOnly(paper_->choice_paperpackage); - bc().addReadOnly(paper_->radio_portrait); - bc().addReadOnly(paper_->radio_landscape); - bc().addReadOnly(paper_->choice_papersize); - bc().addReadOnly(paper_->check_use_geometry); - bc().addReadOnly(paper_->input_custom_width); - bc().addReadOnly(paper_->input_custom_height); - bc().addReadOnly(paper_->input_top_margin); - bc().addReadOnly(paper_->input_bottom_margin); - bc().addReadOnly(paper_->input_inner_margin); - bc().addReadOnly(paper_->input_outer_margin); - bc().addReadOnly(paper_->input_head_height); - bc().addReadOnly(paper_->input_head_sep); - bc().addReadOnly(paper_->input_foot_skip); + bcview().addReadOnly(paper_->choice_paperpackage); + bcview().addReadOnly(paper_->radio_portrait); + bcview().addReadOnly(paper_->radio_landscape); + bcview().addReadOnly(paper_->choice_papersize); + bcview().addReadOnly(paper_->check_use_geometry); + bcview().addReadOnly(paper_->input_custom_width); + bcview().addReadOnly(paper_->input_custom_height); + bcview().addReadOnly(paper_->input_top_margin); + bcview().addReadOnly(paper_->input_bottom_margin); + bcview().addReadOnly(paper_->input_inner_margin); + bcview().addReadOnly(paper_->input_outer_margin); + bcview().addReadOnly(paper_->input_head_height); + bcview().addReadOnly(paper_->input_head_sep); + bcview().addReadOnly(paper_->input_foot_skip); // check validity of "length + unit" input - addCheckedGlueLength(bc(), paper_->input_custom_width); - addCheckedGlueLength(bc(), paper_->input_custom_height); - addCheckedGlueLength(bc(), paper_->input_top_margin); - addCheckedGlueLength(bc(), paper_->input_bottom_margin); - addCheckedGlueLength(bc(), paper_->input_inner_margin); - addCheckedGlueLength(bc(), paper_->input_outer_margin); - addCheckedGlueLength(bc(), paper_->input_head_height); - addCheckedGlueLength(bc(), paper_->input_head_sep); - addCheckedGlueLength(bc(), paper_->input_foot_skip); + addCheckedGlueLength(bcview(), paper_->input_custom_width); + addCheckedGlueLength(bcview(), paper_->input_custom_height); + addCheckedGlueLength(bcview(), paper_->input_top_margin); + addCheckedGlueLength(bcview(), paper_->input_bottom_margin); + addCheckedGlueLength(bcview(), paper_->input_inner_margin); + addCheckedGlueLength(bcview(), paper_->input_outer_margin); + addCheckedGlueLength(bcview(), paper_->input_head_height); + addCheckedGlueLength(bcview(), paper_->input_head_sep); + addCheckedGlueLength(bcview(), paper_->input_foot_skip); // trigger an input event for cut&paste with middle mouse button. setPrehandler(paper_->input_custom_width); @@ -241,10 +242,10 @@ void FormDocument::build() language_.reset(build_document_language(this)); // disable for read-only documents - bc().addReadOnly(language_->choice_inputenc); - bc().addReadOnly(language_->choice_quotes_language); - bc().addReadOnly(language_->radio_single); - bc().addReadOnly(language_->radio_double); + bcview().addReadOnly(language_->choice_inputenc); + bcview().addReadOnly(language_->choice_quotes_language); + bcview().addReadOnly(language_->radio_single); + bcview().addReadOnly(language_->radio_double); fl_addto_choice(language_->choice_inputenc, "default|auto|latin1|latin2|latin3|latin4|latin5|latin9" @@ -279,13 +280,13 @@ void FormDocument::build() options_.reset(build_document_options(this)); // disable for read-only documents - bc().addReadOnly(options_->counter_secnumdepth); - bc().addReadOnly(options_->counter_tocdepth); - bc().addReadOnly(options_->choice_ams_math); - bc().addReadOnly(options_->check_use_natbib); - bc().addReadOnly(options_->choice_citation_format); - bc().addReadOnly(options_->input_float_placement); - bc().addReadOnly(options_->choice_postscript_driver); + bcview().addReadOnly(options_->counter_secnumdepth); + bcview().addReadOnly(options_->counter_tocdepth); + bcview().addReadOnly(options_->choice_ams_math); + bcview().addReadOnly(options_->check_use_natbib); + bcview().addReadOnly(options_->choice_citation_format); + bcview().addReadOnly(options_->input_float_placement); + bcview().addReadOnly(options_->choice_postscript_driver); // trigger an input event for cut&paste with middle mouse button. setPrehandler(options_->input_float_placement); @@ -306,19 +307,19 @@ void FormDocument::build() bullets_.reset(build_document_bullet(this)); // disable for read-only documents - bc().addReadOnly(bullets_->radio_bullet_depth_1); - bc().addReadOnly(bullets_->radio_bullet_depth_2); - bc().addReadOnly(bullets_->radio_bullet_depth_3); - bc().addReadOnly(bullets_->radio_bullet_depth_4); - bc().addReadOnly(bullets_->radio_bullet_panel_standard); - bc().addReadOnly(bullets_->radio_bullet_panel_maths); - bc().addReadOnly(bullets_->radio_bullet_panel_ding1); - bc().addReadOnly(bullets_->radio_bullet_panel_ding2); - bc().addReadOnly(bullets_->radio_bullet_panel_ding3); - bc().addReadOnly(bullets_->radio_bullet_panel_ding4); - bc().addReadOnly(bullets_->bmtable_bullet_panel); - bc().addReadOnly(bullets_->choice_bullet_size); - bc().addReadOnly(bullets_->input_bullet_latex); + bcview().addReadOnly(bullets_->radio_bullet_depth_1); + bcview().addReadOnly(bullets_->radio_bullet_depth_2); + bcview().addReadOnly(bullets_->radio_bullet_depth_3); + bcview().addReadOnly(bullets_->radio_bullet_depth_4); + bcview().addReadOnly(bullets_->radio_bullet_panel_standard); + bcview().addReadOnly(bullets_->radio_bullet_panel_maths); + bcview().addReadOnly(bullets_->radio_bullet_panel_ding1); + bcview().addReadOnly(bullets_->radio_bullet_panel_ding2); + bcview().addReadOnly(bullets_->radio_bullet_panel_ding3); + bcview().addReadOnly(bullets_->radio_bullet_panel_ding4); + bcview().addReadOnly(bullets_->bmtable_bullet_panel); + bcview().addReadOnly(bullets_->choice_bullet_size); + bcview().addReadOnly(bullets_->input_bullet_latex); // trigger an input event for cut&paste with middle mouse button. setPrehandler(bullets_->input_bullet_latex); diff --git a/src/frontends/xforms/FormERT.C b/src/frontends/xforms/FormERT.C index 3dd4c53097..d91e530c15 100644 --- a/src/frontends/xforms/FormERT.C +++ b/src/frontends/xforms/FormERT.C @@ -32,13 +32,13 @@ void FormERT::build() dialog_.reset(build_ert(this)); // Manage the ok, apply and cancel/close buttons - bc().setOK(dialog_->button_ok); - bc().setApply(dialog_->button_apply); - bc().setCancel(dialog_->button_close); + bcview().setOK(dialog_->button_ok); + bcview().setApply(dialog_->button_apply); + bcview().setCancel(dialog_->button_close); - bc().addReadOnly(dialog_->radio_open); - bc().addReadOnly(dialog_->radio_collapsed); - bc().addReadOnly(dialog_->radio_inlined); + bcview().addReadOnly(dialog_->radio_open); + bcview().addReadOnly(dialog_->radio_collapsed); + bcview().addReadOnly(dialog_->radio_inlined); } diff --git a/src/frontends/xforms/FormError.C b/src/frontends/xforms/FormError.C index 300f285a8c..a99f7cc948 100644 --- a/src/frontends/xforms/FormError.C +++ b/src/frontends/xforms/FormError.C @@ -30,7 +30,7 @@ void FormError::build() dialog_.reset(build_error(this)); // Manage the cancel/close button - bc().setCancel(dialog_->button_close); + bcview().setCancel(dialog_->button_close); } diff --git a/src/frontends/xforms/FormExternal.C b/src/frontends/xforms/FormExternal.C index 0b8d63735f..a74505b0bf 100644 --- a/src/frontends/xforms/FormExternal.C +++ b/src/frontends/xforms/FormExternal.C @@ -59,13 +59,13 @@ void FormExternal::build() setPrehandler(dialog_->input_filename); setPrehandler(dialog_->input_parameters); - bc().setOK(dialog_->button_ok); - bc().setApply(dialog_->button_apply); - bc().setCancel(dialog_->button_close); + bcview().setOK(dialog_->button_ok); + bcview().setApply(dialog_->button_apply); + bcview().setCancel(dialog_->button_close); - bc().addReadOnly(dialog_->input_filename); - bc().addReadOnly(dialog_->button_filenamebrowse); - bc().addReadOnly(dialog_->input_parameters); + bcview().addReadOnly(dialog_->input_filename); + bcview().addReadOnly(dialog_->button_filenamebrowse); + bcview().addReadOnly(dialog_->input_parameters); } diff --git a/src/frontends/xforms/FormFloat.C b/src/frontends/xforms/FormFloat.C index 8507c1d28b..ef05398c05 100644 --- a/src/frontends/xforms/FormFloat.C +++ b/src/frontends/xforms/FormFloat.C @@ -46,21 +46,21 @@ void FormFloat::build() dialog_.reset(build_float(this)); // Manage the ok, apply and cancel/close buttons - bc().setOK(dialog_->button_ok); - bc().setApply(dialog_->button_apply); - bc().setCancel(dialog_->button_close); - bc().setRestore(dialog_->button_restore); + bcview().setOK(dialog_->button_ok); + bcview().setApply(dialog_->button_apply); + bcview().setCancel(dialog_->button_close); + bcview().setRestore(dialog_->button_restore); // disable for read-only documents - bc().addReadOnly(dialog_->radio_default); - bc().addReadOnly(dialog_->radio_here_definitely); - bc().addReadOnly(dialog_->radio_alternatives); - bc().addReadOnly(dialog_->check_top); - bc().addReadOnly(dialog_->check_bottom); - bc().addReadOnly(dialog_->check_page); - bc().addReadOnly(dialog_->check_here); - bc().addReadOnly(dialog_->check_force); - bc().addReadOnly(dialog_->check_wide); + bcview().addReadOnly(dialog_->radio_default); + bcview().addReadOnly(dialog_->radio_here_definitely); + bcview().addReadOnly(dialog_->radio_alternatives); + bcview().addReadOnly(dialog_->check_top); + bcview().addReadOnly(dialog_->check_bottom); + bcview().addReadOnly(dialog_->check_page); + bcview().addReadOnly(dialog_->check_here); + bcview().addReadOnly(dialog_->check_force); + bcview().addReadOnly(dialog_->check_wide); placement_.init(dialog_->radio_default, DOCUMENT_DEFAULTS); placement_.init(dialog_->radio_here_definitely, HERE_DEFINITELY); diff --git a/src/frontends/xforms/FormForks.C b/src/frontends/xforms/FormForks.C index de0e194209..960dc31a9f 100644 --- a/src/frontends/xforms/FormForks.C +++ b/src/frontends/xforms/FormForks.C @@ -13,6 +13,7 @@ #include "xformsBC.h" +#include "ButtonController.h" #include "FormForks.h" #include "ControlForks.h" #include "forms/form_forks.h" @@ -45,9 +46,9 @@ void FormForks::build() { fl_clear_browser(dialog_->browser_kill); // Manage the ok, apply, restore and cancel/close buttons - bc().setOK(dialog_->button_ok); - bc().setApply(dialog_->button_apply); - bc().setCancel(dialog_->button_close); + bcview().setOK(dialog_->button_ok); + bcview().setApply(dialog_->button_apply); + bcview().setCancel(dialog_->button_close); bc().invalid(); // Set up the tooltip mechanism diff --git a/src/frontends/xforms/FormGraphics.C b/src/frontends/xforms/FormGraphics.C index f5a29a1c89..6c4ba4b1e6 100644 --- a/src/frontends/xforms/FormGraphics.C +++ b/src/frontends/xforms/FormGraphics.C @@ -79,23 +79,23 @@ void FormGraphics::build() dialog_.reset(build_graphics(this)); // Manage the ok, apply, restore and cancel/close buttons - bc().setOK(dialog_->button_ok); - bc().setApply(dialog_->button_apply); - bc().setCancel(dialog_->button_close); - bc().setRestore(dialog_->button_restore); + bcview().setOK(dialog_->button_ok); + bcview().setApply(dialog_->button_apply); + bcview().setCancel(dialog_->button_close); + bcview().setRestore(dialog_->button_restore); // the file section file_.reset(build_graphics_file(this)); // disable for read-only documents - bc().addReadOnly(file_->button_browse); - bc().addReadOnly(file_->check_aspectratio); - bc().addReadOnly(file_->check_draft); - bc().addReadOnly(file_->check_nounzip); + bcview().addReadOnly(file_->button_browse); + bcview().addReadOnly(file_->check_aspectratio); + bcview().addReadOnly(file_->check_draft); + bcview().addReadOnly(file_->check_nounzip); // check validity of "length + unit" input - addCheckedGlueLength(bc(), file_->input_width); - addCheckedGlueLength(bc(), file_->input_height); + addCheckedGlueLength(bcview(), file_->input_width); + addCheckedGlueLength(bcview(), file_->input_height); // trigger an input event for cut&paste with middle mouse button. setPrehandler(file_->input_filename); @@ -166,11 +166,11 @@ void FormGraphics::build() bbox_.reset(build_graphics_bbox(this)); // disable for read-only documents - bc().addReadOnly(bbox_->button_getBB); - bc().addReadOnly(bbox_->check_clip); + bcview().addReadOnly(bbox_->button_getBB); + bcview().addReadOnly(bbox_->check_clip); // 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. setPrehandler(bbox_->input_bb_x0); @@ -217,10 +217,10 @@ void FormGraphics::build() extra_.reset(build_graphics_extra(this)); // disable for read-only documents - bc().addReadOnly(extra_->input_rotate_angle); - bc().addReadOnly(extra_->choice_origin); - bc().addReadOnly(extra_->check_subcaption); - bc().addReadOnly(extra_->input_special); + bcview().addReadOnly(extra_->input_rotate_angle); + bcview().addReadOnly(extra_->choice_origin); + bcview().addReadOnly(extra_->check_subcaption); + bcview().addReadOnly(extra_->input_special); // trigger an input event for cut&paste with middle mouse button. setPrehandler(extra_->input_rotate_angle); diff --git a/src/frontends/xforms/FormInclude.C b/src/frontends/xforms/FormInclude.C index 0ff8250415..ba443738a5 100644 --- a/src/frontends/xforms/FormInclude.C +++ b/src/frontends/xforms/FormInclude.C @@ -38,8 +38,8 @@ void FormInclude::build() dialog_.reset(build_include(this)); // Manage the ok and cancel buttons - bc().setOK(dialog_->button_ok); - bc().setCancel(dialog_->button_close); + bcview().setOK(dialog_->button_ok); + bcview().setCancel(dialog_->button_close); // trigger an input event for cut&paste with middle mouse button. setPrehandler(dialog_->input_filename); @@ -47,10 +47,10 @@ void FormInclude::build() fl_set_input_return(dialog_->input_filename, FL_RETURN_CHANGED); // disable for read-only documents - bc().addReadOnly(dialog_->button_browse); - bc().addReadOnly(dialog_->radio_useinput); - bc().addReadOnly(dialog_->radio_useinclude); - bc().addReadOnly(dialog_->radio_verbatim); + bcview().addReadOnly(dialog_->button_browse); + bcview().addReadOnly(dialog_->radio_useinput); + bcview().addReadOnly(dialog_->radio_useinclude); + bcview().addReadOnly(dialog_->radio_verbatim); type_.init(dialog_->radio_useinput, ControlInclude::INPUT); type_.init(dialog_->radio_useinclude, ControlInclude::INCLUDE); diff --git a/src/frontends/xforms/FormMathsBitmap.C b/src/frontends/xforms/FormMathsBitmap.C index 798b6ba9b3..707dfb013f 100644 --- a/src/frontends/xforms/FormMathsBitmap.C +++ b/src/frontends/xforms/FormMathsBitmap.C @@ -96,7 +96,7 @@ void FormMathsBitmap::build() it < bitmaps_.end(); ++it) { FL_OBJECT * obj = buildBitmap(*it); - bc().addReadOnly(obj); + bcview().addReadOnly(obj); y_close = max(y_close, obj->y + obj->h); } bitmaps_.clear(); @@ -116,7 +116,7 @@ void FormMathsBitmap::build() fdui->form->fdui = fdui; dialog_.reset(fdui); - bc().setCancel(dialog_->button_close); + bcview().setCancel(dialog_->button_close); } diff --git a/src/frontends/xforms/FormMathsDelim.C b/src/frontends/xforms/FormMathsDelim.C index 347d456cd2..442711a3e7 100644 --- a/src/frontends/xforms/FormMathsDelim.C +++ b/src/frontends/xforms/FormMathsDelim.C @@ -18,6 +18,7 @@ #include "forms/form_maths_delim.h" #include "ControlMath.h" #include "xformsBC.h" +#include "ButtonController.h" #include "bmtable.h" @@ -70,15 +71,15 @@ void FormMathsDelim::build() delim_width, delim_height, delim_bits); fl_set_bmtable_maxitems(dialog_->bmtable, 23); - bc().setOK(dialog_->button_ok); - bc().setApply(dialog_->button_apply); - bc().setCancel(dialog_->button_close); + bcview().setOK(dialog_->button_ok); + bcview().setApply(dialog_->button_apply); + bcview().setCancel(dialog_->button_close); - bc().addReadOnly(dialog_->bmtable); - bc().addReadOnly(dialog_->radio_right); - bc().addReadOnly(dialog_->radio_left); - bc().addReadOnly(dialog_->radio_both); - bc().addReadOnly(dialog_->button_pix); + bcview().addReadOnly(dialog_->bmtable); + bcview().addReadOnly(dialog_->radio_right); + bcview().addReadOnly(dialog_->radio_left); + bcview().addReadOnly(dialog_->radio_both); + bcview().addReadOnly(dialog_->button_pix); } diff --git a/src/frontends/xforms/FormMathsMatrix.C b/src/frontends/xforms/FormMathsMatrix.C index 36d2feab5c..10541873a8 100644 --- a/src/frontends/xforms/FormMathsMatrix.C +++ b/src/frontends/xforms/FormMathsMatrix.C @@ -18,6 +18,7 @@ #include "forms/form_maths_matrix.h" #include "ControlMath.h" #include "xformsBC.h" +#include "ButtonController.h" #include "support/LAssert.h" #include "support/lyxalgo.h" // lyx::count @@ -72,14 +73,14 @@ void FormMathsMatrix::build() C_FormMathsMatrixAlignFilter); setPrehandler(dialog_->input_halign); - bc().setOK(dialog_->button_ok); - bc().setApply(dialog_->button_apply); - bc().setCancel(dialog_->button_close); + bcview().setOK(dialog_->button_ok); + bcview().setApply(dialog_->button_apply); + bcview().setCancel(dialog_->button_close); - bc().addReadOnly(dialog_->slider_rows); - bc().addReadOnly(dialog_->slider_columns); - bc().addReadOnly(dialog_->choice_valign); - bc().addReadOnly(dialog_->input_halign); + bcview().addReadOnly(dialog_->slider_rows); + bcview().addReadOnly(dialog_->slider_columns); + bcview().addReadOnly(dialog_->choice_valign); + bcview().addReadOnly(dialog_->input_halign); } diff --git a/src/frontends/xforms/FormMathsPanel.C b/src/frontends/xforms/FormMathsPanel.C index 563ec3d98b..edc0f2d555 100644 --- a/src/frontends/xforms/FormMathsPanel.C +++ b/src/frontends/xforms/FormMathsPanel.C @@ -75,10 +75,9 @@ FormMathsBitmap * FormMathsPanel::addDaughter(void * key, FormMathsBitmap * const view = new FormMathsBitmap(title, std::vector(data, end)); - typedef ButtonController BC; - BC * const bc = new BC; - - controller().addDaughter(key, view, bc); + controller().addDaughter(key, view, + new xformsBC(controller().bc()), + new IgnorantPolicy); return view; } @@ -112,17 +111,22 @@ void FormMathsPanel::build() fl_set_pixmap_data(dialog_->button_equation, const_cast(equation)); - typedef ButtonController BC_ignorant; - typedef ButtonController BC_ok; - controller().addDaughter(dialog_->button_delim, - new FormMathsDelim, new BC_ok); + new FormMathsDelim, + new xformsBC(controller().bc()), + new OkApplyCancelReadOnlyPolicy); controller().addDaughter(dialog_->button_matrix, - new FormMathsMatrix, new BC_ok); + new FormMathsMatrix, + new xformsBC(controller().bc()), + new OkApplyCancelReadOnlyPolicy); controller().addDaughter(dialog_->button_space, - new FormMathsSpace, new BC_ignorant); + new FormMathsSpace, + new xformsBC(controller().bc()), + new IgnorantPolicy); controller().addDaughter(dialog_->button_style, - new FormMathsStyle, new BC_ignorant); + new FormMathsStyle, + new xformsBC(controller().bc()), + new IgnorantPolicy); FormMathsBitmap * bitmap; bitmap = addDaughter(dialog_->button_deco, diff --git a/src/frontends/xforms/FormMathsSpace.C b/src/frontends/xforms/FormMathsSpace.C index 4ccff26b42..71b942bc72 100644 --- a/src/frontends/xforms/FormMathsSpace.C +++ b/src/frontends/xforms/FormMathsSpace.C @@ -37,16 +37,16 @@ void FormMathsSpace::build() space_ = -1; - bc().setCancel(dialog_->button_close); + bcview().setCancel(dialog_->button_close); - bc().addReadOnly(dialog_->button_negative); - bc().addReadOnly(dialog_->button_negmedspace); - bc().addReadOnly(dialog_->button_negthickspace); - bc().addReadOnly(dialog_->button_thin); - bc().addReadOnly(dialog_->button_medium); - bc().addReadOnly(dialog_->button_thick); - bc().addReadOnly(dialog_->button_quadratin); - bc().addReadOnly(dialog_->button_twoquadratin); + bcview().addReadOnly(dialog_->button_negative); + bcview().addReadOnly(dialog_->button_negmedspace); + bcview().addReadOnly(dialog_->button_negthickspace); + bcview().addReadOnly(dialog_->button_thin); + bcview().addReadOnly(dialog_->button_medium); + bcview().addReadOnly(dialog_->button_thick); + bcview().addReadOnly(dialog_->button_quadratin); + bcview().addReadOnly(dialog_->button_twoquadratin); } diff --git a/src/frontends/xforms/FormMathsStyle.C b/src/frontends/xforms/FormMathsStyle.C index 1a6ca1b828..5d88021329 100644 --- a/src/frontends/xforms/FormMathsStyle.C +++ b/src/frontends/xforms/FormMathsStyle.C @@ -52,24 +52,24 @@ void FormMathsStyle::build() fl_set_bmtable_data(dialog_->bmtable_style1, 1, 1, style1_width, style1_height, style1_bits); 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, style2_width, style2_height, style2_bits); 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, font1_width, font1_height, font1_bits); 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, font2_width, font2_height, font2_bits); 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); } diff --git a/src/frontends/xforms/FormMinipage.C b/src/frontends/xforms/FormMinipage.C index a9716d091d..10d12e1204 100644 --- a/src/frontends/xforms/FormMinipage.C +++ b/src/frontends/xforms/FormMinipage.C @@ -42,16 +42,16 @@ void FormMinipage::build() fl_addto_choice(dialog_->choice_width_units, subst(choice, "%", "%%").c_str()); // Manage the ok, apply and cancel/close buttons - bc().setOK(dialog_->button_ok); - bc().setApply(dialog_->button_apply); - bc().setCancel(dialog_->button_close); - bc().setRestore(dialog_->button_restore); + bcview().setOK(dialog_->button_ok); + bcview().setApply(dialog_->button_apply); + bcview().setCancel(dialog_->button_close); + bcview().setRestore(dialog_->button_restore); - bc().addReadOnly(dialog_->input_width); - bc().addReadOnly(dialog_->choice_width_units); - bc().addReadOnly(dialog_->radio_top); - bc().addReadOnly(dialog_->radio_middle); - bc().addReadOnly(dialog_->radio_bottom); + bcview().addReadOnly(dialog_->input_width); + bcview().addReadOnly(dialog_->choice_width_units); + bcview().addReadOnly(dialog_->radio_top); + bcview().addReadOnly(dialog_->radio_middle); + bcview().addReadOnly(dialog_->radio_bottom); } diff --git a/src/frontends/xforms/FormParagraph.C b/src/frontends/xforms/FormParagraph.C index 4601b36854..30530f7a1a 100644 --- a/src/frontends/xforms/FormParagraph.C +++ b/src/frontends/xforms/FormParagraph.C @@ -74,35 +74,35 @@ void FormParagraph::build() dialog_.reset(build_paragraph(this)); // Manage the ok, apply, restore and cancel/close buttons - bc().setOK(dialog_->button_ok); - bc().setApply(dialog_->button_apply); - bc().setCancel(dialog_->button_close); - bc().setRestore(dialog_->button_restore); + bcview().setOK(dialog_->button_ok); + bcview().setApply(dialog_->button_apply); + bcview().setCancel(dialog_->button_close); + bcview().setRestore(dialog_->button_restore); // disable for read-only documents - bc().addReadOnly(dialog_->check_line_above); - bc().addReadOnly(dialog_->check_pagebreak_above); - bc().addReadOnly(dialog_->choice_space_above); - bc().addReadOnly(dialog_->input_space_above); - bc().addReadOnly(dialog_->check_space_above); + bcview().addReadOnly(dialog_->check_line_above); + bcview().addReadOnly(dialog_->check_pagebreak_above); + bcview().addReadOnly(dialog_->choice_space_above); + bcview().addReadOnly(dialog_->input_space_above); + bcview().addReadOnly(dialog_->check_space_above); - bc().addReadOnly(dialog_->check_noindent); - bc().addReadOnly(dialog_->choice_linespacing); - bc().addReadOnly(dialog_->input_linespacing); + bcview().addReadOnly(dialog_->check_noindent); + bcview().addReadOnly(dialog_->choice_linespacing); + bcview().addReadOnly(dialog_->input_linespacing); - bc().addReadOnly(dialog_->check_line_below); - bc().addReadOnly(dialog_->check_pagebreak_below); - bc().addReadOnly(dialog_->choice_space_below); - bc().addReadOnly(dialog_->input_space_below); - bc().addReadOnly(dialog_->check_space_below); + bcview().addReadOnly(dialog_->check_line_below); + bcview().addReadOnly(dialog_->check_pagebreak_below); + bcview().addReadOnly(dialog_->choice_space_below); + bcview().addReadOnly(dialog_->input_space_below); + bcview().addReadOnly(dialog_->check_space_below); - bc().addReadOnly(dialog_->input_labelwidth); + bcview().addReadOnly(dialog_->input_labelwidth); // check validity of "length + unit" input - addCheckedGlueLength(bc(), + addCheckedGlueLength(bcview(), dialog_->input_space_above, dialog_->choice_space_above); - addCheckedGlueLength(bc(), + addCheckedGlueLength(bcview(), dialog_->input_space_below, dialog_->choice_space_below); diff --git a/src/frontends/xforms/FormPreamble.C b/src/frontends/xforms/FormPreamble.C index 04e5b352b3..a793b9eb70 100644 --- a/src/frontends/xforms/FormPreamble.C +++ b/src/frontends/xforms/FormPreamble.C @@ -31,9 +31,9 @@ void FormPreamble::build() dialog_.reset(build_preamble(this)); // Manage the ok, apply and cancel/close buttons - bc().setOK(dialog_->button_ok); - bc().setApply(dialog_->button_apply); - bc().setCancel(dialog_->button_close); + bcview().setOK(dialog_->button_ok); + bcview().setApply(dialog_->button_apply); + bcview().setCancel(dialog_->button_close); // trigger an input event for cut&paste with middle mouse button. setPrehandler(dialog_->input_preamble); diff --git a/src/frontends/xforms/FormPreferences.C b/src/frontends/xforms/FormPreferences.C index 97f8e3da1d..493ecace5e 100644 --- a/src/frontends/xforms/FormPreferences.C +++ b/src/frontends/xforms/FormPreferences.C @@ -15,6 +15,7 @@ #include "FormPreferences.h" #include "forms/form_preferences.h" #include "xformsBC.h" +#include "ButtonController.h" #include "combox.h" #include "Color.h" @@ -163,10 +164,10 @@ void FormPreferences::build() dialog_.reset(build_preferences(this)); // Manage the restore, save, apply and cancel/close buttons - bc().setOK(dialog_->button_ok); - bc().setApply(dialog_->button_apply); - bc().setCancel(dialog_->button_close); - bc().setRestore(dialog_->button_restore); + bcview().setOK(dialog_->button_ok); + bcview().setApply(dialog_->button_apply); + bcview().setCancel(dialog_->button_close); + bcview().setRestore(dialog_->button_restore); // Allow the base class to control messages setMessageWidget(dialog_->text_warning); diff --git a/src/frontends/xforms/FormPrint.C b/src/frontends/xforms/FormPrint.C index 3e4b78b2f2..a83db97f5a 100644 --- a/src/frontends/xforms/FormPrint.C +++ b/src/frontends/xforms/FormPrint.C @@ -39,9 +39,9 @@ void FormPrint::build() dialog_.reset(build_print(this)); // Manage the ok, apply and cancel/close buttons - bc().setOK(dialog_->button_ok); - bc().setApply(dialog_->button_apply); - bc().setCancel(dialog_->button_close); + bcview().setOK(dialog_->button_ok); + bcview().setApply(dialog_->button_apply); + bcview().setCancel(dialog_->button_close); // trigger an input event for cut&paste with middle mouse button. setPrehandler(dialog_->input_printer); diff --git a/src/frontends/xforms/FormRef.C b/src/frontends/xforms/FormRef.C index 0e0180401a..6cd04355a8 100644 --- a/src/frontends/xforms/FormRef.C +++ b/src/frontends/xforms/FormRef.C @@ -54,14 +54,14 @@ void FormRef::build() setPrehandler(dialog_->input_ref); // Manage the ok and cancel/close buttons - bc().setOK(dialog_->button_ok); - bc().setApply(dialog_->button_apply); - bc().setCancel(dialog_->button_close); - bc().setRestore(dialog_->button_restore); + bcview().setOK(dialog_->button_ok); + bcview().setApply(dialog_->button_apply); + bcview().setCancel(dialog_->button_close); + bcview().setRestore(dialog_->button_restore); - bc().addReadOnly(dialog_->button_update); - bc().addReadOnly(dialog_->input_name); - bc().addReadOnly(dialog_->input_ref); + bcview().addReadOnly(dialog_->button_update); + bcview().addReadOnly(dialog_->input_name); + bcview().addReadOnly(dialog_->input_ref); // set up the tooltips string str = _("Select a document for references."); diff --git a/src/frontends/xforms/FormSearch.C b/src/frontends/xforms/FormSearch.C index 58323eb0fb..cf4ebf303d 100644 --- a/src/frontends/xforms/FormSearch.C +++ b/src/frontends/xforms/FormSearch.C @@ -32,12 +32,12 @@ void FormSearch::build() dialog_.reset(build_search(this)); // Manage the ok, apply and cancel/close buttons - bc().setCancel(dialog_->button_close); + bcview().setCancel(dialog_->button_close); // disable for read-only documents - bc().addReadOnly(dialog_->input_replace); - bc().addReadOnly(dialog_->button_replace); - bc().addReadOnly(dialog_->button_replaceall); + bcview().addReadOnly(dialog_->input_replace); + bcview().addReadOnly(dialog_->button_replace); + bcview().addReadOnly(dialog_->button_replaceall); // set up the tooltips string str = _("Enter the string you want to find."); diff --git a/src/frontends/xforms/FormSendto.C b/src/frontends/xforms/FormSendto.C index 5316c9bcb7..d2527031f0 100644 --- a/src/frontends/xforms/FormSendto.C +++ b/src/frontends/xforms/FormSendto.C @@ -38,9 +38,9 @@ void FormSendto::build() setPrehandler(dialog_->input_command); // Manage the ok, apply, restore and cancel/close buttons - bc().setOK(dialog_->button_ok); - bc().setApply(dialog_->button_apply); - bc().setCancel(dialog_->button_close); + bcview().setOK(dialog_->button_ok); + bcview().setApply(dialog_->button_apply); + bcview().setCancel(dialog_->button_close); // Set up the tooltip mechanism string str = _("Export the buffer to this format before running the command below on it."); diff --git a/src/frontends/xforms/FormSpellchecker.C b/src/frontends/xforms/FormSpellchecker.C index a9dcff8b4d..74924ce7cb 100644 --- a/src/frontends/xforms/FormSpellchecker.C +++ b/src/frontends/xforms/FormSpellchecker.C @@ -37,10 +37,10 @@ void FormSpellchecker::build() dialog_.reset(build_spellchecker(this)); // Manage the buttons - bc().setCancel(dialog_->button_close); + bcview().setCancel(dialog_->button_close); // disable for read-only documents - bc().addReadOnly(dialog_->button_replace); + bcview().addReadOnly(dialog_->button_replace); // trigger an input event for cut&paste with middle mouse button. setPrehandler(dialog_->input_replacement); diff --git a/src/frontends/xforms/FormTabular.C b/src/frontends/xforms/FormTabular.C index 0cc61409c1..f241089ca3 100644 --- a/src/frontends/xforms/FormTabular.C +++ b/src/frontends/xforms/FormTabular.C @@ -16,6 +16,7 @@ #include "ControlTabular.h" #include "xformsBC.h" +#include "ButtonController.h" #include "insets/insettabular.h" #include "FormTabular.h" diff --git a/src/frontends/xforms/FormTabularCreate.C b/src/frontends/xforms/FormTabularCreate.C index 2607244e55..384aefd1f6 100644 --- a/src/frontends/xforms/FormTabularCreate.C +++ b/src/frontends/xforms/FormTabularCreate.C @@ -36,9 +36,9 @@ void FormTabularCreate::build() dialog_.reset(build_tabular_create(this)); // Manage the ok, apply and cancel/close buttons - bc().setOK(dialog_->button_ok); - bc().setApply(dialog_->button_apply); - bc().setCancel(dialog_->button_close); + bcview().setOK(dialog_->button_ok); + bcview().setApply(dialog_->button_apply); + bcview().setCancel(dialog_->button_close); // set up the tooltips string str = _("Number of columns in the tabular."); diff --git a/src/frontends/xforms/FormText.C b/src/frontends/xforms/FormText.C index 868b9e7611..7b5f73671d 100644 --- a/src/frontends/xforms/FormText.C +++ b/src/frontends/xforms/FormText.C @@ -11,6 +11,7 @@ #include #include "xformsBC.h" +#include "ButtonController.h" #include "ControlCommand.h" #include "FormText.h" #include "forms/form_text.h" @@ -38,12 +39,12 @@ void FormText::build() fl_set_button_shortcut(dialog_->input_text, scex(label_).c_str(), 1); // Manage the ok, apply, restore and cancel/close buttons - bc().setOK(dialog_->button_ok); - bc().setApply(dialog_->button_apply); - bc().setCancel(dialog_->button_close); - bc().setRestore(dialog_->button_restore); + bcview().setOK(dialog_->button_ok); + bcview().setApply(dialog_->button_apply); + bcview().setCancel(dialog_->button_close); + bcview().setRestore(dialog_->button_restore); - bc().addReadOnly(dialog_->input_text); + bcview().addReadOnly(dialog_->input_text); } diff --git a/src/frontends/xforms/FormThesaurus.C b/src/frontends/xforms/FormThesaurus.C index 50d7aef750..b7ec39b076 100644 --- a/src/frontends/xforms/FormThesaurus.C +++ b/src/frontends/xforms/FormThesaurus.C @@ -50,8 +50,8 @@ void FormThesaurus::build() setPrehandler(dialog_->input_replace); // Manage the ok, apply and cancel/close buttons - bc().setCancel(dialog_->button_close); - bc().addReadOnly(dialog_->input_replace); + bcview().setCancel(dialog_->button_close); + bcview().addReadOnly(dialog_->input_replace); fl_set_input_return(dialog_->input_entry, FL_RETURN_END_CHANGED); } diff --git a/src/frontends/xforms/FormToc.C b/src/frontends/xforms/FormToc.C index 75d9d0ed47..72059af822 100644 --- a/src/frontends/xforms/FormToc.C +++ b/src/frontends/xforms/FormToc.C @@ -46,7 +46,7 @@ void FormToc::build() fl_addto_choice(dialog_->choice_toc_type, choice.c_str()); // Manage the cancel/close button - bc().setCancel(dialog_->button_close); + bcview().setCancel(dialog_->button_close); } diff --git a/src/frontends/xforms/FormUrl.C b/src/frontends/xforms/FormUrl.C index 49c098ab0d..a58dbbf642 100644 --- a/src/frontends/xforms/FormUrl.C +++ b/src/frontends/xforms/FormUrl.C @@ -36,14 +36,14 @@ void FormUrl::build() setPrehandler(dialog_->input_url); // Manage the ok, apply, restore and cancel/close buttons - bc().setOK(dialog_->button_ok); - bc().setApply(dialog_->button_apply); - bc().setCancel(dialog_->button_close); - bc().setRestore(dialog_->button_restore); + bcview().setOK(dialog_->button_ok); + bcview().setApply(dialog_->button_apply); + bcview().setCancel(dialog_->button_close); + bcview().setRestore(dialog_->button_restore); - bc().addReadOnly(dialog_->input_name); - bc().addReadOnly(dialog_->input_url); - bc().addReadOnly(dialog_->check_html); + bcview().addReadOnly(dialog_->input_name); + bcview().addReadOnly(dialog_->input_url); + bcview().addReadOnly(dialog_->check_html); } diff --git a/src/frontends/xforms/FormWrap.C b/src/frontends/xforms/FormWrap.C index 815e609940..9368d132e3 100644 --- a/src/frontends/xforms/FormWrap.C +++ b/src/frontends/xforms/FormWrap.C @@ -36,17 +36,17 @@ void FormWrap::build() dialog_.reset(build_wrap(this)); // Manage the ok, apply and cancel/close buttons - bc().setOK(dialog_->button_ok); - bc().setApply(dialog_->button_apply); - bc().setCancel(dialog_->button_close); - bc().setRestore(dialog_->button_restore); + bcview().setOK(dialog_->button_ok); + bcview().setApply(dialog_->button_apply); + bcview().setCancel(dialog_->button_close); + bcview().setRestore(dialog_->button_restore); // disable for read-only documents - bc().addReadOnly(dialog_->input_width); - bc().addReadOnly(dialog_->choice_width_units); + bcview().addReadOnly(dialog_->input_width); + bcview().addReadOnly(dialog_->choice_width_units); // check validity of "length + unit" input - addCheckedGlueLength(bc(), dialog_->input_width); + addCheckedGlueLength(bcview(), dialog_->input_width); // trigger an input event for cut&paste with middle mouse button. setPrehandler(dialog_->input_width); diff --git a/src/frontends/xforms/checkedwidgets.C b/src/frontends/xforms/checkedwidgets.C index 3e11352595..a826c74f03 100644 --- a/src/frontends/xforms/checkedwidgets.C +++ b/src/frontends/xforms/checkedwidgets.C @@ -22,17 +22,17 @@ #include FORMS_H_LOCATION -void addCheckedLyXLength(ButtonControllerBase & bc, +void addCheckedLyXLength(BCView & bcview, FL_OBJECT * input, FL_OBJECT * label) { - bc.addCheckedWidget(new CheckedLyXLength(input, label)); + bcview.addCheckedWidget(new CheckedLyXLength(input, label)); } -void addCheckedGlueLength(ButtonControllerBase & bc, +void addCheckedGlueLength(BCView & bcview, FL_OBJECT * input, FL_OBJECT * label) { - bc.addCheckedWidget(new CheckedGlueLength(input, label)); + bcview.addCheckedWidget(new CheckedGlueLength(input, label)); } diff --git a/src/frontends/xforms/checkedwidgets.h b/src/frontends/xforms/checkedwidgets.h index caacab0f79..c3515c2c5b 100644 --- a/src/frontends/xforms/checkedwidgets.h +++ b/src/frontends/xforms/checkedwidgets.h @@ -13,13 +13,13 @@ #define CHECKEDWIDGETS_H -#include "ButtonControllerBase.h" +#include "BCView.h" #include "forms_fwd.h" -void addCheckedLyXLength(ButtonControllerBase & bc, +void addCheckedLyXLength(BCView & bcview, FL_OBJECT * input, FL_OBJECT * label = 0); -void addCheckedGlueLength(ButtonControllerBase & bc, +void addCheckedGlueLength(BCView & bcview, FL_OBJECT * input, FL_OBJECT * label = 0); class CheckedLyXLength : public CheckedWidget { diff --git a/src/frontends/xforms/xformsBC.C b/src/frontends/xforms/xformsBC.C index d2592de9e1..cb27c64c23 100644 --- a/src/frontends/xforms/xformsBC.C +++ b/src/frontends/xforms/xformsBC.C @@ -18,8 +18,9 @@ #include FORMS_H_LOCATION -xformsBC::xformsBC(string const & cancel, string const & close) - : GuiBC(cancel, close) +xformsBC::xformsBC(ButtonController const & parent, + string const & cancel, string const & close) + : GuiBC(parent, cancel, close) {} diff --git a/src/frontends/xforms/xformsBC.h b/src/frontends/xforms/xformsBC.h index b129bb53fc..22a4d39157 100644 --- a/src/frontends/xforms/xformsBC.h +++ b/src/frontends/xforms/xformsBC.h @@ -16,13 +16,14 @@ #include "forms_fwd.h" - -#include "ButtonController.h" +#include "BCView.h" +#include "gettext.h" class xformsBC : public GuiBC { public: /// - xformsBC(string const &, string const &); + xformsBC(ButtonController const &, + string const & = _("Cancel"), string const & = _("Close")); private: /// Updates the button sensitivity (enabled/disabled)