On Sun, Dec 04, 2005 at 08:09:43PM +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 got the attached to work, but I may have misunderstood you. I'm not happy with the result. - 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 4 Dec 2005 20:42:41 -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);
@@ -207,7 +212,11 @@ bool InsetBox::getStatus(LCursor & cur,
case LFUN_INSET_MODIFY:
case LFUN_INSET_DIALOG_UPDATE:
- flag.enabled(true);
+ if (!params_.inner_box
+ && cur.text()->paragraphs().size() > 1)
+ flag.enabled(false);
+ else
+ flag.enabled(true);
return true;
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 4 Dec 2005 20:42:41 -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;
///
pgpvVZNFqe6A2.pgp
Description: PGP signature
