On Monday 19 August 2002 2:07 pm, Martin Vermeer wrote:
> On Mon, Aug 19, 2002 at 01:59:35PM +0200, Jean-Marc Lasgouttes wrote:
> > Finally, LFUN_INSET_SHORTTITLE should be disabled when it does not mke
> > sense.
>
> Good ideas welcome. It isn't *that* simple...
>
> Like this:
>
>
> Index: BufferView_pimpl.C
> ===================================================================
> RCS file: /cvs/lyx/lyx-devel/src/BufferView_pimpl.C,v
> retrieving revision 1.283
> diff -u -p -r1.283 BufferView_pimpl.C
> --- BufferView_pimpl.C        2002/08/18 17:15:23     1.283
> +++ BufferView_pimpl.C        2002/08/19 12:46:01
> @@ -1498,6 +1497,9 @@ bool BufferView::Pimpl::dispatch(FuncReq
>
>       LyXTextClass const & tclass = buffer_->params.getLyXTextClass();
>
> +     LyXText * lt = bv_->getLyXText();
> +     LyXLayout_ptr const & style = lt->cursor.par()->layout();
> +
>       switch (ev.action) {
>               // --- Misc -------------------------------------------
>       case LFUN_APPENDIX:
> @@ -2760,6 +2765,12 @@ bool BufferView::Pimpl::dispatch(FuncReq
>
>       case LFUN_INSERT_NOTE:
>               insertAndEditInset(new InsetNote(buffer_->params));
> +             break;
> +
> +     case LFUN_INSET_SHORTTITLE:
> +
> +             if (style->latexparam() == "void")
> +                     insertAndEditInset(new InsetShortTitle(buffer_->params));
>               break;
>
>       case LFUN_INSET_FLOAT:
>
>
> Works, but you can still change a Section layout to Standard without
> losing the inset...

You have two problems to address IMO.

1. When to enable/disable the insertion of an InsetShortTitle. You seem to be 
well on the way to resolving this cleanly.

2. What to do to an existing InsetShortTitle if the envronment is changed to 
one that does not allow it. Personally, I think you should convert the 
contents of the inset to LyXText and insert that in place of the inset.

Angus

Reply via email to