Fixed a lot of HiDPI metrics.

This commit is contained in:
Daniel J. Ramirez 2017-09-18 14:39:37 -05:00
parent 3d06957f12
commit 957e85dcac
6 changed files with 23 additions and 19 deletions

View file

@ -3933,7 +3933,7 @@ AnimationKeyEditor::AnimationKeyEditor() {
key_editor_tab = memnew(TabContainer); key_editor_tab = memnew(TabContainer);
key_editor_tab->set_tab_align(TabContainer::ALIGN_LEFT); key_editor_tab->set_tab_align(TabContainer::ALIGN_LEFT);
hb->add_child(key_editor_tab); 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 = memnew(PropertyEditor);
key_editor->set_area_as_parent_rect(); 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)); 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); track_editor->set_clip_contents(true);
} }

View file

@ -29,6 +29,7 @@
/*************************************************************************/ /*************************************************************************/
#include "editor_profiler.h" #include "editor_profiler.h"
#include "editor_scale.h"
#include "editor_settings.h" #include "editor_settings.h"
#include "os/os.h" #include "os/os.h"
@ -656,14 +657,14 @@ EditorProfiler::EditorProfiler() {
hb->add_child(cursor_metric_edit); hb->add_child(cursor_metric_edit);
cursor_metric_edit->connect("value_changed", this, "_cursor_metric_changed"); 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); h_split = memnew(HSplitContainer);
add_child(h_split); add_child(h_split);
h_split->set_v_size_flags(SIZE_EXPAND_FILL); h_split->set_v_size_flags(SIZE_EXPAND_FILL);
variables = memnew(Tree); 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); variables->set_hide_folding(true);
h_split->add_child(variables); h_split->add_child(variables);
variables->set_hide_root(true); variables->set_hide_root(true);
@ -674,10 +675,10 @@ EditorProfiler::EditorProfiler() {
variables->set_column_min_width(0, 60); variables->set_column_min_width(0, 60);
variables->set_column_title(1, "Time"); variables->set_column_title(1, "Time");
variables->set_column_expand(1, false); 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_title(2, "Calls");
variables->set_column_expand(2, false); 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"); variables->connect("item_edited", this, "_item_edited");
graph = memnew(TextureRect); graph = memnew(TextureRect);
@ -691,8 +692,6 @@ EditorProfiler::EditorProfiler() {
h_split->add_child(graph); h_split->add_child(graph);
graph->set_h_size_flags(SIZE_EXPAND_FILL); 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); int metric_size = CLAMP(int(EDITOR_DEF("debugger/profiler_frame_history_size", 600)), 60, 1024);
frame_metrics.resize(metric_size); frame_metrics.resize(metric_size);
last_metric = -1; last_metric = -1;

View file

@ -604,15 +604,15 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
style_content_panel->set_border_color_all(dark_color_3); style_content_panel->set_border_color_all(dark_color_3);
style_content_panel->set_border_width_all(border_width); style_content_panel->set_border_width_all(border_width);
// compensate the border // compensate the border
style_content_panel->set_default_margin(MARGIN_TOP, 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); style_content_panel->set_default_margin(MARGIN_RIGHT, margin_size_extra * EDSCALE);
style_content_panel->set_default_margin(MARGIN_BOTTOM, margin_size_extra); style_content_panel->set_default_margin(MARGIN_BOTTOM, margin_size_extra * EDSCALE);
style_content_panel->set_default_margin(MARGIN_LEFT, margin_size_extra); style_content_panel->set_default_margin(MARGIN_LEFT, margin_size_extra * EDSCALE);
// this is the stylebox used in 3d and 2d viewports (no borders) // this is the stylebox used in 3d and 2d viewports (no borders)
Ref<StyleBoxFlat> style_content_panel_vp = style_content_panel->duplicate(); Ref<StyleBoxFlat> 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_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_RIGHT, border_width * 2);
style_content_panel_vp->set_default_margin(MARGIN_BOTTOM, border_width * 2); style_content_panel_vp->set_default_margin(MARGIN_BOTTOM, border_width * 2);
theme->set_stylebox("panel", "TabContainer", style_content_panel); theme->set_stylebox("panel", "TabContainer", style_content_panel);
@ -635,6 +635,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
style_debugger_contents->set_default_margin(MARGIN_RIGHT, 0); style_debugger_contents->set_default_margin(MARGIN_RIGHT, 0);
style_debugger_contents->set_border_width_all(0); style_debugger_contents->set_border_width_all(0);
style_debugger_contents->set_expand_margin_size(MARGIN_TOP, -v_offset); 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); theme->set_stylebox("DebuggerPanel", "EditorStyles", style_debugger_contents);
Ref<StyleBoxFlat> style_tab_fg_debugger = style_tab_selected->duplicate(); Ref<StyleBoxFlat> style_tab_fg_debugger = style_tab_selected->duplicate();
style_tab_fg_debugger->set_expand_margin_size(MARGIN_LEFT, default_margin_size * EDSCALE + border_width); style_tab_fg_debugger->set_expand_margin_size(MARGIN_LEFT, default_margin_size * EDSCALE + border_width);
@ -669,6 +670,17 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_constant("separation", "HSplitContainer", default_margin_size * 2 * EDSCALE); theme->set_constant("separation", "HSplitContainer", default_margin_size * 2 * EDSCALE);
theme->set_constant("separation", "VSplitContainer", 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 // WindowDialog
Ref<StyleBoxFlat> style_window = style_popup->duplicate(); Ref<StyleBoxFlat> style_window = style_popup->duplicate();
style_window->set_border_color_all(tab_color); style_window->set_border_color_all(tab_color);

View file

@ -1812,8 +1812,6 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
display_mode = DISPLAY_THUMBNAILS; display_mode = DISPLAY_THUMBNAILS;
path = "res://"; path = "res://";
add_constant_override("separation", 4);
} }
FileSystemDock::~FileSystemDock() { FileSystemDock::~FileSystemDock() {

View file

@ -103,13 +103,11 @@ void AnimationPlayerEditor::_notification(int p_what) {
get_tree()->connect("node_removed", this, "_node_removed"); get_tree()->connect("node_removed", this, "_node_removed");
add_style_override("panel", editor->get_gui_base()->get_stylebox("panel", "Panel")); add_style_override("panel", editor->get_gui_base()->get_stylebox("panel", "Panel"));
add_constant_override("separation", get_constant("separation", "VBoxContainer"));
} break; } break;
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
add_style_override("panel", editor->get_gui_base()->get_stylebox("panel", "Panel")); add_style_override("panel", editor->get_gui_base()->get_stylebox("panel", "Panel"));
add_constant_override("separation", get_constant("separation", "VBoxContainer"));
} break; } break;
case NOTIFICATION_THEME_CHANGED: { case NOTIFICATION_THEME_CHANGED: {

View file

@ -2016,6 +2016,5 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel
clear_inherit_confirm->get_ok()->set_text(TTR("Clear!")); clear_inherit_confirm->get_ok()->set_text(TTR("Clear!"));
add_child(clear_inherit_confirm); add_child(clear_inherit_confirm);
vbc->add_constant_override("separation", 4);
set_process_input(true); set_process_input(true);
} }