]> git.lyx.org Git - features.git/commitdiff
merge ButtonController and its view (Qt2BC in this case)
authorAndré Pönitz <poenitz@gmx.net>
Mon, 3 Sep 2007 05:59:32 +0000 (05:59 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Mon, 3 Sep 2007 05:59:32 +0000 (05:59 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20018 a592a061-630c-0410-9148-cb99ea01b6c8

102 files changed:
src/frontends/Dialogs.cpp
src/frontends/Dialogs.h
src/frontends/controllers/BCView.cpp [deleted file]
src/frontends/controllers/BCView.h [deleted file]
src/frontends/controllers/ButtonController.cpp [deleted file]
src/frontends/controllers/ButtonController.h [deleted file]
src/frontends/controllers/ControlCharacter.cpp
src/frontends/controllers/ControlParagraph.cpp
src/frontends/controllers/ControlPrint.cpp
src/frontends/controllers/ControlVSpace.cpp
src/frontends/controllers/Dialog.cpp
src/frontends/controllers/Dialog.h
src/frontends/controllers/Makefile.am
src/frontends/controllers/frontend_helpers.h
src/frontends/qt4/ButtonController.cpp [new file with mode: 0644]
src/frontends/qt4/ButtonController.h [new file with mode: 0644]
src/frontends/qt4/Dialogs.cpp
src/frontends/qt4/GuiAbout.cpp
src/frontends/qt4/GuiAbout.h
src/frontends/qt4/GuiBibitem.cpp
src/frontends/qt4/GuiBibitem.h
src/frontends/qt4/GuiBibtex.cpp
src/frontends/qt4/GuiBibtex.h
src/frontends/qt4/GuiBox.cpp
src/frontends/qt4/GuiBox.h
src/frontends/qt4/GuiBranch.cpp
src/frontends/qt4/GuiBranch.h
src/frontends/qt4/GuiChanges.cpp
src/frontends/qt4/GuiChanges.h
src/frontends/qt4/GuiCharacter.cpp
src/frontends/qt4/GuiCharacter.h
src/frontends/qt4/GuiCitation.cpp
src/frontends/qt4/GuiCitation.h
src/frontends/qt4/GuiDelimiter.cpp
src/frontends/qt4/GuiDelimiter.h
src/frontends/qt4/GuiDialog.cpp [new file with mode: 0644]
src/frontends/qt4/GuiDialog.h [new file with mode: 0644]
src/frontends/qt4/GuiDialogView.cpp
src/frontends/qt4/GuiDialogView.h
src/frontends/qt4/GuiDocument.cpp
src/frontends/qt4/GuiDocument.h
src/frontends/qt4/GuiERT.cpp
src/frontends/qt4/GuiERT.h
src/frontends/qt4/GuiEmbeddedFiles.cpp
src/frontends/qt4/GuiErrorList.cpp
src/frontends/qt4/GuiErrorList.h
src/frontends/qt4/GuiExternal.cpp
src/frontends/qt4/GuiExternal.h
src/frontends/qt4/GuiFloat.cpp
src/frontends/qt4/GuiFloat.h
src/frontends/qt4/GuiGraphics.cpp
src/frontends/qt4/GuiGraphics.h
src/frontends/qt4/GuiInclude.cpp
src/frontends/qt4/GuiInclude.h
src/frontends/qt4/GuiIndex.cpp
src/frontends/qt4/GuiIndex.h
src/frontends/qt4/GuiListings.cpp
src/frontends/qt4/GuiListings.h
src/frontends/qt4/GuiLog.cpp
src/frontends/qt4/GuiLog.h
src/frontends/qt4/GuiMathMatrix.cpp
src/frontends/qt4/GuiMathMatrix.h
src/frontends/qt4/GuiNomencl.cpp
src/frontends/qt4/GuiNomencl.h
src/frontends/qt4/GuiNote.cpp
src/frontends/qt4/GuiNote.h
src/frontends/qt4/GuiParagraph.cpp
src/frontends/qt4/GuiParagraph.h
src/frontends/qt4/GuiPrefs.cpp
src/frontends/qt4/GuiPrefs.h
src/frontends/qt4/GuiPrint.cpp
src/frontends/qt4/GuiPrint.h
src/frontends/qt4/GuiRef.cpp
src/frontends/qt4/GuiRef.h
src/frontends/qt4/GuiSearch.cpp
src/frontends/qt4/GuiSearch.h
src/frontends/qt4/GuiSendto.cpp
src/frontends/qt4/GuiSendto.h
src/frontends/qt4/GuiShowFile.cpp
src/frontends/qt4/GuiShowFile.h
src/frontends/qt4/GuiSpellchecker.cpp
src/frontends/qt4/GuiSpellchecker.h
src/frontends/qt4/GuiTabular.cpp
src/frontends/qt4/GuiTabular.h
src/frontends/qt4/GuiTabularCreate.cpp
src/frontends/qt4/GuiTabularCreate.h
src/frontends/qt4/GuiTexinfo.cpp
src/frontends/qt4/GuiTexinfo.h
src/frontends/qt4/GuiThesaurus.cpp
src/frontends/qt4/GuiThesaurus.h
src/frontends/qt4/GuiToc.cpp
src/frontends/qt4/GuiURL.cpp
src/frontends/qt4/GuiURL.h
src/frontends/qt4/GuiVSpace.cpp
src/frontends/qt4/GuiVSpace.h
src/frontends/qt4/GuiViewSource.cpp
src/frontends/qt4/GuiViewSource.h
src/frontends/qt4/GuiWrap.cpp
src/frontends/qt4/GuiWrap.h
src/frontends/qt4/Makefile.am
src/frontends/qt4/Qt2BC.cpp [deleted file]
src/frontends/qt4/Qt2BC.h [deleted file]

index 92d4fdd2adc912acda5bacb7887debdf05337e0e..610c20fb8cbd5043cbc9c62ea40acc55c6264d59 100644 (file)
@@ -44,7 +44,7 @@ Dialog * Dialogs::find_or_build(string const & name)
        if (it != dialogs_.end())
                return it->second.get();
 
-       dialogs_[name] = build(name);
+       dialogs_[name].reset(build(name));
        return dialogs_[name].get();
 }
 
index 3286c525d52cacde8f7c0582b3fdfaa584901490..335bd3f31d978781955cf912ac2c23b18d0606cb 100644 (file)
@@ -104,7 +104,7 @@ private:
        ///
        typedef boost::shared_ptr<Dialog> DialogPtr;
        ///
-       DialogPtr build(std::string const & name);
+       Dialog * build(std::string const & name);
 
        ///
        LyXView & lyxview_;
diff --git a/src/frontends/controllers/BCView.cpp b/src/frontends/controllers/BCView.cpp
deleted file mode 100644 (file)
index a04dfad..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- * \file BCView.cpp
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author Angus Leeming
- *
- * Full author contact details are available in file CREDITS.
- */
-
-#include <config.h>
-
-#include "BCView.h"
-#include "ButtonController.h"
-
-namespace lyx {
-namespace frontend {
-
-ButtonPolicy const & BCView::bp() const { return parent.policy(); }
-ButtonPolicy & BCView::bp() { return parent.policy(); }
-
-
-} // namespace frontend
-} // namespace lyx
diff --git a/src/frontends/controllers/BCView.h b/src/frontends/controllers/BCView.h
deleted file mode 100644 (file)
index e7136ef..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-// -*- 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
-
-namespace lyx {
-namespace frontend {
-
-class ButtonController;
-class ButtonPolicy;
-
-
-/** \c BCView is the View to ButtonController's Controller. It
- *  stores the individual GUI widgets and sets their activation state
- *  upon receipt of instructions from the controller.
- *
- *  It is a base class. The true, GUI, instantiations derive from it.
- */
-class BCView
-{
-public:
-       BCView(ButtonController & p) : parent(p) {}
-       virtual ~BCView() {}
-
-       //@{
-       /// Refresh the status of the Ok, Apply, Restore, Cancel buttons.
-       virtual void refresh() const = 0;
-       /// Refresh the status of any widgets in the read_only list
-       virtual void refreshReadOnly() const = 0;
-       //@}
-
-       /// A shortcut to the BP of the BC.
-       ButtonPolicy const & bp() const;
-       ButtonPolicy & bp();
-
-       ButtonController & parent;
-};
-
-
-} // namespace frontend
-} // namespace lyx
-
-#endif // BCVIEW_H
diff --git a/src/frontends/controllers/ButtonController.cpp b/src/frontends/controllers/ButtonController.cpp
deleted file mode 100644 (file)
index 90f7889..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-/**
- * \file ButtonController.cpp
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author Allan Rae
- *
- * Full author contact details are available in file CREDITS.
- */
-
-#include <config.h>
-
-#include "ButtonController.h"
-#include "BCView.h"
-#include "debug.h"
-
-namespace lyx {
-namespace frontend {
-
-BCView & ButtonController::view() const
-{
-       BOOST_ASSERT(view_.get());
-       return *view_.get();
-}
-
-void ButtonController::view(BCView * view)
-{
-       view_.reset(view);
-}
-
-
-void ButtonController::setPolicy(ButtonPolicy::Policy policy)
-{
-       policy_ = ButtonPolicy(policy);
-}
-
-
-void ButtonController::refresh() const
-{
-       view().refresh();
-}
-
-
-void ButtonController::refreshReadOnly() const
-{
-       view().refreshReadOnly();
-}
-
-
-void ButtonController::ok()
-{
-       input(ButtonPolicy::SMI_OKAY);
-}
-
-
-void ButtonController::input(ButtonPolicy::SMInput in)
-{
-       if (ButtonPolicy::SMI_NOOP == in)
-               return;
-       policy_.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);
-       }
-}
-
-
-bool ButtonController::readOnly(bool ro)
-{
-       LYXERR(Debug::GUI) << "Setting controller ro: " << ro << std::endl;
-
-       if (ro) {
-               policy_.input(ButtonPolicy::SMI_READ_ONLY);
-       } else {
-               policy_.input(ButtonPolicy::SMI_READ_WRITE);
-       }
-       view().refreshReadOnly();
-       view().refresh();
-       return ro;
-}
-
-} // namespace frontend
-} // namespace lyx
diff --git a/src/frontends/controllers/ButtonController.h b/src/frontends/controllers/ButtonController.h
deleted file mode 100644 (file)
index 3ca665a..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-// -*- C++ -*-
-/**
- * \file ButtonController.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 BUTTONCONTROLLER_H
-#define BUTTONCONTROLLER_H
-
-#include "ButtonPolicy.h"
-#include "BCView.h"
-
-#include <boost/scoped_ptr.hpp>
-#include <boost/noncopyable.hpp>
-
-namespace lyx {
-namespace frontend {
-
-/** \c ButtonController controls the activation of the OK, Apply and
- *  Cancel buttons.
- *
- * It 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.
- */
-
-class ButtonController : boost::noncopyable {
-public:
-       ButtonController() : policy_(ButtonPolicy::IgnorantPolicy) {}
-       //@{
-       /** Methods to set and get the GUI view (containing the actual
-        *   button widgets.
-        *  \param ptr is owned by the ButtonController.
-        */
-       void view(BCView * ptr);
-       BCView & view() const;
-       //@}
-
-       //@{
-       /** Methods to set and get the ButtonPolicy.
-        *  \param ptr is owned by the ButtonController.
-        */
-       void setPolicy(ButtonPolicy::Policy policy);
-       ButtonPolicy const & policy() const { return policy_; }
-       ButtonPolicy & policy() { return policy_; }
-       //@}
-
-       ///
-       void input(ButtonPolicy::SMInput);
-
-       //@{
-       /// Tell the BC that a particular button has been pressed.
-       void ok();
-       void apply();
-       void cancel();
-       void restore();
-       //@}
-
-       /// Tell the BC that the dialog is being hidden
-       void hide();
-
-       /**Refresh the activation state of the Ok, Apply, Close and
-        * Restore buttons.
-        */
-       void refresh() const;
-
-       /** Refresh the activation state of all the widgets under the control
-        *  of the BC to reflect the read-only status of the underlying buffer.
-        */
-       void refreshReadOnly() const;
-
-       /** Passthrough function -- returns its input value
-        *  Tell the BC about the read-only status of the underlying buffer.
-        */
-       bool readOnly(bool = true);
-
-       /** \param validity Tell the BC that the data is, or is not, valid.
-        *  Sets the activation state of the buttons immediately.
-        */
-       void valid(bool = true);
-
-private:
-       ButtonPolicy policy_;
-       boost::scoped_ptr<BCView> view_;
-};
-
-} // namespace frontend
-} // namespace lyx
-
-#endif // BUTTONCONTROLLER_H
index b06c95ef58a92952c05a1b7153e667b3f0a90190..fe9444be3932bff981b02ceeb88d2a4c60b22b49 100644 (file)
@@ -11,7 +11,6 @@
 #include <config.h>
 
 #include "ControlCharacter.h"
-#include "ButtonController.h"
 
 #include "Buffer.h"
 #include "BufferParams.h"
@@ -46,7 +45,7 @@ bool ControlCharacter::initialiseParams(string const &)
            getBar()      != IGNORE ||
            getColor()    != Color::ignore ||
            font_->language() != ignore_language)
-               dialog().bc().valid();
+               dialog().setButtonsValid(true);
 
        return true;
 }
index f30762e697094270ad5ad60ad41b5a2d498fbea1..b2e262d0e9ab8ef40392f1de49061d566e1af0ce 100644 (file)
@@ -15,7 +15,6 @@
 #include "Buffer.h"
 #include "BufferParams.h"
 #include "BufferView.h"
-#include "ButtonController.h"
 #include "Cursor.h"
 #include "FuncRequest.h"
 #include "Lexer.h"
@@ -117,7 +116,7 @@ bool ControlParagraph::initialiseParams(string const & data)
        // If "update", then set the activation status of the button controller
        if (action > 0) {
                bool const accept = action == 1;
-               dialog().bc().valid(accept);
+               dialog().setButtonsValid(accept);
        }
        return true;
 }
index bcb0df017b1fe916edcac1ba50a9a52c84d03fa3..21236906ee135091c404b454bc2121de8a893f0b 100644 (file)
@@ -12,7 +12,6 @@
 
 #include "ControlPrint.h"
 
-#include "ButtonController.h"
 #include "frontend_helpers.h"
 
 #include "Buffer.h"
@@ -49,7 +48,7 @@ bool ControlPrint::initialiseParams(std::string const &)
        params_.reset(new PrinterParams(PrinterParams::PRINTER,
                                        lyxrc.printer, name));
 
-       dialog().bc().valid(); // so that the user can press Ok
+       dialog().setButtonsValid(true); // so that the user can press Ok
        return true;
 }
 
index 1a43d1af07c32e13c2c2cce7d864872bec145a6e..e642fedd05a70bcddc4fcb9541a7342fe5e4fe8f 100644 (file)
@@ -12,7 +12,6 @@
 #include <config.h>
 
 #include "ControlVSpace.h"
-#include "ButtonController.h"
 
 #include "FuncRequest.h"
 #include "insets/InsetVSpace.h"
@@ -34,7 +33,7 @@ bool ControlVSpace::initialiseParams(string const & data)
        InsetVSpaceMailer::string2params(data, params_);
 
        // so that the user can press Ok
-       dialog().bc().valid();
+       dialog().setButtonsValid(true);
 
        return true;
 }
index 1c8cd2e97a9391971712b6529aef20a6cb16294e..aae5975acda74172fc4f9e4272064cb86d803609 100644 (file)
@@ -12,9 +12,6 @@
 
 #include "Dialog.h"
 
-#include "ButtonController.h"
-#include "BCView.h"
-
 #include "frontends/LyXView.h"
 
 #include "debug.h"
@@ -29,43 +26,16 @@ namespace lyx {
 namespace frontend {
 
 Dialog::Dialog(LyXView & lv, string const & name)
-       : is_closing_(false), kernel_(lv), name_(name),
-         bc_ptr_(new ButtonController)
+       : is_closing_(false), kernel_(lv), name_(name)
 {}
 
 
-void Dialog::ApplyButton()
-{
-       apply();
-       bc().apply();
-}
-
-
-void Dialog::OKButton()
-{
-       is_closing_ = true;
-       apply();
-       is_closing_ = false;
-       hide();
-       bc().ok();
-}
-
-
-void Dialog::CancelButton()
-{
-       hide();
-       bc().cancel();
-}
+Dialog::~Dialog()
+{}
 
 
-void Dialog::RestoreButton()
-{
-       // Tell the kernel that a request to refresh the dialog's contents
-       // has been received. It's up to the kernel to supply the necessary
-       // info by calling Dialog::update().
-       kernel().updateDialog(name_);
-       bc().restore();
-}
+void Dialog::setButtonsValid(bool valid)
+{}
 
 
 void Dialog::show(string const & data)
@@ -80,11 +50,9 @@ void Dialog::show(string const & data)
                return;
        }
 
-       bc().readOnly(kernel().isBufferReadonly());
+       preShow();
        view().show();
-
-       // The widgets may not be valid, so refresh the button controller
-       bc().refresh();
+       postShow();
 }
 
 
@@ -99,11 +67,14 @@ void Dialog::update(string const & data)
                return;
        }
 
-       bc().readOnly(kernel().isBufferReadonly());
+       preUpdate();
        view().update();
+       postUpdate();
+}
 
-       // The widgets may not be valid, so refresh the button controller
-       bc().refresh();
+
+void Dialog::checkStatus()
+{
 }
 
 
@@ -150,13 +121,6 @@ void Dialog::redraw()
 }
 
 
