From 957e85dcacf4e1f2e62a9376671388fd3e8b7a43 Mon Sep 17 00:00:00 2001 From: "Daniel J. Ramirez" Date: Mon, 18 Sep 2017 14:39:37 -0500 Subject: Fixed a lot of HiDPI metrics. --- editor/animation_editor.cpp | 4 +--- editor/editor_profiler.cpp | 11 +++++------ editor/editor_themes.cpp | 22 +++++++++++++++++----- editor/filesystem_dock.cpp | 2 -- editor/plugins/animation_player_editor_plugin.cpp | 2 -- editor/scene_tree_dock.cpp | 1 - 6 files changed, 23 insertions(+), 19 deletions(-) diff --git a/editor/animation_editor.cpp b/editor/animation_editor.cpp index 40493c1de3..96e5627bef 100644 --- a/editor/animation_editor.cpp +++ b/editor/animation_editor.cpp @@ -3933,7 +3933,7 @@ AnimationKeyEditor::AnimationKeyEditor() { key_editor_tab = memnew(TabContainer); key_editor_tab->set_tab_align(TabContainer::ALIGN_LEFT); hb->add_child(key_editor_tab); - key_editor_tab->set_custom_minimum_size(Size2(200, 0)); + key_editor_tab->set_custom_minimum_size(Size2(200, 0) * EDSCALE); key_editor = memnew(PropertyEditor); key_editor->set_area_as_parent_rect(); @@ -4051,8 +4051,6 @@ AnimationKeyEditor::AnimationKeyEditor() { cleanup_dialog->connect("confirmed", this, "_menu_track", varray(TRACK_MENU_CLEAN_UP_CONFIRM)); - add_constant_override("separation", get_constant("separation", "VBoxContainer")); - track_editor->set_clip_contents(true); } diff --git a/editor/editor_profiler.cpp b/editor/editor_profiler.cpp index 6b972262b9..247775fa1d 100644 --- a/editor/editor_profiler.cpp +++ b/editor/editor_profiler.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "editor_profiler.h" +#include "editor_scale.h" #include "editor_settings.h" #include "os/os.h" @@ -656,14 +657,14 @@ EditorProfiler::EditorProfiler() { hb->add_child(cursor_metric_edit); cursor_metric_edit->connect("value_changed", this, "_cursor_metric_changed"); - hb->add_constant_override("separation", 8); + hb->add_constant_override("separation", 8 * EDSCALE); h_split = memnew(HSplitContainer); add_child(h_split); h_split->set_v_size_flags(SIZE_EXPAND_FILL); variables = memnew(Tree); - variables->set_custom_minimum_size(Size2(300, 0)); + variables->set_custom_minimum_size(Size2(300, 0) * EDSCALE); variables->set_hide_folding(true); h_split->add_child(variables); variables->set_hide_root(true); @@ -674,10 +675,10 @@ EditorProfiler::EditorProfiler() { variables->set_column_min_width(0, 60); variables->set_column_title(1, "Time"); variables->set_column_expand(1, false); - variables->set_column_min_width(1, 60); + variables->set_column_min_width(1, 60 * EDSCALE); variables->set_column_title(2, "Calls"); variables->set_column_expand(2, false); - variables->set_column_min_width(2, 60); + variables->set_column_min_width(2, 60 * EDSCALE); variables->connect("item_edited", this, "_item_edited"); graph = memnew(TextureRect); @@ -691,8 +692,6 @@ EditorProfiler::EditorProfiler() { h_split->add_child(graph); graph->set_h_size_flags(SIZE_EXPAND_FILL); - add_constant_override("separation", 3); - int metric_size = CLAMP(int(EDITOR_DEF("debugger/profiler_frame_history_size", 600)), 60, 1024); frame_metrics.resize(metric_size); last_metric = -1; diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index 3482261c19..4820042c70 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -604,15 +604,15 @@ Ref create_editor_theme(const Ref p_theme) { style_content_panel->set_border_color_all(dark_color_3); style_content_panel->set_border_width_all(border_width); // compensate the border - style_content_panel->set_default_margin(MARGIN_TOP, margin_size_extra); - style_content_panel->set_default_margin(MARGIN_RIGHT, margin_size_extra); - style_content_panel->set_default_margin(MARGIN_BOTTOM, margin_size_extra); - style_content_panel->set_default_margin(MARGIN_LEFT, margin_size_extra); + style_content_panel->set_default_margin(MARGIN_TOP, margin_size_extra * EDSCALE); + style_content_panel->set_default_margin(MARGIN_RIGHT, margin_size_extra * EDSCALE); + style_content_panel->set_default_margin(MARGIN_BOTTOM, margin_size_extra * EDSCALE); + style_content_panel->set_default_margin(MARGIN_LEFT, margin_size_extra * EDSCALE); // this is the stylebox used in 3d and 2d viewports (no borders) Ref style_content_panel_vp = style_content_panel->duplicate(); style_content_panel_vp->set_default_margin(MARGIN_LEFT, border_width * 2); - style_content_panel_vp->set_default_margin(MARGIN_TOP, default_margin_size); + style_content_panel_vp->set_default_margin(MARGIN_TOP, default_margin_size * EDSCALE); style_content_panel_vp->set_default_margin(MARGIN_RIGHT, border_width * 2); style_content_panel_vp->set_default_margin(MARGIN_BOTTOM, border_width * 2); theme->set_stylebox("panel", "TabContainer", style_content_panel); @@ -635,6 +635,7 @@ Ref create_editor_theme(const Ref p_theme) { style_debugger_contents->set_default_margin(MARGIN_RIGHT, 0); style_debugger_contents->set_border_width_all(0); style_debugger_contents->set_expand_margin_size(MARGIN_TOP, -v_offset); + theme->set_constant("extra_margin", "DebuggerPanel", default_margin_size * EDSCALE + border_width); theme->set_stylebox("DebuggerPanel", "EditorStyles", style_debugger_contents); Ref style_tab_fg_debugger = style_tab_selected->duplicate(); style_tab_fg_debugger->set_expand_margin_size(MARGIN_LEFT, default_margin_size * EDSCALE + border_width); @@ -669,6 +670,17 @@ Ref create_editor_theme(const Ref p_theme) { theme->set_constant("separation", "HSplitContainer", default_margin_size * 2 * EDSCALE); theme->set_constant("separation", "VSplitContainer", default_margin_size * 2 * EDSCALE); + // Containers + theme->set_constant("separation", "BoxContainer", default_margin_size * EDSCALE); + theme->set_constant("separation", "HBoxContainer", default_margin_size * EDSCALE); + theme->set_constant("separation", "VBoxContainer", default_margin_size * EDSCALE); + theme->set_constant("margin_left", "MarginContainer", 0); + theme->set_constant("margin_top", "MarginContainer", 0); + theme->set_constant("margin_right", "MarginContainer", 0); + theme->set_constant("margin_bottom", "MarginContainer", 0); + theme->set_constant("hseparation", "GridContainer", default_margin_size * EDSCALE); + theme->set_constant("vseparation", "GridContainer", default_margin_size * EDSCALE); + // WindowDialog Ref style_window = style_popup->duplicate(); style_window->set_border_color_all(tab_color); diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index f0ace864e4..526a8fe810 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -1812,8 +1812,6 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) { display_mode = DISPLAY_THUMBNAILS; path = "res://"; - - add_constant_override("separation", 4); } FileSystemDock::~FileSystemDock() { diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index d7762a66df..c8db1763ab 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -103,13 +103,11 @@ void AnimationPlayerEditor::_notification(int p_what) { get_tree()->connect("node_removed", this, "_node_removed"); add_style_override("panel", editor->get_gui_base()->get_stylebox("panel", "Panel")); - add_constant_override("separation", get_constant("separation", "VBoxContainer")); } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { add_style_override("panel", editor->get_gui_base()->get_stylebox("panel", "Panel")); - add_constant_override("separation", get_constant("separation", "VBoxContainer")); } break; case NOTIFICATION_THEME_CHANGED: { diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 5b783493cb..2fcba7e3c0 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -2016,6 +2016,5 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel clear_inherit_confirm->get_ok()->set_text(TTR("Clear!")); add_child(clear_inherit_confirm); - vbc->add_constant_override("separation", 4); set_process_input(true); } -- cgit v1.2.3