]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_funcinset.C
use stream-like syntax for LaTeX output
[lyx.git] / src / mathed / math_funcinset.C
index 26f95fc3efd513a64ac7237fcd54ba53f6361d19..b5651b9df79b9488eb277d4b18972e80b6824aff 100644 (file)
@@ -15,9 +15,8 @@ extern LyXFont WhichFont(short type, int size);
 
 
 MathFuncInset::MathFuncInset(string const & nm)
-{
-       name_ = nm;
-}
+       : name_(nm)
+{}
 
 
 MathInset * MathFuncInset::clone() const
@@ -26,7 +25,19 @@ MathInset * MathFuncInset::clone() const
 }
 
 
-void MathFuncInset::write(std::ostream & os, bool /* fragile */) const
+string const & MathFuncInset::name() const
+{
+       return name_;
+}
+
+
+void MathFuncInset::setName(string const & n)
+{
+       name_ = n;
+}
+
+
+void MathFuncInset::write(MathWriteInfo & os) const
 {
        os << "\\" << name_ << ' ';
 }
@@ -38,13 +49,10 @@ void MathFuncInset::writeNormal(std::ostream & os) const
 }
 
 
-void MathFuncInset::metrics(MathStyles st) const 
+void MathFuncInset::metrics(MathMetricsInfo const & st) const 
 {
        size_ = st;
-       if (name_.empty()) 
-               mathed_char_dim(LM_TC_TEX, size_, 'I', ascent_, descent_, width_);
-       else 
-               mathed_string_dim(LM_TC_TEX, size_, name_, ascent_, descent_, width_);
+       mathed_string_dim(LM_TC_TEX, size_.size, name_, ascent_, descent_, width_);
 }
 
 
@@ -52,8 +60,5 @@ void MathFuncInset::draw(Painter & pain, int x, int y) const
 { 
        xo(x);
        yo(y);
-       if (name_.empty()) 
-               drawChar(pain, LM_TC_TEX, size_, x, y, ' ');
-       else
-               drawStr(pain, LM_TC_TEX, size_, x, y, name_);
+       drawStr(pain, LM_TC_TEX, size_.size, x, y, name_);
 }