No longer pass Controller & or Dialogs & to the View c-tors.

GUI now contains a controller rather than derives from a controller.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4942 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2002-08-12 14:28:43 +00:00
parent a9e93befaa
commit 1e3d2fce7f
148 changed files with 621 additions and 454 deletions

View File

@ -1,3 +1,9 @@
2002-08-12 Angus Leeming <leeming@lyx.org>
* DialogBase.h: no longer derive from boost::signals::trackable.
* Toolbar.[Ch] (c-tor): no londer passed a Dialogs &.
2002-08-08 John Levon <levon@movementarian.org>
* Toolbar.C:

View File

@ -17,7 +17,6 @@
#ifndef DIALOGBASE_H
#define DIALOGBASE_H
#include <boost/signals/trackable.hpp>
#include <boost/utility.hpp>
/** Abstract base class of all dialogs.
@ -26,7 +25,7 @@
satisfy that request. Thus a dialog will have to "pull" the necessary
details from the core of the program.
*/
class DialogBase : public boost::signals::trackable, boost::noncopyable
class DialogBase : boost::noncopyable
{
public:
/**@name Constructors and Deconstructors */

View File

@ -20,11 +20,10 @@
using std::endl;
Toolbar::Toolbar(LyXView * o, Dialogs & d,
int x, int y, ToolbarDefaults const &tbd)
Toolbar::Toolbar(LyXView * o, int x, int y, ToolbarDefaults const &tbd)
: last_textclass_(-1)
{
pimpl_ = new Pimpl(o, d, x, y);
pimpl_ = new Pimpl(o, x, y);
// extracts the toolbar actions from tbd
for (ToolbarDefaults::const_iterator cit = tbd.begin();

View File

@ -22,7 +22,7 @@
class LyXView;
class ToolbarDefaults;
class Dialogs;
/** The LyX GUI independent toolbar class
The GUI interface is implemented in the corresponding Toolbar_pimpl class.
@ -30,8 +30,7 @@ class Dialogs;
class Toolbar {
public:
///
Toolbar(LyXView * o, Dialogs & d,
int x, int y, ToolbarDefaults const &);
Toolbar(LyXView * o, int x, int y, ToolbarDefaults const &);
///
~Toolbar();

View File

@ -1,3 +1,21 @@
2002-08-12 Angus Leeming <leeming@lyx.org>
* ControlButtons.[Ch] (bc, view): no longer virtual.
(setView, setButtonController): new methods, invoked by GUI.
* ControlDialog.h (show):
* ControlInset.h (createInset, showInset): make public, so that GUI can
invoke them.
* GUI.h: GUI now contains a controller, rather than deriving from it.
remove all those friend functions since we can now access the show,
createInset, showInset controller methods.
* ViewBase.h: simplifiy, enabling ControlButtons to be forward-declared.
(ViewBC): scrapped.
* character.h: #include a couple of STL files.
2002-08-08 John Levon <levon@movementarian.org>
* ControlCommandBuffer.C: LyXAction cleanup

View File

@ -21,9 +21,11 @@
#include "ButtonControllerBase.h"
#include "ViewBase.h"
#include "lyxrc.h"
#include "support/LAssert.h"
ControlButtons::ControlButtons()
: emergency_exit_(false), is_closing_(false)
: emergency_exit_(false), is_closing_(false), bc_ptr_(0), view_ptr_(0)
{}
@ -62,3 +64,30 @@ bool ControlButtons::IconifyWithMain() const
{
return lyxrc.dialogs_iconify_with_main;
}
ButtonControllerBase & ControlButtons::bc()
{
lyx::Assert(bc_ptr_);
return *bc_ptr_;
}
ViewBase & ControlButtons::view()
{
lyx::Assert(view_ptr_);
return *view_ptr_;
}
void ControlButtons::setView(ViewBase & v)
{
view_ptr_ = &v;
}
void ControlButtons::setButtonController(ButtonControllerBase & bc)
{
bc_ptr_ = &bc;
}

View File

@ -48,7 +48,9 @@ public:
///
virtual ~ControlButtons() {}
/// These functions are called when the controlling buttons are pressed.
/** These functions are called by the view when the appropriate buttons
* are pressed.
*/
///
void ApplyButton();
///
@ -57,15 +59,22 @@ public:
void CancelButton();
///
void RestoreButton();
///
/// Returns the user-specified iconification policy.
bool IconifyWithMain() const;
/** Allow the view to access the ButtonController. This method must be
instantiated in a daughter class that creates the actual instance
of the ButtonController. */
virtual ButtonControllerBase & bc() = 0;
///
ButtonControllerBase & bc();
///
void setView(ViewBase &);
///
void setButtonController(ButtonControllerBase &);
protected:
///
ViewBase & view();
/** When Applying it's useful to know whether the dialog is about
to close or not (no point refreshing the display for example). */
bool isClosing() const { return is_closing_; }
@ -77,11 +86,6 @@ protected:
/// Update dialog before showing it.
virtual void update() = 0;
/** Allow the Controller to access the View. This method must be
instantiated in a daughter class that creates the actual instance
of the View. */
virtual ViewBase & view() = 0;
/** This flag can be set by one of the miriad the controller methods
to ensure that the dialog is shut down. */
bool emergency_exit_;
@ -89,7 +93,10 @@ protected:
private:
///
bool is_closing_;
/// We own neither of these pointers.
ButtonControllerBase * bc_ptr_;
///
ViewBase * view_ptr_;
};
#endif // CONTROLBUTTONS_H

View File

@ -29,9 +29,12 @@ public:
///
ControlDialog(LyXView &, Dialogs &);
protected:
/// Show the dialog.
/** Show the dialog.
* Publicly accessible so that it can be invoked by the Dialogs class.
*/
virtual void show();
protected:
/// Hide the dialog.
virtual void hide();
/// Update the dialog.

View File

@ -37,12 +37,13 @@ public:
///
Params const & params() const;
protected:
/// Slots connected in the daughter classes c-tor.
/// Slot launching dialog to (possibly) create a new inset.
void createInset(string const &);
/// Slot launching dialog to an existing inset.
void showInset(Inset *);
protected:
/// Allow the daughter methods to access the inset.
Inset * inset() const;

View File

@ -11,65 +11,41 @@
#define GUI_H
#include "ButtonController.h"
#include "ViewBase.h"
/** This class instantiates and makes available the GUI-specific
ButtonController and View.
/** This class makes a whole out of the disparate parts of a dialog.
*/
template <class Controller, class GUIview, class Policy, class GUIbc>
class GUI : public Controller {
template <typename Controller, typename GUIview,
typename Policy, typename GUIbc>
class GUI {
public:
///
GUI(LyXView & lv, Dialogs & d) : Controller(lv, d), view_(*this, d) {}
GUI(LyXView & lv, Dialogs & d);
///
virtual ButtonControllerBase & bc() { return bc_; }
Controller & controller() { return controller_; }
///
virtual ViewBase & view() { return view_; }
friend void gui_ShowAboutlyx(LyXView &, Dialogs &);
friend void gui_ShowBibitem(InsetCommand *, LyXView &, Dialogs &);
friend void gui_ShowBibtex(InsetCommand *, LyXView &, Dialogs &);
friend void gui_ShowCharacter(LyXView &, Dialogs &);
friend void gui_SetUserFreeFont(LyXView &, Dialogs &);
friend void gui_ShowCitation(InsetCommand *, LyXView &, Dialogs &);
friend void gui_CreateCitation(string const &, LyXView &, Dialogs &);
friend void gui_ShowDocument(LyXView &, Dialogs &);
friend void gui_ShowError(InsetError *, LyXView &, Dialogs &);
friend void gui_ShowERT(InsetERT *, LyXView &, Dialogs &);
friend void gui_UpdateERT(InsetERT *, LyXView &, Dialogs &);
friend void gui_ShowExternal(InsetExternal *, LyXView &, Dialogs &);
friend void gui_ShowFloat(InsetFloat *, LyXView &, Dialogs &);
friend void gui_ShowForks(LyXView &, Dialogs &);
friend void gui_ShowGraphics(InsetGraphics *, LyXView &, Dialogs &);
friend void gui_ShowInclude(InsetInclude *, LyXView &, Dialogs &);
friend void gui_ShowIndex(InsetCommand *, LyXView &, Dialogs &);
friend void gui_CreateIndex(LyXView &, Dialogs &);
friend void gui_ShowLogFile(LyXView &, Dialogs &);
friend void gui_ShowMathPanel(LyXView &, Dialogs &);
friend void gui_ShowMinipage(InsetMinipage *, LyXView &, Dialogs &);
friend void gui_UpdateMinipage(InsetMinipage *, LyXView &, Dialogs &);
friend void gui_ShowParagraph(LyXView &, Dialogs &);
friend void gui_ShowPreamble(LyXView &, Dialogs &);
friend void gui_ShowPreferences(LyXView &, Dialogs &);
friend void gui_ShowPrint(LyXView &, Dialogs &);
friend void gui_ShowRef(InsetCommand *, LyXView &, Dialogs &);
friend void gui_CreateRef(string const &, LyXView &, Dialogs &);
friend void gui_ShowSearch(LyXView &, Dialogs &);
friend void gui_ShowSendto(LyXView &, Dialogs &);
friend void gui_ShowSpellchecker(LyXView &, Dialogs &);
friend void gui_ShowTabularCreate(LyXView &, Dialogs &);
friend void gui_ShowTexinfo(LyXView &, Dialogs &);
friend void gui_ShowTOC(InsetCommand *, LyXView &, Dialogs &);
friend void gui_CreateTOC(string const &, LyXView &, Dialogs &);
friend void gui_ShowUrl(InsetCommand *, LyXView &, Dialogs &);
friend void gui_CreateUrl(string const &, LyXView &, Dialogs &);
friend void gui_ShowVCLogFile(LyXView &, Dialogs &);
Controller const & controller() const { return controller_; }
private:
///
Controller controller_;
///
ButtonController<Policy, GUIbc> bc_;
///
GUIview view_;
};
template <typename Controller, typename GUIview,
typename Policy, typename GUIbc>
GUI<Controller, GUIview, Policy, GUIbc>::GUI(LyXView & lv, Dialogs & d)
: controller_(lv, d),
view_()
{
controller_.setView(view_);
controller_.setButtonController(bc_);
view_.setController(controller_);
}
#endif // GUI_H

View File

@ -14,18 +14,22 @@
#ifndef VIEWBASE_H
#define VIEWBASE_H
#include <boost/utility.hpp>
#include "ControlButtons.h"
#include "support/LAssert.h"
class ControlButtons;
class ViewBase {
public:
///
ViewBase(ControlButtons & c) : controller_(c) {}
ViewBase() : controller_ptr_(0) {}
///
virtual ~ViewBase() {}
/// Apply changes to LyX data from dialog.
virtual void apply() = 0;
/// build the dialog
virtual void build() = 0;
/// Hide the dialog.
virtual void hide() = 0;
/// Redraw the dialog (e.g. if the colors have been remapped).
@ -34,47 +38,35 @@ public:
virtual void show() = 0;
/// Update dialog before/whilst showing it.
virtual void update() = 0;
/// build the dialog
virtual void build() = 0;
/** These shortcuts allow (e.g. xform's) global callback functions
access to the buttons without making the whole controller_ public.
*/
///
void ApplyButton() { controller_.ApplyButton(); }
///
void OKButton() { controller_.OKButton(); }
///
void CancelButton() { controller_.CancelButton(); }
///
void RestoreButton() { controller_.RestoreButton(); }
/** Defaults to nothing. Can be used by the Controller, however, to
indicate to the View that something has changed and that the
dialog therefore needs updating. */
/** Defaults to nothing. Can be used by the controller, however, to
* indicate to the view that something has changed and that the
* dialog therefore needs updating.
*/
virtual void partialUpdate(int) {}
protected:
/// The view is, after all, controlled!
ControlButtons & controller_;
};
/** A generic class to cast the ButtonController controller_.bc_ to it's
daughter class. */
template <class GUIbc>
class ViewBC : public ViewBase {
public:
/** This should be set by the GUI class that owns both the controller
* and the view
*/
void setController(ControlButtons & c) { controller_ptr_ = &c; }
///
ViewBC(ControlButtons & c) : ViewBase(c) {}
protected:
///
GUIbc & bc() const
ControlButtons & getController()
{
return static_cast<GUIbc &>(controller_.bc());
// return dynamic_cast<GUIbc &>(controller_.bc());
lyx::Assert(controller_ptr_);
return *controller_ptr_;
}
///
ControlButtons const & getController() const
{
lyx::Assert(controller_ptr_);
return *controller_ptr_;
}
protected:
/// We don't own this.
ControlButtons * controller_ptr_;
};
#endif // VIEWBASE_H

View File

@ -22,6 +22,9 @@
#include "lyxfont.h"
#include "LColor.h"
#include <utility>
#include <vector>
/** Functions of use to the character GUI controller and view */
namespace frnt {
///

View File

@ -1,3 +1,57 @@
2002-08-12 Angus Leeming <leeming@lyx.org>
* Menubar_pimpl.C: no need to #include "Dialogs.h". Remove semi-colon
from namespace closing delimiter.
* Menubar_pimpl.h: remove MenuItemInfo:: prefix from c-tor declaration.
* QAbout.[Ch]:
* QBibitem.[Ch]:
* QBibtex.[Ch]:
* QCharacter.[Ch]:
* QCitation.[Ch]:
* QERT.[Ch]:
* QError.[Ch]:
* QExternal.[Ch]:
* QFloat.[Ch]:
* QGraphics.[Ch]:
* QInclude.[Ch]:
* QIndex.[Ch]:
* QLog.[Ch]:
* QMinipage.[Ch]:
* QParagraph.[Ch]:
* QPreamble.[Ch]:
* QPrint.[Ch]:
* QRef.[Ch]:
* QSearch.[Ch]:
* QShowFile.[Ch]:
* QSpellchecker.[Ch]:
* QTabularCreate.[Ch]:
* QTexinfo.[Ch]:
* QThesaurus.[Ch]:
* QToc.[Ch]:
* QURL.[Ch]:
* QVCLog.[Ch]:
No longer pass Controller or Dialogs to the c-tor.
No longer forward-declare Dialogs.
* Qt2Base.[Ch]: derives from ViewBase directly.
No longer passed ControlButtons & or Dialogs &.
(bc): new method, enabling the daughter classes to access the
ButtonController.
(slotWMHide):
(slotApply):
(slotOK):
(slotClose):
(slotRestore): changes due to a change in the ViewBase class.
* QtView.C (c-tor): no longer pass Dialogs & to the Toolbar.
* Toolbar_pimpl.[Ch] (c-tor): no longer passed a Dialogs &.
* guiapi.C: access the controller methods by explicit invocation of the
controller.
2002-08-09 John Levon <levon@movementarian.org>
* Toolbar_pimpl.C: add missing header

View File

@ -19,7 +19,6 @@
#include "LyXAction.h"
#include "kbmap.h"
#include "buffer.h"
#include "Dialogs.h"
#include "lyxfunc.h"
#include "FloatList.h"
#include "support/lstrings.h"
@ -58,7 +57,7 @@ string const getLabel(MenuItem const & mi)
return label;
}
};
}
typedef vector<int>::size_type size_type;

View File

@ -36,10 +36,10 @@ class MenuBackend;
/// stored state for menu items
struct MenuItemInfo {
// I REALLY hate this stupid requirement of std::map
MenuItemInfo::MenuItemInfo()
MenuItemInfo()
: parent_(0), id_(0), item_(0) {};
MenuItemInfo::MenuItemInfo(QMenuData * p, int id, MenuItem const * item)
MenuItemInfo(QMenuData * p, int id, MenuItem const * item)
: parent_(p), id_(id), item_(item) {};
/// menu containing item

View File

@ -28,8 +28,8 @@ using std::getline;
typedef Qt2CB<ControlAboutlyx, Qt2DB<QAboutDialog> > base_class;
QAbout::QAbout(ControlAboutlyx & c, Dialogs &)
: base_class(c, _("About LyX"))
QAbout::QAbout()
: base_class(_("About LyX"))
{
}

View File

@ -13,7 +13,6 @@
#include "Qt2Base.h"
#include "boost/utility.hpp"
class Dialogs;
class LyXView;
class QAboutDialog;
class ControlAboutlyx;
@ -22,7 +21,7 @@ class QAbout
: public Qt2CB<ControlAboutlyx, Qt2DB<QAboutDialog> >
{
public:
QAbout(ControlAboutlyx &, Dialogs &);
QAbout();
private:
/// not needed

View File

@ -23,8 +23,8 @@
typedef Qt2CB<ControlBibitem, Qt2DB<QBibitemDialog> > base_class;
QBibitem::QBibitem(ControlBibitem & c, Dialogs &)
: base_class(c, _("Bibliography Item"))
QBibitem::QBibitem()
: base_class(_("Bibliography Item"))
{
}

View File

@ -21,7 +21,7 @@ class QBibitem :
friend class QBibitemDialog;
public:
QBibitem(ControlBibitem &, Dialogs &);
QBibitem();
protected:
virtual bool isValid();

View File

@ -29,8 +29,8 @@ using std::vector;
typedef Qt2CB<ControlBibtex, Qt2DB<QBibtexDialog> > base_class;
QBibtex::QBibtex(ControlBibtex & c, Dialogs &)
: base_class(c, _("BibTeX"))
QBibtex::QBibtex()
: base_class(_("BibTeX"))
{
}

View File

@ -21,7 +21,7 @@ class QBibtex :
friend class QBibtexDialog;
public:
QBibtex(ControlBibtex &, Dialogs &);
QBibtex();
protected:
virtual bool isValid();

View File

@ -27,8 +27,8 @@ using std::vector;
typedef Qt2CB<ControlCharacter, Qt2DB<QCharacterDialog> > base_class;
QCharacter::QCharacter(ControlCharacter & c, Dialogs &)
: base_class(c, _("Character"))
QCharacter::QCharacter()
: base_class(_("Character"))
{
}

View File

@ -22,7 +22,7 @@
class ControlCharacter;
class QCharacterDialog;
class Dialogs;
class QCharacter :
public Qt2CB<ControlCharacter, Qt2DB<QCharacterDialog> >
@ -30,7 +30,7 @@ class QCharacter :
friend class QCharacterDialog;
public:
QCharacter(ControlCharacter &, Dialogs &);
QCharacter();
private:
/// Apply changes

View File

@ -41,8 +41,8 @@ using std::vector;
typedef Qt2CB<ControlCitation, Qt2DB<QCitationDialog> > base_class;
QCitation::QCitation(ControlCitation & c, Dialogs &)
: base_class(c, _("Citation"))
QCitation::QCitation()
: base_class(_("Citation"))
{}

View File

@ -21,7 +21,7 @@ class QListBox;
class ControlCitation;
class QCitationDialog;
class Dialogs;
class QCitation : public Qt2CB<ControlCitation, Qt2DB<QCitationDialog> >
{
@ -29,7 +29,7 @@ class QCitation : public Qt2CB<ControlCitation, Qt2DB<QCitationDialog> >
public:
///
QCitation(ControlCitation &, Dialogs &);
QCitation();
private:
///

View File

@ -20,8 +20,8 @@
typedef Qt2CB<ControlERT, Qt2DB<QERTDialog> > base_class;
QERT::QERT(ControlERT & c, Dialogs &)
: base_class(c, _("LaTeX ERT"))
QERT::QERT()
: base_class(_("LaTeX ERT"))
{
}

View File

@ -14,7 +14,7 @@
class ControlERT;
class QERTDialog;
class Dialogs;
class QERT :
public Qt2CB<ControlERT, Qt2DB<QERTDialog> >
@ -22,7 +22,7 @@ class QERT :
friend class QERTDialog;
public:
QERT(ControlERT &, Dialogs &);
QERT();
private:
/// Apply changes

View File

@ -20,8 +20,8 @@
typedef Qt2CB<ControlError, Qt2DB<QErrorDialog> > base_class;
QError::QError(ControlError & c, Dialogs &)
: base_class(c, _("LaTeX Error"))
QError::QError()
: base_class(_("LaTeX Error"))
{
}

View File

@ -14,7 +14,7 @@
class ControlError;
class QErrorDialog;
class Dialogs;
class QError :
public Qt2CB<ControlError, Qt2DB<QErrorDialog> >
@ -22,7 +22,7 @@ class QError :
friend class QErrorDialog;
public:
QError(ControlError &, Dialogs &);
QError();
private:
/// Apply changes

View File

@ -23,8 +23,8 @@
typedef Qt2CB<ControlExternal, Qt2DB<QExternalDialog> > base_class;
QExternal::QExternal(ControlExternal & c, Dialogs &)
: base_class(c, _("External"))
QExternal::QExternal()
: base_class(_("External"))
{
}

View File

@ -21,7 +21,7 @@ class QExternal :
friend class QExternalDialog;
public:
QExternal(ControlExternal &, Dialogs &);
QExternal();
protected:
virtual bool isValid();

View File

@ -27,8 +27,8 @@
typedef Qt2CB<ControlFloat, Qt2DB<QFloatDialog> > base_class;
QFloat::QFloat(ControlFloat & c, Dialogs &)
: base_class(c, _("LaTeX Information"))
QFloat::QFloat()
: base_class(_("LaTeX Information"))
{
}

View File

@ -27,7 +27,7 @@ public:
///
friend class QFloatDialog;
///
QFloat(ControlFloat &, Dialogs &);
QFloat();
private:
/// Apply changes
virtual void apply();

View File

@ -41,8 +41,8 @@
typedef Qt2CB<ControlGraphics, Qt2DB<QGraphicsDialog> > base_class;
QGraphics::QGraphics(ControlGraphics & c, Dialogs &)
: base_class(c, _("Graphics"))
QGraphics::QGraphics()
: base_class(_("Graphics"))
{
}

View File

@ -28,7 +28,7 @@ public:
///
friend class QGraphicsDialog;
///
QGraphics(ControlGraphics &, Dialogs &);
QGraphics();
protected:
virtual bool isValid();

View File

@ -27,8 +27,8 @@
typedef Qt2CB<ControlInclude, Qt2DB<QIncludeDialog> > base_class;
QInclude::QInclude(ControlInclude & c, Dialogs &)
: base_class(c, _("Include"))
QInclude::QInclude()
: base_class(_("Include"))
{
}

View File

@ -27,7 +27,7 @@ public:
///
friend class QIncludeDialog;
///
QInclude(ControlInclude &, Dialogs &);
QInclude();
protected:
virtual bool isValid();

View File

@ -19,8 +19,8 @@
typedef Qt2CB<ControlIndex, Qt2DB<QIndexDialog> > base_class;
QIndex::QIndex(ControlIndex & c, Dialogs &)
: base_class(c, _("Index"))
QIndex::QIndex()
: base_class(_("Index"))
{
}

View File

@ -15,7 +15,7 @@
class ControlIndex;
class QIndexDialog;
class Dialogs;
class QIndex :
public Qt2CB<ControlIndex, Qt2DB<QIndexDialog> >
@ -23,7 +23,7 @@ class QIndex :
friend class QIndexDialog;
public:
QIndex(ControlIndex &, Dialogs &);
QIndex();
protected:
virtual bool isValid();

View File

@ -29,8 +29,8 @@ using std::getline;
typedef Qt2CB<ControlLog, Qt2DB<QLogDialog> > base_class;
QLog::QLog(ControlLog & c, Dialogs &)
: base_class(c, _("Log"))
QLog::QLog()
: base_class(_("Log"))
{
}

View File

@ -27,7 +27,7 @@ public:
///
friend class QLogDialog;
///
QLog(ControlLog &, Dialogs &);
QLog();
private:
/// Apply changes

View File

@ -29,8 +29,8 @@
typedef Qt2CB<ControlMinipage, Qt2DB<QMinipageDialog> > base_class;
QMinipage::QMinipage(ControlMinipage & c, Dialogs &)
: base_class(c, _("Minipage"))
QMinipage::QMinipage()
: base_class(_("Minipage"))
{
}

View File

@ -27,7 +27,7 @@ public:
///
friend class QMinipageDialog;
///
QMinipage(ControlMinipage &, Dialogs &);
QMinipage();
private:
/// Apply changes

View File

@ -42,8 +42,8 @@ using std::remove_if;
typedef Qt2CB<ControlParagraph, Qt2DB<QParagraphDialog> > base_class;
QParagraph::QParagraph(ControlParagraph & c, Dialogs &)
: base_class(c, _("Paragraph Layout"))
QParagraph::QParagraph()
: base_class(_("Paragraph Layout"))
{}
void QParagraph::build_dialog()

View File

@ -16,7 +16,7 @@
class ControlParagraph;
class QParagraphDialog;
class Dialogs;
class QParagraph :
public Qt2CB<ControlParagraph, Qt2DB<QParagraphDialog> >
@ -24,7 +24,7 @@ class QParagraph :
friend class QParagraphDialog;
public:
QParagraph(ControlParagraph &, Dialogs &);
QParagraph();
private:
/// Apply changes

View File

@ -26,8 +26,8 @@
typedef Qt2CB<ControlPreamble, Qt2DB<QPreambleDialog> > base_class;
QPreamble::QPreamble(ControlPreamble & c, Dialogs &)
: base_class(c, _("LaTeX Preamble"))
QPreamble::QPreamble()
: base_class(_("LaTeX Preamble"))
{
}

View File

@ -27,7 +27,7 @@ public:
///
friend class QPreambleDialog;
///
QPreamble(ControlPreamble &, Dialogs &);
QPreamble();
private:
/// Apply changes

View File

@ -32,8 +32,8 @@
typedef Qt2CB<ControlPrint, Qt2DB<QPrintDialog> > base_class;
QPrint::QPrint(ControlPrint & c, Dialogs &)
: base_class(c, _("Print"))
QPrint::QPrint()
: base_class(_("Print"))
{
}

View File

@ -29,7 +29,7 @@ public:
///
friend class QPrintDialog;
///
QPrint(ControlPrint &, Dialogs &);
QPrint();
private:
/// Apply changes

View File

@ -33,8 +33,8 @@ using std::endl;
typedef Qt2CB<ControlRef, Qt2DB<QRefDialog> > base_class;
QRef::QRef(ControlRef & c, Dialogs &)
: base_class(c, _("Cross Reference")),
QRef::QRef()
: base_class(_("Cross Reference")),
sort_(false), at_ref_(false)
{
}

View File

@ -17,7 +17,7 @@
class ControlRef;
class QRefDialog;
class Dialogs;
class QRef :
public Qt2CB<ControlRef, Qt2DB<QRefDialog> >
@ -25,7 +25,7 @@ class QRef :
friend class QRefDialog;
public:
QRef(ControlRef & c, Dialogs &);
QRef();
private:
/// apply changes

View File

@ -27,8 +27,8 @@
typedef Qt2CB<ControlSearch, Qt2DB<QSearchDialog> > base_class;
QSearch::QSearch(ControlSearch & c, Dialogs &)
: base_class(c, _("Search"))
QSearch::QSearch()
: base_class(_("Search"))
{
}

View File

@ -18,7 +18,7 @@
class ControlSearch;
class QSearchDialog;
class Dialogs;
///
class QSearch
@ -28,7 +28,7 @@ public:
///
friend class QSearchDialog;
///
QSearch(ControlSearch &, Dialogs &);
QSearch();
private:
/// Apply changes

View File

@ -20,8 +20,8 @@
typedef Qt2CB<ControlShowFile, Qt2DB<QShowFileDialog> > base_class;
QShowFile::QShowFile(ControlShowFile & c, Dialogs &)
: base_class(c, _("ShowFile"))
QShowFile::QShowFile()
: base_class(_("ShowFile"))
{
}

View File

@ -14,7 +14,7 @@
class ControlShowFile;
class QShowFileDialog;
class Dialogs;
class QShowFile :
public Qt2CB<ControlShowFile, Qt2DB<QShowFileDialog> >
@ -22,7 +22,7 @@ class QShowFile :
friend class QShowFileDialog;
public:
QShowFile(ControlShowFile &, Dialogs &);
QShowFile();
private:
/// Apply changes

View File

@ -23,8 +23,8 @@
typedef Qt2CB<ControlSpellchecker, Qt2DB<QSpellcheckerDialog> > base_class;
QSpellchecker::QSpellchecker(ControlSpellchecker & c, Dialogs &)
: base_class(c, _("Spellchecker"))
QSpellchecker::QSpellchecker()
: base_class(_("Spellchecker"))
{
}

View File

@ -16,7 +16,7 @@
class ControlSpellchecker;
class QSpellcheckerDialog;
class Dialogs;
class QSpellchecker :
public Qt2CB<ControlSpellchecker, Qt2DB<QSpellcheckerDialog> >
@ -24,7 +24,7 @@ class QSpellchecker :
friend class QSpellcheckerDialog;
public:
QSpellchecker(ControlSpellchecker &, Dialogs &);
QSpellchecker();
/// update from controller
void partialUpdate(int id);

View File

@ -24,8 +24,8 @@
typedef Qt2CB<ControlTabularCreate, Qt2DB<QTabularCreateDialog> > base_class;
QTabularCreate::QTabularCreate(ControlTabularCreate & c, Dialogs &)
: base_class(c, _("Insert table"))
QTabularCreate::QTabularCreate()
: base_class(_("Insert table"))
{
}

View File

@ -18,7 +18,7 @@
class ControlTabularCreate;
class QTabularCreateDialog;
class Dialogs;
///
class QTabularCreate
@ -28,7 +28,7 @@ public:
///
friend class QTabularCreateDialog;
///
QTabularCreate(ControlTabularCreate &, Dialogs &);
QTabularCreate();
private:
/// Apply changes

View File

@ -31,8 +31,8 @@ using std::vector;
typedef Qt2CB<ControlTexinfo, Qt2DB<QTexinfoDialog> > base_class;
QTexinfo::QTexinfo(ControlTexinfo & c, Dialogs &)
: base_class(c, _("LaTeX Information")), warningPosted(false), activeStyle(ControlTexinfo::cls)
QTexinfo::QTexinfo()
: base_class(_("LaTeX Information")), warningPosted(false), activeStyle(ControlTexinfo::cls)
{
}

View File

@ -28,7 +28,7 @@ public:
///
friend class QTexinfoDialog;
///
QTexinfo(ControlTexinfo &, Dialogs &);
QTexinfo();
private:
/// Apply changes
virtual void apply() { };

View File

@ -24,8 +24,8 @@
typedef Qt2CB<ControlThesaurus, Qt2DB<QThesaurusDialog> > base_class;
QThesaurus::QThesaurus(ControlThesaurus & c, Dialogs &)
: base_class(c, _("Thesaurus"))
QThesaurus::QThesaurus()
: base_class(_("Thesaurus"))
{
}

View File

@ -27,7 +27,7 @@ public:
///
friend class QThesaurusDialog;
///
QThesaurus(ControlThesaurus &, Dialogs &);
QThesaurus();
private:
/// Apply changes
virtual void apply() { };

View File

@ -35,8 +35,8 @@ using std::vector;
typedef Qt2CB<ControlToc, Qt2DB<QTocDialog> > base_class;
QToc::QToc(ControlToc & c, Dialogs &)
: base_class(c, _("Table of contents")), depth_(1)
QToc::QToc()
: base_class(_("Table of contents")), depth_(1)
{}

View File

@ -27,7 +27,7 @@ class QToc :
public Qt2CB<ControlToc, Qt2DB<QTocDialog> >
{
public:
QToc(ControlToc &, Dialogs &);
QToc();
friend class QTocDialog;

View File

@ -22,8 +22,8 @@
typedef Qt2CB<ControlUrl, Qt2DB<QURLDialog> > base_class;
QURL::QURL(ControlUrl & c, Dialogs &)
: base_class(c, _("URL"))
QURL::QURL()
: base_class(_("URL"))
{
}

View File

@ -13,14 +13,14 @@
class ControlUrl;
class QURLDialog;
class Dialogs;
class QURL :
public Qt2CB<ControlUrl, Qt2DB<QURLDialog> >
{
friend class QURLDialog;
public:
QURL(ControlUrl & c, Dialogs &);
QURL();
protected:
virtual bool isValid();

View File

@ -26,8 +26,8 @@
typedef Qt2CB<ControlVCLog, Qt2DB<QVCLogDialog> > base_class;
QVCLog::QVCLog(ControlVCLog & c, Dialogs &)
: base_class(c, _("VCLog"))
QVCLog::QVCLog()
: base_class(_("VCLog"))
{
}

View File

@ -27,7 +27,7 @@ public:
///
friend class QVCLogDialog;
///
QVCLog(ControlVCLog &, Dialogs &);
QVCLog();
private:
/// Apply changes

View File

@ -24,13 +24,21 @@
#include "Dialogs.h"
#include "Qt2Base.h"
#include "Qt2BC.h"
#include "ControlButtons.h"
#include "support/LAssert.h"
Qt2Base::Qt2Base(ControlButtons & c, QString const & t)
: ViewBC<Qt2BC>(c), updating_(false), title_(t)
Qt2Base::Qt2Base(QString const & t)
: ViewBase(), updating_(false), title_(t)
{}
Qt2BC & Qt2Base::bc()
{
return static_cast<Qt2BC &>(getController().bc());
// return dynamic_cast<Qt2BC &>(getController().bc());
}
void Qt2Base::show()
{
if (!form()) {
@ -77,29 +85,29 @@ void Qt2Base::changed()
void Qt2Base::slotWMHide()
{
CancelButton();
getController().CancelButton();
}
void Qt2Base::slotApply()
{
ApplyButton();
getController().ApplyButton();
}
void Qt2Base::slotOK()
{
OKButton();
getController().OKButton();
}
void Qt2Base::slotClose()
{
CancelButton();
getController().CancelButton();
}
void Qt2Base::slotRestore()
{
RestoreButton();
getController().RestoreButton();
}

View File

@ -21,7 +21,6 @@
#include "LString.h"
#include "debug.h"
#include "ButtonPolicies.h"
#include "ControlButtons.h"
#include <boost/scoped_ptr.hpp>
@ -34,12 +33,12 @@ class Qt2BC;
/** This class is an Qt2 GUI base class.
*/
class Qt2Base : public QObject, public ViewBC<Qt2BC>
class Qt2Base : public QObject, public ViewBase
{
Q_OBJECT
public:
///
Qt2Base(ControlButtons &, QString const &);
Qt2Base(QString const &);
///
virtual ~Qt2Base() {}
@ -59,6 +58,9 @@ protected:
/// is the dialog currently valid ?
virtual bool isValid();
///
Qt2BC & bc();
/// are we updating ?
bool updating_;
@ -92,7 +94,7 @@ template <class Dialog>
class Qt2DB: public Qt2Base
{
protected:
Qt2DB(ControlButtons &, QString const &);
Qt2DB(QString const &);
/// update the dialog
virtual void update();
@ -110,8 +112,8 @@ protected:
template <class Dialog>
Qt2DB<Dialog>::Qt2DB(ControlButtons & c, QString const & t)
: Qt2Base(c, t)
Qt2DB<Dialog>::Qt2DB(QString const & t)
: Qt2Base(t)
{}
@ -163,23 +165,31 @@ public:
protected:
///
Qt2CB(ControlButtons &, QString const &);
Qt2CB(QString const &);
/// The parent controller
Controller & controller() const;
Controller & controller();
/// The parent controller
Controller const & controller() const;
};
template <class Controller, class Base>
Qt2CB<Controller, Base>::Qt2CB(ControlButtons & c, QString const & t)
: Base(c, t)
Qt2CB<Controller, Base>::Qt2CB(QString const & t)
: Base(t)
{}
template <class Controller, class Base>
Controller & Qt2CB<Controller, Base>::controller() const
Controller & Qt2CB<Controller, Base>::controller()
{
return static_cast<Controller &>(controller_);
//return dynamic_cast<Controller &>(controller_);
return static_cast<Controller &>(getController());
}
template <class Controller, class Base>
Controller const & Qt2CB<Controller, Base>::controller() const
{
return static_cast<Controller const &>(getController());
}

View File

@ -65,7 +65,7 @@ QtView::QtView(unsigned int width, unsigned int height)
connect(menuBar(), SIGNAL(activated(int)),
this, SLOT(activated(int)));
toolbar_.reset(new Toolbar(this, *getDialogs(), 0, 0, toolbardefaults));
toolbar_.reset(new Toolbar(this, 0, 0, toolbardefaults));
statusBar()->setSizeGripEnabled(false);

View File

@ -93,7 +93,7 @@ public:
};
Toolbar::Pimpl::Pimpl(LyXView * o, Dialogs &, int, int)
Toolbar::Pimpl::Pimpl(LyXView * o, int, int)
: owner_(static_cast<QtView *>(o)),
combo_(0)
{

View File

@ -36,7 +36,7 @@ struct Toolbar::Pimpl {
friend class ToolbarProxy;
public:
Pimpl(LyXView * o, Dialogs &, int x, int y);
Pimpl(LyXView * o, int x, int y);
~Pimpl();

View File

@ -180,7 +180,7 @@ extern "C" {
{
static GUI<ControlAboutlyx, QAbout,
OkCancelPolicy, Qt2BC> cal(lv, d);
cal.show();
cal.controller().show();
}
@ -188,7 +188,7 @@ extern "C" {
{
static GUI<ControlBibitem, QBibitem,
OkCancelReadOnlyPolicy, Qt2BC> cbi(lv, d);
cbi.showInset(ic);
cbi.controller().showInset(ic);
}
@ -196,31 +196,31 @@ extern "C" {
{
static GUI<ControlBibtex, QBibtex,
OkCancelReadOnlyPolicy, Qt2BC> cbt(lv, d);
cbt.showInset(ic);
cbt.controller().showInset(ic);
}
void gui_ShowCharacter(LyXView & lv, Dialogs & d)
{
controlCharacterSingleton.get(lv, d).show();
controlCharacterSingleton.get(lv, d).controller().show();
}
void gui_SetUserFreeFont(LyXView & lv, Dialogs & d)
{
controlCharacterSingleton.get(lv, d).apply();
controlCharacterSingleton.get(lv, d).controller().apply();
}
void gui_ShowCitation(InsetCommand * ic, LyXView & lv, Dialogs & d)
{
controlCitationSingleton.get(lv, d).showInset(ic);
controlCitationSingleton.get(lv, d).controller().showInset(ic);
}
void gui_CreateCitation(string const & s, LyXView & lv, Dialogs & d)
{
controlCitationSingleton.get(lv, d).createInset(s);
controlCitationSingleton.get(lv, d).controller().createInset(s);
}
@ -235,19 +235,19 @@ extern "C" {
{
static GUI<ControlError, QError,
OkCancelPolicy, Qt2BC> ce(lv, d);
ce.showInset(ie);
ce.controller().showInset(ie);
}
void gui_ShowERT(InsetERT * ie, LyXView & lv, Dialogs & d)
{
controlERTSingleton.get(lv, d).showInset(ie);
controlERTSingleton.get(lv, d).controller().showInset(ie);
}
void gui_UpdateERT(InsetERT * ie, LyXView & lv, Dialogs & d)
{
controlERTSingleton.get(lv, d).showInset(ie);
controlERTSingleton.get(lv, d).controller().showInset(ie);
}
@ -255,7 +255,7 @@ extern "C" {
{
static GUI<ControlExternal, QExternal,
OkApplyCancelReadOnlyPolicy, Qt2BC> ce(lv, d);
ce.showInset(ie);
ce.controller().showInset(ie);
}
@ -263,7 +263,7 @@ extern "C" {
{
static GUI<ControlShowFile, QShowFile,
OkCancelPolicy, Qt2BC> csf(lv, d);
csf.showFile(f);
csf.controller().showFile(f);
}
@ -271,7 +271,7 @@ extern "C" {
{
static GUI<ControlFloat, QFloat,
NoRepeatedApplyReadOnlyPolicy, Qt2BC> cf(lv, d);
cf.showInset(ifl);
cf.controller().showInset(ifl);
}
@ -280,7 +280,7 @@ extern "C" {
#if 0
static GUI<ControlForks, QForks,
OkApplyCancelPolicy, Qt2BC> cf(lv, d);
cf.show();
cf.controller().show();
#endif
}
@ -289,7 +289,7 @@ extern "C" {
{
static GUI<ControlGraphics, QGraphics,
NoRepeatedApplyReadOnlyPolicy, Qt2BC> cg(lv, d);
cg.showInset(ig);
cg.controller().showInset(ig);
}
@ -297,19 +297,19 @@ extern "C" {
{
static GUI<ControlInclude, QInclude,
OkCancelReadOnlyPolicy, Qt2BC> ci(lv, d);
ci.showInset(ii);
ci.controller().showInset(ii);
}
void gui_ShowIndex(InsetCommand * ic, LyXView & lv, Dialogs & d)
{
controlIndexSingleton.get(lv, d).showInset(ic);
controlIndexSingleton.get(lv, d).controller().showInset(ic);
}
void gui_CreateIndex(LyXView & lv, Dialogs & d)
{
controlIndexSingleton.get(lv, d).createInset("");
controlIndexSingleton.get(lv, d).controller().createInset("");
}
@ -324,7 +324,7 @@ extern "C" {
{
static GUI<ControlLog, QLog,
OkCancelPolicy, Qt2BC> cl(lv, d);
cl.show();
cl.controller().show();
}
@ -337,23 +337,23 @@ extern "C" {
void gui_ShowMinipage(InsetMinipage * im, LyXView & lv, Dialogs & d)
{
controlMinipageSingleton.get(lv, d).showInset(im);
controlMinipageSingleton.get(lv, d).controller().showInset(im);
}
void gui_UpdateMinipage(InsetMinipage * im, LyXView & lv, Dialogs & d)
{
controlMinipageSingleton.get(lv, d).showInset(im);
controlMinipageSingleton.get(lv, d).controller().showInset(im);
}
void gui_ShowParagraph(LyXView & lv, Dialogs & d)
{
controlParagraphSingleton.get(lv, d).show();
controlParagraphSingleton.get(lv, d).controller().show();
#if 0
static GUI<ControlParagraph, QParagraph,
OkApplyCancelReadOnlyPolicy, Qt2BC> cp(lv, d);
cp.show();
cp.controller().show();
#endif
}
@ -376,7 +376,7 @@ extern "C" {
{
static GUI<ControlPreamble, QPreamble,
NoRepeatedApplyReadOnlyPolicy, Qt2BC> cp(lv, d);
cp.show();
cp.controller().show();
}
@ -390,19 +390,19 @@ extern "C" {
{
static GUI<ControlPrint, QPrint,
OkApplyCancelPolicy, Qt2BC> cp(lv, d);
cp.show();
cp.controller().show();
}
void gui_ShowRef(InsetCommand * ic, LyXView & lv, Dialogs & d)
{
controlRefSingleton.get(lv, d).showInset(ic);
controlRefSingleton.get(lv, d).controller().showInset(ic);
}
void gui_CreateRef(string const & s, LyXView & lv, Dialogs & d)
{
controlRefSingleton.get(lv, d).createInset(s);
controlRefSingleton.get(lv, d).controller().createInset(s);
}
@ -410,7 +410,7 @@ extern "C" {
{
static GUI<ControlSearch, QSearch,
NoRepeatedApplyReadOnlyPolicy, Qt2BC> cs(lv, d);
cs.show();
cs.controller().show();
}
@ -428,7 +428,7 @@ extern "C" {
{
static GUI<ControlSpellchecker, QSpellchecker,
NoRepeatedApplyReadOnlyPolicy, Qt2BC> cp(lv, d);
cp.show();
cp.controller().show();
}
@ -448,7 +448,7 @@ extern "C" {
{
static GUI<ControlTabularCreate, QTabularCreate,
OkApplyCancelReadOnlyPolicy, Qt2BC> ctc(lv, d);
ctc.show();
ctc.controller().show();
}
@ -456,7 +456,7 @@ extern "C" {
{
static GUI<ControlTexinfo, QTexinfo,
OkCancelPolicy, Qt2BC> ct(lv, d);
ct.show();
ct.controller().show();
}
@ -465,32 +465,32 @@ extern "C" {
#ifdef HAVE_LIBAIKSAURUS
static GUI<ControlThesaurus, QThesaurus,
OkApplyCancelReadOnlyPolicy, Qt2BC> ct(lv, d);
ct.showEntry(s);
ct.controller().showEntry(s);
#endif
}
void gui_ShowTOC(InsetCommand * ic, LyXView & lv, Dialogs & d)
{
controlTocSingleton.get(lv, d).showInset(ic);
controlTocSingleton.get(lv, d).controller().showInset(ic);
}
void gui_CreateTOC(string const & s, LyXView & lv, Dialogs & d)
{
controlTocSingleton.get(lv, d).createInset(s);
controlTocSingleton.get(lv, d).controller().createInset(s);
}
void gui_ShowUrl(InsetCommand * ic, LyXView & lv, Dialogs & d)
{
controlUrlSingleton.get(lv, d).showInset(ic);
controlUrlSingleton.get(lv, d).controller().showInset(ic);
}
void gui_CreateUrl(string const & s, LyXView & lv, Dialogs & d)
{
controlUrlSingleton.get(lv, d).createInset(s);
controlUrlSingleton.get(lv, d).controller().createInset(s);
}
@ -498,7 +498,7 @@ extern "C" {
{
static GUI<ControlVCLog, QVCLog,
OkCancelPolicy, Qt2BC> cv(lv, d);
cv.show();
cv.controller().show();
}
} // extern "C"

View File

@ -1,3 +1,62 @@
2002-08-12 Angus Leeming <leeming@lyx.org>
* Dialogs.C (c-tor): connect the Tooltips::toggleEnabled method to
the Dialogs::toggleTooltips signal.
* FormAboutlyx.[Ch]:
* FormBibitem.[Ch]:
* FormBibtex.[Ch]:
* FormBrowser.[Ch]:
* FormCharacter.[Ch]:
* FormCitation.[Ch]:
* FormERT.[Ch]:
* FormError.[Ch]:
* FormExternal.[Ch]:
* FormFloat.[Ch]:
* FormForks.[Ch]:
* FormGraphics.[Ch]:
* FormInclude.[Ch]:
* FormIndex.[Ch]:
* FormLog.[Ch]:
* FormMinipage.[Ch]:
* FormParagraph.[Ch]:
* FormPreamble.[Ch]:
* FormPrint.[Ch]:
* FormRef.[Ch]:
* FormSearch.[Ch]:
* FormSendto.[Ch]:
* FormShowFile.[Ch]:
* FormSpellchecker.[Ch]:
* FormTabularCreate.[Ch]:
* FormTexinfo.[Ch]:
* FormThesaurus.[Ch]:
* FormToc.[Ch]:
* FormURL.[Ch]:
* FormVCLog.[Ch]:
No longer pass Controller or Dialogs to the c-tor.
No longer forward-declare Dialogs.
* FormBase.[Ch]: derives from ViewBase directly.
No longer passed ControlButtons & or Dialogs &.
(bc): new method, enabling the daughter classes to access the
ButtonController.
(C_FormBaseApplyCB):
(C_FormBaseOKCB):
(C_FormBaseCancelCB):
(C_FormBaseRestoreCB):
(C_WMHideCB): changes due to a change in the ViewBase class.
* Toolbar_pimpl.[Ch] (c-tor):
* Tooltips.[Ch] (c-tor): no longer passed a Dialogs &.
* Tooltips.h (toggleEnabled): made public for the Dialogs c-tor.
* XFormsView.[Ch] (c-tor, create_form_form_main): no longer pass
Dialogs & to the Toolbar.
* guiapi.C: access the controller methods by explicit invocation of the
controller.
2002-08-12 Lars Gullik Bjønnes <larsbj@gullik.net>
* FormDocument.C (saveParamsAsDefault): ParagraphList changes

View File

@ -16,6 +16,8 @@
#include "Dialogs.h"
#include "Tooltips.h"
#include <boost/bind.hpp>
LyXView * dialogs_lyxview;
@ -31,6 +33,7 @@ Dialogs::Dialogs(LyXView * lv)
#if 1
dialogs_lyxview = lv;
#endif
toggleTooltips.connect(boost::bind(&Tooltips::toggleEnabled));
// reduce the number of connections needed in
// dialogs by a simple connection here.
hideAll.connect(hideBufferDependent);

View File

@ -25,8 +25,8 @@ using std::getline;
typedef FormCB<ControlAboutlyx, FormDB<FD_aboutlyx> > base_class;
FormAboutlyx::FormAboutlyx(ControlAboutlyx & c, Dialogs & d)
: base_class(c, d, _("About LyX"), false)
FormAboutlyx::FormAboutlyx()
: base_class(_("About LyX"), false)
{}

View File

@ -30,7 +30,7 @@ struct FD_aboutlyx_license;
class FormAboutlyx : public FormCB<ControlAboutlyx, FormDB<FD_aboutlyx> > {
public:
///
FormAboutlyx(ControlAboutlyx &, Dialogs &);
FormAboutlyx();
private:
/// not needed.

View File

@ -12,8 +12,9 @@
#pragma implementation
#endif
#include "Dialogs.h"
#include "FormBase.h"
#include "ControlButtons.h"
#include "xformsBC.h"
#include "xforms_resize.h"
#include "Tooltips.h"
@ -32,10 +33,9 @@ static int C_PrehandlerCB(FL_OBJECT *, int, FL_Coord, FL_Coord, int, void *);
} // extern "C"
FormBase::FormBase(ControlButtons & c, Dialogs & d,
string const & t, bool allowResize)
: ViewBC<xformsBC>(c), minw_(0), minh_(0), allow_resize_(allowResize),
title_(t), tooltips_(new Tooltips(d))
FormBase::FormBase(string const & t, bool allowResize)
: ViewBase(), minw_(0), minh_(0), allow_resize_(allowResize),
title_(t), tooltips_(new Tooltips())
{}
@ -58,6 +58,13 @@ void FormBase::redraw()
}
xformsBC & FormBase::bc()
{
return static_cast<xformsBC &>(getController().bc());
// return dynamic_cast<GUIbc &>(controller_ptr_->bc());
}
void FormBase::show()
{
if (!form()) {
@ -102,9 +109,12 @@ void FormBase::show()
if (!allow_resize_)
fl_set_form_maxsize(form(), minw_, minh_);
int const iconify = getController().IconifyWithMain() ?
FL_TRANSIENT : 0;
fl_show_form(form(),
FL_PLACE_MOUSE | FL_FREE_SIZE,
(controller_.IconifyWithMain() ? FL_TRANSIENT : 0),
iconify,
title_.c_str());
}
@ -166,26 +176,26 @@ extern "C" {
void C_FormBaseApplyCB(FL_OBJECT * ob, long)
{
GetForm(ob)->ApplyButton();
GetForm(ob)->getController().ApplyButton();
}
void C_FormBaseOKCB(FL_OBJECT * ob, long)
{
GetForm(ob)->OKButton();
GetForm(ob)->getController().OKButton();
}
void C_FormBaseCancelCB(FL_OBJECT * ob, long)
{
FormBase * form = GetForm(ob);
form->CancelButton();
form->getController().CancelButton();
}
void C_FormBaseRestoreCB(FL_OBJECT * ob, long)
{
GetForm(ob)->RestoreButton();
GetForm(ob)->getController().RestoreButton();
}
@ -200,7 +210,7 @@ static int C_WMHideCB(FL_FORM * form, void *)
// Close the dialog cleanly, even if the WM is used to do so.
lyx::Assert(form && form->u_vdata);
FormBase * ptr = static_cast<FormBase *>(form->u_vdata);
ptr->CancelButton();
ptr->getController().CancelButton();
return FL_CANCEL;
}

View File

@ -28,16 +28,15 @@
class xformsBC;
class Tooltips;
class Dialogs;
/** This class is an XForms GUI base class.
*/
class FormBase : public ViewBC<xformsBC>, public FeedbackController
class FormBase : public ViewBase, public FeedbackController
{
public:
///
FormBase(ControlButtons &, Dialogs &,
string const &, bool allowResize);
FormBase(string const &, bool allowResize);
///
virtual ~FormBase();
@ -64,6 +63,9 @@ protected:
*/
static void setPrehandler(FL_OBJECT * ob);
///
xformsBC & bc();
private:
/// Pointer to the actual instantiation of xform's form
virtual FL_FORM * form() const = 0;
@ -93,8 +95,7 @@ class FormDB: public FormBase
{
protected:
///
FormDB(ControlButtons &, Dialogs &,
string const &, bool allowResize=true);
FormDB(string const &, bool allowResize=true);
/// Pointer to the actual instantiation of xform's form
virtual FL_FORM * form() const;
/// Real GUI implementation.
@ -103,9 +104,8 @@ protected:
template <class Dialog>
FormDB<Dialog>::FormDB(ControlButtons & c, Dialogs & d,
string const & t, bool allowResize)
: FormBase(c, d, t, allowResize)
FormDB<Dialog>::FormDB(string const & t, bool allowResize)
: FormBase(t, allowResize)
{}
@ -122,25 +122,31 @@ class FormCB: public Base
{
protected:
///
FormCB(Controller &, Dialogs &,
string const &, bool allowResize = true);
FormCB(string const &, bool allowResize = true);
/// The parent controller
Controller & controller() const;
Controller & controller();
///
Controller const & controller() const;
};
template <class Controller, class Base>
FormCB<Controller, Base>::FormCB(Controller & c, Dialogs & d,
string const & t, bool allowResize)
: Base(c, d, t, allowResize)
FormCB<Controller, Base>::FormCB(string const & t, bool allowResize)
: Base(t, allowResize)
{}
template <class Controller, class Base>
Controller & FormCB<Controller, Base>::controller() const
Controller & FormCB<Controller, Base>::controller()
{
return static_cast<Controller &>(controller_);
//return dynamic_cast<Controller &>(controller_);
return static_cast<Controller &>(getController());
}
template <class Controller, class Base>
Controller const & FormCB<Controller, Base>::controller() const
{
return static_cast<Controller const &>(getController());
}

View File

@ -43,7 +43,7 @@ FormBaseDeprecated::FormBaseDeprecated(LyXView * lv, Dialogs * d,
string const & t, bool allowResize)
: lv_(lv), d_(d), title_(t),
minw_(0), minh_(0), allow_resize_(allowResize),
tooltips_(new Tooltips(*d))
tooltips_(new Tooltips())
{
lyx::Assert(lv && d);
}

View File

@ -27,7 +27,7 @@
#include "forms_fwd.h"
//#include <boost/signals/trackable.hpp>
#include <boost/signals/connection.hpp>
class Buffer;
class Dialogs;

View File

@ -22,8 +22,8 @@
typedef FormCB<ControlBibitem, FormDB<FD_bibitem> > base_class;
FormBibitem::FormBibitem(ControlBibitem & c, Dialogs & d)
: base_class(c, d, _("Bibliography Entry"))
FormBibitem::FormBibitem()
: base_class(_("Bibliography Entry"))
{}

View File

@ -26,7 +26,7 @@ struct FD_bibitem;
class FormBibitem : public FormCB<ControlBibitem, FormDB<FD_bibitem> > {
public:
///
FormBibitem(ControlBibitem &, Dialogs &);
FormBibitem();
private:
/// Set the Params variable for the Controller.
virtual void apply();

View File

@ -36,8 +36,8 @@ using std::sort;
typedef FormCB<ControlBibtex, FormDB<FD_bibtex> > base_class;
FormBibtex::FormBibtex(ControlBibtex & c, Dialogs & d)
: base_class(c, d, _("BibTeX Database"))
FormBibtex::FormBibtex()
: base_class(_("BibTeX Database"))
{}

View File

@ -26,7 +26,7 @@ struct FD_bibtex;
class FormBibtex : public FormCB<ControlBibtex, FormDB<FD_bibtex> > {
public:
///
FormBibtex(ControlBibtex &, Dialogs &);
FormBibtex();
private:
/// Set the Params variable for the Controller.
virtual void apply();

View File

@ -16,9 +16,8 @@
#include "forms/form_browser.h"
#include "xformsBC.h"
FormBrowser::FormBrowser(ControlButtons & c, Dialogs & d,
string const & t, bool allowResize)
: FormDB<FD_browser>(c, d, t, allowResize)
FormBrowser::FormBrowser(string const & t, bool allowResize)
: FormDB<FD_browser>(t, allowResize)
{}

View File

@ -26,8 +26,7 @@ struct FD_browser;
class FormBrowser : public FormDB<FD_browser> {
public:
///
FormBrowser(ControlButtons &, Dialogs &,
string const &, bool allowResize = true);
FormBrowser(string const &, bool allowResize = true);
private:
/// Build the dialog.
virtual void build();

View File

@ -36,8 +36,8 @@ using namespace frnt;
typedef FormCB<ControlCharacter, FormDB<FD_character> > base_class;
FormCharacter::FormCharacter(ControlCharacter & c, Dialogs & d)
: base_class(c, d, _("Character Layout"), false)
FormCharacter::FormCharacter()
: base_class(_("Character Layout"), false)
{}

View File

@ -35,7 +35,7 @@ class FormCharacter
: public FormCB<ControlCharacter, FormDB<FD_character> > {
public:
///
FormCharacter(ControlCharacter &, Dialogs &);
FormCharacter();
private:
/// Apply from dialog

View File

@ -115,8 +115,8 @@ void updateStyle(FD_citation * dialog, string command)
typedef FormCB<ControlCitation, FormDB<FD_citation> > base_class;
FormCitation::FormCitation(ControlCitation & c, Dialogs & d)
: base_class(c, d, _("Citation"), false)
FormCitation::FormCitation()
: base_class(_("Citation"), false)
{}

View File

@ -25,7 +25,7 @@ struct FD_citation;
class FormCitation : public FormCB<ControlCitation, FormDB<FD_citation> > {
public:
///
FormCitation(ControlCitation &, Dialogs &);
FormCitation();
private:
///
enum State {

View File

@ -23,8 +23,8 @@
typedef FormCB<ControlERT, FormDB<FD_ert> > base_class;
FormERT::FormERT(ControlERT & c, Dialogs & d)
: base_class(c, d, _("ERT Options"))
FormERT::FormERT()
: base_class(_("ERT Options"))
{}

View File

@ -26,7 +26,7 @@ class FormERT
: public FormCB<ControlERT, FormDB<FD_ert> > {
public:
///
FormERT(ControlERT &, Dialogs &);
FormERT();
private:
/// Set the Params variable for the Controller.
virtual void apply();

View File

@ -21,8 +21,8 @@
typedef FormCB<ControlError, FormDB<FD_error> > base_class;
FormError::FormError(ControlError & c, Dialogs & d)
: base_class(c, d, _("LaTeX Error"))
FormError::FormError()
: base_class(_("LaTeX Error"))
{}

View File

@ -24,7 +24,7 @@ struct FD_error;
class FormError : public FormCB<ControlError, FormDB<FD_error> > {
public:
/// Constructor
FormError(ControlError &, Dialogs &);
FormError();
private:
/// not needed.
virtual void apply() {}

View File

@ -27,8 +27,8 @@
typedef FormCB<ControlExternal, FormDB<FD_external> > base_class;
FormExternal::FormExternal(ControlExternal & c, Dialogs & d)
: base_class(c, d, _("Edit external file"))
FormExternal::FormExternal()
: base_class(_("Edit external file"))
{}

View File

@ -26,7 +26,7 @@ struct FD_external;
class FormExternal : public FormCB<ControlExternal, FormDB<FD_external> > {
public:
///
FormExternal(ControlExternal &, Dialogs &);
FormExternal();
private:
/// apply changes
void apply();

View File

@ -23,8 +23,8 @@
typedef FormCB<ControlFloat, FormDB<FD_float> > base_class;
FormFloat::FormFloat(ControlFloat & c, Dialogs & d)
: base_class(c, d, _("Float Options"))
FormFloat::FormFloat()
: base_class(_("Float Options"))
{}

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