X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2Finsetcommand.C;h=6d5248844b923d5650941ffb563ea74feb0313ae;hb=e28331ed63062dea10d0a21b9ec12034b4b17b9a;hp=812202d52b9d9739c654a2b36be92c9e04284773;hpb=0d449056ef9ace3ef737e4b9aba8d3994615dc18;p=lyx.git diff --git a/src/insets/insetcommand.C b/src/insets/insetcommand.C index 812202d52b..6d5248844b 100644 --- a/src/insets/insetcommand.C +++ b/src/insets/insetcommand.C @@ -22,9 +22,8 @@ #include -using lyx::odocstream; -using lyx::odocstream; +namespace lyx { using std::string; using std::istringstream; @@ -36,6 +35,7 @@ InsetCommand::InsetCommand(InsetCommandParams const & p, string const & mailer_name) : p_(p), mailer_name_(mailer_name), + mouse_hover_(false), updateButtonLabel_(true) {} @@ -47,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; @@ -55,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); } @@ -104,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 @@ -113,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; } @@ -209,3 +219,6 @@ InsetCommandMailer::params2string(string const & name, data << "\\end_inset\n"; return data.str(); } + + +} // namespace lyx