]> git.lyx.org Git - lyx.git/commit
RefChanger
authorGuillaume Munch <gm@lyx.org>
Mon, 23 May 2016 21:30:23 +0000 (22:30 +0100)
committerGuillaume Munch <gm@lyx.org>
Mon, 13 Jun 2016 07:46:15 +0000 (08:46 +0100)
commite2bc7ffae3eb387661064be8b9dc927742f9e7e8
treec7026ed0010535a3b8fc80bc0da735bade59a2bc
parent0be52d37100dce2a5010b2a218fb247f18833ef5
RefChanger

RefChanger temporarily assigns a value to a non-const reference of any
kind. RefChanger provides a flexible and uniform generalisation of the various
scope guards previously derived from the old Changer class in MetricsInfo.h.

As before, a temporary assignment lasts as long as the Changer object lives. But
the new Changer is movable. In particular, contorsions are no longer needed to
change a private field. Special code can be moved into the appropriate classes,
and it is no longer necessary to create a new class for each specific use.

Syntax change:

   FontSetChanger dummy(mi.base, value);
-> Changer dummy = mi.base.changeFontSet(value);

New function for generating arbitrary Changers:

  Changer dummy = make_change(ref, val, condition);

Bugfix:

* Fix the display of \displaystyle{\substack{\frac{xyz}{}}} (missing style
  change).
34 files changed:
src/FontInfo.cpp
src/FontInfo.h
src/MetricsInfo.cpp
src/MetricsInfo.h
src/insets/InsetScript.cpp
src/mathed/InsetMathAMSArray.cpp
src/mathed/InsetMathArray.cpp
src/mathed/InsetMathBoldSymbol.cpp
src/mathed/InsetMathBox.cpp
src/mathed/InsetMathChar.cpp
src/mathed/InsetMathDecoration.cpp
src/mathed/InsetMathEnsureMath.cpp
src/mathed/InsetMathFont.cpp
src/mathed/InsetMathFontOld.cpp
src/mathed/InsetMathFrac.cpp
src/mathed/InsetMathHull.cpp
src/mathed/InsetMathOverset.cpp
src/mathed/InsetMathPar.cpp
src/mathed/InsetMathScript.cpp
src/mathed/InsetMathSideset.cpp
src/mathed/InsetMathSize.cpp
src/mathed/InsetMathSpecialChar.cpp
src/mathed/InsetMathStackrel.cpp
src/mathed/InsetMathSubstack.cpp
src/mathed/InsetMathSymbol.cpp
src/mathed/InsetMathTabular.cpp
src/mathed/InsetMathUnderset.cpp
src/mathed/InsetMathXArrow.cpp
src/mathed/InsetMathXYArrow.cpp
src/mathed/MathMacro.cpp
src/mathed/MathMacroTemplate.cpp
src/support/Changer.h [new file with mode: 0644]
src/support/Makefile.am
src/support/RefChanger.h [new file with mode: 0644]