Fix to use editor theme instead of handling each UI

This commit is contained in:
volzhs 2017-04-28 22:42:52 +09:00
parent 2153feb6fd
commit 3223305e5a
5 changed files with 9 additions and 14 deletions

View file

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

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

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

View file

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

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