]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetcommand.C
* src/LyXAction.C: mark goto-clear-bookmark as working without buffer
[lyx.git] / src / insets / insetcommand.C
index 764b63d90d21fa6cd82a01ad25df5ac3ea3a76cf..6d5248844b923d5650941ffb563ea74feb0313ae 100644 (file)
@@ -23,7 +23,7 @@
 #include <sstream>
 
 
-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