X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2Finsetcommand.C;h=6d5248844b923d5650941ffb563ea74feb0313ae;hb=e28331ed63062dea10d0a21b9ec12034b4b17b9a;hp=764b63d90d21fa6cd82a01ad25df5ac3ea3a76cf;hpb=8b67659646c6850377cb9f44a2a0a22c0e80840c;p=lyx.git diff --git a/src/insets/insetcommand.C b/src/insets/insetcommand.C index 764b63d90d..6d5248844b 100644 --- a/src/insets/insetcommand.C +++ b/src/insets/insetcommand.C @@ -23,7 +23,7 @@ #include -using lyx::odocstream; +namespace lyx { using std::string; using std::istringstream; @@ -35,6 +35,7 @@ InsetCommand::InsetCommand(InsetCommandParams const & p, string const & mailer_name) : p_(p), mailer_name_(mailer_name), + mouse_hover_(false), updateButtonLabel_(true) {} @@ -46,7 +47,7 @@ InsetCommand::~InsetCommand() } -void InsetCommand::metrics(MetricsInfo & mi, Dimension & dim) const +bool InsetCommand::metrics(MetricsInfo & mi, Dimension & dim) const { if (updateButtonLabel_) { updateButtonLabel_ = false; @@ -54,13 +55,23 @@ void InsetCommand::metrics(MetricsInfo & mi, Dimension & dim) const editable() != NOT_EDITABLE); } button_.metrics(mi, dim); + bool const changed = dim_ != dim; dim_ = dim; + return changed; +} + + +bool InsetCommand::setMouseHover(bool mouse_hover) +{ + mouse_hover_ = mouse_hover; + return true; } void InsetCommand::draw(PainterInfo & pi, int x, int y) const { setPosCache(pi, x, y); + button_.setRenderState(mouse_hover_); button_.draw(pi, x, y); } @@ -87,7 +98,7 @@ int InsetCommand::plaintext(Buffer const &, odocstream &, } -int InsetCommand::docbook(Buffer const &, ostream &, +int InsetCommand::docbook(Buffer const &, odocstream &, OutputParams const &) const { return 0; @@ -103,7 +114,7 @@ void InsetCommand::doDispatch(LCursor & cur, FuncRequest & cmd) case LFUN_INSET_MODIFY: { InsetCommandParams p(p_.getCmdName()); - InsetCommandMailer::string2params(mailer_name_, lyx::to_utf8(cmd.argument()), p); + InsetCommandMailer::string2params(mailer_name_, to_utf8(cmd.argument()), p); if (p.getCmdName().empty()) cur.noUpdate(); else @@ -112,7 +123,7 @@ void InsetCommand::doDispatch(LCursor & cur, FuncRequest & cmd) } case LFUN_INSET_DIALOG_UPDATE: { - string const name = lyx::to_utf8(cmd.argument()); + string const name = to_utf8(cmd.argument()); InsetCommandMailer(name, *this).updateDialog(&cur.bv()); break; } @@ -208,3 +219,6 @@ InsetCommandMailer::params2string(string const & name, data << "\\end_inset\n"; return data.str(); } + + +} // namespace lyx