Port the About LyX dialog to the Dialog scheme.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6403 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2003-03-09 20:29:58 +00:00
parent b81c83f69b
commit 5ec0a44b09
26 changed files with 106 additions and 81 deletions

View File

@ -1,3 +1,8 @@
2003-03-09 Angus Leeming <leeming@lyx.org>
* lyxfunc.C (dispatch): call Dialogs::show("about") rather
than Dialogs::showAboutlyx().
2003-03-09 Angus Leeming <leeming@lyx.org>
* factory.C (createInset): call Dialogs::show("tabularcreate") rather

View File

@ -125,7 +125,7 @@ Inset * createInset(FuncRequest const & cmd)
::sscanf(cmd.argument.c_str(),"%d%d", &r, &c);
return new InsetTabular(*bv->buffer(), r, c);
}
bv->owner()->getDialogs().show("tabularcreate", string(), 0);
bv->owner()->getDialogs().show("tabularcreate");
return 0;
case LFUN_INSET_CAPTION:

View File

@ -1,7 +1,14 @@
2003-03-09 Angus Leeming <leeming@lyx.org>
* Dialogs.h: remove showAboutlyx.
* guiapi.[Ch]: remove gui_showAboutlyx.
* Dialogs.[Ch] (show): new method for non-inset dialogs.
2003-03-09 Angus Leeming <leeming@lyx.org>
* Dialogs.h: remove showTabularCreate.
* guiapi.[Ch]: remove gui_updateTabularCreate.
* guiapi.[Ch]: remove gui_showTabularCreate.
2003-03-09 Angus Leeming <leeming@lyx.org>

View File

