Patch attached, please review. - Martin
Index: ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/ChangeLog,v retrieving revision 1.480 diff -u -r1.480 ChangeLog --- ChangeLog 30 Mar 2005 09:05:30 -0000 1.480 +++ ChangeLog 30 Mar 2005 11:29:02 -0000 @@ -1,3 +1,10 @@ +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: math_amsarrayinset.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_amsarrayinset.C,v retrieving revision 1.26 diff -u -r1.26 math_amsarrayinset.C --- math_amsarrayinset.C 30 Mar 2005 09:05:30 -0000 1.26 +++ math_amsarrayinset.C 30 Mar 2005 11:29:02 -0000 @@ -17,8 +17,18 @@ #include "math_streamstr.h" #include "math_support.h" +#include "funcrequest.h" +#include "FuncStatus.h" +#include "gettext.h" + +#include "support/lstrings.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) @@ -87,6 +97,29 @@ mathed_draw_deco(pi, x + 1, yy, 5, dim_.height(), name_left()); mathed_draw_deco(pi, x + dim_.width() - 6, yy, 5, dim_.height(), name_right()); setPosCache(pi, x, y); +} + + +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); + } } Index: math_amsarrayinset.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_amsarrayinset.h,v retrieving revision 1.19 diff -u -r1.19 math_amsarrayinset.h --- math_amsarrayinset.h 30 Mar 2005 09:05:30 -0000 1.19 +++ math_amsarrayinset.h 30 Mar 2005 11:29:02 -0000 @@ -32,6 +32,9 @@ MathAMSArrayInset const * asAMSArrayInset() const { return this; } /// + bool getStatus(LCursor & cur, FuncRequest const & cmd, + FuncStatus & flag) const; + /// void write(WriteStream & os) const; /// void normalize(NormalStream &) const; Index: math_splitinset.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_splitinset.C,v retrieving revision 1.15 diff -u -r1.15 math_splitinset.C --- math_splitinset.C 23 Nov 2004 23:04:52 -0000 1.15 +++ math_splitinset.C 30 Mar 2005 11:29:02 -0000 @@ -15,7 +15,16 @@ #include "math_mathmlstream.h" #include "math_streamstr.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; @@ -44,6 +53,29 @@ if (name_ == "alignedat") return (col & 1) ? 'l' : 'r'; return 'l'; +} + + +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); + } } Index: math_splitinset.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_splitinset.h,v retrieving revision 1.13 diff -u -r1.13 math_splitinset.h --- math_splitinset.h 23 Nov 2004 23:04:52 -0000 1.13 +++ math_splitinset.h 30 Mar 2005 11:29:02 -0000 @@ -19,7 +19,11 @@ public: /// explicit MathSplitInset(std::string const & name); + /// + bool getStatus(LCursor & cur, FuncRequest const & cmd, + FuncStatus & flag) const; + void write(WriteStream & os) const; /// int defaultColSpace(col_type) { return 0; } Index: math_substackinset.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_substackinset.C,v retrieving revision 1.19 diff -u -r1.19 math_substackinset.C --- math_substackinset.C 30 Mar 2005 09:05:30 -0000 1.19 +++ math_substackinset.C 30 Mar 2005 11:29:02 -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::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: math_substackinset.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_substackinset.h,v retrieving revision 1.15 diff -u -r1.15 math_substackinset.h --- math_substackinset.h 30 Mar 2005 09:05:30 -0000 1.15 +++ math_substackinset.h 30 Mar 2005 11:29:02 -0000 @@ -31,6 +31,9 @@ /// void normalize(); /// + bool getStatus(LCursor & cur, FuncRequest const & cmd, + FuncStatus & flag) const; + /// void infoize(std::ostream & os) const; /// void write(WriteStream & os) const;
signature.asc
Description: This is a digitally signed message part