summaryrefslogtreecommitdiff
path: root/tools/editor
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2016-06-02 08:38:53 +0200
committerRémi Verschelde <remi@verschelde.fr>2016-06-02 08:38:53 +0200
commit182ee80b7d0e187053150add897931363e5caab4 (patch)
treea630b363f224326c2a6f93fff3ce3fdc558075e8 /tools/editor
parente57bca90ab9e5c7ab983d2db62b033dd2f00f653 (diff)
parent771b22571859df758609c2391e113e6fb894fa58 (diff)
Merge pull request #4926 from Paulb23/fullscreen_and_distraction_free_mode
Added fullscreen and distraction free modes
Diffstat (limited to 'tools/editor')
-rw-r--r--tools/editor/editor_node.cpp98
-rw-r--r--tools/editor/editor_node.h10
2 files changed, 91 insertions, 17 deletions
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp
index a0251936bd..98cc198d94 100644
--- a/tools/editor/editor_node.cpp
+++ b/tools/editor/editor_node.cpp
@@ -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,32 +4534,59 @@ void EditorNode::_update_dock_slots_visibility() {
right_hsplit,
};
- for(int i=0;i<DOCK_SLOT_MAX;i++) {
+ if (!docks_visible) {
- if (dock_slot[i]->get_tab_count())
- dock_slot[i]->show();
- else
+ 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++) {
- for(int i=0;i<DOCK_SLOT_MAX/2;i++) {
- bool in_use = dock_slot[i*2+0]->get_tab_count() || dock_slot[i*2+1]->get_tab_count();
- if (in_use)
- splits[i]->show();
- else
- splits[i]->hide();
- }
+ if (dock_slot[i]->get_tab_count())
+ dock_slot[i]->show();
+ else
+ dock_slot[i]->hide();
- for(int i=0;i<DOCK_SLOT_MAX;i++) {
+ }
- if (!dock_slot[i]->is_hidden() && dock_slot[i]->get_tab_count()) {
- dock_slot[i]->set_current_tab(0);
+
+ for(int i=0;i<DOCK_SLOT_MAX/2;i++) {
+ bool in_use = dock_slot[i*2+0]->get_tab_count() || dock_slot[i*2+1]->get_tab_count();
+ if (in_use)
+ splits[i]->show();
+ else
+ splits[i]->hide();
+ }
+
+ for(int i=0;i<DOCK_SLOT_MAX;i++) {
+
+ if (!dock_slot[i]->is_hidden() && dock_slot[i]->get_tab_count()) {
+ 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();
diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h
index 5ffd7b964a..9ad5a08525 100644
--- a/tools/editor/editor_node.h
+++ b/tools/editor/editor_node.h
@@ -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);