2 * \file MathMacroArgument.C
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Alejandro Aguilar Sierra
9 * Full author contact details are available in file CREDITS.
14 #include "MathMacroArgument.h"
15 #include "InsetMathMacro.h"
16 #include "MathStream.h"
17 #include "MathSupport.h"
29 MathMacroArgument::MathMacroArgument(size_t n)
33 lyxerr << "MathMacroArgument::MathMacroArgument: wrong Argument id: "
36 // The profiler tells us not to use
37 // str_ = '#' + convert<docstring>(n);
38 // so we do the conversion of n to ASCII manually.
39 // This works because 1 <= n <= 9.
46 auto_ptr<InsetBase> MathMacroArgument::doClone() const
48 return auto_ptr<InsetBase>(new MathMacroArgument(*this));
52 void MathMacroArgument::write(WriteStream & os) const
58 void MathMacroArgument::metrics(MetricsInfo & mi, Dimension & dim) const
60 mathed_string_dim(mi.base.font, str_, dim_);
65 void MathMacroArgument::draw(PainterInfo & pi, int x, int y) const
67 drawStrRed(pi, x, y, str_);
68 setPosCache(pi, x, y);
72 void MathMacroArgument::normalize(NormalStream & os) const
74 os << "[macroarg " << str_ << "] ";