Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
a1d07fd6
Commit
a1d07fd6
authored
Jan 02, 2017
by
Wilhem Barbier
Committed by
Rémi Verschelde
Jan 15, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow closing a script tab without saving
parent
07f65184
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
3 deletions
+15
-3
script_editor_plugin.cpp
tools/editor/plugins/script_editor_plugin.cpp
+13
-2
script_editor_plugin.h
tools/editor/plugins/script_editor_plugin.h
+2
-1
No files found.
tools/editor/plugins/script_editor_plugin.cpp
View file @
a1d07fd6
...
...
@@ -445,7 +445,7 @@ void ScriptEditor::_go_to_tab(int p_idx) {
_update_selected_editor_menu
();
}
void
ScriptEditor
::
_close_tab
(
int
p_idx
)
{
void
ScriptEditor
::
_close_tab
(
int
p_idx
,
bool
p_save
)
{
int
selected
=
p_idx
;
if
(
selected
<
0
||
selected
>=
tab_container
->
get_child_count
())
...
...
@@ -454,7 +454,9 @@ void ScriptEditor::_close_tab(int p_idx) {
Node
*
tselected
=
tab_container
->
get_child
(
selected
);
ScriptEditorBase
*
current
=
tab_container
->
get_child
(
selected
)
->
cast_to
<
ScriptEditorBase
>
();
if
(
current
)
{
if
(
p_save
)
{
apply_scripts
();
}
if
(
current
->
get_edit_menu
())
{
memdelete
(
current
->
get_edit_menu
());
}
...
...
@@ -504,6 +506,11 @@ void ScriptEditor::_close_current_tab() {
}
void
ScriptEditor
::
_close_discard_current_tab
(
const
String
&
p_str
)
{
_close_tab
(
tab_container
->
get_current_tab
(),
false
);
erase_tab_confirm
->
hide
();
}
void
ScriptEditor
::
_close_docs_tab
()
{
int
child_count
=
tab_container
->
get_child_count
();
...
...
@@ -2033,6 +2040,7 @@ void ScriptEditor::_bind_methods() {
ClassDB
::
bind_method
(
"_tab_changed"
,
&
ScriptEditor
::
_tab_changed
);
ClassDB
::
bind_method
(
"_menu_option"
,
&
ScriptEditor
::
_menu_option
);
ClassDB
::
bind_method
(
"_close_current_tab"
,
&
ScriptEditor
::
_close_current_tab
);
ClassDB
::
bind_method
(
"_close_discard_current_tab"
,
&
ScriptEditor
::
_close_discard_current_tab
);
ClassDB
::
bind_method
(
"_close_docs_tab"
,
&
ScriptEditor
::
_close_docs_tab
);
ClassDB
::
bind_method
(
"_close_all_tabs"
,
&
ScriptEditor
::
_close_all_tabs
);
ClassDB
::
bind_method
(
"_editor_play"
,
&
ScriptEditor
::
_editor_play
);
...
...
@@ -2225,8 +2233,11 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
tab_container
->
connect
(
"tab_changed"
,
this
,
"_tab_changed"
);
erase_tab_confirm
=
memnew
(
ConfirmationDialog
);
add_child
(
erase_tab_confirm
);
erase_tab_confirm
->
get_ok
()
->
set_text
(
TTR
(
"Save"
));
erase_tab_confirm
->
add_button
(
TTR
(
"Discard"
),
OS
::
get_singleton
()
->
get_swap_ok_cancel
(),
"discard"
);
erase_tab_confirm
->
connect
(
"confirmed"
,
this
,
"_close_current_tab"
);
erase_tab_confirm
->
connect
(
"custom_action"
,
this
,
"_close_discard_current_tab"
);
add_child
(
erase_tab_confirm
);
script_create_dialog
=
memnew
(
ScriptCreateDialog
);
script_create_dialog
->
set_title
(
TTR
(
"Create Script"
));
...
...
tools/editor/plugins/script_editor_plugin.h
View file @
a1d07fd6
...
...
@@ -219,9 +219,10 @@ class ScriptEditor : public VBoxContainer {
bool
_test_script_times_on_disk
(
Ref
<
Script
>
p_for_script
=
Ref
<
Script
>
());
void
_close_tab
(
int
p_idx
);
void
_close_tab
(
int
p_idx
,
bool
p_save
=
true
);
void
_close_current_tab
();
void
_close_discard_current_tab
(
const
String
&
p_str
);
void
_close_docs_tab
();
void
_close_all_tabs
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment