summaryrefslogtreecommitdiff
path: root/tools/editor
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2015-10-17 10:46:32 -0300
committerJuan Linietsky <reduzio@gmail.com>2015-10-17 10:46:32 -0300
commitc9ff40e1400c6351c57ec3c5734bc638ee42f3b7 (patch)
treed9a4634fad3b658b63354ad4920e2eb0b341d72d /tools/editor
parent1b5622fb9b4b3c40f6841b60087498741adadbe4 (diff)
parent17fbd2067385aa3bcbfd676192cb57a9735596cf (diff)
Merge pull request #2380 from StraToN/tabs-buttons
Tab close button + display policies + application on Scenes Tabs
Diffstat (limited to 'tools/editor')
-rw-r--r--tools/editor/editor_node.cpp15
-rw-r--r--tools/editor/editor_node.h1
2 files changed, 16 insertions, 0 deletions
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp
index 9137503e1b..54b47be49c 100644
--- a/tools/editor/editor_node.cpp
+++ b/tools/editor/editor_node.cpp
@@ -3931,6 +3931,7 @@ void EditorNode::_bind_methods() {
ObjectTypeDB::bind_method("set_current_scene",&EditorNode::set_current_scene);
ObjectTypeDB::bind_method("set_current_version",&EditorNode::set_current_version);
ObjectTypeDB::bind_method("_scene_tab_changed",&EditorNode::_scene_tab_changed);
+ ObjectTypeDB::bind_method("_scene_tab_closed",&EditorNode::_scene_tab_closed);
ObjectTypeDB::bind_method("_scene_tab_script_edited",&EditorNode::_scene_tab_script_edited);
ObjectTypeDB::bind_method("_set_main_scene_state",&EditorNode::_set_main_scene_state);
ObjectTypeDB::bind_method("_update_scene_tabs",&EditorNode::_update_scene_tabs);
@@ -4385,6 +4386,17 @@ void EditorNode::_scene_tab_script_edited(int p_tab) {
edit_resource(script);
}
+void EditorNode::_scene_tab_closed(int p_tab) {
+ set_current_scene(p_tab);
+ bool p_confirmed = true;
+ if (unsaved_cache)
+ p_confirmed = false;
+
+ _menu_option_confirm(FILE_CLOSE, p_confirmed);
+ _update_scene_tabs();
+}
+
+
void EditorNode::_scene_tab_changed(int p_tab) {
@@ -4552,8 +4564,10 @@ EditorNode::EditorNode() {
scene_tabs=memnew( Tabs );
scene_tabs->add_tab("unsaved");
scene_tabs->set_tab_align(Tabs::ALIGN_CENTER);
+ scene_tabs->set_tab_close_display_policy(Tabs::SHOW_HOVER);
scene_tabs->connect("tab_changed",this,"_scene_tab_changed");
scene_tabs->connect("right_button_pressed",this,"_scene_tab_script_edited");
+ scene_tabs->connect("tab_close", this, "_scene_tab_closed");
top_dark_vb->add_child(scene_tabs);
//left
left_l_hsplit = memnew( HSplitContainer );
@@ -4690,6 +4704,7 @@ EditorNode::EditorNode() {
main_editor_tabs = memnew( Tabs );
main_editor_tabs->connect("tab_changed",this,"_editor_select");
+ main_editor_tabs->set_tab_close_display_policy(Tabs::SHOW_NEVER);
HBoxContainer *srth = memnew( HBoxContainer );
srt->add_child( srth );
Control *tec = memnew( Control );
diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h
index d52e08191d..978e8390dc 100644
--- a/tools/editor/editor_node.h
+++ b/tools/editor/editor_node.h
@@ -501,6 +501,7 @@ class EditorNode : public Node {
void _dock_split_dragged(int ofs);
void _dock_popup_exit();
void _scene_tab_changed(int p_tab);
+ void _scene_tab_closed(int p_tab);
void _scene_tab_script_edited(int p_tab);
Dictionary _get_main_scene_state();