On Sun, 2005-12-04 at 20:09 +0100, Georg Baum wrote: > Am Sonntag, 4. Dezember 2005 18:38 schrieb Martin Vermeer: > > On Sun, Dec 04, 2005 at 06:11:50PM +0100, Georg Baum wrote: > > > I propose to simply disable the apply button of the dialog in > getStatus() > > > if inner box is unset and the box has more than one paragraph. > > > This is certainly not user friendly, but IMO better than a box that > has > > > multiple paragraphs on screen but only one in dvi. > > > > OK. Could you do that? (And perhaps also for ERT) > > I tried it, but it does not work because getStatus() is called without > proper parameters. > So I now propose to leave it as is for now and implement validators in the > frontends later.
I came up with the attached patch, which fixes 2136 and 2123. It prevents the entering of a paragraph break if we don't have an inner box. This solves at least the most common situation where people try to enter such a box from scratch, and it signals to the user that this is wrong. OK to commit? - Martin
Index: insetbox.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetbox.C,v retrieving revision 1.26 diff -u -p -r1.26 insetbox.C --- insetbox.C 3 Dec 2005 08:59:45 -0000 1.26 +++ insetbox.C 5 Dec 2005 12:02:35 -0000 @@ -163,6 +163,11 @@ void InsetBox::metrics(MetricsInfo & m, } +bool InsetBox::forceDefaultParagraphs(idx_type) const +{ + return !params_.inner_box; +} + bool InsetBox::showInsetDialog(BufferView * bv) const { InsetBoxMailer(const_cast<InsetBox &>(*this)).showDialog(bv); @@ -191,6 +196,13 @@ void InsetBox::doDispatch(LCursor & cur, break; } InsetCollapsable::doDispatch(cur, cmd); + break; + + case LFUN_BREAKPARAGRAPH: + if (params_.inner_box) + InsetCollapsable::doDispatch(cur, cmd); + else + cur.message(_("No paragraph break allowed here")); break; default: Index: insetbox.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetbox.h,v retrieving revision 1.18 diff -u -p -r1.18 insetbox.h --- insetbox.h 22 Apr 2005 08:57:21 -0000 1.18 +++ insetbox.h 5 Dec 2005 12:02:35 -0000 @@ -76,6 +76,10 @@ public: /// bool display() const { return false; } /// + bool forceDefaultParagraphs(idx_type) const; + /// + bool neverIndent() const { return true; } + /// int latex(Buffer const &, std::ostream &, OutputParams const &) const; ///
signature.asc
Description: This is a digitally signed message part