]> git.lyx.org Git - features.git/commitdiff
fix the matrix reading other small cleanup
authorLars Gullik Bjønnes <larsbj@gullik.org>
Wed, 28 Feb 2001 17:21:16 +0000 (17:21 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Wed, 28 Feb 2001 17:21:16 +0000 (17:21 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1642 a592a061-630c-0410-9148-cb99ea01b6c8

19 files changed:
src/mathed/ChangeLog
src/mathed/array.C
src/mathed/array.h
src/mathed/formula.C
src/mathed/formula.h
src/mathed/formulamacro.C
src/mathed/math_cursor.C
src/mathed/math_fracinset.C
src/mathed/math_fracinset.h
src/mathed/math_iter.C
src/mathed/math_macro.C
src/mathed/math_macro.h
src/mathed/math_matrixinset.C
src/mathed/math_matrixinset.h
src/mathed/math_parinset.C
src/mathed/math_parinset.h
src/mathed/math_parser.C
src/mathed/math_root.C
src/mathed/math_root.h

index 3d14a120946e13e423ad41b1f455c72ea3047782..6f56fad288b838c68d21d665217c36065c6cf297 100644 (file)
@@ -1,5 +1,37 @@
 2001-02-28  Lars Gullik Bjønnes  <larsbj@trylle.birdstep.com>
 
+       * formulamacro.C (Read): add comment.
+
+       * math_parser.C (mathed_parse): fix another potential problem by
+       passing a freestanding mathedarray.
+
+       * math_root.C (GetData): add const version
+
+       * math_parinset.C (~MathParInset): delete
+       (GetData): add const version
+
+       * math_matrixinset.C (MathMatrixInset): delete pointer version,
+       make it a proper copy constructor instead
+       (Clone): change acc.
+       (MathMatrixInset): remvoe default val for m and n
+
+       * math_macro.C (GetData): add const version
+
+       * math_fracinset.C (GetData): add const version
+
+       * math_cursor.C (SelCopy): make p1 and p2 const
+       (SelCut): make p1 and p2 const
+
+       * formula.h: add '_' on priv vars. Cnages in formula.C acc. to this
+       (LyxCode): move inline out of class
+       (ConvertFont): ditto
+       (display): ditto
+
+       * array.[Ch] (dump): method added for debugging purposes
+
+       * math_parser.C (mathed_parse): pass a freestanding mathedarray to
+       mathed_parse when reading a matrix.
+
        * math_spaceinset.[Ch]: add pragma, make variables private add
        '_', change order of method definitions.
 
index eba96ab49546616a7ac21e63d35352959502626b..2ef09bf7c9c2ef42f244ec2bf3f0d2b8563bd67a 100644 (file)
@@ -280,3 +280,16 @@ byte & MathedArray::operator[](int i)
 {
        return bf_[i];
 }
+
+
+void MathedArray::dump(ostream & os) const
+{
+       buffer_type::const_iterator cit = bf_.begin();
+       buffer_type::const_iterator end = bf_.end();
+       for (; cit != end; ++cit) {
+               os << (*cit);
+       }
+       os << endl;
+}
+
+       
index 35b205fb7dcc7f56b3f5ab7d6b4ef9c9b7b04788..935228f0c0b38a85f61d86e8ef006a53292d6120 100644 (file)
@@ -17,6 +17,7 @@
 #define MATHEDARRAY_H
 
 #include <vector>
+#include <iosfwd>
 
 #include "mathed/support.h"
 
@@ -110,6 +111,8 @@ public:
        void resize(int newsize);
        /// Make sure we can access at least \a needed elements
        void need_size(int needed);
+       ///
+       void dump(ostream &) const;
 private:
        /// Buffer
        buffer_type bf_;
index 164efb4a30b84d3f15dc2b6bc3fab014d2bfc4df..fd595c76eaca703070b1ed0985439960ca581929 100644 (file)
@@ -211,9 +211,8 @@ InsetFormula::InsetFormula(bool display)
 {
        par = new MathParInset; // this leaks
        //  mathcursor = 0;
-       disp_flag = display;
-       //label = 0;
-       if (disp_flag) {
+       disp_flag_ = display;
+       if (disp_flag_) {
                par->SetType(LM_OT_PAR);
                par->SetStyle(LM_ST_DISPLAY);
        }
@@ -226,12 +225,11 @@ InsetFormula::InsetFormula(MathParInset * p)
                lyxerr << "InsetFormula::InsetFormula: This shouldn't happen" << endl;
 
        par = is_multiline(p->GetType()) ?
-               new MathMatrixInset(static_cast<MathMatrixInset*>(p)):
+               new MathMatrixInset(*static_cast<MathMatrixInset*>(p)):
                new MathParInset(*p);
        //   mathcursor = 0;
 
-       disp_flag = (par->GetType()>0);
-       //label = 0;
+       disp_flag_ = (par->GetType()>0);
 }
 
 
@@ -244,7 +242,7 @@ InsetFormula::~InsetFormula()
 Inset * InsetFormula::Clone(Buffer const &) const
 {
        InsetFormula * f = new InsetFormula(par);
-       f->label = label;
+       f->label_ = label_;
        return f;
 }
 
@@ -260,7 +258,7 @@ int InsetFormula::Latex(Buffer const *, ostream & os, bool fragile, bool) const
 {
        //#warning Alejandro, the number of lines is not returned in this case
        // This problem will disapear at 0.13.
-       return mathed_write(par, os, fragile, label);
+       return mathed_write(par, os, fragile, label_);
 }
 
 
@@ -308,13 +306,13 @@ void InsetFormula::Read(Buffer const *, LyXLex & lex)
        MathedArray ar;
        mathed_parse(ar, 0, &par);
        par->Metrics();
-       disp_flag = (par->GetType() > 0);
+       disp_flag_ = (par->GetType() > 0);
 
        // Update line number
        lex.setLineNo(mathed_parser_lineno());
 
        if (!mathed_label.empty()) {
-               label = mathed_label;
+               label_ = mathed_label;
                mathed_label.erase();
        }
 
@@ -335,13 +333,13 @@ void InsetFormula::Read(Buffer const *, LyXLex & lex)
 
 int InsetFormula::ascent(BufferView *, LyXFont const &) const
 {
-       return par->Ascent() + (disp_flag ? 8 : 1);
+       return par->Ascent() + (disp_flag_ ? 8 : 1);
 }
 
 
 int InsetFormula::descent(BufferView *, LyXFont const &) const
 {
-       return par->Descent() + (disp_flag ? 8 : 1);
+       return par->Descent() + (disp_flag_ ? 8 : 1);
 }
 
 
@@ -388,18 +386,17 @@ void InsetFormula::draw(BufferView * bv, LyXFont const & f,
 
                if (is_singlely_numbered(par->GetType())) {
                        string str;
-                       if (!label.empty())
-                               str = string("(") + label + ")";
+                       if (!label_.empty())
+                               str = string("(") + label_ + ")";
                        else
                                str = string("(#)");
                        pain.text(int(x + 20), baseline, str, wfont);
                } else {
                        MathMatrixInset * mt =
                                static_cast<MathMatrixInset*>(par);
-                       int y;
                        MathedRowSt const * crow = mt->getRowSt();
                        while (crow) {
-                               y = baseline + crow->getBaseline();
+                               int const y = baseline + crow->getBaseline();
                                if (crow->isNumbered()) {
                                        string str;
                                        if (!crow->getLabel().empty())
@@ -532,7 +529,7 @@ void InsetFormula::ToggleInsetSelection(BufferView * bv)
 
 void InsetFormula::display(bool dspf)
 {
-       if (dspf != disp_flag) {
+       if (dspf != disp_flag_) {
                if (dspf) {
                        par->SetType(LM_OT_PAR);
                        par->SetStyle(LM_ST_DISPLAY);
@@ -543,11 +540,11 @@ void InsetFormula::display(bool dspf)
                        }
                        par->SetType(LM_OT_MIN);
                        par->SetStyle(LM_ST_TEXT);
-                       if (!label.empty()) {
-                               label.erase();
+                       if (!label_.empty()) {
+                               label_.erase();
                        }
                }
-               disp_flag = dspf;
+               disp_flag_ = dspf;
        }
 }
 
@@ -567,8 +564,8 @@ vector<string> const InsetFormula::getLabelList() const
                                label_list.push_back(crow->getLabel());
                        crow = crow->getNext();
                }
-       } else if (!label.empty())
-               label_list.push_back(label);
+       } else if (!label_.empty())
+               label_list.push_back(label_);
 
        return label_list;
 }
@@ -604,7 +601,8 @@ void InsetFormula::InsetButtonPress(BufferView * bv, int x, int y,
                                    int /*button*/)
 {
        sel_flag = false;
-       sel_x = x;  sel_y = y;
+       sel_x = x;
+       sel_y = y;
        if (mathcursor && mathcursor->Selection()) {
                mathcursor->SelClear();
                bv->updateInset(this, false);
@@ -646,7 +644,7 @@ void InsetFormula::InsetKeyPress(XKeyEvent *)
 // Special Mathed functions
 bool InsetFormula::SetNumber(bool numbf)
 {
-       if (disp_flag) {
+       if (disp_flag_) {
                short type = par->GetType();
                bool const oldf = is_numbered(type);
                if (numbf && !oldf)
@@ -742,9 +740,9 @@ InsetFormula::LocalDispatch(BufferView * bv, kb_action action,
                bv->lockedInsetStoreUndo(Undo::INSERT);
                byte c = arg.empty() ? '1' : arg[0];
                mathcursor->Insert(c, LM_TC_CR);
-               if (!label.empty()) {
-                       mathcursor->setLabel(label);
-                       label.erase();
+               if (!label_.empty()) {
+                       mathcursor->setLabel(label_);
+                       label_.erase();
                }
                par = mathcursor->GetPar();
                UpdateLocal(bv);
@@ -869,12 +867,12 @@ InsetFormula::LocalDispatch(BufferView * bv, kb_action action,
 
        case LFUN_MATH_NUMBER:
                bv->lockedInsetStoreUndo(Undo::INSERT);
-               if (disp_flag) {
+               if (disp_flag_) {
                        short type = par->GetType();
                        if (is_numbered(type)) {
                                --type;
-                               if (!label.empty()) {
-                                       label.erase();
+                               if (!label_.empty()) {
+                                       label_.erase();
                                }
                                bv->owner()->getMiniBuffer()->Set(_("No number"));
                        } else {
@@ -911,7 +909,7 @@ InsetFormula::LocalDispatch(BufferView * bv, kb_action action,
        case LFUN_MATH_SIZE:
                if (!arg.empty()) {
                        latexkeys const * l = in_word_set(arg);
-                       int sz = (l) ? l->id: -1;
+                       int const sz = (l) ? l->id: -1;
                        mathcursor->SetSize(sz);
                        UpdateLocal(bv);
                        break;
@@ -927,11 +925,14 @@ InsetFormula::LocalDispatch(BufferView * bv, kb_action action,
        case LFUN_INSERT_MATRIX:
        {
                bv->lockedInsetStoreUndo(Undo::INSERT);
-               int k, m, n;
-               char s[80], arg2[80];
-                               // This is just so that too long args won't ooze out of s.
-               strncpy(arg2, arg.c_str(), 80); arg2[79]= '\0';
-               k = sscanf(arg2, "%d %d %s", &m, &n, s);
+               char s[80];
+               char arg2[80];
+               // This is just so that too long args won't ooze out of s.
+               strncpy(arg2, arg.c_str(), 80);
+               arg2[79]= '\0';
+               int m;
+               int n;
+               int const k = sscanf(arg2, "%d %d %s", &m, &n, s);
                s[79] = '\0';
 
                if (k < 1) {
@@ -953,8 +954,11 @@ InsetFormula::LocalDispatch(BufferView * bv, kb_action action,
        case LFUN_MATH_DELIM:
        {
                bv->lockedInsetStoreUndo(Undo::INSERT);
-               char lf[40], rg[40], arg2[40];
-               int ilf = '(', irg = '.';
+               char lf[40];
+               char rg[40];
+               char arg2[40];
+               int ilf = '(';
+               int irg = '.';
                latexkeys const * l;
                string vdelim("(){}[]./|");
 
@@ -962,7 +966,7 @@ InsetFormula::LocalDispatch(BufferView * bv, kb_action action,
                        break;
                ::strncpy(arg2, arg.c_str(), 40);
                arg2[39]= '\0';
-               int n = sscanf(arg2, "%s %s", lf, rg);
+               int const n = sscanf(arg2, "%s %s", lf, rg);
                lf[39] = '\0';
                rg[39] = '\0';
 
@@ -1012,7 +1016,7 @@ InsetFormula::LocalDispatch(BufferView * bv, kb_action action,
                        break;
 
                string old_label = is_multiline(par->GetType())
-                       ? mathcursor->getLabel() : label;
+                       ? mathcursor->getLabel() : label_;
 
 #warning This is a terrible hack! We should find a better solution.
                // This is needed because in some positions
@@ -1051,7 +1055,7 @@ InsetFormula::LocalDispatch(BufferView * bv, kb_action action,
                        // MathMatrixInset *mt = (MathMatrixInset*)par;
                        // mt->SetLabel(new_label);
                } else
-                       label = new_label;
+                       label_ = new_label;
 
                UpdateLocal(bv);
                break;
@@ -1059,7 +1063,7 @@ InsetFormula::LocalDispatch(BufferView * bv, kb_action action,
 
        case LFUN_MATH_DISPLAY:
                bv->lockedInsetStoreUndo(Undo::EDIT);
-               display(!disp_flag);
+               display(!disp_flag_);
                UpdateLocal(bv);
                break;
 
@@ -1134,7 +1138,7 @@ InsetFormula::LocalDispatch(BufferView * bv, kb_action action,
                                
                                varcode = LM_TC_MIN;
                                
-                               if (greek_kb_flag<2)
+                               if (greek_kb_flag < 2)
                                        greek_kb_flag = 0;
                                
                        } else if (strchr("!,:;{}", c) && (varcode == LM_TC_TEX||was_macro)) {
index abc3325396fb179ca8bcddea475e3a0b3aed9a02..b547e421e644dec6aa8e58a28a2d82013a3aeaaa 100644 (file)
@@ -66,27 +66,21 @@ public:
        ///
        Inset * Clone(Buffer const &) const;
        ///
-       Inset::Code LyxCode() const { return Inset::MATH_CODE; }
-       ///
-       LyXFont const ConvertFont(LyXFont const & f) const {
-               // We have already discussed what was here
-               LyXFont font(f);
-               font.setLatex(LyXFont::OFF);
-               return font;
-       }
-
+       Inset::Code LyxCode() const;
+       ///
+       LyXFont const ConvertFont(LyXFont const & f) const;
        /// what appears in the minibuffer when opening
        string const EditMessage() const;
        ///
        void Edit(BufferView *, int x, int y, unsigned int button);
        ///
-       bool display() const { return (disp_flag) ? true: false; }
+       bool display() const;
        ///
        void display(bool);
        ///
        void ToggleInsetCursor(BufferView *);
        ///
-       void ShowInsetCursor(BufferView *, bool show=true);
+       void ShowInsetCursor(BufferView *, bool show = true);
        ///
        void HideInsetCursor(BufferView *);
        ///
@@ -124,8 +118,32 @@ protected:
     
 private:
        ///
-       bool disp_flag;
+       bool disp_flag_;
        ///
-       string label;
+       string label_;
 };
+
+
+inline
+Inset::Code InsetFormula::LyxCode() const
+{
+       return Inset::MATH_CODE;
+}
+
+
+inline
+LyXFont const InsetFormula::ConvertFont(LyXFont const & f) const
+{
+       // We have already discussed what was here
+       LyXFont font(f);
+       font.setLatex(LyXFont::OFF);
+       return font;
+}
+
+
+inline
+bool InsetFormula::display() const
+{
+       return (disp_flag_) ? true : false;
+}
 #endif
index 6b993a69365a01faaa8c152bc6e0938c9c4fbeff..54642dc8fb5f15b108e8a778aead146c1d778add 100644 (file)
@@ -105,7 +105,8 @@ void InsetFormulaMacro::Read(Buffer const *, LyXLex & lex)
        MathedArray ar;
        
        mathed_parse(ar, 0, reinterpret_cast<MathParInset **>(&tmacro_));
-
+       // since tmacro_ == 0 when mathed_parse is called we need to sett
+       // its contents explicitly afterwards (Lgb)
        tmacro_->setData(ar);
        
        // Update line number
index 68d583db38090ea5a75e7c362b89cf6280377295..09c8e9082368bcd3f55bf7f9a8f0d86a57544f63 100644 (file)
@@ -899,8 +899,9 @@ void MathedCursor::MacroModeClose()
 void MathedCursor::SelCopy()
 {
        if (selection) {
-               int p1 = (cursor->getPos() < selpos) ? cursor->getPos() : selpos;
-               int p2 = (cursor->getPos() > selpos) ?
+               int const p1 = (cursor->getPos() < selpos) ?
+                       cursor->getPos() : selpos;
+               int const p2 = (cursor->getPos() > selpos) ?
                        cursor->getPos() : selpos;
                selarray = *(cursor->GetData());
                selarray.shrink(p1, p2);
@@ -916,8 +917,10 @@ void MathedCursor::SelCut()
                if (cursor->getPos() == selpos)
                        return;
 
-               int p1 = (cursor->getPos() < selpos) ? cursor->getPos() : selpos;
-               int p2 = (cursor->getPos() > selpos) ? cursor->getPos() : selpos;
+               int const p1 = (cursor->getPos() < selpos) ?
+                       cursor->getPos() : selpos;
+               int const p2 = (cursor->getPos() > selpos) ?
+                       cursor->getPos() : selpos;
                selarray = *(cursor->GetData());
                selarray.shrink(p1, p2);
                cursor->Clean(selpos);
index 6ee7debf1f1d41c685932ad5484441a699f3a888..fe26cd8fd44de65ffe125487efc2e3edcb031221 100644 (file)
@@ -87,6 +87,15 @@ MathedArray & MathFracInset::GetData()
 }
 
 
+MathedArray const & MathFracInset::GetData() const
+{
+       if (idx_ == 0)
+               return array;
+       else
+               return den_.GetData();
+}
+
+
 bool MathFracInset::Inside(int x, int y) 
 {
        int const xx = xo() - (width - w0_) / 2;
index 83011783f25cff0c137612e57b20ca075c9d33fa..d4e1af923cadbf778fc57135c05a1a72a762419d 100644 (file)
@@ -39,6 +39,8 @@ public:
        ///
        MathedArray & GetData();
        ///
+       MathedArray const & GetData() const;
+       ///
        bool setArgumentIdx(int i); // was bool Up/down(void);
        ///
        int getArgumentIdx() const;
index bf8c5b844459b3cfd94618911a4fa1d68b981d51..46da31d2671cbe56b0141d20851d819d8a552471 100644 (file)
@@ -43,17 +43,18 @@ MathedIter::MathedIter()
 {}
 
 
-
 MathedArray * MathedIter::GetData() const
 {
        return array;
 }
 
+
 short MathedIter::fcode() const
 {
        return fcode_; 
 }
 
+
 void MathedIter::fcode(short c) const
 {
        fcode_ = c; 
index e59452baa35d4e2f4992d1fa305ba8b140b64a8a..8e5d2b1c0f4959a6e0c6b4c01066a581023952f1 100644 (file)
@@ -140,6 +140,12 @@ MathedArray & MathMacro::GetData()
 } 
 
 
+MathedArray const & MathMacro::GetData() const
+{ 
+       return args_[idx_].array; 
+} 
+
+
 int MathMacro::GetColumns() const
 {
        return tmplate_->getMacroPar(idx_)->GetColumns();
index 63421ef3b8ca0f135cb2ca591275bbfd5f9593c0..964e57ba171c0e3c60edabb21019e754f70df01d 100644 (file)
@@ -62,6 +62,8 @@ public:
        ///
        MathedArray & GetData();
        ///
+       MathedArray const & GetData() const;
+       ///
        MathedRowSt * getRowSt() const;
        ///
        void setData(MathedArray const &);
index 9d344f0d9a30144f5112ce6a4bc5c1aa715ded05..8e6fbdc4b56a8fcabbb0653280aed6aaabecd4a3 100644 (file)
@@ -34,15 +34,15 @@ MathMatrixInset::MathMatrixInset(int m, int n, short st)
 }
 
 
-MathMatrixInset::MathMatrixInset(MathMatrixInset * mt)
-       : MathParInset(mt->GetStyle(), mt->GetName(), mt->GetType()),
-         nc_(mt->nc_), nr_(0), ws_(mt->nc_),
-         v_align_(mt->v_align_), h_align_(mt->h_align_)
+MathMatrixInset::MathMatrixInset(MathMatrixInset const & mt)
+       : MathParInset(mt.GetStyle(), mt.GetName(), mt.GetType()),
+         nc_(mt.nc_), nr_(0), ws_(mt.nc_),
+         v_align_(mt.v_align_), h_align_(mt.h_align_)
 {
-       array = mt->GetData();
-       if (mt->row_ != 0) {
+       array = mt.GetData();
+       if (mt.row_ != 0) {
                MathedRowSt * ro = 0;
-               MathedRowSt * mrow = mt->row_;
+               MathedRowSt * mrow = mt.row_;
 
                while (mrow) {
                        MathedRowSt * r = new MathedRowSt(nc_ + 1);
@@ -59,7 +59,7 @@ MathMatrixInset::MathMatrixInset(MathMatrixInset * mt)
                }
        } else   
                row_ = 0;
-       flag = mt->flag;
+       flag = mt.flag;
 }
 
 
@@ -76,7 +76,7 @@ MathMatrixInset::~MathMatrixInset()
 
 MathedInset * MathMatrixInset::Clone()
 {
-       return new MathMatrixInset(this);
+       return new MathMatrixInset(*this);
 }
 
 
index fd9e55262a08ce78041bf59b7a02e345805d9a94..caf23ea3c1ce6b2aba7f1512da5aadf55824a8ba 100644 (file)
@@ -19,10 +19,10 @@ class MathMatrixInset : public MathParInset {
 public: 
        ///
        explicit
-       MathMatrixInset(int m = 1, int n = 1, short st = LM_ST_TEXT);
+       MathMatrixInset(int m, int n, short st = LM_ST_TEXT);
        ///
        explicit
-       MathMatrixInset(MathMatrixInset *);
+       MathMatrixInset(MathMatrixInset const &);
        ///
        ~MathMatrixInset();
        ///
index 83336a8753f27fa34303869216229b862771b18c..53d1befdf8907c2292607a0a943e557f0eec8f83 100644 (file)
@@ -35,12 +35,6 @@ MathParInset::MathParInset(short st, string const & nm, short ot)
 }
 
 
-// This is virtual and needed.
-MathParInset::~MathParInset()
-{
-}
-
-
 MathedInset * MathParInset::Clone()
 {
        return new MathParInset(*this);
@@ -436,6 +430,12 @@ MathedArray & MathParInset::GetData()
 }
 
 
+MathedArray const & MathParInset::GetData() const
+{
+       return array;
+}
+
+
 void MathParInset::setXY(int x, int y)
 {
        xo_ = x;
index 539f569ec69ab1395709b3d4fc342dc144b47126..61b8b55e27c5cedfe35dd4845d511f38a28a81cc 100644 (file)
@@ -19,8 +19,6 @@ public:
        MathParInset(short st = LM_ST_TEXT, string const & nm = string(),
                     short ot = LM_OT_MIN);
        ///
-       virtual ~MathParInset();
-       ///
        virtual MathedInset * Clone();
        /// Draw the object on a drawable
        virtual void draw(Painter &, int x, int baseline);
@@ -34,6 +32,8 @@ public:
        virtual void setData(MathedArray const &);
        ///
        virtual MathedArray & GetData();
+       ///
+       virtual MathedArray const & GetData() const;
        /// Paragraph position
        virtual void GetXY(int &, int &) const;
        ///
index 6ad9268b4b2eabc5b9b8a35760c6d58a8d5a920f..4d1bcd32f567f1222578a5af94a29b70aadf8f01 100644 (file)
@@ -693,7 +693,7 @@ void mathed_parse(MathedArray & array, unsigned flags = 0,
                                rt->setArgumentIdx(0);
                                MathedArray ar;
                                mathed_parse(ar, FLAG_BRACK_END, &rt);
-                               rt->setData(ar);
+                               rt->setData(ar); // I belive that line is not needed (Lgb)
                                rt->setArgumentIdx(1);
                        } else {
                                yyis->putback(c);
@@ -701,7 +701,7 @@ void mathed_parse(MathedArray & array, unsigned flags = 0,
                        }
                        MathedArray ar;
                        mathed_parse(ar, FLAG_BRACE|FLAG_BRACE_LAST, &rt);
-                       rt->setData(ar);
+                       rt->setData(ar); // I belive that this line is not needed (Lgb)
                        data.insertInset(rt, LM_TC_ACTIVE_INSET);
                        break;
                }
@@ -833,7 +833,8 @@ void mathed_parse(MathedArray & array, unsigned flags = 0,
                                MathParInset * mm = new MathMatrixInset(nc, 0);
                                mm->SetAlign(ar2[0], ar);
                                data.insertInset(mm, LM_TC_ACTIVE_INSET);
-                               mathed_parse(mm->GetData(), FLAG_END, &mm);
+                               MathedArray dat;
+                               mathed_parse(dat, FLAG_END, &mm);
                        } else if (is_eqn_type(yylval.i)) {
                                if (plevel!= 0) {
                                        mathPrintError("Misplaced environment");
@@ -884,7 +885,9 @@ void mathed_parse(MathedArray & array, unsigned flags = 0,
                                if (p) {
                                        data.insertInset(p, p->getTCode());
                                        p->setArgumentIdx(0);
-                                       mathed_parse(p->GetData(), FLAG_END, reinterpret_cast<MathParInset**>(&p));
+                                       //mathed_parse(p->GetData(), FLAG_END, reinterpret_cast<MathParInset**>(&p));
+                                       MathedArray dat;
+                                       mathed_parse(dat, FLAG_END, reinterpret_cast<MathParInset**>(&p));
 //              for (int i = 0; p->setArgumentIdx(i); ++i)
 //                p->SetData(mathed_parse(FLAG_BRACE|FLAG_BRACE_LAST));
                                } else 
index 605d153788abf45c8f4babf6a8af715a23fc0d0c..73f93f1b68efc42a9c6a74bc82640b199e437c2d 100644 (file)
@@ -75,6 +75,15 @@ MathedArray & MathRootInset::GetData()
 }
 
 
+MathedArray const & MathRootInset::GetData() const
+{
+       if (idx_ == 1)
+               return array;
+       else
+               return uroot_.GetData();
+}
+
+
 bool MathRootInset::Inside(int x, int y)
 {
        return (uroot_.Inside(x, y) || MathSqrtInset::Inside(x, y));
index aeba4e5660283f873ece63fc10d43a772b9ff7a5..1ba236112a43bb6874a2d2a99f498a03e2ed348a 100644 (file)
@@ -50,6 +50,8 @@ public:
        ///
        MathedArray & GetData();
        ///
+       MathedArray const & GetData() const;
+       ///
        bool setArgumentIdx(int i);
        ///
        int getArgumentIdx() const;