]> git.lyx.org Git - lyx.git/commitdiff
Rename LM_TC_* to FONT_STYLE_*
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 14 Jun 2019 14:42:02 +0000 (16:42 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 14 Jun 2019 14:42:02 +0000 (16:42 +0200)
This makes code more uniform. This is typically something that is done
at end of cycle to limit backport issues later.

src/FontEnums.h
src/FontInfo.cpp
src/MetricsInfo.cpp
src/frontends/qt4/GuiFontLoader.cpp
src/mathed/InsetMathDiagram.cpp
src/mathed/InsetMathFrac.cpp
src/mathed/InsetMathHull.cpp
src/mathed/InsetMathMacroTemplate.cpp
src/mathed/InsetMathRoot.cpp
src/mathed/InsetMathSymbol.cpp
src/mathed/MathClass.cpp

index dadbb981db39b12846739e0cc03e282e664335e6..0f4000e7e3b17c45afb5fb8f7ab161512aa91c0e 100644 (file)
@@ -146,19 +146,19 @@ enum FontState {
 /// Math styles
 enum MathStyle {
        ///
-       LM_ST_SCRIPTSCRIPT = 0,
+       FONT_STYLE_SCRIPTSCRIPT = 0,
        ///
-       LM_ST_SCRIPT,
+       FONT_STYLE_SCRIPT,
        ///
-       LM_ST_TEXT,
+       FONT_STYLE_TEXT,
        ///
-       LM_ST_DISPLAY,
+       FONT_STYLE_DISPLAY,
        ///
-       LM_ST_INHERIT,
+       FONT_STYLE_INHERIT,
        ///
-       LM_ST_IGNORE,
+       FONT_STYLE_IGNORE,
        /// the text and display fonts are the same
-       NUM_STYLE = LM_ST_DISPLAY
+       NUM_STYLE = FONT_STYLE_DISPLAY
 };
 
 
index d7b3a4f377d3b9f0e59a16b5c03efe17216bbe6f..9adef0c59bba15be2773aa6e3516a51b183f3894 100644 (file)
@@ -88,7 +88,7 @@ FontInfo const sane_font(
        MEDIUM_SERIES,
        UP_SHAPE,
        FONT_SIZE_NORMAL,
-       LM_ST_TEXT,
+       FONT_STYLE_TEXT,
        Color_none,
        Color_background,
        FONT_OFF,
@@ -106,7 +106,7 @@ FontInfo const inherit_font(
        INHERIT_SERIES,
        INHERIT_SHAPE,
        FONT_SIZE_INHERIT,
-       LM_ST_INHERIT,
+       FONT_STYLE_INHERIT,
        Color_inherit,
        Color_inherit,
        FONT_INHERIT,
@@ -124,7 +124,7 @@ FontInfo const ignore_font(
        IGNORE_SERIES,
        IGNORE_SHAPE,
        FONT_SIZE_IGNORE,
-       LM_ST_IGNORE,
+       FONT_STYLE_IGNORE,
        Color_ignore,
        Color_ignore,
        FONT_IGNORE,
@@ -214,15 +214,15 @@ double FontInfo::realSize() const
        // font packages. No attempt is made to implement the actual values from
        // \DefineMathSizes.
        switch (style()) {
-       case LM_ST_DISPLAY:
-       case LM_ST_TEXT:
-       case LM_ST_INHERIT:
-       case LM_ST_IGNORE:
+       case FONT_STYLE_DISPLAY:
+       case FONT_STYLE_TEXT:
+       case FONT_STYLE_INHERIT:
+       case FONT_STYLE_IGNORE:
                break;
-       case LM_ST_SCRIPT:
+       case FONT_STYLE_SCRIPT:
                d *= .73;
                break;
-       case LM_ST_SCRIPTSCRIPT:
+       case FONT_STYLE_SCRIPTSCRIPT:
                d *= .55;
                break;
        }
@@ -243,7 +243,7 @@ void FontInfo::reduce(FontInfo const & tmplt)
        if (size_ == tmplt.size_)
                size_ = FONT_SIZE_INHERIT;
        if (style_ == tmplt.style_)
-               style_ = LM_ST_INHERIT;
+               style_ = FONT_STYLE_INHERIT;
        if (emph_ == tmplt.emph_)
                emph_ = FONT_INHERIT;
        if (underbar_ == tmplt.underbar_)
@@ -287,7 +287,7 @@ FontInfo & FontInfo::realize(FontInfo const & tmplt)
        if (size_ == FONT_SIZE_INHERIT)
                size_ = tmplt.size_;
 
-       if (style_ == LM_ST_INHERIT)
+       if (style_ == FONT_STYLE_INHERIT)
                style_ = tmplt.style_;
 
        if (emph_ == FONT_INHERIT)
@@ -411,7 +411,7 @@ void FontInfo::update(FontInfo const & newfont, bool toggleall)
                        size_ = newfont.size_;
        }
 
-       if (newfont.style_ != LM_ST_IGNORE) {
+       if (newfont.style_ != FONT_STYLE_IGNORE) {
                        style_ = newfont.style_;
        }
 
@@ -441,7 +441,7 @@ bool FontInfo::resolved() const
 {
        return (family_ != INHERIT_FAMILY && series_ != INHERIT_SERIES
                && shape_ != INHERIT_SHAPE && size_ != FONT_SIZE_INHERIT
-               && style_ != LM_ST_INHERIT
+               && style_ != FONT_STYLE_INHERIT
                && emph_ != FONT_INHERIT && underbar_ != FONT_INHERIT
                && uuline_ != FONT_INHERIT && uwave_ != FONT_INHERIT
                && strikeout_ != FONT_INHERIT && xout_ != FONT_INHERIT
index 7eaca10acda9cebd76b57d986c0d939c931b91c0..f35ed6f6db996ff916446f299de6400eba7a0b28 100644 (file)
@@ -107,7 +107,7 @@ int MetricsBase::inPixels(Length const & len) const
                fi.setFamily(SYMBOL_FAMILY);
        else
                // Math style is only taken into account in the case of mu
-               fi.setStyle(LM_ST_TEXT);
+               fi.setStyle(FONT_STYLE_TEXT);
        return len.inPixels(textwidth, theFontMetrics(fi).em());
 }
 
@@ -186,14 +186,14 @@ Color PainterInfo::textColor(Color const & color) const
 Changer MetricsBase::changeScript()
 {
        switch (font.style()) {
-       case LM_ST_DISPLAY:
-       case LM_ST_TEXT:
-               return font.changeStyle(LM_ST_SCRIPT);
-       case LM_ST_SCRIPT:
-       case LM_ST_SCRIPTSCRIPT:
-               return font.changeStyle(LM_ST_SCRIPTSCRIPT);
-       case LM_ST_INHERIT:
-       case LM_ST_IGNORE:
+       case FONT_STYLE_DISPLAY:
+       case FONT_STYLE_TEXT:
+               return font.changeStyle(FONT_STYLE_SCRIPT);
+       case FONT_STYLE_SCRIPT:
+       case FONT_STYLE_SCRIPTSCRIPT:
+               return font.changeStyle(FONT_STYLE_SCRIPTSCRIPT);
+       case FONT_STYLE_INHERIT:
+       case FONT_STYLE_IGNORE:
                return Changer();
        }
        //remove Warning
@@ -204,15 +204,15 @@ Changer MetricsBase::changeScript()
 Changer MetricsBase::changeFrac()
 {
        switch (font.style()) {
-       case LM_ST_DISPLAY:
-               return font.changeStyle(LM_ST_TEXT);
-       case LM_ST_TEXT:
-               return font.changeStyle(LM_ST_SCRIPT);
-       case LM_ST_SCRIPT:
-       case LM_ST_SCRIPTSCRIPT:
-               return font.changeStyle(LM_ST_SCRIPTSCRIPT);
-       case LM_ST_INHERIT:
-       case LM_ST_IGNORE:
+       case FONT_STYLE_DISPLAY:
+               return font.changeStyle(FONT_STYLE_TEXT);
+       case FONT_STYLE_TEXT:
+               return font.changeStyle(FONT_STYLE_SCRIPT);
+       case FONT_STYLE_SCRIPT:
+       case FONT_STYLE_SCRIPTSCRIPT:
+               return font.changeStyle(FONT_STYLE_SCRIPTSCRIPT);
+       case FONT_STYLE_INHERIT:
+       case FONT_STYLE_IGNORE:
                return Changer();
        }
        //remove Warning
@@ -222,7 +222,7 @@ Changer MetricsBase::changeFrac()
 
 Changer MetricsBase::changeArray()
 {
-       return (font.style() == LM_ST_DISPLAY) ? font.changeStyle(LM_ST_TEXT)
+       return (font.style() == FONT_STYLE_DISPLAY) ? font.changeStyle(FONT_STYLE_TEXT)
                : Changer();
 }
 
index 06163390a5fdffa0db69fa78349adeaffae48518..3e2451682c83c88796b7ec71549899e0368cbe5b 100644 (file)
@@ -94,7 +94,7 @@ fontinfo_[NUM_FAMILIES][NUM_SERIES][NUM_SHAPE][NUM_SIZE][NUM_STYLE];
 GuiFontInfo * & fontinfo_ptr(FontInfo const & f)
 {
        // The display font and the text font are the same
-       size_t const style = (f.style() == LM_ST_DISPLAY) ? LM_ST_TEXT : f.style();
+       size_t const style = (f.style() == FONT_STYLE_DISPLAY) ? FONT_STYLE_TEXT : f.style();
        return fontinfo_[f.family()][f.series()][f.realShape()][f.size()][style];
 }
 
index c2019d4be856930273f5d456822a6ca327bfec07..3a9b2efa32b33f174747a3cf894e569300d87336 100644 (file)
@@ -50,7 +50,7 @@ void InsetMathDiagram::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        Changer dummy2 = mi.base.changeEnsureMath();
        FontInfo & f = mi.base.font;
-       Changer dummy = (f.style() == LM_ST_DISPLAY) ? f.changeStyle(LM_ST_TEXT)
+       Changer dummy = (f.style() == FONT_STYLE_DISPLAY) ? f.changeStyle(FONT_STYLE_TEXT)
                : Changer();
        InsetMathGrid::metrics(mi, dim);
 }
@@ -60,7 +60,7 @@ void InsetMathDiagram::draw(PainterInfo & pi, int x, int y) const
 {
        Changer dummy2 = pi.base.changeEnsureMath();
        FontInfo & f = pi.base.font;
-       Changer dummy = (f.style() == LM_ST_DISPLAY) ? f.changeStyle(LM_ST_TEXT)
+       Changer dummy = (f.style() == FONT_STYLE_DISPLAY) ? f.changeStyle(FONT_STYLE_TEXT)
                : Changer();
        InsetMathGrid::draw(pi, x, y);
 }
index 90d61913a678236f8582b2b2fb3cb61da1ee1195..e9f9f6010b030fec69250554c7b40576cb460f35 100644 (file)
@@ -243,12 +243,12 @@ void InsetMathFrac::metrics(MetricsInfo & mi, Dimension & dim) const
                int const dy = axis_height(mi.base);
                Changer dummy =
                        // \tfrac is always in text size
-                       (kind_ == TFRAC) ? mi.base.font.changeStyle(LM_ST_SCRIPT) :
+                       (kind_ == TFRAC) ? mi.base.font.changeStyle(FONT_STYLE_SCRIPT) :
                        // \cfrac and \dfrac are always in display size
                        (kind_ == CFRAC
                         || kind_ == CFRACLEFT
                         || kind_ == CFRACRIGHT
-                        || kind_ == DFRAC) ? mi.base.font.changeStyle(LM_ST_DISPLAY) :
+                        || kind_ == DFRAC) ? mi.base.font.changeStyle(FONT_STYLE_DISPLAY) :
                        // all others
                                              mi.base.changeFrac();
                Changer dummy2 = mi.base.changeEnsureMath();
@@ -325,12 +325,12 @@ void InsetMathFrac::draw(PainterInfo & pi, int x, int y) const
                int const dy = axis_height(pi.base);
                Changer dummy =
                        // \tfrac is always in text size
-                       (kind_ == TFRAC) ? pi.base.font.changeStyle(LM_ST_SCRIPT) :
+                       (kind_ == TFRAC) ? pi.base.font.changeStyle(FONT_STYLE_SCRIPT) :
                        // \cfrac and \dfrac are always in display size
                        (kind_ == CFRAC
                         || kind_ == CFRACLEFT
                         || kind_ == CFRACRIGHT
-                        || kind_ == DFRAC) ? pi.base.font.changeStyle(LM_ST_DISPLAY) :
+                        || kind_ == DFRAC) ? pi.base.font.changeStyle(FONT_STYLE_DISPLAY) :
                        // all others
                                              pi.base.changeFrac();
                Dimension const dim1 = cell(1).dimension(*pi.base.bv);
@@ -649,8 +649,8 @@ void InsetMathBinom::metrics(MetricsInfo & mi, Dimension & dim) const
        Dimension dim0, dim1;
        int const dy = axis_height(mi.base);
        Changer dummy =
-               (kind_ == DBINOM) ? mi.base.font.changeStyle(LM_ST_DISPLAY) :
-               (kind_ == TBINOM) ? mi.base.font.changeStyle(LM_ST_SCRIPT) :
+               (kind_ == DBINOM) ? mi.base.font.changeStyle(FONT_STYLE_DISPLAY) :
+               (kind_ == TBINOM) ? mi.base.font.changeStyle(FONT_STYLE_SCRIPT) :
                                    mi.base.changeFrac();
        cell(0).metrics(mi, dim0);
        cell(1).metrics(mi, dim1);
@@ -676,8 +676,8 @@ void InsetMathBinom::draw(PainterInfo & pi, int x, int y) const
        int m = x + dim.width() / 2;
        {
                Changer dummy =
-                       (kind_ == DBINOM) ? pi.base.font.changeStyle(LM_ST_DISPLAY) :
-                       (kind_ == TBINOM) ? pi.base.font.changeStyle(LM_ST_SCRIPT) :
+                       (kind_ == DBINOM) ? pi.base.font.changeStyle(FONT_STYLE_DISPLAY) :
+                       (kind_ == TBINOM) ? pi.base.font.changeStyle(FONT_STYLE_SCRIPT) :
                                            pi.base.changeFrac();
                // take dy both for the vertical alignment and for the spacing between
                // cells
index 7e65260be4ed1268bc94582820fafecc18b3871c..92574c8d2a0eac7e3b79c91236f7b94f54fd330f 100644 (file)
@@ -549,8 +549,8 @@ void InsetMathHull::metrics(MetricsInfo & mi, Dimension & dim) const
        }
 
        Changer dummy1 = mi.base.changeFontSet(standardFont());
-       Changer dummy2 = mi.base.font.changeStyle(display() ? LM_ST_DISPLAY
-                                                           : LM_ST_TEXT);
+       Changer dummy2 = mi.base.font.changeStyle(display() ? FONT_STYLE_DISPLAY
+                                                           : FONT_STYLE_TEXT);
 
        // let the cells adjust themselves
        InsetMathGrid::metrics(mi, dim);
@@ -653,8 +653,8 @@ void InsetMathHull::draw(PainterInfo & pi, int x, int y) const
        Changer dummy0 = really_change_color ? pi.base.font.changeColor(color)
                : Changer();
        Changer dummy1 = pi.base.changeFontSet(standardFont());
-       Changer dummy2 = pi.base.font.changeStyle(display() ? LM_ST_DISPLAY
-                                                           : LM_ST_TEXT);
+       Changer dummy2 = pi.base.font.changeStyle(display() ? FONT_STYLE_DISPLAY
+                                                           : FONT_STYLE_TEXT);
 
        int xmath = x;
        BufferParams::MathNumber const math_number = buffer().params().getMathNumber();
index 2dc2b98b03a536bf14c02969df0f459877876611..5738799441ae4205f3761b5682b5cb69f08bb069 100644 (file)
@@ -545,7 +545,7 @@ void InsetMathMacroTemplate::createLook(int args) const
 void InsetMathMacroTemplate::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        Changer dummy1 = mi.base.changeFontSet("mathnormal");
-       Changer dummy2 = mi.base.font.changeStyle(LM_ST_TEXT);
+       Changer dummy2 = mi.base.font.changeStyle(FONT_STYLE_TEXT);
 
        // valid macro?
        MacroData const * macro = 0;
@@ -587,7 +587,7 @@ void InsetMathMacroTemplate::draw(PainterInfo & pi, int x, int y) const
        // FIXME: Calling Changer on the same object repeatedly is inefficient.
        Changer dummy0 = pi.base.font.changeColor(Color_math);
        Changer dummy1 = pi.base.changeFontSet("mathnormal");
-       Changer dummy2 = pi.base.font.changeStyle(LM_ST_TEXT);
+       Changer dummy2 = pi.base.font.changeStyle(FONT_STYLE_TEXT);
 
        Dimension const dim = dimension(*pi.base.bv);
 
index e0b7efc90b222df3f32d8145162ab200dcbdc6e0..9509e8280c47b251dbeab6e3ee21120221f28364 100644 (file)
@@ -47,7 +47,7 @@ void mathed_root_metrics(MetricsInfo & mi, MathData const & nucleus,
        Changer dummy = mi.base.changeEnsureMath();
        Dimension dimr;
        if (root) {
-               Changer script = mi.base.font.changeStyle(LM_ST_SCRIPTSCRIPT);
+               Changer script = mi.base.font.changeStyle(FONT_STYLE_SCRIPTSCRIPT);
                // make sure that the dim is high enough for any character
                root->metrics(mi, dimr, false);
        }
@@ -70,7 +70,7 @@ void mathed_root_metrics(MetricsInfo & mi, MathData const & nucleus,
         */
        int const t = mi.base.solidLineThickness();
        int const x_height = mathed_font_x_height(mi.base.font);
-       int const phi = (mi.base.font.style() == LM_ST_DISPLAY) ? x_height : t;
+       int const phi = (mi.base.font.style() == FONT_STYLE_DISPLAY) ? x_height : t;
        // first part is the spacing, second part is the line width
        // itself, and last one is the spacing above.
        int const space_above = (t + phi / 4) + t + t;
@@ -105,7 +105,7 @@ void mathed_draw_root(PainterInfo & pi, int x, int y, MathData const & nucleus,
        int const wl = dim.width() - dimn.width();
        // the "exponent"
        if (root) {
-               Changer script = pi.base.font.changeStyle(LM_ST_SCRIPTSCRIPT);
+               Changer script = pi.base.font.changeStyle(FONT_STYLE_SCRIPTSCRIPT);
                Dimension const dimr = root->dimension(*pi.base.bv);
                int const root_offset = wl - 3 * w / 8 - dimr.width();
                root->draw(pi, x + root_offset, y + (d - a)/2);
index 92d2573560a4ad808141d0d999f7263ac77012ea..d083d4121d26c910e2e9590d86430846b6d143fa 100644 (file)
@@ -72,7 +72,7 @@ void InsetMathSymbol::metrics(MetricsInfo & mi, Dimension & dim) const
        }
        // set scriptable_
        scriptable_ = false;
-       if (mi.base.font.style() == LM_ST_DISPLAY)
+       if (mi.base.font.style() == FONT_STYLE_DISPLAY)
                if (sym_->inset == "cmex" || sym_->inset == "esint" ||
                    sym_->extra == "funclim" ||
                    (sym_->inset == "stmry" && sym_->extra == "mathop"))
index a2aee06193da7b9f2ff7b83343f02aec04d3458f..25053fe840d9314cbea52b9ec086a72c2f215d4d 100644 (file)
@@ -147,14 +147,14 @@ int class_spacing(MathClass const mc1, MathClass const mc2,
        //         << "=" << spc_code << " @" << mb.style << endl;
        if (spc_code < 0) {
                switch (mb.font.style()) {
-               case LM_ST_DISPLAY:
-               case LM_ST_TEXT:
-               case LM_ST_IGNORE:
-               case LM_ST_INHERIT:
+               case FONT_STYLE_DISPLAY:
+               case FONT_STYLE_TEXT:
+               case FONT_STYLE_IGNORE:
+               case FONT_STYLE_INHERIT:
                        spc_code = abs(spc_code);
                        break;
-               case LM_ST_SCRIPT:
-               case LM_ST_SCRIPTSCRIPT:
+               case FONT_STYLE_SCRIPT:
+               case FONT_STYLE_SCRIPTSCRIPT:
                        spc_code = 0;
                }
        }