MCPcopy Create free account
hub / github.com/Tablecruncher/tablecruncher / setTheme

Method setTheme

src/csvapplication.cpp:2893–2930  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2891
2892
2893void CsvApplication::setTheme(std::string theme) {
2894 this->theme = theme;
2895 if( !ColorThemes::isTheme(this->theme) ) {
2896 this->theme = "Bright";
2897 }
2898 // Style all openend data windows
2899 for( int slot = 0; slot < TCRUNCHER_MAX_WINDOWS; ++slot) {
2900 windows[slot].applyTheme();
2901 }
2902 // Style Search Window
2903 struct My_Fl_Button::buttonColorStruct colorsDefaultButton;
2904 colorsDefaultButton.background = ColorThemes::getColor(this->theme, "button_bg");
2905 colorsDefaultButton.label = ColorThemes::getColor(this->theme, "button_text");
2906 colorsDefaultButton.border = ColorThemes::getColor(this->theme, "button_border");
2907 colorsDefaultButton.windowBg = ColorThemes::getColor(this->theme, "win_bg");
2908 colorsDefaultButton.borderWidth = ColorThemes::getColor(this->theme, "button_border_width");
2909 struct My_Fl_Button::buttonColorStruct colorsHighlightButton;
2910 colorsHighlightButton.background = ColorThemes::getColor(this->theme, "hightlight_button_bg");
2911 colorsHighlightButton.label = ColorThemes::getColor(this->theme, "hightlight_button_text");
2912 colorsHighlightButton.border = ColorThemes::getColor(this->theme, "hightlight_button_border");
2913 colorsHighlightButton.windowBg = ColorThemes::getColor(this->theme, "win_bg");
2914 colorsHighlightButton.borderWidth = ColorThemes::getColor(this->theme, "highlight_button_border_width");
2915 searchWin->color(ColorThemes::getColor(this->theme, "win_bg"));
2916 searchInput->labelcolor(ColorThemes::getColor(this->theme, "win_text"));
2917 replaceInput->labelcolor(ColorThemes::getColor(this->theme, "win_text"));
2918 findButton->colors = colorsHighlightButton;
2919 replaceButton->colors = colorsDefaultButton;
2920 replaceFindButton->colors = colorsDefaultButton;
2921 replaceAllButton->colors = colorsDefaultButton;
2922 ignoreCase->labelcolor(ColorThemes::getColor(this->theme, "win_text"));
2923 useRegex->labelcolor(ColorThemes::getColor(this->theme, "win_text"));
2924 flagMatchingButton->colors = colorsDefaultButton;
2925 unflagMatchingButton->colors = colorsDefaultButton;
2926 searchWinLabel->labelcolor(ColorThemes::getColor(this->theme, "win_text"));
2927 searchWinScope->labelcolor(ColorThemes::getColor(this->theme, "win_text"));
2928 // Store theme settings
2929 preferences.set(TCRUNCHER_PREF_THEME, this->theme.c_str());
2930}
2931
2932std::string CsvApplication::getTheme() {
2933 return theme;

Callers 2

MyMenuCallbackMethod · 0.80
mainFunction · 0.80

Calls 2

applyThemeMethod · 0.80
setMethod · 0.80

Tested by

no test coverage detected