Martin Vermeer wrote:

> 
> Patch attached, please review.

It looks good, except for the strange indentation of some closing braces. I
corrected that and merged it with my infoize fixes. I think that both
should go in.


Georg
Index: src/mathed/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/ChangeLog,v
retrieving revision 1.480
diff -u -p -r1.480 ChangeLog
--- src/mathed/ChangeLog	30 Mar 2005 09:05:30 -0000	1.480
+++ src/mathed/ChangeLog	30 Mar 2005 11:59:58 -0000
@@ -1,3 +1,16 @@
+2005-03-30  Georg Baum  <[EMAIL PROTECTED]>
+
+	* math_amsarrayinset.[Ch], math_tabularinset.[Ch],
+	math_splitinset.[Ch] (infoize): implement
+	* math_arrayinset.C (infoize): generalize
+
+2005-03-30  Martin Vermeer  <[EMAIL PROTECTED]>
+
+	* math_amsarrayinset.[Ch] (getStatus):
+	* math_splitinset.[Ch] (getStatus):
+	* math_substackinset.[Ch]: suppress output of vertical gridlines
+	where appropriate 
+
 2005-03-27  Georg Baum  <[EMAIL PROTECTED]>
 
 	* math_amsarrayinset.[Ch] (validate): new, require amsmath
Index: src/mathed/math_amsarrayinset.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_amsarrayinset.C,v
retrieving revision 1.26
diff -u -p -r1.26 math_amsarrayinset.C
--- src/mathed/math_amsarrayinset.C	30 Mar 2005 09:05:30 -0000	1.26
+++ src/mathed/math_amsarrayinset.C	30 Mar 2005 11:59:58 -0000
@@ -17,8 +17,20 @@
 #include "math_streamstr.h"
 #include "math_support.h"
+
+#include "funcrequest.h"
+#include "FuncStatus.h"
+#include "gettext.h"
+
+#include "support/lstrings.h"
+#include "support/std_ostream.h"
+
+#include <sstream>
+
 
 using std::string;
+using std::istringstream;
 using std::auto_ptr;
+using lyx::support::bformat;
 
 
 MathAMSArrayInset::MathAMSArrayInset(string const & name, int m, int n)
@@ -90,11 +104,42 @@ void MathAMSArrayInset::draw(PainterInfo
 }
 
 
+bool MathAMSArrayInset::getStatus(LCursor & cur, FuncRequest const & cmd,
+		FuncStatus & flag) const
+{
+	switch (cmd.action) {
+	case LFUN_TABULAR_FEATURE: {
+		istringstream is(cmd.argument);
+		string s;
+		is >> s;
+		if (s == "add-vline-left" || s == "add-vline-right") {
+			flag.message(bformat(
+			N_("Can't add vertical grid lines in '%1$s'"),
+				name_));
+			flag.enabled(false);
+			return true;
+		}
+		return MathGridInset::getStatus(cur, cmd, flag);
+	}
+	default:
+		return MathGridInset::getStatus(cur, cmd, flag);
+        }
+}
+
+
 void MathAMSArrayInset::write(WriteStream & os) const
 {
 	os << "\\begin{" << name_ << '}';
 	MathGridInset::write(os);
 	os << "\\end{" << name_ << '}';
+}
+
+
+void MathAMSArrayInset::infoize(std::ostream & os) const
+{
+	string name = name_;
+	name[0] = lyx::support::uppercase(name[0]);
+	os << name << ' ';
 }
 
 
Index: src/mathed/math_amsarrayinset.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_amsarrayinset.h,v
retrieving revision 1.19
diff -u -p -r1.19 math_amsarrayinset.h
--- src/mathed/math_amsarrayinset.h	30 Mar 2005 09:05:30 -0000	1.19
+++ src/mathed/math_amsarrayinset.h	30 Mar 2005 11:59:58 -0000
@@ -32,7 +32,12 @@ public:
 	MathAMSArrayInset const * asAMSArrayInset() const { return this; }
 
 	///
