mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-11 11:08:41 +00:00
Get LFUN_DIALOG_SHOW_NEW_INSET using InsetCode, too.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21025 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
3b3ac62e58
commit
f2418483a0
@ -1401,62 +1401,97 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
|||||||
case LFUN_DIALOG_SHOW_NEW_INSET: {
|
case LFUN_DIALOG_SHOW_NEW_INSET: {
|
||||||
BOOST_ASSERT(lyx_view_);
|
BOOST_ASSERT(lyx_view_);
|
||||||
string const name = cmd.getArg(0);
|
string const name = cmd.getArg(0);
|
||||||
|
InsetCode code = insetCode(name);
|
||||||
string data = trim(to_utf8(cmd.argument()).substr(name.size()));
|
string data = trim(to_utf8(cmd.argument()).substr(name.size()));
|
||||||
if (name == "bibitem" ||
|
bool insetCodeOK = true;
|
||||||
name == "bibtex" ||
|
switch (code) {
|
||||||
name == "index" ||
|
case BIBITEM_CODE:
|
||||||
name == "label" ||
|
case BIBTEX_CODE:
|
||||||
name == "nomenclature" ||
|
case INDEX_CODE:
|
||||||
name == "ref" ||
|
case LABEL_CODE:
|
||||||
name == "toc" ||
|
case NOMENCL_CODE:
|
||||||
name == "href") {
|
case REF_CODE:
|
||||||
|
case TOC_CODE:
|
||||||
|
case HYPERLINK_CODE: {
|
||||||
InsetCommandParams p(name);
|
InsetCommandParams p(name);
|
||||||
data = InsetCommandMailer::params2string(name, p);
|
data = InsetCommandMailer::params2string(name, p);
|
||||||
} else if (name == "include") {
|
break;
|
||||||
|
}
|
||||||
|
case INCLUDE_CODE: {
|
||||||
// data is the include type: one of "include",
|
// data is the include type: one of "include",
|
||||||
// "input", "verbatiminput" or "verbatiminput*"
|
// "input", "verbatiminput" or "verbatiminput*"
|
||||||
if (data.empty())
|
if (data.empty())
|
||||||
// default type is requested
|
// default type is requested
|
||||||
data = "include";
|
data = "include";
|
||||||
InsetCommandParams p(data);
|
InsetCommandParams p("include", data);
|
||||||
data = InsetIncludeMailer::params2string(p);
|
data = InsetIncludeMailer::params2string(p);
|
||||||
} else if (name == "box") {
|
break;
|
||||||
|
}
|
||||||
|
case BOX_CODE: {
|
||||||
// \c data == "Boxed" || "Frameless" etc
|
// \c data == "Boxed" || "Frameless" etc
|
||||||
InsetBoxParams p(data);
|
InsetBoxParams p(data);
|
||||||
data = InsetBoxMailer::params2string(p);
|
data = InsetBoxMailer::params2string(p);
|
||||||
} else if (name == "branch") {
|
break;
|
||||||
|
}
|
||||||
|
case BRANCH_CODE: {
|
||||||
InsetBranchParams p;
|
InsetBranchParams p;
|
||||||
data = InsetBranchMailer::params2string(p);
|
data = InsetBranchMailer::params2string(p);
|
||||||
} else if (name == "citation") {
|
break;
|
||||||
InsetCommandParams p("citation");
|
}
|
||||||
|
case CITE_CODE: {
|
||||||
|
InsetCommandParams p("cite");
|
||||||
data = InsetCommandMailer::params2string(name, p);
|
data = InsetCommandMailer::params2string(name, p);
|
||||||
} else if (name == "ert") {
|
break;
|
||||||
|
}
|
||||||
|
case ERT_CODE: {
|
||||||
data = InsetERTMailer::params2string(InsetCollapsable::Open);
|
data = InsetERTMailer::params2string(InsetCollapsable::Open);
|
||||||
} else if (name == "external") {
|
break;
|
||||||
|
}
|
||||||
|
case EXTERNAL_CODE: {
|
||||||
InsetExternalParams p;
|
InsetExternalParams p;
|
||||||
Buffer const & buffer = *lyx_view_->buffer();
|
Buffer const & buffer = *lyx_view_->buffer();
|
||||||
data = InsetExternalMailer::params2string(p, buffer);
|
data = InsetExternalMailer::params2string(p, buffer);
|
||||||
} else if (name == "float") {
|
break;
|
||||||
|
}
|
||||||
|
case FLOAT_CODE: {
|
||||||
InsetFloatParams p;
|
InsetFloatParams p;
|
||||||
data = InsetFloatMailer::params2string(p);
|
data = InsetFloatMailer::params2string(p);
|
||||||
} else if (name == "listings") {
|
break;
|
||||||
|
}
|
||||||
|
case LISTINGS_CODE: {
|
||||||
InsetListingsParams p;
|
InsetListingsParams p;
|
||||||
data = InsetListingsMailer::params2string(p);
|
data = InsetListingsMailer::params2string(p);
|
||||||
} else if (name == "graphics") {
|
break;
|
||||||
|
}
|
||||||
|
case GRAPHICS_CODE: {
|
||||||
InsetGraphicsParams p;
|
InsetGraphicsParams p;
|
||||||
Buffer const & buffer = *lyx_view_->buffer();
|
Buffer const & buffer = *lyx_view_->buffer();
|
||||||
data = InsetGraphicsMailer::params2string(p, buffer);
|
data = InsetGraphicsMailer::params2string(p, buffer);
|
||||||
} else if (name == "note") {
|
break;
|
||||||
|
}
|
||||||
|
case NOTE_CODE: {
|
||||||
InsetNoteParams p;
|
InsetNoteParams p;
|
||||||
data = InsetNoteMailer::params2string(p);
|
data = InsetNoteMailer::params2string(p);
|
||||||
} else if (name == "vspace") {
|
break;
|
||||||
|
}
|
||||||
|
case VSPACE_CODE: {
|
||||||
VSpace space;
|
VSpace space;
|
||||||
data = InsetVSpaceMailer::params2string(space);
|
data = InsetVSpaceMailer::params2string(space);
|
||||||
} else if (name == "wrap") {
|
break;
|
||||||
|
}
|
||||||
|
case WRAP_CODE: {
|
||||||
InsetWrapParams p;
|
InsetWrapParams p;
|
||||||
data = InsetWrapMailer::params2string(p);
|
data = InsetWrapMailer::params2string(p);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
lyx_view_->getDialogs().show(name, data, 0);
|
default:
|
||||||
|
lyxerr << "Inset type '" << name <<
|
||||||
|
"' not recognized in LFUN_DIALOG_SHOW_NEW_INSET" << std:: endl;
|
||||||
|
insetCodeOK = false;
|
||||||
|
break;
|
||||||
|
} // end switch(code)
|
||||||
|
if (insetCodeOK)
|
||||||
|
lyx_view_->getDialogs().show(name, data, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1508,7 +1543,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
|||||||
arg = token(argument, '|', 0);
|
arg = token(argument, '|', 0);
|
||||||
opt1 = token(argument, '|', 1);
|
opt1 = token(argument, '|', 1);
|
||||||
}
|
}
|
||||||
InsetCommandParams icp("citation");
|
InsetCommandParams icp("cite");
|
||||||
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);
|
||||||
|
Loading…
Reference in New Issue
Block a user