From bd56331825e64dd5785b822cf4b2302d711ce0fa Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Tue, 25 Mar 2003 21:27:07 +0000 Subject: [PATCH] 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 --- src/BufferView_pimpl.C | 43 +++++++++++++++++++++++---------------- src/ChangeLog | 11 ++++++++++ src/LyXAction.C | 1 + src/factory.C | 2 +- src/insets/ChangeLog | 5 +++++ src/insets/insetbibitem.C | 8 ++++++++ src/lfuns.h | 3 ++- 7 files changed, 53 insertions(+), 20 deletions(-) diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index 233fedc29a..0577ee7ae9 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -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); diff --git a/src/ChangeLog b/src/ChangeLog index c93fd0c3da..8c8e857594 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,14 @@ +2003-03-25 Angus Leeming + + * 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 * lyxfunc.C (dispatch): changes to the Dialogs interface. diff --git a/src/LyXAction.C b/src/LyXAction.C index 5bf1edd779..25a5e76552 100644 --- a/src/LyXAction.C +++ b/src/LyXAction.C @@ -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", diff --git a/src/factory.C b/src/factory.C index c61872dd1a..490bd0dabb 100644 --- a/src/factory.C +++ b/src/factory.C @@ -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") { diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index ad46449fb6..68f84e180f 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,8 @@ +2003-03-25 Angus Leeming + + * insetbibitem.C (localDispatch): repaint the view after modifying + a bibitem inset in case the maximum InsetBibitem width has changed. + 2003-03-25 John Levon * insettext.C: diff --git a/src/insets/insetbibitem.C b/src/insets/insetbibitem.C index 7fb54eec61..5a91ffd8d5 100644 --- a/src/insets/insetbibitem.C +++ b/src/insets/insetbibitem.C @@ -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; diff --git a/src/lfuns.h b/src/lfuns.h index 31b8d32558..a871ce3c3b 100644 --- a/src/lfuns.h +++ b/src/lfuns.h @@ -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 };