]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_root.C
small cleanup, doxygen, formatting changes
[lyx.git] / src / mathed / math_root.C
index 141167ef323ee7a990ac186fb611d0620622aaf2..13ae9ab97c03e20ec46c7bc6badb4377e0b5737b 100644 (file)
 
 #include "math_iter.h"
 #include "math_root.h"
+#include "support/LOstream.h"
 
 using std::ostream;
 
 MathRootInset::MathRootInset(short st)
        : MathSqrtInset(st)
 {
-    idx = 1;
-    uroot = new MathParInset(LM_ST_TEXT); 
+       idx_ = 1;
+       uroot_ = new MathParInset(LM_ST_TEXT); 
 }
 
 
 MathRootInset::~MathRootInset() 
 {
-    delete uroot;
+       delete uroot_;
 }
 
 
 MathedInset * MathRootInset::Clone()
 {
-   MathRootInset * p = new MathRootInset(GetStyle());
-   MathedIter it(array), itr(uroot->GetData());
-   p->SetData(it.Copy());
-   p->setArgumentIdx(0);
-   p->SetData(itr.Copy());
-
-   return p;
+       MathRootInset * p = new MathRootInset(GetStyle());
+       MathedIter it(array);
+       MathedIter itr(uroot_->GetData());
+       p->setData(it.Copy());
+       p->setArgumentIdx(0);
+       p->setData(itr.Copy());
+       
+       return p;
 }
 
 
-void MathRootInset::SetData(LyxArrayBase * d)
+void MathRootInset::setData(MathedArray * d)
 {
-   if (idx == 1)
-     MathParInset::SetData(d);
-   else {
-      uroot->SetData(d);
-   }
+       if (idx_ == 1)
+               MathParInset::setData(d);
+       else {
+               uroot_->setData(d);
+       }
 }
 
 
 bool MathRootInset::setArgumentIdx(int i)
 {
-   if (i == 0 || i == 1) {
-       idx = i;
-       return true;
-   } else
-      return false;
+       if (i == 0 || i == 1) {
+               idx_ = i;
+               return true;
+       } else
+               return false;
 }
 
 
 void MathRootInset::GetXY(int & x, int & y) const
 {
-   if (idx == 1)
-     MathParInset::GetXY(x, y);
-   else
-     uroot->GetXY(x, y);
+       if (idx_ == 1)
+               MathParInset::GetXY(x, y);
+       else
+               uroot_->GetXY(x, y);
 }
 
 
-LyxArrayBase * MathRootInset::GetData()
+MathedArray * MathRootInset::GetData()
 {
-   if (idx == 1)
-     return array;
-   else
-     return uroot->GetData();
+       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));
+       return (uroot_->Inside(x, y) || MathSqrtInset::Inside(x, y));
 }
 
 
 void MathRootInset::Metrics()
 {
-    int idxp = idx;
-
-    idx = 1;
-    MathSqrtInset::Metrics();
-    uroot->Metrics();
-    wroot = uroot->Width();
-    dh = Height()/2;
-    width += wroot;
-    //    if (uroot->Ascent() > dh) 
-    if (uroot->Height() > dh
-      ascent += uroot->Height() - dh;
-    dh -= descent - uroot->Descent();
-    idx = idxp;
+       int idxp = idx_;
+       
+       idx_ = 1;
+       MathSqrtInset::Metrics();
+       uroot_->Metrics();
+       wroot_ = uroot_->Width();
+       dh_ = Height()/2;
+       width += wroot_;
+       //    if (uroot->Ascent() > dh) 
+       if (uroot_->Height() > dh_
+               ascent += uroot_->Height() - dh_;
+       dh_ -= descent - uroot_->Descent();
+       idx_ = idxp;
 }
 
 
 void MathRootInset::draw(Painter & pain, int x, int y)
 {
-    int idxp = idx;
-
-    idx = 1;
-    uroot->draw(pain, x, y - dh);
-    MathSqrtInset::draw(pain, x + wroot, y);
-    idx = idxp;
+       int idxp = idx_;
+       
+       idx_ = 1;
+       uroot_->draw(pain, x, y - dh_);
+       MathSqrtInset::draw(pain, x + wroot_, y);
+       idx_ = idxp;
 }
 
 
 void MathRootInset::SetStyle(short st)
 {
-    MathSqrtInset::SetStyle(st);
-    
-    uroot->SetStyle((size<LM_ST_SCRIPTSCRIPT) ? size+1: size);
+       MathSqrtInset::SetStyle(st);
+       
+       uroot_->SetStyle((size() < LM_ST_SCRIPTSCRIPT) ? size() + 1 : size());
 }
 
 
 void MathRootInset::SetFocus(int x, int)
 {  
-    idx = (x > xo + wroot) ? 1: 0;
+       idx_ = (x > xo() + wroot_) ? 1: 0;
 }
 
 
-void MathRootInset::Write(ostream & os, signed char fragile)
+void MathRootInset::Write(ostream & os, bool fragile)
 {
        os << '\\' << name << '[';
-       uroot->Write(os, fragile);  
+       uroot_->Write(os, fragile);  
        os << "]{";
        MathParInset::Write(os, fragile);
        os << '}';