]> git.lyx.org Git - features.git/commit
Re-implement math markers logic.
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 6 Jan 2017 08:52:10 +0000 (09:52 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 11 Jan 2017 16:35:34 +0000 (17:35 +0100)
commit89662a6852ca8f68caa557808d7b7e1d669344d4
tree5c124218554e455022e7fc5dc2f4dde33e67fa2a
parent605438f26df9e25277e1c3799e6022f3ff18d466
Re-implement math markers logic.

The goal of this patch is to be able to properly remove the space
needed for markers in the case of insets that are inside macros and do
not need these markers. This was attempted at 9a9a6a8, but did not
work reliably.

To this end, the following simplifications are made:

* instead of drawing its own markers, each inset has a virtual method
  marker() which prescribes either NO_MARKER, MARKER (normal bottom
  marker) or MARKER2 (top and bottom marker). All explicit calls to
  (draw|metrics)Markers(|2) are removed.

* the space necessary for the markers is now counted in the
  before/above margins in the row structure. Therefore painting will
  not happen at (x + 1, y), but just (x,y).

* the methods drawDecoration are removed.

* the helper methods InsetMath::(draw|metrics)Markers(|2) are removed
  and replaced by a new function drawMarkers in MathRow.cpp.

Now the marker type is kept in the MathRow::Element object (and set to
NO_MARKER in not editable context) and the marker is accounted for in
MathRow::(metrics|draw).

Moreover, the extra pixel for the marker is taken on the before/After
space if possible. The marker will only require extra space when
before/after is 0.

See comment 168 of #8883 to understand what issues are fixed.
39 files changed:
src/insets/Inset.h
src/mathed/InsetMath.cpp
src/mathed/InsetMath.h
src/mathed/InsetMathBoldSymbol.cpp
src/mathed/InsetMathBox.cpp
src/mathed/InsetMathBox.h
src/mathed/InsetMathBrace.cpp
src/mathed/InsetMathCancel.cpp
src/mathed/InsetMathCancelto.cpp
src/mathed/InsetMathClass.cpp
src/mathed/InsetMathColor.cpp
src/mathed/InsetMathComment.cpp
src/mathed/InsetMathDecoration.cpp
src/mathed/InsetMathEnsureMath.cpp
src/mathed/InsetMathEnv.cpp
src/mathed/InsetMathFont.cpp
src/mathed/InsetMathFontOld.cpp
src/mathed/InsetMathFrac.cpp
src/mathed/InsetMathFrac.h
src/mathed/InsetMathGrid.cpp
src/mathed/InsetMathGrid.h
src/mathed/InsetMathHull.cpp
src/mathed/InsetMathLefteqn.cpp
src/mathed/InsetMathNest.h
src/mathed/InsetMathOverset.cpp
src/mathed/InsetMathPhantom.cpp
src/mathed/InsetMathRoot.cpp
src/mathed/InsetMathScript.cpp
src/mathed/InsetMathSideset.cpp
src/mathed/InsetMathSize.cpp
src/mathed/InsetMathSqrt.cpp
src/mathed/InsetMathStackrel.cpp
src/mathed/InsetMathUnderset.cpp
src/mathed/InsetMathXArrow.cpp
src/mathed/MathMacro.cpp
src/mathed/MathMacro.h
src/mathed/MathMacroTemplate.cpp
src/mathed/MathRow.cpp
src/mathed/MathRow.h