On Tue, Sep 02, 2003 at 03:39:49PM +0100, Angus Leeming spake thusly: > Martin Vermeer wrote: > You would invoke a new LFUN_INSET_SHOW_DIALOG. The code above should > be: > > switch (cmd.action) { > - case LFUN_INSET_EDIT: > - InsetCommandMailer("toc", *this).showDialog(cmd.view()); > + case LFUN_INSET_SHOW_DIALOG: > + case LFUN_MOUSE_RELEASE: > + if (buttonBox().contained(cmd.x, cmd.y)) > + InsetCommandMailer("toc", > *this).showDialog(cmd.view()); > > Ie, it's up to the inset to decide what to do on receipt of an LFUN. > In this particular case, clicking on the button will have the same > effect as an outside request that the dialog be opened. > > I think that Martin should now add the LFUN. OK... the instructions in lfuns.h are clear enough.
But lyxfunc/getStatus ... looks mysterious to me. Does the following look about right: Index: lyxfunc.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxfunc.C,v retrieving revision 1.480 diff -u -p -r1.480 lyxfunc.C --- lyxfunc.C 28 Aug 2003 07:41:14 -0000 1.480 +++ lyxfunc.C 2 Sep 2003 15:42:02 -0000 @@ -689,6 +689,19 @@ FuncStatus LyXFunc::getStatus(FuncReques if (!mathcursor) code = InsetOld::SPACE_CODE; break; + case LFUN_INSET_SHOW_DIALOG: { + LyXText * lt = view()->getLyXText(); + InsetOld * inset = lt->getInset(); + disable = !inset; + if (!disable) { + code = inset->lyxCode(); + if (!(code == InsetOld::INCLUDE_CODE + || code == InsetOld::BIBTEX_CODE + || code == InsetOld::TOC_CODE)) + disable = true; + } + } + break; default: break; } I.e., the command should only be valid if we are "on" an inset of the right type. Untested, groping my way forward... > -- > Angus > - Martin
pgp00000.pgp
Description: PGP signature