#include "InsetSpace.h"
#include "debug.h"
-#include "Color.h"
+#include "Dimension.h"
#include "Lexer.h"
#include "MetricsInfo.h"
#include "OutputParams.h"
using std::string;
using std::max;
-using std::auto_ptr;
using std::ostream;
}
-bool InsetSpace::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetSpace::metrics(MetricsInfo & mi, Dimension & dim) const
{
- frontend::FontMetrics const & fm =
- theFontMetrics(mi.base.font);
+ frontend::FontMetrics const & fm = theFontMetrics(mi.base.font);
dim.asc = fm.maxAscent();
dim.des = fm.maxDescent();
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];
yp[3] = y - max(h / 4, 1);
if (kind_ == PROTECTED || kind_ == ENSPACE || kind_ == NEGTHIN)
- pi.pain.lines(xp, yp, 4, Color::latex);
+ pi.pain.lines(xp, yp, 4, Color_latex);
else
- pi.pain.lines(xp, yp, 4, Color::special);
+ pi.pain.lines(xp, yp, 4, Color_special);
}
}
-auto_ptr<Inset> InsetSpace::doClone() const
+Inset * InsetSpace::clone() const
{
- return auto_ptr<Inset>(new InsetSpace(kind_));
+ return new InsetSpace(kind_);
}