Merge pull request #4926 from Paulb23/fullscreen_and_distraction_free_mode

Added fullscreen and distraction free modes
This commit is contained in:
Rémi Verschelde 2016-06-02 08:38:53 +02:00
commit 182ee80b7d
2 changed files with 96 additions and 22 deletions

View File

@ -192,6 +192,18 @@ void EditorNode::_unhandled_input(const InputEvent& p_event) {
case KEY_F6: _menu_option_confirm(RUN_PLAY_SCENE,true); break;
//case KEY_F7: _menu_option_confirm(RUN_PAUSE,true); break;
case KEY_F8: _menu_option_confirm(RUN_STOP,true); break;
case KEY_F11: {
if (p_event.key.mod.shift) {
if (p_event.key.mod.control) {
set_distraction_free_mode(!get_distraction_free_mode());
} else if (distraction_free_mode) {
distraction_free_mode = false;
_update_top_menu_visibility();
} else {
set_docks_visible(!get_docks_visible());
}
}
} break;
}
}
@ -4522,6 +4534,19 @@ void EditorNode::_update_dock_slots_visibility() {
right_hsplit,
};
if (!docks_visible) {
for(int i=0;i<DOCK_SLOT_MAX;i++) {
dock_slot[i]->hide();
}
for(int i=0;i<DOCK_SLOT_MAX/2;i++) {
splits[i]->hide();
}
right_hsplit->hide();
bottom_panel->hide();
} else {
for(int i=0;i<DOCK_SLOT_MAX;i++) {
if (dock_slot[i]->get_tab_count())
@ -4546,8 +4571,22 @@ void EditorNode::_update_dock_slots_visibility() {
dock_slot[i]->set_current_tab(0);
}
}
bottom_panel->show();
right_hsplit->show();
}
}
void EditorNode::_update_top_menu_visibility() {
if (distraction_free_mode) {
play_cc->hide();
menu_hb->hide();
scene_tabs->hide();
} else {
play_cc->show();
menu_hb->show();
scene_tabs->show();
}
}
void EditorNode::_load_docks_from_config(Ref<ConfigFile> p_layout, const String& p_section) {
@ -4913,6 +4952,31 @@ void EditorNode::_bottom_panel_switch(bool p_enable,int p_idx) {
}
}
void EditorNode::set_docks_visible(bool p_show) {
docks_visible = p_show;
_update_dock_slots_visibility();
}
bool EditorNode::get_docks_visible() const {
return docks_visible;
}
void EditorNode::set_distraction_free_mode(bool p_enter) {
distraction_free_mode = p_enter;
if (p_enter) {
if (docks_visible) {
set_docks_visible(false);
}
} else {
set_docks_visible(true);
}
_update_top_menu_visibility();
}
bool EditorNode::get_distraction_free_mode() const {
return distraction_free_mode;
}
void EditorNode::add_control_to_dock(DockSlot p_slot,Control* p_control) {
ERR_FAIL_INDEX(p_slot,DOCK_SLOT_MAX);
@ -5167,6 +5231,8 @@ EditorNode::EditorNode() {
last_checked_version=0;
changing_scene=false;
_initializing_addons=false;
docks_visible = true;
distraction_free_mode=false;
FileAccess::set_backup_save(true);
@ -5632,7 +5698,7 @@ EditorNode::EditorNode() {
//s1->set_size(Point2(10,15));
CenterContainer *play_cc = memnew( CenterContainer );
play_cc = memnew( CenterContainer );
play_cc->set_ignore_mouse(true);
gui_base->add_child( play_cc );
play_cc->set_area_as_parent_rect();

View File

@ -238,6 +238,7 @@ private:
//HSplitContainer *editor_hsplit;
//VSplitContainer *editor_vsplit;
CenterContainer *play_cc;
HBoxContainer *menu_hb;
Control *viewport;
MenuButton *file_menu;
@ -351,6 +352,8 @@ private:
ToolButton *dock_tab_move_right;
int dock_popup_selected;
Timer *dock_drag_timer;
bool docks_visible;
bool distraction_free_mode;
String _tmp_import_path;
@ -557,7 +560,7 @@ private:
void _save_docks_to_config(Ref<ConfigFile> p_layout, const String& p_section);
void _load_docks_from_config(Ref<ConfigFile> p_layout, const String& p_section);
void _update_dock_slots_visibility();
void _update_top_menu_visibility();
void _update_layouts_menu();
void _layout_menu_option(int p_idx);
@ -594,6 +597,11 @@ public:
void new_inherited_scene() { _menu_option_confirm(FILE_NEW_INHERITED_SCENE,false); }
void set_docks_visible(bool p_show);
bool get_docks_visible() const;
void set_distraction_free_mode(bool p_enter);
bool get_distraction_free_mode() const;
void add_control_to_dock(DockSlot p_slot,Control* p_control);
void remove_control_from_dock(Control* p_control);