The branch, biblatex2, has been updated. - Log -----------------------------------------------------------------
commit 239b9919ffe28338d789e6dc9122228f77ab77a7 Merge: 9b13217 cdc847f Author: Juergen Spitzmueller <sp...@lyx.org> Date: Thu Jan 12 14:29:55 2017 +0100 Merge branch 'master' into biblatex2 commit cdc847fd304019a19425a0d5d9d42a556a937097 Author: Jean-Marc Lasgouttes <lasgout...@lyx.org> Date: Thu Jan 12 12:15:17 2017 +0100 Fix drawing of empty boxes They were actually bigger than their metrics. diff --git a/src/mathed/MathRow.cpp b/src/mathed/MathRow.cpp index cfb4164..9465b32 100644 --- a/src/mathed/MathRow.cpp +++ b/src/mathed/MathRow.cpp @@ -289,7 +289,7 @@ void MathRow::draw(PainterInfo & pi, int x, int const y) const // the box is not visible in non-editable context (except for grey macro boxes). if (e.color != Color_none) pi.pain.rectangle(x + e.before, y - d.ascent(), - d.width(), d.height(), e.color); + d.width() - 1, d.height() - 1, e.color); x += d.wid + e.before + e.after; break; } commit 8361fb603eb92fa54b84a49b3996b382804a5f20 Author: Jean-Marc Lasgouttes <lasgout...@lyx.org> Date: Thu Jan 12 11:22:51 2017 +0100 Rename InsetMathNest::metrics to cellsMetrics Re-using the name of a virtual method with different semantics is not a good idea anyway. diff --git a/src/mathed/InsetMathCancelto.cpp b/src/mathed/InsetMathCancelto.cpp index f3ead3c..cf6b006 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 1da7546..3460cdc 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 06668c9..f142635 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 f8f36d8..f61db16 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; commit 4cea47d1eb082ed2e957cfe381fe4cdfd951453e Author: Jean-Marc Lasgouttes <lasgout...@lyx.org> Date: Thu Jan 12 10:27:41 2017 +0100 Implement mathClass() for \big and friends The information here is obtained by reading LaTeX sources. diff --git a/src/mathed/InsetMathBig.cpp b/src/mathed/InsetMathBig.cpp index eeaf965..889f8d4 100644 --- a/src/mathed/InsetMathBig.cpp +++ b/src/mathed/InsetMathBig.cpp @@ -39,6 +39,25 @@ docstring InsetMathBig::name() const } +MathClass InsetMathBig::mathClass() const +{ + /* The class of the delimiter depends on the type (l, m, r, nothing). + * For example, the definition of \bigl in LaTeX sources is + * \def\bigl{\mathopen\big} + */ + switch(name_.back()) { + case 'l': + return MC_OPEN; + case 'm': + return MC_REL; + case 'r': + return MC_CLOSE; + default: + return MC_ORD; + } +} + + Inset * InsetMathBig::clone() const { return new InsetMathBig(*this); @@ -49,9 +68,9 @@ InsetMathBig::size_type InsetMathBig::size() const { // order: big Big bigg Bigg biggg Biggg // 0 1 2 3 4 5 - char_type const c = name_[name_.size() - 1]; + char_type const c = name_.back(); int const base_size = (c == 'l' || c == 'm' || c == 'r') ? 4 : 3; - return name_[0] == 'B' ? + return name_.front() == 'B' ? 2 * (name_.size() - base_size) + 1: 2 * (name_.size() - base_size); } diff --git a/src/mathed/InsetMathBig.h b/src/mathed/InsetMathBig.h index 996a30a..83010a9 100644 --- a/src/mathed/InsetMathBig.h +++ b/src/mathed/InsetMathBig.h @@ -24,6 +24,8 @@ public: InsetMathBig(docstring const & name, docstring const & delim); /// docstring name() const; + /// class is different for l(eft), r(ight) and m(iddle) + MathClass mathClass() const; /// void metrics(MetricsInfo & mi, Dimension & dim) const; /// ----------------------------------------------------------------------- Summary of changes: src/mathed/InsetMathBig.cpp | 23 +++++++++++++++++++++-- src/mathed/InsetMathBig.h | 2 ++ src/mathed/InsetMathCancelto.cpp | 2 +- src/mathed/InsetMathNest.cpp | 6 +++--- src/mathed/InsetMathNest.h | 13 ++----------- src/mathed/InsetMathRoot.cpp | 2 +- src/mathed/MathRow.cpp | 2 +- 7 files changed, 31 insertions(+), 19 deletions(-) hooks/post-receive -- Repository for new features