-ButtonController & Dialog::bc() const
-{
-       BOOST_ASSERT(bc_ptr_.get());
-       return *bc_ptr_.get();
-}
-
-
 void Dialog::setController(Controller * i)
 {
        BOOST_ASSERT(i && !controller_ptr_.get());
@@ -171,31 +135,6 @@ void Dialog::setView(View * v)
 }
 
 
-void Dialog::checkStatus()
-{
-       // buffer independant dialogs are always active.
-       // This check allows us leave canApply unimplemented for some dialogs.
-       if (!controller().isBufferDependent())
-               return;
-
-       // deactivate the dialog if we have no buffer
-       if (!kernel().isBufferAvailable()) {
-               bc().readOnly(true);
-               return;
-       }
-
-       // check whether this dialog may be active
-       if (controller().canApply()) {
-               bool const readonly = kernel().isBufferReadonly();
-               bc().readOnly(readonly);
-               // refreshReadOnly() is too generous in _enabling_ widgets
-               // update dialog to disable disabled widgets again
-               if (!readonly || controller().canApplyToReadOnly())
-                       view().update();
-       } else
-               bc().readOnly(true);
-}
-
 
 Dialog::Controller::Controller(Dialog & parent)
        : parent_(parent)
index 8cf351de4013b845b66b1ef59588928fe6c73fb2..89d93a0f7cde337f94be6eb04b752e372d4e20ed 100644 (file)
@@ -23,7 +23,6 @@
 namespace lyx {
 namespace frontend {
 
-class ButtonController;
 class LyXView;
 
 /** \c Dialog collects the different parts of a Model-Controller-View
@@ -35,23 +34,13 @@ public:
        /// \param name is the identifier given to the dialog by its parent
        /// container.
        Dialog(LyXView & lv, std::string const & name);
+       virtual ~Dialog();
 
        /** The Dialog's name is the means by which a dialog identifies
         *  itself to the kernel.
         */
        std::string const & name() const { return name_; }
 
-       /** \name Buttons
-        *  These methods are publicly accessible because they are invoked
-        *  by the View when the user presses... guess what ;-)
-        */
-       //@{
-       void ApplyButton();
-       void OKButton();
-       void CancelButton();
-       void RestoreButton();
-       //@}
-
        /** \name Container Access
         *  These methods are publicly accessible because they are invoked
         *  by the parent container acting on commands from the LyX kernel.
@@ -65,6 +54,17 @@ public:
        void hide();
        bool isVisible() const;
 
+       // Override in GuiDialog
+       virtual void preShow() {}
+       virtual void postShow() {}
+       virtual void preUpdate() {}
+       virtual void postUpdate() {}
+
+       virtual void OkButton() {}
+       virtual void ApplyButton() {}
+       virtual void CancelButton() {}
+       virtual void RestoreButton() {}
+
        /** This function is called, for example, if the GUI colours
         *  have been changed.
         */
@@ -112,17 +112,17 @@ public:
         */
        //@{
        Controller & controller() const;
-       ButtonController & bc() const;
        View & view() const;
        //@}
 
-private:
+
+       virtual void setButtonsValid(bool valid);
+protected:
        void apply();
 
        bool is_closing_;
        Kernel kernel_;
        std::string name_;
-       boost::scoped_ptr<ButtonController> bc_ptr_;
        boost::scoped_ptr<Controller> controller_ptr_;
        boost::scoped_ptr<View> view_ptr_;
 };
@@ -286,9 +286,6 @@ protected:
 
        Controller & getController() { return p_.controller(); }
        Controller const & getController() const { return p_.controller(); }
-
-       ButtonController & bc() { return p_.bc(); }
-       ButtonController const & bc() const { return p_.bc(); }
        //@}
 
 private:
index 4834bbf9e3efd6c757df3067aaad91e2282c270b..2e63998b10354124afc189f1d2251fa5eb1dc650 100644 (file)
@@ -7,10 +7,9 @@ EXTRA_DIST =
 pkglib_LTLIBRARIES = liblyxcontrollers.la
 
 SOURCEFILES = \
+       Dialog.cpp \
        Dialog.cpp \
        Kernel.cpp \
-       BCView.cpp \
-       ButtonController.cpp \
        ButtonPolicy.cpp \
        ControlAboutlyx.cpp \
        ControlBibtex.cpp \
@@ -53,7 +52,6 @@ SOURCEFILES = \
 
 HEADERFILES = \
        Kernel.h \
-       ButtonController.h \
        ButtonPolicy.h \
        ControlAboutlyx.h \
        ControlBibtex.h \
index 896c65b46e5a0e06f001007cb09808c5a90a1d4d..79fa3adea5973dacf808621131cc473f89c82995 100644 (file)
 #include <utility>
 #include <vector>
 #include <string>
-#include <boost/bind.hpp>
-#include <algorithm>
-#include <utility>
-#include <map>
-
-class Buffer;
 
 class Color_color;
 
 /** Functions of use to the character GUI controller and view */
 namespace lyx {
+
+namespace support { class FileFilterList; }
+
 namespace frontend {
 
 ///
@@ -83,14 +80,6 @@ std::vector<LanguagePair> const getLanguageData(bool character_dlg);
 /// sort colors for the gui
 std::vector<Color_color> const getSortedColors(std::vector<Color_color> colors);
 
-} // namespace frontend
-
-
-namespace support { class FileFilterList; }
-
-
-namespace frontend {
-
 /** Launch a file dialog and return the chosen file.
     filename: a suggested filename.
     title: the title of the dialog.
@@ -157,29 +146,6 @@ browseDir(docstring const & pathname,
 std::vector<docstring> const getLatexUnits();
 
 
-/** Functions to extract vectors of the first and second elems from a
-    vector<pair<A,B> >
-*/
-template<class Pair>
-std::vector<typename Pair::first_type> const
-getFirst(std::vector<Pair> const & pr)
-{
-       std::vector<typename Pair::first_type> tmp(pr.size());
-       std::transform(pr.begin(), pr.end(), tmp.begin(),
-                      boost::bind(&Pair::first, _1));
-       return tmp;
-}
-
-template<class Pair>
-std::vector<typename Pair::second_type> const
-getSecond(std::vector<Pair> const & pr)
-{
-       std::vector<typename Pair::second_type> tmp(pr.size());
-       std::transform(pr.begin(), pr.end(), tmp.begin(),
-                      boost::bind(&Pair::second, _1));
-       return tmp;
-}
-
 /** Build filelists of all availabe bst/cls/sty-files. Done through
  *  kpsewhich and an external script, saved in *Files.lst.
  */
diff --git a/src/frontends/qt4/ButtonController.cpp b/src/frontends/qt4/ButtonController.cpp
new file mode 100644 (file)
index 0000000..26279aa
--- /dev/null
@@ -0,0 +1,217 @@
+/**
+ * \file ButtonController.cpp
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Allan Rae
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
+
+#include "ButtonController.h"
+#include "debug.h"
+#include "qt_helpers.h"
+
+#include <QPushButton>
+#include <QLineEdit>
+#include <QLabel>
+#include <QValidator>
+
+namespace lyx {
+namespace frontend {
+
+ButtonController::ButtonController()
+       : okay_(0), apply_(0), cancel_(0), restore_(0),
+               policy_(ButtonPolicy::IgnorantPolicy)
+{}
+
+
+void ButtonController::setPolicy(ButtonPolicy::Policy policy)
+{
+       policy_ = ButtonPolicy(policy);
+}
+
+
+void ButtonController::ok()
+{
+       input(ButtonPolicy::SMI_OKAY);
+}
+
+
+void ButtonController::input(ButtonPolicy::SMInput in)
+{
+       if (ButtonPolicy::SMI_NOOP == in)
+               return;
+       policy_.input(in);
+       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::setValid(bool v)
+{
+       input(v ? ButtonPolicy::SMI_VALID : ButtonPolicy::SMI_INVALID);
+}
+
+
+bool ButtonController::setReadOnly(bool ro)
+{
+       LYXERR(Debug::GUI) << "Setting controller ro: " << ro << std::endl;
+
+       policy_.input(ro ?
+               ButtonPolicy::SMI_READ_ONLY : ButtonPolicy::SMI_READ_WRITE);
+       refreshReadOnly();
+       refresh();
+       return ro;
+}
+
+
+void ButtonController::refresh() const
+{
+       LYXERR(Debug::GUI) << "Calling BC refresh()" << std::endl;
+
+       bool const all_valid = checkWidgets();
+
+       if (okay_) {
+               bool const enabled =
+                       all_valid && policy().buttonStatus(ButtonPolicy::OKAY);
+               okay_->setEnabled(enabled);
+       }
+       if (apply_) {
+               bool const enabled =
+                       all_valid && policy().buttonStatus(ButtonPolicy::APPLY);
+               apply_->setEnabled(enabled);
+       }
+       if (restore_) {
+               bool const enabled =
+                       all_valid && policy().buttonStatus(ButtonPolicy::RESTORE);
+               restore_->setEnabled(enabled);
+       }
+       if (cancel_) {
+               bool const enabled = policy().buttonStatus(ButtonPolicy::CANCEL);
+               if (enabled)
+                       cancel_->setText(toqstr(_("Cancel")));
+               else
+                       cancel_->setText(toqstr(_("Close")));
+       }
+}
+
+
+void ButtonController::refreshReadOnly() const
+{
+       if (read_only_.empty())
+               return;
+
+       bool const enable = !policy().isReadOnly();
+
+       Widgets::const_iterator end = read_only_.end();
+       Widgets::const_iterator iter = read_only_.begin();
+       for (; iter != end; ++iter)
+               setWidgetEnabled(*iter, enable);
+}
+
+
+void ButtonController::setWidgetEnabled(QWidget * obj, bool enabled) const
+{
+       if (QLineEdit * le = qobject_cast<QLineEdit*>(obj))
+               le->setReadOnly(!enabled);
+       else
+               obj->setEnabled(enabled);
+
+       obj->setFocusPolicy(enabled ? Qt::StrongFocus : Qt::NoFocus);
+}
+
+
+void ButtonController::addCheckedLineEdit(QLineEdit * input, QWidget * label)
+{
+       checked_widgets.push_back(CheckedLineEdit(input, label));
+}
+
+
+bool ButtonController::checkWidgets() const
+{
+       bool valid = true;
+
+       CheckedWidgetList::const_iterator it  = checked_widgets.begin();
+       CheckedWidgetList::const_iterator end = checked_widgets.end();
+
+       for (; it != end; ++it)
+               valid &= it->check();
+
+       // return valid status after checking ALL widgets
+       return valid;
+}
+
+
+//////////////////////////////////////////////////////////////
+//
+// CheckedLineEdit
+//
+//////////////////////////////////////////////////////////////
+
+static void setWarningColor(QWidget * widget)
+{
+       QPalette pal = widget->palette();
+       pal.setColor(QPalette::Active, QPalette::Foreground, QColor(255, 0, 0));
+       widget->setPalette(pal);
+}
+
+
+CheckedLineEdit::CheckedLineEdit(QLineEdit * input, QWidget * label)
+       : input_(input), label_(label)
+{}
+
+
+bool CheckedLineEdit::check() const
+{
+       QValidator const * validator = input_->validator();
+       if (!validator)
+               return true;
+
+       QString t = input_->text();
+       int p = 0;
+       bool const valid = validator->validate(t, p) == QValidator::Acceptable;
+
+       // Visual feedback.
+       if (valid)
+               input_->setPalette(QPalette());
+       else
+               setWarningColor(input_);
+
+       if (!label_) {
+               if (valid)
+                       label_->setPalette(QPalette());
+               else
+                       setWarningColor(label_);
+       }
+
+       return valid;
+}
+
+} // namespace frontend
+} // namespace lyx
diff --git a/src/frontends/qt4/ButtonController.h b/src/frontends/qt4/ButtonController.h
new file mode 100644 (file)
index 0000000..fd226cd
--- /dev/null
@@ -0,0 +1,152 @@
+// -*- C++ -*-
+/**
+ * \file ButtonController.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 BUTTONCONTROLLER_H
+#define BUTTONCONTROLLER_H
+
+#include "ButtonPolicy.h"
+#include "gettext.h"
+
+class QWidget;
+class QPushButton;
+class QLineEdit;
+
+namespace lyx {
+namespace frontend {
+
+class CheckedLineEdit
+{
+public:
+       CheckedLineEdit(QLineEdit * input, QWidget * label = 0);
+       bool check() const;
+
+private:
+       // non-owned
+       QLineEdit * input_;
+       QWidget * label_;
+};
+
+/** General purpose button controller for up to four buttons.
+    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.
+*/
+
+
+/** \c ButtonController controls the activation of the OK, Apply and
+ *  Cancel buttons.
+ *
+ * It 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.
+ */
+
+class ButtonController
+{
+public:
+       ButtonController();
+
+       //@{
+       /** Methods to set and get the ButtonPolicy.
+        *  \param ptr is owned by the ButtonController.
+        */
+       void setPolicy(ButtonPolicy::Policy policy);
+       ButtonPolicy const & policy() const { return policy_; }
+       ButtonPolicy & policy() { return policy_; }
+       //@}
+
+       ///
+       void input(ButtonPolicy::SMInput);
+
+       //@{
+       /// Tell the BC that a particular button has been pressed.
+       void ok();
+       void apply();
+       void cancel();
+       void restore();
+       //@}
+
+       /// Tell the BC that the dialog is being hidden
+       void hide();
+
+       /**Refresh the activation state of the Ok, Apply, Close and
+        * Restore buttons.
+        */
+       void refresh() const;
+
+       /** Refresh the activation state of all the widgets under the control
+        *  of the BC to reflect the read-only status of the underlying buffer.
+        */
+       void refreshReadOnly() const;
+
+       /** Passthrough function -- returns its input value
+        *  Tell the BC about the read-only status of the underlying buffer.
+        */
+       bool setReadOnly(bool = true);
+
+       /** \param validity Tell the BC that the data is, or is not, valid.
+        *  Sets the activation state of the buttons immediately.
+        */
+       void setValid(bool = true);
+
+       //
+       // View
+       //
+
+       //@{
+       /** Store pointers to these widgets.
+        */
+       void setOK(QPushButton * obj) { okay_ = obj; }
+       void setApply(QPushButton * obj) { apply_ = obj; }
+       void setCancel(QPushButton * obj) { cancel_ = obj; }
+       void setRestore(QPushButton * obj) { restore_ = obj; }
+       //@}
+
+       /** Add a pointer to the list of widgets whose activation
+        *  state is dependent upon the read-only status of the
+        *  underlying buffer.
+        */
+       void addReadOnly(QWidget * obj) { read_only_.push_back(obj); }
+
+       /** Add a widget to the list of all widgets whose validity should
+        *  be checked explicitly when the buttons are refreshed.
+        */
+       void addCheckedLineEdit(QLineEdit * input, QWidget * label = 0);
+
+protected:
+       /// \return true if all CheckedWidgets are in a valid state.
+       bool checkWidgets() const;
+
+private:
+       typedef std::list<CheckedLineEdit> CheckedWidgetList;
+       CheckedWidgetList checked_widgets;
+
+private:
+       /// Updates the widget sensitivity (enabled/disabled)
+       void setWidgetEnabled(QWidget *, bool enabled) const;
+
+       QPushButton * okay_;
+       QPushButton * apply_;
+       QPushButton * cancel_;
+       QPushButton * restore_;
+
+       typedef std::list<QWidget *> Widgets;
+       Widgets read_only_;
+
+private:
+       ButtonPolicy policy_;
+};
+
+} // namespace frontend
+} // namespace lyx
+
+#endif // BUTTONCONTROLLER_H
index 231e0defef8cbc8e225a15dac6b83d70dd2bea32..78fa8e9e4bd4ee75d51ba53c6fc875a562189119 100644 (file)
@@ -11,8 +11,8 @@
 #include <config.h>
 
 #include "Dialogs.h"
+#include "GuiDialog.h"
 
-#include "Qt2BC.h"
 #include "ButtonController.h"
 #include "DockView.h"
 #include "GuiView.h"
@@ -110,12 +110,11 @@ bool Dialogs::isValidName(string const & name) const
 }
 
 
