Fix insertion/modification of button-style insets

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8083 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Martin Vermeer 2003-11-13 20:16:34 +00:00
parent 7771334a11
commit 3bc54f0645
4 changed files with 39 additions and 15 deletions

View File

@ -1098,6 +1098,10 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev_in)
break;
case LFUN_INSET_APPLY: {
#warning is this code ever called?
// Remove if not triggered. Mail lyx-devel if triggered.
// This code was replaced by code in text3.C.
BOOST_ASSERT(false);
string const name = ev.getArg(0);
InsetBase * inset = owner_->getDialogs().getOpenInset(name);
@ -1114,6 +1118,8 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev_in)
break;
case LFUN_INSET_INSERT: {
// Same as above.
BOOST_ASSERT(false);
InsetOld * inset = createInset(ev);
if (!inset || !insertInset(inset))
delete inset;

View File

@ -1,3 +1,9 @@
2003-11-13 Martin Vermeer <martin.vermeer@hut.fi>
* BufferView_pimpl.C:
* factory.C:
* text3.C: Fix the insertion and modification of button-style
insets
2003-11-13 André Pönitz <poenitz@gmx.net>

View File

@ -285,19 +285,6 @@ InsetOld * createInset(FuncRequest const & cmd)
}
}
case LFUN_INSERT_LABEL: {
InsetCommandParams icp;
InsetCommandMailer::string2params(cmd.argument, icp);
return new InsetLabel(icp);
}
case LFUN_URL:
case LFUN_HTMLURL: {
InsetCommandParams icp;
InsetCommandMailer::string2params(cmd.argument, icp);
return new InsetUrl(icp);
}
case LFUN_SPACE_INSERT: {
string const name = cmd.argument;
if (name == "normal")

View File

@ -989,6 +989,26 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd)
break;
}
case LFUN_INSET_APPLY: {
string const name = cmd.getArg(0);
InsetBase * inset = bv->owner()->getDialogs().getOpenInset(name);
if (inset) {
FuncRequest fr(bv, LFUN_INSET_MODIFY, cmd.argument);
inset->dispatch(fr);
} else {
FuncRequest fr(bv, LFUN_INSET_INSERT, cmd.argument);
dispatch(fr);
}
break;
}
case LFUN_INSET_INSERT: {
InsetOld * inset = createInset(cmd);
if (!inset || !bv->insertInset(inset))
delete inset;
break;
}
case LFUN_INSET_SETTINGS:
bv->cursor().innerInset()->showInsetDialog(bv);
break;
@ -1484,7 +1504,6 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd)
}
case LFUN_URL: {
doInsertInset(this, cmd, true, false);
InsetCommandParams p("url");
string const data = InsetCommandMailer::params2string("url", p);
bv->owner()->getDialogs().show("url", data, 0);
@ -1492,13 +1511,19 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd)
}
case LFUN_HTMLURL: {
doInsertInset(this, cmd, true, false);
InsetCommandParams p("htmlurl");
string const data = InsetCommandMailer::params2string("url", p);
bv->owner()->getDialogs().show("url", data, 0);
break;
}
case LFUN_INSERT_LABEL: {
InsetCommandParams p("label");
string const data = InsetCommandMailer::params2string("label", p);
bv->owner()->getDialogs().show("label", data, 0);
break;
}
#if 0
case LFUN_INSET_LIST: