Use black as default color for an inset button label text

It turns out that LyX was using red as default color for the
inset button text since ever. However, due to the use of "inherit",
the default button text color was black in practice. This was so
until [897ee2ed/lyxgit], which made the label font not inherited
by default anymore. Hence, all insets that didn't specify a specific
label button color started using red as default color.

This commit restores the previous behavior and introduces the
possibility of modifying this default color.

Fixes bug #12771
This commit is contained in:
Enrico Forestieri 2023-05-09 11:33:13 +02:00
parent 5556cb3d3f
commit ee9fca42bb
5 changed files with 10 additions and 4 deletions

View File

@ -11,7 +11,7 @@
# This script will update a .layout file to current format # This script will update a .layout file to current format
# The latest layout format is also defined in src/TextClass.cpp # The latest layout format is also defined in src/TextClass.cpp
currentFormat = 99 currentFormat = 100
# Incremented to format 4, 6 April 2007, lasgouttes # Incremented to format 4, 6 April 2007, lasgouttes
@ -334,6 +334,9 @@ currentFormat = 99
# Incremented to format 99, 22 December 2022 by tcuvelier # Incremented to format 99, 22 December 2022 by tcuvelier
# Add DocBookGenerateTitle for Layout # Add DocBookGenerateTitle for Layout
# Incremented to format 100, 9 May 2023 by forenr
# Add inset label color
# Do not forget to document format change in Customization # Do not forget to document format change in Customization
# Manual (section "Declaring a new text class"). # Manual (section "Declaring a new text class").
@ -580,7 +583,7 @@ def convert(lines, end_format):
i += 1 i += 1
continue continue
if 87 <= format <= 98: if 87 <= format <= 100:
# nothing to do. # nothing to do.
i += 1 i += 1
continue continue

View File

@ -318,6 +318,7 @@ ColorSet::ColorSet()
{ Color_collapsible, N_("collapsible inset text"), "collapsible", DarkRed, DarkRed, "collapsible" }, { Color_collapsible, N_("collapsible inset text"), "collapsible", DarkRed, DarkRed, "collapsible" },
{ Color_collapsibleframe, N_("collapsible inset frame"), "collapsibleframe", IndianRed, IndianRed, "collapsibleframe" }, { Color_collapsibleframe, N_("collapsible inset frame"), "collapsibleframe", IndianRed, IndianRed, "collapsibleframe" },
{ Color_insetbg, N_("inset background"), "insetbg", grey80, grey80, "insetbg" }, { Color_insetbg, N_("inset background"), "insetbg", grey80, grey80, "insetbg" },
{ Color_insetlabel, N_("inset label"), "insetlabel", black, black, "insetlabel" },
{ Color_insetframe, N_("inset frame"), "insetframe", IndianRed, IndianRed, "insetframe" }, { Color_insetframe, N_("inset frame"), "insetframe", IndianRed, IndianRed, "insetframe" },
{ Color_error, N_("LaTeX error"), "error", red, DarkRed, "error" }, { Color_error, N_("LaTeX error"), "error", red, DarkRed, "error" },
{ Color_eolmarker, N_("end-of-line marker"), "eolmarker", Brown, Brown, "eolmarker" }, { Color_eolmarker, N_("end-of-line marker"), "eolmarker", Brown, Brown, "eolmarker" },

View File

@ -171,6 +171,8 @@ enum ColorCode {
Color_insetbg, Color_insetbg,
/// Inset marker frame color /// Inset marker frame color
Color_insetframe, Color_insetframe,
/// Inset marker label color
Color_insetlabel,
/// Error box text color /// Error box text color
Color_error, Color_error,

View File

@ -59,7 +59,7 @@ namespace lyx {
// You should also run the development/tools/updatelayouts.py script, // You should also run the development/tools/updatelayouts.py script,
// to update the format of all of our layout files. // to update the format of all of our layout files.
// //
int const LAYOUT_FORMAT = 99; // tcuvelier: add docbookgeneratetitle int const LAYOUT_FORMAT = 100; // forenr: add inset label color
// Layout format for the current lyx file format. Controls which format is // Layout format for the current lyx file format. Controls which format is

View File

@ -55,7 +55,7 @@ enum class InsetLaTeXType : int {
class InsetLayout { class InsetLayout {
public: public:
/// ///
InsetLayout() { labelfont_.setColor(Color_error); } InsetLayout() { labelfont_.setColor(Color_insetlabel); }
/// ///
bool read(Lexer & lexrc, TextClass const & tclass, bool read(Lexer & lexrc, TextClass const & tclass,
bool validating = false); bool validating = false);