-Dialogs::DialogPtr Dialogs::build(string const & name)
+Dialog * Dialogs::build(string const & name)
 {
        BOOST_ASSERT(isValidName(name));
 
-       DialogPtr dialog(new Dialog(lyxview_, name));
-       dialog->bc().view(new Qt2BC(dialog->bc()));
+       GuiDialog * dialog = new GuiDialog(lyxview_, name);
 
        if (name == "aboutlyx") {
                dialog->setController(new ControlAboutlyx(*dialog));
index 90acf73c91e68919f151e1068be1b6b97e6800b7..36ef8ace723186946349916c25d7487fd547ac8e 100644 (file)
 #include <config.h>
 
 #include "GuiAbout.h"
-#include "Qt2BC.h"
 #include "qt_helpers.h"
-
-#include "controllers/ButtonController.h"
-#include "controllers/ControlAboutlyx.h"
+#include "gettext.h"
 
 #include "support/lstrings.h"
 
@@ -38,7 +35,7 @@ namespace lyx {
 namespace frontend {
 
 
-GuiAbout::GuiAbout(Dialog & parent)
+GuiAbout::GuiAbout(GuiDialog & parent)
        : GuiView<GuiAboutDialog>(parent, _("About LyX"))
 {
 }
@@ -112,8 +109,8 @@ void GuiAbout::build_dialog()
        dialog_->setMinimumSize(dialog_->sizeHint());
 
        // Manage the cancel/close button
-       bcview().setCancel(dialog_->closePB);
-       bc().refresh();
+       bc().setCancel(dialog_->closePB);
+       //FIXME bc().refresh();
 }
 
 } // namespace frontend
index 0be3eae0e526d7bead5b18baf336c01835eaf95f..27ed42ed79844b339f1f129fbc3e8eacb0d3377d 100644 (file)
@@ -36,7 +36,7 @@ public:
 class GuiAbout : public GuiView<GuiAboutDialog>
 {
 public:
-       GuiAbout(Dialog &);
+       GuiAbout(GuiDialog &);
        /// parent controller
        ControlAboutlyx & controller()
        { return static_cast<ControlAboutlyx &>(this->getController()); }
index 88512371c3e94769253f48cfde6025ad81306b5e..3f9412640ac8e070751623b6402deb7489645455 100644 (file)
@@ -11,7 +11,6 @@
 #include <config.h>
 
 #include "GuiBibitem.h"
-#include "Qt2BC.h"
 #include "qt_helpers.h"
 
 #include <QCloseEvent>
@@ -62,7 +61,7 @@ void GuiBibitemDialog::closeEvent(QCloseEvent *e)
 /////////////////////////////////////////////////////////////////////
 
 
-GuiBibitem::GuiBibitem(Dialog & parent)
+GuiBibitem::GuiBibitem(GuiDialog & parent)
        : GuiView<GuiBibitemDialog>(parent, _("Bibliography Entry Settings"))
 {
 }
@@ -72,10 +71,10 @@ void GuiBibitem::build_dialog()
 {
        dialog_.reset(new GuiBibitemDialog(this));
 
-       bcview().setOK(dialog_->okPB);
-       bcview().setCancel(dialog_->closePB);
-       bcview().addReadOnly(dialog_->keyED);
-       bcview().addReadOnly(dialog_->labelED);
+       bc().setOK(dialog_->okPB);
+       bc().setCancel(dialog_->closePB);
+       bc().addReadOnly(dialog_->keyED);
+       bc().addReadOnly(dialog_->labelED);
 }
 
 
index 7f6859f4e9bd0eb600a9386180f072e9b05af99d..57b536f16f39f70dd503ccbfdd5e0b4e16c26875 100644 (file)
@@ -42,7 +42,7 @@ class GuiBibitem : public GuiView<GuiBibitemDialog>
 {
 public:
        ///
-       GuiBibitem(Dialog &);
+       GuiBibitem(GuiDialog &);
        /// parent controller
        ControlCommand & controller()
        { return static_cast<ControlCommand &>(this->getController()); }
index 06210eefbd9f50810f1fcfb6547ea1d745d4345a..0dba536ab430fe67849bdc24dfeea32e11ac45cd 100644 (file)
@@ -15,7 +15,6 @@
 #include "GuiBibtex.h"
 
 #include "ui_BibtexAddUi.h"
-#include "Qt2BC.h"
 #include "qt_helpers.h"
 #include "Validator.h"
 #include "LyXRC.h"
@@ -80,14 +79,10 @@ GuiBibtexDialog::GuiBibtexDialog(GuiBibtex * form)
                this, SLOT(addPressed()));
 
        add_ = new UiDialog<Ui::BibtexAddUi>(this, true);
-
-       Qt2BC * bcview = new Qt2BC(add_bc_);
-       add_bc_.view(bcview);
        add_bc_.setPolicy(ButtonPolicy::OkCancelPolicy);
-
-       bcview->setOK(add_->addPB);
-       bcview->setCancel(add_->closePB);
-       bcview->addCheckedLineEdit(add_->bibED, 0);
+       add_bc_.setOK(add_->addPB);
+       add_bc_.setCancel(add_->closePB);
+       add_bc_.addCheckedLineEdit(add_->bibED, 0);
 
        connect(add_->bibED, SIGNAL(textChanged(const QString &)),
                this, SLOT(bibEDChanged()));
@@ -105,7 +100,6 @@ GuiBibtexDialog::GuiBibtexDialog(GuiBibtex * form)
                this, SLOT(browseBibPressed()));
        connect(add_->closePB, SIGNAL(clicked()),
                add_, SLOT(reject()));
-
 }
 
 
@@ -114,7 +108,7 @@ void GuiBibtexDialog::bibEDChanged()
        // Indicate to the button controller that the contents have
        // changed. The actual test of validity is carried out by
        // the checkedLineEdit.
-       add_bc_.valid(true);
+       add_bc_.setValid(true);
 }
 
 
@@ -176,7 +170,7 @@ void GuiBibtexDialog::browseBibPressed()
 
 void GuiBibtexDialog::addPressed()
 {
-       add_bc_.valid(false);
+       add_bc_.setValid(false);
        add_->exec();
 }
 
@@ -231,7 +225,7 @@ void GuiBibtexDialog::databaseChanged()
 
 void GuiBibtexDialog::availableChanged()
 {
-       add_bc_.valid(true);
+       add_bc_.setValid(true);
 }
 
 
@@ -244,12 +238,12 @@ void GuiBibtexDialog::closeEvent(QCloseEvent *e)
 
 /////////////////////////////////////////////////////////////////////
 //
-// QBibTex
+// GuiBibTex
 //
 /////////////////////////////////////////////////////////////////////
 
 
-GuiBibtex::GuiBibtex(Dialog & parent)
+GuiBibtex::GuiBibtex(GuiDialog & parent)
        : GuiView<GuiBibtexDialog>(parent, _("BibTeX Bibliography"))
 {
 }
@@ -259,14 +253,14 @@ void GuiBibtex::build_dialog()
 {
        dialog_.reset(new GuiBibtexDialog(this));
 
-       bcview().setOK(dialog_->okPB);
-       bcview().setCancel(dialog_->closePB);
-       bcview().addReadOnly(dialog_->databaseLW);
-       bcview().addReadOnly(dialog_->stylePB);
-       bcview().addReadOnly(dialog_->styleCB);
-       bcview().addReadOnly(dialog_->bibtocCB);
-       bcview().addReadOnly(dialog_->addBibPB);
-       bcview().addReadOnly(dialog_->deletePB);
+       bc().setOK(dialog_->okPB);
+       bc().setCancel(dialog_->closePB);
+       bc().addReadOnly(dialog_->databaseLW);
+       bc().addReadOnly(dialog_->stylePB);
+       bc().addReadOnly(dialog_->styleCB);
+       bc().addReadOnly(dialog_->bibtocCB);
+       bc().addReadOnly(dialog_->addBibPB);
+       bc().addReadOnly(dialog_->deletePB);
 }
 
 
index 8033c51db3e869a19497902e21195460b6b79887..30afc2ba5ed8f78888b0f87e76a0e672bf1e1061 100644 (file)
@@ -71,7 +71,7 @@ class GuiBibtex : public GuiView<GuiBibtexDialog>
 public:
        friend class GuiBibtexDialog;
 
-       GuiBibtex(Dialog &);
+       GuiBibtex(GuiDialog &);
        /// parent controller
        ControlBibtex & controller()
        { return static_cast<ControlBibtex &>(this->getController()); }
index 2dc3045923b8d9383e01cb44994826abff692008..3b06509ce3da2c9c6fed42ad54ac9ae6f500133d 100644 (file)
@@ -16,7 +16,6 @@
 
 #include "LengthCombo.h"
 #include "qt_helpers.h"
-#include "Qt2BC.h"
 #include "lengthcommon.h"
 #include "LyXRC.h" // to set the default length values
 #include "Validator.h"
@@ -142,7 +141,7 @@ void GuiBoxDialog::restoreClicked()
 //////////////////////////////////////////////////////////////////
 
 
-GuiBox::GuiBox(Dialog & parent)
+GuiBox::GuiBox(GuiDialog & parent)
        : GuiView<GuiBoxDialog>(parent, _("Box Settings"))
 {}
 
@@ -162,24 +161,24 @@ void GuiBox::build_dialog()
        for (unsigned int i = 1; i < gui_names_spec_.size(); ++i)
                dialog_->heightUnitsLC->addItem(toqstr(gui_names_spec_[i]));
 
-       bcview().addReadOnly(dialog_->typeCO);
-       bcview().addReadOnly(dialog_->innerBoxCO);
-       bcview().addReadOnly(dialog_->valignCO);
-       bcview().addReadOnly(dialog_->ialignCO);
-       bcview().addReadOnly(dialog_->halignCO);
-       bcview().addReadOnly(dialog_->widthED);
-       bcview().addReadOnly(dialog_->heightED);
-       bcview().addReadOnly(dialog_->widthUnitsLC);
-       bcview().addReadOnly(dialog_->heightUnitsLC);
-
-       bcview().setRestore(dialog_->restorePB);
-       bcview().setOK(dialog_->okPB);
-       bcview().setApply(dialog_->applyPB);
-       bcview().setCancel(dialog_->closePB);
+       bc().addReadOnly(dialog_->typeCO);
+       bc().addReadOnly(dialog_->innerBoxCO);
+       bc().addReadOnly(dialog_->valignCO);
+       bc().addReadOnly(dialog_->ialignCO);
+       bc().addReadOnly(dialog_->halignCO);
+       bc().addReadOnly(dialog_->widthED);
+       bc().addReadOnly(dialog_->heightED);
+       bc().addReadOnly(dialog_->widthUnitsLC);
+       bc().addReadOnly(dialog_->heightUnitsLC);
+
+       bc().setRestore(dialog_->restorePB);
+       bc().setOK(dialog_->okPB);
+       bc().setApply(dialog_->applyPB);
+       bc().setCancel(dialog_->closePB);
 
        // initialize the length validator
-       addCheckedLineEdit(bcview(), dialog_->widthED, dialog_->widthLA);
-       addCheckedLineEdit(bcview(), dialog_->heightED, dialog_->heightLA);
+       bc().addCheckedLineEdit(dialog_->widthED, dialog_->widthLA);
+       bc().addCheckedLineEdit(dialog_->heightED, dialog_->heightLA);
 }
 
 
index 6d9e3dfc499fa70cf98d825db501a935d85c4be4..1cd65f96c544187f85ac524e657cee6e2f105082 100644 (file)
@@ -47,7 +47,7 @@ class GuiBox : public GuiView<GuiBoxDialog>
 {
 public:
        ///
-       GuiBox(Dialog &);
+       GuiBox(GuiDialog &);
        /// parent controller
        ControlBox & controller()
        { return static_cast<ControlBox &>(this->getController()); }
index f292dc73115f709c17e518539199254a4a7ca69e..78af17f9f67e6f07e6aeb8c20005088e54a05b3d 100644 (file)
@@ -11,7 +11,6 @@
 #include <config.h>
 
 #include "GuiBranch.h"
-#include "Qt2BC.h"
 #include "qt_helpers.h"
 
 #include "BranchList.h"
@@ -63,7 +62,7 @@ void GuiBranchDialog::change_adaptor()
 /////////////////////////////////////////////////////////////////////
 
 
-GuiBranch::GuiBranch(Dialog & parent)
+GuiBranch::GuiBranch(GuiDialog & parent)
        : GuiView<GuiBranchDialog>(parent, _("Branch Settings"))
 {}
 
@@ -72,8 +71,8 @@ void GuiBranch::build_dialog()
 {
        dialog_.reset(new GuiBranchDialog(this));
 
-       bcview().setOK(dialog_->okPB);
-       bcview().setCancel(dialog_->closePB);
+       bc().setOK(dialog_->okPB);
+       bc().setCancel(dialog_->closePB);
 }
 
 
index d3c3b66e8dff9993628c8cbdde1f0e836cbb3573..2bf448d46cb94a2e1e1af88f8e55da00f4f45438 100644 (file)
@@ -42,7 +42,7 @@ class GuiBranch : public GuiView<GuiBranchDialog>
 {
 public:
        /// Constructor
-       GuiBranch(Dialog &);
+       GuiBranch(GuiDialog &);
        /// parent controller
        ControlBranch & controller()
        { return static_cast<ControlBranch &>(this->getController()); }
index 7f4bb8b7b81ae2c47ae9a12551288f44e50cae0b..6375e793183a8fd21dd4f38ed1f5796a76673d98 100644 (file)
@@ -12,7 +12,6 @@
 #include <config.h>
 
 #include "GuiChanges.h"
-#include "Qt2BC.h"
 #include "qt_helpers.h"
 
 #include "support/lstrings.h"
@@ -76,7 +75,7 @@ void GuiChangesDialog::closeEvent(QCloseEvent *e)
 /////////////////////////////////////////////////////////////////////
 
 
-GuiChanges::GuiChanges(Dialog & parent)
+GuiChanges::GuiChanges(GuiDialog & parent)
        : GuiView<GuiChangesDialog>(parent, _("Merge Changes"))
 {
 }
@@ -86,9 +85,9 @@ void GuiChanges::build_dialog()
 {
        dialog_.reset(new GuiChangesDialog(this));
 
-       bcview().setCancel(dialog_->closePB);
-       bcview().addReadOnly(dialog_->acceptPB);
-       bcview().addReadOnly(dialog_->rejectPB);
+       bc().setCancel(dialog_->closePB);
+       bc().addReadOnly(dialog_->acceptPB);
+       bc().addReadOnly(dialog_->rejectPB);
 }
 
 
index 0bb2937da678c4bf9eab699479842b588f788883..19efd6e31d3f2e39e9ad79f3851bf742565320c9 100644 (file)
@@ -47,7 +47,7 @@ class GuiChanges : public GuiView<GuiChangesDialog>
 {
 public:
        ///
-       GuiChanges(Dialog &);
+       GuiChanges(GuiDialog &);
        /// parent controller
        ControlChanges & controller()
        { return static_cast<ControlChanges &>(this->getController()); }
index f10b40619e3d2197a1dce8739b5318c560225454..369486cd60731817e210646f4b97a2ee351486dc 100644 (file)
@@ -12,7 +12,6 @@
 #include <config.h>
 
 #include "GuiCharacter.h"
-#include "Qt2BC.h"
 #include "qt_helpers.h"
 #include "frontend_helpers.h"
 #include "Color.h"
@@ -85,7 +84,7 @@ void GuiCharacterDialog::closeEvent(QCloseEvent * e)
 /////////////////////////////////////////////////////////////////////
 
 
-GuiCharacter::GuiCharacter(Dialog & parent)
+GuiCharacter::GuiCharacter(GuiDialog & parent)
        : GuiView<GuiCharacterDialog>(parent, _("Text Style"))
 {
 }
@@ -133,18 +132,18 @@ void GuiCharacter::build_dialog()
                dialog_->langCO->addItem(toqstr(cit->first));
        }
 
-       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);
+       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);
 
 // FIXME: hack to work around resizing bug in Qt >= 4.2
 // bug verified with Qt 4.2.{0-3} (JSpitzm)
index 09e9507db04b07a58552deb016500d41cdd5f98c..519901dcd64debc6488ad1424e06be7d187b5d8b 100644 (file)
@@ -44,7 +44,7 @@ class GuiCharacter : public GuiView<GuiCharacterDialog>
 public:
        friend class GuiCharacterDialog;
 
-       GuiCharacter(Dialog &);
+       GuiCharacter(GuiDialog &);
        /// parent controller
        ControlCharacter & controller()
        { return static_cast<ControlCharacter &>(this->getController()); }
index 1bf47e6d802cf4e740812287c34c9156bb20528d..94ce98800117a0bfd69881370fb1fa1776aab96f 100644 (file)
@@ -462,7 +462,7 @@ void GuiCitationDialog::changed()
 //
 ///////////////////////////////////////////////////////////////////////
 
-GuiCitation::GuiCitation(Dialog & parent)
+GuiCitation::GuiCitation(GuiDialog & parent)
        : ControlCitation(parent)
 {
 }
index 573525cc31c444a6b2e91f31ec0ed4386ee4cbda..7de1d472ed1ae8d5987c2a2ca5679d09b2ac5776 100644 (file)
@@ -15,7 +15,7 @@
 #ifndef GUICITATION_H
 #define GUICITATION_H
 
-#include "Dialog.h"
+#include "GuiDialog.h"
 #include "GuiSelectionManager.h"
 #include "ui_CitationUi.h"
 #include "ControlCitation.h"
@@ -109,7 +109,7 @@ class GuiCitation : public ControlCitation
 {
 public:
        ///
-       GuiCitation(Dialog &);
+       GuiCitation(GuiDialog &);
        virtual ~GuiCitation() {}
        virtual bool initialiseParams(std::string const & data);
 
index 40eb280d0fc162a7d24d76199c062cd3d13ad3c4..e93682b81f75c13c4e4c2fff7196334fb4a1eb68 100644 (file)
@@ -58,7 +58,7 @@ QString fix_name(QString const & str, bool big)
 } // namespace anon
 
 
-GuiDelimiter::GuiDelimiter(Dialog & parent)
+GuiDelimiter::GuiDelimiter(GuiDialog & parent)
        : GuiView<GuiDelimiterDialog>(parent, _("Math Delimiter"))
 {}
 
index 301eabc7b92173f8f55a21be9627802d3582eaac..b57b1c2734faa1d597345f734ab8aef6b25bb9e4 100644 (file)
@@ -54,7 +54,7 @@ class GuiDelimiter : public GuiView<GuiDelimiterDialog>
 public:
        friend class GuiDelimiterDialog;
        ///
-       GuiDelimiter(Dialog &);
+       GuiDelimiter(GuiDialog &);
        /// parent controller
        ControlMath & controller()
        { return static_cast<ControlMath &>(this->getController()); }
