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
commit a37364620f
5 changed files with 9 additions and 14 deletions

View file

@ -4943,13 +4943,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]);
@ -4960,10 +4958,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]);
@ -4974,7 +4970,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);
@ -4982,18 +4977,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]);
@ -5004,7 +4996,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]);
@ -5063,7 +5054,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);
}
@ -5074,7 +5064,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);

View file

@ -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));

View file

@ -2103,7 +2103,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);

View file

@ -1174,7 +1174,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);

View file

@ -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);