lyx_mirror/src/mathed/math_macroarg.C
André Pönitz 4665fc9c30 remove unneeded #includes, cosmetics
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2232 a592a061-630c-0410-9148-cb99ea01b6c8
2001-07-13 09:54:32 +00:00

63 lines
1.1 KiB
C

#ifdef __GNUG__
#pragma implementation
#endif
#include "math_macroarg.h"
#include "math_macro.h"
#include "math_defs.h"
#include "mathed/support.h"
#include "debug.h"
MathMacroArgument::MathMacroArgument(int n)
: number_(n)
{
if (n < 1 || n > 9) {
lyxerr << "MathMacroArgument::MathMacroArgument: wrong Argument id: "
<< n << std::endl;
}
}
MathInset * MathMacroArgument::clone() const
{
return new MathMacroArgument(*this);
}
void MathMacroArgument::draw(Painter & pain, int x, int y)
{
char str[] = "#0";
str[1] += number_;
drawStr(pain, LM_TC_TEX, size(), x, y, str);
}
void MathMacroArgument::Metrics(MathStyles st, int, int)
{
char str[] = "#0";
str[1] += number_;
size_ = st;
mathed_string_dim(LM_TC_TEX, size(), str, ascent_, descent_, width_);
}
void MathMacroArgument::Write(std::ostream & os, bool /*fragile*/) const
{
os << '#' << number_ << ' ';
}
void MathMacroArgument::WriteNormal(std::ostream & os) const
{
os << "[macroarg " << number_ << "] ";
}
void MathMacroArgument::substitute(MathArray & array, MathMacro const & m) const
{
array.push_back(m.cell(number_ - 1));
}