]> git.lyx.org Git - lyx.git/commitdiff
Rename InsetMathNest::metrics to cellsMetrics
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 12 Jan 2017 10:22:51 +0000 (11:22 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 12 Jan 2017 10:22:51 +0000 (11:22 +0100)
Re-using the name of a virtual method with different semantics is not
a good idea anyway.

src/mathed/InsetMathCancelto.cpp
src/mathed/InsetMathNest.cpp
src/mathed/InsetMathNest.h
src/mathed/InsetMathRoot.cpp

index f3ead3cd3a6dd2bea6d75cc46ff7ddfe7fa1e135..cf6b006d446485b739a9f1179e3f01604bbe05db 100644 (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;
index 1da75468d218533b93c527aefe5b5b58d0daa99b..3460cdca35a7be3b65c7b66664d1820497da6064 100644 (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);
        }
 }
 
index 06668c9d2aa33a7cf1302b151f6e19afef86b8d9..f1426350c3070145672610cd5913904612f1697a 100644 (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
index f8f36d8214a09c49e71d9246ea01d7e37693fe85..f61db16e8f1d9dc3b24ea0c7005199274fe20568 100644 (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;