]> git.lyx.org Git - features.git/blobdiff - src/mathed/math_root.C
apply the ostream changes to mathed, some other small related things
[features.git] / src / mathed / math_root.C
index f182316783d445e684939c1de417f5d3542e9c3a..f37fe0518c9ea2d1349870ad26583311f5599721 100644 (file)
@@ -35,9 +35,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,7 +47,7 @@ MathedInset *MathRootInset::Clone()
 }
 
 
-void MathRootInset::SetData(LyxArrayBase *d)
+void MathRootInset::SetData(LyxArrayBase * d)
 {
    if (idx == 1)
      MathParInset::SetData(d);
@@ -67,7 +67,7 @@ bool MathRootInset::setArgumentIdx(int i)
 }
 
 
-void MathRootInset::GetXY(int& x, int& y) const
+void MathRootInset::GetXY(int & x, int & y) const
 {
    if (idx == 1)
      MathParInset::GetXY(x, y);
@@ -75,7 +75,8 @@ void MathRootInset::GetXY(int& x, int& y) const
      uroot->GetXY(x, y);
 }
 
-LyxArrayBase *MathRootInset::GetData()
+
+LyxArrayBase * MathRootInset::GetData()
 {
    if (idx == 1)
      return array;
@@ -108,14 +109,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,15 +134,24 @@ void MathRootInset::SetFocus(int x, int)
 }
 
 
-void MathRootInset::Write(FILE *outf)
-{ 
+void MathRootInset::Write(ostream & os)
+{
+#ifdef USE_OSTREAM_ONLY
+       os << '\\' << name << '[';
+       uroot->Write(os);  
+       os << "]{";
+       MathParInset::Write(os);
+       os << '}';
+#else
    string output;
-   MathRootInset::Write(output);  
-   fprintf(outf, "%s", output.c_str());
+   MathRootInset::Write(output);
+   os << output;
+#endif
 }
 
 
-void MathRootInset::Write(string &outf)
+#ifndef USE_OSTREAM_ONLY
+void MathRootInset::Write(string & outf)
 { 
    outf += '\\';
    outf += name;
@@ -152,3 +161,4 @@ void MathRootInset::Write(string &outf)
    MathParInset::Write(outf);
    outf += '}';
 }
+#endif