]> git.lyx.org Git - features.git/commitdiff
Introduce color_selectionmath
authorJuergen Spitzmueller <spitz@lyx.org>
Wed, 4 Oct 2023 11:10:07 +0000 (13:10 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Wed, 4 Oct 2023 11:10:07 +0000 (13:10 +0200)
To have a distinctive color for selected math which works in both modes

Also, link color_selectionmath with QPalette::HighlightedText, so we
won't need to special-case on lyxrc.use_system_colors any longer

src/Color.cpp
src/ColorCode.h
src/frontends/qt/ColorCache.cpp
src/mathed/InsetMathHull.cpp
src/mathed/MathRow.cpp

index 3b9e68ebd1959d78537a838996f7d73d1f0aec69..23e40a9c941e6c4c40d070a7f98279e1fd840664 100644 (file)
@@ -264,6 +264,7 @@ ColorSet::ColorSet()
        { Color_background, N_("background"), "background", Linen, black, "background" },
        { Color_foreground, N_("text"), "foreground", black, Linen, "foreground" },
        { Color_selection, N_("selection"), "selection", "#add8e6", "#add8e6", "selection" },
+       { Color_selectionmath, N_("selected math"), "selectionmath", "#00008B", "#00008B", "selectionmath" },
        { Color_selectiontext, N_("selected text"), "selectiontext", black, black, "selectiontext" },
        { Color_latex, N_("LaTeX text"), "latex", DarkRed, "#D66613", "latex" },
        { Color_textlabel1, N_("Text label 1"), "textlabel1", blue, "#86a4ff", "textlabel1" },
index 3439c287277c6beda78f7922600b5c2567cdf596..9b26e7219ccbc9e826f953379c4c2456b2754a01 100644 (file)
@@ -65,6 +65,8 @@ enum ColorCode {
        Color_foreground,
        /// Background color of selected text
        Color_selection,
+       /// Foreground color of selected math
+       Color_selectionmath,
        /// Foreground color of selected text
        Color_selectiontext,
        /// Text color in LaTeX mode
index 821494edc1b2113755994f1bc34dd456757c425e..1c3d68e548ac0a96fd771e303d7f50b0c8e8ca63 100644 (file)
@@ -45,6 +45,7 @@ QPalette::ColorRole role(ColorCode col)
        case Color_selection:
                return QPalette::Highlight;
                break;
+       case Color_selectionmath:
        case Color_selectiontext:
                return QPalette::HighlightedText;
                break;
index d2c215916722ce6b2bf75a8411cfc3a086b2ed31..1cf3be201dec8fcea983913788f72300f3cae137 100644 (file)
@@ -697,8 +697,7 @@ void InsetMathHull::draw(PainterInfo & pi, int x, int y) const
        }
 
        // Then the equations
-       ColorCode color = pi.selected && lyxrc.use_system_colors
-               ? Color_selectiontext : standardColor();
+       ColorCode color = pi.selected ? Color_selectionmath : standardColor();
        bool const really_change_color = pi.base.font.color() == Color_none;
        Changer dummy0 = really_change_color ? pi.base.font.changeColor(color)
                : noChange();
index fee869c89ace1df2edd394053dc9a1aece432b82..8e46b59047f63e4e8fbce4befa5ee38bcb086826 100644 (file)
@@ -356,8 +356,7 @@ void MathRow::draw(PainterInfo & pi, int x, int const y) const
                        x += e.before + e.after;
                        break;
                case BEGIN_SEL:
-                       if (lyxrc.use_system_colors)
-                               change_color = pi.base.font.changeColor(Color_selectiontext);
+                       change_color = pi.base.font.changeColor(Color_selectionmath);
                        break;
                case END_SEL:
                        change_color = noChange();