diff --git a/src/frontends/qt4/GuiBibitem.cpp b/src/frontends/qt4/GuiBibitem.cpp index 0e13e49426..a74a34cb65 100644 --- a/src/frontends/qt4/GuiBibitem.cpp +++ b/src/frontends/qt4/GuiBibitem.cpp @@ -14,6 +14,8 @@ #include "qt_helpers.h" #include "FuncRequest.h" +#include "insets/InsetCommand.h" + #include #include @@ -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); } diff --git a/src/frontends/qt4/GuiBibitem.h b/src/frontends/qt4/GuiBibitem.h index 8d7ea4faa6..b0c34e79b7 100644 --- a/src/frontends/qt4/GuiBibitem.h +++ b/src/frontends/qt4/GuiBibitem.h @@ -21,11 +21,12 @@ 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 diff --git a/src/frontends/qt4/GuiBibtex.h b/src/frontends/qt4/GuiBibtex.h index 4eb11d744b..1234703183 100644 --- a/src/frontends/qt4/GuiBibtex.h +++ b/src/frontends/qt4/GuiBibtex.h @@ -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" diff --git a/src/frontends/qt4/GuiCitation.h b/src/frontends/qt4/GuiCitation.h index d06cce1a46..bdafad9ecf 100644 --- a/src/frontends/qt4/GuiCitation.h +++ b/src/frontends/qt4/GuiCitation.h @@ -15,13 +15,11 @@ #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 #include #include diff --git a/src/frontends/qt4/GuiCommand.h b/src/frontends/qt4/GuiCommand.h new file mode 100644 index 0000000000..6e7edaeaf3 --- /dev/null +++ b/src/frontends/qt4/GuiCommand.h @@ -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 diff --git a/src/frontends/qt4/GuiDialog.cpp b/src/frontends/qt4/GuiDialog.cpp index 53a132d5ff..aa7ae171d7 100644 --- a/src/frontends/qt4/GuiDialog.cpp +++ b/src/frontends/qt4/GuiDialog.cpp @@ -11,6 +11,8 @@ #include #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 -#include -#include -#include using namespace std; diff --git a/src/frontends/qt4/GuiDialog.h b/src/frontends/qt4/GuiDialog.h index ce9f2fcd6a..04878e2981 100644 --- a/src/frontends/qt4/GuiDialog.h +++ b/src/frontends/qt4/GuiDialog.h @@ -15,12 +15,8 @@ #include "Dialog.h" #include "ButtonController.h" -#include "insets/InsetCommandParams.h" - #include -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 diff --git a/src/frontends/qt4/GuiHyperlink.h b/src/frontends/qt4/GuiHyperlink.h index dd8329d78a..e55a677d3a 100644 --- a/src/frontends/qt4/GuiHyperlink.h +++ b/src/frontends/qt4/GuiHyperlink.h @@ -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: diff --git a/src/frontends/qt4/GuiInclude.h b/src/frontends/qt4/GuiInclude.h index 0d66d92e92..c34143d77e 100644 --- a/src/frontends/qt4/GuiInclude.h +++ b/src/frontends/qt4/GuiInclude.h @@ -15,12 +15,9 @@ #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 { diff --git a/src/frontends/qt4/GuiLabel.h b/src/frontends/qt4/GuiLabel.h index 73c6654ffa..bdca993f1a 100644 --- a/src/frontends/qt4/GuiLabel.h +++ b/src/frontends/qt4/GuiLabel.h @@ -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 diff --git a/src/frontends/qt4/GuiMath.h b/src/frontends/qt4/GuiMath.h index 8100b61c69..a406f738b0 100644 --- a/src/frontends/qt4/GuiMath.h +++ b/src/frontends/qt4/GuiMath.h @@ -17,6 +17,7 @@ #include "FontEnums.h" #include +#include namespace lyx { diff --git a/src/frontends/qt4/GuiNomencl.h b/src/frontends/qt4/GuiNomencl.h index f5c3ac6af1..0029f448d3 100644 --- a/src/frontends/qt4/GuiNomencl.h +++ b/src/frontends/qt4/GuiNomencl.h @@ -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. * @@ -11,10 +11,10 @@ * 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 diff --git a/src/frontends/qt4/GuiRef.h b/src/frontends/qt4/GuiRef.h index f1bb9f9e3c..e6ff95857a 100644 --- a/src/frontends/qt4/GuiRef.h +++ b/src/frontends/qt4/GuiRef.h @@ -12,10 +12,8 @@ #ifndef GUIREF_H #define GUIREF_H -#include "GuiDialog.h" -#include "Dialog.h" +#include "GuiCommand.h" #include "ui_RefUi.h" -#include "insets/InsetCommandParams.h" #include diff --git a/src/frontends/qt4/Makefile.am b/src/frontends/qt4/Makefile.am index eba02e902a..7d5b42dd8b 100644 --- a/src/frontends/qt4/Makefile.am +++ b/src/frontends/qt4/Makefile.am @@ -140,6 +140,7 @@ NOMOCHEADER = \ DialogView.h \ DockView.h \ FileDialog.h \ + GuiCommand.h \ GuiFontExample.h \ GuiFontLoader.h \ GuiFontMetrics.h \ diff --git a/src/insets/InsetCommandParams.cpp b/src/insets/InsetCommandParams.cpp index 8dd3bceb96..fae7ce61e4 100644 --- a/src/insets/InsetCommandParams.cpp +++ b/src/insets/InsetCommandParams.cpp @@ -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;