]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_macrotemplate.C
small cleanup, doxygen, formatting changes
[lyx.git] / src / mathed / math_macrotemplate.C
index 37d7f0edf47cc2565872c396b5f2a0659175227e..eeaede5705b3f5df527587e796fb66f374e41943 100644 (file)
@@ -10,34 +10,34 @@ using std::ostream;
 
 void  MathMacroTemplate::setTCode(MathedTextCodes t)
 {
-       tcode = t;
+       tcode_ = t;
 }
 
 
 MathedTextCodes MathMacroTemplate::getTCode() const
 {
-       return tcode;
+       return tcode_;
 }
 
 
 int MathMacroTemplate::getNoArgs() const
 {
-       return nargs;
+       return nargs_;
 }
 
 
 MathMacroTemplate::MathMacroTemplate(string const & nm, int na, int flg):
        MathParInset(LM_ST_TEXT, nm, LM_OT_MACRO), 
-       flags(flg), nargs(na)
+       flags_(flg), nargs_(na)
 {
-       if (nargs > 0) {
-               tcode = LM_TC_ACTIVE_INSET;
-               args_.resize(nargs);
-               for (int i = 0; i < nargs; ++i) {
+       if (nargs_ > 0) {
+               tcode_ = LM_TC_ACTIVE_INSET;
+               args_.resize(nargs_);
+               for (int i = 0; i < nargs_; ++i) {
                        args_[i].setNumber(i + 1);
                }
        } else {
-               tcode = LM_TC_INSET;
+               tcode_ = LM_TC_INSET;
                // Here is  nargs != args_.size()
                //args = 0;
        }
@@ -47,8 +47,8 @@ MathMacroTemplate::MathMacroTemplate(string const & nm, int na, int flg):
 MathMacroTemplate::~MathMacroTemplate()
 {
        // prevent to delete already deleted objects
-       for (int i = 0; i < nargs; ++i) {
-               args_[i].SetData(0);
+       for (int i = 0; i < nargs_; ++i) {
+               args_[i].setData(0);
        }
 }
 
@@ -56,14 +56,14 @@ MathMacroTemplate::~MathMacroTemplate()
 void MathMacroTemplate::setEditMode(bool ed)
 {
        if (ed) {
-               flags |= MMF_Edit;
-               for (int i = 0; i < nargs; ++i) {
+               flags_ |= MMF_Edit;
+               for (int i = 0; i < nargs_; ++i) {
                        args_[i].setExpand(false);
                }
        }
        else {
-               flags &= ~MMF_Edit;
-               for (int i = 0; i < nargs; ++i) {
+               flags_ &= ~MMF_Edit;
+               for (int i = 0; i < nargs_; ++i) {
                        args_[i].setExpand(true);
                }
        }
@@ -72,23 +72,27 @@ void MathMacroTemplate::setEditMode(bool ed)
 
 void MathMacroTemplate::draw(Painter & pain, int x, int y)
 {
-       int x2, y2;
-       bool expnd = (nargs > 0) ? args_[0].getExpand(): false;
-       if (flags & MMF_Edit) {
-               for (int i = 0; i < nargs; ++i) {
+       int x2;
+       int y2;
+       bool expnd = (nargs_ > 0) ? args_[0].getExpand(): false;
+       if (flags_ & MMF_Edit) {
+               for (int i = 0; i < nargs_; ++i) {
                        args_[i].setExpand(false);
                }
-               x2 = x; y2 = y;
+               x2 = x;
+               y2 = y;
        } else {
-               for (int i = 0; i < nargs; ++i) {
+               for (int i = 0; i < nargs_; ++i) {
                        args_[i].setExpand(true);
                }
-               x2 = xo; y2 = yo;
+               x2 = xo();
+               y2 = yo();
        }
        MathParInset::draw(pain, x, y);
-       xo = x2; yo = y2;
+       xo(x2);
+       yo(y2);
 
-       for (int i = 0; i < nargs; ++i) {
+       for (int i = 0; i < nargs_; ++i) {
                args_[i].setExpand(expnd);
        }
 }
@@ -96,20 +100,20 @@ void MathMacroTemplate::draw(Painter & pain, int x, int y)
 
 void MathMacroTemplate::Metrics()
 {
-       bool expnd = (nargs > 0) ? args_[0].getExpand(): false;
+       bool expnd = (nargs_ > 0) ? args_[0].getExpand(): false;
     
-       if (flags & MMF_Edit) {
-               for (int i = 0; i < nargs; ++i) {
+       if (flags_ & MMF_Edit) {
+               for (int i = 0; i < nargs_; ++i) {
                        args_[i].setExpand(false);
                }
        } else {
-               for (int i = 0; i < nargs; ++i) {
+               for (int i = 0; i < nargs_; ++i) {
                        args_[i].setExpand(true);
                }
        }
        MathParInset::Metrics();
     
-       for (int i = 0; i < nargs; ++i) {
+       for (int i = 0; i < nargs_; ++i) {
                args_[i].setExpand(expnd);
        }
 }
@@ -118,10 +122,10 @@ void MathMacroTemplate::Metrics()
 void MathMacroTemplate::update(MathMacro * macro)
 {
        int idx = (macro) ? macro->getArgumentIdx() : 0;
-       for (int i = 0; i < nargs; ++i) {
+       for (int i = 0; i < nargs_; ++i) {
                if (macro) {
                        macro->setArgumentIdx(i);
-                       args_[i].SetData(macro->GetData());
+                       args_[i].setData(macro->GetData());
                        MathedRowSt * row = macro->getRowSt();
                        args_[i].setRowSt(row);
                }
@@ -135,22 +139,22 @@ void MathMacroTemplate::WriteDef(ostream & os, bool fragile)
 {
        os << "\n\\newcommand{\\" << name << "}";
 
-       if (nargs > 0 ) 
-               os << "[" << nargs << "]";
+       if (nargs_ > 0 ) 
+               os << "[" << nargs_ << "]";
 
        os << "{";
 
-       for (int i = 0; i < nargs; ++i) {
+       for (int i = 0; i < nargs_; ++i) {
                args_[i].setExpand(false);
        }        
-       Write(os, fragile); 
+       Write(os, fragile);
        os << "}\n";
 }
 
 
 void MathMacroTemplate::setArgument(MathedArray * a, int i)
 {
-       args_[i].SetData(a);
+       args_[i].setData(a);
 }
 
 
@@ -162,7 +166,7 @@ void MathMacroTemplate::GetMacroXY(int i, int & x, int & y) const
 
 MathParInset * MathMacroTemplate::getMacroPar(int i) const
 {
-       if (i >= 0 && i < nargs) 
+       if (i >= 0 && i < nargs_
                return const_cast<MathParInset *>
                        (static_cast<MathParInset const *>(&args_[i]));
        else 
@@ -172,7 +176,7 @@ MathParInset * MathMacroTemplate::getMacroPar(int i) const
 
 void MathMacroTemplate::SetMacroFocus(int &idx, int x, int y)
 {
-       for (int i = 0; i < nargs; ++i) {
+       for (int i = 0; i < nargs_; ++i) {
                if (args_[i].Inside(x, y)) {
                        idx = i;
                        break;