@ -75,6 +75,16 @@ Dialog * Dialogs::find(string const & name)
}
void Dialogs::show(string const & name)
{
Dialog * dialog = find(name);
if (!dialog)
return;
dialog->show();
}
void Dialogs::show(string const & name, string const & data, InsetBase * inset)
{
Dialog * dialog = find(name);

View File

@ -72,8 +72,6 @@ public:
Put into some sort of alphabetical order */
//@{
///
void showAboutlyx();
///
void showCharacter();
/// connected to the character dialog also
void setUserFreeFont();
@ -113,6 +111,8 @@ public:
void showVCLogFile();
//@}
///name == "about" etc
void show(string const & name);
/** name == "bibtex", "citation" etc
data is generated by the Inset::write method, to be read by the
Inset::read method in the frontends.

View File

@ -1,3 +1,7 @@
2003-03-09 Angus Leeming <leeming@lyx.org>
* ControlAboutlyx.[Ch]: rewrite to use the Dialog-based scheme.
2003-03-09 Angus Leeming <leeming@lyx.org>
* ControlTabularCreate.[Ch]: rewrite to use the Dialog-based scheme.

View File

@ -29,8 +29,8 @@ extern string system_lyxdir;
extern string user_lyxdir;
ControlAboutlyx::ControlAboutlyx(LyXView & lv, Dialogs & d)
: ControlDialogBI(lv, d)
ControlAboutlyx::ControlAboutlyx(Dialog & parent)
: Dialog::Controller(parent)
{}

View File

@ -13,36 +13,34 @@
#ifndef CONTROLABOUTLYX_H
#define CONTROLABOUTLYX_H
#include "ControlDialog_impl.h"
#include "LString.h"
#include "Dialog.h"
#include <iosfwd>
/** A controller for the About LyX dialogs.
*/
class ControlAboutlyx : public ControlDialogBI {
class ControlAboutlyx : public Dialog::Controller {
public:
///
ControlAboutlyx(LyXView &, Dialogs &);
ControlAboutlyx(Dialog &);
///
virtual void initialiseParams(string const &) {}
///
virtual void clearParams() {}
///
virtual void dispatchParams() {}
///
virtual bool isBufferDependent() const { return false; }
///
void getCredits(std::ostream &) const;
///
string const getCopyright() const;
///
string const getLicense() const;
///
string const getDisclaimer() const;
///
string const getVersion() const;
private:
/// not needed.
virtual void apply() {}
};
#endif // CONTROLABOUTLYX_H

View File

@ -21,12 +21,6 @@ void gui_show_dialog(Dialogs * d, char const * name, char const * data)
d->show(name, data, 0);
}
void gui_ShowAboutlyx(Dialogs & d)
{
d.showAboutlyx();
}
void gui_ShowCharacter(Dialogs & d)
{
d.showCharacter();

View File

@ -21,7 +21,6 @@ extern "C" {
void gui_show_dialog(Dialogs *, char const * name, char const * data);
void gui_ShowAboutlyx(Dialogs &);
void gui_ShowCharacter(Dialogs &);
void gui_SetUserFreeFont(Dialogs &);
void gui_ShowDocument(Dialogs &);

View File

@ -1,3 +1,13 @@
2003-03-09 Angus Leeming <leeming@lyx.org>
* Dialogs.C:
* Dialogs2.C:
* Dialogs_impl.h: remove aboutlyx dialog.
* Dialogs3.C: add aboutlyx dialog.
* QAbout.[Ch]: changes to use the new Dialog-based scheme.
2003-03-09 Angus Leeming <leeming@lyx.org>
* Dialogs.C:

View File

@ -26,8 +26,7 @@ Dialogs::~Dialogs()
Dialogs::Impl::Impl(LyXView & lv, Dialogs & d)
: aboutlyx(lv, d),
changes(lv, d),
: changes(lv, d),
character(lv, d),
document(lv, d),
file(lv, d),

View File

@ -15,12 +15,6 @@
#include "Dialogs_impl.h"
void Dialogs::showAboutlyx()
{
pimpl_->aboutlyx.controller().show();
}
void Dialogs::showMergeChanges()
{
pimpl_->changes.controller().show();

View File

@ -13,6 +13,7 @@
#include "Dialogs.h"
#include "Dialog.h"
#include "ControlAboutlyx.h"
#include "ControlBibtex.h"
#include "ControlCitation.h"
#include "ControlError.h"
@ -28,6 +29,8 @@
#include "ControlToc.h"
#include "ControlWrap.h"
#include "QAbout.h"
#include "QAboutDialog.h"
#include "QBibitem.h"
#include "QBibitemDialog.h"
#include "QBibtex.h"
@ -86,7 +89,7 @@ typedef ButtonController<NoRepeatedApplyReadOnlyPolicy, Qt2BC>
namespace {
char const * const dialognames[] = { "bibitem", "bibtex", "citation",
char const * const dialognames[] = { "about", "bibitem", "bibtex", "citation",
"error", "ert", "external", "float",
"graphics", "include", "index", "label",
"minipage", "ref", "tabular",
@ -122,7 +125,11 @@ Dialog * Dialogs::build(string const & name)
Dialog * dialog = new Dialog(lyxview_, name);
if (name == "bibitem") {
if (name == "about") {
dialog->setController(new ControlAboutlyx(*dialog));
dialog->setView(new QAbout(*dialog));
dialog->setButtonController(new OkCancelBC);
} else if (name == "bibitem") {
dialog->setController(new ControlCommand(*dialog, name));
dialog->setView(new QBibitem(*dialog));
dialog->setButtonController(new OkCancelReadOnlyBC);

View File

@ -14,7 +14,6 @@
#include "Dialogs.h"
#include "controllers/GUI.h"
#include "ControlAboutlyx.h"
#include "ControlChanges.h"
#include "ControlCharacter.h"
#include "ControlDocument.h"
@ -30,8 +29,6 @@
#include "ControlTexinfo.h"
#include "ControlVCLog.h"
#include "QAbout.h"
#include "QAboutDialog.h"
#include "QChanges.h"
#include "QChangesDialog.h"
#include "QCharacter.h"
@ -75,9 +72,6 @@
typedef GUI<ControlAboutlyx, QAbout, OkCancelPolicy, Qt2BC>
AboutlyxDialog;
typedef GUI<ControlChanges, QChanges, NoRepeatedApplyReadOnlyPolicy, Qt2BC>
ChangesDialog;
@ -126,7 +120,6 @@ VCLogFileDialog;
struct Dialogs::Impl {
Impl(LyXView & lv, Dialogs & d);
AboutlyxDialog aboutlyx;
ChangesDialog changes;
CharacterDialog character;
DocumentDialog document;

View File

@ -29,11 +29,11 @@
using std::getline;
typedef Qt2CB<ControlAboutlyx, Qt2DB<QAboutDialog> > base_class;
typedef QController<ControlAboutlyx, QView<QAboutDialog> > base_class;
QAbout::QAbout()
: base_class(qt_("About LyX"))
QAbout::QAbout(Dialog & parent)
: base_class(parent, qt_("About LyX"))
{
}

View File

@ -13,16 +13,17 @@
#define FORMABOUT_H
#include "Qt2Base.h"
#include "QDialogView.h"
class QAboutDialog;
class ControlAboutlyx;
class QAbout
: public Qt2CB<ControlAboutlyx, Qt2DB<QAboutDialog> >
: public QController<ControlAboutlyx, QView<QAboutDialog> >
{
public:
QAbout();
QAbout(Dialog &);
private:
/// not needed
virtual void apply() {}

View File

@ -1,3 +1,14 @@
2003-03-09 Angus Leeming <leeming@lyx.org>
* Dialogs.C:
* Dialogs2.C:
* Dialogs_impl.h: remove aboutlyx dialog.
* Dialogs3.C: add aboutlyx dialog.
* FormAboutlyx.[Ch]:
* forms/form_aboutlyx.fd: changes to use the new Dialog-based scheme.
2003-03-09 Angus Leeming <leeming@lyx.org>
* Dialogs.C:

View File

@ -26,8 +26,7 @@ Dialogs::~Dialogs()
Dialogs::Impl::Impl(LyXView & lv, Dialogs & d)
: aboutlyx(lv, d),
changes(lv, d),
: changes(lv, d),
character(lv, d),
document(lv, d),
file(lv, d),

View File

@ -15,12 +15,6 @@
#include "Dialogs_impl.h"
void Dialogs::showAboutlyx()
{
pimpl_->aboutlyx.controller().show();
}
void Dialogs::showMergeChanges()
{
pimpl_->changes.controller().show();

View File

@ -15,6 +15,7 @@
#include "Tooltips.h"
#include "ControlAboutlyx.h"
#include "ControlBibtex.h"
#include "ControlCitation.h"
#include "ControlCommand.h"
@ -31,6 +32,8 @@
#include "ControlToc.h"
#include "ControlWrap.h"
#include "FormAboutlyx.h"
#include "forms/form_aboutlyx.h"
#include "FormBibitem.h"
#include "forms/form_bibitem.h"
#include "FormBibtex.h"
@ -85,7 +88,7 @@ typedef ButtonController<NoRepeatedApplyReadOnlyPolicy, xformsBC>
namespace {
char const * const dialognames[] = { "bibitem", "bibtex", "citation",
char const * const dialognames[] = { "about", "bibitem", "bibtex", "citation",
"error", "ert", "external", "float",
"graphics", "include", "index", "label",
"minipage", "ref", "tabular",
@ -122,7 +125,11 @@ Dialog * Dialogs::build(string const & name)
Dialog * dialog = new Dialog(lyxview_, name);
if (name == "bibitem") {
if (name == "about") {
dialog->setController(new ControlAboutlyx(*dialog));
dialog->setView(new FormAboutlyx(*dialog));
dialog->setButtonController(new OkCancelBC);
} else if (name == "bibitem") {
dialog->setController(new ControlCommand(*dialog, name));
dialog->setView(new FormBibitem(*dialog));
dialog->setButtonController(new OkCancelReadOnlyBC);

View File

@ -18,10 +18,6 @@
#include "xformsBC.h"
#include "combox.h"
#include "ControlAboutlyx.h"
#include "FormAboutlyx.h"
#include "forms/form_aboutlyx.h"
#include "FormBrowser.h"
#include "forms/form_browser.h"
@ -92,9 +88,6 @@
#include "ControlVCLog.h"
#include "FormVCLog.h"
typedef GUI<ControlAboutlyx, FormAboutlyx, OkCancelPolicy, xformsBC>
AboutlyxDialog;
typedef GUI<ControlChanges, FormChanges, NoRepeatedApplyReadOnlyPolicy, xformsBC>
ChangesDialog;
@ -151,7 +144,6 @@ VCLogFileDialog;
struct Dialogs::Impl {
Impl(LyXView & lv, Dialogs & d);
AboutlyxDialog aboutlyx;
ChangesDialog changes;
CharacterDialog character;
DocumentDialog document;

View File

@ -24,10 +24,10 @@
#include FORMS_H_LOCATION
typedef FormCB<ControlAboutlyx, FormDB<FD_aboutlyx> > base_class;
typedef FormController<ControlAboutlyx, FormView<FD_aboutlyx> > base_class;
FormAboutlyx::FormAboutlyx()
: base_class(_("About LyX"), false)
FormAboutlyx::FormAboutlyx(Dialog & parent)
: base_class(parent, _("About LyX"), false)
{}

View File

@ -14,7 +14,7 @@
#define FORMABOUTLYX_H
#include "FormBase.h"
#include "FormDialogView.h"
#include <boost/scoped_ptr.hpp>
@ -26,10 +26,11 @@ struct FD_aboutlyx_license;
/** This class provides an XForms implementation of the FormAboutlyx Dialog.
*/
class FormAboutlyx : public FormCB<ControlAboutlyx, FormDB<FD_aboutlyx> > {
class FormAboutlyx
: public FormController<ControlAboutlyx, FormView<FD_aboutlyx> > {
public:
///
FormAboutlyx();
FormAboutlyx(Dialog &);
private:
/// not needed.

View File

@ -46,7 +46,7 @@ shortcut:
resize: FL_RESIZE_NONE
gravity: FL_SouthEast FL_SouthEast
name: button_close
callback: C_FormBaseCancelCB
callback: C_FormDialogView_CancelCB
argument: 0
--------------------
@ -106,8 +106,8 @@ shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NorthWest FL_SouthEast
name: browser_version
callback: C_FormBaseInputCB
argument: 0
callback:
argument:
=============== FORM ===============
Name: form_aboutlyx_credits
@ -148,8 +148,8 @@ shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NorthWest FL_SouthEast
name: browser_credits
callback: C_FormBaseInputCB
argument: 0
callback:
argument:
=============== FORM ===============
Name: form_aboutlyx_license
@ -190,8 +190,8 @@ shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NorthWest FL_SouthEast
name: browser_license
callback: C_FormBaseInputCB
argument: 0
callback:
argument:
==============================
create_the_forms

View File

@ -1126,7 +1126,7 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
#endif
#endif
case LFUN_HELP_ABOUTLYX:
owner->getDialogs().showAboutlyx();
owner->getDialogs().show("about");
break;
case LFUN_HELP_TEXINFO: