mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Remove the name parameter from string2params and params2string. We can always derive the name with insetName(params.code()).
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35891 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
e313d3a12b
commit
c5b9664476
@ -1846,7 +1846,7 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
|
|||||||
icp["key"] = from_utf8(arg);
|
icp["key"] = from_utf8(arg);
|
||||||
if (!opt1.empty())
|
if (!opt1.empty())
|
||||||
icp["before"] = from_utf8(opt1);
|
icp["before"] = from_utf8(opt1);
|
||||||
string icstr = InsetCommand::params2string("citation", icp);
|
string icstr = InsetCommand::params2string(icp);
|
||||||
FuncRequest fr(LFUN_INSET_INSERT, icstr);
|
FuncRequest fr(LFUN_INSET_INSERT, icstr);
|
||||||
lyx::dispatch(fr);
|
lyx::dispatch(fr);
|
||||||
break;
|
break;
|
||||||
|
@ -1560,7 +1560,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
}
|
}
|
||||||
p["target"] = (cmd.argument().empty()) ?
|
p["target"] = (cmd.argument().empty()) ?
|
||||||
content : cmd.argument();
|
content : cmd.argument();
|
||||||
string const data = InsetCommand::params2string("href", p);
|
string const data = InsetCommand::params2string(p);
|
||||||
if (p["target"].empty()) {
|
if (p["target"].empty()) {
|
||||||
bv->showDialog("href", data);
|
bv->showDialog("href", data);
|
||||||
} else {
|
} else {
|
||||||
@ -1576,7 +1576,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
p["name"] = (cmd.argument().empty()) ?
|
p["name"] = (cmd.argument().empty()) ?
|
||||||
cur.getPossibleLabel() :
|
cur.getPossibleLabel() :
|
||||||
cmd.argument();
|
cmd.argument();
|
||||||
string const data = InsetCommand::params2string("label", p);
|
string const data = InsetCommand::params2string(p);
|
||||||
|
|
||||||
if (cmd.argument().empty()) {
|
if (cmd.argument().empty()) {
|
||||||
bv->showDialog("label", data);
|
bv->showDialog("label", data);
|
||||||
@ -1692,7 +1692,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
p["symbol"] = bv->cursor().innerText()->getStringToIndex(bv->cursor());
|
p["symbol"] = bv->cursor().innerText()->getStringToIndex(bv->cursor());
|
||||||
else
|
else
|
||||||
p["symbol"] = cmd.argument();
|
p["symbol"] = cmd.argument();
|
||||||
string const data = InsetCommand::params2string("nomenclature", p);
|
string const data = InsetCommand::params2string(p);
|
||||||
bv->showDialog("nomenclature", data);
|
bv->showDialog("nomenclature", data);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1703,7 +1703,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
p["type"] = from_ascii("idx");
|
p["type"] = from_ascii("idx");
|
||||||
else
|
else
|
||||||
p["type"] = cmd.argument();
|
p["type"] = cmd.argument();
|
||||||
string const data = InsetCommand::params2string("index_print", p);
|
string const data = InsetCommand::params2string(p);
|
||||||
FuncRequest fr(LFUN_INSET_INSERT, data);
|
FuncRequest fr(LFUN_INSET_INSERT, data);
|
||||||
dispatch(cur, fr);
|
dispatch(cur, fr);
|
||||||
break;
|
break;
|
||||||
|
@ -219,19 +219,19 @@ Inset * createInsetHelper(Buffer * buf, FuncRequest const & cmd)
|
|||||||
|
|
||||||
case BIBITEM_CODE: {
|
case BIBITEM_CODE: {
|
||||||
InsetCommandParams icp(code);
|
InsetCommandParams icp(code);
|
||||||
InsetCommand::string2params(name, to_utf8(cmd.argument()), icp);
|
InsetCommand::string2params(to_utf8(cmd.argument()), icp);
|
||||||
return new InsetBibitem(buf, icp);
|
return new InsetBibitem(buf, icp);
|
||||||
}
|
}
|
||||||
|
|
||||||
case BIBTEX_CODE: {
|
case BIBTEX_CODE: {
|
||||||
InsetCommandParams icp(code);
|
InsetCommandParams icp(code);
|
||||||
InsetCommand::string2params(name, to_utf8(cmd.argument()), icp);
|
InsetCommand::string2params(to_utf8(cmd.argument()), icp);
|
||||||
return new InsetBibtex(buf, icp);
|
return new InsetBibtex(buf, icp);
|
||||||
}
|
}
|
||||||
|
|
||||||
case CITE_CODE: {
|
case CITE_CODE: {
|
||||||
InsetCommandParams icp(code);
|
InsetCommandParams icp(code);
|
||||||
InsetCommand::string2params(name, to_utf8(cmd.argument()), icp);
|
InsetCommand::string2params(to_utf8(cmd.argument()), icp);
|
||||||
return new InsetCitation(buf, icp);
|
return new InsetCitation(buf, icp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,13 +259,13 @@ Inset * createInsetHelper(Buffer * buf, FuncRequest const & cmd)
|
|||||||
|
|
||||||
case HYPERLINK_CODE: {
|
case HYPERLINK_CODE: {
|
||||||
InsetCommandParams icp(code);
|
InsetCommandParams icp(code);
|
||||||
InsetCommand::string2params(name, to_utf8(cmd.argument()), icp);
|
InsetCommand::string2params(to_utf8(cmd.argument()), icp);
|
||||||
return new InsetHyperlink(buf, icp);
|
return new InsetHyperlink(buf, icp);
|
||||||
}
|
}
|
||||||
|
|
||||||
case INCLUDE_CODE: {
|
case INCLUDE_CODE: {
|
||||||
InsetCommandParams icp(code);
|
InsetCommandParams icp(code);
|
||||||
InsetCommand::string2params(name, to_utf8(cmd.argument()), icp);
|
InsetCommand::string2params(to_utf8(cmd.argument()), icp);
|
||||||
return new InsetInclude(buf, icp);
|
return new InsetInclude(buf, icp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -276,19 +276,19 @@ Inset * createInsetHelper(Buffer * buf, FuncRequest const & cmd)
|
|||||||
|
|
||||||
case INDEX_PRINT_CODE: {
|
case INDEX_PRINT_CODE: {
|
||||||
InsetCommandParams icp(code);
|
InsetCommandParams icp(code);
|
||||||
InsetCommand::string2params(name, to_utf8(cmd.argument()), icp);
|
InsetCommand::string2params(to_utf8(cmd.argument()), icp);
|
||||||
return new InsetPrintIndex(buf, icp);
|
return new InsetPrintIndex(buf, icp);
|
||||||
}
|
}
|
||||||
|
|
||||||
case LABEL_CODE: {
|
case LABEL_CODE: {
|
||||||
InsetCommandParams icp(code);
|
InsetCommandParams icp(code);
|
||||||
InsetCommand::string2params(name, to_utf8(cmd.argument()), icp);
|
InsetCommand::string2params(to_utf8(cmd.argument()), icp);
|
||||||
return new InsetLabel(buf, icp);
|
return new InsetLabel(buf, icp);
|
||||||
}
|
}
|
||||||
|
|
||||||
case LINE_CODE: {
|
case LINE_CODE: {
|
||||||
InsetCommandParams icp(code);
|
InsetCommandParams icp(code);
|
||||||
InsetCommand::string2params(name, to_utf8(cmd.argument()), icp);
|
InsetCommand::string2params(to_utf8(cmd.argument()), icp);
|
||||||
return new InsetLine(buf, icp);
|
return new InsetLine(buf, icp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -300,13 +300,13 @@ Inset * createInsetHelper(Buffer * buf, FuncRequest const & cmd)
|
|||||||
|
|
||||||
case NOMENCL_CODE: {
|
case NOMENCL_CODE: {
|
||||||
InsetCommandParams icp(code);
|
InsetCommandParams icp(code);
|
||||||
InsetCommand::string2params(name, to_utf8(cmd.argument()), icp);
|
InsetCommand::string2params(to_utf8(cmd.argument()), icp);
|
||||||
return new InsetNomencl(buf, icp);
|
return new InsetNomencl(buf, icp);
|
||||||
}
|
}
|
||||||
|
|
||||||
case REF_CODE: {
|
case REF_CODE: {
|
||||||
InsetCommandParams icp(code);
|
InsetCommandParams icp(code);
|
||||||
InsetCommand::string2params(name, to_utf8(cmd.argument()), icp);
|
InsetCommand::string2params(to_utf8(cmd.argument()), icp);
|
||||||
return new InsetRef(buf, icp);
|
return new InsetRef(buf, icp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -318,7 +318,7 @@ Inset * createInsetHelper(Buffer * buf, FuncRequest const & cmd)
|
|||||||
|
|
||||||
case TOC_CODE: {
|
case TOC_CODE: {
|
||||||
InsetCommandParams icp(code);
|
InsetCommandParams icp(code);
|
||||||
InsetCommand::string2params(name, to_utf8(cmd.argument()), icp);
|
InsetCommand::string2params(to_utf8(cmd.argument()), icp);
|
||||||
return new InsetTOC(buf, icp);
|
return new InsetTOC(buf, icp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ docstring GuiBibitem::dialogToParams() const
|
|||||||
InsetCommandParams params(insetCode());
|
InsetCommandParams params(insetCode());
|
||||||
params["key"] = qstring_to_ucs4(keyED->text());
|
params["key"] = qstring_to_ucs4(keyED->text());
|
||||||
params["label"] = qstring_to_ucs4(labelED->text());
|
params["label"] = qstring_to_ucs4(labelED->text());
|
||||||
return from_utf8(InsetCommand::params2string("bibitem", params));
|
return from_utf8(InsetCommand::params2string(params));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -547,14 +547,14 @@ QString GuiBibtex::styleFile() const
|
|||||||
|
|
||||||
bool GuiBibtex::initialiseParams(std::string const & data)
|
bool GuiBibtex::initialiseParams(std::string const & data)
|
||||||
{
|
{
|
||||||
InsetCommand::string2params("bibtex", data, params_);
|
InsetCommand::string2params(data, params_);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiBibtex::dispatchParams()
|
void GuiBibtex::dispatchParams()
|
||||||
{
|
{
|
||||||
std::string const lfun = InsetCommand::params2string("bibtex", params_);
|
std::string const lfun = InsetCommand::params2string(params_);
|
||||||
dispatch(FuncRequest(getLfun(), lfun));
|
dispatch(FuncRequest(getLfun(), lfun));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -622,7 +622,7 @@ void GuiCitation::setCitedKeys()
|
|||||||
|
|
||||||
bool GuiCitation::initialiseParams(string const & data)
|
bool GuiCitation::initialiseParams(string const & data)
|
||||||
{
|
{
|
||||||
InsetCommand::string2params("citation", data, params_);
|
InsetCommand::string2params(data, params_);
|
||||||
CiteEngine const engine = buffer().params().citeEngine();
|
CiteEngine const engine = buffer().params().citeEngine();
|
||||||
citeStyles_ = citeStyles(engine);
|
citeStyles_ = citeStyles(engine);
|
||||||
init();
|
init();
|
||||||
@ -748,7 +748,7 @@ vector<docstring> GuiCitation::searchKeys(BiblioInfo const & bi,
|
|||||||
|
|
||||||
void GuiCitation::dispatchParams()
|
void GuiCitation::dispatchParams()
|
||||||
{
|
{
|
||||||
std::string const lfun = InsetCommand::params2string("citation", params_);
|
std::string const lfun = InsetCommand::params2string(params_);
|
||||||
dispatch(FuncRequest(getLfun(), lfun));
|
dispatch(FuncRequest(getLfun(), lfun));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,8 +81,7 @@ docstring GuiHyperlink::dialogToParams() const
|
|||||||
else if (fileRB->isChecked())
|
else if (fileRB->isChecked())
|
||||||
params["type"] = qstring_to_ucs4("file:");
|
params["type"] = qstring_to_ucs4("file:");
|
||||||
params.setCmdName("href");
|
params.setCmdName("href");
|
||||||
|
return from_ascii(InsetHyperlink::params2string(params));
|
||||||
return from_ascii(InsetHyperlink::params2string("href", params));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -335,7 +335,7 @@ QString GuiInclude::browse(QString const & in_name, Type in_type) const
|
|||||||
|
|
||||||
bool GuiInclude::initialiseParams(std::string const & data)
|
bool GuiInclude::initialiseParams(std::string const & data)
|
||||||
{
|
{
|
||||||
InsetCommand::string2params("include", data, params_);
|
InsetCommand::string2params(data, params_);
|
||||||
paramsToDialog(params_);
|
paramsToDialog(params_);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -343,7 +343,7 @@ bool GuiInclude::initialiseParams(std::string const & data)
|
|||||||
|
|
||||||
void GuiInclude::dispatchParams()
|
void GuiInclude::dispatchParams()
|
||||||
{
|
{
|
||||||
std::string const lfun = InsetCommand::params2string("include", params_);
|
std::string const lfun = InsetCommand::params2string(params_);
|
||||||
dispatch(FuncRequest(getLfun(), lfun));
|
dispatch(FuncRequest(getLfun(), lfun));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,14 +54,14 @@ docstring GuiLabel::dialogToParams() const
|
|||||||
{
|
{
|
||||||
InsetCommandParams params(insetCode());
|
InsetCommandParams params(insetCode());
|
||||||
params["name"] = qstring_to_ucs4(keywordED->text());
|
params["name"] = qstring_to_ucs4(keywordED->text());
|
||||||
return from_ascii(InsetLabel::params2string("label", params));
|
return from_ascii(InsetLabel::params2string(params));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool GuiLabel::initialiseParams(std::string const & data)
|
bool GuiLabel::initialiseParams(std::string const & data)
|
||||||
{
|
{
|
||||||
InsetCommandParams p(insetCode());
|
InsetCommandParams p(insetCode());
|
||||||
if (!InsetCommand::string2params("label", data, p))
|
if (!InsetCommand::string2params(data, p))
|
||||||
return false;
|
return false;
|
||||||
keywordED->setText(toqstr(p["name"]));
|
keywordED->setText(toqstr(p["name"]));
|
||||||
return true;
|
return true;
|
||||||
|
@ -77,7 +77,7 @@ docstring GuiLine::dialogToParams() const
|
|||||||
params["width"] = from_utf8(widgetsToLength(WidthLE, WidthUnitCO));
|
params["width"] = from_utf8(widgetsToLength(WidthLE, WidthUnitCO));
|
||||||
params["height"] = from_utf8(widgetsToLength(HeightLE, HeightUnitCO));
|
params["height"] = from_utf8(widgetsToLength(HeightLE, HeightUnitCO));
|
||||||
params.setCmdName("rule");
|
params.setCmdName("rule");
|
||||||
return from_ascii(InsetLine::params2string("line", params));
|
return from_ascii(InsetLine::params2string(params));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ docstring GuiNomenclature::dialogToParams() const
|
|||||||
QString description = descriptionTE->toPlainText();
|
QString description = descriptionTE->toPlainText();
|
||||||
description.replace('\n',"\\\\");
|
description.replace('\n',"\\\\");
|
||||||
params["description"] = qstring_to_ucs4(description);
|
params["description"] = qstring_to_ucs4(description);
|
||||||
return from_ascii(InsetNomencl::params2string("nomenclature", params));
|
return from_ascii(InsetNomencl::params2string(params));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ bool GuiPrintNomencl::isValid() const
|
|||||||
|
|
||||||
bool GuiPrintNomencl::initialiseParams(std::string const & data)
|
bool GuiPrintNomencl::initialiseParams(std::string const & data)
|
||||||
{
|
{
|
||||||
InsetCommand::string2params("nomencl_print", data, params_);
|
InsetCommand::string2params(data, params_);
|
||||||
paramsToDialog(params_);
|
paramsToDialog(params_);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -146,7 +146,7 @@ bool GuiPrintNomencl::initialiseParams(std::string const & data)
|
|||||||
|
|
||||||
void GuiPrintNomencl::dispatchParams()
|
void GuiPrintNomencl::dispatchParams()
|
||||||
{
|
{
|
||||||
std::string const lfun = InsetCommand::params2string("nomencl_print", params_);
|
std::string const lfun = InsetCommand::params2string(params_);
|
||||||
dispatch(FuncRequest(getLfun(), lfun));
|
dispatch(FuncRequest(getLfun(), lfun));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ bool GuiPrintindex::initialiseParams(string const & data)
|
|||||||
{
|
{
|
||||||
// The name passed with LFUN_INSET_APPLY is also the name
|
// The name passed with LFUN_INSET_APPLY is also the name
|
||||||
// used to identify the mailer.
|
// used to identify the mailer.
|
||||||
InsetCommand::string2params("index_print", data, params_);
|
InsetCommand::string2params(data, params_);
|
||||||
paramsToDialog(params_);
|
paramsToDialog(params_);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -121,7 +121,7 @@ bool GuiPrintindex::initialiseParams(string const & data)
|
|||||||
|
|
||||||
void GuiPrintindex::dispatchParams()
|
void GuiPrintindex::dispatchParams()
|
||||||
{
|
{
|
||||||
std::string const lfun = InsetCommand::params2string("index_print", params_);
|
std::string const lfun = InsetCommand::params2string(params_);
|
||||||
dispatch(FuncRequest(getLfun(), lfun));
|
dispatch(FuncRequest(getLfun(), lfun));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -496,14 +496,14 @@ void GuiRef::filterLabels()
|
|||||||
|
|
||||||
bool GuiRef::initialiseParams(std::string const & data)
|
bool GuiRef::initialiseParams(std::string const & data)
|
||||||
{
|
{
|
||||||
InsetCommand::string2params("ref", data, params_);
|
InsetCommand::string2params(data, params_);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiRef::dispatchParams()
|
void GuiRef::dispatchParams()
|
||||||
{
|
{
|
||||||
std::string const lfun = InsetCommand::params2string("ref", params_);
|
std::string const lfun = InsetCommand::params2string(params_);
|
||||||
dispatch(FuncRequest(getLfun(), lfun));
|
dispatch(FuncRequest(getLfun(), lfun));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1389,7 +1389,7 @@ void MenuDefinition::expandIndicesContext(Buffer const * buf, bool listof)
|
|||||||
if (listof) {
|
if (listof) {
|
||||||
InsetCommandParams p(INDEX_PRINT_CODE);
|
InsetCommandParams p(INDEX_PRINT_CODE);
|
||||||
p["type"] = cit->shortcut();
|
p["type"] = cit->shortcut();
|
||||||
string const data = InsetCommand::params2string("index_print", p);
|
string const data = InsetCommand::params2string(p);
|
||||||
addWithStatusCheck(MenuItem(MenuItem::Command, toqstr(cit->index()),
|
addWithStatusCheck(MenuItem(MenuItem::Command, toqstr(cit->index()),
|
||||||
FuncRequest(LFUN_INSET_MODIFY, data)));
|
FuncRequest(LFUN_INSET_MODIFY, data)));
|
||||||
} else {
|
} else {
|
||||||
|
@ -116,7 +116,7 @@ void InsetBibitem::doDispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
|
|
||||||
case LFUN_INSET_MODIFY: {
|
case LFUN_INSET_MODIFY: {
|
||||||
InsetCommandParams p(BIBITEM_CODE);
|
InsetCommandParams p(BIBITEM_CODE);
|
||||||
InsetCommand::string2params("bibitem", to_utf8(cmd.argument()), p);
|
InsetCommand::string2params(to_utf8(cmd.argument()), p);
|
||||||
if (p.getCmdName().empty()) {
|
if (p.getCmdName().empty()) {
|
||||||
cur.noScreenUpdate();
|
cur.noScreenUpdate();
|
||||||
break;
|
break;
|
||||||
|
@ -88,8 +88,7 @@ void InsetBibtex::doDispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
case LFUN_INSET_MODIFY: {
|
case LFUN_INSET_MODIFY: {
|
||||||
InsetCommandParams p(BIBTEX_CODE);
|
InsetCommandParams p(BIBTEX_CODE);
|
||||||
try {
|
try {
|
||||||
if (!InsetCommand::string2params("bibtex",
|
if (!InsetCommand::string2params(to_utf8(cmd.argument()), p)) {
|
||||||
to_utf8(cmd.argument()), p)) {
|
|
||||||
cur.noScreenUpdate();
|
cur.noScreenUpdate();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -152,7 +152,7 @@ void InsetCommand::doDispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
InsetCommandParams p(p_.code());
|
InsetCommandParams p(p_.code());
|
||||||
InsetCommand::string2params(mailer_name_, to_utf8(cmd.argument()), p);
|
InsetCommand::string2params(to_utf8(cmd.argument()), p);
|
||||||
if (p.getCmdName().empty())
|
if (p.getCmdName().empty())
|
||||||
cur.noScreenUpdate();
|
cur.noScreenUpdate();
|
||||||
else
|
else
|
||||||
@ -166,7 +166,7 @@ void InsetCommand::doDispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
|
|
||||||
case LFUN_INSET_DIALOG_UPDATE: {
|
case LFUN_INSET_DIALOG_UPDATE: {
|
||||||
string const name = to_utf8(cmd.argument());
|
string const name = to_utf8(cmd.argument());
|
||||||
cur.bv().updateDialog(name, params2string(name, params()));
|
cur.bv().updateDialog(name, params2string(params()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,14 +216,13 @@ docstring InsetCommand::contextMenu(BufferView const &, int, int) const
|
|||||||
bool InsetCommand::showInsetDialog(BufferView * bv) const
|
bool InsetCommand::showInsetDialog(BufferView * bv) const
|
||||||
{
|
{
|
||||||
if (!mailer_name_.empty())
|
if (!mailer_name_.empty())
|
||||||
bv->showDialog(mailer_name_, params2string(mailer_name_, p_),
|
bv->showDialog(mailer_name_, params2string(p_),
|
||||||
const_cast<InsetCommand *>(this));
|
const_cast<InsetCommand *>(this));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// FIXME This could take an InsetCode instead of a string
|
bool InsetCommand::string2params(string const & data,
|
||||||
bool InsetCommand::string2params(string const & name, string const & data,
|
|
||||||
InsetCommandParams & params)
|
InsetCommandParams & params)
|
||||||
{
|
{
|
||||||
params.clear();
|
params.clear();
|
||||||
@ -232,6 +231,7 @@ bool InsetCommand::string2params(string const & name, string const & data,
|
|||||||
// This happens when inset-insert is called without argument except for the
|
// This happens when inset-insert is called without argument except for the
|
||||||
// inset type; ex:
|
// inset type; ex:
|
||||||
// "inset-insert toc"
|
// "inset-insert toc"
|
||||||
|
string const name = insetName(params.code());
|
||||||
if (data == name)
|
if (data == name)
|
||||||
return true;
|
return true;
|
||||||
istringstream dstream(data);
|
istringstream dstream(data);
|
||||||
@ -245,12 +245,10 @@ bool InsetCommand::string2params(string const & name, string const & data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// FIXME This could take an InsetCode instead of a string
|
string InsetCommand::params2string(InsetCommandParams const & params)
|
||||||
string InsetCommand::params2string(string const & name,
|
|
||||||
InsetCommandParams const & params)
|
|
||||||
{
|
{
|
||||||
ostringstream data;
|
ostringstream data;
|
||||||
data << name << ' ';
|
data << insetName(params.code()) << ' ';
|
||||||
params.write(data);
|
params.write(data);
|
||||||
data << "\\end_inset\n";
|
data << "\\end_inset\n";
|
||||||
return data.str();
|
return data.str();
|
||||||
@ -273,7 +271,7 @@ bool decodeInsetParam(string const & name, string & data,
|
|||||||
case TOC_CODE:
|
case TOC_CODE:
|
||||||
case HYPERLINK_CODE: {
|
case HYPERLINK_CODE: {
|
||||||
InsetCommandParams p(code);
|
InsetCommandParams p(code);
|
||||||
data = InsetCommand::params2string(name, p);
|
data = InsetCommand::params2string(p);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case INCLUDE_CODE: {
|
case INCLUDE_CODE: {
|
||||||
@ -283,7 +281,7 @@ bool decodeInsetParam(string const & name, string & data,
|
|||||||
// default type is requested
|
// default type is requested
|
||||||
data = "include";
|
data = "include";
|
||||||
InsetCommandParams p(INCLUDE_CODE, data);
|
InsetCommandParams p(INCLUDE_CODE, data);
|
||||||
data = InsetCommand::params2string("include", p);
|
data = InsetCommand::params2string(p);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case BOX_CODE: {
|
case BOX_CODE: {
|
||||||
@ -299,7 +297,7 @@ bool decodeInsetParam(string const & name, string & data,
|
|||||||
}
|
}
|
||||||
case CITE_CODE: {
|
case CITE_CODE: {
|
||||||
InsetCommandParams p(CITE_CODE);
|
InsetCommandParams p(CITE_CODE);
|
||||||
data = InsetCommand::params2string(name, p);
|
data = InsetCommand::params2string(p);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ERT_CODE: {
|
case ERT_CODE: {
|
||||||
|
@ -46,14 +46,11 @@ public:
|
|||||||
///
|
///
|
||||||
InsetCommand const * asInsetCommand() const { return this; }
|
InsetCommand const * asInsetCommand() const { return this; }
|
||||||
|
|
||||||
|
|
||||||
/// \return true if params are successfully read
|
/// \return true if params are successfully read
|
||||||
static bool string2params(std::string const & name,
|
static bool string2params(std::string const & data,
|
||||||
std::string const & data,
|
|
||||||
InsetCommandParams &);
|
InsetCommandParams &);
|
||||||
///
|
///
|
||||||
static std::string params2string(std::string const & name,
|
static std::string params2string(InsetCommandParams const &);
|
||||||
InsetCommandParams const &);
|
|
||||||
///
|
///
|
||||||
InsetCommandParams const & params() const { return p_; }
|
InsetCommandParams const & params() const { return p_; }
|
||||||
///
|
///
|
||||||
|
@ -245,7 +245,7 @@ void InsetInclude::doDispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
InsetCommand::doDispatch(cur, cmd);
|
InsetCommand::doDispatch(cur, cmd);
|
||||||
p = params();
|
p = params();
|
||||||
} else
|
} else
|
||||||
InsetCommand::string2params("include", to_utf8(cmd.argument()), p);
|
InsetCommand::string2params(to_utf8(cmd.argument()), p);
|
||||||
if (!p.getCmdName().empty()) {
|
if (!p.getCmdName().empty()) {
|
||||||
if (isListings(p)){
|
if (isListings(p)){
|
||||||
InsetListingsParams new_params(to_utf8(p["lstparams"]));
|
InsetListingsParams new_params(to_utf8(p["lstparams"]));
|
||||||
|
@ -493,8 +493,7 @@ void InsetPrintIndex::doDispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
}
|
}
|
||||||
InsetCommandParams p(INDEX_PRINT_CODE);
|
InsetCommandParams p(INDEX_PRINT_CODE);
|
||||||
// FIXME UNICODE
|
// FIXME UNICODE
|
||||||
InsetCommand::string2params("index_print",
|
InsetCommand::string2params(to_utf8(cmd.argument()), p);
|
||||||
to_utf8(cmd.argument()), p);
|
|
||||||
if (p.getCmdName().empty()) {
|
if (p.getCmdName().empty()) {
|
||||||
cur.noScreenUpdate();
|
cur.noScreenUpdate();
|
||||||
break;
|
break;
|
||||||
@ -527,8 +526,7 @@ bool InsetPrintIndex::getStatus(Cursor & cur, FuncRequest const & cmd,
|
|||||||
} if (cmd.getArg(0) == "index_print"
|
} if (cmd.getArg(0) == "index_print"
|
||||||
&& cmd.getArg(1) == "CommandInset") {
|
&& cmd.getArg(1) == "CommandInset") {
|
||||||
InsetCommandParams p(INDEX_PRINT_CODE);
|
InsetCommandParams p(INDEX_PRINT_CODE);
|
||||||
InsetCommand::string2params("index_print",
|
InsetCommand::string2params(to_utf8(cmd.argument()), p);
|
||||||
to_utf8(cmd.argument()), p);
|
|
||||||
if (suffixIs(p.getCmdName(), '*')) {
|
if (suffixIs(p.getCmdName(), '*')) {
|
||||||
status.setEnabled(true);
|
status.setEnabled(true);
|
||||||
status.setOnOff(false);
|
status.setOnOff(false);
|
||||||
|
@ -192,7 +192,7 @@ void InsetLabel::doDispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
case LFUN_INSET_MODIFY: {
|
case LFUN_INSET_MODIFY: {
|
||||||
InsetCommandParams p(LABEL_CODE);
|
InsetCommandParams p(LABEL_CODE);
|
||||||
// FIXME UNICODE
|
// FIXME UNICODE
|
||||||
InsetCommand::string2params("label", to_utf8(cmd.argument()), p);
|
InsetCommand::string2params(to_utf8(cmd.argument()), p);
|
||||||
if (p.getCmdName().empty()) {
|
if (p.getCmdName().empty()) {
|
||||||
cur.noScreenUpdate();
|
cur.noScreenUpdate();
|
||||||
break;
|
break;
|
||||||
@ -214,7 +214,7 @@ void InsetLabel::doDispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
case LFUN_LABEL_INSERT_AS_REF: {
|
case LFUN_LABEL_INSERT_AS_REF: {
|
||||||
InsetCommandParams p(REF_CODE, "ref");
|
InsetCommandParams p(REF_CODE, "ref");
|
||||||
p["reference"] = getParam("name");
|
p["reference"] = getParam("name");
|
||||||
string const data = InsetCommand::params2string("ref", p);
|
string const data = InsetCommand::params2string(p);
|
||||||
lyx::dispatch(FuncRequest(LFUN_INSET_INSERT, data));
|
lyx::dispatch(FuncRequest(LFUN_INSET_INSERT, data));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -71,8 +71,7 @@ void InsetLine::doDispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
case LFUN_INSET_MODIFY: {
|
case LFUN_INSET_MODIFY: {
|
||||||
InsetCommandParams p(LINE_CODE);
|
InsetCommandParams p(LINE_CODE);
|
||||||
// FIXME UNICODE
|
// FIXME UNICODE
|
||||||
InsetCommand::string2params("line",
|
InsetCommand::string2params(to_utf8(cmd.argument()), p);
|
||||||
to_utf8(cmd.argument()), p);
|
|
||||||
if (p.getCmdName().empty()) {
|
if (p.getCmdName().empty()) {
|
||||||
cur.noScreenUpdate();
|
cur.noScreenUpdate();
|
||||||
break;
|
break;
|
||||||
|
@ -169,8 +169,7 @@ void InsetPrintNomencl::doDispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
case LFUN_INSET_MODIFY: {
|
case LFUN_INSET_MODIFY: {
|
||||||
InsetCommandParams p(NOMENCL_PRINT_CODE);
|
InsetCommandParams p(NOMENCL_PRINT_CODE);
|
||||||
// FIXME UNICODE
|
// FIXME UNICODE
|
||||||
InsetCommand::string2params("nomencl_print",
|
InsetCommand::string2params(to_utf8(cmd.argument()), p);
|
||||||
to_utf8(cmd.argument()), p);
|
|
||||||
if (p.getCmdName().empty()) {
|
if (p.getCmdName().empty()) {
|
||||||
cur.noScreenUpdate();
|
cur.noScreenUpdate();
|
||||||
break;
|
break;
|
||||||
|
@ -1318,7 +1318,7 @@ void InsetMathHull::doDispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
|
|
||||||
InsetCommandParams p(LABEL_CODE);
|
InsetCommandParams p(LABEL_CODE);
|
||||||
p["name"] = cmd.argument().empty() ? old_label : cmd.argument();
|
p["name"] = cmd.argument().empty() ? old_label : cmd.argument();
|
||||||
string const data = InsetCommand::params2string("label", p);
|
string const data = InsetCommand::params2string(p);
|
||||||
|
|
||||||
if (cmd.argument().empty())
|
if (cmd.argument().empty())
|
||||||
cur.bv().showDialog("label", data);
|
cur.bv().showDialog("label", data);
|
||||||
@ -1382,7 +1382,7 @@ void InsetMathHull::doDispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
string const name = cmd.getArg(0);
|
string const name = cmd.getArg(0);
|
||||||
if (name == "label") {
|
if (name == "label") {
|
||||||
InsetCommandParams p(LABEL_CODE);
|
InsetCommandParams p(LABEL_CODE);
|
||||||
InsetCommand::string2params(name, to_utf8(cmd.argument()), p);
|
InsetCommand::string2params(to_utf8(cmd.argument()), p);
|
||||||
docstring str = p["name"];
|
docstring str = p["name"];
|
||||||
cur.recordUndoInset();
|
cur.recordUndoInset();
|
||||||
row_type const r = (type_ == hullMultline) ? nrows() - 1 : cur.row();
|
row_type const r = (type_ == hullMultline) ? nrows() - 1 : cur.row();
|
||||||
|
@ -187,13 +187,13 @@ void InsetMathRef::updateBuffer(ParIterator const & it, UpdateType /*utype*/)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string const InsetMathRef::createDialogStr(string const & name) const
|
string const InsetMathRef::createDialogStr(string const & /*name*/) const
|
||||||
{
|
{
|
||||||
InsetCommandParams icp(REF_CODE, to_ascii(commandname()));
|
InsetCommandParams icp(REF_CODE, to_ascii(commandname()));
|
||||||
icp["reference"] = asString(cell(0));
|
icp["reference"] = asString(cell(0));
|
||||||
if (!cell(1).empty())
|
if (!cell(1).empty())
|
||||||
icp["name"] = asString(cell(1));
|
icp["name"] = asString(cell(1));
|
||||||
return InsetCommand::params2string(name, icp);
|
return InsetCommand::params2string(icp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -212,7 +212,7 @@ void InsetMathRef::changeTarget(docstring const & target)
|
|||||||
MathData ar;
|
MathData ar;
|
||||||
Buffer & buf = buffer();
|
Buffer & buf = buffer();
|
||||||
if (createInsetMath_fromDialogStr(
|
if (createInsetMath_fromDialogStr(
|
||||||
from_utf8(InsetCommand::params2string("ref", icp)), ar)) {
|
from_utf8(InsetCommand::params2string(icp)), ar)) {
|
||||||
*this = *ar[0].nucleus()->asRefInset();
|
*this = *ar[0].nucleus()->asRefInset();
|
||||||
// FIXME audit setBuffer calls
|
// FIXME audit setBuffer calls
|
||||||
setBuffer(buf);
|
setBuffer(buf);
|
||||||
|
@ -520,7 +520,7 @@ bool createInsetMath_fromDialogStr(docstring const & str, MathData & ar)
|
|||||||
if (name == "ref") {
|
if (name == "ref") {
|
||||||
InsetCommandParams icp(REF_CODE);
|
InsetCommandParams icp(REF_CODE);
|
||||||
// FIXME UNICODE
|
// FIXME UNICODE
|
||||||
InsetCommand::string2params("ref", to_utf8(str), icp);
|
InsetCommand::string2params(to_utf8(str), icp);
|
||||||
Encoding const * const utf8 = encodings.fromLyXName("utf8");
|
Encoding const * const utf8 = encodings.fromLyXName("utf8");
|
||||||
OutputParams op(utf8);
|
OutputParams op(utf8);
|
||||||
mathed_parse_cell(ar, icp.getCommand(op));
|
mathed_parse_cell(ar, icp.getCommand(op));
|
||||||
|
Loading…
Reference in New Issue
Block a user