2014-02-10 01:10:30 +00:00
|
|
|
/**************************************************************************/
|
2024-01-15 12:14:55 +00:00
|
|
|
/* editor_theme_manager.h */
|
2014-02-10 01:10:30 +00:00
|
|
|
/**************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
|
|
|
/* https://godotengine.org */
|
|
|
|
/**************************************************************************/
|
|
|
|
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
|
|
|
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* */
|
|
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
|
|
/* a copy of this software and associated documentation files (the */
|
|
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
|
|
/* the following conditions: */
|
|
|
|
/* */
|
|
|
|
/* The above copyright notice and this permission notice shall be */
|
|
|
|
/* included in all copies or substantial portions of the Software. */
|
|
|
|
/* */
|
|
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
|
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
/**************************************************************************/
|
2018-01-04 23:50:27 +00:00
|
|
|
|
2024-01-15 12:14:55 +00:00
|
|
|
#ifndef EDITOR_THEME_MANAGER_H
|
|
|
|
#define EDITOR_THEME_MANAGER_H
|
2015-04-18 17:38:54 +00:00
|
|
|
|
2024-01-17 14:03:55 +00:00
|
|
|
#include "editor/themes/editor_theme.h"
|
2024-01-15 12:14:55 +00:00
|
|
|
#include "scene/resources/style_box_flat.h"
|
2015-04-18 17:38:54 +00:00
|
|
|
|
2024-01-15 12:14:55 +00:00
|
|
|
class EditorThemeManager {
|
2024-01-17 14:03:55 +00:00
|
|
|
static int benchmark_run;
|
|
|
|
|
|
|
|
static String get_benchmark_key();
|
|
|
|
|
|
|
|
enum ColorMode {
|
|
|
|
AUTO_COLOR,
|
|
|
|
DARK_COLOR,
|
|
|
|
LIGHT_COLOR,
|
|
|
|
};
|
|
|
|
|
2024-01-15 12:14:55 +00:00
|
|
|
struct ThemeConfiguration {
|
|
|
|
// Basic properties.
|
|
|
|
|
|
|
|
String preset;
|
2024-01-15 12:14:55 +00:00
|
|
|
String spacing_preset;
|
2024-01-15 12:14:55 +00:00
|
|
|
|
|
|
|
Color base_color;
|
|
|
|
Color accent_color;
|
|
|
|
float contrast = 1.0;
|
|
|
|
float icon_saturation = 1.0;
|
|
|
|
|
|
|
|
// Extra properties.
|
|
|
|
|
2024-01-15 12:14:55 +00:00
|
|
|
int base_spacing = 4;
|
|
|
|
int extra_spacing = 0;
|
2024-01-15 12:14:55 +00:00
|
|
|
int border_width = 0;
|
|
|
|
int corner_radius = 3;
|
|
|
|
|
|
|
|
bool draw_extra_borders = false;
|
|
|
|
float relationship_line_opacity = 1.0;
|
|
|
|
int thumb_size = 16;
|
|
|
|
int class_icon_size = 16;
|
|
|
|
bool increase_scrollbar_touch_area = false;
|
|
|
|
float gizmo_handle_scale = 1.0;
|
|
|
|
int color_picker_button_height = 28;
|
2024-01-17 14:03:55 +00:00
|
|
|
float subresource_hue_tint = 0.0;
|
2024-01-15 12:14:55 +00:00
|
|
|
|
|
|
|
float default_contrast = 1.0;
|
|
|
|
|
|
|
|
// Generated properties.
|
|
|
|
|
2024-01-17 14:03:55 +00:00
|
|
|
bool dark_theme = false;
|
|
|
|
|
2024-01-15 12:14:55 +00:00
|
|
|
int base_margin = 4;
|
|
|
|
int increased_margin = 4;
|
2024-01-15 12:14:55 +00:00
|
|
|
int separation_margin = 4;
|
2024-01-15 12:14:55 +00:00
|
|
|
int popup_margin = 12;
|
|
|
|
int window_border_margin = 8;
|
|
|
|
int top_bar_separation = 8;
|
|
|
|
int forced_even_separation = 0;
|
|
|
|
|
|
|
|
Color mono_color;
|
|
|
|
Color dark_color_1;
|
|
|
|
Color dark_color_2;
|
|
|
|
Color dark_color_3;
|
|
|
|
Color contrast_color_1;
|
|
|
|
Color contrast_color_2;
|
|
|
|
Color highlight_color;
|
|
|
|
Color highlight_disabled_color;
|
|
|
|
Color success_color;
|
|
|
|
Color warning_color;
|
|
|
|
Color error_color;
|
|
|
|
Color extra_border_color_1;
|
|
|
|
Color extra_border_color_2;
|
|
|
|
|
|
|
|
Color font_color;
|
|
|
|
Color font_focus_color;
|
|
|
|
Color font_hover_color;
|
|
|
|
Color font_pressed_color;
|
|
|
|
Color font_hover_pressed_color;
|
|
|
|
Color font_disabled_color;
|
|
|
|
Color font_readonly_color;
|
|
|
|
Color font_placeholder_color;
|
|
|
|
Color font_outline_color;
|
|
|
|
|
|
|
|
Color icon_normal_color;
|
|
|
|
Color icon_focus_color;
|
|
|
|
Color icon_hover_color;
|
|
|
|
Color icon_pressed_color;
|
|
|
|
Color icon_disabled_color;
|
|
|
|
|
|
|
|
Color shadow_color;
|
|
|
|
Color selection_color;
|
|
|
|
Color disabled_border_color;
|
|
|
|
Color disabled_bg_color;
|
|
|
|
Color separator_color;
|
|
|
|
|
|
|
|
Ref<StyleBoxFlat> base_style;
|
|
|
|
Ref<StyleBoxEmpty> base_empty_style;
|
|
|
|
|
|
|
|
Ref<StyleBoxFlat> button_style;
|
|
|
|
Ref<StyleBoxFlat> button_style_disabled;
|
|
|
|
Ref<StyleBoxFlat> button_style_focus;
|
|
|
|
Ref<StyleBoxFlat> button_style_pressed;
|
|
|
|
Ref<StyleBoxFlat> button_style_hover;
|
|
|
|
|
|
|
|
Ref<StyleBoxFlat> popup_style;
|
|
|
|
Ref<StyleBoxFlat> window_style;
|
|
|
|
Ref<StyleBoxFlat> dialog_style;
|
|
|
|
Ref<StyleBoxFlat> panel_container_style;
|
|
|
|
Ref<StyleBoxFlat> content_panel_style;
|
|
|
|
Ref<StyleBoxFlat> tree_panel_style;
|
|
|
|
|
|
|
|
Vector2 widget_margin;
|
2024-01-17 14:03:55 +00:00
|
|
|
|
|
|
|
uint32_t hash();
|
|
|
|
uint32_t hash_fonts();
|
|
|
|
uint32_t hash_icons();
|
2024-01-15 12:14:55 +00:00
|
|
|
};
|
2015-04-18 17:38:54 +00:00
|
|
|
|
2024-01-17 14:03:55 +00:00
|
|
|
static Ref<EditorTheme> _create_base_theme(const Ref<EditorTheme> &p_old_theme = nullptr);
|
|
|
|
static ThemeConfiguration _create_theme_config(const Ref<EditorTheme> &p_theme);
|
2024-01-15 12:14:55 +00:00
|
|
|
|
2024-01-17 14:03:55 +00:00
|
|
|
static void _create_shared_styles(const Ref<EditorTheme> &p_theme, ThemeConfiguration &p_config);
|
|
|
|
static void _populate_standard_styles(const Ref<EditorTheme> &p_theme, ThemeConfiguration &p_config);
|
|
|
|
static void _populate_editor_styles(const Ref<EditorTheme> &p_theme, ThemeConfiguration &p_config);
|
2024-01-15 12:14:55 +00:00
|
|
|
|
|
|
|
static void _generate_text_editor_defaults(ThemeConfiguration &p_config);
|
2024-01-17 14:03:55 +00:00
|
|
|
static void _populate_text_editor_styles(const Ref<EditorTheme> &p_theme, ThemeConfiguration &p_config);
|
2024-01-15 12:14:55 +00:00
|
|
|
|
|
|
|
public:
|
2024-01-17 14:03:55 +00:00
|
|
|
static Ref<EditorTheme> generate_theme(const Ref<EditorTheme> &p_old_theme = nullptr);
|
2024-01-15 12:14:55 +00:00
|
|
|
static bool is_generated_theme_outdated();
|
|
|
|
|
2024-01-17 14:03:55 +00:00
|
|
|
static bool is_dark_theme();
|
|
|
|
|
2024-01-15 12:14:55 +00:00
|
|
|
static void initialize();
|
|
|
|
static void finalize();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // EDITOR_THEME_MANAGER_H
|