#include <config.h>
#include "command_inset.h"
+#include "math_data.h"
#include "math_mathmlstream.h"
+#include "dispatchresult.h"
#include "funcrequest.h"
-#include "Lsstream.h"
+#include <sstream>
+
+using std::string;
using std::auto_ptr;
+using std::ostringstream;
CommandInset::CommandInset(string const & name)
- : MathNestInset(2),
- name_(name),
- set_label_(false)
+ : MathNestInset(2), name_(name), set_label_(false)
{
lock_ = true;
}
-auto_ptr<InsetBase> CommandInset::clone() const
+auto_ptr<InsetBase> CommandInset::doClone() const
{
return auto_ptr<InsetBase>(new CommandInset(*this));
}
button_.update(screenLabel(), true);
}
button_.metrics(mi, dim);
+ dim_ = dim;
}
void CommandInset::draw(PainterInfo & pi, int x, int y) const
{
button_.draw(pi, x, y);
-}
-
-dispatch_result
-CommandInset::dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos)
-{
- switch (cmd.action) {
- default:
- return MathNestInset::dispatch(cmd, idx, pos);
- }
- return UNDISPATCHED;
+ setPosCache(pi, x, y);
}
string const CommandInset::screenLabel() const
{
- return name_;
+ return name_;
}
string const CommandInset::createDialogStr(string const & name) const
{
- ostringstream data;
- data << name << " LatexCommand ";
- WriteStream wsdata(data);
- write(wsdata);
- wsdata << "\n\\end_inset\n\n";
- return STRCONV(data.str());
+ ostringstream os;
+ os << name << " LatexCommand ";
+ WriteStream ws(os);
+ write(ws);
+ ws << "\n\\end_inset\n\n";
+ return os.str();
}