Port the TabularCreate dialog to the Dialog scheme.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6402 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2003-03-09 19:34:46 +00:00
parent ded76b4ff4
commit b81c83f69b
25 changed files with 95 additions and 95 deletions

View File

@ -1,3 +1,8 @@
2003-03-09 Angus Leeming <leeming@lyx.org>
* factory.C (createInset): call Dialogs::show("tabularcreate") rather
than Dialogs::showTabularCreate().
2003-03-09 John Levon <levon@movementarian.org>
* lyxtext.h:

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().showTabularCreate();
bv->owner()->getDialogs().show("tabularcreate", string(), 0);
return 0;
case LFUN_INSET_CAPTION:

View File

@ -1,3 +1,8 @@
2003-03-09 Angus Leeming <leeming@lyx.org>
* Dialogs.h: remove showTabularCreate.
* guiapi.[Ch]: remove gui_updateTabularCreate.
2003-03-09 Angus Leeming <leeming@lyx.org>
* Dialogs.h: remove showTabular, updateTabular.

View File

@ -105,8 +105,6 @@ public:
void showSendto();
/// bring up the spellchecker
void showSpellchecker();
///
void showTabularCreate();
/// show the TexInfo
void showTexinfo();
/// show the thesaurus dialog

View File

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

View File

@ -10,41 +10,30 @@
#include <config.h>
#include "ControlTabularCreate.h"
#include "ViewBase.h"
#include "ButtonControllerBase.h"
#include "lyxfunc.h"
#include "funcrequest.h"
#include "support/lstrings.h"
ControlTabularCreate::ControlTabularCreate(LyXView & lv, Dialogs & d)
: ControlDialogBD(lv, d)
ControlTabularCreate::ControlTabularCreate(Dialog & parent)
: Dialog::Controller(parent)
{}
ControlTabularCreate::rowsCols & ControlTabularCreate::params()
void ControlTabularCreate::initialiseParams(string const &)
{
return params_;
params_.first = params_.second = 5;
}
void ControlTabularCreate::setParams()
void ControlTabularCreate::clearParams()
{
bc().valid(); // so that the user can press Ok
params_.first = params_.second = 0;
}
void ControlTabularCreate::apply()
void ControlTabularCreate::dispatchParams()
{
if (!bufferIsAvailable())
return;
view().apply();
string const val = tostr(params().first) + ' ' + tostr(params().second);
lyxfunc().dispatch(FuncRequest(LFUN_TABULAR_INSERT, val));
string data = tostr(params().first) + ' ' + tostr(params().second);
kernel().dispatch(FuncRequest(LFUN_TABULAR_INSERT, data));
}

View File

