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,
110 bool AffectsMathOut(
TextStyle style)
const;
111 bool AffectsColorOnly(
TextStyle style)
const;
119 Style *active() {
return m_useDark ? m_stylesDark : m_styles; }
120 const Style *active()
const {
return m_useDark ? m_stylesDark : m_styles; }
123 void SetLightDefaultsInto(
Style *styles);
130 bool m_useDark =
false;
132 std::vector<TextStyle> m_codeStyles;
134 std::vector<TextStyle> m_2dMathStyles;
136 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:230
@ TS_ERROR_SPOT
Background of the place a syntax error was found at (GH #289)
Definition: TextStyle.h:275
@ NUMBEROFSTYLES
This is not a style, but its value tells us how many styles are defined.
Definition: TextStyle.h:276
@ TS_ERROR_STATEMENT
Background of a statement Maxima reported an error for (GH #289)
Definition: TextStyle.h:274
@ TS_LINK
Links in text cells (GH #2396)
Definition: TextStyle.h:272
@ TS_DIFF_CHANGED
Background of text the diff viewer's counterpart cell lacks.
Definition: TextStyle.h:271
@ TS_IMAGE_BACKDROP
Drawn behind transparent images (GH #2227)
Definition: TextStyle.h:273
Text Style Definition.
Definition: TextStyle.h:67
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:353
void Read(wxConfigBase *config)
Read every persisted style from config.
Definition: Styles.cpp:339
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:157
const std::vector< TextStyle > & ColorOnlyStylesList() const
The styles where only the color is configurable.
Definition: Styles.h:108
const std::vector< TextStyle > & MathStylesList() const
The styles that share the 2d-math font.
Definition: Styles.h:106
const std::vector< TextStyle > & CodeStylesList() const
The styles that share the code-default font/attributes.
Definition: Styles.h:104
void MakeConsistent()
Propagate the code-default / math fonts to the styles that must share them, in the light and in the d...
Definition: Styles.cpp:150
void SetDefaults()
Reset every style to wxMaxima's built-in (light) defaults.
Definition: Styles.cpp:211
void Write(wxConfigBase *config) const
Write every persisted style to config.
Definition: Styles.cpp:346
void ClearCaches()
Invalidate the font caches of every style in BOTH sets.
Definition: Styles.cpp:324
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:274
void SetUseDark(bool dark)
Select which set indexing/iteration return.
Definition: Styles.h:57