From 8361fb603eb92fa54b84a49b3996b382804a5f20 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Thu, 12 Jan 2017 11:22:51 +0100 Subject: [PATCH] Rename InsetMathNest::metrics to cellsMetrics Re-using the name of a virtual method with different semantics is not a good idea anyway. --- src/mathed/InsetMathCancelto.cpp | 2 +- src/mathed/InsetMathNest.cpp | 6 +++--- src/mathed/InsetMathNest.h | 13 ++----------- src/mathed/InsetMathRoot.cpp | 2 +- 4 files changed, 7 insertions(+), 16 deletions(-) diff --git a/src/mathed/InsetMathCancelto.cpp b/src/mathed/InsetMathCancelto.cpp index f3ead3cd3a..cf6b006d44 100644 --- a/src/mathed/InsetMathCancelto.cpp +++ b/src/mathed/InsetMathCancelto.cpp @@ -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; diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp index 1da75468d2..3460cdca35 100644 --- a/src/mathed/InsetMathNest.cpp +++ b/src/mathed/InsetMathNest.cpp @@ -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); } } diff --git a/src/mathed/InsetMathNest.h b/src/mathed/InsetMathNest.h index 06668c9d2a..f1426350c3 100644 --- a/src/mathed/InsetMathNest.h +++ b/src/mathed/InsetMathNest.h @@ -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 diff --git a/src/mathed/InsetMathRoot.cpp b/src/mathed/InsetMathRoot.cpp index f8f36d8214..f61db16e8f 100644 --- a/src/mathed/InsetMathRoot.cpp +++ b/src/mathed/InsetMathRoot.cpp @@ -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; -- 2.39.5