]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetVSpace.cpp
* src/paragraph_funcs.cpp (breakParagraph): change parameter 'flag' to
[lyx.git] / src / insets / InsetVSpace.cpp
index 3a8b0fcdaff2d208b19d3d357a7ba6272f24e013..0d630b5cdbf2bdfc3167e5c71862ef6833a8f901 100644 (file)
@@ -57,9 +57,9 @@ InsetVSpace::~InsetVSpace()
 }
 
 
-std::auto_ptr<Inset> InsetVSpace::doClone() const
+Inset * InsetVSpace::clone() const
 {
-       return std::auto_ptr<Inset>(new InsetVSpace(*this));
+       return new InsetVSpace(*this);
 }
 
 
@@ -73,7 +73,8 @@ void InsetVSpace::doDispatch(Cursor & cur, FuncRequest & cmd)
        }
 
        case LFUN_MOUSE_RELEASE:
-               InsetVSpaceMailer(*this).showDialog(&cur.bv());
+               if (!cur.selection())
+                       InsetVSpaceMailer(*this).showDialog(&cur.bv());
                break;
 
        default:
@@ -117,7 +118,7 @@ int const arrow_size = 4;
 }
 
 
-bool InsetVSpace::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetVSpace::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        int height = 3 * arrow_size;
        if (space_.length().len().value() >= 0.0)
@@ -137,20 +138,17 @@ bool InsetVSpace::metrics(MetricsInfo & mi, Dimension & dim) const
        dim.asc = height / 2 + (a - d) / 2; // align cursor with the
        dim.des = height - dim.asc;         // label text
        dim.wid = ADD_TO_VSPACE_WIDTH + 2 * arrow_size + 5 + w;
-       bool const changed = dim_ != dim;
-       dim_ = dim;
-       return changed;
+       // Cache the inset dimension. 
+       setDimCache(mi, dim);
 }
 
 
 void InsetVSpace::draw(PainterInfo & pi, int x, int y) const
 {
-       setPosCache(pi, x, y);
-
+       Dimension const dim = dimension(*pi.base.bv);
        x += ADD_TO_VSPACE_WIDTH;
-
-       int const start = y - dim_.asc;
-       int const end   = y + dim_.des;
+       int const start = y - dim.asc;
+       int const end   = y + dim.des;
 
        // y-values for top arrow
        int ty1, ty2;
@@ -203,7 +201,7 @@ void InsetVSpace::draw(PainterInfo & pi, int x, int y) const
 
 
 int InsetVSpace::latex(Buffer const & buf, odocstream & os,
-                       OutputParams const &) const
+                      OutputParams const &) const
 {
        os << from_ascii(space_.asLatexCommand(buf.params())) << '\n';
        return 1;
@@ -211,7 +209,7 @@ int InsetVSpace::latex(Buffer const & buf, odocstream & os,
 
 
 int InsetVSpace::plaintext(Buffer const &, odocstream & os,
-                           OutputParams const &) const
+                          OutputParams const &) const
 {
        os << "\n\n";
        return PLAINTEXT_NEWLINE;
@@ -219,7 +217,7 @@ int InsetVSpace::plaintext(Buffer const &, odocstream & os,
 
 
 int InsetVSpace::docbook(Buffer const &, odocstream & os,
-                         OutputParams const &) const
+                        OutputParams const &) const
 {
        os << '\n';
        return 1;