]> git.lyx.org Git - features.git/commitdiff
read/write support for the AMS split environment
authorAndré Pönitz <poenitz@gmx.net>
Wed, 5 Sep 2001 12:57:13 +0000 (12:57 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Wed, 5 Sep 2001 12:57:13 +0000 (12:57 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2688 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/Makefile.am
src/mathed/math_gridinset.C
src/mathed/math_gridinset.h
src/mathed/math_matrixinset.C
src/mathed/math_matrixinset.h
src/mathed/math_parser.C
src/mathed/math_splitinset.C [new file with mode: 0644]
src/mathed/math_splitinset.h [new file with mode: 0644]

index 5ffdd9c7e5a0ec5482c973f0c97eee0c52be924a..06d0aafb913b23e4059ec048b99f8bfdbe5212f4 100644 (file)
@@ -80,6 +80,8 @@ libmathed_la_SOURCES = \
        math_spaceinset.h \
        math_specialcharinset.C \
        math_specialcharinset.h \
+       math_splitinset.C \
+       math_splitinset.h \
        math_sqrtinset.C \
        math_sqrtinset.h \
        math_stackrelinset.C \
index c5863e6811c8bea7aa094aa007d44927820cc348..daf70daa9628433ad95c6619ca3b74049257a440 100644 (file)
@@ -24,6 +24,7 @@ MathGridInset::RowInfo::RowInfo()
 {}
 
 
+
 int MathGridInset::RowInfo::skipPixels() const
 {
 #ifdef WITH_WARNINGS
@@ -46,10 +47,7 @@ MathGridInset::MathGridInset(int m, int n)
                lyxerr << "positve number of columns expected\n";
        if (n <= 0)
                lyxerr << "positve number of rows expected\n";
-       for (int col = 0; col < m; ++col) {
-               colinfo_[col].skip_  = defaultColSpace(col);
-               colinfo_[col].align_ = defaultColAlign(col);
-       }
+       setDefaults();
 }
 
 
@@ -59,6 +57,14 @@ int MathGridInset::index(int row, int col) const
 }
 
 
+void MathGridInset::setDefaults()
+{
+       for (int col = 0; col < ncols(); ++col) {
+               colinfo_[col].align_ = defaultColAlign(col);
+               colinfo_[col].skip_  = defaultColSpace(col);
+       }
+}
+
 
 void MathGridInset::halign(string const & hh)
 {
index b3af17a760e648691ac860b2c0a84fcdfd41af85..25555c1e9182f0abbfdf30d91124a41bcb40f4b9 100644 (file)
@@ -138,6 +138,8 @@ public:
        virtual int defaultColSpace(int) { return 10; }
        ///
        virtual char defaultColAlign(int) { return 'c'; }
+       ///
+       void setDefaults();
 
 protected:
        /// returns proper 'end of line' code for LaTeX
index 32f032b485e4af0597331ab79875b23b244dcbc4..0401b8ba174d5f01b70b3e133df79acaa836cab0 100644 (file)
@@ -108,15 +108,6 @@ int MathMatrixInset::defaultColSpace(int col)
 }
 
 
-void MathMatrixInset::setDefaults()
-{
-       for (int col = 0; col < ncols(); ++col) {
-               colinfo_[col].align_ = defaultColAlign(col);
-               colinfo_[col].skip_  = defaultColSpace(col);
-       }
-}
-
-
 void MathMatrixInset::metrics(MathStyles) const
 {
        size_ = (getType() == LM_OT_SIMPLE) ? LM_ST_TEXT : LM_ST_DISPLAY;
index d4e2b8ed58d002f108a656b839fa1a1a53a54c8d..0bacd405346cef6b274502d0663222b6be9e310b 100644 (file)
@@ -76,8 +76,6 @@ public:
        MathInsetTypes getType() const;
 
 private:
-       ///
-       void setDefaults();
        ///
        void setType(MathInsetTypes t);
        ///
index 1ae46225249283e139ff75540ed582bfd97324e8..ad0e5c011661beded2236e790e2496a267e61e31 100644 (file)
@@ -40,6 +40,7 @@
 #include "math_sqrtinset.h"
 #include "math_scriptinset.h"
 #include "math_specialcharinset.h"
+#include "math_splitinset.h"
 #include "math_sqrtinset.h"
 #include "debug.h"
 #include "support.h"
@@ -825,6 +826,10 @@ void Parser::parse_into(MathArray & array, unsigned flags, MathTextCodes code)
                                m->halign(halign);
                                parse_lines(m, false, false);
                                array.push_back(m);
+                       } else if (name == "split") {
+                               MathSplitInset * m = new MathSplitInset(1);
+                               parse_lines(m, false, false);
+                               array.push_back(m);
                        } else 
                                lyxerr[Debug::MATHED] << "unknow math inset begin '" << name << "'\n";  
                }
diff --git a/src/mathed/math_splitinset.C b/src/mathed/math_splitinset.C
new file mode 100644 (file)
index 0000000..e7b5c18
--- /dev/null
@@ -0,0 +1,31 @@
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include "math_splitinset.h"
+#include "support/LOstream.h"
+
+
+MathSplitInset::MathSplitInset(int n)
+       : MathGridInset(2, n)
+{
+       setDefaults();
+}
+
+
+MathInset * MathSplitInset::clone() const
+{
+       return new MathSplitInset(*this);
+}
+
+
+void MathSplitInset::write(std::ostream & os, bool fragile) const
+{
+       if (fragile)
+               os << "\\protect";
+       os << "\\begin{split}";
+       MathGridInset::write(os, fragile);
+       if (fragile)
+               os << "\\protect";
+       os << "\\end{split}\n";
+}
diff --git a/src/mathed/math_splitinset.h b/src/mathed/math_splitinset.h
new file mode 100644 (file)
index 0000000..2ef9348
--- /dev/null
@@ -0,0 +1,26 @@
+// -*- C++ -*-
+#ifndef MATH_SPLITINSET_H
+#define MATH_SPLITINSET_H
+
+#include "math_gridinset.h"
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+
+class MathSplitInset : public MathGridInset {
+public: 
+       ///
+       explicit MathSplitInset(int n);
+       ///
+       MathInset * clone() const;
+       ///
+       void write(std::ostream &, bool fragile) const;
+       ///
+       int defaultColSpace(int) { return 0; }
+       ///
+       char defaultColAlign(int) { return 'l'; }
+};
+
+#endif