2 * \file InsetMathCommand.C
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
13 #include "InsetMathCommand.h"
15 #include "MathStream.h"
16 #include "dispatchresult.h"
17 #include "funcrequest.h"
27 CommandInset::CommandInset(docstring const & name)
28 : InsetMathNest(2), name_(name), set_label_(false)
34 auto_ptr<InsetBase> CommandInset::doClone() const
36 return auto_ptr<InsetBase>(new CommandInset(*this));
40 void CommandInset::metrics(MetricsInfo & mi, Dimension & dim) const
44 button_.update(screenLabel(), true);
46 button_.metrics(mi, dim);
51 InsetBase * CommandInset::editXY(LCursor & cur, int /*x*/, int /*y*/)
58 void CommandInset::draw(PainterInfo & pi, int x, int y) const
60 button_.draw(pi, x, y);
61 setPosCache(pi, x, y);
65 void CommandInset::write(WriteStream & os) const
67 os << '\\' << name_.c_str();
69 os << '[' << cell(1) << ']';
70 os << '{' << cell(0) << '}';
74 docstring const CommandInset::screenLabel() const
80 string const CommandInset::createDialogStr(string const & name) const
83 os << from_ascii(name + " LatexCommand ");
86 return to_utf8(os.str()) + "\n\\end_inset\n\n";