diff options
author | volzhs <volzhs@gmail.com> | 2017-04-28 22:42:52 +0900 |
---|---|---|
committer | volzhs <volzhs@gmail.com> | 2017-04-28 22:42:52 +0900 |
commit | 3223305e5a6d3643c554081de336c3464cd99977 (patch) | |
tree | 53236e0fb978642d99b7efaea3609a7763905ab5 | |
parent | 2153feb6fd8cc328191c92b43818624a6fa6c27e (diff) |
Fix to use editor theme instead of handling each UI
-rw-r--r-- | editor/editor_node.cpp | 11 | ||||
-rw-r--r-- | editor/editor_themes.cpp | 9 | ||||
-rw-r--r-- | editor/plugins/script_editor_plugin.cpp | 1 | ||||
-rw-r--r-- | editor/project_settings.cpp | 1 | ||||
-rw-r--r-- | editor/settings_config_dialog.cpp | 1 |
5 files changed, 9 insertions, 14 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index bff22655ff..668c39c5fa 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -4942,13 +4942,11 @@ EditorNode::EditorNode() { //top_dark_vb->add_child(scene_tabs); //left left_l_hsplit = memnew(HSplitContainer); - left_l_hsplit->add_constant_override("separation", 8 * EDSCALE); main_vbox->add_child(left_l_hsplit); left_l_hsplit->set_v_size_flags(Control::SIZE_EXPAND_FILL); left_l_vsplit = memnew(VSplitContainer); - left_l_vsplit->add_constant_override("separation", 8 * EDSCALE); left_l_hsplit->add_child(left_l_vsplit); dock_slot[DOCK_SLOT_LEFT_UL] = memnew(TabContainer); left_l_vsplit->add_child(dock_slot[DOCK_SLOT_LEFT_UL]); @@ -4959,10 +4957,8 @@ EditorNode::EditorNode() { dock_slot[DOCK_SLOT_LEFT_BL]->hide(); left_r_hsplit = memnew(HSplitContainer); - left_r_hsplit->add_constant_override("separation", 8 * EDSCALE); left_l_hsplit->add_child(left_r_hsplit); left_r_vsplit = memnew(VSplitContainer); - left_r_hsplit->add_constant_override("separation", 8 * EDSCALE); left_r_hsplit->add_child(left_r_vsplit); dock_slot[DOCK_SLOT_LEFT_UR] = memnew(TabContainer); left_r_vsplit->add_child(dock_slot[DOCK_SLOT_LEFT_UR]); @@ -4973,7 +4969,6 @@ EditorNode::EditorNode() { //dock_slot[DOCK_SLOT_LEFT_BR]->hide(); main_hsplit = memnew(HSplitContainer); - main_hsplit->add_constant_override("separation", 8 * EDSCALE); left_r_hsplit->add_child(main_hsplit); //main_split->set_v_size_flags(Control::SIZE_EXPAND_FILL); VBoxContainer *center_vb = memnew(VBoxContainer); @@ -4981,18 +4976,15 @@ EditorNode::EditorNode() { center_vb->set_h_size_flags(Control::SIZE_EXPAND_FILL); center_split = memnew(VSplitContainer); - center_split->add_constant_override("separation", 8 * EDSCALE); //main_hsplit->add_child(center_split); center_split->set_v_size_flags(Control::SIZE_EXPAND_FILL); center_split->set_collapsed(false); center_vb->add_child(center_split); right_hsplit = memnew(HSplitContainer); - right_hsplit->add_constant_override("separation", 8 * EDSCALE); main_hsplit->add_child(right_hsplit); right_l_vsplit = memnew(VSplitContainer); - right_l_vsplit->add_constant_override("separation", 8 * EDSCALE); right_hsplit->add_child(right_l_vsplit); dock_slot[DOCK_SLOT_RIGHT_UL] = memnew(TabContainer); right_l_vsplit->add_child(dock_slot[DOCK_SLOT_RIGHT_UL]); @@ -5003,7 +4995,6 @@ EditorNode::EditorNode() { //dock_slot[DOCK_SLOT_RIGHT_BL]->hide(); right_r_vsplit = memnew(VSplitContainer); - right_r_vsplit->add_constant_override("separation", 8 * EDSCALE); right_hsplit->add_child(right_r_vsplit); dock_slot[DOCK_SLOT_RIGHT_UR] = memnew(TabContainer); right_r_vsplit->add_child(dock_slot[DOCK_SLOT_RIGHT_UR]); @@ -5062,7 +5053,6 @@ EditorNode::EditorNode() { dock_slot[i]->set_v_size_flags(Control::SIZE_EXPAND_FILL); dock_slot[i]->set_popup(dock_select_popoup); dock_slot[i]->connect("pre_popup_pressed", this, "_dock_pre_popup", varray(i)); - dock_slot[i]->add_constant_override("side_margin", 0); //dock_slot[i]->set_tab_align(TabContainer::ALIGN_LEFT); } @@ -5073,7 +5063,6 @@ EditorNode::EditorNode() { dock_drag_timer->connect("timeout", this, "_save_docks"); top_split = memnew(VSplitContainer); - top_split->add_constant_override("separation", 8 * EDSCALE); center_split->add_child(top_split); top_split->set_v_size_flags(Control::SIZE_EXPAND_FILL); top_split->set_collapsed(true); diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index dee83c6bc3..1457f6b421 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -69,6 +69,11 @@ Ref<Theme> create_editor_theme() { theme->set_stylebox("bg", "ItemList", style_bg); theme->set_stylebox("EditorBG", "EditorStyles", style_bg); + Ref<StyleBox> style_tree_btn = theme->get_stylebox("button_pressed", "Tree"); + style_tree_btn->set_default_margin(MARGIN_LEFT, 3 * EDSCALE); + style_tree_btn->set_default_margin(MARGIN_RIGHT, 3 * EDSCALE); + theme->set_stylebox("button_pressed", "Tree", style_tree_btn); + Ref<StyleBoxFlat> style_tab(memnew(StyleBoxFlat)); style_tab->set_default_margin(MARGIN_LEFT, 15 * EDSCALE); style_tab->set_default_margin(MARGIN_RIGHT, 15 * EDSCALE); @@ -114,6 +119,10 @@ Ref<Theme> create_editor_theme() { style_textedit_normal->set_default_margin(MARGIN_TOP, 0); theme->set_stylebox("normal", "TextEdit", style_textedit_normal); + theme->set_constant("separation", "HSplitContainer", 8 * EDSCALE); + theme->set_constant("separation", "VSplitContainer", 8 * EDSCALE); + theme->set_constant("side_margin", "TabContainer", 0); + // theme->set_color("prop_category","Editor",Color::hex(0x3f3a44ff)); // theme->set_color("prop_section","Editor",Color::hex(0x35313aff)); // theme->set_color("prop_subsection","Editor",Color::hex(0x312e37ff)); diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index b029f8a3fe..d72998f366 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -2024,7 +2024,6 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { add_child(menu_hb); script_split = memnew(HSplitContainer); - script_split->add_constant_override("separation", 8 * EDSCALE); add_child(script_split); script_split->set_v_size_flags(SIZE_EXPAND_FILL); diff --git a/editor/project_settings.cpp b/editor/project_settings.cpp index 7d9ee91f35..f509130115 100644 --- a/editor/project_settings.cpp +++ b/editor/project_settings.cpp @@ -1175,7 +1175,6 @@ ProjectSettings::ProjectSettings(EditorData *p_data) { data = p_data; tab_container = memnew(TabContainer); - tab_container->add_constant_override("side_margin", 0); add_child(tab_container); //set_child_rect(tab_container); diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp index 70acb8a052..8c87857944 100644 --- a/editor/settings_config_dialog.cpp +++ b/editor/settings_config_dialog.cpp @@ -300,7 +300,6 @@ EditorSettingsDialog::EditorSettingsDialog() { set_resizable(true); tabs = memnew(TabContainer); - tabs->add_constant_override("side_margin", 0); add_child(tabs); //set_child_rect(tabs); |