On Mon, 2005-12-05 at 14:14 +0100, Jean-Marc Lasgouttes wrote:
> >>>>> "Martin" == Martin Vermeer <[EMAIL PROTECTED]> writes:
> 
> Martin> I came up with the attached patch, which fixes 2136 and 2123.
> 
> Martin> It prevents the entering of a paragraph break if we don't have
> Martin> an inner box. This solves at least the most common situation
> Martin> where people try to enter such a box from scratch, and it
> Martin> signals to the user that this is wrong.
> 
> Martin> OK to commit?
> 
> If you are going to do that, it would be better to do it in getStatus
> (where you can output the message too).
> 
> Personally, any solution around this is OK.

Committed the attached (plus changelog)

- 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 14:54:42 -0000
@@ -163,6 +163,12 @@ 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);
@@ -209,6 +215,13 @@ bool InsetBox::getStatus(LCursor & cur, 
 	case LFUN_INSET_DIALOG_UPDATE:
 		flag.enabled(true);
 		return true;
+	case LFUN_BREAKPARAGRAPH:
+		if (params_.inner_box) {
+			return InsetCollapsable::getStatus(cur, cmd, flag);
+		} else {
+			flag.enabled(false);
+			return true;
+		}
 
 	default:
 		return InsetCollapsable::getStatus(cur, cmd, flag);
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 14:54:42 -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;
 	///

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to