Skip to content

Commit

Permalink
Make main editor window border margin controllable by theme
Browse files Browse the repository at this point in the history
  • Loading branch information
davthedev committed May 30, 2023
1 parent 6101240 commit a8fc343
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 4 additions & 2 deletions editor/editor_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,8 @@ void EditorNode::_notification(int p_what) {
get_window()->set_theme(theme);

gui_base->add_theme_style_override("panel", gui_base->get_theme_stylebox(SNAME("Background"), SNAME("EditorStyles")));
main_vbox->set_anchors_and_offsets_preset(Control::PRESET_FULL_RECT, Control::PRESET_MODE_MINSIZE, gui_base->get_theme_constant(SNAME("window_border_margin"), SNAME("Editor")));
main_vbox->add_theme_constant_override("separation", gui_base->get_theme_constant(SNAME("top_bar_separation"), SNAME("Editor")));
scene_root_parent->add_theme_style_override("panel", gui_base->get_theme_stylebox(SNAME("Content"), SNAME("EditorStyles")));
bottom_panel->add_theme_style_override("panel", gui_base->get_theme_stylebox(SNAME("BottomPanel"), SNAME("EditorStyles")));
tabbar_panel->add_theme_style_override("panel", gui_base->get_theme_stylebox(SNAME("tabbar_background"), SNAME("TabContainer")));
Expand Down Expand Up @@ -7001,8 +7003,8 @@ EditorNode::EditorNode() {

main_vbox = memnew(VBoxContainer);
gui_base->add_child(main_vbox);
main_vbox->set_anchors_and_offsets_preset(Control::PRESET_FULL_RECT, Control::PRESET_MODE_MINSIZE, 8);
main_vbox->add_theme_constant_override("separation", 8 * EDSCALE);
main_vbox->set_anchors_and_offsets_preset(Control::PRESET_FULL_RECT, Control::PRESET_MODE_MINSIZE, gui_base->get_theme_constant(SNAME("window_border_margin"), SNAME("Editor")));
main_vbox->add_theme_constant_override("separation", gui_base->get_theme_constant(SNAME("top_bar_separation"), SNAME("Editor")));

title_bar = memnew(EditorTitleBar);
main_vbox->add_child(title_bar);
Expand Down
2 changes: 2 additions & 0 deletions editor/editor_themes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,8 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_constant("dark_theme", "Editor", dark_theme);
theme->set_constant("color_picker_button_height", "Editor", 28 * EDSCALE);
theme->set_constant("gizmo_handle_scale", "Editor", gizmo_handle_scale);
theme->set_constant("window_border_margin", "Editor", 8);
theme->set_constant("top_bar_separation", "Editor", 8 * EDSCALE);

// Register editor icons.
// If the settings are comparable to the old theme, then just copy them over.
Expand Down

0 comments on commit a8fc343

Please sign in to comment.