7 #include "math_macrotemplate.h"
12 MathMacroTemplate::MathMacroTemplate() :
13 MathInset("undefined", LM_OT_MACRO, 1), numargs_(0), users_()
17 MathMacroTemplate::MathMacroTemplate(string const & nm, int numargs) :
18 MathInset(nm, LM_OT_MACRO, 1), numargs_(numargs), users_()
22 MathMacroTemplate * MathMacroTemplate::Clone() const
24 lyxerr << "cloning MacroTemplate!\n";
25 return new MathMacroTemplate(*this);
28 int MathMacroTemplate::numargs() const
33 void MathMacroTemplate::numargs(int numargs)
39 void MathMacroTemplate::Write(ostream & os, bool fragile) const
41 os << "\n\\newcommand{\\" << name_ << "}";
44 os << "[" << numargs_ << "]";
47 cell(0).Write(os, fragile);
52 void MathMacroTemplate::Metrics(MathStyles st)
56 width_ = xcell(0).width() + 4;
57 ascent_ = xcell(0).ascent() + 2;
58 descent_ = xcell(0).descent() + 2;
62 void MathMacroTemplate::draw(Painter & pain, int x, int y)
66 xcell(0).draw(pain, x + 2, y + 1);
67 pain.rectangle(x, y - ascent(), width(), height(), LColor::blue);