dim.wid = 10;
break;
}
+ // Cache the inset dimension.
+ setDimCache(mi, dim);
}
void InsetSpace::draw(PainterInfo & pi, int x, int y) const
{
- int const w = dim_.wid;
+ 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];
///
void metrics(MetricsInfo &, Dimension &) const;
///
- Dimension const dimension(BufferView const &) const { return dim_; };
- ///
void draw(PainterInfo & pi, int x, int y) const;
///
void write(Buffer const &, std::ostream &) const;
/// And which kind is this?
Kind kind_;
- ///
- mutable Dimension dim_;
};
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;
- dim_ = dim;
+ // Cache the inset dimension.
+ setDimCache(mi, dim);
}
void InsetVSpace::draw(PainterInfo & pi, int x, int y) const
{
+ 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;
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
- Dimension const dimension(BufferView const &) const { return dim_; };
- ///
void draw(PainterInfo & pi, int x, int y) const;
///
int latex(Buffer const &, odocstream &,
///
VSpace space_;
- ///
- mutable Dimension dim_;
};
dim.wid = 6;
dim.asc = int(h + f * h);
dim.des = int(f * h);
- dim_ = dim;
+ // Cache the inset dimension.
+ setDimCache(mi, dim);
}
void InsetMathBig::draw(PainterInfo & pi, int x, int y) const
{
+ Dimension const dim = dimension(*pi.base.bv);
// mathed_draw_deco does not use the leading backslash, so remove it
// (but don't use ltrim if this is the backslash delimiter).
// Replace \| by \Vert (equivalent in LaTeX), since mathed_draw_deco
// would treat it as |.
docstring const delim = (delim_ == "\\|") ? from_ascii("Vert") :
(delim_ == "\\\\") ? from_ascii("\\") : support::ltrim(delim_, "\\");
- mathed_draw_deco(pi, x + 1, y - dim_.ascent(), 4, dim_.height(),
+ mathed_draw_deco(pi, x + 1, y - dim.ascent(), 4, dim.height(),
delim);
setPosCache(pi, x, y);
}
docstring const name_;
/// ( or [ or \\Vert...
docstring const delim_;
- ///
- mutable Dimension dim_;
};
char_type char_;
/// cached kerning for superscript
mutable int kerning_;
- /// FIXME: move this out to BufferView
- mutable Dimension dim_;
};
} // namespace lyx