]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_root.C
Hopefully fix the problem with stateText() in lyxfont.C
[lyx.git] / src / mathed / math_root.C
index 31d2079e78ce0bf1d74988bfde6d44ea21d1fae8..be1853c60f9bfb74ebc6aab02451073f94c584f3 100644 (file)
@@ -6,7 +6,7 @@
  *  Created:     January 1999
  *  Description: Root math object
  *
- *  Copyright: (c) 1999 Alejandro Aguilar Sierra
+ *  Copyright: 1999 Alejandro Aguilar Sierra
  *
  *   You are free to use and modify this code under the terms of
  *   the GNU General Public Licence version 2 or later.
 #include "math_iter.h"
 #include "math_root.h"
 
-MathRootInset::MathRootInset(short st): MathSqrtInset(st)
+using std::ostream;
+
+MathRootInset::MathRootInset(short st)
+       : MathSqrtInset(st)
 {
     idx = 1;
     uroot = new MathParInset(LM_ST_TEXT); 
@@ -35,9 +38,9 @@ MathRootInset::~MathRootInset()
 }
 
 
-MathedInset *MathRootInset::Clone()
+MathedInset * MathRootInset::Clone()
 {
-   MathRootInset* p = new MathRootInset(GetStyle());
+   MathRootInset * p = new MathRootInset(GetStyle());
    MathedIter it(array), itr(uroot->GetData());
    p->SetData(it.Copy());
    p->setArgumentIdx(0);
@@ -47,9 +50,9 @@ MathedInset *MathRootInset::Clone()
 }
 
 
-void MathRootInset::SetData(LyxArrayBase *d)
+void MathRootInset::SetData(LyxArrayBase * d)
 {
-   if (idx==1)
+   if (idx == 1)
      MathParInset::SetData(d);
    else {
       uroot->SetData(d);
@@ -59,7 +62,7 @@ void MathRootInset::SetData(LyxArrayBase *d)
 
 bool MathRootInset::setArgumentIdx(int i)
 {
-   if (i==0 || i==1) {
+   if (i == 0 || i == 1) {
        idx = i;
        return true;
    } else
@@ -67,17 +70,18 @@ bool MathRootInset::setArgumentIdx(int i)
 }
 
 
-void MathRootInset::GetXY(int& x, int& y) const
+void MathRootInset::GetXY(int & x, int & y) const
 {
-   if (idx==1)
+   if (idx == 1)
      MathParInset::GetXY(x, y);
    else
      uroot->GetXY(x, y);
 }
 
-LyxArrayBase *MathRootInset::GetData()
+
+LyxArrayBase * MathRootInset::GetData()
 {
-   if (idx==1)
+   if (idx == 1)
      return array;
    else
      return uroot->GetData();
@@ -108,14 +112,13 @@ void MathRootInset::Metrics()
 }
 
 
-void MathRootInset::Draw(int x, int y)
+void MathRootInset::draw(Painter & pain, int x, int y)
 {
     int idxp = idx;
 
     idx = 1;
-    uroot->Draw(x, y - dh);
-    MathSqrtInset::Draw(x+wroot, y);
-    XFlush(fl_display);
+    uroot->draw(pain, x, y - dh);
+    MathSqrtInset::draw(pain, x + wroot, y);
     idx = idxp;
 }
 
@@ -134,21 +137,11 @@ void MathRootInset::SetFocus(int x, int)
 }
 
 
-void MathRootInset::Write(FILE *outf)
-{ 
-   LString output;
-   MathRootInset::Write(output);  
-   fprintf(outf, "%s", output.c_str());
-}
-
-
-void MathRootInset::Write(LString &outf)
-{ 
-   outf += '\\';
-   outf += name;
-   outf += '[';
-   uroot->Write(outf);  
-   outf += "]{";
-   MathParInset::Write(outf);
-   outf += '}';
+void MathRootInset::Write(ostream & os, bool fragile)
+{
+       os << '\\' << name << '[';
+       uroot->Write(os, fragile);  
+       os << "]{";
+       MathParInset::Write(os, fragile);
+       os << '}';
 }