#include "Buffer.h"
#include "BufferParams.h"
-#include "ui_BibtexAddUi.h"
+#include "FuncRequest.h"
+#include "LyXRC.h"
#include "qt_helpers.h"
#include "Validator.h"
-#include "LyXRC.h"
+
+#include "ui_BibtexAddUi.h"
#include "ButtonPolicy.h"
GuiBibtex::GuiBibtex(GuiView & lv)
- : GuiCommand(lv, "bibtex", qt_("BibTeX Bibliography"))
+ : GuiDialog(lv, "bibtex", qt_("BibTeX Bibliography")),
+ params_(insetCode("bibtex"))
{
setupUi(this);
}
+bool GuiBibtex::initialiseParams(std::string const & data)
+{
+ InsetCommand::string2params("bibtex", data, params_);
+ return true;
+}
+
+
+void GuiBibtex::dispatchParams()
+{
+ std::string const lfun = InsetCommand::params2string("bibtex", params_);
+ dispatch(FuncRequest(getLfun(), lfun));
+}
+
+
+
Dialog * createGuiBibtex(GuiView & lv) { return new GuiBibtex(lv); }
#ifndef GUIBIBTEX_H
#define GUIBIBTEX_H
-#include "GuiCommand.h"
+#include "GuiDialog.h"
#include "ButtonController.h"
#include "ui_BibtexUi.h"
#include "ui_BibtexAddUi.h"
+#include "insets/InsetCommandParams.h"
+
namespace lyx {
namespace frontend {
};
-class GuiBibtex : public GuiCommand, public Ui::BibtexUi
+class GuiBibtex : public GuiDialog, public Ui::BibtexUi
{
Q_OBJECT
/// which stylefile do we use?
QString styleFile() const;
+ ///
+ 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_;
///
GuiBibtexAddDialog * add_;
///
#include "qt_helpers.h"
#include "Buffer.h"
#include "BufferParams.h"
+#include "FuncRequest.h"
#include "insets/InsetCommand.h"
GuiCitation::GuiCitation(GuiView & lv)
- : GuiCommand(lv, "citation", qt_("Citation"))
+ : GuiDialog(lv, "citation", qt_("Citation")),
+ params_(insetCode("citation"))
{
setupUi(this);
bool GuiCitation::initialiseParams(string const & data)
{
- InsetCommand::string2params(lfun_name_, data, params_);
+ InsetCommand::string2params("citation", data, params_);
biblio::CiteEngine const engine = buffer().params().citeEngine();
bibkeysInfo_.fillWithBibKeys(&buffer());
citeStyles_ = biblio::getCiteStyles(engine);
}
+void GuiCitation::dispatchParams()
+{
+ std::string const lfun = InsetCommand::params2string("citation", params_);
+ dispatch(FuncRequest(getLfun(), lfun));
+}
+
+
Dialog * createGuiCitation(GuiView & lv) { return new GuiCitation(lv); }
#ifndef GUICITATION_H
#define GUICITATION_H
-#include "GuiCommand.h"
+#include "GuiDialog.h"
#include "GuiSelectionManager.h"
#include "ui_CitationUi.h"
#include "BiblioInfo.h"
+#include "insets/InsetCommandParams.h"
+
#include <QStringList>
#include <QStringListModel>
namespace lyx {
namespace frontend {
-class GuiCitation : public GuiCommand, public Ui::CitationUi
+class GuiCitation : public GuiDialog, public Ui::CitationUi
{
Q_OBJECT
/// Set the Params variable for the Controller.
void apply(int const choice, bool const full, bool const force,
QString before, QString after);
+ ///
+ bool initialiseParams(std::string const & data);
+ /// clean-up on hide.
+ void clearParams();
+ /// clean-up on hide.
+ void dispatchParams();
+ ///
+ bool isBufferDependent() const { return true; }
private:
/// available keys.
QStringList all_keys_;
/// Cited keys.
QStringList cited_keys_;
-
///
- bool initialiseParams(std::string const & data);
-
- /// clean-up on hide.
- void clearParams();
+ InsetCommandParams params_;
/** Disconnect from the inset when the Apply button is pressed.
* Allows easy insertion of multiple citations.
+++ /dev/null
-// -*- 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
#include <config.h>
#include "GuiDialog.h"
-#include "GuiCommand.h"
#include "GuiView.h"
#include "qt_helpers.h"
#include "FuncRequest.h"
-#include "insets/InsetCommand.h"
-
#include "support/debug.h"
#include <QCloseEvent>
namespace frontend {
GuiDialog::GuiDialog(GuiView & lv, QString const & name, QString const & title)
- : QDialog(&lv), Dialog(lv, name, "LyX: " + title), is_closing_(false)
+ : QDialog(&lv), Dialog(lv, name, "LyX: " + title), is_closing_(false)
{}
setUpdatesEnabled(true);
}
-
-/////////////////////////////////////////////////////////////////////
-//
-// Command based dialogs
-//
-/////////////////////////////////////////////////////////////////////
-
-
-GuiCommand::GuiCommand(GuiView & lv, QString const & name,
- QString const & title)
- : GuiDialog(lv, name, title), params_(insetCode(fromqstr(name))),
- lfun_name_(fromqstr(name))
-{
-}
-
-
-bool GuiCommand::initialiseParams(string const & data)
-{
- // The name passed with LFUN_INSET_APPLY is also the name
- // used to identify the mailer.
- InsetCommand::string2params(lfun_name_, data, params_);
- return true;
-}
-
-
-void GuiCommand::dispatchParams()
-{
- if (lfun_name_.empty())
- return;
-
- string const lfun = InsetCommand::params2string(lfun_name_, params_);
- dispatch(FuncRequest(getLfun(), lfun));
-}
-
} // namespace frontend
} // namespace lyx
namespace frontend {
GuiHyperlink::GuiHyperlink(GuiView & lv)
- : GuiCommand(lv, "href",qt_("Hyperlink"))
+ : GuiDialog(lv, "href", qt_("Hyperlink")),
+ params_(insetCode(fromqstr("href")))
{
setupUi(this);
bool GuiHyperlink::isValid()
{
- QString const u = targetED->text();
- QString const n = nameED->text();
+ return !targetED->text().isEmpty() || !nameED->text().isEmpty();
+}
+
- return !u.isEmpty() || !n.isEmpty();
+bool GuiHyperlink::initialiseParams(std::string const & data)
+{
+ // The name passed with LFUN_INSET_APPLY is also the name
+ // used to identify the mailer.
+ InsetCommand::string2params("href", data, params_);
+ return true;
+}
+
+
+void GuiHyperlink::dispatchParams()
+{
+ std::string const lfun = InsetCommand::params2string("href", params_);
+ dispatch(FuncRequest(getLfun(), lfun));
}
#ifndef GUIHYPERLINK_H
#define GUIHYPERLINK_H
-#include "GuiCommand.h"
+#include "GuiDialog.h"
#include "ui_HyperlinkUi.h"
+#include "insets/InsetCommandParams.h"
+
namespace lyx {
namespace frontend {
-class GuiHyperlink : public GuiCommand, public Ui::HyperlinkUi
+class GuiHyperlink : public GuiDialog, public Ui::HyperlinkUi
{
Q_OBJECT
void applyView();
/// update dialog
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
GuiInclude::GuiInclude(GuiView & lv)
- : GuiCommand(lv, "include", qt_("Child Document"))
+ : GuiDialog(lv, "include", qt_("Child Document")),
+ params_(insetCode("include"))
{
setupUi(this);
}
+bool GuiInclude::initialiseParams(std::string const & data)
+{
+ InsetCommand::string2params("include", data, params_);
+ return true;
+}
+
+
+void GuiInclude::dispatchParams()
+{
+ std::string const lfun = InsetCommand::params2string("include", params_);
+ dispatch(FuncRequest(getLfun(), lfun));
+}
+
+
Dialog * createGuiInclude(GuiView & lv) { return new GuiInclude(lv); }
#define GUIINCLUDE_H
#include "GuiDialog.h"
-#include "GuiCommand.h"
#include "ui_IncludeUi.h"
+#include "insets/InsetCommandParams.h"
+
namespace lyx {
namespace frontend {
-class GuiInclude : public GuiCommand, public Ui::IncludeUi
+class GuiInclude : public GuiDialog, public Ui::IncludeUi
{
Q_OBJECT
void set_listings_msg();
private:
+ ///
+ 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; }
+
///
enum Type {
///
void applyView();
/// update
void updateContents();
- ///
- bool isBufferDependent() const { return true; }
/// Browse for a file
QString browse(QString const &, Type) const;
+
+private:
+ ///
+ InsetCommandParams params_;
};
} // namespace frontend
#include "GuiLabel.h"
+#include "FuncRequest.h"
#include "qt_helpers.h"
#include "support/debug.h"
+#include "insets/InsetCommand.h"
#include <QLabel>
#include <QPushButton>
/////////////////////////////////////////////////////////////////
//
-// Base implementation
+// GuiLabel
//
/////////////////////////////////////////////////////////////////
GuiLabel::GuiLabel(GuiView & lv)
- : GuiCommand(lv, "label", qt_("Label"))
+ : GuiDialog(lv, "label", qt_("Label")),
+ params_(insetCode("label"))
{
setupUi(this);
}
+bool GuiLabel::initialiseParams(std::string const & data)
+{
+ InsetCommand::string2params("label", data, params_);
+ return true;
+}
+
+
+void GuiLabel::dispatchParams()
+{
+ std::string const lfun = InsetCommand::params2string("label", params_);
+ dispatch(FuncRequest(getLfun(), lfun));
+}
+
+
Dialog * createGuiLabel(GuiView & lv) { return new GuiLabel(lv); }
#ifndef GUILABEL_H
#define GUILABEL_H
-#include "GuiCommand.h"
+#include "GuiDialog.h"
#include "ui_LabelUi.h"
+#include "insets/InsetCommandParams.h"
+
namespace lyx {
namespace frontend {
-class GuiLabel : public GuiCommand, public Ui::LabelUi
+class GuiLabel : public GuiDialog, public Ui::LabelUi
{
Q_OBJECT
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
#include "GuiNomencl.h"
#include "qt_helpers.h"
+#include "FuncRequest.h"
+
+#include "insets/InsetCommand.h"
#include "support/debug.h"
#include <QLabel>
#include <QLineEdit>
-#include <QPushButton>
-#include <QTextEdit>
-#include <QWhatsThis>
using namespace std;
namespace frontend {
GuiNomenclature::GuiNomenclature(GuiView & lv)
- : GuiCommand(lv, "nomenclature", qt_("Nomenclature"))
+ : GuiDialog(lv, "nomenclature", qt_("Nomenclature")),
+ params_(insetCode("nomenclature"))
{
setupUi(this);
}
+bool GuiNomenclature::initialiseParams(std::string const & data)
+{
+ InsetCommand::string2params("nomenclature", data, params_);
+ return true;
+}
+
+
+void GuiNomenclature::dispatchParams()
+{
+ std::string const lfun = InsetCommand::params2string("nomenclature", params_);
+ dispatch(FuncRequest(getLfun(), lfun));
+}
+
+
+
Dialog * createGuiNomenclature(GuiView & lv)
{
return new GuiNomenclature(lv);
#ifndef GUINOMENCLATURE_H
#define GUINOMENCLATURE_H
-#include "GuiCommand.h"
+#include "GuiDialog.h"
#include "ui_NomenclUi.h"
+#include "insets/InsetCommandParams.h"
+
namespace lyx {
namespace frontend {
-class GuiNomenclature : public GuiCommand, public Ui::NomenclUi
+class GuiNomenclature : public GuiDialog, public Ui::NomenclUi
{
Q_OBJECT
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
#include "insets/InsetRef.h"
#include "support/FileName.h"
-#include "support/filetools.h" // MakeAbsPath, MakeDisplayPath
+#include "support/filetools.h" // makeAbsPath, makeDisplayPath
#include <QLineEdit>
#include <QCheckBox>
namespace frontend {
GuiRef::GuiRef(GuiView & lv)
- : GuiCommand(lv, "ref", qt_("Cross-reference"))
+ : GuiDialog(lv, "ref", qt_("Cross-reference")),
+ params_(insetCode("ref"))
{
setupUi(this);
vector<string> buffers = theBufferList().getFileNames();
for (vector<string>::iterator it = buffers.begin();
it != buffers.end(); ++it) {
- bufferCO->addItem(toqstr(lyx::to_utf8(makeDisplayPath(*it))));
+ bufferCO->addItem(toqstr(makeDisplayPath(*it)));
}
// restore the buffer combo setting for new insets
}
+bool GuiRef::initialiseParams(std::string const & data)
+{
+ InsetCommand::string2params("ref", data, params_);
+ return true;
+}
+
+
+void GuiRef::dispatchParams()
+{
+ std::string const lfun = InsetCommand::params2string("ref", params_);
+ dispatch(FuncRequest(getLfun(), lfun));
+}
+
+
+
Dialog * createGuiRef(GuiView & lv) { return new GuiRef(lv); }
#ifndef GUIREF_H
#define GUIREF_H
-#include "GuiCommand.h"
+#include "GuiDialog.h"
#include "ui_RefUi.h"
+#include "insets/InsetCommandParams.h"
+
#include <vector>
class QListWidgetItem;
namespace lyx {
namespace frontend {
-class GuiRef : public GuiCommand, public Ui::RefUi
+class GuiRef : public GuiDialog, public Ui::RefUi
{
Q_OBJECT
void redoRefs();
/// update references
void updateRefs();
+ ///
+ bool initialiseParams(std::string const & data);
+ /// clean-up on hide.
+ void clearParams() { params_.clear(); }
+ /// clean-up on hide.
+ void dispatchParams();
+
+private:
+ ///
+ InsetCommandParams params_;
/// sort or not persistent state
bool sort_;
DialogView.h \
DockView.h \
FileDialog.h \
- GuiCommand.h \
GuiFontExample.h \
GuiFontLoader.h \
GuiFontMetrics.h \