From 540a00cd02f9b1198255ff5896956c82eb9f41b8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Sat, 6 Oct 2007 09:39:29 +0000 Subject: [PATCH] next one git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20773 a592a061-630c-0410-9148-cb99ea01b6c8 --- .../controllers/ControlTabularCreate.cpp | 51 ------------------- .../controllers/ControlTabularCreate.h | 51 ------------------- src/frontends/controllers/Makefile.am | 2 - src/frontends/qt4/Dialogs.cpp | 4 +- src/frontends/qt4/GuiTabularCreate.cpp | 51 ++++++++++++++----- src/frontends/qt4/GuiTabularCreate.h | 30 +++++++++-- 6 files changed, 66 insertions(+), 123 deletions(-) delete mode 100644 src/frontends/controllers/ControlTabularCreate.cpp delete mode 100644 src/frontends/controllers/ControlTabularCreate.h diff --git a/src/frontends/controllers/ControlTabularCreate.cpp b/src/frontends/controllers/ControlTabularCreate.cpp deleted file mode 100644 index 2441a6fba0..0000000000 --- a/src/frontends/controllers/ControlTabularCreate.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/** - * \file ControlTabularCreate.cpp - * This file is part of LyX, the document processor. - * Licence details can be found in the file COPYING. - * - * \author unknown - * - * Full author contact details are available in file CREDITS. - */ - -#include - -#include "ControlTabularCreate.h" -#include "FuncRequest.h" - -#include "support/convert.h" - - -using std::string; - -namespace lyx { -namespace frontend { - -ControlTabularCreate::ControlTabularCreate(Dialog & parent) - : Controller(parent) -{} - - -bool ControlTabularCreate::initialiseParams(string const &) -{ - params_.first = 5; - params_.second = 5; - return true; -} - - -void ControlTabularCreate::clearParams() -{ - params_.first = 0; - params_.second = 0; -} - - -void ControlTabularCreate::dispatchParams() -{ - string const data = convert(params().first) + ' ' + convert(params().second); - dispatch(FuncRequest(getLfun(), data)); -} - -} // namespace frontend -} // namespace lyx diff --git a/src/frontends/controllers/ControlTabularCreate.h b/src/frontends/controllers/ControlTabularCreate.h deleted file mode 100644 index fde42ec9d8..0000000000 --- a/src/frontends/controllers/ControlTabularCreate.h +++ /dev/null @@ -1,51 +0,0 @@ -// -*- C++ -*- -/** - * \file ControlTabularCreate.h - * This file is part of LyX, the document processor. - * Licence details can be found in the file COPYING. - * - * \author unknown - * - * Full author contact details are available in file CREDITS. - */ - -#ifndef CONTROLTABULARCREATE_H -#define CONTROLTABULARCREATE_H - -#include "Dialog.h" -#include - -namespace lyx { -namespace frontend { - -/** A controller for the TabularCreate Dialog. - */ -class ControlTabularCreate : public Controller { -public: - /// - ControlTabularCreate(Dialog &); - /// - virtual bool initialiseParams(std::string const & data); - /// clean-up on hide. - virtual void clearParams(); - /// - virtual void dispatchParams(); - /// - virtual bool isBufferDependent() const { return true; } - /// - virtual kb_action getLfun() const { return LFUN_TABULAR_INSERT; } - - /// - typedef std::pair rowsCols; - /// - rowsCols & params() { return params_; } - -private: - /// rows, cols params - rowsCols params_; -}; - -} // namespace frontend -} // namespace lyx - -#endif // CONTROLTABULARCREATE_H diff --git a/src/frontends/controllers/Makefile.am b/src/frontends/controllers/Makefile.am index 6aaf8c2b4d..a4882ab65c 100644 --- a/src/frontends/controllers/Makefile.am +++ b/src/frontends/controllers/Makefile.am @@ -31,7 +31,6 @@ SOURCEFILES = \ ControlSearch.cpp \ ControlSendto.cpp \ ControlSpellchecker.cpp \ - ControlTabularCreate.cpp \ ControlThesaurus.cpp \ ControlToc.cpp \ frontend_helpers.cpp @@ -60,7 +59,6 @@ HEADERFILES = \ ControlSearch.h \ ControlSendto.h \ ControlSpellchecker.h \ - ControlTabularCreate.h \ ControlThesaurus.h \ ControlToc.h \ frontend_helpers.h diff --git a/src/frontends/qt4/Dialogs.cpp b/src/frontends/qt4/Dialogs.cpp index a4a449962a..307adc0280 100644 --- a/src/frontends/qt4/Dialogs.cpp +++ b/src/frontends/qt4/Dialogs.cpp @@ -41,8 +41,6 @@ #include "GuiSendto.h" #include "GuiShowFile.h" #include "GuiSpellchecker.h" -#include "GuiTabular.h" -#include "GuiTabularCreate.h" #include "GuiToc.h" #include "GuiView.h" #include "GuiViewSource.h" @@ -232,7 +230,7 @@ Dialog * Dialogs::build(string const & name) } else if (name == "tabular") { dialog = createGuiTabular(lyxview_); } else if (name == "tabularcreate") { - dialog = new GuiTabularCreateDialog(lyxview_); + dialog = createGuiTabularCreate(lyxview_); } else if (name == "texinfo") { dialog = createGuiTexInfo(lyxview_); #ifdef HAVE_LIBAIKSAURUS diff --git a/src/frontends/qt4/GuiTabularCreate.cpp b/src/frontends/qt4/GuiTabularCreate.cpp index a4394388ab..be59c0bec9 100644 --- a/src/frontends/qt4/GuiTabularCreate.cpp +++ b/src/frontends/qt4/GuiTabularCreate.cpp @@ -12,23 +12,27 @@ #include "GuiTabularCreate.h" -#include "ControlTabularCreate.h" #include "EmptyTable.h" +#include "FuncRequest.h" + +#include "support/convert.h" #include #include #include +using std::string; + namespace lyx { namespace frontend { -GuiTabularCreateDialog::GuiTabularCreateDialog(LyXView & lv) - : GuiDialog(lv, "tabularcreate") +GuiTabularCreate::GuiTabularCreate(LyXView & lv) + : GuiDialog(lv, "tabularcreate"), Controller(this) { setupUi(this); setViewTitle(_("Insert Table")); - setController(new ControlTabularCreate(*this)); + setController(this, false); rowsSB->setValue(5); columnsSB->setValue(5); @@ -47,30 +51,53 @@ GuiTabularCreateDialog::GuiTabularCreateDialog(LyXView & lv) } -ControlTabularCreate & GuiTabularCreateDialog::controller() +void GuiTabularCreate::columnsChanged(int) { - return static_cast(GuiDialog::controller()); + changed(); } -void GuiTabularCreateDialog::columnsChanged(int) +void GuiTabularCreate::rowsChanged(int) { changed(); } -void GuiTabularCreateDialog::rowsChanged(int) +void GuiTabularCreate::applyView() { - changed(); + params_.first = rowsSB->value(); + params_.second = columnsSB->value(); } -void GuiTabularCreateDialog::applyView() +bool GuiTabularCreate::initialiseParams(string const &) { - controller().params().first = rowsSB->value(); - controller().params().second = columnsSB->value(); + params_.first = 5; + params_.second = 5; + return true; } + +void GuiTabularCreate::clearParams() +{ + params_.first = 0; + params_.second = 0; +} + + +void GuiTabularCreate::dispatchParams() +{ + string const data = convert(params().first) + ' ' + convert(params().second); + dispatch(FuncRequest(getLfun(), data)); +} + + +Dialog * createGuiTabularCreate(LyXView & lv) +{ + return new GuiTabularCreate(lv); +} + + } // namespace frontend } // namespace lyx diff --git a/src/frontends/qt4/GuiTabularCreate.h b/src/frontends/qt4/GuiTabularCreate.h index e620f804a3..45f14a8838 100644 --- a/src/frontends/qt4/GuiTabularCreate.h +++ b/src/frontends/qt4/GuiTabularCreate.h @@ -13,29 +13,51 @@ #define GUITABULARCREATE_H #include "GuiDialog.h" -#include "ControlTabularCreate.h" #include "ui_TabularCreateUi.h" +#include + namespace lyx { namespace frontend { -class GuiTabularCreateDialog : public GuiDialog, public Ui::TabularCreateUi + +class GuiTabularCreate + : public GuiDialog, public Ui::TabularCreateUi, public Controller { Q_OBJECT public: - GuiTabularCreateDialog(LyXView & lv); + GuiTabularCreate(LyXView & lv); private Q_SLOTS: void columnsChanged(int); void rowsChanged(int); /// parent controller - ControlTabularCreate & controller(); + Controller & controller() { return *this; } private: /// Apply changes void applyView(); + /// + bool initialiseParams(std::string const & data); + /// clean-up on hide. + void clearParams(); + /// + void dispatchParams(); + /// + bool isBufferDependent() const { return true; } + /// + kb_action getLfun() const { return LFUN_TABULAR_INSERT; } + + /// + typedef std::pair rowsCols; + /// + rowsCols & params() { return params_; } + +private: + /// rows, cols params + rowsCols params_; }; } // namespace frontend -- 2.39.5