On Wed, Nov 12, 2003 at 08:29:12AM +0000, Angus Leeming spake thusly:
> 
> [EMAIL PROTECTED] wrote:
> > Looks like just the other way around, in fact:
> 
> Sigh. I need a holiday to recover from the holiday.
> Ah well,
> -- 
> Angus

Angus,

sorry to disturb your ongoing holiday :-) but what's wrong with this
code (attached)? When I try to insert a label, it correctly creates a
little grey inset button and pops up the dialog, but when I enter
something and press "Apply" (or OK), out comes

---
LyXFunc::dispatch: cmd:  action: 236 arg: 'label LatexCommand
\label{abc}
\end_inset
' x: 0 y: 0

LCursor::dispatch: 

trying to dispatch to main text 0x08b00ce8
LyXText::dispatch: cmd:  action: 236 arg: 'label LatexCommand
\label{abc}
\end_inset
' x: 0 y: 0
INSET APPLY name:label
APPLY: no inset
LyXText::dispatch: cmd:  action: 237 arg: 'label' x: 0 y: 0
   result: 0
Redraw screen
dispatched by Cursor::dispatch()
BufferView::Pimpl::fitCursor.
---

It's the "APPLY: no inset" message I don't understand. There IS an
inset and it should be found, shouldn't it? 

- Martin

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     12 Nov 2003 15:33:39 -0000
@@ -992,6 +992,22 @@ DispatchResult LyXText::dispatch(FuncReq
                break;
        }
 
+       case LFUN_INSET_APPLY: {
+        string const name = cmd.getArg(0);
+               lyxerr << "INSET APPLY name:" << name << endl;
+               InsetBase * inset = bv->owner()->getDialogs().getOpenInset(name);
+               if (inset) {
+lyxerr << "APPLY: we have an inset" << endl;
+                       FuncRequest fr(bv, LFUN_INSET_MODIFY, name);
+                       inset->dispatch(fr);
+               } else {
+lyxerr << "APPLY: no inset" << endl;
+                       FuncRequest fr(bv, LFUN_INSET_INSERT, name);
+                       dispatch(fr);
+               }
+               break;
+       }
+
        case LFUN_INSET_SETTINGS:
                bv->cursor().innerInset()->showInsetDialog(bv);
                break;
@@ -1501,6 +1517,14 @@ DispatchResult LyXText::dispatch(FuncReq
                InsetCommandParams p("htmlurl");
                string const data = InsetCommandMailer::params2string("url", p);
                bv->owner()->getDialogs().show("url", data, 0);
+               break;
+       }
+
+       case LFUN_INSERT_LABEL: {
+               doInsertInset(this, cmd, true, false);
+               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