]> git.lyx.org Git - features.git/commitdiff
move GuiCommand into hedar of its own. InsetCommandParams.h is expensive
authorAndré Pönitz <poenitz@gmx.net>
Sun, 20 Apr 2008 08:19:26 +0000 (08:19 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Sun, 20 Apr 2008 08:19:26 +0000 (08:19 +0000)
nowadays ;-|

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24375 a592a061-630c-0410-9148-cb99ea01b6c8

15 files changed:
src/frontends/qt4/GuiBibitem.cpp
src/frontends/qt4/GuiBibitem.h
src/frontends/qt4/GuiBibtex.h
src/frontends/qt4/GuiCitation.h
src/frontends/qt4/GuiCommand.h [new file with mode: 0644]
src/frontends/qt4/GuiDialog.cpp
src/frontends/qt4/GuiDialog.h
src/frontends/qt4/GuiHyperlink.h
src/frontends/qt4/GuiInclude.h
src/frontends/qt4/GuiLabel.h
src/frontends/qt4/GuiMath.h
src/frontends/qt4/GuiNomencl.h
src/frontends/qt4/GuiRef.h
src/frontends/qt4/Makefile.am
src/insets/InsetCommandParams.cpp

index 0e13e49426f1499307ca02d8e2c4d202a84ed1bb..a74a34cb65e71698861d96e9d044cecdffc5156e 100644 (file)
@@ -14,6 +14,8 @@
 #include "qt_helpers.h"
 #include "FuncRequest.h"
 
+#include "insets/InsetCommand.h"
+
 #include <QLineEdit>
 #include <QPushButton>
 
@@ -23,7 +25,8 @@ namespace frontend {
 
 
 GuiBibitem::GuiBibitem(GuiView & lv)
-       : GuiCommand(lv, "bibitem", qt_("Bibliography Entry Settings"))
+       : GuiDialog(lv, "bibitem", qt_("Bibliography Entry Settings")),
+         params_(insetCode("bibitem"))
 {
        setupUi(this);
 
@@ -69,6 +72,22 @@ bool GuiBibitem::isValid()
 }
 
 
+bool GuiBibitem::initialiseParams(std::string const & data)
+{
+       // The name passed with LFUN_INSET_APPLY is also the name
+       // used to identify the mailer.
+       InsetCommand::string2params("bibitem", data, params_);
+       return true;
+}
+
+
+void GuiBibitem::dispatchParams()
+{
+       std::string const lfun = InsetCommand::params2string("bibitem", params_);
+       dispatch(FuncRequest(getLfun(), lfun));
+}
+
+
 Dialog * createGuiBibitem(GuiView & lv) { return new GuiBibitem(lv); }
 
 
index 8d7ea4faa666f9dcfbbfd0c0be00b044accbda99..b0c34e79b7e9709bc47dbb499bfc4af876311f2f 100644 (file)
 namespace lyx {
 namespace frontend {
 
-class GuiBibitem : public GuiCommand, public Ui::BibitemUi
+class GuiBibitem : public GuiDialog, public Ui::BibitemUi
 {
        Q_OBJECT
 
 public:
+       /// Constructor
        GuiBibitem(GuiView & lv);
 
 private Q_SLOTS:
@@ -38,6 +39,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 4eb11d744ba277ef3dd23f25122ed4116f0394a8..1234703183cf5ba033167c74df73b65afa08d4a3 100644 (file)
@@ -13,7 +13,7 @@
 #ifndef GUIBIBTEX_H
 #define GUIBIBTEX_H
 
-#include "GuiDialog.h"
+#include "GuiCommand.h"
 #include "ButtonController.h"
 #include "ui_BibtexUi.h"
 #include "ui_BibtexAddUi.h"
index d06cce1a46e8252b4a55bbd5577817992315c25b..bdafad9ecf2fe442c899434aa2511b7d9913d0ff 100644 (file)
 #ifndef GUICITATION_H
 #define GUICITATION_H
 
-#include "GuiDialog.h"
+#include "GuiCommand.h"
 #include "GuiSelectionManager.h"
 #include "ui_CitationUi.h"
-#include "support/docstring.h"
 #include "BiblioInfo.h"
 
-#include <QKeyEvent>
 #include <QStringList>
 #include <QStringListModel>
 
diff --git a/src/frontends/qt4/GuiCommand.h b/src/frontends/qt4/GuiCommand.h
new file mode 100644 (file)
index 0000000..6e7edae
--- /dev/null
@@ -0,0 +1,51 @@
+// -*- C++ -*-
+/**
+ * \file GuiCommand.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Angus Leeming
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef GUICOMMAND_H
+#define GUICOMMAND_H
+
+#include "GuiDialog.h"
+
+#include "insets/InsetCommandParams.h"
+
+
+namespace lyx {
+namespace frontend {
+
+class GuiCommand : public GuiDialog
+{
+public:
+       /// We need to know with what sort of inset we're associated.
+       // FIXME This should probably be an InsetCode
+       GuiCommand(GuiView &, QString const & name, QString const & title);
+       ///
+       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; }
+
+protected:
+       ///
+       InsetCommandParams params_;
+       //FIXME It should be possible to eliminate lfun_name_
+       //now and recover that information from params().insetType().
+       //But let's not do that quite yet.
+       /// Flags what action is taken by Kernel::dispatch()
+       std::string const lfun_name_;
+};
+
+} // namespace frontend
+} // namespace lyx
+
+#endif // GUIDIALOG_H
index 53a132d5ff987a300eea9908fe3fb81dee4f257f..aa7ae171d716a4f150b720f6b1819729e621a3e1 100644 (file)
@@ -11,6 +11,8 @@
 #include <config.h>
 
 #include "GuiDialog.h"
+#include "GuiCommand.h"
+
 #include "GuiView.h"
 #include "qt_helpers.h"
 #include "FuncRequest.h"
@@ -20,9 +22,6 @@
 #include "support/debug.h"
 
 #include <QCloseEvent>
-#include <QMainWindow>
-#include <QSettings>
-#include <QShowEvent>
 
 using namespace std;
 
index ce9f2fcd6a774ae7a3bb1d701c4a9e6512f94fee..04878e2981d4ef4fe17fddbc6c86f169554067b2 100644 (file)
 #include "Dialog.h"
 #include "ButtonController.h"
 
-#include "insets/InsetCommandParams.h"
-
 #include <QDialog>
 
-class QCloseEvent;
-class QShowEvent;
 
 namespace lyx {
 namespace frontend {
@@ -109,31 +105,6 @@ private:
 };
 
 
-class GuiCommand : public GuiDialog
-{
-public:
-       /// We need to know with what sort of inset we're associated.
-       // FIXME This should probably be an InsetCode
-       GuiCommand(GuiView &, QString const & name, QString const & title);
-       ///
-       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; }
-
-protected:
-       ///
-       InsetCommandParams params_;
-       //FIXME It should be possible to eliminate lfun_name_
-       //now and recover that information from params().insetType().
-       //But let's not do that quite yet.
-       /// Flags what action is taken by Kernel::dispatch()
-       std::string const lfun_name_;
-};
-
 } // namespace frontend
 } // namespace lyx
 
index dd8329d78a5f794e13ae9ccac10876375c8645ef..e55a677d3aa448470009bcc5734f939db07a137f 100644 (file)
@@ -13,9 +13,8 @@
 #ifndef GUIHYPERLINK_H
 #define GUIHYPERLINK_H
 
-#include "GuiDialog.h"
+#include "GuiCommand.h"
 #include "ui_HyperlinkUi.h"
-#include "insets/InsetCommandParams.h"
 
 namespace lyx {
 namespace frontend {
@@ -25,6 +24,7 @@ class GuiHyperlink : public GuiCommand, public Ui::HyperlinkUi
        Q_OBJECT
 
 public:
+       /// Constructor
        GuiHyperlink(GuiView & lv);
 
 public Q_SLOTS:
index 0d66d92e9249e04f523ca5a666d7d69b1015d29e..c34143d77e52534843ba34ae4fb1791ec038dcff 100644 (file)
 #define GUIINCLUDE_H
 
 #include "GuiDialog.h"
+#include "GuiCommand.h"
 #include "ui_IncludeUi.h"
 
-#include "insets/InsetCommandParams.h"
-
-#include "support/docstring.h"
-
 
 namespace lyx {
 namespace frontend {
index 73c6654ffae4b1f94617b7f73c68094c9572d440..bdca993f1af6731d8b2fff97d45260d044728297 100644 (file)
@@ -13,7 +13,7 @@
 #ifndef GUILABEL_H
 #define GUILABEL_H
 
-#include "GuiDialog.h"
+#include "GuiCommand.h"
 #include "ui_LabelUi.h"
 
 namespace lyx {
@@ -39,8 +39,7 @@ private:
        void updateContents();
 };
 
-
 } // namespace frontend
 } // namespace lyx
 
-#endif // GUIINDEX_H
+#endif // GUILABEL_H
index 8100b61c693ad5a7b26118e7bbdc5582295b28ba..a406f738b025de61219123cd64e2d5cfb7e01b6c 100644 (file)
@@ -17,6 +17,7 @@
 #include "FontEnums.h"
 
 #include <map>
+#include <string>
 
 
 namespace lyx {
index f5c3ac6af19beb2dc25f1ba63293556fb3013c8b..0029f448d370bdde797cd1e7224ee819a0617718 100644 (file)
@@ -1,6 +1,6 @@
 // -*- C++ -*-
 /**
- * \file GuiNomencl.h
+ * \file GuiNomenclature.h
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
  * Full author contact details are available in file CREDITS.
  */
 
-#ifndef GUINOMENCL_H
-#define GUINOMENCL_H
+#ifndef GUINOMENCLATURE_H
+#define GUINOMENCLATURE_H
 
-#include "GuiDialog.h"
+#include "GuiCommand.h"
 #include "ui_NomenclUi.h"
 
 namespace lyx {
@@ -43,4 +43,4 @@ private:
 } // namespace frontend
 } // namespace lyx
 
-#endif // GUINOMENCL_H
+#endif // GUINOMENCLATURE_H
index f1bb9f9e3c56c6c3ab7a282b16b0f93a0aa45f8a..e6ff95857a13451379d2661dd8ba4e1141c989d4 100644 (file)
 #ifndef GUIREF_H
 #define GUIREF_H
 
-#include "GuiDialog.h"
-#include "Dialog.h"
+#include "GuiCommand.h"
 #include "ui_RefUi.h"
-#include "insets/InsetCommandParams.h"
 
 #include <vector>
 
index eba02e902a354ea51921cdb940a9b0d467b0ef7e..7d5b42dd8be9624c11b4db9cbcdaaccadb7663d7 100644 (file)
@@ -140,6 +140,7 @@ NOMOCHEADER = \
        DialogView.h \
        DockView.h \
        FileDialog.h \
+       GuiCommand.h \
        GuiFontExample.h \
        GuiFontLoader.h \
        GuiFontMetrics.h \
index 8dd3bceb96737d6460ba3992ed5143a5846050a5..fae7ce61e45fbfbf53ff24b0bd938eb59bd25eb8 100644 (file)
@@ -395,7 +395,7 @@ docstring InsetCommandParams::getFirstNonOptParam() const
                find_if(info_.begin(), info_.end(), 
                        not1(mem_fun_ref(&ParamInfo::ParamData::isOptional)));
        if (it == info_.end())
-               LASSERT(false, /**/);
+               LASSERT(false, return docstring());
        return (*this)[it->name()];
 }
 
@@ -403,7 +403,7 @@ docstring InsetCommandParams::getFirstNonOptParam() const
 docstring const & InsetCommandParams::operator[](string const & name) const
 {
        static const docstring dummy; //so we don't return a ref to temporary
-       LASSERT(info_.hasParam(name), /**/);
+       LASSERT(info_.hasParam(name), return dummy);
        ParamMap::const_iterator data = params_.find(name);
        if (data == params_.end() || data->second.empty())
                return dummy;