diff --git a/src/frontends/qt4/GuiDialog.cpp b/src/frontends/qt4/GuiDialog.cpp
new file mode 100644 (file)
index 0000000..581ac33
--- /dev/null
@@ -0,0 +1,121 @@
+/**
+ * \file Dialog.cpp
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Angus Leeming
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
+
+#include "GuiDialog.h"
+#include "debug.h"
+
+
+namespace lyx {
+namespace frontend {
+
+GuiDialog::GuiDialog(LyXView & lv, std::string const & name)
+       : Dialog(lv, name)
+{}
+
+
+void GuiDialog::setButtonsValid(bool valid)
+{
+       bc().setValid(valid);
+}
+
+
+void GuiDialog::ApplyButton()
+{
+       apply();
+       bc().apply();
+}
+
+
+void GuiDialog::OKButton()
+{
+       is_closing_ = true;
+       apply();
+       is_closing_ = false;
+       hide();
+       bc().ok();
+}
+
+
+void GuiDialog::CancelButton()
+{
+       hide();
+       bc().cancel();
+}
+
+
+void GuiDialog::RestoreButton()
+{
+       // Tell the kernel that a request to refresh the dialog's contents
+       // has been received. It's up to the kernel to supply the necessary
+       // info by calling GuiDialog::update().
+       kernel().updateDialog(name_);
+       bc().restore();
+}
+
+
+void GuiDialog::preShow()
+{
+       bc().setReadOnly(kernel().isBufferReadonly());
+}
+
+
+void GuiDialog::postShow()
+{
+       // The widgets may not be valid, so refresh the button controller
+       bc().refresh();
+}
+
+
+void GuiDialog::preUpdate()
+{
+       bc().setReadOnly(kernel().isBufferReadonly());
+}
+
+
+void GuiDialog::postUpdate()
+{
+       // The widgets may not be valid, so refresh the button controller
+       bc().refresh();
+}
+
+
+void GuiDialog::checkStatus()
+{
+       // buffer independant dialogs are always active.
+       // This check allows us leave canApply unimplemented for some dialogs.
+       if (!controller().isBufferDependent())
+               return;
+
+       // deactivate the dialog if we have no buffer
+       if (!kernel().isBufferAvailable()) {
+               bc().setReadOnly(true);
+               return;
+       }
+
+       // check whether this dialog may be active
+       if (controller().canApply()) {
+               bool const readonly = kernel().isBufferReadonly();
+               bc().setReadOnly(readonly);
+               // refreshReadOnly() is too generous in _enabling_ widgets
+               // update dialog to disable disabled widgets again
+/*
+ *     FIXME:
+               if (!readonly || controller().canApplyToReadOnly())
+                       update();
+*/
+       } else {
+               bc().setReadOnly(true);
+       }       
+}
+
+} // namespace frontend
+} // namespace lyx
diff --git a/src/frontends/qt4/GuiDialog.h b/src/frontends/qt4/GuiDialog.h
new file mode 100644 (file)
index 0000000..db52058
--- /dev/null
@@ -0,0 +1,71 @@
+// -*- C++ -*-
+/**
+ * \file GuiDialog.h
+ * 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.
+ */
+
+#ifndef GUIDIALOG_H
+#define GUIDIALOG_H
+
+#include "Dialog.h"
+#include "ButtonController.h"
+
+namespace lyx {
+namespace frontend {
+
+/** \c Dialog collects the different parts of a Model-Controller-View
+ *  split of a generic dialog together.
+ */
+class GuiDialog : public Dialog
+{
+public:
+       /// \param lv is the access point for the dialog to the LyX kernel.
+       /// \param name is the identifier given to the dialog by its parent
+       /// container.
+       GuiDialog(LyXView & lv, std::string const & name);
+
+       /** \name Buttons
+        *  These methods are publicly accessible because they are invoked
+        *  by the View when the user presses... guess what ;-)
+        */
+       //@{
+       void ApplyButton();
+       void OKButton();
+       void CancelButton();
+       void RestoreButton();
+       //@}
+
+       /** Check whether we may apply our data.
+        *
+        *  The buttons are disabled if not and (re-)enabled if yes.
+        */
+       void checkStatus();
+       void setButtonsValid(bool valid);
+
+
+       /** \name Dialog Components
+        *  Methods to access the various components making up a dialog.
+        */
+       //@{
+       ButtonController const & bc() const { return bc_; }
+       ButtonController & bc() { return bc_; }
+       //@}
+
+       void preShow();
+       void postShow();
+       void preUpdate();
+       void postUpdate();
+
+private:
+       ButtonController bc_;
+};
+
+} // namespace frontend
+} // namespace lyx
+
+#endif // GUIDIALOG_H
index 153ef7bb5075031ed25d8e94b574370703892278..9fd6b9151e3fe788a50834c26322dc2cd784d216 100644 (file)
 #include <config.h>
 
 #include "GuiDialogView.h"
-#include "Qt2BC.h"
 #include "qt_helpers.h"
 
