]> git.lyx.org Git - features.git/commitdiff
Satisfy JMarc and Lar's desire for LFUN_INSET_INSERT
authorAngus Leeming <leeming@lyx.org>
Tue, 25 Mar 2003 21:27:07 +0000 (21:27 +0000)
committerAngus Leeming <leeming@lyx.org>
Tue, 25 Mar 2003 21:27:07 +0000 (21:27 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6577 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView_pimpl.C
src/ChangeLog
src/LyXAction.C
src/factory.C
src/insets/ChangeLog
src/insets/insetbibitem.C
src/lfuns.h

index 233fedc29a0ef7f7866ba36599bbb925902dd02b..0577ee7ae95f8c506bd4d1a9d283ab03df6af37d 100644 (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;
-                       }
+                       FuncRequest fr(bv_, LFUN_INSET_INSERT, ev.argument);
+                       dispatch(fr);
                }
+       }
+       break;
 
-               if (name == "bibitem") {
-                       // We need to do a redraw because the maximum
-                       // InsetBibitem width could have changed
+       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();
+                               bv_->repaint();
+                               bv_->fitCursor();
+                       }
+               } else {
+                       delete inset;
                }
        }
        break;
-
+       
        case LFUN_FLOAT_LIST:
                if (tclass.floats().typeExist(ev.argument)) {
                        Inset * inset = new InsetFloatList(ev.argument);
index c93fd0c3da61b26cdcb109f979b20dad1b7d64b6..8c8e8575947e738dde881c7f70e949960276d872 100644 (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.
index 5bf1edd77938957da003e4bcca86c65b54f62cd6..25a5e76552c50c7607bc4d0241691cca80d9746c 100644 (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",
index c61872dd1a8e626279a7a9516e32daa25214be26..490bd0dabb73f49ec74d7d56fdcfb6f74a28abe3 100644 (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") {
index ad46449fb61b2b55f692b0c9c11b2bf46272e222..68f84e180fd7ec09f206fa4c5acea6db6ae3ab5c 100644 (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:
index 7fb54eec613fcb485124c5952919ed4c8e923d5d..5a91ffd8d5c108ed4dcc8384d1de8b57b8576dae 100644 (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;
index 31b8d325582390e1b2bef1a43bf5aa6f010a0bae..a871ce3c3bccd32e63df8448e8bbdd61071c5e61 100644 (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
 };