From b81c83f69bf3ab91ff69db4de73a71920088b84e Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Sun, 9 Mar 2003 19:34:46 +0000 Subject: [PATCH] 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 --- src/ChangeLog | 5 ++++ src/factory.C | 2 +- src/frontends/ChangeLog | 5 ++++ src/frontends/Dialogs.h | 2 -- src/frontends/controllers/ChangeLog | 4 +++ .../controllers/ControlTabularCreate.C | 29 ++++++------------- .../controllers/ControlTabularCreate.h | 27 ++++++++--------- src/frontends/guiapi.C | 6 ---- src/frontends/guiapi.h | 1 - src/frontends/qt2/ChangeLog | 10 +++++++ src/frontends/qt2/Dialogs.C | 1 - src/frontends/qt2/Dialogs2.C | 6 ---- src/frontends/qt2/Dialogs3.C | 11 +++++-- src/frontends/qt2/Dialogs_impl.h | 7 ----- src/frontends/qt2/QTabularCreate.C | 6 ++-- src/frontends/qt2/QTabularCreate.h | 7 +++-- src/frontends/qt2/Qt2Base.C | 2 -- src/frontends/xforms/ChangeLog | 12 ++++++++ src/frontends/xforms/Dialogs.C | 1 - src/frontends/xforms/Dialogs2.C | 6 ---- src/frontends/xforms/Dialogs3.C | 11 +++++-- src/frontends/xforms/Dialogs_impl.h | 8 ----- src/frontends/xforms/FormTabularCreate.C | 6 ++-- src/frontends/xforms/FormTabularCreate.h | 7 ++--- .../xforms/forms/form_tabular_create.fd | 6 ++-- 25 files changed, 94 insertions(+), 94 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index e0cc6e809e..4044b64c0b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2003-03-09 Angus Leeming + + * factory.C (createInset): call Dialogs::show("tabularcreate") rather + than Dialogs::showTabularCreate(). + 2003-03-09 John Levon * lyxtext.h: diff --git a/src/factory.C b/src/factory.C index 5e127756c3..fed4967c1c 100644 --- a/src/factory.C +++ b/src/factory.C @@ -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: diff --git a/src/frontends/ChangeLog b/src/frontends/ChangeLog index 372ca64262..dd97fa7deb 100644 --- a/src/frontends/ChangeLog +++ b/src/frontends/ChangeLog @@ -1,3 +1,8 @@ +2003-03-09 Angus Leeming + + * Dialogs.h: remove showTabularCreate. + * guiapi.[Ch]: remove gui_updateTabularCreate. + 2003-03-09 Angus Leeming * Dialogs.h: remove showTabular, updateTabular. diff --git a/src/frontends/Dialogs.h b/src/frontends/Dialogs.h index 457b32ec87..286b69d441 100644 --- a/src/frontends/Dialogs.h +++ b/src/frontends/Dialogs.h @@ -105,8 +105,6 @@ public: void showSendto(); /// bring up the spellchecker void showSpellchecker(); - /// - void showTabularCreate(); /// show the TexInfo void showTexinfo(); /// show the thesaurus dialog diff --git a/src/frontends/controllers/ChangeLog b/src/frontends/controllers/ChangeLog index 4068d19295..0be6b203eb 100644 --- a/src/frontends/controllers/ChangeLog +++ b/src/frontends/controllers/ChangeLog @@ -1,3 +1,7 @@ +2003-03-09 Angus Leeming + + * ControlTabularCreate.[Ch]: rewrite to use the Dialog-based scheme. + 2003-03-09 Angus Leeming * ControlTabular.[Ch]: rewrite to use the Dialog-based scheme. diff --git a/src/frontends/controllers/ControlTabularCreate.C b/src/frontends/controllers/ControlTabularCreate.C index e1e0b2850f..970f5ffe6c 100644 --- a/src/frontends/controllers/ControlTabularCreate.C +++ b/src/frontends/controllers/ControlTabularCreate.C @@ -10,41 +10,30 @@ #include - #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)); } diff --git a/src/frontends/controllers/ControlTabularCreate.h b/src/frontends/controllers/ControlTabularCreate.h index 0261d11fe2..819526fd4c 100644 --- a/src/frontends/controllers/ControlTabularCreate.h +++ b/src/frontends/controllers/ControlTabularCreate.h @@ -12,29 +12,30 @@ #ifndef CONTROLTABULARCREATE_H #define CONTROLTABULARCREATE_H +#include "Dialog.h" #include - -#include "ControlDialog_impl.h" - /** A controller for the TabularCreate Dialog. */ -class ControlTabularCreate : public ControlDialogBD { +class ControlTabularCreate : public Dialog::Controller { public: /// - ControlTabularCreate(LyXView &, Dialogs &); + ControlTabularCreate(Dialog &); + /// + virtual void initialiseParams(string const &); + /// clean-up on hide. + virtual void clearParams(); + /// + virtual void dispatchParams(); + /// + virtual bool isBufferDependent() const { return true; } + /// typedef std::pair rowsCols; - /// - rowsCols & params(); -private: - /// Apply from dialog - virtual void apply(); - - /// set the params before show or update - virtual void setParams(); + rowsCols & params() { return params_; } +private: /// rows, cols params rowsCols params_; }; diff --git a/src/frontends/guiapi.C b/src/frontends/guiapi.C index c053b57f6d..6460cbf942 100644 --- a/src/frontends/guiapi.C +++ b/src/frontends/guiapi.C @@ -117,12 +117,6 @@ void gui_ShowSpellchecker(Dialogs & d) } -void gui_ShowTabularCreate(Dialogs & d) -{ - d.showTabularCreate(); -} - - void gui_ShowTexinfo(Dialogs & d) { d.showTexinfo(); diff --git a/src/frontends/guiapi.h b/src/frontends/guiapi.h index 7cb0f666eb..825077b57e 100644 --- a/src/frontends/guiapi.h +++ b/src/frontends/guiapi.h @@ -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 &); diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index 25791e3e13..01e011c3df 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,3 +1,13 @@ +2003-03-09 Angus Leeming + + * 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 * Dialogs.C: diff --git a/src/frontends/qt2/Dialogs.C b/src/frontends/qt2/Dialogs.C index 4e8a3600dc..6415c9c6e5 100644 --- a/src/frontends/qt2/Dialogs.C +++ b/src/frontends/qt2/Dialogs.C @@ -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 diff --git a/src/frontends/qt2/Dialogs2.C b/src/frontends/qt2/Dialogs2.C index c5f35361a7..e75d2801a3 100644 --- a/src/frontends/qt2/Dialogs2.C +++ b/src/frontends/qt2/Dialogs2.C @@ -118,12 +118,6 @@ void Dialogs::showSpellchecker() } -void Dialogs::showTabularCreate() -{ - pimpl_->tabularcreate.controller().show(); -} - - void Dialogs::showTexinfo() { pimpl_->texinfo.controller().show(); diff --git a/src/frontends/qt2/Dialogs3.C b/src/frontends/qt2/Dialogs3.C index d1800c31c4..20d291d579 100644 --- a/src/frontends/qt2/Dialogs3.C +++ b/src/frontends/qt2/Dialogs3.C @@ -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)); diff --git a/src/frontends/qt2/Dialogs_impl.h b/src/frontends/qt2/Dialogs_impl.h index ab2301f0fb..81b04d50b5 100644 --- a/src/frontends/qt2/Dialogs_impl.h +++ b/src/frontends/qt2/Dialogs_impl.h @@ -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 SpellcheckerDialog; -typedef GUI -TabularCreateDialog; - typedef GUI TexinfoDialog; @@ -144,7 +138,6 @@ struct Dialogs::Impl { SearchDialog search; SendtoDialog sendto; SpellcheckerDialog spellchecker; - TabularCreateDialog tabularcreate; TexinfoDialog texinfo; #ifdef HAVE_LIBAIKSAURUS diff --git a/src/frontends/qt2/QTabularCreate.C b/src/frontends/qt2/QTabularCreate.C index 3baa16bb96..6cb5a47296 100644 --- a/src/frontends/qt2/QTabularCreate.C +++ b/src/frontends/qt2/QTabularCreate.C @@ -21,11 +21,11 @@ #include #include -typedef Qt2CB > base_class; +typedef QController > base_class; -QTabularCreate::QTabularCreate() - : base_class(qt_("LyX: Insert Table")) +QTabularCreate::QTabularCreate(Dialog & parent) + : base_class(parent, qt_("LyX: Insert Table")) { } diff --git a/src/frontends/qt2/QTabularCreate.h b/src/frontends/qt2/QTabularCreate.h index f64ab0891c..61f66560ad 100644 --- a/src/frontends/qt2/QTabularCreate.h +++ b/src/frontends/qt2/QTabularCreate.h @@ -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 > + : public QController > { public: /// friend class QTabularCreateDialog; /// - QTabularCreate(); + QTabularCreate(Dialog &); private: /// Apply changes virtual void apply(); diff --git a/src/frontends/qt2/Qt2Base.C b/src/frontends/qt2/Qt2Base.C index d8deb24b6c..44fe8c86dc 100644 --- a/src/frontends/qt2/Qt2Base.C +++ b/src/frontends/qt2/Qt2Base.C @@ -10,13 +10,11 @@ #include - #include #include #include "debug.h" #include "QtLyXView.h" -#include "Dialogs.h" #include "Qt2Base.h" #include "Qt2BC.h" #include "ControlButtons.h" diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index ac4eed0b24..cac71dffe6 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,15 @@ +2003-03-09 Angus Leeming + + * 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 * Dialogs.C: diff --git a/src/frontends/xforms/Dialogs.C b/src/frontends/xforms/Dialogs.C index 61e7f7a868..e261b0b61e 100644 --- a/src/frontends/xforms/Dialogs.C +++ b/src/frontends/xforms/Dialogs.C @@ -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 diff --git a/src/frontends/xforms/Dialogs2.C b/src/frontends/xforms/Dialogs2.C index 3914284c3f..5669d2b26d 100644 --- a/src/frontends/xforms/Dialogs2.C +++ b/src/frontends/xforms/Dialogs2.C @@ -117,12 +117,6 @@ void Dialogs::showSpellchecker() } -void Dialogs::showTabularCreate() -{ - pimpl_->tabularcreate.controller().show(); -} - - void Dialogs::showTexinfo() { pimpl_->texinfo.controller().show(); diff --git a/src/frontends/xforms/Dialogs3.C b/src/frontends/xforms/Dialogs3.C index 2c242db161..1e88ca944f 100644 --- a/src/frontends/xforms/Dialogs3.C +++ b/src/frontends/xforms/Dialogs3.C @@ -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)); diff --git a/src/frontends/xforms/Dialogs_impl.h b/src/frontends/xforms/Dialogs_impl.h index a1dd5f82d6..daacd56ed4 100644 --- a/src/frontends/xforms/Dialogs_impl.h +++ b/src/frontends/xforms/Dialogs_impl.h @@ -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 SpellcheckerDialog; -typedef GUI -TabularCreateDialog; - typedef GUI TexinfoDialog; @@ -173,7 +166,6 @@ struct Dialogs::Impl { SearchDialog search; SendtoDialog sendto; SpellcheckerDialog spellchecker; - TabularCreateDialog tabularcreate; TexinfoDialog texinfo; #ifdef HAVE_LIBAIKSAURUS diff --git a/src/frontends/xforms/FormTabularCreate.C b/src/frontends/xforms/FormTabularCreate.C index 025ca501fd..2607244e55 100644 --- a/src/frontends/xforms/FormTabularCreate.C +++ b/src/frontends/xforms/FormTabularCreate.C @@ -24,10 +24,10 @@ using std::make_pair; -typedef FormCB > base_class; +typedef FormController > base_class; -FormTabularCreate::FormTabularCreate() - : base_class(_("Insert Tabular")) +FormTabularCreate::FormTabularCreate(Dialog & parent) + : base_class(parent, _("Insert Tabular")) {} diff --git a/src/frontends/xforms/FormTabularCreate.h b/src/frontends/xforms/FormTabularCreate.h index 478cb5950e..d7e2200847 100644 --- a/src/frontends/xforms/FormTabularCreate.h +++ b/src/frontends/xforms/FormTabularCreate.h @@ -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 > { + public FormController > { public: /// - FormTabularCreate(); + FormTabularCreate(Dialog &); private: /// Apply from dialog virtual void apply(); diff --git a/src/frontends/xforms/forms/form_tabular_create.fd b/src/frontends/xforms/forms/form_tabular_create.fd index eae74980b6..561c195cd7 100644 --- a/src/frontends/xforms/forms/form_tabular_create.fd +++ b/src/frontends/xforms/forms/form_tabular_create.fd @@ -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 -------------------- -- 2.39.2