]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_macroarg.C
rename commandtags.h to lfuns.h and renumber/cleanup. Rebuild the tree !
[lyx.git] / src / mathed / math_macroarg.C
index a9a565160f6fe82631bfd887ad74bd42e1651e42..09b28d1a67ad26c2198e7bf042d0bc96eb1bde03 100644 (file)
@@ -1,25 +1,23 @@
-#ifdef __GNUG__
-#pragma implementation
-#endif
 
 #include "math_macroarg.h"
 #include "math_macro.h"
-#include "math_defs.h"
 #include "math_mathmlstream.h"
 #include "math_support.h"
 #include "debug.h"
 
 
+using std::endl;
+
 
 MathMacroArgument::MathMacroArgument(int n)
        : MathNestInset(1), number_(n), expanded_(false)
 {
        if (n < 1 || n > 9) {
                lyxerr << "MathMacroArgument::MathMacroArgument: wrong Argument id: "
-                       << n << std::endl;
+                       << n << endl;
        }
        str_[0] = '#';
-       str_[1] = '0' + static_cast<unsigned char>(n);
+       str_[1] = static_cast<unsigned char>('0' + n);
        str_[2] = '\0';
 }
 
@@ -36,25 +34,21 @@ void MathMacroArgument::write(WriteStream & os) const
 }
 
 
-void MathMacroArgument::metrics(MathMetricsInfo const & mi) const
+void MathMacroArgument::metrics(MathMetricsInfo & mi) const
 {
-       mi_ = mi;
-       if (expanded_) {
-               xcell(0).metrics(mi_);
-               width_   = xcell(0).width();
-               ascent_  = xcell(0).ascent();
-               descent_ = xcell(0).descent();
-       } else
-               mathed_string_dim(LM_TC_TEX, mi_, str_, ascent_, descent_, width_);
+       if (expanded_)
+               dim_ = cell(0).metrics(mi);
+       else
+               mathed_string_dim(mi.base.font, str_, dim_);
 }
 
 
-void MathMacroArgument::draw(Painter & pain, int x, int y) const
+void MathMacroArgument::draw(MathPainterInfo & pi, int x, int y) const
 {
        if (expanded_)
-               xcell(0).draw(pain, x, y);
+               cell(0).draw(pi, x, y);
        else
-               drawStr(pain, LM_TC_TEX, mi_, x, y, str_);
+               drawStrRed(pi, x, y, str_);
 }
 
 
@@ -69,4 +63,3 @@ void MathMacroArgument::substitute(MathMacro const & m)
        cell(0) = m.cell(number_ - 1);
        expanded_ = true;
 }
-