#include "debug.h"
#include "funcrequest.h"
#include "lyxlex.h"
+#include "metricsinfo.h"
#include "frontends/Painter.h"
InsetCommand::InsetCommand(InsetCommandParams const & p)
- : p_(p.getCmdName(), p.getContents(), p.getOptions())
+ : p_(p.getCmdName(), p.getContents(), p.getOptions()),
+ set_label_(false)
{}
-// InsetCommand::InsetCommand(InsetCommandParams const & p, bool)
-// : p_(p.getCmdName(), p.getContents(), p.getOptions())
-// {}
+BufferView * InsetCommand::view() const
+{
+ return button_.view();
+}
+
+
+void InsetCommand::metrics(MetricsInfo & mi, Dimension & dim) const
+{
+ if (!set_label_) {
+ set_label_ = true;
+ button_.update(getScreenLabel(mi.base.bv->buffer()),
+ editable() != NOT_EDITABLE);
+ }
+ button_.metrics(mi, dim);
+ dim_ = dim;
+}
+
+
+void InsetCommand::draw(PainterInfo & pi, int x, int y) const
+{
+ button_.draw(pi, x, y);
+}
void InsetCommand::setParams(InsetCommandParams const & p)
p_.setCmdName(p.getCmdName());
p_.setContents(p.getContents());
p_.setOptions(p.getOptions());
+ set_label_ = false;
}
dispatch_result InsetCommand::localDispatch(FuncRequest const & cmd)
{
- lyxerr << "InsetCommand::localDispatch: " << cmd.action << "\n";
switch (cmd.action) {
case LFUN_INSET_MODIFY: {
InsetCommandParams p;
return localDispatch(FuncRequest(cmd.view(), LFUN_INSET_EDIT));
default:
- return UNDISPATCHED;
+ return InsetOld::localDispatch(cmd);
}
}
{}
-string const InsetCommandMailer::inset2string() const
+string const InsetCommandMailer::inset2string(Buffer const &) const
{
return params2string(name(), inset_.params());
}