Satisfy JMarc and Lar's desire for LFUN_INSET_INSERT

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6577 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2003-03-25 21:27:07 +00:00
parent 16cba1f3ab
commit bd56331825
7 changed files with 53 additions and 20 deletions

View File

@ -1115,33 +1115,40 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev_in)
case LFUN_INSET_APPLY: {
string const name = ev.getArg(0);
InsetBase * base = owner_->getDialogs().getOpenInset(name);
if (base) {
InsetBase * inset = owner_->getDialogs().getOpenInset(name);
if (inset) {
// This works both for 'original' and 'mathed' insets.
// Note that the localDispatch performs updateInset
// also.
FuncRequest fr(bv_, LFUN_INSET_MODIFY, ev.argument);
base->localDispatch(fr);
inset->localDispatch(fr);
} else {
Inset * inset = createInset(ev);
if (inset && insertInset(inset)) {
updateInset(inset);
} else {
delete inset;
}
}
if (name == "bibitem") {
// We need to do a redraw because the maximum
// InsetBibitem width could have changed
#warning please check you mean repaint() not update(),
#warning and whether the repaint() is needed at all
bv_->repaint();
bv_->fitCursor();
FuncRequest fr(bv_, LFUN_INSET_INSERT, ev.argument);
dispatch(fr);
}
}
break;
case LFUN_INSET_INSERT: {
Inset * inset = createInset(ev);
if (inset && insertInset(inset)) {
updateInset(inset);
string const name = ev.getArg(0);
if (name == "bibitem") {
// We need to do a redraw because the maximum
// InsetBibitem width could have changed
#warning please check you mean repaint() not update(),
#warning and whether the repaint() is needed at all
bv_->repaint();
bv_->fitCursor();
}
} else {
delete inset;
}
}
break;
case LFUN_FLOAT_LIST:
if (tclass.floats().typeExist(ev.argument)) {
Inset * inset = new InsetFloatList(ev.argument);

View File

@ -1,3 +1,14 @@
2003-03-25 Angus Leeming <leeming@lyx.org>
* lfuns.h:
* LyXAction.C (init): new LFUN_INSET_INSERT.
* BufferView_pimpl.C (dispatch): split out part of the
LFUN_INSET_APPLY block LFUN_INSET_INSERT.
* factory.C (createInset): act on LFUN_INSET_INSERT rather than
LFUN_INSET_APPLY.
2003-03-25 Angus Leeming <leeming@lyx.org>
* lyxfunc.C (dispatch): changes to the Dialogs interface.

View File

@ -415,6 +415,7 @@ void LyXAction::init()
{ LFUN_DIALOG_DISCONNECT_INSET, "dialog-disconnect-inset",
N_("Disconnect the dialog from the current inset"), Noop },
{ LFUN_INSET_APPLY, "inset-apply", "", Noop },
{ LFUN_INSET_INSERT, "inset-insert", "", Noop },
{ LFUN_INSET_MODIFY, "", "internal only", Noop },
{ LFUN_INSET_DIALOG_UPDATE, "", "internal only", Noop },
{ LFUN_PARAGRAPH_APPLY, "paragraph-params-apply",

View File

@ -172,7 +172,7 @@ Inset * createInset(FuncRequest const & cmd)
return new InsetTheorem;
#endif
case LFUN_INSET_APPLY: {
case LFUN_INSET_INSERT: {
string const name = cmd.getArg(0);
if (name == "bibitem") {

View File

@ -1,3 +1,8 @@
2003-03-25 Angus Leeming <leeming@lyx.org>
* insetbibitem.C (localDispatch): repaint the view after modifying
a bibitem inset in case the maximum InsetBibitem width has changed.
2003-03-25 John Levon <levon@movementarian.org>
* insettext.C:

View File

@ -67,6 +67,14 @@ dispatch_result InsetBibitem::localDispatch(FuncRequest const & cmd)
setParams(p);
cmd.view()->updateInset(this);
// We need to do a redraw because the maximum
// InsetBibitem width could have changed
#warning please check you mean repaint() not update(),
#warning and whether the repaint() is needed at all
cmd.view()->repaint();
cmd.view()->fitCursor();
result = DISPATCHED;
}
break;

View File

@ -337,11 +337,12 @@ enum kb_action {
LFUN_DIALOG_DISCONNECT_INSET,
LFUN_INSET_APPLY,
// 260
LFUN_INSET_INSERT,
LFUN_INSET_MODIFY,
LFUN_INSET_DIALOG_UPDATE,
LFUN_PARAGRAPH_APPLY,
LFUN_PARAGRAPH_UPDATE,
// 265
LFUN_LASTACTION // end of the table
};