]> git.lyx.org Git - features.git/commitdiff
Martins and my getStatus and infoize fixes
authorGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Sun, 3 Apr 2005 12:07:49 +0000 (12:07 +0000)
committerGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Sun, 3 Apr 2005 12:07:49 +0000 (12:07 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9772 a592a061-630c-0410-9148-cb99ea01b6c8

12 files changed:
src/mathed/ChangeLog
src/mathed/math_amsarrayinset.C
src/mathed/math_amsarrayinset.h
src/mathed/math_arrayinset.C
src/mathed/math_casesinset.C
src/mathed/math_gridinset.C
src/mathed/math_splitinset.C
src/mathed/math_splitinset.h
src/mathed/math_substackinset.C
src/mathed/math_substackinset.h
src/mathed/math_tabularinset.C
src/mathed/math_tabularinset.h

index a48e87d78ebb594e0742dd8c94075fe493add1db..1a350f45ea5f9c3dffd5e734a4856927a41fdaa6 100644 (file)
@@ -1,3 +1,18 @@
+2005-03-31  Georg Baum  <Georg.Baum@post.rwth-aachen.de>
+
+       * math_amsarrayinset.[Ch], math_tabularinset.[Ch],
+       math_splitinset.[Ch] (infoize): implement
+       * math_casesinset.C (getStatus, doDispatch): use cmd.argument directly
+       * math_gridinset.C (getStatus): ditto
+       * math_arrayinset.C (infoize): generalize
+
+2005-03-30  Martin Vermeer  <martin.vermeer@hut.fi>
+
+       * math_amsarrayinset.[Ch] (getStatus):
+       * math_splitinset.[Ch] (getStatus):
+       * math_substackinset.[Ch]: suppress output of vertical gridlines
+       where appropriate
+
 2005-04-03  Martin Vermeer  <martin.vermeer@hut.fi>
 
        * math_fontinset.[Ch] (draw): add call to setPosCache, 
index 4acba92900884b75e8a82b059856ee03a72d84ee..dea483859ef0e44980363df7a58ff67ba566703d 100644 (file)
 #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"
+
+
 using std::string;
 using std::auto_ptr;
+using lyx::support::bformat;
 
 
 MathAMSArrayInset::MathAMSArrayInset(string const & name, int m, int n)
@@ -90,6 +99,27 @@ void MathAMSArrayInset::draw(PainterInfo & pi, int x, int y) const
 }
 
 