+	bool getStatus(LCursor & cur, FuncRequest const & cmd,
+		FuncStatus & flag) const;
+	///
 	void write(WriteStream & os) const;
+	///
+	void infoize(std::ostream & os) const;
 	///
 	void normalize(NormalStream &) const;
 	///
Index: src/mathed/math_arrayinset.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_arrayinset.C,v
retrieving revision 1.56
diff -u -p -r1.56 math_arrayinset.C
--- src/mathed/math_arrayinset.C	30 Mar 2005 09:05:30 -0000	1.56
+++ src/mathed/math_arrayinset.C	30 Mar 2005 11:59:58 -0000
@@ -17,6 +17,8 @@
 #include "math_mathmlstream.h"
 #include "math_streamstr.h"
 
+#include "support/lstrings.h"
+
 #include <iterator>
 #include <sstream>
 
@@ -113,7 +115,9 @@ void MathArrayInset::write(WriteStream &
 
 void MathArrayInset::infoize(std::ostream & os) const
 {
-	os << "Array";
+	string name = name_;
+	name[0] = lyx::support::uppercase(name[0]);
+	os << name << ' ';
 }
 
 
Index: src/mathed/math_splitinset.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_splitinset.C,v
retrieving revision 1.15
diff -u -p -r1.15 math_splitinset.C
--- src/mathed/math_splitinset.C	23 Nov 2004 23:04:52 -0000	1.15
+++ src/mathed/math_splitinset.C	30 Mar 2005 11:59:59 -0000
@@ -15,7 +15,18 @@
 #include "math_mathmlstream.h"
 #include "math_streamstr.h"
 
+#include "funcrequest.h"
+#include "FuncStatus.h"
+#include "gettext.h"
+
+#include "support/lstrings.h"
+#include "support/std_ostream.h"
 
+#include <sstream>
+
+
+using std::istringstream;
+using lyx::support::bformat;
 using std::string;
 using std::auto_ptr;
 
@@ -47,6 +59,29 @@ char MathSplitInset::defaultColAlign(col
 }
 
 
+bool MathSplitInset::getStatus(LCursor & cur, FuncRequest const & cmd,
+		FuncStatus & flag) const
+{
+	switch (cmd.action) {
+	case LFUN_TABULAR_FEATURE: {
+		istringstream is(cmd.argument);
+		string s;
+		is >> s;
+		if (s == "add-vline-left" || s == "add-vline-right") {
+			flag.message(bformat(
+			N_("Can't add vertical grid lines in '%1$s'"),
+				name_));
+			flag.enabled(false);
+			return true;
+		}
+		return MathGridInset::getStatus(cur, cmd, flag);
+	}
+	default:
+		return MathGridInset::getStatus(cur, cmd, flag);
+	}
+}
+
+
 void MathSplitInset::write(WriteStream & ws) const
 {
 	if (ws.fragile())
@@ -56,4 +91,12 @@ void MathSplitInset::write(WriteStream &
 	if (ws.fragile())
 		ws << "\\protect";
 	ws << "\\end{" << name_ << "}\n";
+}
+
+
+void MathSplitInset::infoize(std::ostream & os) const
+{
+	string name = name_;
+	name[0] = lyx::support::uppercase(name[0]);
+	os << name << ' ';
 }
Index: src/mathed/math_splitinset.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_splitinset.h,v
retrieving revision 1.13
diff -u -p -r1.13 math_splitinset.h
--- src/mathed/math_splitinset.h	23 Nov 2004 23:04:52 -0000	1.13
+++ src/mathed/math_splitinset.h	30 Mar 2005 11:59:59 -0000
@@ -19,8 +19,14 @@ class MathSplitInset : public MathGridIn
 public:
 	///
 	explicit MathSplitInset(std::string const & name);
+
 	///
+	bool getStatus(LCursor & cur, FuncRequest const & cmd,
+		FuncStatus & flag) const;
+
 	void write(WriteStream & os) const;
+	///
+	void infoize(std::ostream & os) const;
 	///
 	int defaultColSpace(col_type) { return 0; }
 	///
Index: src/mathed/math_substackinset.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_substackinset.C,v
retrieving revision 1.19
diff -u -p -r1.19 math_substackinset.C
--- src/mathed/math_substackinset.C	30 Mar 2005 09:05:30 -0000	1.19
+++ src/mathed/math_substackinset.C	30 Mar 2005 11:59:59 -0000
@@ -16,6 +16,17 @@
 #include "math_mathmlstream.h"
 #include "support/std_ostream.h"
 
+#include "funcrequest.h"
+#include "FuncStatus.h"
+#include "gettext.h"
+
+#include "support/lstrings.h"
+
+#include <sstream>
+
+using std::istringstream;
+using lyx::support::bformat;
+using std::string;
 using std::auto_ptr;
 
 
@@ -45,6 +56,29 @@ void MathSubstackInset::metrics(MetricsI
 void MathSubstackInset::draw(PainterInfo & pi, int x, int y) const
 {
 	MathGridInset::draw(pi, x + 1, y);
+}
+
+
+bool MathSubstackInset::getStatus(LCursor & cur, FuncRequest const & cmd,
+		FuncStatus & flag) const
+{
+	switch (cmd.action) {
+	case LFUN_TABULAR_FEATURE: {
+		istringstream is(cmd.argument);
+		string const name("substack");
+		string s;
+		is >> s;
+		if (s == "add-vline-left" || s == "add-vline-right") {
+			flag.message(bformat(
+			N_("Can't add vertical grid lines in '%1$s'"), name));
+			flag.enabled(false);
+			return true;
+		}
+		return MathGridInset::getStatus(cur, cmd, flag);
+	}
+	default:
+		return MathGridInset::getStatus(cur, cmd, flag);
+	}
 }
 
 
Index: src/mathed/math_substackinset.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_substackinset.h,v
retrieving revision 1.15
diff -u -p -r1.15 math_substackinset.h
--- src/mathed/math_substackinset.h	30 Mar 2005 09:05:30 -0000	1.15
+++ src/mathed/math_substackinset.h	30 Mar 2005 11:59:59 -0000
@@ -31,6 +31,9 @@ public:
 	///
 	void normalize();
 	///
+	bool getStatus(LCursor & cur, FuncRequest const & cmd,
+		FuncStatus & flag) const;
+	///
 	void infoize(std::ostream & os) const;
 	///
 	void write(WriteStream & os) const;
Index: src/mathed/math_tabularinset.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_tabularinset.C,v
retrieving revision 1.13
diff -u -p -r1.13 math_tabularinset.C
--- src/mathed/math_tabularinset.C	23 Nov 2004 23:04:52 -0000	1.13
+++ src/mathed/math_tabularinset.C	30 Mar 2005 11:59:59 -0000
@@ -15,6 +15,9 @@
 #include "math_mathmlstream.h"
 #include "math_streamstr.h"
 
+#include "support/lstrings.h"
+#include "support/std_ostream.h"
+
 #include <iterator>
 
 
@@ -76,6 +79,14 @@ void MathTabularInset::write(WriteStream
 	os << "\\end{" << name_ << '}';
 	// adding a \n here is bad if the tabular is the last item
 	// in an \eqnarray...
+}
+
+
+void MathTabularInset::infoize(std::ostream & os) const
+{
+	string name = name_;
+	name[0] = lyx::support::uppercase(name[0]);
+	os << name << ' ';
 }
 
 
Index: src/mathed/math_tabularinset.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_tabularinset.h,v
retrieving revision 1.9
diff -u -p -r1.9 math_tabularinset.h
--- src/mathed/math_tabularinset.h	23 Nov 2004 23:04:52 -0000	1.9
+++ src/mathed/math_tabularinset.h	30 Mar 2005 11:59:59 -0000
@@ -37,6 +37,8 @@ public:
 	///
 	void write(WriteStream & os) const;
 	///
+	void infoize(std::ostream & os) const;
+	///
 	void normalize(NormalStream &) const;
 	///
 	void maple(MapleStream &) const;

Reply via email to