]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetCommand.cpp
* src/paragraph_funcs.cpp (breakParagraph): change parameter 'flag' to
[lyx.git] / src / insets / InsetCommand.cpp
index ea52598dc1278919749d9626f877082622899773..f50d33c124e6d1ed806fb36482a58fc782c5fbec 100644 (file)
@@ -29,7 +29,6 @@ namespace lyx {
 
 using std::string;
 using std::istringstream;
-using std::ostream;
 using std::ostringstream;
 
 
@@ -49,17 +48,14 @@ InsetCommand::~InsetCommand()
 }
 
 
-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;
 }
 
 
@@ -72,7 +68,6 @@ bool InsetCommand::setMouseHover(bool mouse_hover)
 
 void InsetCommand::draw(PainterInfo & pi, int x, int y) const
 {
-       setPosCache(pi, x, y);
        button_.setRenderState(mouse_hover_);
        button_.draw(pi, x, y);
 }
@@ -133,8 +128,8 @@ void InsetCommand::doDispatch(Cursor & cur, FuncRequest & cmd)
        }
 
        case LFUN_MOUSE_RELEASE: {
-               if (!mailer_name_.empty() && !cur.selection())
-                       InsetCommandMailer(mailer_name_, *this).showDialog(&cur.bv());
+               if (!cur.selection())
+                       edit(cur, true);
                break;
        }
 
@@ -166,6 +161,13 @@ bool InsetCommand::getStatus(Cursor & cur, FuncRequest const & cmd,
 }
 
 
+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)
@@ -206,7 +208,7 @@ void InsetCommandMailer::string2params(string const & name,
        // 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);