]> git.lyx.org Git - lyx.git/commitdiff
rename MathArray into MathData
authorAndré Pönitz <poenitz@gmx.net>
Thu, 26 Apr 2007 16:05:57 +0000 (16:05 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Thu, 26 Apr 2007 16:05:57 +0000 (16:05 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18043 a592a061-630c-0410-9148-cb99ea01b6c8

82 files changed:
src/mathed/CommandInset.cpp
src/mathed/InsetMath.cpp
src/mathed/InsetMath.h
src/mathed/InsetMathAMSArray.cpp
src/mathed/InsetMathArray.cpp
src/mathed/InsetMathBinom.cpp
src/mathed/InsetMathBoldSymbol.cpp
src/mathed/InsetMathBox.cpp
src/mathed/InsetMathBoxed.cpp
src/mathed/InsetMathBrace.cpp
src/mathed/InsetMathBrace.h
src/mathed/InsetMathCases.cpp
src/mathed/InsetMathColor.cpp
src/mathed/InsetMathComment.cpp
src/mathed/InsetMathDFrac.cpp
src/mathed/InsetMathDecoration.cpp
src/mathed/InsetMathDelim.cpp
src/mathed/InsetMathDelim.h
src/mathed/InsetMathDiff.cpp
src/mathed/InsetMathDiff.h
src/mathed/InsetMathEnv.cpp
src/mathed/InsetMathExFunc.cpp
src/mathed/InsetMathExFunc.h
src/mathed/InsetMathExInt.cpp
src/mathed/InsetMathFBox.cpp
src/mathed/InsetMathFont.cpp
src/mathed/InsetMathFontOld.cpp
src/mathed/InsetMathFrac.cpp
src/mathed/InsetMathFracBase.cpp
src/mathed/InsetMathFrameBox.cpp
src/mathed/InsetMathGrid.cpp
src/mathed/InsetMathHull.cpp
src/mathed/InsetMathLefteqn.cpp
src/mathed/InsetMathLim.cpp
src/mathed/InsetMathLim.h
src/mathed/InsetMathMBox.cpp
src/mathed/InsetMathMakebox.cpp
src/mathed/InsetMathMatrix.cpp
src/mathed/InsetMathNest.cpp
src/mathed/InsetMathNest.h
src/mathed/InsetMathOverset.cpp
src/mathed/InsetMathPar.cpp
src/mathed/InsetMathPar.h
src/mathed/InsetMathRef.cpp
src/mathed/InsetMathRoot.cpp
src/mathed/InsetMathScript.cpp
src/mathed/InsetMathScript.h
src/mathed/InsetMathSize.cpp
src/mathed/InsetMathSpace.cpp
src/mathed/InsetMathSplit.cpp
src/mathed/InsetMathSqrt.cpp
src/mathed/InsetMathStackrel.cpp
src/mathed/InsetMathSubstack.cpp
src/mathed/InsetMathTFrac.cpp
src/mathed/InsetMathTabular.cpp
src/mathed/InsetMathUnderset.cpp
src/mathed/InsetMathXArrow.cpp
src/mathed/InsetMathXYArrow.cpp
src/mathed/InsetMathXYArrow.h
src/mathed/Makefile.am
src/mathed/MathArray.cpp [deleted file]
src/mathed/MathArray.h [deleted file]
src/mathed/MathAutoCorrect.cpp
src/mathed/MathData.cpp [new file with mode: 0644]
src/mathed/MathData.h [new file with mode: 0644]
src/mathed/MathExtern.cpp
src/mathed/MathExtern.h
src/mathed/MathFactory.cpp
src/mathed/MathFactory.h
src/mathed/MathMacro.cpp
src/mathed/MathMacro.h
src/mathed/MathMacroTable.cpp
src/mathed/MathMacroTable.h
src/mathed/MathMacroTemplate.cpp
src/mathed/MathMacroTemplate.h
src/mathed/MathParser.cpp
src/mathed/MathParser.h
src/mathed/MathStream.cpp
src/mathed/MathStream.h
src/mathed/MathSupport.cpp
src/mathed/MathSupport.h
src/mathed/ReplaceData.h

index a9529b5f3c2cf81a00d05f88b8462824379f945d..303ca931cac57f294987b48a92003e797e5cdcbc 100644 (file)
@@ -11,7 +11,7 @@
 #include <config.h>
 
 #include "CommandInset.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathStream.h"
 #include "DispatchResult.h"
 #include "FuncRequest.h"
index 6e06d34fc8b38d9c121f5ef6d139499c29d9d9c1..9be69abbaaca077dc7452718a240d7693e6b5637 100644 (file)
@@ -12,7 +12,7 @@
 #include <config.h>
 
 #include "InsetMath.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathStream.h"
 #include "gettext.h"
 #include "debug.h"
@@ -28,17 +28,17 @@ namespace lyx {
 
 
 
-MathArray & InsetMath::cell(idx_type)
+MathData & InsetMath::cell(idx_type)
 {
-       static MathArray dummyCell;
+       static MathData dummyCell;
        lyxerr << BOOST_CURRENT_FUNCTION << ": I don't have any cell" << endl;
        return dummyCell;
 }
 
 
-MathArray const & InsetMath::cell(idx_type) const
+MathData const & InsetMath::cell(idx_type) const
 {
-       static MathArray dummyCell;
+       static MathData dummyCell;
        lyxerr << BOOST_CURRENT_FUNCTION << ": I don't have any cell" << endl;
        return dummyCell;
 }
index f0c615f448e098d30907c307e23a7fad6e695db9..aeaebb9d9a812d2c3227902d91405acbdbafc707 100644 (file)
@@ -13,7 +13,7 @@
 #ifndef MATH_INSET_H
 #define MATH_INSET_H
 
-#include "MathArray.h"
+#include "MathData.h"
 
 #include "insets/InsetBase.h"
 
@@ -104,9 +104,9 @@ public:
        virtual void drawT(TextPainter &, int x, int y) const;
 
        /// return cell given its number
-       virtual MathArray & cell(idx_type);
+       virtual MathData & cell(idx_type);
        /// return cell given its number
-       virtual MathArray const & cell(idx_type) const;
+       virtual MathData const & cell(idx_type) const;
 
        /// identifies certain types of insets
        virtual InsetMathAMSArray       * asAMSArrayInset()       { return 0; }
@@ -161,7 +161,7 @@ public:
        /// replace things by other things
        virtual void replace(ReplaceData &) {}
        /// do we contain a given subsequence?
-       virtual bool contains(MathArray const &) const { return false; }
+       virtual bool contains(MathData const &) const { return false; }
        /// access to the lock (only nest array have one)
        virtual bool lock() const { return false; }
        /// access to the lock (only nest array have one)
index 7e8bbfce79ecd5450b9c646a1078f965233ed34e..4ccd56c2fc6b94cf9a6fb73fac4e9d9f31cfb90b 100644 (file)
@@ -12,7 +12,7 @@
 
 #include "LaTeXFeatures.h"
 #include "InsetMathAMSArray.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathStream.h"
 #include "MathStream.h"
 #include "MathSupport.h"
index da7d3183c35ba08b0f1cf7cc110f515c496bc1e9..8732f50c9cb4cae17b8135b49ef7340f992a507f 100644 (file)
@@ -12,7 +12,7 @@
 
 #include "LaTeXFeatures.h"
 #include "InsetMathArray.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathParser.h"
 #include "MathStream.h"
 
index 17ec145390edfd75e0aff7da3cc39604ae3b77c1..0a08e7bea356a107b4ff1b5056fa2d4b31686b86 100644 (file)
@@ -11,7 +11,7 @@
 #include <config.h>
 
 #include "InsetMathBinom.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathSupport.h"
 #include "MathStream.h"
 
index 3a82b02b109ba988a89c52c68906f0b9052cc291..1d7c6f67607bb4af4e919e053f7c086e4c0f15f2 100644 (file)
@@ -12,7 +12,7 @@
 
 #include "InsetMathBoldSymbol.h"
 #include "MathStream.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "LaTeXFeatures.h"
 #include "support/std_ostream.h"
 
index 8a4e87c550ed22ac6e74fff4331061974b9823a9..0447e84467cb921ac0eaef4ba74f2ec038f43cc5 100644 (file)
@@ -11,7 +11,7 @@
 #include <config.h>
 
 #include "InsetMathBox.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathStream.h"
 #include "MathStream.h"
 #include "support/std_ostream.h"
index 5b9db75c1dc6af110776012bae6e9d49eb9dc1b3..2ff48888f771fc0aaba0674460a658a2098333e7 100644 (file)
@@ -11,7 +11,7 @@
 #include <config.h>
 
 #include "InsetMathBoxed.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathStream.h"
 #include "LaTeXFeatures.h"
 #include "LColor.h"
index 6a4f6b61a7de647286923f7531c35d4c70e50b00..e096c7a3ce3bf6fff03e084d72b147a55fc72617 100644 (file)
@@ -11,7 +11,7 @@
 #include <config.h>
 
 #include "InsetMathBrace.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathStream.h"
 #include "MathSupport.h"
 #include "LColor.h"
@@ -32,7 +32,7 @@ InsetMathBrace::InsetMathBrace()
 {}
 
 
-InsetMathBrace::InsetMathBrace(MathArray const & ar)
+InsetMathBrace::InsetMathBrace(MathData const & ar)
        : InsetMathNest(1)
 {
        cell(0) = ar;
index 3d581dc023c23dce476cc557bdf476566e50b132..e22bb7cfc125c3434e5412ab5b47a87d765658c9 100644 (file)
@@ -24,7 +24,7 @@ public:
        ///
        InsetMathBrace();
        ///
-       InsetMathBrace(MathArray const & ar);
+       InsetMathBrace(MathData const & ar);
        ///
        InsetMathBrace const * asBraceInset() const { return this; }
        /// we write extra braces in any case...
index 1f2eb60b4d0e5763dcdeb4dd6e839f3a8ced8912..7155b723f9e6c1d38f0c2962aeaca160b3107dcf 100644 (file)
@@ -11,7 +11,7 @@
 #include <config.h>
 
 #include "InsetMathCases.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathStream.h"
 #include "MathSupport.h"
 #include "FuncStatus.h"
index 5e0fed7b776ce2e397464f4d0d0894d668fd8b1a..c3358bfe34907c6c8e1d582df3a03ace9d103ca3 100644 (file)
@@ -11,7 +11,7 @@
 #include <config.h>
 
 #include "InsetMathColor.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathStream.h"
 #include "MathSupport.h"
 #include "LaTeXFeatures.h"
index 3faf7134335e30df1434879ccbb6d40b5cdb7ab4..ca0de54262e6d6b7e4bad023fa39eced24c485cb 100644 (file)
@@ -11,7 +11,7 @@
 #include <config.h>
 
 #include "InsetMathComment.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathStream.h"
 #include "MathSupport.h"
 #include "support/std_ostream.h"
index 20616016ff89f3a71db5e4f50bb2133dcf8aa2e7..5dded132b687f7d2ec0c5da8b3f5f222cb7a253d 100644 (file)
@@ -11,7 +11,7 @@
 #include <config.h>
 
 #include "InsetMathDFrac.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathStream.h"
 #include "LaTeXFeatures.h"
 #include "LColor.h"
index f1c8a7c3f743bad1623bba956009d510087e4eda..f7a038bec879bd903db5d153da700ff69c47610f 100644 (file)
@@ -12,7 +12,7 @@
 #include <config.h>
 
 #include "InsetMathDecoration.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathParser.h"
 #include "MathSupport.h"
 #include "MathStream.h"
index 86049818e5ec30f653764924af99eae9e38afae2..f7c1f24aa5e6a7adff8c30a40e6208caaa5c19da 100644 (file)
@@ -12,7 +12,7 @@
 #include <config.h>
 
 #include "InsetMathDelim.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathStream.h"
 #include "MathStream.h"
 #include "MathSupport.h"
@@ -45,7 +45,7 @@ InsetMathDelim::InsetMathDelim(docstring const & l, docstring const & r)
 
 
 InsetMathDelim::InsetMathDelim
-               (docstring const & l, docstring const & r, MathArray const & ar)
+               (docstring const & l, docstring const & r, MathData const & ar)
        : InsetMathNest(1), left_(l), right_(r)
 {
        cell(0) = ar;
index ab94d85808153caa39ca900e0a239f2e0f67741a..61c230e4e9d4285d58dcdcf4a5d588459c17070b 100644 (file)
@@ -26,7 +26,7 @@ public:
        ///
        InsetMathDelim(docstring const & left, docstring const & right);
        ///
-       InsetMathDelim(docstring const & left, docstring const & right, MathArray const &);
+       InsetMathDelim(docstring const & left, docstring const & right, MathData const &);
        ///
        InsetMathDelim * asDelimInset() { return this; }
        ///
index 61b87a36c8b752f632261f2f08830c224bf624b1..d598746f9906960e1f36fa636bb05ca7c56c2e90 100644 (file)
@@ -11,7 +11,7 @@
 #include <config.h>
 
 #include "InsetMathDiff.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathStream.h"
 #include "debug.h"
 
@@ -33,7 +33,7 @@ auto_ptr<InsetBase> InsetMathDiff::doClone() const
 }
 
 
-void InsetMathDiff::addDer(MathArray const & der)
+void InsetMathDiff::addDer(MathData const & der)
 {
        cells_.push_back(der);
 }
index 02658add64fdf7d09a427e36ec0e5d0b38a7d44f..2a8a5a53cc12d54fa33e86c039c2c6a3682f1515 100644 (file)
@@ -26,7 +26,7 @@ public:
        ///
        InsetMathDiff();
        ///
-       void addDer(MathArray const & der);
+       void addDer(MathData const & der);
        ///
        bool metrics(MetricsInfo & mi, Dimension & dim) const;
        ///
index 15584b6745d847e6c4cce73eef3725ab960832b7..110d09b2597bda01cbd4fdabc8bc0961efbd28d0 100644 (file)
@@ -11,7 +11,7 @@
 #include <config.h>
 
 #include "InsetMathEnv.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathStream.h"
 #include "MathStream.h"
 #include "support/std_ostream.h"
index 77530973f80466585910cbd4f940f8d4f74dc845..b716af8b8053daf13bdeb1464854de888090c592 100644 (file)
@@ -11,7 +11,7 @@
 #include <config.h>
 
 #include "InsetMathExFunc.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathStream.h"
 #include "MathStream.h"
 #include "MathSupport.h"
@@ -29,7 +29,7 @@ InsetMathExFunc::InsetMathExFunc(docstring const & name)
 {}
 
 
-InsetMathExFunc::InsetMathExFunc(docstring const & name, MathArray const & ar)
+InsetMathExFunc::InsetMathExFunc(docstring const & name, MathData const & ar)
        : InsetMathNest(1), name_(name)
 {
        cell(0) = ar;
index 5f150eeab994448562280f58cf2663b905d59214..aa44fda798e9a1568c57134c86c8d2a0f2c20ef3 100644 (file)
@@ -28,7 +28,7 @@ public:
        ///
        explicit InsetMathExFunc(docstring const & name);
        ///
-       InsetMathExFunc(docstring const & name, MathArray const & ar);
+       InsetMathExFunc(docstring const & name, MathData const & ar);
        ///
        bool metrics(MetricsInfo & mi, Dimension & dim) const;
        ///
index 9adfe507cef71cde9691902b06acc166fc4f4d8f..23fca486bcdec8690a237be9cc95a6c8e595c3a1 100644 (file)
@@ -11,7 +11,7 @@
 #include <config.h>
 
 #include "InsetMathExInt.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathStream.h"
 #include "MathStream.h"
 #include "InsetMathSymbol.h"
index 135395bccb9bac0b94856624e749e8792fee34f5..4eb91a8b97cdeab8edae0de21d05dec3809d2db2 100644 (file)
@@ -11,7 +11,7 @@
 #include <config.h>
 
 #include "InsetMathFBox.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathStream.h"
 #include "LColor.h"
 
index 6954cd03af73e1e082d861617cec19d3b89c5168..e079868a1a103f2a74fcc5cdcc64334aafc0c960 100644 (file)
@@ -11,7 +11,7 @@
 #include <config.h>
 
 #include "InsetMathFont.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathStream.h"
 #include "MathParser.h"
 #include "LaTeXFeatures.h"
index e70b7370f594a4d33a3224914b5050daa74dfa50..d061280118250cdde7dc4882ec0206b8c8afb366 100644 (file)
@@ -11,7 +11,7 @@
 #include <config.h>
 
 #include "InsetMathFontOld.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathStream.h"
 #include "MathParser.h"
 #include "MathStream.h"
index 55ccf4bbe38fdcbe3700f7ffdfd4381e906c25c7..924cebe79cf423f323a3bd95367ddaa99c82650d 100644 (file)
@@ -12,7 +12,7 @@
 #include <config.h>
 
 #include "InsetMathFrac.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathStream.h"
 #include "TextPainter.h"
 #include "LaTeXFeatures.h"
index 3e78c5f395919283fa762e1d95fc698ff6826d6f..f76986a07c9db1a68d6d10f8ec5243849f85f573 100644 (file)
@@ -11,7 +11,7 @@
 #include <config.h>
 
 #include "InsetMathFracBase.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "Cursor.h"
 
 
index 252589894129086a4c0aa047e60b431472669216..e77fe38fc6dd276fca4a7916d77eefe43700a382 100644 (file)
@@ -11,7 +11,7 @@
 #include <config.h>
 
 #include "InsetMathFrameBox.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathStream.h"
 #include "MathSupport.h"
 #include "LColor.h"
index 85068dea758ced6ca42ab86dcac807b476d62def..afcf0cfa48928cbf6f45b1723c4624e9ff559edc 100644 (file)
@@ -11,7 +11,7 @@
 #include <config.h>
 
 #include "InsetMathGrid.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathParser.h"
 #include "MathStream.h"
 
@@ -333,7 +333,7 @@ void InsetMathGrid::metrics(MetricsInfo & mi) const
                int asc  = 0;
                int desc = 0;
                for (col_type col = 0; col < ncols(); ++col) {
-                       MathArray const & c = cell(index(row, col));
+                       MathData const & c = cell(index(row, col));
                        asc  = max(asc,  c.ascent());
                        desc = max(desc, c.descent());
                }
@@ -519,7 +519,7 @@ void InsetMathGrid::metricsT(TextMetricsInfo const & mi, Dimension & dim) const
                int asc  = 0;
                int desc = 0;
                for (col_type col = 0; col < ncols(); ++col) {
-                       MathArray const & c = cell(index(row, col));
+                       MathData const & c = cell(index(row, col));
                        asc  = max(asc,  c.ascent());
                        desc = max(desc, c.descent());
                }
@@ -614,7 +614,7 @@ docstring InsetMathGrid::eolString(row_type row, bool emptyline, bool fragile) c
 
        // make sure an upcoming '[' does not break anything
        if (row + 1 < nrows()) {
-               MathArray const & c = cell(index(row + 1, 0));
+               MathData const & c = cell(index(row + 1, 0));
                if (c.size() && c.front()->getChar() == '[')
                        //eol += "[0pt]";
                        eol += "{}";
@@ -640,7 +640,7 @@ void InsetMathGrid::addRow(row_type row)
 {
        rowinfo_.insert(rowinfo_.begin() + row + 1, RowInfo());
        cells_.insert
-               (cells_.begin() + (row + 1) * ncols(), ncols(), MathArray());
+               (cells_.begin() + (row + 1) * ncols(), ncols(), MathData());
        cellinfo_.insert
                (cellinfo_.begin() + (row + 1) * ncols(), ncols(), CellInfo());
 }
@@ -649,7 +649,7 @@ void InsetMathGrid::addRow(row_type row)
 void InsetMathGrid::appendRow()
 {
        rowinfo_.push_back(RowInfo());
-       //cells_.insert(cells_.end(), ncols(), MathArray());
+       //cells_.insert(cells_.end(), ncols(), MathData());
        for (col_type col = 0; col < ncols(); ++col) {
                cells_.push_back(cells_type::value_type());
                cellinfo_.push_back(CellInfo());
@@ -1016,7 +1016,7 @@ void InsetMathGrid::splitCell(Cursor & cur)
 {
        if (cur.idx() == cur.lastidx())
                return;
-       MathArray ar = cur.cell();
+       MathData ar = cur.cell();
        ar.erase(0, cur.pos());
        cur.cell().erase(cur.pos(), cur.lastpos());
        ++cur.idx();
index 38897e2f44810dd44ce267e9571d267d2177a6ad..1b963ac068762cc23022f0c2948ff93453a6eb1f 100644 (file)
@@ -13,7 +13,7 @@
 #include "InsetMathArray.h"
 #include "InsetMathChar.h"
 #include "InsetMathColor.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "InsetMathDelim.h"
 #include "MathExtern.h"
 #include "MathFactory.h"
@@ -98,9 +98,9 @@ namespace {
 
        // returns position of first relation operator in the array
        // used for "intelligent splitting"
-       size_t firstRelOp(MathArray const & ar)
+       size_t firstRelOp(MathData const & ar)
        {
-               for (MathArray::const_iterator it = ar.begin(); it != ar.end(); ++it)
+               for (MathData::const_iterator it = ar.begin(); it != ar.end(); ++it)
                        if ((*it)->isRelOp())
                                return it - ar.begin();
                return ar.size();
@@ -680,7 +680,7 @@ docstring InsetMathHull::nicelabel(row_type row) const
 
 void InsetMathHull::glueall()
 {
-       MathArray ar;
+       MathData ar;
        for (idx_type i = 0; i < nargs(); ++i)
                ar.append(cell(i));
        *this = InsetMathHull(hullSimple);
@@ -696,7 +696,7 @@ void InsetMathHull::splitTo2Cols()
        for (row_type row = 0; row < nrows(); ++row) {
                idx_type const i = 2 * row;
                pos_type pos = firstRelOp(cell(i));
-               cell(i + 1) = MathArray(cell(i).begin() + pos, cell(i).end());
+               cell(i + 1) = MathData(cell(i).begin() + pos, cell(i).end());
                cell(i).erase(pos, cell(i).size());
        }
 }
@@ -711,7 +711,7 @@ void InsetMathHull::splitTo3Cols()
        for (row_type row = 0; row < nrows(); ++row) {
                idx_type const i = 3 * row + 1;
                if (cell(i).size()) {
-                       cell(i + 1) = MathArray(cell(i).begin() + 1, cell(i).end());
+                       cell(i + 1) = MathData(cell(i).begin() + 1, cell(i).end());
                        cell(i).erase(1, cell(i).size());
                }
        }
@@ -967,7 +967,7 @@ void InsetMathHull::doExtern(Cursor & cur, FuncRequest & func)
 #ifdef WITH_WARNINGS
 #warning temporarily disabled
        //if (cur.selection()) {
-       //      MathArray ar;
+       //      MathData ar;
        //      selGet(cur.ar);
        //      lyxerr << "use selection: " << ar << endl;
        //      insert(pipeThroughExtern(lang, extra, ar));
@@ -975,7 +975,7 @@ void InsetMathHull::doExtern(Cursor & cur, FuncRequest & func)
        //}
 #endif
 
-       MathArray eq;
+       MathData eq;
        eq.push_back(MathAtom(new InsetMathChar('=')));
 
        // go to first item in line
@@ -984,14 +984,14 @@ void InsetMathHull::doExtern(Cursor & cur, FuncRequest & func)
 
        if (getType() == hullSimple) {
                size_type pos = cur.cell().find_last(eq);
-               MathArray ar;
+               MathData ar;
                if (cur.inMathed() && cur.selection()) {
                        asArray(grabAndEraseSelection(cur), ar);
                } else if (pos == cur.cell().size()) {
                        ar = cur.cell();
                        lyxerr << "use whole cell: " << ar << endl;
                } else {
-                       ar = MathArray(cur.cell().begin() + pos + 1, cur.cell().end());
+                       ar = MathData(cur.cell().begin() + pos + 1, cur.cell().end());
                        lyxerr << "use partial cell form pos: " << pos << endl;
                }
                cur.cell().append(eq);
@@ -1003,7 +1003,7 @@ void InsetMathHull::doExtern(Cursor & cur, FuncRequest & func)
        if (getType() == hullEquation) {
                lyxerr << "use equation inset" << endl;
                mutate(hullEqnArray);
-               MathArray & ar = cur.cell();
+               MathData & ar = cur.cell();
                lyxerr << "use cell: " << ar << endl;
                ++cur.idx();
                cur.cell() = eq;
@@ -1018,7 +1018,7 @@ void InsetMathHull::doExtern(Cursor & cur, FuncRequest & func)
                lyxerr << "use eqnarray" << endl;
                cur.idx() += 2 - cur.idx() % ncols();
                cur.pos() = 0;
-               MathArray ar = cur.cell();
+               MathData ar = cur.cell();
                lyxerr << "use cell: " << ar << endl;
 #ifdef WITH_WARNINGS
 #warning temporarily disabled
@@ -1385,7 +1385,7 @@ bool InsetMathHull::searchForward(BufferView * bv, string const & str,
 #endif
        static InsetMathHull * lastformula = 0;
        static CursorBase current = DocIterator(ibegin(nucleus()));
-       static MathArray ar;
+       static MathData ar;
        static string laststr;
 
        if (lastformula != this || laststr != str) {
@@ -1402,7 +1402,7 @@ bool InsetMathHull::searchForward(BufferView * bv, string const & str,
 
        for (DocIterator it = current; it != iend(nucleus()); increment(it)) {
                CursorSlice & top = it.back();
-               MathArray const & a = top.asInsetMath()->cell(top.idx_);
+               MathData const & a = top.asInsetMath()->cell(top.idx_);
                if (a.matchpart(ar, top.pos_)) {
                        bv->cursor().setSelection(it, ar.size());
                        current = it;
index 6227dbf32c94a8794b1d9af2b9c5b72cb72517b5..4122d781f9afa264bcaee522d23dcf4cdb95eb99 100644 (file)
@@ -11,7 +11,7 @@
 #include <config.h>
 
 #include "InsetMathLefteqn.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "support/std_ostream.h"
 
 
index 3fdd3b5e8abb530d93d1e6e81be22daff6d0f5b6..d088d80fa3deb5c1f2a8a29027a7ef54337725e7 100644 (file)
@@ -11,7 +11,7 @@
 #include <config.h>
 
 #include "InsetMathLim.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathStream.h"
 #include "debug.h"
 
@@ -23,7 +23,7 @@ using std::endl;
 
 
 InsetMathLim::InsetMathLim
-       (MathArray const & f, MathArray const & x, MathArray const & x0)
+       (MathData const & f, MathData const & x, MathData const & x0)
        : InsetMathNest(3)
 {
        cell(0) = f;
index af1480dd0cfe83f79fad282b28e3221a0c9492d8..2a8f3e390bf140e408a48d2136f49b2abf48b5b3 100644 (file)
@@ -24,7 +24,7 @@ namespace lyx {
 class InsetMathLim : public InsetMathNest {
 public:
        ///
-       InsetMathLim(MathArray const & f, MathArray const & x, MathArray const & x0);
+       InsetMathLim(MathData const & f, MathData const & x, MathData const & x0);
        ///
        bool metrics(MetricsInfo & mi, Dimension & dim) const;
        ///
index 23f5453515aa75fe74e40bb8afdef7b8e51e71c5..bdc95de8d6c95b8a14525cb671e3aa64f179ac49 100644 (file)
@@ -11,7 +11,7 @@
 #include <config.h>
 
 #include "InsetMathMBox.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathStream.h"
 
 #include "BufferView.h"
index 51fce619e6f13a77531e7facc5cb6743c8fac646..fb6a0b09a422d42fb55c924a477c7a5d306cc18e 100644 (file)
@@ -11,7 +11,7 @@
 #include <config.h>
 
 #include "InsetMathMakebox.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathStream.h"
 #include "MathSupport.h"
 
index 7b19c38d9822a1a11e7ddf69f6204a57ad97496f..feb56cb3df61249d8c9c4c37488e872c1daa231f 100644 (file)
@@ -11,7 +11,7 @@
 #include <config.h>
 
 #include "InsetMathMatrix.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathStream.h"
 
 
index bf224bb12f67fe3a5233f08b8c337fec12cf5305..154af01e493ff96118d8ef424a253bb47eede339 100644 (file)
@@ -18,7 +18,7 @@
 #include "InsetMathBrace.h"
 #include "InsetMathColor.h"
 #include "InsetMathComment.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "InsetMathDelim.h"
 #include "MathFactory.h"
 #include "InsetMathHull.h"
@@ -92,13 +92,13 @@ void InsetMathNest::cursorPos(BufferView const & bv,
 {
 // FIXME: This is a hack. Ideally, the coord cache should not store
 // absolute positions, but relative ones. This would mean to call
-// setXY() not in MathArray::draw(), but in the parent insets' draw()
+// setXY() not in MathData::draw(), but in the parent insets' draw()
 // with the correctly adjusted x,y values. But this means that we'd have
 // to touch all (math)inset's draw() methods. Right now, we'll store
 // absolute value, and make them here relative, only to make them
 // absolute again when actually drawing the cursor. What a mess.
        BOOST_ASSERT(ptr_cmp(&sl.inset(), this));
-       MathArray const & ar = sl.cell();
+       MathData const & ar = sl.cell();
        CoordCache const & coord_cache = bv.coordCache();
        if (!coord_cache.getArrays().has(&ar)) {
                // this can (semi-)legally happen if we just created this cell
@@ -117,7 +117,7 @@ void InsetMathNest::cursorPos(BufferView const & bv,
                return;
        }
        Point const pt2 = coord_cache.getInsets().xy(this);
-       //lyxerr << "retrieving position cache for MathArray "
+       //lyxerr << "retrieving position cache for MathData "
        //      << pt.x_ << ' ' << pt.y_ << std::endl;
        x = pt.x_ - pt2.x_ + ar.pos2x(sl.pos());
        y = pt.y_ - pt2.y_;
@@ -240,7 +240,7 @@ void InsetMathNest::drawSelection(PainterInfo & pi, int x, int y) const
        //lyxerr << "InsetMathNest::drawing selection: "
        //      << " s1: " << s1 << " s2: " << s2 << endl;
        if (s1.idx() == s2.idx()) {
-               MathArray const & c = cell(s1.idx());
+               MathData const & c = cell(s1.idx());
                int x1 = c.xo(bv) + c.pos2x(s1.pos());
                int y1 = c.yo(bv) - c.ascent();
                int x2 = c.xo(bv) + c.pos2x(s2.pos());
@@ -252,7 +252,7 @@ void InsetMathNest::drawSelection(PainterInfo & pi, int x, int y) const
        } else {
                for (idx_type i = 0; i < nargs(); ++i) {
                        if (idxBetween(i, s1.idx(), s2.idx())) {
-                               MathArray const & c = cell(i);
+                               MathData const & c = cell(i);
                                int x1 = c.xo(bv);
                                int y1 = c.yo(bv) - c.ascent();
                                int x2 = c.xo(bv) + c.width();
@@ -278,7 +278,7 @@ void InsetMathNest::replace(ReplaceData & rep)
 }
 
 
-bool InsetMathNest::contains(MathArray const & ar) const
+bool InsetMathNest::contains(MathData const & ar) const
 {
        for (idx_type i = 0; i < nargs(); ++i)
                if (cell(i).contains(ar))
@@ -305,9 +305,9 @@ bool InsetMathNest::isActive() const
 }
 
 
-MathArray InsetMathNest::glue() const
+MathData InsetMathNest::glue() const
 {
-       MathArray ar;
+       MathData ar;
        for (size_t i = 0; i < nargs(); ++i)
                ar.append(cell(i));
        return ar;
@@ -352,12 +352,12 @@ bool InsetMathNest::notifyCursorLeaves(Cursor & /*cur*/)
 #warning look here
 #endif
 #if 0
-       MathArray & ar = cur.cell();
+       MathData & ar = cur.cell();
        // remove base-only "scripts"
        for (pos_type i = 0; i + 1 < ar.size(); ++i) {
                InsetMathScript * p = operator[](i).nucleus()->asScriptInset();
                if (p && p->nargs() == 1) {
-                       MathArray ar = p->nuc();
+                       MathData ar = p->nuc();
                        erase(i);
                        insert(i, ar);
                        cur.adjust(i, ar.size() - 1);
@@ -975,7 +975,7 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
        }
 
        case LFUN_INSET_INSERT: {
-               MathArray ar;
+               MathData ar;
                if (createInsetMath_fromDialogStr(cmd.argument(), ar)) {
                        recordUndo(cur);
                        cur.insert(ar);
@@ -1112,7 +1112,7 @@ InsetBase * InsetMathNest::editXY(Cursor & cur, int x, int y)
                        idx_min = i;
                }
        }
-       MathArray & ar = cell(idx_min);
+       MathData & ar = cell(idx_min);
        cur.push(*this);
        cur.idx() = idx_min;
        cur.pos() = ar.x2pos(x - ar.xo(cur.bv()));
@@ -1144,7 +1144,7 @@ void InsetMathNest::lfunMousePress(Cursor & cur, FuncRequest & cmd)
                // cur.result().update(): don't overwrite previously set flags.
                cur.updateFlags(Update::Decoration | Update::FitCursor | cur.result().update());
        } else if (cmd.button() == mouse_button::button2) {
-               MathArray ar;
+               MathData ar;
                if (cap::selection()) {
                        // See comment in LyXText::dispatch why we do this
                        cap::copySelectionToStack();
index 18ba304c9b7840eb12090e3d5a383b108ab241f8..1ae230a2841a6772b205297a331d1b43a4857169 100644 (file)
@@ -77,8 +77,8 @@ public:
        /// direct access to the cell.
        /// inlined because shows in profile.
        //@{
-       MathArray & cell(idx_type i) { return cells_[i]; }
-       MathArray const & cell(idx_type i) const { return cells_[i]; }
+       MathData & cell(idx_type i) { return cells_[i]; }
+       MathData const & cell(idx_type i) const { return cells_[i]; }
        //@}
 
        /// can we move into this cell (see macroarg.h)
@@ -89,9 +89,9 @@ public:
        /// replace in all cells
        void replace(ReplaceData &);
        /// do we contain a given pattern?
-       bool contains(MathArray const &) const;
+       bool contains(MathData const &) const;
        /// glue everything to a single cell
-       MathArray glue() const;
+       MathData glue() const;
 
        /// debug helper
        void dump() const;
@@ -141,7 +141,7 @@ private:
 
 protected:
        /// we store the cells in a vector
-       typedef std::vector<MathArray> cells_type;
+       typedef std::vector<MathData> cells_type;
        /// thusly:
        cells_type cells_;
        /// if the inset is locked, it can't be entered with the cursor
index 9d241723a5da3d1c03068e52eaec0eebffce01ed..15727f90861eacda67bca36bb5d1ad6699d366c8 100644 (file)
@@ -11,7 +11,7 @@
 #include <config.h>
 
 #include "InsetMathOverset.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathStream.h"
 
 #include "Cursor.h"
index e0b6345bda513683c80d862a228468c9db122c1c..4fef89efe3925a0ec2b617c28bfe811c9ceb3364 100644 (file)
@@ -11,7 +11,7 @@
 #include <config.h>
 
 #include "InsetMathPar.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathStream.h"
 #include "support/std_ostream.h"
 
@@ -22,7 +22,7 @@ namespace lyx {
 using std::auto_ptr;
 
 
-InsetMathPar::InsetMathPar(MathArray const & ar)
+InsetMathPar::InsetMathPar(MathData const & ar)
 {
        cells_[0] = ar;
 }
index 3f980e2fec230d748c3aa046a124b13b37f189ee..29d62b98d403e8bd32835954590c2eb640171f55 100644 (file)
@@ -23,7 +23,7 @@ public:
        ///
        InsetMathPar() {}
        ///
-       InsetMathPar(MathArray const & ar);
+       InsetMathPar(MathData const & ar);
        ///
        mode_type currentMode() const { return TEXT_MODE; }
        ///
index e66aa89f2d2d3bdcd09818a9ad132db95f1ba18f..9945694a68f1b8a55b16328bb725b3fdc68d6f83 100644 (file)
@@ -20,7 +20,7 @@
 #include "FuncRequest.h"
 #include "FuncStatus.h"
 #include "gettext.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathFactory.h"
 #include "MathSupport.h"
 #include "OutputParams.h"
@@ -63,7 +63,7 @@ void RefInset::doDispatch(Cursor & cur, FuncRequest & cmd)
        switch (cmd.action) {
        case LFUN_INSET_MODIFY:
                if (cmd.getArg(0) == "ref") {
-                       MathArray ar;
+                       MathData ar;
                        if (createInsetMath_fromDialogStr(cmd.argument(), ar)) {
                                *this = *ar[0].nucleus()->asRefInset();
                                break;
index b927db47e3c35097c8398d0f166f9c05ea5f130f..324d804f6bd51c6f84bf976a6080c313cf37e381 100644 (file)
@@ -12,7 +12,7 @@
 #include <config.h>
 
 #include "InsetMathRoot.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathStream.h"
 #include "Cursor.h"
 #include "LColor.h"
index ee18314316dd703d5c2dec937b9a90100b7dbc44..71aeeff773997d75a5e89102907673346c24947f 100644 (file)
@@ -11,7 +11,7 @@
 #include <config.h>
 
 #include "InsetMathScript.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathStream.h"
 #include "MathSupport.h"
 #include "InsetMathSymbol.h"
@@ -86,7 +86,7 @@ bool InsetMathScript::idxLast(Cursor & cur) const
 }
 
 
-MathArray const & InsetMathScript::down() const
+MathData const & InsetMathScript::down() const
 {
        if (nargs() == 3)
                return cell(2);
@@ -95,7 +95,7 @@ MathArray const & InsetMathScript::down() const
 }
 
 
-MathArray & InsetMathScript::down()
+MathData & InsetMathScript::down()
 {
        if (nargs() == 3)
                return cell(2);
@@ -104,14 +104,14 @@ MathArray & InsetMathScript::down()
 }
 
 
-MathArray const & InsetMathScript::up() const
+MathData const & InsetMathScript::up() const
 {
        BOOST_ASSERT(nargs() > 1);
        return cell(1);
 }
 
 
-MathArray & InsetMathScript::up()
+MathData & InsetMathScript::up()
 {
        BOOST_ASSERT(nargs() > 1);
        return cell(1);
@@ -122,26 +122,26 @@ void InsetMathScript::ensure(bool up)
 {
        if (nargs() == 1) {
                // just nucleus so far
-               cells_.push_back(MathArray());
+               cells_.push_back(MathData());
                cell_1_is_up_ = up;
        } else if (nargs() == 2 && !has(up)) {
                if (up) {
                        cells_.push_back(cell(1));
                        cell(1).clear();
                } else {
-                       cells_.push_back(MathArray());
+                       cells_.push_back(MathData());
                }
        }
 }
 
 
-MathArray const & InsetMathScript::nuc() const
+MathData const & InsetMathScript::nuc() const
 {
        return cell(0);
 }
 
 
-MathArray & InsetMathScript::nuc()
+MathData & InsetMathScript::nuc()
 {
        return cell(0);
 }
@@ -157,7 +157,7 @@ bool isAlphaSymbol(MathAtom const & at)
                return true;
 
        if (at->asFontInset()) {
-               MathArray const & ar = at->asFontInset()->cell(0);
+               MathData const & ar = at->asFontInset()->cell(0);
                for (size_t i = 0; i < ar.size(); ++i) {
                        if (!(ar[i]->asCharInset() ||
                                        (ar[i]->asSymbolInset() &&
@@ -676,7 +676,7 @@ bool InsetMathScript::notifyCursorLeaves(Cursor & cur)
                // invoke notifyCursorLeaves again and does not touch
                // cur (since the top slice will be deleted
                // afterwards))
-               MathArray ar = cell(0);
+               MathData ar = cell(0);
                Cursor tmpcur = cur;
                tmpcur.pop();
                tmpcur.cell().erase(tmpcur.pos());
index 011b82160b72d13facd83b5804171206b58e4a02..b13d163289a9ec7ed1b2b54551a94f7bd6157457 100644 (file)
@@ -75,17 +75,17 @@ public:
        /// get limits
        int limits() const { return limits_; }
        /// returns subscript. Always run 'hasDown' or 'has(false)' before!
-       MathArray const & down() const;
+       MathData const & down() const;
        /// returns subscript. Always run 'hasDown' or 'has(false)' before!
-       MathArray & down();
+       MathData & down();
        /// returns superscript. Always run 'hasUp' or 'has(true)' before!
-       MathArray const & up() const;
+       MathData const & up() const;
        /// returns superscript. Always run 'hasUp' or 'has(true)' before!
-       MathArray & up();
+       MathData & up();
        /// returns nucleus
-       MathArray const & nuc() const;
+       MathData const & nuc() const;
        /// returns nucleus
-       MathArray & nuc();
+       MathData & nuc();
        /// do we have a superscript?
        bool hasUp() const;
        /// do we have a subscript?
index 91709a9532f86d4c65a3381c6c97c374cb45d235..23eb69812a97b387b2d0808b94b27d430232aeb8 100644 (file)
@@ -11,7 +11,7 @@
 #include <config.h>
 
 #include "InsetMathSize.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathParser.h"
 #include "MathStream.h"
 
index 41ede3c4d32176bd5158870cdf2bae6efb693c3b..8d3df0930b28499ebd585483ec25fcbeec27948e 100644 (file)
@@ -11,7 +11,7 @@
 #include <config.h>
 
 #include "InsetMathSpace.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathStream.h"
 
 #include "LaTeXFeatures.h"
index 7cbaf9b342435adf82d951de487cc91ce662d03d..781c6ec2c81c5c42b4f915459045b50880262985 100644 (file)
@@ -11,7 +11,7 @@
 #include <config.h>
 
 #include "InsetMathSplit.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathStream.h"
 #include "MathStream.h"
 
index 57faa1ccc05e93b16e2aa09b03c9f04d3029fc0d..55d773c946df7648f34703ff8615e240e4b8f2c7 100644 (file)
@@ -11,7 +11,7 @@
 #include <config.h>
 
 #include "InsetMathSqrt.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathStream.h"
 #include "TextPainter.h"
 #include "LColor.h"
index 3df8d284bf0a54b87914c5aa4f3be3d67b1c9b29..9f1a9baba9b2d8eb9cdfd501bc33ad7577651e1e 100644 (file)
@@ -11,7 +11,7 @@
 #include <config.h>
 
 #include "InsetMathStackrel.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathStream.h"
 
 
index a7817f15f0ca931b669048c1d32ffab2e2c36e26..c285f0f650cea041bd2566a17ded3a3775227758 100644 (file)
@@ -12,7 +12,7 @@
 
 #include "LaTeXFeatures.h"
 #include "InsetMathSubstack.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathStream.h"
 #include "support/std_ostream.h"
 
index a739904edde2bf2e9145bbf9a0e4170768416755..84ed2b8157f686ee03e00f57124b910060c26590 100644 (file)
@@ -12,7 +12,7 @@
 
 #include "InsetMathTFrac.h"
 
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathStream.h"
 
 #include "LaTeXFeatures.h"
index ac4381aa46149f51f28051b5301e6e7be98366e7..7445044e3e4e602d29ff09cf6c7284ca83abd84a 100644 (file)
@@ -11,7 +11,7 @@
 #include <config.h>
 
 #include "InsetMathTabular.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathStream.h"
 #include "MathStream.h"
 
index bceabfb62c9705beb5e997b360539915f51412b5..0f91a963f40ec575daca27489563529c816b993d 100644 (file)
@@ -11,7 +11,7 @@
 #include <config.h>
 
 #include "InsetMathUnderset.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathStream.h"
 
 #include "Cursor.h"
index 08c234c274aa2cb3bb3f7ea0c2a301670ada20c8..dbd16ac31c53348a2e74c761fa462acc8eb130a7 100644 (file)
@@ -11,7 +11,7 @@
 #include <config.h>
 
 #include "InsetMathXArrow.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathStream.h"
 #include "MathStream.h"
 #include "MathSupport.h"
index fb0f30252dc4067fe46c7286297d76f56fd94379..1853c2e4d946ddee65b044afec0aea2306c88431 100644 (file)
@@ -40,14 +40,14 @@ InsetMathXYMatrix const * InsetMathXYArrow::targetMatrix() const
 }
 
 
-MathArray const & InsetMathXYArrow::targetCell() const
+MathData const & InsetMathXYArrow::targetCell() const
 {
 #if 0
        InsetMathXYMatrix const * p = targetMatrix();
        int x = 0;
        int y = 0;
-       MathArray const & t = cell(0);
-       for (MathArray::const_iterator it = t.begin(); it != t.end(); ++it) {
+       MathData const & t = cell(0);
+       for (MathData::const_iterator it = t.begin(); it != t.end(); ++it) {
                switch ((*it)->getChar()) {
                        case 'l': --x; break;
                        case 'r': ++x; break;
@@ -64,18 +64,18 @@ MathArray const & InsetMathXYArrow::targetCell() const
        }
        return p->cell(n);
 #else
-       static MathArray dummy;
+       static MathData dummy;
        return dummy;
 #endif
 }
 
 
-MathArray const & InsetMathXYArrow::sourceCell() const
+MathData const & InsetMathXYArrow::sourceCell() const
 {
 #if 0
        return targetMatrix()->cell(mi_.idx);
 #else
-       static MathArray dummy;
+       static MathData dummy;
        return dummy;
 #endif
 }
@@ -131,8 +131,8 @@ void InsetMathXYArrow::draw(PainterInfo & pi, int x, int y) const
        } else {
 
                pi.pain.text(x, y, "X");
-               MathArray const & s = sourceCell();
-               MathArray const & t = targetCell();
+               MathData const & s = sourceCell();
+               MathData const & t = targetCell();
                pi.pain.line(s.xm(), s.ym(), t.xm(), t.ym(), LColor::math);
                cell(1).draw(pi, (s.xm() + t.xm())/2, (s.ym() + t.ym())/2);
 
index 041bf080a72eb13817c437659c2910a10b486d6c..447e9604e1d91e2ce00496142e4a39cb886cf630 100644 (file)
@@ -47,9 +47,9 @@ public:
        ///
        InsetMathXYMatrix const * targetMatrix() const;
        ///
-       MathArray const & targetCell() const;
+       MathData const & targetCell() const;
        ///
-       MathArray const & sourceCell() const;
+       MathData const & sourceCell() const;
 
        ///
        bool up_;
index 062f88789590cae974a37ca58f15cb5ab75f4b0c..d856a8cb539241e4c865e49d2fac6f48df18ce08 100644 (file)
@@ -131,8 +131,8 @@ libmathed_la_SOURCES = \
        MathAtom.h \
        MathAutoCorrect.cpp \
        MathAutoCorrect.h \
-       MathArray.cpp \
-       MathArray.h \
+       MathData.cpp \
+       MathData.h \
        MathExtern.cpp \
        MathExtern.h \
        MathFactory.cpp \
diff --git a/src/mathed/MathArray.cpp b/src/mathed/MathArray.cpp
deleted file mode 100644 (file)
index 2078384..0000000
+++ /dev/null
@@ -1,485 +0,0 @@
-/**
- * \file MathArray.cpp
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author André Pönitz
- *
- * Full author contact details are available in file CREDITS.
- */
-
-#include <config.h>
-
-#include "MathArray.h"
-#include "InsetMathFont.h"
-#include "InsetMathScript.h"
-#include "MathMacro.h"
-#include "MathMacroTable.h"
-#include "MathStream.h"
-#include "MathSupport.h"
-#include "ReplaceData.h"
-
-#include "BufferView.h"
-#include "Buffer.h"
-#include "Cursor.h"
-#include "debug.h"
-#include "LColor.h"
-
-#include "frontends/FontMetrics.h"
-#include "frontends/Painter.h"
-
-#include <boost/assert.hpp>
-
-
-namespace lyx {
-
-using std::abs;
-using std::endl;
-using std::min;
-using std::ostringstream;
-using std::string;
-using std::vector;
-
-
-MathArray::MathArray(const_iterator from, const_iterator to)
-       : base_type(from, to)
-{}
-
-
-MathAtom & MathArray::operator[](pos_type pos)
-{
-       BOOST_ASSERT(pos < size());
-       return base_type::operator[](pos);
-}
-
-
-MathAtom const & MathArray::operator[](pos_type pos) const
-{
-       BOOST_ASSERT(pos < size());
-       return base_type::operator[](pos);
-}
-
-
-void MathArray::insert(size_type pos, MathAtom const & t)
-{
-       base_type::insert(begin() + pos, t);
-}
-
-
-void MathArray::insert(size_type pos, MathArray const & ar)
-{
-       BOOST_ASSERT(pos <= size());
-       base_type::insert(begin() + pos, ar.begin(), ar.end());
-}
-
-
-void MathArray::append(MathArray const & ar)
-{
-       insert(size(), ar);
-}
-
-
-void MathArray::erase(size_type pos)
-{
-       if (pos < size())
-               erase(pos, pos + 1);
-}
-
-
-void MathArray::erase(iterator pos1, iterator pos2)
-{
-       base_type::erase(pos1, pos2);
-}
-
-
-void MathArray::erase(iterator pos)
-{
-       base_type::erase(pos);
-}
-
-
-void MathArray::erase(size_type pos1, size_type pos2)
-{
-       base_type::erase(begin() + pos1, begin() + pos2);
-}
-
-
-void MathArray::dump2() const
-{
-       odocstringstream os;
-       NormalStream ns(os);
-       for (const_iterator it = begin(); it != end(); ++it)
-               ns << *it << ' ';
-       lyxerr << to_utf8(os.str());
-}
-
-
-void MathArray::dump() const
-{
-       odocstringstream os;
-       NormalStream ns(os);
-       for (const_iterator it = begin(); it != end(); ++it)
-               ns << '<' << *it << '>';
-       lyxerr << to_utf8(os.str());
-}
-
-
-void MathArray::validate(LaTeXFeatures & features) const
-{
-       for (const_iterator it = begin(); it != end(); ++it)
-               (*it)->validate(features);
-}
-
-
-bool MathArray::match(MathArray const & ar) const
-{
-       return size() == ar.size() && matchpart(ar, 0);
-}
-
-
-bool MathArray::matchpart(MathArray const & ar, pos_type pos) const
-{
-       if (size() < ar.size() + pos)
-               return false;
-       const_iterator it = begin() + pos;
-       for (const_iterator jt = ar.begin(); jt != ar.end(); ++jt, ++it)
-               if (asString(*it) != asString(*jt))
-                       return false;
-       return true;
-}
-
-
-void MathArray::replace(ReplaceData & rep)
-{
-       for (size_type i = 0; i < size(); ++i) {
-               if (find1(rep.from, i)) {
-                       // match found
-                       lyxerr << "match found!" << endl;
-                       erase(i, i + rep.from.size());
-                       insert(i, rep.to);
-               }
-       }
-
-#ifdef WITH_WARNINGS
-#warning temporarily disabled
-       // for (const_iterator it = begin(); it != end(); ++it)
-       //      it->nucleus()->replace(rep);
-#endif
-}
-
-
-bool MathArray::find1(MathArray const & ar, size_type pos) const
-{
-       lyxerr << "finding '" << ar << "' in '" << *this << "'" << endl;
-       for (size_type i = 0, n = ar.size(); i < n; ++i)
-               if (asString(operator[](pos + i)) != asString(ar[i]))
-                       return false;
-       return true;
-}
-
-
-MathArray::size_type MathArray::find(MathArray const & ar) const
-{
-       for (int i = 0, last = size() - ar.size(); i < last; ++i)
-               if (find1(ar, i))
-                       return i;
-       return size();
-}
-
-
-MathArray::size_type MathArray::find_last(MathArray const & ar) const
-{
-       for (int i = size() - ar.size(); i >= 0; --i)
-               if (find1(ar, i))
-                       return i;
-       return size();
-}
-
-
-bool MathArray::contains(MathArray const & ar) const
-{
-       if (find(ar) != size())
-               return true;
-       for (const_iterator it = begin(); it != end(); ++it)
-               if ((*it)->contains(ar))
-                       return true;
-       return false;
-}
-
-
-void MathArray::touch() const
-{
-}
-
-
-bool MathArray::metrics(MetricsInfo & mi, Dimension & dim) const
-{
-       dim = dim_;
-       metrics(mi);
-       if (dim_ == dim)
-               return false;
-       dim = dim_;
-       return true;
-}
-
-
-namespace {
-
-bool isInside(DocIterator const & it, MathArray const & ar,
-       pos_type p1, pos_type p2)
-{
-       for (size_t i = 0; i != it.depth(); ++i) {
-               CursorSlice const & sl = it[i];
-               if (sl.inset().inMathed() && &sl.cell() == &ar)
-                       return p1 <= sl.pos() && sl.pos() < p2;
-       }
-       return false;
-}
-
-}
-
-
-
-void MathArray::metrics(MetricsInfo & mi) const
-{
-       frontend::FontMetrics const & fm = theFontMetrics(mi.base.font);
-       dim_ = fm.dimension('I');
-       int xascent = fm.dimension('x').ascent();
-       if (xascent >= dim_.asc)
-               xascent = (2 * dim_.asc) / 3;
-       minasc_ = xascent;
-       mindes_ = (3 * xascent) / 4;
-       slevel_ = (4 * xascent) / 5;
-       sshift_ = xascent / 4;
-       kerning_ = 0;
-
-       if (empty())
-               return;
-
-       dim_.asc = 0;
-       dim_.wid = 0;
-       Dimension d;
-       //BufferView & bv  = *mi.base.bv;
-       //Buffer const & buf = *bv.buffer();
-       for (size_t i = 0, n = size(); i != n; ++i) {
-               MathAtom const & at = operator[](i);
-#if 0
-               MathMacro const * mac = at->asMacro();
-               if (mac && buf.hasMacro(mac->name())) {
-                       MacroData const & tmpl = buf.getMacro(mac->name());
-                       int numargs = tmpl.numargs();
-                       if (i + numargs > n)
-                               numargs = n - i - 1;
-                       lyxerr << "metrics:found macro: " << mac->name()
-                               << " numargs: " << numargs << endl;
-                       if (!isInside(bv.cursor(), *this, i + 1, i + numargs + 1)) {
-                               MathArray args(begin() + i + 1, begin() + i + numargs + 1);
-                               MathArray exp;
-                               tmpl.expand(args, exp);
-                               mac->setExpansion(exp, args);
-                               mac->metricsExpanded(mi, d);
-                               dim_.wid += mac->widthExpanded();
-                               i += numargs;
-                               continue;
-                       }
-               }
-#endif
-               at->metrics(mi, d);
-               dim_ += d;
-               if (i == n - 1)
-                       kerning_ = at->kerning();
-       }
-}
-
-
-void MathArray::draw(PainterInfo & pi, int x, int y) const
-{
-       //lyxerr << "MathArray::draw: x: " << x << " y: " << y << endl;
-       BufferView & bv  = *pi.base.bv;
-       setXY(bv, x, y);
-
-       if (empty()) {
-               pi.pain.rectangle(x, y - ascent(), width(), height(), LColor::mathline);
-               return;
-       }
-
-       // don't draw outside the workarea
-       if (y + descent() <= 0
-               || y - ascent() >= bv.workHeight()
-               || x + width() <= 0
-               || x >= bv. workWidth())
-               return;
-
-       for (size_t i = 0, n = size(); i != n; ++i) {
-               MathAtom const & at = operator[](i);
-#if 0
-       Buffer const & buf = bv.buffer();
-               // special macro handling
-               MathMacro const * mac = at->asMacro();
-               if (mac && buf.hasMacro(mac->name())) {
-                       MacroData const & tmpl = buf.getMacro(mac->name());
-                       int numargs = tmpl.numargs();
-                       if (i + numargs > n)
-                               numargs = n - i - 1;
-                       if (!isInside(bv.cursor(), *this, i + 1, i + numargs + 1)) {
-                               mac->drawExpanded(pi, x, y);
-                               x += mac->widthExpanded();
-                               i += numargs;
-                               continue;
-                       }
-               }
-#endif
-               bv.coordCache().insets().add(at.nucleus(), x, y);
-               at->drawSelection(pi, x, y);
-               at->draw(pi, x, y);
-               x += at->width();
-       }
-}
-
-
-void MathArray::metricsT(TextMetricsInfo const & mi, Dimension & dim) const
-{
-       dim.clear();
-       Dimension d;
-       for (const_iterator it = begin(); it != end(); ++it) {
-               (*it)->metricsT(mi, d);
-               dim += d;
-       }
-}
-
-
-void MathArray::drawT(TextPainter & pain, int x, int y) const
-{
-       //lyxerr << "x: " << x << " y: " << y << ' ' << pain.workAreaHeight() << endl;
-
-       // FIXME: Abdel 16/10/2006
-       // This drawT() method is never used, this is dead code.
-
-       for (const_iterator it = begin(), et = end(); it != et; ++it) {
-               (*it)->drawT(pain, x, y);
-               //x += (*it)->width_;
-               x += 2;
-       }
-}
-
-
-int MathArray::pos2x(size_type pos) const
-{
-       return pos2x(pos, 0);
-}
-
-
-int MathArray::pos2x(size_type pos, int glue) const
-{
-       int x = 0;
-       size_type target = min(pos, size());
-       for (size_type i = 0; i < target; ++i) {
-               const_iterator it = begin() + i;
-               if ((*it)->getChar() == ' ')
-                       x += glue;
-               //lyxerr << "char: " << (*it)->getChar()
-               //      << "width: " << (*it)->width() << std::endl;
-               x += (*it)->width();
-       }
-       return x;
-}
-
-
-MathArray::size_type MathArray::x2pos(int targetx) const
-{
-       return x2pos(targetx, 0);
-}
-
-
-MathArray::size_type MathArray::x2pos(int targetx, int glue) const
-{
-       const_iterator it = begin();
-       int lastx = 0;
-       int currx = 0;
-       // find first position after targetx
-       for (; currx < targetx && it < end(); ++it) {
-               lastx = currx;
-               if ((*it)->getChar() == ' ')
-                       currx += glue;
-               currx += (*it)->width();
-       }
-
-       /**
-        * If we are not at the beginning of the array, go to the left
-        * of the inset if one of the following two condition holds:
-        * - the current inset is editable (so that the cursor tip is
-        *   deeper than us): in this case, we want all intermediate
-        *   cursor slices to be before insets;
-        * - the mouse is closer to the left side of the inset than to
-        *   the right one.
-        * See bug 1918 for details.
-        **/
-       if (it != begin() && currx >= targetx
-           && ((*boost::prior(it))->asNestInset()
-               || abs(lastx - targetx) < abs(currx - targetx))) {
-               --it;
-       }
-
-       return it - begin();
-}
-
-
-int MathArray::dist(BufferView const & bv, int x, int y) const
-{
-       int xx = 0;
-       int yy = 0;
-
-       const int xo_ = xo(bv);
-       const int yo_ = yo(bv);
-
-       if (x < xo_)
-               xx = xo_ - x;
-       else if (x > xo_ + width())
-               xx = x - xo_ - width();
-
-       if (y < yo_ - ascent())
-               yy = yo_ - ascent() - y;
-       else if (y > yo_ + descent())
-               yy = y - yo_ - descent();
-
-       return xx + yy;
-}
-
-
-void MathArray::setXY(BufferView & bv, int x, int y) const
-{
-       //lyxerr << "setting position cache for MathArray " << this << std::endl;
-       bv.coordCache().arrays().add(this, x, y);
-}
-
-
-int MathArray::xo(BufferView const & bv) const
-{
-       return bv.coordCache().getArrays().x(this);
-}
-
-
-int MathArray::yo(BufferView const & bv) const
-{
-       return bv.coordCache().getArrays().y(this);
-}
-
-
-std::ostream & operator<<(std::ostream & os, MathArray const & ar)
-{
-       odocstringstream oss;
-       NormalStream ns(oss);
-       ns << ar;
-       return os << to_utf8(oss.str());
-}
-
-
-odocstream & operator<<(odocstream & os, MathArray const & ar)
-{
-       NormalStream ns(os);
-       ns << ar;
-       return os;
-}
-
-
-} // namespace lyx
diff --git a/src/mathed/MathArray.h b/src/mathed/MathArray.h
deleted file mode 100644 (file)
index 2001ec9..0000000
+++ /dev/null
@@ -1,188 +0,0 @@
-// -*- C++ -*-
-/**
- * \file MathArray.h
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author Alejandro Aguilar Sierra
- * \author André Pönitz
- * \author Lars Gullik Bjønnes
- *
- * Full author contact details are available in file CREDITS.
- */
-
-#ifndef MATH_DATA_H
-#define MATH_DATA_H
-
-#include <vector>
-
-#include "MathAtom.h"
-#include "Dimension.h"
-
-#include "support/docstream.h"
-
-
-namespace lyx {
-
-class BufferView;
-class LaTeXFeatures;
-class ReplaceData;
-class MetricsInfo;
-class PainterInfo;
-class TextMetricsInfo;
-class TextPainter;
-
-
-class MathArray : private std::vector<MathAtom> {
-public:
-       /// re-use inhertited stuff
-       typedef std::vector<MathAtom> base_type;
-       using base_type::const_iterator;
-       using base_type::iterator;
-       using base_type::size_type;
-       using base_type::difference_type;
-       using base_type::size;
-       using base_type::empty;
-       using base_type::clear;
-       using base_type::begin;
-       using base_type::end;
-       using base_type::push_back;
-       using base_type::pop_back;
-       using base_type::back;
-       using base_type::front;
-       ///
-       typedef size_type idx_type;
-       typedef size_type pos_type;
-
-public:
-       ///
-       MathArray() {}
-       ///
-       MathArray(const_iterator from, const_iterator to);
-       ///
-       void append(MathArray const & ar);
-
-       /// inserts single atom at position pos
-       void insert(size_type pos, MathAtom const & at);
-       /// inserts multiple atoms at position pos
-       void insert(size_type pos, MathArray const & ar);
-
-       /// erase range from pos1 to pos2
-       void erase(iterator pos1, iterator pos2);
-       /// erase single atom
-       void erase(iterator pos);
-       /// erase range from pos1 to pos2
-       void erase(size_type pos1, size_type pos2);
-       /// erase single atom
-       void erase(size_type pos);
-
-       ///
-       void dump() const;
-       ///
-       void dump2() const;
-       ///
-       void replace(ReplaceData &);
-       ///
-       void substitute(MathArray const & m);
-
-       /// looks for exact match
-       bool match(MathArray const & ar) const;
-       /// looks for inclusion match starting at pos
-       bool matchpart(MathArray const & ar, pos_type pos) const;
-       /// looks for containment, return == size mean not found
-       size_type find(MathArray const & ar) const;
-       /// looks for containment, return == size mean not found
-       size_type find_last(MathArray const & ar) const;
-       ///
-       bool contains(MathArray const & ar) const;
-       ///
-       void validate(LaTeXFeatures &) const;
-
-       /// checked write access
-       MathAtom & operator[](pos_type);
-       /// checked read access
-       MathAtom const & operator[](pos_type) const;
-       /// rebuild cached metrics information
-       void metrics(MetricsInfo & mi) const;
-       /// rebuild cached metrics information
-       bool metrics(MetricsInfo & mi, Dimension & dim) const;
-       /// redraw cell using cache metrics information
-       void draw(PainterInfo & pi, int x, int y) const;
-       /// rebuild cached metrics information
-       void metricsT(TextMetricsInfo const & mi, Dimension & dim) const;
-       /// redraw cell using cache metrics information
-       void drawT(TextPainter & pi, int x, int y) const;
-       /// mark cell for re-drawing
-       void touch() const;
-
-       /// access to cached x coordinate of last drawing
-       int xo(BufferView const & bv) const;
-       /// access to cached y coordinate of last drawing
-       int yo(BufferView const & bv) const;
-       /// access to cached x coordinate of mid point of last drawing
-       int xm(BufferView const & bv) const { return xo(bv) + dim_.wid / 2; }
-       /// access to cached y coordinate of mid point of last drawing
-       int ym(BufferView const & bv) const { return yo(bv) + (dim_.des - dim_.asc) / 2; }
-       /// write access to coordinate;
-       void setXY(BufferView & bv, int x, int y) const;
-       /// returns x coordinate of given position in the array
-       int pos2x(size_type pos) const;
-       /// returns position of given x coordinate
-       int pos2x(size_type pos, int glue) const;
-       /// returns position of given x coordinate
-       size_type x2pos(int pos) const;
-       /// returns position of given x coordinate fstarting from a certain pos
-       size_type x2pos(int targetx, int glue) const;
-       /// returns distance of this cell to the point given by x and y
-       // assumes valid position and size cache
-       int dist(BufferView const & bv, int x, int y) const;
-
-       /// ascent of this cell above the baseline
-       int ascent() const { return dim_.asc; }
-       /// descent of this cell below the baseline
-       int descent() const { return dim_.des; }
-       /// height of the cell
-       int height() const { return dim_.asc + dim_.des; }
-       /// width of this cell
-       int width() const { return dim_.wid; }
-       /// dimensions of cell
-       Dimension const & dim() const { return dim_; }
-       /// dimensions of cell
-       void setDim(Dimension const & d) const { dim_ = d; }
-       /// minimum ascent offset for superscript
-       int minasc() const { return minasc_; }
-       /// minimum descent offset for subscript
-       int mindes() const { return mindes_; }
-       /// level above/below which super/subscript should extend
-       int slevel() const { return slevel_; }
-       /// additional super/subscript shift
-       int sshift() const { return sshift_; }
-       /// superscript kerning
-       int kerning() const { return kerning_; }
-       /// 
-       void swap(MathArray & ar) { base_type::swap(ar); }
-
-protected:
-       /// cached dimensions of cell
-       mutable Dimension dim_;
-       /// cached values for super/subscript placement
-       mutable int minasc_;
-       mutable int mindes_;
-       mutable int slevel_;
-       mutable int sshift_;
-       mutable int kerning_;
-
-private:
-       /// is this an exact match at this position?
-       bool find1(MathArray const & ar, size_type pos) const;
-};
-
-///
-std::ostream & operator<<(std::ostream & os, MathArray const & ar);
-///
-odocstream & operator<<(odocstream & os, MathArray const & ar);
-
-
-} // namespace lyx
-
-#endif
index 2b384d330e0f00e0c685a8549589e1c3be5ab277..f34765ec4d0c1e9a95e14f15344b47b632b0cfa5 100644 (file)
@@ -11,7 +11,7 @@
 #include <config.h>
 
 #include "MathAutoCorrect.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "InsetMath.h"
 #include "MathSupport.h"
 #include "MathParser.h"
@@ -62,7 +62,7 @@ bool Correction::read(idocstream & is)
                return false;
        if (s2.size() != 1)
                return false;
-       MathArray ar1, ar3;
+       MathData ar1, ar3;
        mathed_parse_cell(ar1, s1);
        mathed_parse_cell(ar3, s3);
        if (ar1.size() != 1 || ar3.size() != 1)
diff --git a/src/mathed/MathData.cpp b/src/mathed/MathData.cpp
new file mode 100644 (file)
index 0000000..a0e9222
--- /dev/null
@@ -0,0 +1,485 @@
+/**
+ * \file MathData.cpp
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author André Pönitz
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
+
+#include "MathData.h"
+#include "InsetMathFont.h"
+#include "InsetMathScript.h"
+#include "MathMacro.h"
+#include "MathMacroTable.h"
+#include "MathStream.h"
+#include "MathSupport.h"
+#include "ReplaceData.h"
+
+#include "BufferView.h"
+#include "Buffer.h"
+#include "Cursor.h"
+#include "debug.h"
+#include "LColor.h"
+
+#include "frontends/FontMetrics.h"
+#include "frontends/Painter.h"
+
+#include <boost/assert.hpp>
+
+
+namespace lyx {
+
+using std::abs;
+using std::endl;
+using std::min;
+using std::ostringstream;
+using std::string;
+using std::vector;
+
+
+MathData::MathData(const_iterator from, const_iterator to)
+       : base_type(from, to)
+{}
+
+
+MathAtom & MathData::operator[](pos_type pos)
+{
+       BOOST_ASSERT(pos < size());
+       return base_type::operator[](pos);
+}
+
+
+MathAtom const & MathData::operator[](pos_type pos) const
+{
+       BOOST_ASSERT(pos < size());
+       return base_type::operator[](pos);
+}
+
+
+void MathData::insert(size_type pos, MathAtom const & t)
+{
+       base_type::insert(begin() + pos, t);
+}
+
+
+void MathData::insert(size_type pos, MathData const & ar)
+{
+       BOOST_ASSERT(pos <= size());
+       base_type::insert(begin() + pos, ar.begin(), ar.end());
+}
+
+
+void MathData::append(MathData const & ar)
+{
+       insert(size(), ar);
+}
+
+
+void MathData::erase(size_type pos)
+{
+       if (pos < size())
+               erase(pos, pos + 1);
+}
+
+
+void MathData::erase(iterator pos1, iterator pos2)
+{
+       base_type::erase(pos1, pos2);
+}
+
+
+void MathData::erase(iterator pos)
+{
+       base_type::erase(pos);
+}
+
+
+void MathData::erase(size_type pos1, size_type pos2)
+{
+       base_type::erase(begin() + pos1, begin() + pos2);
+}
+
+
+void MathData::dump2() const
+{
+       odocstringstream os;
+       NormalStream ns(os);
+       for (const_iterator it = begin(); it != end(); ++it)
+               ns << *it << ' ';
+       lyxerr << to_utf8(os.str());
+}
+
+
+void MathData::dump() const
+{
+       odocstringstream os;
+       NormalStream ns(os);
+       for (const_iterator it = begin(); it != end(); ++it)
+               ns << '<' << *it << '>';
+       lyxerr << to_utf8(os.str());
+}
+
+
+void MathData::validate(LaTeXFeatures & features) const
+{
+       for (const_iterator it = begin(); it != end(); ++it)
+               (*it)->validate(features);
+}
+
+
+bool MathData::match(MathData const & ar) const
+{
+       return size() == ar.size() && matchpart(ar, 0);
+}
+
+
+bool MathData::matchpart(MathData const & ar, pos_type pos) const
+{
+       if (size() < ar.size() + pos)
+               return false;
+       const_iterator it = begin() + pos;
+       for (const_iterator jt = ar.begin(); jt != ar.end(); ++jt, ++it)
+               if (asString(*it) != asString(*jt))
+                       return false;
+       return true;
+}
+
+
+void MathData::replace(ReplaceData & rep)
+{
+       for (size_type i = 0; i < size(); ++i) {
+               if (find1(rep.from, i)) {
+                       // match found
+                       lyxerr << "match found!" << endl;
+                       erase(i, i + rep.from.size());
+                       insert(i, rep.to);
+               }
+       }
+
+#ifdef WITH_WARNINGS
+#warning temporarily disabled
+       // for (const_iterator it = begin(); it != end(); ++it)
+       //      it->nucleus()->replace(rep);
+#endif
+}
+
+
+bool MathData::find1(MathData const & ar, size_type pos) const
+{
+       lyxerr << "finding '" << ar << "' in '" << *this << "'" << endl;
+       for (size_type i = 0, n = ar.size(); i < n; ++i)
+               if (asString(operator[](pos + i)) != asString(ar[i]))
+                       return false;
+       return true;
+}
+
+
+MathData::size_type MathData::find(MathData const & ar) const
+{
+       for (int i = 0, last = size() - ar.size(); i < last; ++i)
+               if (find1(ar, i))
+                       return i;
+       return size();
+}
+
+
+MathData::size_type MathData::find_last(MathData const & ar) const
+{
+       for (int i = size() - ar.size(); i >= 0; --i)
+               if (find1(ar, i))
+                       return i;
+       return size();
+}
+
+
+bool MathData::contains(MathData const & ar) const
+{
+       if (find(ar) != size())
+               return true;
+       for (const_iterator it = begin(); it != end(); ++it)
+               if ((*it)->contains(ar))
+                       return true;
+       return false;
+}
+
+
+void MathData::touch() const
+{
+}
+
+
+bool MathData::metrics(MetricsInfo & mi, Dimension & dim) const
+{
+       dim = dim_;
+       metrics(mi);
+       if (dim_ == dim)
+               return false;
+       dim = dim_;
+       return true;
+}
+
+
+namespace {
+
+bool isInside(DocIterator const & it, MathData const & ar,
+       pos_type p1, pos_type p2)
+{
+       for (size_t i = 0; i != it.depth(); ++i) {
+               CursorSlice const & sl = it[i];
+               if (sl.inset().inMathed() && &sl.cell() == &ar)
+                       return p1 <= sl.pos() && sl.pos() < p2;
+       }
+       return false;
+}
+
+}
+
+
+
+void MathData::metrics(MetricsInfo & mi) const
+{
+       frontend::FontMetrics const & fm = theFontMetrics(mi.base.font);
+       dim_ = fm.dimension('I');
+       int xascent = fm.dimension('x').ascent();
+       if (xascent >= dim_.asc)
+               xascent = (2 * dim_.asc) / 3;
+       minasc_ = xascent;
+       mindes_ = (3 * xascent) / 4;
+       slevel_ = (4 * xascent) / 5;
+       sshift_ = xascent / 4;
+       kerning_ = 0;
+
+       if (empty())
+               return;
+
+       dim_.asc = 0;
+       dim_.wid = 0;
+       Dimension d;
+       //BufferView & bv  = *mi.base.bv;
+       //Buffer const & buf = *bv.buffer();
+       for (size_t i = 0, n = size(); i != n; ++i) {
+               MathAtom const & at = operator[](i);
+#if 0
+               MathMacro const * mac = at->asMacro();
+               if (mac && buf.hasMacro(mac->name())) {
+                       MacroData const & tmpl = buf.getMacro(mac->name());
+                       int numargs = tmpl.numargs();
+                       if (i + numargs > n)
+                               numargs = n - i - 1;
+                       lyxerr << "metrics:found macro: " << mac->name()
+                               << " numargs: " << numargs << endl;
+                       if (!isInside(bv.cursor(), *this, i + 1, i + numargs + 1)) {
+                               MathData args(begin() + i + 1, begin() + i + numargs + 1);
+                               MathData exp;
+                               tmpl.expand(args, exp);
+                               mac->setExpansion(exp, args);
+                               mac->metricsExpanded(mi, d);
+                               dim_.wid += mac->widthExpanded();
+                               i += numargs;
+                               continue;
+                       }
+               }
+#endif
+               at->metrics(mi, d);
+               dim_ += d;
+               if (i == n - 1)
+                       kerning_ = at->kerning();
+       }
+}
+
+
+void MathData::draw(PainterInfo & pi, int x, int y) const
+{
+       //lyxerr << "MathData::draw: x: " << x << " y: " << y << endl;
+       BufferView & bv  = *pi.base.bv;
+       setXY(bv, x, y);
+
+       if (empty()) {
+               pi.pain.rectangle(x, y - ascent(), width(), height(), LColor::mathline);
+               return;
+       }
+
+       // don't draw outside the workarea
+       if (y + descent() <= 0
+               || y - ascent() >= bv.workHeight()
+               || x + width() <= 0
+               || x >= bv. workWidth())
+               return;
+
+       for (size_t i = 0, n = size(); i != n; ++i) {
+               MathAtom const & at = operator[](i);
+#if 0
+       Buffer const & buf = bv.buffer();
+               // special macro handling
+               MathMacro const * mac = at->asMacro();
+               if (mac && buf.hasMacro(mac->name())) {
+                       MacroData const & tmpl = buf.getMacro(mac->name());
+                       int numargs = tmpl.numargs();
+                       if (i + numargs > n)
+                               numargs = n - i - 1;
+                       if (!isInside(bv.cursor(), *this, i + 1, i + numargs + 1)) {
+                               mac->drawExpanded(pi, x, y);
+                               x += mac->widthExpanded();
+                               i += numargs;
+                               continue;
+                       }
+               }
+#endif
+               bv.coordCache().insets().add(at.nucleus(), x, y);
+               at->drawSelection(pi, x, y);
+               at->draw(pi, x, y);
+               x += at->width();
+       }
+}
+
+
+void MathData::metricsT(TextMetricsInfo const & mi, Dimension & dim) const
+{
+       dim.clear();
+       Dimension d;
+       for (const_iterator it = begin(); it != end(); ++it) {
+               (*it)->metricsT(mi, d);
+               dim += d;
+       }
+}
+
+
+void MathData::drawT(TextPainter & pain, int x, int y) const
+{
+       //lyxerr << "x: " << x << " y: " << y << ' ' << pain.workAreaHeight() << endl;
+
+       // FIXME: Abdel 16/10/2006
+       // This drawT() method is never used, this is dead code.
+
+       for (const_iterator it = begin(), et = end(); it != et; ++it) {
+               (*it)->drawT(pain, x, y);
+               //x += (*it)->width_;
+               x += 2;
+       }
+}
+
+
+int MathData::pos2x(size_type pos) const
+{
+       return pos2x(pos, 0);
+}
+
+
+int MathData::pos2x(size_type pos, int glue) const
+{
+       int x = 0;
+       size_type target = min(pos, size());
+       for (size_type i = 0; i < target; ++i) {
+               const_iterator it = begin() + i;
+               if ((*it)->getChar() == ' ')
+                       x += glue;
+               //lyxerr << "char: " << (*it)->getChar()
+               //      << "width: " << (*it)->width() << std::endl;
+               x += (*it)->width();
+       }
+       return x;
+}
+
+
+MathData::size_type MathData::x2pos(int targetx) const
+{
+       return x2pos(targetx, 0);
+}
+
+
+MathData::size_type MathData::x2pos(int targetx, int glue) const
+{
+       const_iterator it = begin();
+       int lastx = 0;
+       int currx = 0;
+       // find first position after targetx
+       for (; currx < targetx && it < end(); ++it) {
+               lastx = currx;
+               if ((*it)->getChar() == ' ')
+                       currx += glue;
+               currx += (*it)->width();
+       }
+
+       /**
+        * If we are not at the beginning of the array, go to the left
+        * of the inset if one of the following two condition holds:
+        * - the current inset is editable (so that the cursor tip is
+        *   deeper than us): in this case, we want all intermediate
+        *   cursor slices to be before insets;
+        * - the mouse is closer to the left side of the inset than to
+        *   the right one.
+        * See bug 1918 for details.
+        **/
+       if (it != begin() && currx >= targetx
+           && ((*boost::prior(it))->asNestInset()
+               || abs(lastx - targetx) < abs(currx - targetx))) {
+               --it;
+       }
+
+       return it - begin();
+}
+
+
+int MathData::dist(BufferView const & bv, int x, int y) const
+{
+       int xx = 0;
+       int yy = 0;
+
+       const int xo_ = xo(bv);
+       const int yo_ = yo(bv);
+
+       if (x < xo_)
+               xx = xo_ - x;
+       else if (x > xo_ + width())
+               xx = x - xo_ - width();
+
+       if (y < yo_ - ascent())
+               yy = yo_ - ascent() - y;
+       else if (y > yo_ + descent())
+               yy = y - yo_ - descent();
+
+       return xx + yy;
+}
+
+
+void MathData::setXY(BufferView & bv, int x, int y) const
+{
+       //lyxerr << "setting position cache for MathData " << this << std::endl;
+       bv.coordCache().arrays().add(this, x, y);
+}
+
+
+int MathData::xo(BufferView const & bv) const
+{
+       return bv.coordCache().getArrays().x(this);
+}
+
+
+int MathData::yo(BufferView const & bv) const
+{
+       return bv.coordCache().getArrays().y(this);
+}
+
+
+std::ostream & operator<<(std::ostream & os, MathData const & ar)
+{
+       odocstringstream oss;
+       NormalStream ns(oss);
+       ns << ar;
+       return os << to_utf8(oss.str());
+}
+
+
+odocstream & operator<<(odocstream & os, MathData const & ar)
+{
+       NormalStream ns(os);
+       ns << ar;
+       return os;
+}
+
+
+} // namespace lyx
diff --git a/src/mathed/MathData.h b/src/mathed/MathData.h
new file mode 100644 (file)
index 0000000..f2cde12
--- /dev/null
@@ -0,0 +1,188 @@
+// -*- C++ -*-
+/**
+ * \file MathData.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Alejandro Aguilar Sierra
+ * \author André Pönitz
+ * \author Lars Gullik Bjønnes
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef MATH_DATA_H
+#define MATH_DATA_H
+
+#include <vector>
+
+#include "MathAtom.h"
+#include "Dimension.h"
+
+#include "support/docstream.h"
+
+
+namespace lyx {
+
+class BufferView;
+class LaTeXFeatures;
+class ReplaceData;
+class MetricsInfo;
+class PainterInfo;
+class TextMetricsInfo;
+class TextPainter;
+
+
+class MathData : private std::vector<MathAtom> {
+public:
+       /// re-use inhertited stuff
+       typedef std::vector<MathAtom> base_type;
+       using base_type::const_iterator;
+       using base_type::iterator;
+       using base_type::size_type;
+       using base_type::difference_type;
+       using base_type::size;
+       using base_type::empty;
+       using base_type::clear;
+       using base_type::begin;
+       using base_type::end;
+       using base_type::push_back;
+       using base_type::pop_back;
+       using base_type::back;
+       using base_type::front;
+       ///
+       typedef size_type idx_type;
+       typedef size_type pos_type;
+
+public:
+       ///
+       MathData() {}
+       ///
+       MathData(const_iterator from, const_iterator to);
+       ///
+       void append(MathData const & ar);
+
+       /// inserts single atom at position pos
+       void insert(size_type pos, MathAtom const & at);
+       /// inserts multiple atoms at position pos
+       void insert(size_type pos, MathData const & ar);
+
+       /// erase range from pos1 to pos2
+       void erase(iterator pos1, iterator pos2);
+       /// erase single atom
+       void erase(iterator pos);
+       /// erase range from pos1 to pos2
+       void erase(size_type pos1, size_type pos2);
+       /// erase single atom
+       void erase(size_type pos);
+
+       ///
+       void dump() const;
+       ///
+       void dump2() const;
+       ///
+       void replace(ReplaceData &);
+       ///
+       void substitute(MathData const & m);
+
+       /// looks for exact match
+       bool match(MathData const & ar) const;
+       /// looks for inclusion match starting at pos
+       bool matchpart(MathData const & ar, pos_type pos) const;
+       /// looks for containment, return == size mean not found
+       size_type find(MathData const & ar) const;
+       /// looks for containment, return == size mean not found
+       size_type find_last(MathData const & ar) const;
+       ///
+       bool contains(MathData const & ar) const;
+       ///
+       void validate(LaTeXFeatures &) const;
+
+       /// checked write access
+       MathAtom & operator[](pos_type);
+       /// checked read access
+       MathAtom const & operator[](pos_type) const;
+       /// rebuild cached metrics information
+       void metrics(MetricsInfo & mi) const;
+       /// rebuild cached metrics information
+       bool metrics(MetricsInfo & mi, Dimension & dim) const;
+       /// redraw cell using cache metrics information
+       void draw(PainterInfo & pi, int x, int y) const;
+       /// rebuild cached metrics information
+       void metricsT(TextMetricsInfo const & mi, Dimension & dim) const;
+       /// redraw cell using cache metrics information
+       void drawT(TextPainter & pi, int x, int y) const;
+       /// mark cell for re-drawing
+       void touch() const;
+
+       /// access to cached x coordinate of last drawing
+       int xo(BufferView const & bv) const;
+       /// access to cached y coordinate of last drawing
+       int yo(BufferView const & bv) const;
+       /// access to cached x coordinate of mid point of last drawing
+       int xm(BufferView const & bv) const { return xo(bv) + dim_.wid / 2; }
+       /// access to cached y coordinate of mid point of last drawing
+       int ym(BufferView const & bv) const { return yo(bv) + (dim_.des - dim_.asc) / 2; }
+       /// write access to coordinate;
+       void setXY(BufferView & bv, int x, int y) const;
+       /// returns x coordinate of given position in the array
+       int pos2x(size_type pos) const;
+       /// returns position of given x coordinate
+       int pos2x(size_type pos, int glue) const;
+       /// returns position of given x coordinate
+       size_type x2pos(int pos) const;
+       /// returns position of given x coordinate fstarting from a certain pos
+       size_type x2pos(int targetx, int glue) const;
+       /// returns distance of this cell to the point given by x and y
+       // assumes valid position and size cache
+       int dist(BufferView const & bv, int x, int y) const;
+
+       /// ascent of this cell above the baseline
+       int ascent() const { return dim_.asc; }
+       /// descent of this cell below the baseline
+       int descent() const { return dim_.des; }
+       /// height of the cell
+       int height() const { return dim_.asc + dim_.des; }
+       /// width of this cell
+       int width() const { return dim_.wid; }
+       /// dimensions of cell
+       Dimension const & dim() const { return dim_; }
+       /// dimensions of cell
+       void setDim(Dimension const & d) const { dim_ = d; }
+       /// minimum ascent offset for superscript
+       int minasc() const { return minasc_; }
+       /// minimum descent offset for subscript
+       int mindes() const { return mindes_; }
+       /// level above/below which super/subscript should extend
+       int slevel() const { return slevel_; }
+       /// additional super/subscript shift
+       int sshift() const { return sshift_; }
+       /// superscript kerning
+       int kerning() const { return kerning_; }
+       /// 
+       void swap(MathData & ar) { base_type::swap(ar); }
+
+protected:
+       /// cached dimensions of cell
+       mutable Dimension dim_;
+       /// cached values for super/subscript placement
+       mutable int minasc_;
+       mutable int mindes_;
+       mutable int slevel_;
+       mutable int sshift_;
+       mutable int kerning_;
+
+private:
+       /// is this an exact match at this position?
+       bool find1(MathData const & ar, size_type pos) const;
+};
+
+///
+std::ostream & operator<<(std::ostream & os, MathData const & ar);
+///
+odocstream & operator<<(odocstream & os, MathData const & ar);
+
+
+} // namespace lyx
+
+#endif
index a0ba5e33dccd23c54bf1f39e4889db9e15868664..260ab5138f442461ca69fb9b55ca7593a78e01a1 100644 (file)
@@ -10,7 +10,7 @@
 
 // This file contains most of the magic that extracts "context
 // information" from the unstructered layout-oriented stuff in an
-// MathArray.
+// MathData.
 
 #include <config.h>
 
@@ -18,7 +18,7 @@
 #include "InsetMathArray.h"
 #include "InsetMathChar.h"
 #include "InsetMathDelim.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "InsetMathDiff.h"
 #include "InsetMathExFunc.h"
 #include "InsetMathExInt.h"
@@ -72,14 +72,14 @@ static size_t const npos = lyx::docstring::npos;
 typedef bool TestItemFunc(MathAtom const &);
 
 // define a function for replacing subexpressions
-typedef MathAtom ReplaceArgumentFunc(const MathArray & ar);
+typedef MathAtom ReplaceArgumentFunc(const MathData & ar);
 
 
 
 // try to extract a super/subscript
 // modify iterator position to point behind the thing
-bool extractScript(MathArray & ar,
-       MathArray::iterator & pos, MathArray::iterator last, bool superscript)
+bool extractScript(MathData & ar,
+       MathData::iterator & pos, MathData::iterator last, bool superscript)
 {
        // nothing to get here
        if (pos == last)
@@ -102,8 +102,8 @@ bool extractScript(MathArray & ar,
 
 // try to extract an "argument" to some function.
 // returns position behind the argument
-MathArray::iterator extractArgument(MathArray & ar,
-       MathArray::iterator pos, MathArray::iterator last, bool function = false)
+MathData::iterator extractArgument(MathData & ar,
+       MathData::iterator pos, MathData::iterator last, bool function = false)
 {
        // nothing to get here
        if (pos == last)
@@ -113,9 +113,9 @@ MathArray::iterator extractArgument(MathArray & ar,
        if ((*pos)->asDelimInset()) {
                // leave out delimiters if this is a function argument
                if (function) {
-                       MathArray const & arg = (*pos)->asDelimInset()->cell(0);
-                       MathArray::const_iterator cur = arg.begin();
-                       MathArray::const_iterator end = arg.end();
+                       MathData const & arg = (*pos)->asDelimInset()->cell(0);
+                       MathData::const_iterator cur = arg.begin();
+                       MathData::const_iterator end = arg.end();
                        while (cur != end)
                                ar.push_back(*cur++);
                } else
@@ -146,7 +146,7 @@ MathArray::iterator extractArgument(MathArray & ar,
 
        // but it might be more than that.
        // FIXME: not implemented
-       //for (MathArray::iterator it = pos + 1; it != last; ++it) {
+       //for (MathData::iterator it = pos + 1; it != last; ++it) {
        //      // always take the first thing, no matter
        //      if (it == pos) {
        //              ar.push_back(*it);
@@ -160,7 +160,7 @@ MathArray::iterator extractArgument(MathArray & ar,
 // returns sequence of char with same code starting at it up to end
 // it might be less, though...
 docstring charSequence
-       (MathArray::const_iterator it, MathArray::const_iterator end)
+       (MathData::const_iterator it, MathData::const_iterator end)
 {
        docstring s;
        for (; it != end && (*it)->asCharInset(); ++it)
@@ -169,7 +169,7 @@ docstring charSequence
 }
 
 
-void extractStrings(MathArray & ar)
+void extractStrings(MathData & ar)
 {
        //lyxerr << "\nStrings from: " << ar << endl;
        for (size_t i = 0; i < ar.size(); ++i) {
@@ -183,14 +183,14 @@ void extractStrings(MathArray & ar)
 }
 
 
-void extractMatrices(MathArray & ar)
+void extractMatrices(MathData & ar)
 {
        //lyxerr << "\nMatrices from: " << ar << endl;
        // first pass for explicitly delimited stuff
        for (size_t i = 0; i < ar.size(); ++i) {
                if (!ar[i]->asDelimInset())
                        continue;
-               MathArray const & arr = ar[i]->asDelimInset()->cell(0);
+               MathData const & arr = ar[i]->asDelimInset()->cell(0);
                if (arr.size() != 1)
                        continue;
                if (!arr.front()->asGridInset())
@@ -246,7 +246,7 @@ bool extractFunctionName(MathAtom const & at, docstring & str)
        }
        if (at->asFontInset() && at->name() == "mathrm") {
                // assume it is well known...
-               MathArray const & ar = at->asFontInset()->cell(0);
+               MathData const & ar = at->asFontInset()->cell(0);
                str = charSequence(ar.begin(), ar.end());
                return ar.size() == str.size();
        }
@@ -255,7 +255,7 @@ bool extractFunctionName(MathAtom const & at, docstring & str)
 
 
 // convert this inset somehow to a number
-bool extractNumber(MathArray const & ar, int & i)
+bool extractNumber(MathData const & ar, int & i)
 {
        idocstringstream is(charSequence(ar.begin(), ar.end()));
        is >> i;
@@ -263,7 +263,7 @@ bool extractNumber(MathArray const & ar, int & i)
 }
 
 
-bool extractNumber(MathArray const & ar, double & d)
+bool extractNumber(MathData const & ar, double & d)
 {
        idocstringstream is(charSequence(ar.begin(), ar.end()));
        is >> d;
@@ -284,9 +284,9 @@ bool testString(MathAtom const & at, char const * const str)
 }
 
 // search end of nested sequence
-MathArray::iterator endNestSearch(
-       MathArray::iterator it,
-       MathArray::iterator last,
+MathData::iterator endNestSearch(
+       MathData::iterator it,
+       MathData::iterator last,
        TestItemFunc testOpen,
        TestItemFunc testClose
 )
@@ -305,7 +305,7 @@ MathArray::iterator endNestSearch(
 
 // replace nested sequences by a real Insets
 void replaceNested(
-       MathArray & ar,
+       MathData & ar,
        TestItemFunc testOpen,
        TestItemFunc testClose,
        ReplaceArgumentFunc replaceArg
@@ -319,13 +319,13 @@ void replaceNested(
                        continue;
 
                // search end of sequence
-               MathArray::iterator it = ar.begin() + i;
-               MathArray::iterator jt = endNestSearch(it, ar.end(), testOpen, testClose);
+               MathData::iterator it = ar.begin() + i;
+               MathData::iterator jt = endNestSearch(it, ar.end(), testOpen, testClose);
                if (jt == ar.end())
                        continue;
 
                // replace the original stuff by the new inset
-               ar[i] = replaceArg(MathArray(it + 1, jt));
+               ar[i] = replaceArg(MathData(it + 1, jt));
                ar.erase(it + 1, jt + 1);
        }
 }
@@ -337,7 +337,7 @@ void replaceNested(
 // front of super...
 //
 
-void splitScripts(MathArray & ar)
+void splitScripts(MathData & ar)
 {
        //lyxerr << "\nScripts from: " << ar << endl;
        for (size_t i = 0; i < ar.size(); ++i) {
@@ -367,9 +367,9 @@ void splitScripts(MathArray & ar)
 
                // if we don't have a subscript, get rid of the ScriptInset
                if (!script->hasDown()) {
-                       MathArray arg(p->nuc());
-                       MathArray::const_iterator it = arg.begin();
-                       MathArray::const_iterator et = arg.end();
+                       MathData arg(p->nuc());
+                       MathData::const_iterator it = arg.begin();
+                       MathData::const_iterator et = arg.end();
                        ar.erase(i);
                        while (it != et)
                                ar.insert(i++, *it++);
@@ -387,7 +387,7 @@ void splitScripts(MathArray & ar)
 // extract exp(...)
 //
 
-void extractExps(MathArray & ar)
+void extractExps(MathData & ar)
 {
        //lyxerr << "\nExps from: " << ar << endl;
        for (size_t i = 0; i + 1 < ar.size(); ++i) {
@@ -411,10 +411,10 @@ void extractExps(MathArray & ar)
 //
 // extract det(...)  from |matrix|
 //
-void extractDets(MathArray & ar)
+void extractDets(MathData & ar)
 {
        //lyxerr << "\ndet from: " << ar << endl;
-       for (MathArray::iterator it = ar.begin(); it != ar.end(); ++it) {
+       for (MathData::iterator it = ar.begin(); it != ar.end(); ++it) {
                InsetMathDelim const * del = (*it)->asDelimInset();
                if (!del)
                        continue;
@@ -438,7 +438,7 @@ bool isDigitOrSimilar(char_type c)
 
 // returns sequence of digits
 docstring digitSequence
-       (MathArray::const_iterator it, MathArray::const_iterator end)
+       (MathData::const_iterator it, MathData::const_iterator end)
 {
        docstring s;
        for (; it != end && (*it)->asCharInset(); ++it) {
@@ -450,7 +450,7 @@ docstring digitSequence
 }
 
 
-void extractNumbers(MathArray & ar)
+void extractNumbers(MathData & ar)
 {
        //lyxerr << "\nNumbers from: " << ar << endl;
        for (size_t i = 0; i < ar.size(); ++i) {
@@ -485,7 +485,7 @@ bool testCloseParen(MathAtom const & at)
 }
 
 
-MathAtom replaceParenDelims(const MathArray & ar)
+MathAtom replaceParenDelims(const MathData & ar)
 {
        return MathAtom(new InsetMathDelim(from_ascii("("), from_ascii(")"), ar));
 }
@@ -503,14 +503,14 @@ bool testCloseBracket(MathAtom const & at)
 }
 
 
-MathAtom replaceBracketDelims(const MathArray & ar)
+MathAtom replaceBracketDelims(const MathData & ar)
 {
        return MathAtom(new InsetMathDelim(from_ascii("["), from_ascii("]"), ar));
 }
 
 
 // replace '('...')' and '['...']' sequences by a real InsetMathDelim
-void extractDelims(MathArray & ar)
+void extractDelims(MathData & ar)
 {
        //lyxerr << "\nDelims from: " << ar << endl;
        replaceNested(ar, testOpenParen, testCloseParen, replaceParenDelims);
@@ -527,7 +527,7 @@ void extractDelims(MathArray & ar)
 
 // replace 'f' '(...)' and 'f' '^n' '(...)' sequences by a real InsetMathExFunc
 // assume 'extractDelims' ran before
-void extractFunctions(MathArray & ar)
+void extractFunctions(MathData & ar)
 {
        // we need at least two items...
        if (ar.size() < 2)
@@ -535,8 +535,8 @@ void extractFunctions(MathArray & ar)
 
        //lyxerr << "\nFunctions from: " << ar << endl;
        for (size_t i = 0; i + 1 < ar.size(); ++i) {
-               MathArray::iterator it = ar.begin() + i;
-               MathArray::iterator jt = it + 1;
+               MathData::iterator it = ar.begin() + i;
+               MathData::iterator jt = it + 1;
 
                docstring name;
                // is it a function?
@@ -559,14 +559,14 @@ void extractFunctions(MathArray & ar)
 
                // do we have an exponent like in
                // 'sin' '^2' 'x' -> 'sin(x)' '^2'
-               MathArray exp;
+               MathData exp;
                extractScript(exp, jt, ar.end(), true);
 
                // create a proper inset as replacement
                auto_ptr<InsetMathExFunc> p(new InsetMathExFunc(name));
 
                // jt points to the "argument". Get hold of this.
-               MathArray::iterator st = extractArgument(p->cell(0), jt, ar.end(), true);
+               MathData::iterator st = extractArgument(p->cell(0), jt, ar.end(), true);
 
                // replace the function name by a real function inset
                *it = MathAtom(p.release());
@@ -622,7 +622,7 @@ bool testIntDiff(MathAtom const & at)
 
 // replace '\int' ['_^'] x 'd''x'(...)' sequences by a real InsetMathExInt
 // assume 'extractDelims' ran before
-void extractIntegrals(MathArray & ar)
+void extractIntegrals(MathData & ar)
 {
        // we need at least three items...
        if (ar.size() < 3)
@@ -630,10 +630,10 @@ void extractIntegrals(MathArray & ar)
 
        //lyxerr << "\nIntegrals from: " << ar << endl;
        for (size_t i = 0; i + 1 < ar.size(); ++i) {
-               MathArray::iterator it = ar.begin() + i;
+               MathData::iterator it = ar.begin() + i;
 
                // search 'd'
-               MathArray::iterator jt =
+               MathData::iterator jt =
                        endNestSearch(it, ar.end(), testIntegral, testIntDiff);
 
                // something sensible found?
@@ -652,10 +652,10 @@ void extractIntegrals(MathArray & ar)
                        p->cell(2) = (*it)->asScriptInset()->down();
                        p->cell(3) = (*it)->asScriptInset()->up();
                }
-               p->cell(0) = MathArray(it + 1, jt);
+               p->cell(0) = MathData(it + 1, jt);
 
                // use the "thing" behind the 'd' as differential
-               MathArray::iterator tt = extractArgument(p->cell(1), jt + 1, ar.end());
+               MathData::iterator tt = extractArgument(p->cell(1), jt + 1, ar.end());
 
                // remove used parts
                ar.erase(it + 1, tt);
@@ -673,8 +673,8 @@ bool testTermDelimiter(MathAtom const & at)
 
 // try to extract a "term", i.e., something delimited by '+' or '-'.
 // returns position behind the term
-MathArray::iterator extractTerm(MathArray & ar,
-       MathArray::iterator pos, MathArray::iterator last)
+MathData::iterator extractTerm(MathData & ar,
+       MathData::iterator pos, MathData::iterator last)
 {
        while (pos != last && !testTermDelimiter(*pos)) {
                ar.push_back(*pos);
@@ -713,7 +713,7 @@ bool testSum(MathAtom const & at)
 
 // replace '\sum' ['_^'] f(x) sequences by a real InsetMathExInt
 // assume 'extractDelims' ran before
-void extractSums(MathArray & ar)
+void extractSums(MathData & ar)
 {
        // we need at least two items...
        if (ar.size() < 2)
@@ -721,7 +721,7 @@ void extractSums(MathArray & ar)
 
        //lyxerr << "\nSums from: " << ar << endl;
        for (size_t i = 0; i + 1 < ar.size(); ++i) {
-               MathArray::iterator it = ar.begin() + i;
+               MathData::iterator it = ar.begin() + i;
 
                // is this a sum name?
                if (!testSum(ar[i]))
@@ -734,14 +734,14 @@ void extractSums(MathArray & ar)
                InsetMathScript const * sub = ar[i]->asScriptInset();
                if (sub && sub->hasDown()) {
                        // try to figure out the summation index from the subscript
-                       MathArray const & ar = sub->down();
-                       MathArray::const_iterator xt =
+                       MathData const & ar = sub->down();
+                       MathData::const_iterator xt =
                                find_if(ar.begin(), ar.end(), &testEqualSign);
                        if (xt != ar.end()) {
                                // we found a '=', use everything in front of that as index,
                                // and everything behind as lower index
-                               p->cell(1) = MathArray(ar.begin(), xt);
-                               p->cell(2) = MathArray(xt + 1, ar.end());
+                               p->cell(1) = MathData(ar.begin(), xt);
+                               p->cell(2) = MathData(xt + 1, ar.end());
                        } else {
                                // use everything as summation index, don't use scripts.
                                p->cell(1) = ar;
@@ -753,7 +753,7 @@ void extractSums(MathArray & ar)
                        p->cell(3) = sub->up();
 
                // use something  behind the script as core
-               MathArray::iterator tt = extractTerm(p->cell(0), it + 1, ar.end());
+               MathData::iterator tt = extractTerm(p->cell(0), it + 1, ar.end());
 
                // cleanup
                ar.erase(it + 1, tt);
@@ -783,7 +783,7 @@ bool testDiffItem(MathAtom const & at)
 }
 
 
-bool testDiffArray(MathArray const & ar)
+bool testDiffArray(MathData const & ar)
 {
        return ar.size() && testDiffItem(ar.front());
 }
@@ -798,11 +798,11 @@ bool testDiffFrac(MathAtom const & at)
 }
 
 
-void extractDiff(MathArray & ar)
+void extractDiff(MathData & ar)
 {
        //lyxerr << "\nDiffs from: " << ar << endl;
        for (size_t i = 0; i < ar.size(); ++i) {
-               MathArray::iterator it = ar.begin() + i;
+               MathData::iterator it = ar.begin() + i;
 
                // is this a "differential fraction"?
                if (!testDiffFrac(*it))
@@ -818,36 +818,36 @@ void extractDiff(MathArray & ar)
                auto_ptr<InsetMathDiff> diff(new InsetMathDiff);
 
                // collect function, let jt point behind last used item
-               MathArray::iterator jt = it + 1;
+               MathData::iterator jt = it + 1;
                //int n = 1;
-               MathArray numer(f->cell(0));
+               MathData numer(f->cell(0));
                splitScripts(numer);
                if (numer.size() > 1 && numer[1]->asScriptInset()) {
                        // this is something like  d^n f(x) / d... or  d^n / d...
                        // FIXME
                        //n = 1;
                        if (numer.size() > 2)
-                               diff->cell(0) = MathArray(numer.begin() + 2, numer.end());
+                               diff->cell(0) = MathData(numer.begin() + 2, numer.end());
                        else
                                jt = extractTerm(diff->cell(0), jt, ar.end());
                } else {
                        // simply d f(x) / d... or  d/d...
                        if (numer.size() > 1)
-                               diff->cell(0) = MathArray(numer.begin() + 1, numer.end());
+                               diff->cell(0) = MathData(numer.begin() + 1, numer.end());
                        else
                                jt = extractTerm(diff->cell(0), jt, ar.end());
                }
 
                // collect denominator parts
-               MathArray denom(f->cell(1));
+               MathData denom(f->cell(1));
                splitScripts(denom);
-               for (MathArray::iterator dt = denom.begin(); dt != denom.end();) {
+               for (MathData::iterator dt = denom.begin(); dt != denom.end();) {
                        // find the next 'd'
-                       MathArray::iterator et
+                       MathData::iterator et
                                = find_if(dt + 1, denom.end(), &testDiffItem);
 
                        // point before this
-                       MathArray::iterator st = et - 1;
+                       MathData::iterator st = et - 1;
                        InsetMathScript const * script = (*st)->asScriptInset();
                        if (script && script->hasUp()) {
                                // things like   d.../dx^n
@@ -855,11 +855,11 @@ void extractDiff(MathArray & ar)
                                if (extractNumber(script->up(), mult)) {
                                        //lyxerr << "mult: " << mult << endl;
                                        for (int i = 0; i < mult; ++i)
-                                               diff->addDer(MathArray(dt + 1, st));
+                                               diff->addDer(MathData(dt + 1, st));
                                }
                        } else {
                                // just  d.../dx
-                               diff->addDer(MathArray(dt + 1, et));
+                               diff->addDer(MathData(dt + 1, et));
                        }
                        dt = et;
                }
@@ -886,11 +886,11 @@ bool testRightArrow(MathAtom const & at)
 
 // replace '\lim_{x->x0} f(x)' sequences by a real InsetMathLim
 // assume 'extractDelims' ran before
-void extractLims(MathArray & ar)
+void extractLims(MathData & ar)
 {
        //lyxerr << "\nLimits from: " << ar << endl;
        for (size_t i = 0; i < ar.size(); ++i) {
-               MathArray::iterator it = ar.begin() + i;
+               MathData::iterator it = ar.begin() + i;
 
                // must be a script inset with a subscript (without superscript)
                InsetMathScript const * sub = (*it)->asScriptInset();
@@ -902,18 +902,18 @@ void extractLims(MathArray & ar)
                        continue;
 
                // subscript must contain a -> symbol
-               MathArray const & s = sub->down();
-               MathArray::const_iterator st = find_if(s.begin(), s.end(), &testRightArrow);
+               MathData const & s = sub->down();
+               MathData::const_iterator st = find_if(s.begin(), s.end(), &testRightArrow);
                if (st == s.end())
                        continue;
 
                // the -> splits the subscript int x and x0
-               MathArray x  = MathArray(s.begin(), st);
-               MathArray x0 = MathArray(st + 1, s.end());
+               MathData x  = MathData(s.begin(), st);
+               MathData x0 = MathData(st + 1, s.end());
 
                // use something behind the script as core
-               MathArray f;
-               MathArray::iterator tt = extractTerm(f, it + 1, ar.end());
+               MathData f;
+               MathData::iterator tt = extractTerm(f, it + 1, ar.end());
 
                // cleanup
                ar.erase(it + 1, tt);
@@ -929,7 +929,7 @@ void extractLims(MathArray & ar)
 // combine searches
 //
 
-void extractStructure(MathArray & ar)
+void extractStructure(MathData & ar)
 {
        //lyxerr << "\nStructure from: " << ar << endl;
        splitScripts(ar);
@@ -948,64 +948,64 @@ void extractStructure(MathArray & ar)
 }
 
 
-void write(MathArray const & dat, WriteStream & wi)
+void write(MathData const & dat, WriteStream & wi)
 {
-       MathArray ar = dat;
+       MathData ar = dat;
        extractStrings(ar);
        wi.firstitem() = true;
-       for (MathArray::const_iterator it = ar.begin(); it != ar.end(); ++it) {
+       for (MathData::const_iterator it = ar.begin(); it != ar.end(); ++it) {
                (*it)->write(wi);
                wi.firstitem() = false;
        }
 }
 
 
-void normalize(MathArray const & ar, NormalStream & os)
+void normalize(MathData const & ar, NormalStream & os)
 {
-       for (MathArray::const_iterator it = ar.begin(); it != ar.end(); ++it)
+       for (MathData::const_iterator it = ar.begin(); it != ar.end(); ++it)
                (*it)->normalize(os);
 }
 
 
-void octave(MathArray const & dat, OctaveStream & os)
+void octave(MathData const & dat, OctaveStream & os)
 {
-       MathArray ar = dat;
+       MathData ar = dat;
        extractStructure(ar);
-       for (MathArray::const_iterator it = ar.begin(); it != ar.end(); ++it)
+       for (MathData::const_iterator it = ar.begin(); it != ar.end(); ++it)
                (*it)->octave(os);
 }
 
 
-void maple(MathArray const & dat, MapleStream & os)
+void maple(MathData const & dat, MapleStream & os)
 {
-       MathArray ar = dat;
+       MathData ar = dat;
        extractStructure(ar);
-       for (MathArray::const_iterator it = ar.begin(); it != ar.end(); ++it)
+       for (MathData::const_iterator it = ar.begin(); it != ar.end(); ++it)
                (*it)->maple(os);
 }
 
 
-void maxima(MathArray const & dat, MaximaStream & os)
+void maxima(MathData const & dat, MaximaStream & os)
 {
-       MathArray ar = dat;
+       MathData ar = dat;
        extractStructure(ar);
-       for (MathArray::const_iterator it = ar.begin(); it != ar.end(); ++it)
+       for (MathData::const_iterator it = ar.begin(); it != ar.end(); ++it)
                (*it)->maxima(os);
 }
 
 
-void mathematica(MathArray const & dat, MathematicaStream & os)
+void mathematica(MathData const & dat, MathematicaStream & os)
 {
-       MathArray ar = dat;
+       MathData ar = dat;
        extractStructure(ar);
-       for (MathArray::const_iterator it = ar.begin(); it != ar.end(); ++it)
+       for (MathData::const_iterator it = ar.begin(); it != ar.end(); ++it)
                (*it)->mathematica(os);
 }
 
 
-void mathmlize(MathArray const & dat, MathStream & os)
+void mathmlize(MathData const & dat, MathStream & os)
 {
-       MathArray ar = dat;
+       MathData ar = dat;
        extractStructure(ar);
        if (ar.size() == 0)
                os << "<mrow/>";
@@ -1013,7 +1013,7 @@ void mathmlize(MathArray const & dat, MathStream & os)
                os << ar.front();
        else {
                os << MTag("mrow");
-               for (MathArray::const_iterator it = ar.begin(); it != ar.end(); ++it)
+               for (MathData::const_iterator it = ar.begin(); it != ar.end(); ++it)
                        (*it)->mathmlize(os);
                os << ETag("mrow");
        }
@@ -1081,7 +1081,7 @@ namespace {
                return npos;
        }
 
-       MathArray pipeThroughMaxima(docstring const &, MathArray const & ar)
+       MathData pipeThroughMaxima(docstring const &, MathData const & ar)
        {
                odocstringstream os;
                MaximaStream ms(os);
@@ -1131,7 +1131,7 @@ namespace {
 
                vector<std::string> tmp = getVectorFromString(out, "$$");
                if (tmp.size() < 2)
-                       return MathArray();
+                       return MathData();
 
                out = subst(tmp[1], "\\>", std::string());
                lyxerr << "output: '" << out << "'" << endl;
@@ -1170,13 +1170,13 @@ namespace {
                        //lyxerr << "output: " << out << endl;
                        i = out.find("\\over", i + 4);
                }
-               MathArray res;
+               MathData res;
                mathed_parse_cell(res, from_utf8(out));
                return res;
        }
 
 
-       MathArray pipeThroughMaple(docstring const & extra, MathArray const & ar)
+       MathData pipeThroughMaple(docstring const & extra, MathData const & ar)
        {
                std::string header = "readlib(latex):\n";
 
@@ -1248,13 +1248,13 @@ namespace {
                // change \_ into _
 
                //
-               MathArray res;
+               MathData res;
                mathed_parse_cell(res, from_utf8(out));
                return res;
        }
 
 
-       MathArray pipeThroughOctave(docstring const &, MathArray const & ar)
+       MathData pipeThroughOctave(docstring const &, MathData const & ar)
        {
                odocstringstream os;
                OctaveStream vs(os);
@@ -1307,13 +1307,13 @@ namespace {
                // ansi control sequence before, such as '\033[?1034hans = '
                size_t i = out.find("ans = ");
                if (i == string::npos)
-                       return MathArray();
+                       return MathData();
                out = out.substr(i + 6);
 
                // parse output as matrix or single number
                MathAtom at(new InsetMathArray(from_ascii("array"), from_utf8(out)));
                InsetMathArray const * mat = at->asArrayInset();
-               MathArray res;
+               MathData res;
                if (mat->ncols() == 1 && mat->nrows() == 1)
                        res.append(mat->cell(0));
                else {
@@ -1372,7 +1372,7 @@ namespace {
        }
 
 
-       MathArray pipeThroughMathematica(docstring const &, MathArray const & ar)
+       MathData pipeThroughMathematica(docstring const &, MathData const & ar)
        {
                odocstringstream os;
                MathematicaStream ms(os);
@@ -1391,7 +1391,7 @@ namespace {
                size_t pos2 = out.find("In[2]:=");
 
                if (pos1 == string::npos || pos2 == string::npos)
-                       return MathArray();
+                       return MathData();
 
                // get everything from pos1+17 to pos2
                out = out.substr(pos1 + 17, pos2 - pos1 - 17);
@@ -1402,7 +1402,7 @@ namespace {
                prettifyMathematicaOutput(out, "Muserfunction", true, false);
                prettifyMathematicaOutput(out, "Mvariable", false, false);
 
-               MathArray res;
+               MathData res;
                mathed_parse_cell(res, from_utf8(out));
                return res;
        }
@@ -1410,8 +1410,8 @@ namespace {
 }
 
 
-MathArray pipeThroughExtern(string const & lang, docstring const & extra,
-       MathArray const & ar)
+MathData pipeThroughExtern(string const & lang, docstring const & extra,
+       MathData const & ar)
 {
        if (lang == "octave")
                return pipeThroughOctave(extra, ar);
@@ -1438,12 +1438,12 @@ MathArray pipeThroughExtern(string const & lang, docstring const & extra,
        support::FileName const file = libFileSearch("mathed", "extern_" + lang);
        if (file.empty()) {
                lyxerr << "converter to '" << lang << "' not found" << endl;
-               return MathArray();
+               return MathData();
        }
 
        // run external sript
        string out = captureOutput(file.absFilename(), data);
-       MathArray res;
+       MathData res;
        mathed_parse_cell(res, from_utf8(out));
        return res;
 }
index 20fe9849ebc4631858215bb1c6773b28f7d30b3b..82b053195ff0e9c877c6c7af9013acff4ef2ef07 100644 (file)
@@ -24,21 +24,21 @@ class MathematicaStream;
 class MathStream;
 class OctaveStream;
 class WriteStream;
-class MathArray;
+class MathData;
 
-void write(MathArray const &, WriteStream &);
-void normalize(MathArray const &, NormalStream &);
-void maple(MathArray const &, MapleStream &);
-void maxima(MathArray const &, MaximaStream &);
-void mathematica(MathArray const &, MathematicaStream &);
-void mathmlize(MathArray const &, MathStream &);
-void octave(MathArray const &, OctaveStream &);
+void write(MathData const &, WriteStream &);
+void normalize(MathData const &, NormalStream &);
+void maple(MathData const &, MapleStream &);
+void maxima(MathData const &, MaximaStream &);
+void mathematica(MathData const &, MathematicaStream &);
+void mathmlize(MathData const &, MathStream &);
+void octave(MathData const &, OctaveStream &);
 
-bool extractNumber(MathArray const & ar, int & i);
-bool extractNumber(MathArray const & ar, double & i);
+bool extractNumber(MathData const & ar, int & i);
+bool extractNumber(MathData const & ar, double & i);
 
-MathArray pipeThroughExtern(std::string const & language,
-       docstring const & extra, MathArray const & ar);
+MathData pipeThroughExtern(std::string const & language,
+       docstring const & extra, MathData const & ar);
 
 
 } // namespace lyx
index 5f5cb02192e2b9a5f3f072c20b97c594081d4e7c..ad7b86d31cd9c2081bfaa733d23a208527252017 100644 (file)
@@ -404,7 +404,7 @@ MathAtom createInsetMath(docstring const & s)
 }
 
 
-bool createInsetMath_fromDialogStr(docstring const & str, MathArray & ar)
+bool createInsetMath_fromDialogStr(docstring const & str, MathData & ar)
 {
        // An example str:
        // "ref LatexCommand ref\nreference \"sec:Title\"\n\\end_inset\n\n";
index 89e17e9f8ce51d57a5774dfa5371fe5064ae9772..2b9cbd0149c977fff79f64cc65480629792ec1e2 100644 (file)
@@ -18,7 +18,7 @@
 namespace lyx {
 
 class MathAtom;
-class MathArray;
+class MathData;
 
 
 MathAtom createInsetMath(docstring const &);
@@ -28,7 +28,7 @@ MathAtom createInsetMath(char const * const);
  *  str is created by the frontend dialog's and returned to the LyX core.
  *  The function returns true if successful.
  */
-bool createInsetMath_fromDialogStr(docstring const &, MathArray &);
+bool createInsetMath_fromDialogStr(docstring const &, MathData &);
 
 
 } // namespace lyx
index 1ce383b555f1fb504cbee82c1abbe2159af08850..f12c14e4901fc1212077dbe996650698f5043efa 100644 (file)
@@ -38,7 +38,7 @@ using std::vector;
 class MathMacroArgumentValue : public InsetMathDim {
 public:
        ///
-       MathMacroArgumentValue(MathArray const * value, docstring const & macroName) 
+       MathMacroArgumentValue(MathData const * value, docstring const & macroName) 
                : value_(value), macroName_(macroName) {}
        ///
        bool metrics(MetricsInfo & mi, Dimension & dim) const;
@@ -47,7 +47,7 @@ public:
        
 private:
        std::auto_ptr<InsetBase> doClone() const;
-       MathArray const * value_;
+       MathData const * value_;
        docstring macroName_;
 };
 
@@ -115,7 +115,7 @@ bool MathMacro::metrics(MetricsInfo & mi, Dimension & dim) const
                MacroData const & macro = MacroTable::globalMacros().get(name());
                if (macro.locked()) {
                        mathed_string_dim(mi.base.font, "Self reference: " + name(), dim);
-                       expanded_ = MathArray();
+                       expanded_ = MathData();
                } else if (editing(mi.base.bv)) {
                        // FIXME UNICODE
                        asArray(macro.def(), tmpl_);
@@ -127,7 +127,7 @@ bool MathMacro::metrics(MetricsInfo & mi, Dimension & dim) const
                        // FIXME UNICODE
                        int ww = mathed_string_width(font, from_ascii("#1: "));
                        for (idx_type i = 0; i < nargs(); ++i) {
-                               MathArray const & c = cell(i);
+                               MathData const & c = cell(i);
                                c.metrics(mi);
                                dim.wid  = max(dim.wid, c.width() + ww);
                                dim.des += c.height() + 10;
@@ -135,7 +135,7 @@ bool MathMacro::metrics(MetricsInfo & mi, Dimension & dim) const
                } else {
                        // create MathMacroArgumentValue object pointing to the cells of the macro
                        MacroData const & macro = MacroTable::globalMacros().get(name());
-                       vector<MathArray> values(nargs());
+                       vector<MathData> values(nargs());
                        for (size_t i = 0; i != nargs(); ++i) 
                                values[i].insert(0, MathAtom(new MathMacroArgumentValue(&cells_[i], name())));
                        macro.expand(values, expanded_);
@@ -175,7 +175,7 @@ void MathMacro::draw(PainterInfo & pi, int x, int y) const
                        docstring t = from_ascii("#1: ");
                        mathed_string_dim(font, t, ldim);
                        for (idx_type i = 0; i < nargs(); ++i) {
-                               MathArray const & c = cell(i);
+                               MathData const & c = cell(i);
                                h += max(c.ascent(), ldim.asc) + 5;
                                c.draw(pi, x + ldim.wid, h);
                                char_type str[] = { '#', '1', ':', '\0' };
index 72453cd8eb3bd7c4ae10093ab20e9c6f38125642..2c455e44c077b59068fc91d529d68eff39dc193e 100644 (file)
@@ -14,7 +14,7 @@
 #define MATH_MACRO_H
 
 #include "InsetMathNest.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "InsetMathNest.h"
 #include "MathMacroTable.h"
 
@@ -52,7 +52,7 @@ public:
        ///
        docstring name() const;
        ///
-       void setExpansion(MathArray const & exp, MathArray const & args) const;
+       void setExpansion(MathData const & exp, MathData const & args) const;
 
        ///
        void validate(LaTeXFeatures &) const;
@@ -78,9 +78,9 @@ private:
        /// name of macro
        docstring name_;
        /// the unexpanded macro defintition
-       mutable MathArray tmpl_;
+       mutable MathData tmpl_;
        /// the macro substituted with our args
-       mutable MathArray expanded_;
+       mutable MathData expanded_;
 };
 
 
index 2cc7c8fcd8d9a7a6c4c2f3632fc9e6b9011ff27f..0a60ee44a20feaa8c5b50fd8cc218f0e0a6e7795 100644 (file)
@@ -45,7 +45,7 @@ MacroData::MacroData(docstring const & def, int numargs, docstring const & disp,
 {}
 
 
-void MacroData::expand(vector<MathArray> const & args, MathArray & to) const
+void MacroData::expand(vector<MathData> const & args, MathData & to) const
 {
        InsetMathSqrt inset; // Hack. Any inset with a cell would do.
        // FIXME UNICODE
index bf4a17522ac156947afeca5f29ee513f6bd91737..5525beed1c06685b9344a48ec1db59bae35d2dfc 100644 (file)
@@ -21,7 +21,7 @@
 
 namespace lyx {
 
-class MathArray;
+class MathData;
 
 ///
 class MacroData {
@@ -37,7 +37,7 @@ public:
        ///
        int numargs() const { return numargs_; }
        /// replace #1,#2,... by given MathAtom 0,1,..
-       void expand(std::vector<MathArray> const & from, MathArray & to) const;
+       void expand(std::vector<MathData> const & from, MathData & to) const;
        ///
        std::string requires() const { return requires_; }
        ///
index 8106a639d4bb36eb1c6b53f3bc37bb9646bf076e..024c5d4f126e5c861eb067e8db325d6500b4d97f 100644 (file)
@@ -44,7 +44,7 @@ MathMacroTemplate::MathMacroTemplate()
 
 
 MathMacroTemplate::MathMacroTemplate(docstring const & name, int numargs,
-               docstring const & type, MathArray const & ar1, MathArray const & ar2)
+               docstring const & type, MathData const & ar1, MathData const & ar2)
        : InsetMathNest(2), numargs_(numargs), name_(name), type_(type)
 {
        initMath();
@@ -62,7 +62,7 @@ MathMacroTemplate::MathMacroTemplate(docstring const & str)
 {
        initMath();
 
-       MathArray ar;
+       MathData ar;
        mathed_parse_cell(ar, str);
        if (ar.size() != 1 || !ar[0]->asMacroTemplate()) {
                lyxerr << "Cannot read macro from '" << ar << "'" << endl;
@@ -187,7 +187,7 @@ void MathMacroTemplate::draw(PainterInfo & p, int x, int y) const
 
 void MathMacroTemplate::read(Buffer const &, Lexer & lex)
 {
-       MathArray ar;
+       MathData ar;
        mathed_parse_cell(ar, lex.getStream());
        if (ar.size() != 1 || !ar[0]->asMacroTemplate()) {
                lyxerr << "Cannot read macro from '" << ar << "'" << endl;
index cdf5073544388a3576fcf331d9e24492510d77b5..2ed8e87bf5de6c6a946de5b90c9ec35a4aabf6cd 100644 (file)
@@ -13,7 +13,7 @@
 #ifndef MATH_MACROTEMPLATE_H
 #define MATH_MACROTEMPLATE_H
 
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathMacroTable.h"
 #include "InsetMathNest.h"
 
@@ -30,8 +30,8 @@ public:
        ///
        MathMacroTemplate(docstring const & name, int nargs,
                docstring const & type,
-               MathArray const & = MathArray(),
-               MathArray const & = MathArray());
+               MathData const & = MathData(),
+               MathData const & = MathData());
        ///
        explicit MathMacroTemplate(const docstring & str);
        ///
index 3a5fa9902eb38b4c603d94d48c08fc7479aa5ef9..2a63b824b3a9155056d75f2749c7048e3a6a5b86 100644 (file)
@@ -324,12 +324,12 @@ public:
        ///
        bool parse(MathAtom & at);
        ///
-       void parse(MathArray & array, unsigned flags, mode_type mode);
+       void parse(MathData & array, unsigned flags, mode_type mode);
        ///
        void parse1(InsetMathGrid & grid, unsigned flags, mode_type mode,
                bool numbered);
        ///
-       MathArray parse(unsigned flags, mode_type mode);
+       MathData parse(unsigned flags, mode_type mode);
        ///
        int lineno() const { return lineno_; }
        ///
@@ -613,7 +613,7 @@ void Parser::error(string const & msg)
 bool Parser::parse(MathAtom & at)
 {
        skipSpaces();
-       MathArray ar;
+       MathData ar;
        parse(ar, false, InsetMath::UNDECIDED_MODE);
        if (ar.size() != 1 || ar.front()->getType() == hullNone) {
                lyxerr << "unusual contents found: " << ar << endl;
@@ -666,15 +666,15 @@ docstring Parser::parse_verbatim_item()
 }
 
 
-MathArray Parser::parse(unsigned flags, mode_type mode)
+MathData Parser::parse(unsigned flags, mode_type mode)
 {
-       MathArray ar;
+       MathData ar;
        parse(ar, flags, mode);
        return ar;
 }
 
 
-void Parser::parse(MathArray & array, unsigned flags, mode_type mode)
+void Parser::parse(MathData & array, unsigned flags, mode_type mode)
 {
        InsetMathGrid grid(1, 1);
        parse1(grid, flags, mode, false);
@@ -695,7 +695,7 @@ void Parser::parse1(InsetMathGrid & grid, unsigned flags,
        int limits = 0;
        InsetMathGrid::row_type cellrow = 0;
        InsetMathGrid::col_type cellcol = 0;
-       MathArray * cell = &grid.cell(grid.index(cellrow, cellcol));
+       MathData * cell = &grid.cell(grid.index(cellrow, cellcol));
 
        if (grid.asHullInset())
                grid.asHullInset()->numbered(cellrow, numbered);
@@ -746,7 +746,7 @@ void Parser::parse1(InsetMathGrid & grid, unsigned flags,
 
                if (flags & FLAG_OPTION) {
                        if (t.cat() == catOther && t.character() == '[') {
-                               MathArray ar;
+                               MathData ar;
                                parse(ar, FLAG_BRACK_LAST, mode);
                                cell->append(ar);
                        } else {
@@ -809,7 +809,7 @@ void Parser::parse1(InsetMathGrid & grid, unsigned flags,
                        cell->push_back(MathAtom(new InsetMathChar(t.character())));
 
                else if (t.cat() == catBegin) {
-                       MathArray ar;
+                       MathData ar;
                        parse(ar, FLAG_BRACE_LAST, mode);
                        // do not create a BraceInset if they were written by LyX
                        // this helps to keep the annoyance of  "a choose b"  to a minimum
@@ -938,11 +938,11 @@ void Parser::parse1(InsetMathGrid & grid, unsigned flags,
 
                        }
 
-                       MathArray ar1;
+                       MathData ar1;
                        parse(ar1, FLAG_ITEM, InsetMath::UNDECIDED_MODE);
 
                        // we cannot handle recursive stuff at all
-                       //MathArray test;
+                       //MathData test;
                        //test.push_back(createInsetMath(name));
                        //if (ar1.contains(test)) {
                        //      error("we cannot handle recursive macros at all.");
@@ -951,7 +951,7 @@ void Parser::parse1(InsetMathGrid & grid, unsigned flags,
 
                        // is a version for display attached?
                        skipSpaces();
-                       MathArray ar2;
+                       MathData ar2;
                        if (nextToken().cat() == catBegin)
                                parse(ar2, FLAG_ITEM, InsetMath::MATH_MODE);
 
@@ -1036,7 +1036,7 @@ void Parser::parse1(InsetMathGrid & grid, unsigned flags,
 #if 0
                else if (t.cs() == "multicolumn") {
                        // extract column count and insert dummy cells
-                       MathArray count;
+                       MathData count;
                        parse(count, FLAG_ITEM, mode);
                        int cols = 1;
                        if (!extractNumber(count, cols)) {
@@ -1056,7 +1056,7 @@ void Parser::parse1(InsetMathGrid & grid, unsigned flags,
                        grid.cellinfo(grid.index(cellrow, cellcol)).dummy_ = false;
 
                        // read special alignment
-                       MathArray align;
+                       MathData align;
                        parse(align, FLAG_ITEM, mode);
                        //grid.cellinfo(grid.index(cellrow, cellcol)).align_ = extractString(align);
 
@@ -1086,7 +1086,7 @@ void Parser::parse1(InsetMathGrid & grid, unsigned flags,
                }
 
                else if (t.cs() == "sqrt") {
-                       MathArray ar;
+                       MathData ar;
                        parse(ar, FLAG_OPTION, mode);
                        if (ar.size()) {
                                cell->push_back(MathAtom(new InsetMathRoot));
@@ -1118,7 +1118,7 @@ void Parser::parse1(InsetMathGrid & grid, unsigned flags,
                        // can't handle \|
                        // FIXME: fix this in InsetMathDelim itself!
                        docstring const l = tl.cs() == "|" ? from_ascii("Vert") : tl.asString();
-                       MathArray ar;
+                       MathData ar;
                        parse(ar, FLAG_RIGHT, mode);
                        if (!good())
                                break;
@@ -1274,7 +1274,7 @@ void Parser::parse1(InsetMathGrid & grid, unsigned flags,
                else if (t.cs() == "label") {
                        // FIXME: This is swallowed in inline formulas
                        docstring label = parse_verbatim_item();
-                       MathArray ar;
+                       MathData ar;
                        asArray(label, ar);
                        if (grid.asHullInset()) {
                                grid.asHullInset()->label(cellrow, label);
@@ -1343,7 +1343,7 @@ void Parser::parse1(InsetMathGrid & grid, unsigned flags,
 
 #if 0
                else if (t.cs() == "infer") {
-                       MathArray ar;
+                       MathData ar;
                        parse(ar, FLAG_OPTION, mode);
                        cell->push_back(createInsetMath(t.cs()));
                        parse2(cell->back(), FLAG_ITEM, mode, false);
@@ -1427,7 +1427,7 @@ void Parser::parse1(InsetMathGrid & grid, unsigned flags,
                                //lyxerr << "default creation: m2: " << m << endl;
                                InsetMath::idx_type start = 0;
                                // this fails on \bigg[...\bigg]
-                               //MathArray opt;
+                               //MathData opt;
                                //parse(opt, FLAG_OPTION, InsetMath::VERBATIM_MODE);
                                //if (opt.size()) {
                                //      start = 1;
@@ -1454,13 +1454,13 @@ void Parser::parse1(InsetMathGrid & grid, unsigned flags,
 } // anonymous namespace
 
 
-void mathed_parse_cell(MathArray & ar, docstring const & str)
+void mathed_parse_cell(MathData & ar, docstring const & str)
 {
        Parser(str).parse(ar, 0, InsetMath::MATH_MODE);
 }
 
 
-void mathed_parse_cell(MathArray & ar, istream & is)
+void mathed_parse_cell(MathData & ar, istream & is)
 {
        Parser(is).parse(ar, 0, InsetMath::MATH_MODE);
 }
index bf174f1643507c4b61e0c38065c4599bb01f76b3..5be3b10275ee3e7816858141d4342e735898c6c5 100644 (file)
@@ -23,7 +23,7 @@ namespace lyx {
 
 
 class MathAtom;
-class MathArray;
+class MathData;
 class InsetMathGrid;
 class Lexer;
 
@@ -69,10 +69,10 @@ bool mathed_parse_normal(MathAtom &, Lexer &);
 void mathed_parse_normal(InsetMathGrid &, docstring const &);
 
 /// parse a single cell from a string
-void mathed_parse_cell(MathArray & ar, docstring const &);
+void mathed_parse_cell(MathData & ar, docstring const &);
 /// parse a single cell from a stream. Only use this for reading from .lyx
 /// file format, for the reason see Parser::tokenize(std::istream &).
-void mathed_parse_cell(MathArray & ar, std::istream &);
+void mathed_parse_cell(MathData & ar, std::istream &);
 
 void initParser();
 
index e6d6f52522eeb2a713ca7c525f3b69949778507d..c1365739571e54ecfc788d8f77f4230045bdeae8 100644 (file)
@@ -11,7 +11,7 @@
 #include <config.h>
 
 #include "InsetMath.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathExtern.h"
 #include "MathStream.h"
 
@@ -36,7 +36,7 @@ NormalStream & operator<<(NormalStream & ns, MathAtom const & at)
 }
 
 
-NormalStream & operator<<(NormalStream & ns, MathArray const & ar)
+NormalStream & operator<<(NormalStream & ns, MathData const & ar)
 {
        normalize(ar, ns);
        return ns;
@@ -139,7 +139,7 @@ WriteStream & operator<<(WriteStream & ws, MathAtom const & at)
 }
 
 
-WriteStream & operator<<(WriteStream & ws, MathArray const & ar)
+WriteStream & operator<<(WriteStream & ws, MathData const & ar)
 {
        write(ar, ws);
        return ws;
@@ -202,7 +202,7 @@ MathStream & operator<<(MathStream & ms, MathAtom const & at)
 }
 
 
-MathStream & operator<<(MathStream & ms, MathArray const & ar)
+MathStream & operator<<(MathStream & ms, MathData const & ar)
 {
        mathmlize(ar, ms);
        return ms;
@@ -266,7 +266,7 @@ MapleStream & operator<<(MapleStream & ms, MathAtom const & at)
 }
 
 
-MapleStream & operator<<(MapleStream & ms, MathArray const & ar)
+MapleStream & operator<<(MapleStream & ms, MathData const & ar)
 {
        maple(ar, ms);
        return ms;
@@ -318,7 +318,7 @@ MaximaStream & operator<<(MaximaStream & ms, MathAtom const & at)
 }
 
 
-MaximaStream & operator<<(MaximaStream & ms, MathArray const & ar)
+MaximaStream & operator<<(MaximaStream & ms, MathData const & ar)
 {
        maxima(ar, ms);
        return ms;
@@ -370,7 +370,7 @@ MathematicaStream & operator<<(MathematicaStream & ms, MathAtom const & at)
 }
 
 
-MathematicaStream & operator<<(MathematicaStream & ms, MathArray const & ar)
+MathematicaStream & operator<<(MathematicaStream & ms, MathData const & ar)
 {
        mathematica(ar, ms);
        return ms;
@@ -422,7 +422,7 @@ OctaveStream & operator<<(OctaveStream & ns, MathAtom const & at)
 }
 
 
-OctaveStream & operator<<(OctaveStream & ns, MathArray const & ar)
+OctaveStream & operator<<(OctaveStream & ns, MathData const & ar)
 {
        octave(ar, ns);
        return ns;
index 2262ad9df88bc3c71b94270c6ddad38f168795dd..7787949d019ad6ed08224abcc4ee8b88d31ea710 100644 (file)
@@ -24,7 +24,7 @@
 
 namespace lyx {
 
-class MathArray;
+class MathData;
 class InsetMath;
 class MathAtom;
 
@@ -61,7 +61,7 @@ private:
        odocstream & os_;
        /// do we have to write \\protect sometimes
        bool fragile_;
-       /// are we at the beginning of an MathArray?
+       /// are we at the beginning of an MathData?
        bool firstitem_;
        /// are we writing to .tex?
        int latex_;
@@ -74,7 +74,7 @@ private:
 ///
 WriteStream & operator<<(WriteStream &, MathAtom const &);
 ///
-WriteStream & operator<<(WriteStream &, MathArray const &);
+WriteStream & operator<<(WriteStream &, MathData const &);
 ///
 WriteStream & operator<<(WriteStream &, docstring const &);
 ///
@@ -140,7 +140,7 @@ private:
 ///
 MathStream & operator<<(MathStream &, MathAtom const &);
 ///
-MathStream & operator<<(MathStream &, MathArray const &);
+MathStream & operator<<(MathStream &, MathData const &);
 ///
 MathStream & operator<<(MathStream &, docstring const &);
 ///
@@ -172,7 +172,7 @@ private:
 ///
 NormalStream & operator<<(NormalStream &, MathAtom const &);
 ///
-NormalStream & operator<<(NormalStream &, MathArray const &);
+NormalStream & operator<<(NormalStream &, MathData const &);
 ///
 NormalStream & operator<<(NormalStream &, docstring const &);
 ///
@@ -203,7 +203,7 @@ private:
 ///
 MapleStream & operator<<(MapleStream &, MathAtom const &);
 ///
-MapleStream & operator<<(MapleStream &, MathArray const &);
+MapleStream & operator<<(MapleStream &, MathData const &);
 ///
 MapleStream & operator<<(MapleStream &, docstring const &);
 ///
@@ -236,7 +236,7 @@ private:
 ///
 MaximaStream & operator<<(MaximaStream &, MathAtom const &);
 ///
-MaximaStream & operator<<(MaximaStream &, MathArray const &);
+MaximaStream & operator<<(MaximaStream &, MathData const &);
 ///
 MaximaStream & operator<<(MaximaStream &, docstring const &);
 ///
@@ -269,7 +269,7 @@ private:
 ///
 MathematicaStream & operator<<(MathematicaStream &, MathAtom const &);
 ///
-MathematicaStream & operator<<(MathematicaStream &, MathArray const &);
+MathematicaStream & operator<<(MathematicaStream &, MathData const &);
 ///
 MathematicaStream & operator<<(MathematicaStream &, docstring const &);
 ///
@@ -299,7 +299,7 @@ private:
 ///
 OctaveStream & operator<<(OctaveStream &, MathAtom const &);
 ///
-OctaveStream & operator<<(OctaveStream &, MathArray const &);
+OctaveStream & operator<<(OctaveStream &, MathData const &);
 ///
 OctaveStream & operator<<(OctaveStream &, docstring const &);
 ///
index f828b06d587159fa64415bbc2f38ee415c499a38..a381d66304144b6c6ef9830d22cc0bf23b1f7430 100644 (file)
@@ -12,7 +12,7 @@
 #include <config.h>
 
 #include "MathSupport.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "InsetMath.h"
 #include "MathStream.h"
 #include "MathParser.h"
@@ -678,7 +678,7 @@ void augmentFont(LyXFont & font, docstring const & name)
 }
 
 
-docstring asString(MathArray const & ar)
+docstring asString(MathData const & ar)
 {
        odocstringstream os;
        WriteStream ws(os);
@@ -687,7 +687,7 @@ docstring asString(MathArray const & ar)
 }
 
 
-void asArray(docstring const & str, MathArray & ar)
+void asArray(docstring const & str, MathData & ar)
 {
        mathed_parse_cell(ar, str);
 }
index b37d42bc33a01f47685c2fe0210c0a3c38ded029..c616c8c7210693503e67fa890bde950cef859f90 100644 (file)
@@ -23,7 +23,7 @@ namespace lyx {
 class PainterInfo;
 class LyXFont;
 class Dimension;
-class MathArray;
+class MathData;
 class MathAtom;
 class InsetMath;
 
@@ -51,12 +51,12 @@ void augmentFont(LyXFont & f, docstring const & cmd);
 bool isFontName(docstring const & name);
 
 // converts single cell to string
-docstring asString(MathArray const & ar);
+docstring asString(MathData const & ar);
 // converts single inset to string
 docstring asString(InsetMath const &);
 docstring asString(MathAtom const &);
 // converts string to single cell
-void asArray(docstring const & str, MathArray & ar);
+void asArray(docstring const & str, MathData & ar);
 
 } // namespace lyx
 
index dc8eb6b68f3403b4da187ae56c48263ed795747e..907005e0b5baf670f649fc7ce9b29cd9c3b53802 100644 (file)
@@ -13,7 +13,7 @@
 #define MATH_REPLACE_H
 
 
-#include "MathArray.h"
+#include "MathData.h"
 
 
 namespace lyx {
@@ -21,9 +21,9 @@ namespace lyx {
 class ReplaceData {
 public:
        ///
-       MathArray from;
+       MathData from;
        ///
-       MathArray to;
+       MathData to;
 };