Fix TabBar corner radius and generalize Debugger hack

This commit is contained in:
Logan Detrick
2025-06-11 01:50:23 -07:00
parent 09ed9d4a93
commit 78045df591
4 changed files with 11 additions and 30 deletions

View File

@@ -1141,7 +1141,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
Ref<StyleBoxFlat> style_tab_focus = p_config.button_style_focus->duplicate();
Ref<StyleBoxFlat> style_tabbar_background = make_flat_stylebox(p_config.dark_color_1, 0, 0, 0, 0, p_config.corner_radius * EDSCALE);
Ref<StyleBoxFlat> style_tabbar_background = make_flat_stylebox(p_config.dark_color_1, 0, 0, 0, 0, p_config.corner_radius);
style_tabbar_background->set_corner_radius(CORNER_BOTTOM_LEFT, 0);
style_tabbar_background->set_corner_radius(CORNER_BOTTOM_RIGHT, 0);
p_theme->set_stylebox("tabbar_background", "TabContainer", style_tabbar_background);
@@ -2525,18 +2525,6 @@ void EditorThemeManager::_populate_editor_styles(const Ref<EditorTheme> &p_theme
Ref<StyleBoxFlat> debugger_panel_style = p_config.content_panel_style->duplicate();
debugger_panel_style->set_border_width(SIDE_BOTTOM, 0);
p_theme->set_stylebox("DebuggerPanel", EditorStringName(EditorStyles), debugger_panel_style);
// This pattern of get_font()->get_height(get_font_size()) is used quite a lot and is very verbose.
// FIXME: Introduce Theme::get_font_height() / Control::get_theme_font_height() / Window::get_theme_font_height().
const int offset_i1 = p_theme->get_font(SNAME("tab_selected"), SNAME("TabContainer"))->get_height(p_theme->get_font_size(SNAME("tab_selected"), SNAME("TabContainer")));
const int offset_i2 = p_theme->get_stylebox(SNAME("tab_selected"), SNAME("TabContainer"))->get_minimum_size().height;
const int offset_i3 = p_theme->get_stylebox(SceneStringName(panel), SNAME("TabContainer"))->get_content_margin(SIDE_TOP);
const int invisible_top_offset = offset_i1 + offset_i2 + offset_i3;
Ref<StyleBoxFlat> invisible_top_panel_style = p_config.content_panel_style->duplicate();
invisible_top_panel_style->set_expand_margin(SIDE_TOP, -invisible_top_offset);
invisible_top_panel_style->set_content_margin(SIDE_TOP, 0);
p_theme->set_stylebox("BottomPanelDebuggerOverride", EditorStringName(EditorStyles), invisible_top_panel_style);
}
// Resource and node editors.