@ -12,29 +12,30 @@
#ifndef CONTROLTABULARCREATE_H
#define CONTROLTABULARCREATE_H
#include "Dialog.h"
#include <utility>
#include "ControlDialog_impl.h"
/** A controller for the TabularCreate Dialog.
*/
class ControlTabularCreate : public ControlDialogBD {
class ControlTabularCreate : public Dialog::Controller {
public:
///
ControlTabularCreate(LyXView &, Dialogs &);
typedef std::pair<unsigned int, unsigned int> rowsCols;
ControlTabularCreate(Dialog &);
///
virtual void initialiseParams(string const &);
/// clean-up on hide.
virtual void clearParams();
///
virtual void dispatchParams();
///
virtual bool isBufferDependent() const { return true; }
///
rowsCols & params();
typedef std::pair<unsigned int, unsigned int> rowsCols;
///
rowsCols & params() { return params_; }
private:
/// Apply from dialog
virtual void apply();
/// set the params before show or update
virtual void setParams();
/// rows, cols params
rowsCols params_;
};

View File

@ -117,12 +117,6 @@ void gui_ShowSpellchecker(Dialogs & d)
}
void gui_ShowTabularCreate(Dialogs & d)
{
d.showTabularCreate();
}
void gui_ShowTexinfo(Dialogs & d)
{
d.showTexinfo();

View File

@ -37,7 +37,6 @@ void gui_ShowPrint(Dialogs &);
void gui_ShowSearch(Dialogs &);
void gui_ShowSendto(Dialogs &);
void gui_ShowSpellchecker(Dialogs &);
void gui_ShowTabularCreate(Dialogs &);
void gui_ShowTexinfo(Dialogs &);
void gui_ShowThesaurus(string const &, Dialogs &);
void gui_ShowVCLogFile(Dialogs &);

View File

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

View File

@ -38,7 +38,6 @@ Dialogs::Impl::Impl(LyXView & lv, Dialogs & d)
search(lv, d),
sendto(lv, d),
spellchecker(lv, d),
tabularcreate(lv, d),
texinfo(lv, d),
#ifdef HAVE_LIBAIKSAURUS

View File

@ -118,12 +118,6 @@ void Dialogs::showSpellchecker()
}
void Dialogs::showTabularCreate()
{
pimpl_->tabularcreate.controller().show();
}
void Dialogs::showTexinfo()
{
pimpl_->texinfo.controller().show();

View File

@ -24,6 +24,7 @@
#include "ControlMinipage.h"
#include "ControlRef.h"
#include "ControlTabular.h"
#include "ControlTabularCreate.h"
#include "ControlToc.h"
#include "ControlWrap.h"
@ -57,6 +58,8 @@
#include "QRefDialog.h"
#include "QTabular.h"
#include "QTabularDialog.h"
#include "QTabularCreate.h"
#include "QTabularCreateDialog.h"
#include "QToc.h"
#include "QTocDialog.h"
#include "QURL.h"
@ -86,8 +89,8 @@ namespace {
char const * const dialognames[] = { "bibitem", "bibtex", "citation",
"error", "ert", "external", "float",
"graphics", "include", "index", "label",
"minipage", "ref", "tabular", "toc",
"url", "wrap" };
"minipage", "ref", "tabular",
"tabularcreate", "toc", "url", "wrap" };
char const * const * const end_dialognames =
dialognames + (sizeof(dialognames) / sizeof(char *));
@ -179,6 +182,10 @@ Dialog * Dialogs::build(string const & name)
dialog->setController(new ControlTabular(*dialog));
dialog->setView(new QTabular(*dialog));
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC);
} else if (name == "tabularcreate") {
dialog->setController(new ControlTabularCreate(*dialog));
dialog->setView(new QTabularCreate(*dialog));
dialog->setButtonController(new OkApplyCancelReadOnlyBC);
} else if (name == "toc") {
dialog->setController(new ControlToc(*dialog));
dialog->setView(new QToc(*dialog));

View File

@ -27,7 +27,6 @@
#include "ControlSendto.h"
#include "ControlShowFile.h"
#include "ControlSpellchecker.h"
#include "ControlTabularCreate.h"
#include "ControlTexinfo.h"
#include "ControlVCLog.h"
@ -60,8 +59,6 @@
#include "QShowFileDialog.h"
#include "QSpellchecker.h"
#include "QSpellcheckerDialog.h"
#include "QTabularCreate.h"
#include "QTabularCreateDialog.h"
#include "QTexinfo.h"
#include "QTexinfoDialog.h"
@ -114,9 +111,6 @@ SendtoDialog;
typedef GUI<ControlSpellchecker, QSpellchecker, NoRepeatedApplyReadOnlyPolicy, Qt2BC>
SpellcheckerDialog;
typedef GUI<ControlTabularCreate, QTabularCreate, OkApplyCancelReadOnlyPolicy, Qt2BC>
TabularCreateDialog;
typedef GUI<ControlTexinfo, QTexinfo, OkCancelPolicy, Qt2BC>
TexinfoDialog;
@ -144,7 +138,6 @@ struct Dialogs::Impl {
SearchDialog search;
SendtoDialog sendto;
SpellcheckerDialog spellchecker;
TabularCreateDialog tabularcreate;
TexinfoDialog texinfo;
#ifdef HAVE_LIBAIKSAURUS

View File

@ -21,11 +21,11 @@
#include <qspinbox.h>
#include <qpushbutton.h>
typedef Qt2CB<ControlTabularCreate, Qt2DB<QTabularCreateDialog> > base_class;
typedef QController<ControlTabularCreate, QView<QTabularCreateDialog> > base_class;
QTabularCreate::QTabularCreate()
: base_class(qt_("LyX: Insert Table"))
QTabularCreate::QTabularCreate(Dialog & parent)
: base_class(parent, qt_("LyX: Insert Table"))
{
}

View File

@ -13,7 +13,8 @@
#define QTABULARCREATE_H
#include "Qt2Base.h"
#include "QDialogView.h"
class ControlTabularCreate;
class QTabularCreateDialog;
@ -21,13 +22,13 @@ class QTabularCreateDialog;
///
class QTabularCreate
: public Qt2CB<ControlTabularCreate, Qt2DB<QTabularCreateDialog> >
: public QController<ControlTabularCreate, QView<QTabularCreateDialog> >
{
public:
///
friend class QTabularCreateDialog;
///
QTabularCreate();
QTabularCreate(Dialog &);
private:
/// Apply changes
virtual void apply();

View File

@ -10,13 +10,11 @@
#include <config.h>
#include <qdialog.h>
#include <qapplication.h>
#include "debug.h"
#include "QtLyXView.h"
#include "Dialogs.h"
#include "Qt2Base.h"
#include "Qt2BC.h"
#include "ControlButtons.h"

View File

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

View File

@ -41,7 +41,6 @@ Dialogs::Impl::Impl(LyXView & lv, Dialogs & d)
search(lv, d),
sendto(lv, d),
spellchecker(lv, d),
tabularcreate(lv, d),
texinfo(lv, d),
#ifdef HAVE_LIBAIKSAURUS

View File

@ -117,12 +117,6 @@ void Dialogs::showSpellchecker()
}
void Dialogs::showTabularCreate()
{
pimpl_->tabularcreate.controller().show();
}
void Dialogs::showTexinfo()
{
pimpl_->texinfo.controller().show();

View File

@ -27,6 +27,7 @@
#include "ControlMinipage.h"
#include "ControlRef.h"
#include "ControlTabular.h"
#include "ControlTabularCreate.h"
#include "ControlToc.h"
#include "ControlWrap.h"
@ -54,6 +55,8 @@
#include "forms/form_ref.h"
#include "FormTabular.h"
#include "forms/form_tabular.h"
#include "FormTabularCreate.h"
#include "forms/form_tabular_create.h"
#include "FormText.h"
#include "forms/form_text.h"
#include "FormToc.h"
@ -85,8 +88,8 @@ namespace {
char const * const dialognames[] = { "bibitem", "bibtex", "citation",
"error", "ert", "external", "float",
"graphics", "include", "index", "label",
"minipage", "ref", "tabular", "toc",
"url", "wrap" };
"minipage", "ref", "tabular",
"tabularcreate", "toc", "url", "wrap" };
char const * const * const end_dialognames =
@ -177,6 +180,10 @@ Dialog * Dialogs::build(string const & name)
dialog->setController(new ControlTabular(*dialog));
dialog->setView(new FormTabular(*dialog));
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC);
} else if (name == "tabularcreate") {
dialog->setController(new ControlTabularCreate(*dialog));
dialog->setView(new FormTabularCreate(*dialog));
dialog->setButtonController(new OkApplyCancelReadOnlyBC);
} else if (name == "toc") {
dialog->setController(new ControlToc(*dialog));
dialog->setView(new FormToc(*dialog));

View File

@ -79,10 +79,6 @@
#include "FormSpellchecker.h"
#include "forms/form_spellchecker.h"
#include "ControlTabularCreate.h"
#include "FormTabularCreate.h"
#include "forms/form_tabular_create.h"
#include "ControlTexinfo.h"
#include "FormTexinfo.h"
#include "forms/form_texinfo.h"
@ -141,9 +137,6 @@ SendtoDialog;
typedef GUI<ControlSpellchecker, FormSpellchecker, NoRepeatedApplyReadOnlyPolicy, xformsBC>
SpellcheckerDialog;
typedef GUI<ControlTabularCreate, FormTabularCreate, OkApplyCancelReadOnlyPolicy, xformsBC>
TabularCreateDialog;
typedef GUI<ControlTexinfo, FormTexinfo, OkCancelPolicy, xformsBC>
TexinfoDialog;
@ -173,7 +166,6 @@ struct Dialogs::Impl {
SearchDialog search;
SendtoDialog sendto;
SpellcheckerDialog spellchecker;
TabularCreateDialog tabularcreate;
TexinfoDialog texinfo;
#ifdef HAVE_LIBAIKSAURUS

View File

@ -24,10 +24,10 @@
using std::make_pair;
typedef FormCB<ControlTabularCreate, FormDB<FD_tabular_create> > base_class;
typedef FormController<ControlTabularCreate, FormView<FD_tabular_create> > base_class;
FormTabularCreate::FormTabularCreate()
: base_class(_("Insert Tabular"))
FormTabularCreate::FormTabularCreate(Dialog & parent)
: base_class(parent, _("Insert Tabular"))
{}

View File

@ -13,8 +13,7 @@
#ifndef FORMTABULARCREATE_H
#define FORMTABULARCREATE_H
#include "FormBase.h"
#include "FormDialogView.h"
class ControlTabularCreate;
struct FD_tabular_create;
@ -23,10 +22,10 @@ struct FD_tabular_create;
Dialog.
*/
class FormTabularCreate :
public FormCB<ControlTabularCreate, FormDB<FD_tabular_create> > {
public FormController<ControlTabularCreate, FormView<FD_tabular_create> > {
public:
///
FormTabularCreate();
FormTabularCreate(Dialog &);
private:
/// Apply from dialog
virtual void apply();

View File

@ -46,7 +46,7 @@ shortcut: ^M
resize: FL_RESIZE_NONE
gravity: FL_SouthEast FL_SouthEast
name: button_ok
callback: C_FormBaseOKCB
callback: C_FormDialogView_OKCB
argument: 0
--------------------
@ -64,7 +64,7 @@ shortcut:
resize: FL_RESIZE_NONE
gravity: FL_SouthEast FL_SouthEast
name: button_apply
callback: C_FormBaseApplyCB
callback: C_FormDialogView_ApplyCB
argument: 0
--------------------
@ -82,7 +82,7 @@ shortcut:
resize: FL_RESIZE_NONE
gravity: FL_SouthEast FL_SouthEast
name: button_close
callback: C_FormBaseCancelCB
callback: C_FormDialogView_CancelCB
argument: 0
--------------------