+bool MathAMSArrayInset::getStatus(LCursor & cur, FuncRequest const & cmd,
+               FuncStatus & flag) const
+{
+       switch (cmd.action) {
+       case LFUN_TABULAR_FEATURE: {
+               string const s = cmd.argument;
+               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_ << '}';
@@ -98,6 +128,14 @@ void MathAMSArrayInset::write(WriteStream & os) const
 }
 
 
+void MathAMSArrayInset::infoize(std::ostream & os) const
+{
+       string name = name_;
+       name[0] = lyx::support::uppercase(name[0]);
+       os << name << ' ';
+}
+
+
 void MathAMSArrayInset::normalize(NormalStream & os) const
 {
        os << '[' << name_ << ' ';
index 9f3901fe5407ddcb8f56f4f434e4163e0fdea11a..8ff70cbdc8b3f19197805e511ee39e2a56d5a31f 100644 (file)
@@ -31,9 +31,14 @@ 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;
        ///
        void validate(LaTeXFeatures & features) const;
index 6cbcd3a093861535da7b5fa21b47d54f4bdb7f33..8bc8b449ea561b733bc6e8948cc87d6a653ec058 100644 (file)
@@ -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 & os) const
 
 void MathArrayInset::infoize(std::ostream & os) const
 {
-       os << "Array";
+       string name = name_;
+       name[0] = lyx::support::uppercase(name[0]);
+       os << name << ' ';
 }
 
 
index 595a3d0790908fc9dd7e21bf50ab61f8e8b7417e..6c489ccddcab7a3c5a4e2c58abbcfa840e4d25ce 100644 (file)
@@ -24,7 +24,6 @@
 
 #include "support/lstrings.h"
 
-#include <sstream>
 
 using lyx::support::bformat;
 
@@ -32,7 +31,6 @@ using std::endl;
 using std::max;
 using std::min;
 using std::swap;
-using std::istringstream;
 using std::string;
 
 using std::auto_ptr;
@@ -71,9 +69,7 @@ void MathCasesInset::doDispatch(LCursor & cur, FuncRequest & cmd)
        switch (cmd.action) {
        case LFUN_TABULAR_FEATURE: {
                recordUndo(cur);
-               istringstream is(cmd.argument);
-               string s;
-               is >> s; 
+               string const s = cmd.argument;
                if (s == "add-vline-left" || s == "add-vline-right") {
                        cur.undispatched();
                        break;
@@ -90,9 +86,7 @@ bool MathCasesInset::getStatus(LCursor & cur, FuncRequest const & cmd,
 {
        switch (cmd.action) {
        case LFUN_TABULAR_FEATURE: {
-               istringstream is(cmd.argument);
-               string s;
-               is >> s;
+               string const s = cmd.argument;
                if (s == "add-vline-left" || s == "add-vline-right") {
                        flag.enabled(false);
                        flag.message(bformat(
index a07aaf39a0f4bc83a90f30a511d6ec9abc555f8b..e104f2cbc2423260706dc09d891681f4c84ec442 100644 (file)
@@ -1237,9 +1237,7 @@ bool MathGridInset::getStatus(LCursor & cur, FuncRequest const & cmd,
 {
        switch (cmd.action) {
        case LFUN_TABULAR_FEATURE: {
-               istringstream is(cmd.argument);
-               string s;
-               is >> s;
+               string const s = cmd.argument;
                if (nrows() <= 1 && (s == "delete-row" || s == "swap-row")) {
                        flag.enabled(false);
                        flag.message(N_("Only one row"));
index e903a04b8482ad0d9e9f5aa4fb47a45d2c84612b..5f5af3d87a1248975a632ce5e46591060205404b 100644 (file)
 #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"
+
+
+using lyx::support::bformat;
 using std::string;
 using std::auto_ptr;
 
@@ -47,6 +55,27 @@ char MathSplitInset::defaultColAlign(col_type col)
 }
 
 
+bool MathSplitInset::getStatus(LCursor & cur, FuncRequest const & cmd,
+               FuncStatus & flag) const
+{
+       switch (cmd.action) {
+       case LFUN_TABULAR_FEATURE: {
+               string const s = cmd.argument;
+               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())
@@ -57,3 +86,11 @@ void MathSplitInset::write(WriteStream & ws) const
                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 49faf48f4e4974844857e6eb38fa956db99ea44d..8df30022677b6ae6abaea91408064e105e452e84 100644 (file)
@@ -19,9 +19,15 @@ class MathSplitInset : public MathGridInset {
 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; }
        ///
        char defaultColAlign(col_type);
index b60e4898cc7802231d9e7169a14b678710897a29..1dd634d337b1ee41bb313db701acff16f31275a2 100644 (file)
 #include "math_mathmlstream.h"
 #include "support/std_ostream.h"
 
+#include "funcrequest.h"
+#include "FuncStatus.h"
+#include "gettext.h"
+
+#include "support/lstrings.h"
+
+
+using lyx::support::bformat;
+using std::string;
 using std::auto_ptr;
 
 
@@ -48,6 +57,27 @@ void MathSubstackInset::draw(PainterInfo & pi, int x, int y) const
 }
 
 
+bool MathSubstackInset::getStatus(LCursor & cur, FuncRequest const & cmd,
+               FuncStatus & flag) const
+{
+       switch (cmd.action) {
+       case LFUN_TABULAR_FEATURE: {
+               string const name("substack");
+               string const s = cmd.argument;
+               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 MathSubstackInset::infoize(std::ostream & os) const
 {
        os << "Substack ";
index ca84d21e5817d3159f379c07df692ac7d8a6845b..36f6a4209a26b2b824eef0d3280df1919f182942 100644 (file)
@@ -29,7 +29,8 @@ public:
        MathSubstackInset const * asSubstackInset() const { return this; }
 
        ///
-       void normalize();
+       bool getStatus(LCursor & cur, FuncRequest const & cmd,
+               FuncStatus & flag) const;
        ///
        void infoize(std::ostream & os) const;
        ///
index 78712160eb708282cecf92fdebf53262d5491551..e67203f2559160d33e6773c083e06fb9da615eb5 100644 (file)
@@ -15,6 +15,9 @@
 #include "math_mathmlstream.h"
 #include "math_streamstr.h"
 
+#include "support/lstrings.h"
+#include "support/std_ostream.h"
+
 #include <iterator>
 
 
@@ -79,6 +82,14 @@ void MathTabularInset::write(WriteStream & os) const
 }
 
 
+void MathTabularInset::infoize(std::ostream & os) const
+{
+       string name = name_;
+       name[0] = lyx::support::uppercase(name[0]);
+       os << name << ' ';
+}
+
+
 void MathTabularInset::normalize(NormalStream & os) const
 {
        os << '[' << name_ << ' ';
index e2476d246e5d6c44c64445777cf4674003bdebc0..469983dde2f7a7468f88abe6fd404f2cbaddaeaa 100644 (file)
@@ -37,6 +37,8 @@ public:
        ///
        void write(WriteStream & os) const;
        ///
+       void infoize(std::ostream & os) const;
+       ///
        void normalize(NormalStream &) const;
        ///
        void maple(MapleStream &) const;