summaryrefslogtreecommitdiffstats
path: root/scene/theme/default_theme.cpp
diff options
context:
space:
mode:
authorHendrik Brucker <hendrik.brucker@mail.de>2023-08-09 18:31:15 +0200
committerHendrik Brucker <hendrik.brucker@mail.de>2023-09-07 17:29:06 +0200
commit5afe78bd9c7e619ebc2dd2fb43d549d16382b51d (patch)
treecdf9e6e0979a1726fc4fb801fdd1f9591cf48b4f /scene/theme/default_theme.cpp
parent08c578c54c352edf85f750992b2156bae5685fb8 (diff)
downloadredot-engine-5afe78bd9c7e619ebc2dd2fb43d549d16382b51d.tar.gz
Clean up/refactor GraphNode and make it more flexible
Split GraphNode into GraphElement and GraphNode, add custom titlebar, and adjust theming.
Diffstat (limited to 'scene/theme/default_theme.cpp')
-rw-r--r--scene/theme/default_theme.cpp51
1 files changed, 27 insertions, 24 deletions
diff --git a/scene/theme/default_theme.cpp b/scene/theme/default_theme.cpp
index eef46a6798..3597eb3f78 100644
--- a/scene/theme/default_theme.cpp
+++ b/scene/theme/default_theme.cpp
@@ -699,40 +699,43 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_constant("icon_max_width", "PopupMenu", 0);
// GraphNode
- Ref<StyleBoxFlat> graphnode_normal = make_flat_stylebox(style_normal_color, 18, 42, 18, 12);
- graphnode_normal->set_border_width(SIDE_TOP, 30);
+
+ Ref<StyleBoxFlat> graphnode_normal = make_flat_stylebox(style_normal_color, 18, 12, 18, 12);
graphnode_normal->set_border_color(Color(0.325, 0.325, 0.325, 0.6));
Ref<StyleBoxFlat> graphnode_selected = graphnode_normal->duplicate();
graphnode_selected->set_border_color(Color(0.625, 0.625, 0.625, 0.6));
- Ref<StyleBoxFlat> graphnode_comment_normal = make_flat_stylebox(style_pressed_color, 18, 42, 18, 12, 3, true, 2);
- graphnode_comment_normal->set_border_color(style_pressed_color);
- Ref<StyleBoxFlat> graphnode_comment_selected = graphnode_comment_normal->duplicate();
- graphnode_comment_selected->set_border_color(style_hover_color);
- Ref<StyleBoxFlat> graphnode_breakpoint = make_flat_stylebox(style_pressed_color, 18, 42, 18, 12, 6, true, 4);
- graphnode_breakpoint->set_border_color(Color(0.9, 0.29, 0.3));
- Ref<StyleBoxFlat> graphnode_position = make_flat_stylebox(style_pressed_color, 18, 42, 18, 12, 6, true, 4);
- graphnode_position->set_border_color(Color(0.98, 0.89, 0.27));
+
+ Ref<StyleBoxFlat> graphn_sb_titlebar = make_flat_stylebox(style_normal_color.lightened(0.3), 4, 4, 4, 4);
+ Ref<StyleBoxFlat> graphn_sb_titlebar_selected = graphnode_normal->duplicate();
+ graphn_sb_titlebar_selected->set_bg_color(Color(1.0, 0.625, 0.625, 0.6));
Ref<StyleBoxEmpty> graphnode_slot = make_empty_stylebox(0, 0, 0, 0);
- theme->set_stylebox("frame", "GraphNode", graphnode_normal);
- theme->set_stylebox("selected_frame", "GraphNode", graphnode_selected);
- theme->set_stylebox("breakpoint", "GraphNode", graphnode_breakpoint);
- theme->set_stylebox("position", "GraphNode", graphnode_position);
+ theme->set_stylebox("panel", "GraphNode", graphnode_normal);
+ theme->set_stylebox("panel_selected", "GraphNode", graphnode_selected);
+ theme->set_stylebox("titlebar", "GraphNode", graphn_sb_titlebar);
+ theme->set_stylebox("titlebar_selected", "GraphNode", graphn_sb_titlebar_selected);
theme->set_stylebox("slot", "GraphNode", graphnode_slot);
-
theme->set_icon("port", "GraphNode", icons["graph_port"]);
- theme->set_icon("close", "GraphNode", icons["close"]);
theme->set_icon("resizer", "GraphNode", icons["resizer_se"]);
- theme->set_font("title_font", "GraphNode", Ref<Font>());
- theme->set_color("title_color", "GraphNode", control_font_color);
- theme->set_color("close_color", "GraphNode", control_font_color);
theme->set_color("resizer_color", "GraphNode", control_font_color);
theme->set_constant("separation", "GraphNode", Math::round(2 * scale));
- theme->set_constant("title_offset", "GraphNode", Math::round(26 * scale));
- theme->set_constant("title_h_offset", "GraphNode", 0);
- theme->set_constant("close_offset", "GraphNode", Math::round(22 * scale));
- theme->set_constant("close_h_offset", "GraphNode", Math::round(12 * scale));
- theme->set_constant("port_offset", "GraphNode", 0);
+ theme->set_constant("port_h_offset", "GraphNode", 0);
+
+ // GraphNodes's title Label.
+
+ theme->set_type_variation("GraphNodeTitleLabel", "Label");
+
+ theme->set_stylebox("normal", "GraphNodeTitleLabel", make_empty_stylebox(0, 0, 0, 0));
+ theme->set_font("font", "GraphNodeTitleLabel", Ref<Font>());
+ theme->set_font_size("font_size", "GraphNodeTitleLabel", -1);
+ theme->set_color("font_color", "GraphNodeTitleLabel", control_font_color);
+ theme->set_color("font_shadow_color", "GraphNodeTitleLabel", Color(0, 0, 0, 0));
+ theme->set_color("font_outline_color", "GraphNodeTitleLabel", control_font_color);
+ theme->set_constant("shadow_offset_x", "GraphNodeTitleLabel", Math::round(1 * scale));
+ theme->set_constant("shadow_offset_y", "GraphNodeTitleLabel", Math::round(1 * scale));
+ theme->set_constant("outline_size", "GraphNodeTitleLabel", 0);
+ theme->set_constant("shadow_outline_size", "GraphNodeTitleLabel", Math::round(1 * scale));
+ theme->set_constant("line_spacing", "GraphNodeTitleLabel", Math::round(3 * scale));
// Tree