From 06256cd7782de2d91cd9ed3bcb9a05e293397303 Mon Sep 17 00:00:00 2001 From: Gilles Roudiere Date: Sat, 19 Aug 2017 19:10:00 +0200 Subject: Some control fixes and removed useless lines --- editor/plugins/cube_grid_theme_editor_plugin.cpp | 1 - editor/plugins/sample_editor_plugin.cpp | 4 ++-- editor/plugins/tile_set_editor_plugin.cpp | 1 - editor/project_manager.cpp | 3 +-- editor/property_editor.cpp | 6 ++---- modules/gridmap/grid_map_editor_plugin.cpp | 2 +- modules/visual_script/visual_script_editor.cpp | 1 - scene/gui/popup.cpp | 7 ++++--- 8 files changed, 10 insertions(+), 15 deletions(-) diff --git a/editor/plugins/cube_grid_theme_editor_plugin.cpp b/editor/plugins/cube_grid_theme_editor_plugin.cpp index b26b2aec4f..1fcd514b31 100644 --- a/editor/plugins/cube_grid_theme_editor_plugin.cpp +++ b/editor/plugins/cube_grid_theme_editor_plugin.cpp @@ -368,7 +368,6 @@ MeshLibraryEditorPlugin::MeshLibraryEditorPlugin(EditorNode *p_node) { p_node->get_viewport()->add_child(theme_editor); theme_editor->set_area_as_parent_rect(); - theme_editor->set_anchor(MARGIN_RIGHT, Control::ANCHOR_END); theme_editor->set_anchor(MARGIN_BOTTOM, Control::ANCHOR_BEGIN); theme_editor->set_end(Point2(0, 22)); theme_editor->hide(); diff --git a/editor/plugins/sample_editor_plugin.cpp b/editor/plugins/sample_editor_plugin.cpp index 1d6417e2d5..2dd6de1683 100644 --- a/editor/plugins/sample_editor_plugin.cpp +++ b/editor/plugins/sample_editor_plugin.cpp @@ -374,8 +374,8 @@ SampleEditor::SampleEditor() { sample_texframe->add_child(info_label); info_label->set_area_as_parent_rect(); info_label->set_anchor_and_margin(MARGIN_TOP,ANCHOR_END,-15); - info_label->set_margin(MARGIN_BOTTOM,4); - info_label->set_margin(MARGIN_RIGHT,4); + info_label->set_margin(MARGIN_BOTTOM,-4); + info_label->set_margin(MARGIN_RIGHT,-4); info_label->set_align(Label::ALIGN_RIGHT); diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index bed4727bb9..8396b4d412 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -294,7 +294,6 @@ TileSetEditorPlugin::TileSetEditorPlugin(EditorNode *p_node) { p_node->get_viewport()->add_child(tileset_editor); tileset_editor->set_area_as_parent_rect(); - tileset_editor->set_anchor(MARGIN_RIGHT, Control::ANCHOR_END); tileset_editor->set_anchor(MARGIN_BOTTOM, Control::ANCHOR_BEGIN); tileset_editor->set_end(Point2(0, 22)); tileset_editor->hide(); diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index dc0c888eea..1ea8440508 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -969,7 +969,6 @@ void ProjectManager::_run_project_confirm() { return; } - const String &selected = E->key(); String path = EditorSettings::get_singleton()->get("projects/" + selected); @@ -1220,7 +1219,7 @@ ProjectManager::ProjectManager() { panel->add_child(vb); vb->set_area_as_parent_rect(20 * EDSCALE); vb->set_margin(MARGIN_TOP, 4 * EDSCALE); - vb->set_margin(MARGIN_BOTTOM, 4 * EDSCALE); + vb->set_margin(MARGIN_BOTTOM, -4 * EDSCALE); vb->add_constant_override("separation", 15 * EDSCALE); String cp; diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp index 2f47d3e130..90af4f1de1 100644 --- a/editor/property_editor.cpp +++ b/editor/property_editor.cpp @@ -1938,10 +1938,8 @@ CustomPropertyEditor::CustomPropertyEditor() { text_edit = memnew(TextEdit); add_child(text_edit); - text_edit->set_area_as_parent_rect(); - for (int i = 0; i < 4; i++) - text_edit->set_margin((Margin)i, 5); - text_edit->set_margin(MARGIN_BOTTOM, 30); + text_edit->set_area_as_parent_rect(5); + text_edit->set_margin(MARGIN_BOTTOM, -30); text_edit->hide(); text_edit->connect("text_changed", this, "_text_edit_changed"); diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp index 38f58799df..7bb80c2510 100644 --- a/modules/gridmap/grid_map_editor_plugin.cpp +++ b/modules/gridmap/grid_map_editor_plugin.cpp @@ -1203,7 +1203,7 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) { edit_mode = memnew(OptionButton); edit_mode->set_area_as_parent_rect(); edit_mode->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_BEGIN, 24); - edit_mode->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -14); + edit_mode->set_margin(MARGIN_RIGHT, -14); edit_mode->add_item("Tiles"); edit_mode->add_item("Areas"); hb->add_child(edit_mode); diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index 0f6b47c56d..75175b217a 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -3268,7 +3268,6 @@ VisualScriptEditor::VisualScriptEditor() { select_func_text->set_valign(Label::VALIGN_CENTER); select_func_text->set_h_size_flags(SIZE_EXPAND_FILL); add_child(select_func_text); - graph->set_area_as_parent_rect(); hint_text = memnew(Label); hint_text->set_anchor_and_margin(MARGIN_TOP, ANCHOR_END, -100); diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp index f2ba6bfbc4..b21139f969 100644 --- a/scene/gui/popup.cpp +++ b/scene/gui/popup.cpp @@ -276,9 +276,10 @@ void PopupPanel::set_child_rect(Control *p_child) { Ref p = get_stylebox("panel"); p_child->set_area_as_parent_rect(); - for (int i = 0; i < 4; i++) { - p_child->set_margin(Margin(i), p->get_margin(Margin(i))); - } + p_child->set_margin(MARGIN_LEFT, p->get_margin(MARGIN_LEFT)); + p_child->set_margin(MARGIN_RIGHT, -p->get_margin(MARGIN_RIGHT)); + p_child->set_margin(MARGIN_TOP, p->get_margin(MARGIN_TOP)); + p_child->set_margin(MARGIN_BOTTOM, -p->get_margin(MARGIN_BOTTOM)); } void PopupPanel::_notification(int p_what) { -- cgit v1.2.3