mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-13 20:09:59 +00:00
move GuiCommand into hedar of its own. InsetCommandParams.h is expensive
nowadays ;-| git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24375 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
9cf878cc60
commit
c621ec9843
@ -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); }
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
@ -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 <QKeyEvent>
|
||||
#include <QStringList>
|
||||
#include <QStringListModel>
|
||||
|
||||
|
51
src/frontends/qt4/GuiCommand.h
Normal file
51
src/frontends/qt4/GuiCommand.h
Normal file
@ -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
|
@ -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;
|
||||
|
||||
|
@ -15,12 +15,8 @@
|
||||
#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
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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 {
|
||||
|
@ -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
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "FontEnums.h"
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
@ -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
|
||||
|
@ -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 <vector>
|
||||
|
||||
|
@ -140,6 +140,7 @@ NOMOCHEADER = \
|
||||
DialogView.h \
|
||||
DockView.h \
|
||||
FileDialog.h \
|
||||
GuiCommand.h \
|
||||
GuiFontExample.h \
|
||||
GuiFontLoader.h \
|
||||
GuiFontMetrics.h \
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user