26#ifndef WXMAXIMA_STYLES_H
27#define WXMAXIMA_STYLES_H
50 const Style &
operator[](
int textStyle)
const {
return active()[textStyle]; }
51 Style *begin() {
return active(); }
53 const Style *begin()
const {
return active(); }
58 bool UsingDark()
const {
return m_useDark; }
70 void Read(wxConfigBase *config);
72 void Write(wxConfigBase *config)
const;
81 static const std::vector<std::pair<TextStyle, wxString>> &
ConfigKeys();
90 : m_codeStyles{TS_CODE_VARIABLE, TS_CODE_FUNCTION, TS_CODE_COMMENT,
91 TS_CODE_NUMBER, TS_CODE_STRING, TS_CODE_OPERATOR,
92 TS_CODE_LISP, TS_CODE_ENDOFLINE, TS_EQUALSSELECTION},
93 m_2dMathStyles{TS_VARIABLE, TS_OPERATOR, TS_NUMBER,
94 TS_FUNCTION, TS_SPECIAL_CONSTANT, TS_GREEK_CONSTANT,
95 TS_STRING, TS_MAIN_PROMPT, TS_OTHER_PROMPT,
96 TS_LABEL, TS_USERLABEL, TS_HIGHLIGHT,
97 TS_WARNING, TS_ERROR, TS_ASCIIMATHS, TS_TEXT},
98 m_colorOnlyStyles{TS_TEXT_BACKGROUND, TS_DOCUMENT_BACKGROUND, TS_CELL_BRACKET,
99 TS_ACTIVE_CELL_BRACKET, TS_CURSOR, TS_SELECTION,
100 TS_EQUALSSELECTION, TS_OUTDATED} {}
109 bool AffectsMathOut(
TextStyle style)
const;
110 bool AffectsColorOnly(
TextStyle style)
const;
115 Style *active() {
return m_useDark ? m_stylesDark : m_styles; }
116 const Style *active()
const {
return m_useDark ? m_stylesDark : m_styles; }
119 void SetLightDefaultsInto(
Style *styles);
126 bool m_useDark =
false;
128 std::vector<TextStyle> m_codeStyles;
130 std::vector<TextStyle> m_2dMathStyles;
132 std::vector<TextStyle> m_colorOnlyStyles;
This file declares everything needed for the text style system used to style all the elements on the ...
TextStyle
All text styles known to wxMaxima.
Definition: TextStyle.h:231
@ NUMBEROFSTYLES
This is not a style, but its value tells us how many styles are defined.
Definition: TextStyle.h:272
Text Style Definition.
Definition: TextStyle.h:63
Storage for the worksheet's per-TextStyle text styles.
Definition: Styles.h:42
static const std::vector< std::pair< TextStyle, wxString > > & ConfigKeys()
The single source of truth mapping each persisted text style to its config-key prefix.
Definition: Styles.cpp:261
void Read(wxConfigBase *config)
Read every persisted style from config.
Definition: Styles.cpp:247
static const wxString & Name(TextStyle textStyle)
The human-readable, translated name of a style (used by the config dialog). Returns an empty string f...
Definition: Styles.cpp:95
const std::vector< TextStyle > & ColorOnlyStylesList() const
The styles where only the color is configurable.
Definition: Styles.h:107
const std::vector< TextStyle > & MathStylesList() const
The styles that share the 2d-math font.
Definition: Styles.h:105
const std::vector< TextStyle > & CodeStylesList() const
The styles that share the code-default font/attributes.
Definition: Styles.h:103
void MakeConsistent()
Propagate the code-default / math fonts to the styles that must share them.
Definition: Styles.cpp:55
void SetDefaults()
Reset every style to wxMaxima's built-in (light) defaults.
Definition: Styles.cpp:144
void Write(wxConfigBase *config) const
Write every persisted style to config.
Definition: Styles.cpp:254
void ClearCaches()
Invalidate the font caches of every style in BOTH sets.
Definition: Styles.cpp:232
Style & operator[](int textStyle)
The style used for a given TextStyle. Indexed like the old raw array, so both TextStyle enumerators a...
Definition: Styles.h:49
void SetDarkDefaults()
Reset every style to wxMaxima's built-in dark-mode defaults (a curated palette for a dark background;...
Definition: Styles.cpp:192
void SetUseDark(bool dark)
Select which set indexing/iteration return.
Definition: Styles.h:57