Rename InsetMathNest::metrics to cellsMetrics

Re-using the name of a virtual method with different semantics is not
a good idea anyway.
This commit is contained in:
Jean-Marc Lasgouttes 2017-01-12 11:22:51 +01:00
parent 4cea47d1eb
commit 8361fb603e
4 changed files with 7 additions and 16 deletions

View File

@ -42,7 +42,7 @@ Inset * InsetMathCancelto::clone() const
void InsetMathCancelto::metrics(MetricsInfo & mi, Dimension & dim) const
{
Changer dummy = mi.base.changeEnsureMath();
InsetMathNest::metrics(mi);
cellsMetrics(mi);
Dimension const & dim0 = cell(0).dimension(*mi.base.bv);
Dimension const & dim1 = cell(1).dimension(*mi.base.bv);
dim.asc = max(dim0.ascent() + 2, dim0.ascent() + dim1.ascent()) + 2 + 8;

View File

@ -176,12 +176,12 @@ void InsetMathNest::cursorPos(BufferView const & bv,
}
void InsetMathNest::metrics(MetricsInfo const & mi) const
void InsetMathNest::cellsMetrics(MetricsInfo const & mi) const
{
MetricsInfo m = mi;
for (idx_type i = 0, n = nargs(); i != n; ++i) {
for (auto const & cell : cells_) {
Dimension dim;
cell(i).metrics(m, dim);
cell.metrics(m, dim);
}
}

View File

@ -33,17 +33,8 @@ public:
///
void setBuffer(Buffer &);
// The method below hides inset::metrics() intentionally!
// We have to tell clang not to be fussy about that.
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Woverloaded-virtual"
#endif
/// the size is usually some sort of convex hull of the cells
void metrics(MetricsInfo const & mi) const;
#ifdef __clang__
#pragma clang diagnostic pop
#endif
/// Update the cells metrics
void cellsMetrics(MetricsInfo const & mi) const;
/// draw background if locked
void draw(PainterInfo & pi, int x, int y) const;
/// draw selection background

View File

@ -42,7 +42,7 @@ Inset * InsetMathRoot::clone() const
void InsetMathRoot::metrics(MetricsInfo & mi, Dimension & dim) const
{
Changer dummy = mi.base.changeEnsureMath();
InsetMathNest::metrics(mi);
cellsMetrics(mi);
Dimension const & dim0 = cell(0).dimension(*mi.base.bv);
Dimension const & dim1 = cell(1).dimension(*mi.base.bv);
dim.asc = max(dim0.ascent() + 5, dim1.ascent()) + 2;