#include "InsetCommand.h"
+#include "Buffer.h"
#include "BufferView.h"
#include "DispatchResult.h"
#include "FuncRequest.h"
using std::string;
using std::istringstream;
-using std::ostream;
using std::ostringstream;
}
-bool InsetCommand::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetCommand::metrics(MetricsInfo & mi, Dimension & dim) const
{
if (updateButtonLabel_) {
updateButtonLabel_ = false;
- button_.update(getScreenLabel(*mi.base.bv->buffer()),
+ button_.update(getScreenLabel(mi.base.bv->buffer()),
editable() != NOT_EDITABLE);
}
button_.metrics(mi, dim);
- bool const changed = dim_ != dim;
- dim_ = dim;
- return changed;
}
void InsetCommand::draw(PainterInfo & pi, int x, int y) const
{
- setPosCache(pi, x, y);
button_.setRenderState(mouse_hover_);
button_.draw(pi, x, y);
}
int InsetCommand::latex(Buffer const &, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
os << getCommand();
return 0;
}
-int InsetCommand::plaintext(Buffer const &, odocstream & os,
- OutputParams const &) const
+int InsetCommand::plaintext(Buffer const & buf, odocstream & os,
+ OutputParams const &) const
{
- docstring const str = "[" + _("LaTeX Command: ") + from_utf8(getCmdName()) + "]";
+ docstring const str = "[" + buf.B_("LaTeX Command: ") + from_utf8(getCmdName()) + "]";
os << str;
return str.size();
}
int InsetCommand::docbook(Buffer const &, odocstream &,
- OutputParams const &) const
+ OutputParams const &) const
{
return 0;
}
}
case LFUN_MOUSE_RELEASE: {
- if (!mailer_name_.empty())
- InsetCommandMailer(mailer_name_, *this).showDialog(&cur.bv());
+ if (!cur.selection())
+ edit(cur, true);
break;
}
}
+void InsetCommand::edit(Cursor & cur, bool)
+{
+ if (!mailer_name_.empty())
+ InsetCommandMailer(mailer_name_, *this).showDialog(&cur.bv());
+}
+
+
void InsetCommand::replaceContents(std::string const & from, string const & to)
{
if (getContents() == from)
// by Text::readInset
string id;
lex >> id;
- if (!lex || id != "LatexCommand")
+ if (!lex || id != "CommandInset")
return print_mailer_error("InsetCommandMailer", in, 2, "LatexCommand");
params.read(lex);