-#include "controllers/ButtonController.h"
-
 
 namespace lyx {
 namespace frontend {
 
-GuiDialogView::GuiDialogView(Dialog & parent, docstring const & t)
-       : Dialog::View(parent,t), updating_(false)
+GuiDialogView::GuiDialogView(GuiDialog & parent, docstring const & t)
+       : Dialog::View(parent, t), updating_(false), parent_(parent)
 {}
 
 
-Qt2BC & GuiDialogView::bcview()
+ButtonController & GuiDialogView::bc()
 {
-       return static_cast<Qt2BC &>(dialog().bc().view());
+       return parent_.bc();
 }
 
 
@@ -45,9 +42,8 @@ bool GuiDialogView::readOnly() const
 
 void GuiDialogView::show()
 {
-       if (!form()) {
+       if (!form())
                build();
-       }
 
        QSize const sizeHint = form()->sizeHint();
        if (sizeHint.height() >= 0 && sizeHint.width() >= 0)
@@ -87,37 +83,37 @@ void GuiDialogView::changed()
 {
        if (updating_)
                return;
-       bc().valid(isValid());
+       parent_.bc().setValid(isValid());
 }
 
 
 void GuiDialogView::slotWMHide()
 {
-       dialog().CancelButton();
+       parent_.CancelButton();
 }
 
 
 void GuiDialogView::slotApply()
 {
-       dialog().ApplyButton();
+       parent_.ApplyButton();
 }
 
 
 void GuiDialogView::slotOK()
 {
-       dialog().OKButton();
+       parent_.OKButton();
 }
 
 
 void GuiDialogView::slotClose()
 {
-       dialog().CancelButton();
+       parent_.CancelButton();
 }
 
 
 void GuiDialogView::slotRestore()
 {
-       dialog().RestoreButton();
+       parent_.RestoreButton();
 }
 
 } // namespace frontend
index d0eba362bc573f01351a74ab012658c6c7a06e30..8d2fb4e2de590819f9833aa0fd9867980e1cb417 100644 (file)
@@ -12,7 +12,7 @@
 #ifndef GUIDIALOGVIEW_H
 #define GUIDIALOGVIEW_H
 
-#include "Dialog.h"
+#include "GuiDialog.h"
 
 #include <boost/scoped_ptr.hpp>
 
 namespace lyx {
 namespace frontend {
 
-class Qt2BC;
-
 /** This class is an Qt2 GUI base class.
  */
-class GuiDialogView : public QObject, public Dialog::View {
+class GuiDialogView : public QObject, public Dialog::View
+{
        Q_OBJECT
 public:
        ///
-       GuiDialogView(Dialog &, docstring const &);
+       GuiDialogView(GuiDialog &, docstring const &);
        ///
        virtual ~GuiDialogView() {}
        ///
@@ -41,7 +40,7 @@ public:
        virtual void changed();
 
        ///
-       Qt2BC & bcview();
+       ButtonController & bc();
 
 protected:
        /// build the actual dialog
@@ -63,6 +62,8 @@ protected:
        /// are we updating ?
        bool updating_;
 
+       GuiDialog & parent_;
+
 public Q_SLOTS:
        // dialog closed from WM
        void slotWMHide();
@@ -87,7 +88,7 @@ private:
 template <class GUIDialog>
 class GuiView : public GuiDialogView {
 protected:
-       GuiView(Dialog & p, docstring const & t)
+       GuiView(GuiDialog & p, docstring const & t)
                : GuiDialogView(p, t)
        {}
 
index 48e312457a40bb7531c75033a9cecc2d417492d4..9119b2250156d95cd083cb0c8cc46eec04d71271 100644 (file)
@@ -15,7 +15,6 @@
 #include "FloatPlacement.h"
 #include "LengthCombo.h"
 #include "PanelStack.h"
-#include "Qt2BC.h"
 #include "qt_helpers.h"
 #include "Validator.h"
 
@@ -41,7 +40,7 @@
 #include <QScrollBar>
 #include <QTextCursor>
 
-#include <map>
+#include <algorithm>
 
 using lyx::support::token;
 using lyx::support::bformat;
@@ -171,9 +170,18 @@ void PreambleModule::closeEvent(QCloseEvent * e)
 //
 /////////////////////////////////////////////////////////////////////
 
+template<class Pair>
+std::vector<typename Pair::second_type> const
+getSecond(std::vector<Pair> const & pr)
+{
+       std::vector<typename Pair::second_type> tmp(pr.size());
+       std::transform(pr.begin(), pr.end(), tmp.begin(),
+                                                               boost::bind(&Pair::second, _1));
+       return tmp;
+}
+
 GuiDocumentDialog::GuiDocumentDialog(GuiDocument * form)
-       : form_(form),
-       lang_(getSecond(getLanguageData(false)))
+       : form_(form), lang_(getSecond(getLanguageData(false)))
 {
        setupUi(this);
 
@@ -186,10 +194,10 @@ GuiDocumentDialog::GuiDocumentDialog(GuiDocument * form)
        connect(defaultPB, SIGNAL(clicked()), this, SLOT(useDefaultsClicked()));
 
        // Manage the restore, ok, apply, restore and cancel/close buttons
-       form_->bcview().setOK(okPB);
-       form_->bcview().setApply(applyPB);
-       form_->bcview().setCancel(closePB);
-       form_->bcview().setRestore(restorePB);
+       form_->bc().setOK(okPB);
+       form_->bc().setApply(applyPB);
+       form_->bc().setCancel(closePB);
+       form_->bc().setRestore(restorePB);
 
 
        textLayoutModule = new UiWidget<Ui::TextLayoutUi>;
@@ -247,7 +255,7 @@ GuiDocumentDialog::GuiDocumentDialog(GuiDocument * form)
                Spacing::Other, qt_("Custom"));
 
        // initialize the length validator
-       addCheckedLineEdit(form_->bcview(), textLayoutModule->skipLE);
+       form_->bc().addCheckedLineEdit(textLayoutModule->skipLE);
 
        fontModule = new UiWidget<Ui::FontUi>;
        // fonts
@@ -337,9 +345,9 @@ GuiDocumentDialog::GuiDocumentDialog(GuiDocument * form)
        pageLayoutModule->pagestyleCO->addItem(qt_("plain"));
        pageLayoutModule->pagestyleCO->addItem(qt_("headings"));
        pageLayoutModule->pagestyleCO->addItem(qt_("fancy"));
-       addCheckedLineEdit(form_->bcview(), pageLayoutModule->paperheightLE,
+       form_->bc().addCheckedLineEdit(pageLayoutModule->paperheightLE,
                pageLayoutModule->paperheightL);
-       addCheckedLineEdit(form_->bcview(), pageLayoutModule->paperwidthLE,
+       form_->bc().addCheckedLineEdit(pageLayoutModule->paperwidthLE,
                pageLayoutModule->paperwidthL);
 
        // paper
@@ -415,19 +423,19 @@ GuiDocumentDialog::GuiDocumentDialog(GuiDocument * form)
        marginsModule->footskipLE->setValidator(unsignedLengthValidator(
                marginsModule->footskipLE));
 
-       addCheckedLineEdit(form_->bcview(), marginsModule->topLE,
+       form_->bc().addCheckedLineEdit(marginsModule->topLE,
                marginsModule->topL);
-       addCheckedLineEdit(form_->bcview(), marginsModule->bottomLE,
+       form_->bc().addCheckedLineEdit(marginsModule->bottomLE,
                marginsModule->bottomL);
-       addCheckedLineEdit(form_->bcview(), marginsModule->innerLE,
+       form_->bc().addCheckedLineEdit(marginsModule->innerLE,
                marginsModule->innerL);
-       addCheckedLineEdit(form_->bcview(), marginsModule->outerLE,
+       form_->bc().addCheckedLineEdit(marginsModule->outerLE,
                marginsModule->outerL);
-       addCheckedLineEdit(form_->bcview(), marginsModule->headsepLE,
+       form_->bc().addCheckedLineEdit(marginsModule->headsepLE,
                marginsModule->headsepL);
-       addCheckedLineEdit(form_->bcview(), marginsModule->headheightLE,
+       form_->bc().addCheckedLineEdit(marginsModule->headheightLE,
                marginsModule->headheightL);
-       addCheckedLineEdit(form_->bcview(), marginsModule->footskipLE,
+       form_->bc().addCheckedLineEdit(marginsModule->footskipLE,
                marginsModule->footskipL);
 
 
@@ -509,7 +517,6 @@ GuiDocumentDialog::GuiDocumentDialog(GuiDocument * form)
        biblioModule->citeStyleCO->setCurrentIndex(0);
 
 
-
        mathsModule = new UiWidget<Ui::MathsUi>;
        connect(mathsModule->amsautoCB, SIGNAL(toggled(bool)),
                mathsModule->amsCB, SLOT(setDisabled(bool)));
@@ -1393,7 +1400,7 @@ void GuiDocumentDialog::updateParams(BufferParams const & params)
 /////////////////////////////////////////////////////////////////////
 
 
-GuiDocument::GuiDocument(Dialog & parent)
+GuiDocument::GuiDocument(GuiDialog & parent)
        : GuiView<GuiDocumentDialog>(parent, _("Document Settings"))
 {}
 
index 7590cdaa931960c0223c9f83ceab7ab4256cf207..296e0140d60cd28a2ba9272d3e9b9f3dfbd07c2e 100644 (file)
@@ -123,7 +123,7 @@ public:
 
        friend class GuiDocumentDialog;
 
-       GuiDocument(Dialog &);
+       GuiDocument(GuiDialog &);
 
        void showPreamble();
        /// parent controller
index f9b994129bb7bf4bd67105930e3e41cb7dd1260f..a8648c97928ebd5b3f52cb5f85cb31f4e6b431f0 100644 (file)
@@ -11,7 +11,7 @@
 #include <config.h>
 
 #include "GuiERT.h"
-#include "Qt2BC.h"
+#include "gettext.h"
 
 #include <QRadioButton>
 #include <QPushButton>
@@ -58,7 +58,7 @@ void GuiERTDialog::change_adaptor()
 //
 /////////////////////////////////////////////////////////////////////
 
-GuiERT::GuiERT(Dialog & parent)
+GuiERT::GuiERT(GuiDialog & parent)
        : GuiView<GuiERTDialog>(parent, _("TeX Code Settings"))
 {
 }
@@ -68,8 +68,8 @@ void GuiERT::build_dialog()
 {
        dialog_.reset(new GuiERTDialog(this));
 
-       bcview().setOK(dialog_->okPB);
-       bcview().setCancel(dialog_->closePB);
+       bc().setOK(dialog_->okPB);
+       bc().setCancel(dialog_->closePB);
 }
 
 
index 4bc641eb1d697f3fbcd58532d2c2b834e67b407c..e95b734f0a42e1636bea73aa6e9d1023262609ba 100644 (file)
@@ -16,7 +16,6 @@
 #include "ControlERT.h"
 #include "ui_ERTUi.h"
 
-#include <QCloseEvent>
 #include <QDialog>
 
 namespace lyx {
@@ -42,7 +41,7 @@ class GuiERT : public GuiView<GuiERTDialog>
 {
 public:
        /// constructor
-       GuiERT(Dialog &);
+       GuiERT(GuiDialog &);
        /// parent controller
        ControlERT & controller()
        { return static_cast<ControlERT &>(this->getController()); }
index dc1b57105a5f970cf5d618c3162919ecf15710ea..49ebc9427f89dd94bc0b89bf4ab857f1af6720c6 100644 (file)
@@ -11,8 +11,6 @@
 #include <config.h>
 
 #include "GuiEmbeddedFiles.h"
-#include "Qt2BC.h"
-
 #include "debug.h"
 
 namespace lyx {
index c05b26c7871a3eda67d470690d86dca11145509f..526f2996887dbd2a9d930e9f8098e2d738bdcc8a 100644 (file)
@@ -11,7 +11,6 @@
 #include <config.h>
 
 #include "GuiErrorList.h"
-#include "Qt2BC.h"
 #include "qt_helpers.h"
 
 #include <QListWidget>
@@ -69,7 +68,7 @@ void GuiErrorListDialog::showEvent(QShowEvent *e)
 /////////////////////////////////////////////////////////////////////
 
 
-GuiErrorList::GuiErrorList(Dialog & parent)
+GuiErrorList::GuiErrorList(GuiDialog & parent)
        :  GuiView<GuiErrorListDialog>(parent, docstring())
 {}
 
@@ -77,7 +76,7 @@ GuiErrorList::GuiErrorList(Dialog & parent)
 void GuiErrorList::build_dialog()
 {
        dialog_.reset(new GuiErrorListDialog(this));
-       bcview().setCancel(dialog_->closePB);
+       bc().setCancel(dialog_->closePB);
 }
 
 
index b2365541705f10f74430d000083f1ef320dc6e59..2ed5f72da7a608f42794060820a6d203cc71e54e 100644 (file)
@@ -45,7 +45,7 @@ class GuiErrorList : public GuiView<GuiErrorListDialog>
 public:
        friend class GuiErrorListDialog;
 
-       GuiErrorList(Dialog &);
+       GuiErrorList(GuiDialog &);
        /// parent controller
        ControlErrorList & controller()
        { return static_cast<ControlErrorList &>(this->getController()); }
index bbdf922c434889c75c0ca6083aea9a1b501518d8..44ffefd58a498fa7384c7af778f4412e32f3c912 100644 (file)
@@ -14,8 +14,6 @@
 #include "lengthcommon.h"
 #include "LyXRC.h"
 
-#include "controllers/ButtonController.h"
-
 #include "insets/ExternalTemplate.h"
 #include "insets/InsetExternal.h"
 
@@ -25,7 +23,6 @@
 #include "support/lyxlib.h"
 
 #include "GuiExternal.h"
-#include "Qt2BC.h"
 
 #include "LengthCombo.h"
 #include "qt_helpers.h"
@@ -485,7 +482,7 @@ void getExtra(external::ExtraData & data,
 } // namespace anon
 
 
-GuiExternal::GuiExternal(Dialog & parent)
+GuiExternal::GuiExternal(GuiDialog & parent)
        : GuiView<GuiExternalDialog>(parent, _("External Material"))
 {}
 
@@ -494,43 +491,43 @@ void GuiExternal::build_dialog()
 {
        dialog_.reset(new GuiExternalDialog(this));
 
-       bcview().setOK(dialog_->okPB);
-       bcview().setApply(dialog_->applyPB);
-       bcview().setCancel(dialog_->closePB);
-
-       bcview().addReadOnly(dialog_->fileED);
-       bcview().addReadOnly(dialog_->browsePB);
-       bcview().addReadOnly(dialog_->editPB);
-       bcview().addReadOnly(dialog_->externalCO);
-       bcview().addReadOnly(dialog_->draftCB);
-       bcview().addReadOnly(dialog_->displayscaleED);
-       bcview().addReadOnly(dialog_->showCO);
-       bcview().addReadOnly(dialog_->displayCB);
-       bcview().addReadOnly(dialog_->angleED);
-       bcview().addReadOnly(dialog_->originCO);
-       bcview().addReadOnly(dialog_->heightUnitCO);
-       bcview().addReadOnly(dialog_->heightED);
-       bcview().addReadOnly(dialog_->aspectratioCB);
-       bcview().addReadOnly(dialog_->widthUnitCO);
-       bcview().addReadOnly(dialog_->widthED);
-       bcview().addReadOnly(dialog_->clipCB);
-       bcview().addReadOnly(dialog_->getbbPB);
-       bcview().addReadOnly(dialog_->ytED);
-       bcview().addReadOnly(dialog_->xlED);
-       bcview().addReadOnly(dialog_->xrED);
-       bcview().addReadOnly(dialog_->ybED);
-       bcview().addReadOnly(dialog_->extraFormatCO);
-       bcview().addReadOnly(dialog_->extraED);
-
-       addCheckedLineEdit(bcview(), dialog_->angleED, dialog_->angleLA);
-       addCheckedLineEdit(bcview(), dialog_->displayscaleED, dialog_->scaleLA);
-       addCheckedLineEdit(bcview(), dialog_->heightED, dialog_->heightLA);
-       addCheckedLineEdit(bcview(), dialog_->widthED, dialog_->widthLA);
-       addCheckedLineEdit(bcview(), dialog_->xlED, dialog_->lbLA);
-       addCheckedLineEdit(bcview(), dialog_->ybED, dialog_->lbLA);
-       addCheckedLineEdit(bcview(), dialog_->xrED, dialog_->rtLA);
-       addCheckedLineEdit(bcview(), dialog_->ytED, dialog_->rtLA);
-       addCheckedLineEdit(bcview(), dialog_->fileED, dialog_->fileLA);
+       bc().setOK(dialog_->okPB);
+       bc().setApply(dialog_->applyPB);
+       bc().setCancel(dialog_->closePB);
+
+       bc().addReadOnly(dialog_->fileED);
+       bc().addReadOnly(dialog_->browsePB);
+       bc().addReadOnly(dialog_->editPB);
+       bc().addReadOnly(dialog_->externalCO);
+       bc().addReadOnly(dialog_->draftCB);
+       bc().addReadOnly(dialog_->displayscaleED);
+       bc().addReadOnly(dialog_->showCO);
+       bc().addReadOnly(dialog_->displayCB);
+       bc().addReadOnly(dialog_->angleED);
+       bc().addReadOnly(dialog_->originCO);
+       bc().addReadOnly(dialog_->heightUnitCO);
+       bc().addReadOnly(dialog_->heightED);
+       bc().addReadOnly(dialog_->aspectratioCB);
+       bc().addReadOnly(dialog_->widthUnitCO);
+       bc().addReadOnly(dialog_->widthED);
+       bc().addReadOnly(dialog_->clipCB);
+       bc().addReadOnly(dialog_->getbbPB);
+       bc().addReadOnly(dialog_->ytED);
+       bc().addReadOnly(dialog_->xlED);
+       bc().addReadOnly(dialog_->xrED);
+       bc().addReadOnly(dialog_->ybED);
+       bc().addReadOnly(dialog_->extraFormatCO);
+       bc().addReadOnly(dialog_->extraED);
+
+       bc().addCheckedLineEdit(dialog_->angleED, dialog_->angleLA);
+       bc().addCheckedLineEdit(dialog_->displayscaleED, dialog_->scaleLA);
+       bc().addCheckedLineEdit(dialog_->heightED, dialog_->heightLA);
+       bc().addCheckedLineEdit(dialog_->widthED, dialog_->widthLA);
+       bc().addCheckedLineEdit(dialog_->xlED, dialog_->lbLA);
+       bc().addCheckedLineEdit(dialog_->ybED, dialog_->lbLA);
+       bc().addCheckedLineEdit(dialog_->xrED, dialog_->rtLA);
+       bc().addCheckedLineEdit(dialog_->ytED, dialog_->rtLA);
+       bc().addCheckedLineEdit(dialog_->fileED, dialog_->fileLA);
 
        std::vector<string> templates(controller().getTemplates());
 
index ffc1efe7ef53702458d51aa82a159b241add9f37..7eb372a80b5c7102dcb88fc81d9efbfd1b7c022e 100644 (file)
@@ -58,7 +58,7 @@ class GuiExternal : public GuiView<GuiExternalDialog>
 public:
        friend class GuiExternalDialog;
 
-       GuiExternal(Dialog &);
+       GuiExternal(GuiDialog &);
        /// parent controller
        ControlExternal & controller()
        { return static_cast<ControlExternal &>(this->getController()); }
index 3312ca9872fcd38e8496e893dd2d047697103251..95430d91b54bce259b235b7bee443d9eaa9fe40a 100644 (file)
@@ -11,7 +11,6 @@
 #include <config.h>
 
 #include "GuiFloat.h"
-#include "Qt2BC.h"
 #include "FloatPlacement.h"
 
 #include "insets/InsetFloat.h"
@@ -59,7 +58,7 @@ void GuiFloatDialog::closeEvent(QCloseEvent * e)
 }
 
 
-GuiFloat::GuiFloat(Dialog & parent)
+GuiFloat::GuiFloat(GuiDialog & parent)
        :  GuiView<GuiFloatDialog>(parent, _("Float Settings"))
 {
 }
@@ -69,12 +68,12 @@ void GuiFloat::build_dialog()
 {
        dialog_.reset(new GuiFloatDialog(this));
 
-       bcview().setCancel(dialog_->closePB);
-       bcview().setApply(dialog_->applyPB);
-       bcview().setOK(dialog_->okPB);
-       bcview().setRestore(dialog_->restorePB);
+       bc().setCancel(dialog_->closePB);
+       bc().setApply(dialog_->applyPB);
+       bc().setOK(dialog_->okPB);
+       bc().setRestore(dialog_->restorePB);
 
-       bcview().addReadOnly(dialog_->floatFP);
+       bc().addReadOnly(dialog_->floatFP);
 }
 
 
index 565f8652e9c8930af7eb0e00e76fda58d2fd5a89..7ef8c0fdfd073a0b324ce29b89adf4e768f375ce 100644 (file)
@@ -45,7 +45,7 @@ public:
        ///
        friend class GuiFloatDialog;
        ///
-       GuiFloat(Dialog &);
+       GuiFloat(GuiDialog &);
        /// parent controller
        ControlFloat & controller()
        { return static_cast<ControlFloat &>(this->getController()); }
index a2a05a78924a59e6f643c8fc58d73eb1fc9989fa..d9a8280c3c1af779d9f28c63b7e8151b5a0c9e06 100644 (file)
@@ -19,7 +19,6 @@
 #include "LengthCombo.h"
 #include "lengthcommon.h"
 #include "LyXRC.h"
-#include "Qt2BC.h"
 #include "qt_helpers.h"
 #include "Validator.h"
 
 #include "support/lyxlib.h"
 #include "support/os.h"
 
-#include <cmath>
-
-#include "insets/InsetGraphicsParams.h"
-
 #include <QCheckBox>
 #include <QCloseEvent>
 #include <QLabel>
@@ -43,6 +38,8 @@
 #include <QPushButton>
 #include <QValidator>
 
+#include <algorithm>
+#include <cmath>
 
 using lyx::support::float_equal;
 using lyx::support::token;
@@ -61,6 +58,16 @@ namespace lyx {
 namespace frontend {
 
 
+template<class Pair>
+std::vector<typename Pair::first_type> const
+getFirst(std::vector<Pair> const & pr)
+{
+       std::vector<typename Pair::first_type> tmp(pr.size());
+       std::transform(pr.begin(), pr.end(), tmp.begin(),
+                      boost::bind(&Pair::first, _1));
+       return tmp;
+}
+
 GuiGraphicsDialog::GuiGraphicsDialog(GuiGraphics * form)
        : form_(form)
 {
@@ -329,7 +336,7 @@ void GuiGraphicsDialog::on_angle_textChanged(const QString & filename)
 }
 
 
-GuiGraphics::GuiGraphics(Dialog & parent)
+GuiGraphics::GuiGraphics(GuiDialog & parent)
        : GuiView<GuiGraphicsDialog>(parent, _("Graphics"))
 {
 }
@@ -339,39 +346,39 @@ void GuiGraphics::build_dialog()
 {
        dialog_.reset(new GuiGraphicsDialog(this));
 
-       bcview().setOK(dialog_->okPB);
-       bcview().setApply(dialog_->applyPB);
-       bcview().setRestore(dialog_->restorePB);
-       bcview().setCancel(dialog_->closePB);
-
-       bcview().addReadOnly(dialog_->latexoptions);
-       bcview().addReadOnly(dialog_->subfigure);
-       bcview().addReadOnly(dialog_->filenameL);
-       bcview().addReadOnly(dialog_->filename);
-       bcview().addReadOnly(dialog_->browsePB);
-       bcview().addReadOnly(dialog_->unzipCB);
-       bcview().addReadOnly(dialog_->bbFrame);
-       bcview().addReadOnly(dialog_->draftCB);
-       bcview().addReadOnly(dialog_->clip);
-       bcview().addReadOnly(dialog_->unzipCB);
-       bcview().addReadOnly(dialog_->displayGB);
-       bcview().addReadOnly(dialog_->sizeGB);
-       bcview().addReadOnly(dialog_->rotationGB);
-       bcview().addReadOnly(dialog_->latexoptions);
-       bcview().addReadOnly(dialog_->getPB);
-       bcview().addReadOnly(dialog_->rotateOrderCB);
+       bc().setOK(dialog_->okPB);
+       bc().setApply(dialog_->applyPB);
+       bc().setRestore(dialog_->restorePB);
+       bc().setCancel(dialog_->closePB);
+
+       bc().addReadOnly(dialog_->latexoptions);
+       bc().addReadOnly(dialog_->subfigure);
+       bc().addReadOnly(dialog_->filenameL);
+       bc().addReadOnly(dialog_->filename);
+       bc().addReadOnly(dialog_->browsePB);
+       bc().addReadOnly(dialog_->unzipCB);
+       bc().addReadOnly(dialog_->bbFrame);
+       bc().addReadOnly(dialog_->draftCB);
+       bc().addReadOnly(dialog_->clip);
+       bc().addReadOnly(dialog_->unzipCB);
+       bc().addReadOnly(dialog_->displayGB);
+       bc().addReadOnly(dialog_->sizeGB);
+       bc().addReadOnly(dialog_->rotationGB);
+       bc().addReadOnly(dialog_->latexoptions);
+       bc().addReadOnly(dialog_->getPB);
+       bc().addReadOnly(dialog_->rotateOrderCB);
 
        // initialize the length validator
-       addCheckedLineEdit(bcview(), dialog_->Scale, dialog_->scaleCB);
-       addCheckedLineEdit(bcview(), dialog_->Width, dialog_->WidthCB);
-       addCheckedLineEdit(bcview(), dialog_->Height, dialog_->HeightCB);
-       addCheckedLineEdit(bcview(), dialog_->displayscale, dialog_->scaleLA);
-       addCheckedLineEdit(bcview(), dialog_->angle, dialog_->angleL);
-       addCheckedLineEdit(bcview(), dialog_->lbX, dialog_->xL);
-       addCheckedLineEdit(bcview(), dialog_->lbY, dialog_->yL);
-       addCheckedLineEdit(bcview(), dialog_->rtX, dialog_->xL_2);
-       addCheckedLineEdit(bcview(), dialog_->rtY, dialog_->yL_2);
-       addCheckedLineEdit(bcview(), dialog_->filename, dialog_->filenameL);
+       bc().addCheckedLineEdit(dialog_->Scale, dialog_->scaleCB);
+       bc().addCheckedLineEdit(dialog_->Width, dialog_->WidthCB);
+       bc().addCheckedLineEdit(dialog_->Height, dialog_->HeightCB);
+       bc().addCheckedLineEdit(dialog_->displayscale, dialog_->scaleLA);
+       bc().addCheckedLineEdit(dialog_->angle, dialog_->angleL);
+       bc().addCheckedLineEdit(dialog_->lbX, dialog_->xL);
+       bc().addCheckedLineEdit(dialog_->lbY, dialog_->yL);
+       bc().addCheckedLineEdit(dialog_->rtX, dialog_->xL_2);
+       bc().addCheckedLineEdit(dialog_->rtY, dialog_->yL_2);
+       bc().addCheckedLineEdit(dialog_->filename, dialog_->filenameL);
 }
 
 
@@ -383,6 +390,16 @@ static int getItemNo(const vector<string> & v, string const & s)
        return (cit != v.end()) ? int(cit - v.begin()) : 0;
 }
 
+template<class Pair>
+std::vector<typename Pair::second_type> const
+getSecond(std::vector<Pair> const & pr)
+{
+        std::vector<typename Pair::second_type> tmp(pr.size());
+        std::transform(pr.begin(), pr.end(), tmp.begin(),
+                                        boost::bind(&Pair::second, _1));
+        return tmp;
+}
+
 
 void GuiGraphics::update_contents()
 {
index 3ff72533845369ad21b5cbc5a093864c7dc04bd2..bb2675c1d06223205718394a87b675d03022cf8b 100644 (file)
@@ -59,7 +59,7 @@ public:
        ///
        friend class GuiGraphicsDialog;
        ///
-       GuiGraphics(Dialog &);
+       GuiGraphics(GuiDialog &);
        /// parent controller
        ControlGraphics & controller()
        { return static_cast<ControlGraphics &>(this->getController()); }
index a2650d5f3517f031d211eaec88553a0982cfda4e..1cfc42ca692d5775b0c279da2120dff0c3784b9e 100644 (file)
@@ -15,7 +15,6 @@
 
 #include "GuiInclude.h"
 
-#include "Qt2BC.h"
 #include "qt_helpers.h"
 #include "LyXRC.h"
 
@@ -184,7 +183,7 @@ void GuiIncludeDialog::browseClicked()
 /////////////////////////////////////////////////////////////////////
 
 
-GuiInclude::GuiInclude(Dialog & parent)
+GuiInclude::GuiInclude(GuiDialog & parent)
        : GuiView<GuiIncludeDialog>(parent, _("Child Document"))
 {}
 
@@ -193,15 +192,15 @@ void GuiInclude::build_dialog()
 {
        dialog_.reset(new GuiIncludeDialog(this));
 
-       bcview().setOK(dialog_->okPB);
-       bcview().setCancel(dialog_->closePB);
-       bcview().addReadOnly(dialog_->filenameED);
-       bcview().addReadOnly(dialog_->browsePB);
-       bcview().addReadOnly(dialog_->visiblespaceCB);
-       bcview().addReadOnly(dialog_->typeCO);
-       bcview().addReadOnly(dialog_->listingsED);
+       bc().setOK(dialog_->okPB);
+       bc().setCancel(dialog_->closePB);
+       bc().addReadOnly(dialog_->filenameED);
+       bc().addReadOnly(dialog_->browsePB);
+       bc().addReadOnly(dialog_->visiblespaceCB);
+       bc().addReadOnly(dialog_->typeCO);
+       bc().addReadOnly(dialog_->listingsED);
 
-       addCheckedLineEdit(bcview(), dialog_->filenameED, dialog_->filenameLA);
+       bc().addCheckedLineEdit(dialog_->filenameED, dialog_->filenameLA);
 }
 
 
index d176547a93dc0158c901df8d6f35a11abe8a9bfa..f1873bcca3542eaa95cc102e2e8a6840fbf23719 100644 (file)
@@ -56,7 +56,7 @@ public:
        ///
        friend class GuiIncludeDialog;
        ///
-       GuiInclude(Dialog &);
+       GuiInclude(GuiDialog &);
        /// parent controller
        ControlInclude & controller()
        { return static_cast<ControlInclude &>(this->getController()); }
index cebac4debdeab5068809c3fa7430221cc72ed156..a567a9ce7b02139d24eeb04f2a7755bf007330f2 100644 (file)
 
 #include <config.h>
 
+#include "GuiIndex.h"
+
 #include "debug.h"
 #include "qt_helpers.h"
 
-#include "GuiIndex.h"
-#include "Qt2BC.h"
-#include "ButtonController.h"
-
 #include <QLabel>
 #include <QPushButton>
 #include <QLineEdit>
@@ -90,7 +88,8 @@ void GuiIndexDialog::closeEvent(QCloseEvent * e)
 /////////////////////////////////////////////////////////////////////
 
 
-GuiIndex::GuiIndex(Dialog & parent, docstring const & title, QString const & label)
+GuiIndex::GuiIndex(GuiDialog & parent, docstring const & title,
+               QString const & label)
        : GuiView<GuiIndexDialog>(parent, title), label_(label)
 {
 }
@@ -102,9 +101,9 @@ void GuiIndex::build_dialog()
 
        dialog_->keywordLA->setText(label_);
 
-       bcview().setOK(dialog_->okPB);
-       bcview().setCancel(dialog_->closePB);
-       bcview().addReadOnly(dialog_->keywordED);
+       bc().setOK(dialog_->okPB);
+       bc().setCancel(dialog_->closePB);
+       bc().addReadOnly(dialog_->keywordED);
 }
 
 
@@ -113,7 +112,7 @@ void GuiIndex::update_contents()
        docstring const contents = controller().params()["name"];
        dialog_->keywordED->setText(toqstr(contents));
 
-       bc().valid(!contents.empty());
+       bc().setValid(!contents.empty());
 }
 
 
index 31929004a9fa2d5f9f2b3fe11d73ba23081e9214..b745d6295a389613da3e5a88081cd4e91b386868 100644 (file)
@@ -44,7 +44,7 @@ class GuiIndex : public GuiView<GuiIndexDialog>
 public:
        friend class GuiIndexDialog;
 
-       GuiIndex(Dialog &, docstring const & title, QString const & label);
+       GuiIndex(GuiDialog &, docstring const & title, QString const & label);
        /// parent controller
        ControlCommand & controller()
        { return static_cast<ControlCommand &>(this->getController()); }
index 04926b24e96f50ae1b0661521b7fcd6e2c17e352..ea4de2e9ea88486810a6136607bf3ecd1a81120d 100644 (file)
@@ -12,7 +12,6 @@
 #include <config.h>
 
 #include "GuiListings.h"
-#include "Qt2BC.h"
 #include "qt_helpers.h"
 #include "insets/InsetListingsParams.h"
 #include "debug.h"
@@ -408,7 +407,7 @@ void GuiListingsDialog::on_languageCO_currentIndexChanged(int index)
 /////////////////////////////////////////////////////////////////////
 
 
-GuiListings::GuiListings(Dialog & parent)
+GuiListings::GuiListings(GuiDialog & parent)
        : GuiView<GuiListingsDialog>(parent, _("Program Listing Settings"))
 {
 }
@@ -418,9 +417,9 @@ void GuiListings::build_dialog()
 {
        dialog_.reset(new GuiListingsDialog(this));
 
-       bcview().setOK(dialog_->okPB);
-       bcview().setApply(dialog_->applyPB);
-       bcview().setCancel(dialog_->closePB);
+       bc().setOK(dialog_->okPB);
+       bc().setApply(dialog_->applyPB);
+       bc().setCancel(dialog_->closePB);
        dialog_->listingsTB->setPlainText(
                qt_("Input listing parameters on the right. Enter ? for a list of parameters."));
 
index 1aa6e0f54cbfd96df3e3188638028fde37714baa..092dcfa7b5295d2bc411a849a654e0de8daa24c0 100644 (file)
@@ -57,7 +57,7 @@ class GuiListings : public GuiView<GuiListingsDialog> {
 public:
        friend class GuiListingsDialog;
 
-       GuiListings(Dialog &);
+       GuiListings(GuiDialog &);
        /// parent controller
        ControlListings & controller()
        { return static_cast<ControlListings &>(this->getController()); }
index 112f879a09a3eb622fb4503093991b8cf7e81d81..274ad265fe8a903390e0606ed1f4ca291b75eb89 100644 (file)
@@ -107,7 +107,7 @@ void LogHighlighter::highlightBlock(QString const & text)
 /////////////////////////////////////////////////////////////////////
 
 
-GuiLog::GuiLog(Dialog & parent)
+GuiLog::GuiLog(GuiDialog & parent)
        :  GuiView<GuiLogDialog>(parent, docstring())
 {}
 
index 430c1e3f3615959177bd80b12f050bb89a2bcd28..8259afe37fb1034c5916e6730836790e67e94d35 100644 (file)
@@ -47,7 +47,7 @@ public:
        ///
        friend class GuiLogDialog;
        ///
-       GuiLog(Dialog &);
+       GuiLog(GuiDialog &);
        /// parent controller
        ControlLog & controller()
        { return static_cast<ControlLog &>(this->getController()); }
index 5a83b0d09de9082b7c64a0a3e0b4eeed473f61d0..5d439634135c2ce63796f26bc88ccd2497b44363 100644 (file)
@@ -28,7 +28,7 @@ using std::string;
 namespace lyx {
 namespace frontend {
 
-GuiMathMatrix::GuiMathMatrix(Dialog & parent)
+GuiMathMatrix::GuiMathMatrix(GuiDialog & parent)
        : GuiView<GuiMathMatrixDialog>(parent, _("Math Matrix"))
 {}
 
index 050f20fc530ed793a3232fb8717a2e7098b0ad13..42d1cb906ed49af592d3b56d84a42366fd08755b 100644 (file)
@@ -47,7 +47,7 @@ class GuiMathMatrix : public GuiView<GuiMathMatrixDialog> {
 public:
        friend class GuiMathMatrixDialog;
 
-       GuiMathMatrix(Dialog &);
+       GuiMathMatrix(GuiDialog &);
        /// parent controller
        ControlMath & controller()
        { return static_cast<ControlMath &>(this->getController()); }
index 48dd5e4e8bbb784594992a7f738bec597aa589c4..ff5f27f7e3fc7b8a8400452e599f86a629aa84b4 100644 (file)
 
 #include <config.h>
 
+#include "GuiNomencl.h"
+
 #include "debug.h"
 #include "ControlCommand.h"
 #include "qt_helpers.h"
 
-#include "GuiNomencl.h"
-#include "Qt2BC.h"
-#include "ButtonController.h"
-
 #include <QLabel>
 #include <QLineEdit>
 #include <QPushButton>
@@ -85,7 +83,7 @@ void GuiNomenclDialog::closeEvent(QCloseEvent * e)
 /////////////////////////////////////////////////////////////////////
 
 
-GuiNomencl::GuiNomencl(Dialog & parent, docstring const & title)
+GuiNomencl::GuiNomencl(GuiDialog & parent, docstring const & title)
        : GuiView<GuiNomenclDialog>(parent, title)
 {
 }
@@ -95,11 +93,11 @@ void GuiNomencl::build_dialog()
 {
        dialog_.reset(new GuiNomenclDialog(this));
 
-       bcview().setOK(dialog_->okPB);
-       bcview().setCancel(dialog_->closePB);
-       bcview().addReadOnly(dialog_->symbolED);
-       bcview().addReadOnly(dialog_->descriptionTE);
-       bcview().addReadOnly(dialog_->prefixED);
+       bc().setOK(dialog_->okPB);
+       bc().setCancel(dialog_->closePB);
+       bc().addReadOnly(dialog_->symbolED);
+       bc().addReadOnly(dialog_->descriptionTE);
+       bc().addReadOnly(dialog_->prefixED);
 }
 
 
@@ -111,7 +109,7 @@ void GuiNomencl::update_contents()
        description.replace("\\\\","\n");
        dialog_->descriptionTE->setPlainText(description);
 
-       bc().valid(isValid());
+       bc().setValid(isValid());
 }
 
 
index 2d9536ed570f4a497e33f2968ac035765eb8adf9..14911641d70406fea94c266aacd195e8ca36b203 100644 (file)
@@ -26,7 +26,8 @@ namespace frontend {
 
 class GuiNomencl;
 
-class GuiNomenclDialog : public QDialog, public Ui::NomenclUi {
+class GuiNomenclDialog : public QDialog, public Ui::NomenclUi
+{
        Q_OBJECT
 public:
        GuiNomenclDialog(GuiNomencl * form);
@@ -46,7 +47,7 @@ class GuiNomencl : public GuiView<GuiNomenclDialog>
 public:
        friend class GuiNomenclDialog;
 
-       GuiNomencl(Dialog &, docstring const & title);
+       GuiNomencl(GuiDialog &, docstring const & title);
        /// parent controller
        ControlCommand & controller()
        { return static_cast<ControlCommand &>(this->getController()); }
index 250d2d34b615cf544ccd7a51e1897be8096bbc9c..c83c44c0e009d0ef5acaedd45baffc1978bd4dba 100644 (file)
@@ -11,7 +11,6 @@
 #include <config.h>
 
 #include "GuiNote.h"
-#include "Qt2BC.h"
 
 #include "insets/InsetNote.h"
 
@@ -62,7 +61,7 @@ void GuiNoteDialog::change_adaptor()
 /////////////////////////////////////////////////////////////////////
 
 
-GuiNote::GuiNote(Dialog & parent)
+GuiNote::GuiNote(GuiDialog & parent)
        : GuiView<GuiNoteDialog>(parent, _("Note Settings"))
 {}
 
@@ -71,8 +70,8 @@ void GuiNote::build_dialog()
 {
        dialog_.reset(new GuiNoteDialog(this));
 
-       bcview().setOK(dialog_->okPB);
-       bcview().setCancel(dialog_->closePB);
+       bc().setOK(dialog_->okPB);
+       bc().setCancel(dialog_->closePB);
 }
 
 
index 1d71caebfb1d547b132018e190e03c8ffb24dcae..a541f6a12fdbf36c82ca75171ad5514e7ee57a61 100644 (file)
@@ -45,7 +45,7 @@ public:
        friend class GuiNoteDialog;
 
        /// Constructor
-       GuiNote(Dialog &);
+       GuiNote(GuiDialog &);
        /// parent controller
        ControlNote & controller()
        { return static_cast<ControlNote &>(this->getController()); }
index 4a6c3d3bc30d223ffe6d2e859a3e65ba75f3189b..8b40befb6b748e00e3d2fc3cc3d364fe1547c5a4 100644 (file)
 #include <config.h>
 
 #include "GuiParagraph.h"
-#include "Qt2BC.h"
-#include "qt_helpers.h"
 
 #include "debug.h"
+#include "frontend_helpers.h"
 #include "ParagraphParameters.h"
+#include "qt_helpers.h"
 #include "Spacing.h"
-#include "frontend_helpers.h"
 
 #include <QCheckBox>
 #include <QCloseEvent>
@@ -163,7 +162,7 @@ LyXAlignment GuiParagraphDialog::getAlignmentFromDialog()
 /////////////////////////////////////////////////////////////////////
 
 
-GuiParagraph::GuiParagraph(Dialog & parent)
+GuiParagraph::GuiParagraph(GuiDialog & parent)
        : GuiView<GuiParagraphDialog>(parent, _("Paragraph Settings"))
 {}
 
@@ -174,10 +173,10 @@ void GuiParagraph::build_dialog()
        dialog_.reset(new GuiParagraphDialog(this));
 
        // Manage the ok, apply, restore and cancel/close buttons
-       bcview().setOK(dialog_->okPB);
-       bcview().setApply(dialog_->applyPB);
-       bcview().setCancel(dialog_->closePB);
-       bcview().setRestore(dialog_->restorePB);
+       bc().setOK(dialog_->okPB);
+       bc().setApply(dialog_->applyPB);
+       bc().setCancel(dialog_->closePB);
+       bc().setRestore(dialog_->restorePB);
 }
 
 
index 746f7cc276f883aecbcb285da436439cdd5cd498..7be6505640d6bc63e65b8842337c39f99e04186b 100644 (file)
@@ -59,7 +59,7 @@ class GuiParagraph : public GuiView<GuiParagraphDialog>
 public:
        friend class GuiParagraphDialog;
 
-       GuiParagraph(Dialog &);
+       GuiParagraph(GuiDialog &);
        /// parent controller
        ControlParagraph & controller()
        { return static_cast<ControlParagraph &>(this->getController()); }
index 8ba269eb3963ca1608c11dd1fecf562f122a99dc..5dab09eb7445c1354d606811bcc23782dcea58fb 100644 (file)
@@ -12,7 +12,6 @@
 
 #include "GuiPrefs.h"
 
-#include "Qt2BC.h"
 #include "qt_helpers.h"
 #include "GuiApplication.h"
 
 #include <QCloseEvent>
 
 #include <boost/tuple/tuple.hpp>
+#include <boost/bind.hpp>
+
 #include <iomanip>
 #include <sstream>
+#include <algorithm>
 
 using namespace Ui;
 
@@ -1571,6 +1573,17 @@ void PrefFileformats::remove_format()
 //
 /////////////////////////////////////////////////////////////////////
 
+template<class Pair>
+std::vector<typename Pair::second_type> const
+getSecond(std::vector<Pair> const & pr)
+{
+       std::vector<typename Pair::second_type> tmp(pr.size());
+       std::transform(pr.begin(), pr.end(), tmp.begin(),
+                      boost::bind(&Pair::second, _1));
+       return tmp;
+}
+
+
 PrefLanguage::PrefLanguage(QWidget * parent)
        : PrefModule(_("Language"), 0, parent)
 {
@@ -1946,10 +1959,10 @@ GuiPrefsDialog::GuiPrefsDialog(GuiPrefs * form)
        prefsPS->updateGeometry();
 #endif
 
-       form_->bcview().setOK(savePB);
-       form_->bcview().setApply(applyPB);
-       form_->bcview().setCancel(closePB);
-       form_->bcview().setRestore(restorePB);
+       form_->bc().setOK(savePB);
+       form_->bc().setApply(applyPB);
+       form_->bc().setCancel(closePB);
+       form_->bc().setRestore(restorePB);
 }
 
 
@@ -2000,7 +2013,7 @@ void GuiPrefsDialog::updateRc(LyXRC const & rc)
 /////////////////////////////////////////////////////////////////////
 
 
-GuiPrefs::GuiPrefs(Dialog & parent)
+GuiPrefs::GuiPrefs(GuiDialog & parent)
        : GuiView<GuiPrefsDialog>(parent, _("Preferences"))
 {
 }
index 428c9287fe9c02357dcebd157e140d3766e07f77..493bef39992f08cc76b9564f283e4337b6d5eb3f 100644 (file)
@@ -361,7 +361,7 @@ private:
 class GuiPrefs : public GuiView<GuiPrefsDialog>
 {
 public:
-       GuiPrefs(Dialog &);
+       GuiPrefs(GuiDialog &);
 
        Converters & converters();
        Formats & formats();
index 7aea586cce9d7bd51342a5be215f7157347bf2bc..aa861ab84365c17e946a86c8f8075f3d2b8e856b 100644 (file)
@@ -12,9 +12,8 @@
 #include <config.h>
 
 #include "GuiPrint.h"
-#include "Qt2BC.h"
-#include "qt_helpers.h"
 
+#include "qt_helpers.h"
 #include "PrinterParams.h"
 
 #include "support/os.h"
@@ -104,7 +103,7 @@ void GuiPrintDialog::pagerangeChanged()
 }
 
 
-GuiPrint::GuiPrint(Dialog & parent)
+GuiPrint::GuiPrint(GuiDialog & parent)
        : GuiView<GuiPrintDialog>(parent, _("Print Document"))
 {
 }
@@ -114,8 +113,8 @@ void GuiPrint::build_dialog()
 {
        dialog_.reset(new GuiPrintDialog(this));
 
-       bcview().setOK(dialog_->printPB);
-       bcview().setCancel(dialog_->closePB);
+       bc().setOK(dialog_->printPB);
+       bc().setCancel(dialog_->closePB);
 }
 
 
index b8f8c15d8b552775ecaf771d21eb0d5c7bdd96dd..494654a17ee6bb675ab912792e79437f839fd63d 100644 (file)
@@ -46,7 +46,7 @@ public:
        ///
        friend class GuiPrintDialog;
        ///
-       GuiPrint(Dialog &);
+       GuiPrint(GuiDialog &);
        /// parent controller
        ControlPrint & controller()
        { return static_cast<ControlPrint &>(this->getController()); }
index b268a3f478c71d1573bf5893a0609bc0bb3fa428..ab3a9710739ea488e719c0b2606e511134599a81 100644 (file)
 #include <config.h>
 
 #include "GuiRef.h"
-#include "Qt2BC.h"
 #include "qt_helpers.h"
 
-#include "ButtonController.h"
-
 #include "insets/InsetRef.h"
 
 #include <QLineEdit>
@@ -181,7 +178,7 @@ void GuiRefDialog::closeEvent(QCloseEvent * e)
 /////////////////////////////////////////////////////////////////////
 
 
-GuiRef::GuiRef(Dialog & parent)
+GuiRef::GuiRef(GuiDialog & parent)
        : GuiView<GuiRefDialog>(parent, _("Cross-reference")),
        sort_(false), at_ref_(false)
 {
@@ -192,15 +189,15 @@ void GuiRef::build_dialog()
 {
        dialog_.reset(new GuiRefDialog(this));
 
-       bcview().setOK(dialog_->okPB);
-       bcview().setApply(dialog_->applyPB);
-       bcview().setCancel(dialog_->closePB);
-       bcview().addReadOnly(dialog_->refsLW);
-       bcview().addReadOnly(dialog_->sortCB);
-       bcview().addReadOnly(dialog_->nameED);
-       bcview().addReadOnly(dialog_->referenceED);
-       bcview().addReadOnly(dialog_->typeCO);
-       bcview().addReadOnly(dialog_->bufferCO);
+       bc().setOK(dialog_->okPB);
+       bc().setApply(dialog_->applyPB);
+       bc().setCancel(dialog_->closePB);
+       bc().addReadOnly(dialog_->refsLW);
+       bc().addReadOnly(dialog_->sortCB);
+       bc().addReadOnly(dialog_->nameED);
+       bc().addReadOnly(dialog_->referenceED);
+       bc().addReadOnly(dialog_->typeCO);
+       bc().addReadOnly(dialog_->bufferCO);
 
        restored_buffer_ = -1;
 }
@@ -243,7 +240,7 @@ void GuiRef::update_contents()
                dialog_->bufferCO->setCurrentIndex(controller().getBufferNum());
 
        updateRefs();
-       bc().valid(false);
+       bc().setValid(false);
 }
 
 
index 81288a9cb32b9831f94a6cdce4e0646092765e7f..5d22ca336e4faeb9a631f63bb7ab27ca695dbef3 100644 (file)
@@ -57,7 +57,7 @@ class GuiRef : public GuiView<GuiRefDialog>
 public:
        friend class GuiRefDialog;
 
-       GuiRef(Dialog &);
+       GuiRef(GuiDialog &);
 
        /// parent controller
        ControlRef & controller()
index f936472384709a40ca61d560a098945ea20376a4..42a74587b4fb6f949ec4dd1ef011d1a65817a2c8 100644 (file)
@@ -13,7 +13,6 @@
 
 #include "GuiSearch.h"
 #include "qt_helpers.h"
-#include "Qt2BC.h"
 
 #include <QLineEdit>
 #include <QCloseEvent>
@@ -130,7 +129,7 @@ void GuiSearchDialog::replaceallClicked()
 /////////////////////////////////////////////////////////////////////
 
 
-GuiSearch::GuiSearch(Dialog & parent)
+GuiSearch::GuiSearch(GuiDialog & parent)
        : GuiView<GuiSearchDialog>(parent, _("Find and Replace"))
 {
 }
@@ -140,10 +139,10 @@ void GuiSearch::build_dialog()
 {
        dialog_.reset(new GuiSearchDialog(this));
 
-       bcview().setCancel(dialog_->closePB);
-       bcview().addReadOnly(dialog_->replaceCO);
-       bcview().addReadOnly(dialog_->replacePB);
-       bcview().addReadOnly(dialog_->replaceallPB);
+       bc().setCancel(dialog_->closePB);
+       bc().addReadOnly(dialog_->replaceCO);
+       bc().addReadOnly(dialog_->replacePB);
+       bc().addReadOnly(dialog_->replaceallPB);
 
        dialog_->replacePB->setEnabled(false);
        dialog_->replaceallPB->setEnabled(false);
index a022a66bba611e5c90c1b898a0acac7e7f4c4dca..d36b33b62a183e7f4d4ea05284a4e71f2c0a6713 100644 (file)
@@ -50,7 +50,7 @@ public:
        ///
        friend class GuiSearchDialog;
        ///
-       GuiSearch(Dialog &);
+       GuiSearch(GuiDialog &);
        /// parent controller
        ControlSearch & controller()
        { return static_cast<ControlSearch &>(this->getController()); }
index 3015fd8a0095a5d06a7af28d76286bcec2798352..e635272be003f4d2ea1e9231c69ff5def16143fd 100644 (file)
@@ -11,7 +11,6 @@
 #include <config.h>
 
 #include "GuiSendto.h"
-#include "Qt2BC.h"
 #include "qt_helpers.h"
 
 #include "Format.h"
@@ -76,7 +75,7 @@ void GuiSendtoDialog::closeEvent(QCloseEvent * e)
 /////////////////////////////////////////////////////////////////////
 
 
-GuiSendto::GuiSendto(Dialog & parent)
+GuiSendto::GuiSendto(GuiDialog & parent)
        : GuiView<GuiSendtoDialog>(parent, _("Send Document to Command"))
 {
 }
@@ -87,9 +86,9 @@ void GuiSendto::build_dialog()
        dialog_.reset(new GuiSendtoDialog(this));
 
        // Manage the ok, apply, restore and cancel/close buttons
-       bcview().setOK(dialog_->okPB);
-       bcview().setApply(dialog_->applyPB);
-       bcview().setCancel(dialog_->closePB);
+       bc().setOK(dialog_->okPB);
+       bc().setApply(dialog_->applyPB);
+       bc().setCancel(dialog_->closePB);
 }
 
 
index efdd78b41f25f4929b83b5baff1d88910635395c..8fd9faf32a37d860e3831e39c1bff30151d15182 100644 (file)
@@ -53,7 +53,7 @@ public:
        ///
        friend class GuiSendtoDialog;
        ///
-       GuiSendto(Dialog &);
+       GuiSendto(GuiDialog &);
        /// parent controller
        ControlSendto & controller()
        { return static_cast<ControlSendto &>(this->getController()); }
index 306b3efd5fe8513c3dda44a6cfc3fbadc2c541eb..ab89573a434738cf32c65ddeccb51b76c3d5d7a4 100644 (file)
@@ -11,7 +11,6 @@
 #include <config.h>
 
 #include "GuiShowFile.h"
-#include "Qt2BC.h"
 #include "qt_helpers.h"
 
 #include <QTextBrowser>
@@ -49,7 +48,7 @@ void GuiShowFileDialog::closeEvent(QCloseEvent * e)
 /////////////////////////////////////////////////////////////////////
 
 
-GuiShowFile::GuiShowFile(Dialog & parent)
+GuiShowFile::GuiShowFile(GuiDialog & parent)
        : GuiView<GuiShowFileDialog>(parent, _("Show File"))
 {
 }
@@ -59,7 +58,7 @@ void GuiShowFile::build_dialog()
 {
        dialog_.reset(new GuiShowFileDialog(this));
 
-       bcview().setCancel(dialog_->closePB);
+       bc().setCancel(dialog_->closePB);
 }
 
 
index 0c72c164288ec8924b50a97b3f789b2110cc5374..5a219dd9a2f27fa9d8445b9490f2d4e5f2aae1b0 100644 (file)
@@ -41,7 +41,7 @@ class GuiShowFile : public GuiView<GuiShowFileDialog>
 public:
        friend class GuiShowFileDialog;
 
-       GuiShowFile(Dialog &);
+       GuiShowFile(GuiDialog &);
        /// parent controller
        ControlShowFile & controller()
        { return static_cast<ControlShowFile &>(this->getController()); }
index 15756d51c7a6de18dc372d578b0b29a13812207f..ddf0af2e6270b772e88a62357f6c53ea30f43a51 100644 (file)
@@ -11,7 +11,6 @@
 #include <config.h>
 
 #include "GuiSpellchecker.h"
-#include "Qt2BC.h"
 #include "qt_helpers.h"
 
 #include <QProgressBar>
@@ -127,7 +126,7 @@ void GuiSpellcheckerDialog::reject()
 /////////////////////////////////////////////////////////////////////
 
 
-GuiSpellchecker::GuiSpellchecker(Dialog & parent)
+GuiSpellchecker::GuiSpellchecker(GuiDialog & parent)
        : GuiView<GuiSpellcheckerDialog>(parent, _("Spellchecker"))
 {}
 
@@ -136,7 +135,7 @@ void GuiSpellchecker::build_dialog()
 {
        dialog_.reset(new GuiSpellcheckerDialog(this));
 
-       bcview().setCancel(dialog_->closePB);
+       bc().setCancel(dialog_->closePB);
        dialog_->wordED->setReadOnly(true);
 }
 
index 9c4a9258b5e55c65c0f1e2f10baebef32da0ac51..cce38ec91dedce05fb227214a3c86fcdf212e1c8 100644 (file)
@@ -55,7 +55,7 @@ class GuiSpellchecker : public GuiView<GuiSpellcheckerDialog>
 public:
        friend class GuiSpellcheckerDialog;
 
-       GuiSpellchecker(Dialog &);
+       GuiSpellchecker(GuiDialog &);
 
        /// update from controller
        void partialUpdate(int id);
index 050a487eac7ac9062d54cb609b3745a7890b2a3d..c0245043518ce292867cd1098a973b9a5a149650 100644 (file)
 #include "GuiTabular.h"
 
 #include "GuiSetBorder.h"
-#include "Qt2BC.h"
-
 #include "LengthCombo.h"
 #include "Validator.h"
 #include "qt_helpers.h"
 
-#include "controllers/ButtonController.h"
-
 #include "support/convert.h"
 
 #include <QCloseEvent>
@@ -516,7 +512,7 @@ void GuiTabularDialog::ltLastFooterEmpty_clicked()
 /////////////////////////////////////////////////////////////////////
 
 
-GuiTabular::GuiTabular(Dialog & parent)
+GuiTabular::GuiTabular(GuiDialog & parent)
        : GuiView<GuiTabularDialog>(parent, _("Table Settings"))
 {
 }
@@ -526,57 +522,53 @@ void GuiTabular::build_dialog()
 {
        dialog_.reset(new GuiTabularDialog(this));
 
-       bcview().setCancel(dialog_->closePB);
-
-       bcview().addReadOnly(dialog_->topspaceED);
-       bcview().addReadOnly(dialog_->topspaceUnit);
-       bcview().addReadOnly(dialog_->topspaceCO);
-       bcview().addReadOnly(dialog_->bottomspaceED);
-       bcview().addReadOnly(dialog_->bottomspaceUnit);
-       bcview().addReadOnly(dialog_->bottomspaceCO);
-       bcview().addReadOnly(dialog_->interlinespaceED);
-       bcview().addReadOnly(dialog_->interlinespaceUnit);
-       bcview().addReadOnly(dialog_->interlinespaceCO);
-       bcview().addReadOnly(dialog_->borderDefaultRB);
-       bcview().addReadOnly(dialog_->booktabsRB);
-
-       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_->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);
+       bc().setCancel(dialog_->closePB);
+
+       bc().addReadOnly(dialog_->topspaceED);
+       bc().addReadOnly(dialog_->topspaceUnit);
+       bc().addReadOnly(dialog_->topspaceCO);
+       bc().addReadOnly(dialog_->bottomspaceED);
+       bc().addReadOnly(dialog_->bottomspaceUnit);
+       bc().addReadOnly(dialog_->bottomspaceCO);
+       bc().addReadOnly(dialog_->interlinespaceED);
+       bc().addReadOnly(dialog_->interlinespaceUnit);
+       bc().addReadOnly(dialog_->interlinespaceCO);
+       bc().addReadOnly(dialog_->borderDefaultRB);
+       bc().addReadOnly(dialog_->booktabsRB);
+
+       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_->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);
 
        // initialize the length validator
-       addCheckedLineEdit(bcview(), dialog_->widthED,
-               dialog_->fixedWidthColLA);
-       addCheckedLineEdit(bcview(), dialog_->topspaceED,
-               dialog_->topspaceLA);
-       addCheckedLineEdit(bcview(), dialog_->bottomspaceED,
-               dialog_->bottomspaceLA);
-       addCheckedLineEdit(bcview(), dialog_->interlinespaceED,
-               dialog_->interlinespaceLA);
+       bc().addCheckedLineEdit(dialog_->widthED, dialog_->fixedWidthColLA);
+       bc().addCheckedLineEdit(dialog_->topspaceED, dialog_->topspaceLA);
+       bc().addCheckedLineEdit(dialog_->bottomspaceED, dialog_->bottomspaceLA);
+       bc().addCheckedLineEdit(dialog_->interlinespaceED, dialog_->interlinespaceLA);
 }
 
 
@@ -668,7 +660,8 @@ void GuiTabular::update_contents()
        bool const isReadonly = bc().policy().isReadOnly();
        dialog_->specialAlignmentED->setEnabled(!isReadonly);
 
-       Length::UNIT default_unit = controller().useMetricUnits() ? Length::CM : Length::IN;
+       Length::UNIT default_unit =
+               controller().useMetricUnits() ? Length::CM : Length::IN;
 
        dialog_->borderDefaultRB->setChecked(!tabular.useBookTabs());
        dialog_->booktabsRB->setChecked(tabular.useBookTabs());
index d9bcc9abe25d429ce51be56e4a4e14135f6f875c..7339d5c60b991c856733427efd484ceb07bfbbf6 100644 (file)
@@ -83,7 +83,7 @@ class GuiTabular : public GuiView<GuiTabularDialog>
 public:
        friend class GuiTabularDialog;
 
-       GuiTabular(Dialog &);
+       GuiTabular(GuiDialog &);
 
        /// parent controller
        ControlTabular & controller()
index e98ab486fb878976b66826035d20d38e83c770d2..0f9a1a48fa011463f835b14f171018789e631892 100644 (file)
@@ -11,7 +11,6 @@
 #include <config.h>
 
 #include "GuiTabularCreate.h"
-#include "Qt2BC.h"
 #include "EmptyTable.h"
 
 #include <QCloseEvent>
@@ -64,7 +63,7 @@ void GuiTabularCreateDialog::rowsChanged(int)
 /////////////////////////////////////////////////////////////////////
 
 
-GuiTabularCreate::GuiTabularCreate(Dialog & parent)
+GuiTabularCreate::GuiTabularCreate(GuiDialog & parent)
        : GuiView<GuiTabularCreateDialog>(parent, _("Insert Table"))
 {
 }
@@ -74,8 +73,8 @@ void GuiTabularCreate::build_dialog()
 {
        dialog_.reset(new GuiTabularCreateDialog(this));
 
-       bcview().setOK(dialog_->okPB);
-       bcview().setCancel(dialog_->closePB);
+       bc().setOK(dialog_->okPB);
+       bc().setCancel(dialog_->closePB);
 }
 
 
index 474f4e42e9c7cab643cafa526fd1da90c85bcfa1..75056ca1fe3a106c7efe70ee9f369aa8c9f7670e 100644 (file)
@@ -42,7 +42,7 @@ public:
        ///
        friend class GuiTabularCreateDialog;
        ///
-       GuiTabularCreate(Dialog &);
+       GuiTabularCreate(GuiDialog &);
        /// parent controller
        ControlTabularCreate & controller()
        { return static_cast<ControlTabularCreate &>(this->getController()); }
index c9eea0043480eb000f7aa41e36c638dfe7d1ccae..2efa10b37a2d6e3bedebebc7b9286a91c49e84d7 100644 (file)
@@ -11,7 +11,6 @@
 #include <config.h>
 
 #include "GuiTexinfo.h"
-#include "Qt2BC.h"
 #include "qt_helpers.h"
 
 #include "support/filetools.h"
@@ -122,7 +121,7 @@ void GuiTexinfoDialog::enableViewPB()
 /////////////////////////////////////////////////////////////////////
 
 
-GuiTexinfo::GuiTexinfo(Dialog & parent)
+GuiTexinfo::GuiTexinfo(GuiDialog & parent)
        : GuiView<GuiTexinfoDialog>(parent, _("TeX Information")),
          warningPosted(false), activeStyle(ControlTexinfo::cls)
 {
@@ -135,7 +134,7 @@ void GuiTexinfo::build_dialog()
 
        updateStyles(ControlTexinfo::cls);
 
-       bcview().setCancel(dialog_->closePB);
+       bc().setCancel(dialog_->closePB);
 }
 
 
index 6e840d1f4455d557a4b8c6d57087e72ace813a7e..649b6644f20c71f04e6437b6c34948adc234c7f8 100644 (file)
@@ -52,7 +52,7 @@ public:
        ///
        friend class GuiTexinfoDialog;
        ///
-       GuiTexinfo(Dialog &);
+       GuiTexinfo(GuiDialog &);
        /// parent controller
        ControlTexinfo & controller()
        { return static_cast<ControlTexinfo &>(this->getController()); }
index dc076319f051a042e4e43bb5ff156b02128e3de9..6d1490ca47b82b4a0bf0056931fedb9b6f6802a3 100644 (file)
@@ -11,7 +11,6 @@
 #include <config.h>
 
 #include "GuiThesaurus.h"
-#include "Qt2BC.h"
 #include "qt_helpers.h"
 #include "debug.h"
 
@@ -141,7 +140,7 @@ void GuiThesaurusDialog::updateLists()
 //
 /////////////////////////////////////////////////////////////////////
 
-GuiThesaurus::GuiThesaurus(Dialog & parent)
+GuiThesaurus::GuiThesaurus(GuiDialog & parent)
        : GuiView<GuiThesaurusDialog>(parent, _("Thesaurus"))
 {
 }
@@ -151,10 +150,10 @@ void GuiThesaurus::build_dialog()
 {
        dialog_.reset(new GuiThesaurusDialog(this));
 
-       bcview().setCancel(dialog_->closePB);
-       bcview().setApply(dialog_->replacePB);
-       bcview().addReadOnly(dialog_->replaceED);
-       bcview().addReadOnly(dialog_->replacePB);
+       bc().setCancel(dialog_->closePB);
+       bc().setApply(dialog_->replacePB);
+       bc().addReadOnly(dialog_->replaceED);
+       bc().addReadOnly(dialog_->replacePB);
 }
 
 
index cb8f48ce1b67e4b82fe0c971c866afc94d2d3b4c..2a008be6728e83310445315675442b403b912c4b 100644 (file)
@@ -56,7 +56,7 @@ public:
        ///
        friend class GuiThesaurusDialog;
        ///
-       GuiThesaurus(Dialog &);
+       GuiThesaurus(GuiDialog &);
        /// parent controller
        ControlThesaurus & controller()
        { return static_cast<ControlThesaurus &>(this->getController()); }
index 7ec2110c1f50d485aae2ae641a5ec826e8b57437..3749d117c7999ed818f40561c0009e9faaf5c945 100644 (file)
 #include "GuiToc.h"
 
 #include "TocModel.h"
-#include "Qt2BC.h"
 #include "qt_helpers.h"
 
 #include "debug.h"
 
-#include "controllers/ControlToc.h"
+#include "ControlToc.h"
 
 #include <algorithm>
 
index 518987cfa1a58a98b1c3bd3f0a2c621b3c725b73..40761fb49f889d21f5e85f55220e15674536e2a9 100644 (file)
@@ -11,9 +11,7 @@
 #include <config.h>
 
 #include "GuiURL.h"
-#include "Qt2BC.h"
 #include "qt_helpers.h"
-#include "ButtonController.h"
 
 #include <QCheckBox>
 #include <QCloseEvent>
@@ -56,7 +54,7 @@ void GuiURLDialog::closeEvent(QCloseEvent * e)
 
 
 
-UrlView::UrlView(Dialog & parent)
+UrlView::UrlView(GuiDialog & parent)
        : GuiView<GuiURLDialog>(parent, _("URL"))
 {
 }
@@ -66,11 +64,11 @@ void UrlView::build_dialog()
 {
        dialog_.reset(new GuiURLDialog(this));
 
-       bcview().setOK(dialog_->okPB);
-       bcview().setCancel(dialog_->closePB);
-       bcview().addReadOnly(dialog_->urlED);
-       bcview().addReadOnly(dialog_->nameED);
-       bcview().addReadOnly(dialog_->hyperlinkCB);
+       bc().setOK(dialog_->okPB);
+       bc().setCancel(dialog_->closePB);
+       bc().addReadOnly(dialog_->urlED);
+       bc().addReadOnly(dialog_->nameED);
+       bc().addReadOnly(dialog_->hyperlinkCB);
 }
 
 
@@ -82,7 +80,7 @@ void UrlView::update_contents()
        dialog_->nameED->setText(toqstr(params["name"]));
        dialog_->hyperlinkCB->setChecked(params.getCmdName() != "url");
 
-       bc().valid(isValid());
+       bc().setValid(isValid());
 }
 
 
index 6c9c5ffee9963c69b3cf9263788a39de47e6ea51..4015ae40e9dce69c654f6f016eedd3368f471933 100644 (file)
@@ -41,7 +41,7 @@ class UrlView : public GuiView<GuiURLDialog>
 {
 public:
        friend class QURLDialog;
-       UrlView(Dialog &);
+       UrlView(GuiDialog &);
        /// parent controller
        ControlCommand & controller()
        { return static_cast<ControlCommand &>(this->getController()); }
index 3473f82f7949bba9b818aa56cfc9d571ee7ed9ac..df7c13da94fdd50d97df71c9bf4b5a8ed02c3f97 100644 (file)
@@ -16,7 +16,6 @@
 #include <config.h>
 
 #include "GuiVSpace.h"
-#include "Qt2BC.h"
 
 #include "LengthCombo.h"
 #include "qt_helpers.h"
@@ -26,8 +25,8 @@
 #include "Spacing.h"
 #include "VSpace.h"
 
-#include "controllers/ControlVSpace.h"
-#include "controllers/frontend_helpers.h"
+#include "ControlVSpace.h"
+#include "frontend_helpers.h"
 
 #include "support/lstrings.h"
 
@@ -181,7 +180,7 @@ static VSpace setVSpaceFromWidgets(int spacing,
 }
 
 
-GuiVSpace::GuiVSpace(Dialog & parent)
+GuiVSpace::GuiVSpace(GuiDialog & parent)
        : GuiView<GuiVSpaceDialog>(parent, _("Vertical Space Settings"))
 {}
 
@@ -192,18 +191,18 @@ void GuiVSpace::build_dialog()
        dialog_.reset(new GuiVSpaceDialog(this));
 
        // Manage the ok, apply, restore and cancel/close buttons
-       bcview().setOK(dialog_->okPB);
-       bcview().setApply(dialog_->applyPB);
-       bcview().setCancel(dialog_->closePB);
+       bc().setOK(dialog_->okPB);
+       bc().setApply(dialog_->applyPB);
+       bc().setCancel(dialog_->closePB);
 
        // disable for read-only documents
-       bcview().addReadOnly(dialog_->spacingCO);
-       bcview().addReadOnly(dialog_->valueLE);
-       bcview().addReadOnly(dialog_->unitCO);
-       bcview().addReadOnly(dialog_->keepCB);
+       bc().addReadOnly(dialog_->spacingCO);
+       bc().addReadOnly(dialog_->valueLE);
+       bc().addReadOnly(dialog_->unitCO);
+       bc().addReadOnly(dialog_->keepCB);
 
        // initialize the length validator
-       addCheckedLineEdit(bcview(), dialog_->valueLE, dialog_->valueL);
+       bc().addCheckedLineEdit(dialog_->valueLE, dialog_->valueL);
 
        // remove the %-items from the unit choice
        dialog_->unitCO->noPercents();
index 9cc1f74a7a86364ff9be78faf8dda10fe0c3c0b9..708ffdd92a775fd68cd9e8110d1e139770be61f8 100644 (file)
@@ -50,7 +50,7 @@ public:
        ///
        friend class GuiVSpaceDialog;
        ///
-       GuiVSpace(Dialog &);
+       GuiVSpace(GuiDialog &);
        /// parent controller
        ControlVSpace & controller()
        { return static_cast<ControlVSpace &>(this->getController()); }
index e22b0652d103f653fea4dc3029a67125bdd7926e..1ea22141251d9fd2ac11058251e2af41ce58fafa 100644 (file)
@@ -160,7 +160,7 @@ void LaTeXHighlighter::highlightBlock(QString const & text)
 }
 
 
-GuiViewSource::GuiViewSource(Dialog & parent)
+GuiViewSource::GuiViewSource(GuiDialog & parent)
        : ControlViewSource(parent)
 {
        document_ = new QTextDocument(this);
index 1f3e56e76973f22bddd73dba9d8e231dd2618944..93459360239da638c87355949f1190963511b39e 100644 (file)
@@ -15,6 +15,7 @@
 #define GUIVIEWSOURCE_H
 
 #include "ControlViewSource.h"
+#include "GuiDialog.h"
 #include "Application.h"
 #include "ui_ViewSourceUi.h"
 
@@ -63,7 +64,7 @@ private:
 class GuiViewSource : public QObject, public ControlViewSource {
 public:
        ///
-       GuiViewSource(Dialog &);
+       GuiViewSource(GuiDialog &);
        ///
        QTextDocument * document() { return document_; }
        ///
index af19e66503bc33c86f7d49b07332ecf93fb0cb01..d6718eae43559af93857b0dac756f8774114bcd2 100644 (file)
@@ -11,7 +11,6 @@
 #include <config.h>
 
 #include "GuiWrap.h"
-#include "Qt2BC.h"
 
 #include "LengthCombo.h"
 #include "qt_helpers.h"
@@ -75,7 +74,7 @@ void GuiWrapDialog::change_adaptor()
 //
 /////////////////////////////////////////////////////////////////////
 
-GuiWrap::GuiWrap(Dialog & parent)
+GuiWrap::GuiWrap(GuiDialog & parent)
        : GuiView<GuiWrapDialog>(parent, _("Text Wrap Settings"))
 {
 }
@@ -85,14 +84,14 @@ void GuiWrap::build_dialog()
 {
        dialog_.reset(new GuiWrapDialog(this));
 
-       bcview().setRestore(dialog_->restorePB);
-       bcview().setOK(dialog_->okPB);
-       bcview().setApply(dialog_->applyPB);
-       bcview().setCancel(dialog_->closePB);
+       bc().setRestore(dialog_->restorePB);
+       bc().setOK(dialog_->okPB);
+       bc().setApply(dialog_->applyPB);
+       bc().setCancel(dialog_->closePB);
 
-       bcview().addReadOnly(dialog_->widthED);
-       bcview().addReadOnly(dialog_->unitsLC);
-       bcview().addReadOnly(dialog_->valignCO);
+       bc().addReadOnly(dialog_->widthED);
+       bc().addReadOnly(dialog_->unitsLC);
+       bc().addReadOnly(dialog_->valignCO);
 }
 
 
index 8bdf588c86d53599508e767586720778c07aa114..2956f7ddcfd054101011ca4cc4cf6b9223db725c 100644 (file)
@@ -42,7 +42,7 @@ class GuiWrap : public GuiView<GuiWrapDialog>
 public:
        friend class GuiWrapDialog;
 
-       GuiWrap(Dialog &);
+       GuiWrap(GuiDialog &);
        /// parent controller
        ControlWrap & controller()
        { return static_cast<ControlWrap &>(this->getController()); }
index ccf241fa05915a843ea62dce05a8ba48f116356b..ff01af670ca02c576d893cd3b9f32fc0717de3ba 100644 (file)
@@ -38,6 +38,7 @@ SOURCEFILES = \
        Action.cpp \
        alert_pimpl.cpp \
        BulletsModule.cpp \
+       ButtonController.cpp \
        ColorCache.cpp \
        Dialogs.cpp \
        EmptyTable.cpp \
@@ -57,6 +58,7 @@ SOURCEFILES = \
        GuiCommandBuffer.cpp \
        GuiCommandEdit.cpp \
        GuiDelimiter.cpp \
+       GuiDialog.cpp \
        GuiDialogView.cpp \
        GuiDocument.cpp \
        GuiEmbeddedFiles.cpp \
@@ -110,7 +112,6 @@ SOURCEFILES = \
        LengthCombo.cpp \
        LyXFileDialog.cpp \
        PanelStack.cpp \
-       Qt2BC.cpp \
        qt_helpers.cpp \
        socket_callback.cpp \
        TocModel.cpp \
@@ -118,13 +119,13 @@ SOURCEFILES = \
        Validator.cpp 
 
 NOMOCHEADER = \
+       ButtonController.h \
        GuiClipboard.h \
        GuiFontLoader.h \
        GuiFontMetrics.h \
        GuiSelection.h \
        GuiImage.h \
        GuiPainter.h \
-       Qt2BC.h \
        qt_helpers.h
 
 MOCHEADER = \
@@ -147,6 +148,7 @@ MOCHEADER = \
        GuiCommandBuffer.h \
        GuiCommandEdit.h \
        GuiDelimiter.h \
+       GuiDialog.h \
        GuiDialogView.h \
        GuiDocument.h \
        GuiEmbeddedFiles.h \
diff --git a/src/frontends/qt4/Qt2BC.cpp b/src/frontends/qt4/Qt2BC.cpp
deleted file mode 100644 (file)
index 9653c89..0000000
+++ /dev/null
@@ -1,166 +0,0 @@
-/**
- * \file Qt2BC.cpp
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author Allan Rae
- * \author Angus Leeming
- *
- * Full author contact details are available in file CREDITS.
- */
-
-#include <config.h>
-
-#include "Qt2BC.h"
-#include "BCView.h"
-#include "ButtonPolicy.h"
-#include "debug.h"
-#include "qt_helpers.h"
-
-#include <QPushButton>
-#include <QLineEdit>
-#include <QLabel>
-#include <QValidator>
-
-
-namespace lyx {
-namespace frontend {
-
-
-Qt2BC::Qt2BC(ButtonController & parent)
-       : BCView(parent), okay_(0), apply_(0), cancel_(0), restore_(0)
-{}
-
-
-void Qt2BC::refresh() const
-{
-       LYXERR(Debug::GUI) << "Calling BC refresh()" << std::endl;
-
-       bool const all_valid = checkWidgets();
-
-       if (okay_) {
-               bool const enabled =
-                       all_valid && bp().buttonStatus(ButtonPolicy::OKAY);
-               okay_->setEnabled(enabled);
-       }
-       if (apply_) {
-               bool const enabled =
-                       all_valid && bp().buttonStatus(ButtonPolicy::APPLY);
-               apply_->setEnabled(enabled);
-       }
-       if (restore_) {
-               bool const enabled =
-                       all_valid && bp().buttonStatus(ButtonPolicy::RESTORE);
-               restore_->setEnabled(enabled);
-       }
-       if (cancel_) {
-               bool const enabled = bp().buttonStatus(ButtonPolicy::CANCEL);
-               if (enabled)
-                       cancel_->setText(toqstr(_("Cancel")));
-               else
-                       cancel_->setText(toqstr(_("Close")));
-       }
-}
-
-
-void Qt2BC::refreshReadOnly() const
-{
-       if (read_only_.empty())
-               return;
-
-       bool const enable = !bp().isReadOnly();
-
-       Widgets::const_iterator end = read_only_.end();
-       Widgets::const_iterator iter = read_only_.begin();
-       for (; iter != end; ++iter)
-               setWidgetEnabled(*iter, enable);
-}
-
-
-void Qt2BC::setWidgetEnabled(QWidget * obj, bool enabled) const
-{
-       if (QLineEdit * le = qobject_cast<QLineEdit*>(obj))
-               le->setReadOnly(!enabled);
-       else
-               obj->setEnabled(enabled);
-
-       obj->setFocusPolicy(enabled ? Qt::StrongFocus : Qt::NoFocus);
-}
-
-
-void Qt2BC::addCheckedLineEdit(QLineEdit * input, QWidget * label)
-{
-       checked_widgets.push_back(CheckedLineEdit(input, label));
-}
-
-
-bool Qt2BC::checkWidgets() const
-{
-       bool valid = true;
-
-       CheckedWidgetList::const_iterator it  = checked_widgets.begin();
-       CheckedWidgetList::const_iterator end = checked_widgets.end();
-
-       for (; it != end; ++it)
-               valid &= it->check();
-
-       // return valid status after checking ALL widgets
-       return valid;
-}
-
-
-//////////////////////////////////////////////////////////////
-//
-// CheckedLineEdit
-//
-//////////////////////////////////////////////////////////////
-
-void addCheckedLineEdit(BCView & bcview, QLineEdit * input, QWidget * label)
-{
-       Qt2BC * bc = static_cast<Qt2BC *>(&bcview);
-       bc->addCheckedLineEdit(input, label);
-}
-
-
-static void setWarningColor(QWidget * widget)
-{
-       QPalette pal = widget->palette();
-       pal.setColor(QPalette::Active, QPalette::Foreground, QColor(255, 0, 0));
-       widget->setPalette(pal);
-}
-
-
-
-CheckedLineEdit::CheckedLineEdit(QLineEdit * input, QWidget * label)
-       : input_(input), label_(label)
-{}
-
-
-bool CheckedLineEdit::check() const
-{
-       QValidator const * validator = input_->validator();
-       if (!validator)
-               return true;
-
-       QString t = input_->text();
-       int p = 0;
-       bool const valid = validator->validate(t, p) == QValidator::Acceptable;
-
-       // Visual feedback.
-       if (valid)
-               input_->setPalette(QPalette());
-       else
-               setWarningColor(input_);
-
-       if (label_) {
-               if (valid)
-                       label_->setPalette(QPalette());
-               else
-                       setWarningColor(label_);
-       }
-
-       return valid;
-}
-
-} // namespace frontend
-} // namespace lyx
diff --git a/src/frontends/qt4/Qt2BC.h b/src/frontends/qt4/Qt2BC.h
deleted file mode 100644 (file)
index fbef62c..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-// -*- C++ -*-
-/**
- * \file Qt2BC.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 QT2BC_H
-#define QT2BC_H
-
-#include "BCView.h"
-#include "gettext.h"
-
-#include <list>
-
-class QWidget;
-class QPushButton;
-class QLineEdit;
-
-namespace lyx {
-namespace frontend {
-
-
-void addCheckedLineEdit(BCView & bcview,
-       QLineEdit * input, QWidget * label = 0);
-
-class CheckedLineEdit
-{
-public:
-       CheckedLineEdit(QLineEdit * input, QWidget * label = 0);
-       bool check() const;
-
-private:
-       // non-owned
-       QLineEdit * input_;
-       QWidget * label_;
-};
-
-/** General purpose button controller for up to four buttons.
-    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.
-*/
-
-class Qt2BC : public BCView
-{
-public:
-       ///
-       Qt2BC(ButtonController & parent);
-
-       //@{
-       /** Store pointers to these widgets.
-        */
-       void setOK(QPushButton * obj) { okay_ = obj; }
-       void setApply(QPushButton * obj) { apply_ = obj; }
-       void setCancel(QPushButton * obj) { cancel_ = obj; }
-       void setRestore(QPushButton * obj) { restore_ = obj; }
-       //@}
-
-       /** Add a pointer to the list of widgets whose activation
-        *  state is dependent upon the read-only status of the
-        *  underlying buffer.
-        */
-       void addReadOnly(QWidget * obj) { read_only_.push_back(obj); }
-
-       /// Refresh the status of the Ok, Apply, Restore, Cancel buttons.
-       virtual void refresh() const;
-       /// Refresh the status of any widgets in the read_only list
-       virtual void refreshReadOnly() const;
-
-       /** Add a widget to the list of all widgets whose validity should
-        *  be checked explicitly when the buttons are refreshed.
-        */
-       void addCheckedLineEdit(QLineEdit * input, QWidget * label = 0);
-
-protected:
-       /// \return true if all CheckedWidgets are in a valid state.
-       bool checkWidgets() const;
-
-private:
-       typedef std::list<CheckedLineEdit> CheckedWidgetList;
-       CheckedWidgetList checked_widgets;
-
-private:
-       /// Updates the widget sensitivity (enabled/disabled)
-       void setWidgetEnabled(QWidget *, bool enabled) const;
-
-       QPushButton * okay_;
-       QPushButton * apply_;
-       QPushButton * cancel_;
-       QPushButton * restore_;
-
-       typedef std::list<QWidget *> Widgets;
-       Widgets read_only_;
-};
-
-} // namespace frontend
-} // namespace lyx
-
-#endif // QT2BC_H