]> git.lyx.org Git - features.git/commitdiff
more
authorAndré Pönitz <poenitz@gmx.net>
Sun, 7 Oct 2007 10:31:37 +0000 (10:31 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Sun, 7 Oct 2007 10:31:37 +0000 (10:31 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20813 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/Dialogs.cpp
src/frontends/qt4/GuiBibitem.cpp
src/frontends/qt4/GuiBibitem.h
src/frontends/qt4/GuiParagraph.cpp

index 35c2d6ca07fb9f7e91f02cc8b4eb797b51e1e091..64962d0615a203b529caa2e63bda8cc468f6f040 100644 (file)
@@ -16,7 +16,6 @@
 #include "ButtonController.h"
 #include "DialogView.h"
 #include "DockView.h"
-#include "GuiBibitem.h"
 #include "GuiDelimiter.h"
 #include "GuiIndex.h"
 #include "GuiMathMatrix.h"
@@ -96,7 +95,7 @@ Dialog * createGuiLog(LyXView & lv);
 Dialog * createGuiMath(LyXView & lv);
 Dialog * createGuiNomencl(LyXView & lv);
 Dialog * createGuiNote(LyXView & lv);
-Dialog * createGuiParagraph(LyXView & lv)
+Dialog * createGuiParagraph(LyXView & lv);
 Dialog * createGuiPreferences(LyXView & lv);
 Dialog * createGuiPrint(LyXView & lv);
 Dialog * createGuiRef(LyXView & lv);
@@ -129,7 +128,7 @@ Dialog * Dialogs::build(string const & name)
        if (name == "aboutlyx")
                return createGuiAbout(lyxview_);
        if (name == "bibitem")
-               return new GuiBibitemDialog(lyxview_);
+               return createGuiBibitem(lyxview_);
        if (name == "bibtex")
                return createGuiBibtex(lyxview_);
        if (name == "box")
index 2a9294d19fa8e97ce432a1c76a15eeb0806aab2d..7f49de22b4a67e4aeeb289f1616910caaf33e06d 100644 (file)
@@ -13,6 +13,9 @@
 #include "GuiBibitem.h"
 #include "ControlCommand.h"
 #include "qt_helpers.h"
+#include "FuncRequest.h"
+
+#include "insets/InsetCommand.h"
 
 #include <QCloseEvent>
 #include <QLineEdit>
@@ -23,19 +26,19 @@ namespace lyx {
 namespace frontend {
 
 
-GuiBibitemDialog::GuiBibitemDialog(LyXView & lv)
-       : GuiDialog(lv, "bibitem")
+GuiBibitem::GuiBibitem(LyXView & lv)
+       : GuiDialog(lv, "bibitem"), Controller(this), params_("bibitem")
 {
        setupUi(this);
        setViewTitle(_("Bibliography Entry Settings"));
-       setController(new ControlCommand(*this, "bibitem"));
+       setController(this, false);
 
        connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
        connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
 
-       connect(keyED, SIGNAL(textChanged(const QString &)),
+       connect(keyED, SIGNAL(textChanged(QString)),
                this, SLOT(change_adaptor()));
-       connect(labelED, SIGNAL(textChanged(const QString &)),
+       connect(labelED, SIGNAL(textChanged(QString)),
                this, SLOT(change_adaptor()));
 
        bc().setPolicy(ButtonPolicy::OkCancelReadOnlyPolicy);
@@ -46,44 +49,58 @@ GuiBibitemDialog::GuiBibitemDialog(LyXView & lv)
 }
 
 
-ControlCommand & GuiBibitemDialog::controller()
-{
-       return static_cast<ControlCommand &>(GuiDialog::controller());
-}
-
-
-void GuiBibitemDialog::change_adaptor()
+void GuiBibitem::change_adaptor()
 {
        changed();
 }
 
 
-void GuiBibitemDialog::closeEvent(QCloseEvent *e)
+void GuiBibitem::closeEvent(QCloseEvent *e)
 {
        slotClose();
        e->accept();
 }
 
 
-void GuiBibitemDialog::updateContents()
+void GuiBibitem::updateContents()
 {
-       keyED->setText(toqstr(controller().params()["key"]));
-       labelED->setText(toqstr(controller().params()["label"]));
+       keyED->setText(toqstr(params_["key"]));
+       labelED->setText(toqstr(params_["label"]));
 }
 
 
-void GuiBibitemDialog::applyView()
+void GuiBibitem::applyView()
 {
-       controller().params()["key"] = qstring_to_ucs4(keyED->text());
-       controller().params()["label"] = qstring_to_ucs4(labelED->text());
+       params_["key"] = qstring_to_ucs4(keyED->text());
+       params_["label"] = qstring_to_ucs4(labelED->text());
 }
 
 
-bool GuiBibitemDialog::isValid()
+bool GuiBibitem::isValid()
 {
        return !keyED->text().isEmpty();
 }
 
+
+bool GuiBibitem::initialiseParams(std::string const & data)
+{
+       // The name passed with LFUN_INSET_APPLY is also the name
+       // used to identify the mailer.
+       InsetCommandMailer::string2params("bibitem", data, params_);
+       return true;
+}
+
+
+void GuiBibitem::dispatchParams()
+{
+       std::string const lfun = InsetCommandMailer::params2string("bibitem", params_);
+       dispatch(FuncRequest(getLfun(), lfun));
+}
+
+
+Dialog * createGuiBibitem(LyXView & lv) { return new GuiBibitem(lv); }
+
+
 } // namespace frontend
 } // namespace lyx
 
index 671021a130515bf3759268534065ab0e56199a35..e096be582c33ae89a42302c37524784b2a26f49b 100644 (file)
@@ -4,6 +4,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
+ * \author Angus Leeming
  * \author John Levon
  *
  * Full author contact details are available in file CREDITS.
 #define GUIBIBITEM_H
 
 #include "GuiDialog.h"
-#include "ControlCommand.h"
 #include "ui_BibitemUi.h"
 
+#include "frontends/Dialog.h"
+
+#include "insets/InsetCommandParams.h"
+
 namespace lyx {
 namespace frontend {
 
-class GuiBibitemDialog : public GuiDialog, public Ui::BibitemUi
+class GuiBibitem : public GuiDialog, public Ui::BibitemUi, public Controller
 {
        Q_OBJECT
 
 public:
-       GuiBibitemDialog(LyXView & lv);
+       GuiBibitem(LyXView & lv);
 
 private Q_SLOTS:
        void change_adaptor();
@@ -33,7 +37,7 @@ private:
        ///
        void closeEvent(QCloseEvent * e);
        /// parent controller
-       ControlCommand & controller();
+       Controller & controller() { return *this; }
 
 private:
        ///
@@ -42,6 +46,18 @@ private:
        void applyView();
        /// update
        void updateContents();
+       ///
+       bool initialiseParams(std::string const & data);
+       /// clean-up on hide.
+       void clearParams() { params_.clear(); }
+       /// clean-up on hide.
+       void dispatchParams();
+       ///
+       bool isBufferDependent() const { return true; }
+
+private:
+       ///
+       InsetCommandParams params_;
 };
 
 } // namespace frontend
index 55704b0f04704cb55066ce76430f4362ef390959..5f6917429986932d2ee3e2f66e093cbdea6bcfff 100644 (file)
@@ -22,6 +22,9 @@
 #include "gettext.h"
 #include "ParagraphParameters.h"
 #include "Spacing.h"
+#include "GuiView.h"
+#include "DialogView.h"
+#include "DockView.h"
 
 #include <QCheckBox>
 #include <QCloseEvent>
@@ -251,10 +254,10 @@ Dialog * createGuiParagraph(LyXView & lv)
 {
        GuiViewBase & guiview = static_cast<GuiViewBase &>(lv);
 #ifdef USE_DOCK_WIDGET
-       return new DockView<ControlParagraph, GuiParagraph>(guiview, name,
+       return new DockView<ControlParagraph, GuiParagraph>(guiview, "paragraph",
                Qt::TopDockWidgetArea);
 #else
-       return new DialogView<ControlParagraph, GuiParagraph>(guiview, name);
+       return new DialogView<ControlParagraph, GuiParagraph>(guiview, "paragraph");
 #endif
 }