]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetSpace.cpp
* src/paragraph_funcs.cpp (breakParagraph): change parameter 'flag' to
[lyx.git] / src / insets / InsetSpace.cpp
index 168862236bed9f734759b6be9da07870a47cb002..bbab7f278e73cabf0b3c9a2d37abd0bb44973516 100644 (file)
@@ -29,7 +29,6 @@ namespace lyx {
 
 using std::string;
 using std::max;
-using std::auto_ptr;
 using std::ostream;
 
 
@@ -48,7 +47,7 @@ InsetSpace::Kind InsetSpace::kind() const
 }
 
 
-bool InsetSpace::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetSpace::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        frontend::FontMetrics const & fm =
                theFontMetrics(mi.base.font);
@@ -75,15 +74,15 @@ bool InsetSpace::metrics(MetricsInfo & mi, Dimension & dim) const
                        dim.wid = 10;
                        break;
        }
-       bool const changed = dim_ != dim;
-       dim_ = dim;
-       return changed;
+       // Cache the inset dimension. 
+       setDimCache(mi, dim);
 }
 
 
 void InsetSpace::draw(PainterInfo & pi, int x, int y) const
 {
-       int const w = width();
+       Dimension const dim = dimension(*pi.base.bv);
+       int const w = dim.wid;
        int const h = theFontMetrics(pi.base.font)
                .ascent('x');
        int xp[4], yp[4];
@@ -235,9 +234,9 @@ int InsetSpace::textString(Buffer const & buf, odocstream & os,
 }
 
 
-auto_ptr<Inset> InsetSpace::doClone() const
+Inset * InsetSpace::clone() const
 {
-       return auto_ptr<Inset>(new InsetSpace(kind_));
+       return new InsetSpace(kind_);
 }