1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-30 16:26:50 +00:00

Merge pull request #8569 from volzhs/editor-theme-1

Fix to use editor theme instead of handling each UI
This commit is contained in:
Rémi Verschelde
2017-05-02 11:28:52 +02:00
committed by GitHub
5 changed files with 9 additions and 14 deletions

View File

@@ -4943,13 +4943,11 @@ EditorNode::EditorNode() {
//top_dark_vb->add_child(scene_tabs); //top_dark_vb->add_child(scene_tabs);
//left //left
left_l_hsplit = memnew(HSplitContainer); left_l_hsplit = memnew(HSplitContainer);
left_l_hsplit->add_constant_override("separation", 8 * EDSCALE);
main_vbox->add_child(left_l_hsplit); main_vbox->add_child(left_l_hsplit);
left_l_hsplit->set_v_size_flags(Control::SIZE_EXPAND_FILL); left_l_hsplit->set_v_size_flags(Control::SIZE_EXPAND_FILL);
left_l_vsplit = memnew(VSplitContainer); left_l_vsplit = memnew(VSplitContainer);
left_l_vsplit->add_constant_override("separation", 8 * EDSCALE);
left_l_hsplit->add_child(left_l_vsplit); left_l_hsplit->add_child(left_l_vsplit);
dock_slot[DOCK_SLOT_LEFT_UL] = memnew(TabContainer); dock_slot[DOCK_SLOT_LEFT_UL] = memnew(TabContainer);
left_l_vsplit->add_child(dock_slot[DOCK_SLOT_LEFT_UL]); left_l_vsplit->add_child(dock_slot[DOCK_SLOT_LEFT_UL]);
@@ -4960,10 +4958,8 @@ EditorNode::EditorNode() {
dock_slot[DOCK_SLOT_LEFT_BL]->hide(); dock_slot[DOCK_SLOT_LEFT_BL]->hide();
left_r_hsplit = memnew(HSplitContainer); left_r_hsplit = memnew(HSplitContainer);
left_r_hsplit->add_constant_override("separation", 8 * EDSCALE);
left_l_hsplit->add_child(left_r_hsplit); left_l_hsplit->add_child(left_r_hsplit);
left_r_vsplit = memnew(VSplitContainer); left_r_vsplit = memnew(VSplitContainer);
left_r_hsplit->add_constant_override("separation", 8 * EDSCALE);
left_r_hsplit->add_child(left_r_vsplit); left_r_hsplit->add_child(left_r_vsplit);
dock_slot[DOCK_SLOT_LEFT_UR] = memnew(TabContainer); dock_slot[DOCK_SLOT_LEFT_UR] = memnew(TabContainer);
left_r_vsplit->add_child(dock_slot[DOCK_SLOT_LEFT_UR]); left_r_vsplit->add_child(dock_slot[DOCK_SLOT_LEFT_UR]);
@@ -4974,7 +4970,6 @@ EditorNode::EditorNode() {
//dock_slot[DOCK_SLOT_LEFT_BR]->hide(); //dock_slot[DOCK_SLOT_LEFT_BR]->hide();
main_hsplit = memnew(HSplitContainer); main_hsplit = memnew(HSplitContainer);
main_hsplit->add_constant_override("separation", 8 * EDSCALE);
left_r_hsplit->add_child(main_hsplit); left_r_hsplit->add_child(main_hsplit);
//main_split->set_v_size_flags(Control::SIZE_EXPAND_FILL); //main_split->set_v_size_flags(Control::SIZE_EXPAND_FILL);
VBoxContainer *center_vb = memnew(VBoxContainer); VBoxContainer *center_vb = memnew(VBoxContainer);
@@ -4982,18 +4977,15 @@ EditorNode::EditorNode() {
center_vb->set_h_size_flags(Control::SIZE_EXPAND_FILL); center_vb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
center_split = memnew(VSplitContainer); center_split = memnew(VSplitContainer);
center_split->add_constant_override("separation", 8 * EDSCALE);
//main_hsplit->add_child(center_split); //main_hsplit->add_child(center_split);
center_split->set_v_size_flags(Control::SIZE_EXPAND_FILL); center_split->set_v_size_flags(Control::SIZE_EXPAND_FILL);
center_split->set_collapsed(false); center_split->set_collapsed(false);
center_vb->add_child(center_split); center_vb->add_child(center_split);
right_hsplit = memnew(HSplitContainer); right_hsplit = memnew(HSplitContainer);
right_hsplit->add_constant_override("separation", 8 * EDSCALE);
main_hsplit->add_child(right_hsplit); main_hsplit->add_child(right_hsplit);
right_l_vsplit = memnew(VSplitContainer); right_l_vsplit = memnew(VSplitContainer);
right_l_vsplit->add_constant_override("separation", 8 * EDSCALE);
right_hsplit->add_child(right_l_vsplit); right_hsplit->add_child(right_l_vsplit);
dock_slot[DOCK_SLOT_RIGHT_UL] = memnew(TabContainer); dock_slot[DOCK_SLOT_RIGHT_UL] = memnew(TabContainer);
right_l_vsplit->add_child(dock_slot[DOCK_SLOT_RIGHT_UL]); right_l_vsplit->add_child(dock_slot[DOCK_SLOT_RIGHT_UL]);
@@ -5004,7 +4996,6 @@ EditorNode::EditorNode() {
//dock_slot[DOCK_SLOT_RIGHT_BL]->hide(); //dock_slot[DOCK_SLOT_RIGHT_BL]->hide();
right_r_vsplit = memnew(VSplitContainer); right_r_vsplit = memnew(VSplitContainer);
right_r_vsplit->add_constant_override("separation", 8 * EDSCALE);
right_hsplit->add_child(right_r_vsplit); right_hsplit->add_child(right_r_vsplit);
dock_slot[DOCK_SLOT_RIGHT_UR] = memnew(TabContainer); dock_slot[DOCK_SLOT_RIGHT_UR] = memnew(TabContainer);
right_r_vsplit->add_child(dock_slot[DOCK_SLOT_RIGHT_UR]); right_r_vsplit->add_child(dock_slot[DOCK_SLOT_RIGHT_UR]);
@@ -5063,7 +5054,6 @@ EditorNode::EditorNode() {
dock_slot[i]->set_v_size_flags(Control::SIZE_EXPAND_FILL); dock_slot[i]->set_v_size_flags(Control::SIZE_EXPAND_FILL);
dock_slot[i]->set_popup(dock_select_popoup); dock_slot[i]->set_popup(dock_select_popoup);
dock_slot[i]->connect("pre_popup_pressed", this, "_dock_pre_popup", varray(i)); 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); //dock_slot[i]->set_tab_align(TabContainer::ALIGN_LEFT);
} }
@@ -5074,7 +5064,6 @@ EditorNode::EditorNode() {
dock_drag_timer->connect("timeout", this, "_save_docks"); dock_drag_timer->connect("timeout", this, "_save_docks");
top_split = memnew(VSplitContainer); top_split = memnew(VSplitContainer);
top_split->add_constant_override("separation", 8 * EDSCALE);
center_split->add_child(top_split); center_split->add_child(top_split);
top_split->set_v_size_flags(Control::SIZE_EXPAND_FILL); top_split->set_v_size_flags(Control::SIZE_EXPAND_FILL);
top_split->set_collapsed(true); top_split->set_collapsed(true);

View File

@@ -69,6 +69,11 @@ Ref<Theme> create_editor_theme() {
theme->set_stylebox("bg", "ItemList", style_bg); theme->set_stylebox("bg", "ItemList", style_bg);
theme->set_stylebox("EditorBG", "EditorStyles", 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)); Ref<StyleBoxFlat> style_tab(memnew(StyleBoxFlat));
style_tab->set_default_margin(MARGIN_LEFT, 15 * EDSCALE); style_tab->set_default_margin(MARGIN_LEFT, 15 * EDSCALE);
style_tab->set_default_margin(MARGIN_RIGHT, 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); style_textedit_normal->set_default_margin(MARGIN_TOP, 0);
theme->set_stylebox("normal", "TextEdit", style_textedit_normal); 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_category","Editor",Color::hex(0x3f3a44ff));
// theme->set_color("prop_section","Editor",Color::hex(0x35313aff)); // theme->set_color("prop_section","Editor",Color::hex(0x35313aff));
// theme->set_color("prop_subsection","Editor",Color::hex(0x312e37ff)); // theme->set_color("prop_subsection","Editor",Color::hex(0x312e37ff));

View File

@@ -2103,7 +2103,6 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
add_child(menu_hb); add_child(menu_hb);
script_split = memnew(HSplitContainer); script_split = memnew(HSplitContainer);
script_split->add_constant_override("separation", 8 * EDSCALE);
add_child(script_split); add_child(script_split);
script_split->set_v_size_flags(SIZE_EXPAND_FILL); script_split->set_v_size_flags(SIZE_EXPAND_FILL);

View File

@@ -1174,7 +1174,6 @@ ProjectSettings::ProjectSettings(EditorData *p_data) {
data = p_data; data = p_data;
tab_container = memnew(TabContainer); tab_container = memnew(TabContainer);
tab_container->add_constant_override("side_margin", 0);
add_child(tab_container); add_child(tab_container);
//set_child_rect(tab_container); //set_child_rect(tab_container);

View File

@@ -300,7 +300,6 @@ EditorSettingsDialog::EditorSettingsDialog() {
set_resizable(true); set_resizable(true);
tabs = memnew(TabContainer); tabs = memnew(TabContainer);
tabs->add_constant_override("side_margin", 0);
add_child(tabs); add_child(tabs);
//set_child_rect(tabs); //set_child_rect(tabs);