On Thu, Nov 13, 2003 at 02:04:06PM +0000, Angus Leeming spake thusly:
> 
> Andre Poenitz wrote:
> 
> > On Thu, Nov 13, 2003 at 01:48:37PM +0000, Angus Leeming wrote:
> >> I am all in favour of the general thrust (to get things working)
> >> but would want LFUN_INSET_INSERT to be moved across too.
> >> Pleasssssssseeeeeee!
> > 
> > So why don't you just do it.
> > You are a big boy after all.
> 
> Because I'm busy with real work, don't have the source code to hand 
> and because Martin has posted his code for feedback. At least that's 
> why I post code to the list...
> 
> > Andre', off for a few days now.
> Have a good break.
> 
> -- 
> Angus

OK, here's my latest including a local LFUN_INSET_INSERT.

If no shout, I'll commit a bit later.

- Martin 

Index: BufferView_pimpl.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView_pimpl.C,v
retrieving revision 1.460
diff -u -p -r1.460 BufferView_pimpl.C
--- BufferView_pimpl.C  11 Nov 2003 13:17:26 -0000      1.460
+++ BufferView_pimpl.C  13 Nov 2003 14:23:20 -0000
@@ -1132,6 +1132,10 @@ bool BufferView::Pimpl::dispatch(FuncReq
                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);
@@ -1148,6 +1152,8 @@ bool BufferView::Pimpl::dispatch(FuncReq
        break;
 
        case LFUN_INSET_INSERT: {
+               // Same as above.
+               BOOST_ASSERT(false);
                InsetOld * inset = createInset(ev);
                if (!inset || !insertInset(inset))
                        delete inset;
Index: factory.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/factory.C,v
retrieving revision 1.69
diff -u -p -r1.69 factory.C
--- factory.C   12 Nov 2003 14:38:24 -0000      1.69
+++ factory.C   13 Nov 2003 14:23:20 -0000
@@ -285,19 +285,6 @@ InsetOld * createInset(FuncRequest const
                }
        }
 
-       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")
Index: text3.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text3.C,v
retrieving revision 1.177
diff -u -p -r1.177 text3.C
--- text3.C     12 Nov 2003 14:38:26 -0000      1.177
+++ text3.C     13 Nov 2003 14:23:20 -0000
@@ -992,6 +992,26 @@ DispatchResult LyXText::dispatch(FuncReq
                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;
@@ -1489,7 +1509,6 @@ DispatchResult LyXText::dispatch(FuncReq
        }
 
        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);
@@ -1497,10 +1516,16 @@ DispatchResult LyXText::dispatch(FuncReq
        }
 
        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;
        }
 

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to