summaryrefslogtreecommitdiff
path: root/editor/code_editor.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-12-17 07:58:21 +0100
committerGitHub <noreply@github.com>2019-12-17 07:58:21 +0100
commit01a62232264eae3beea6fd6afceae8a45328985f (patch)
tree080ab671472ad74e5f2f735af45ae8cec2e840e8 /editor/code_editor.cpp
parent8fdbfe0aa8479fe08cabfd627c33f0141561acf5 (diff)
parentdc0199989d01d6f6eb260f13a1e1305e93f36c35 (diff)
Merge pull request #34364 from Chaosus/toggle_scripts_panel
Moves switch for show scripts panel from File menu to status bar
Diffstat (limited to 'editor/code_editor.cpp')
-rw-r--r--editor/code_editor.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index db44edcfcb..11d5e1e786 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -1508,6 +1508,10 @@ void CodeTextEditor::_set_show_warnings_panel(bool p_show) {
emit_signal("show_warnings_panel", p_show);
}
+void CodeTextEditor::_toggle_scripts_pressed() {
+ toggle_scripts_button->set_icon(ScriptEditor::get_singleton()->toggle_scripts_panel() ? get_icon("Back", "EditorIcons") : get_icon("Forward", "EditorIcons"));
+}
+
void CodeTextEditor::_error_pressed(const Ref<InputEvent> &p_event) {
Ref<InputEventMouseButton> mb = p_event;
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
@@ -1523,6 +1527,7 @@ void CodeTextEditor::_notification(int p_what) {
emit_signal("load_theme_settings");
} break;
case NOTIFICATION_THEME_CHANGED: {
+ toggle_scripts_button->set_icon(ScriptEditor::get_singleton()->is_scripts_panel_toggled() ? get_icon("Back", "EditorIcons") : get_icon("Forward", "EditorIcons"));
_update_font();
} break;
case NOTIFICATION_ENTER_TREE: {
@@ -1623,6 +1628,7 @@ void CodeTextEditor::_bind_methods() {
ClassDB::bind_method("_complete_request", &CodeTextEditor::_complete_request);
ClassDB::bind_method("_font_resize_timeout", &CodeTextEditor::_font_resize_timeout);
ClassDB::bind_method("_error_pressed", &CodeTextEditor::_error_pressed);
+ ClassDB::bind_method("_toggle_scripts_pressed", &CodeTextEditor::_toggle_scripts_pressed);
ClassDB::bind_method("_warning_button_pressed", &CodeTextEditor::_warning_button_pressed);
ClassDB::bind_method("_warning_label_gui_input", &CodeTextEditor::_warning_label_gui_input);
@@ -1678,6 +1684,11 @@ CodeTextEditor::CodeTextEditor() {
error_line = 0;
error_column = 0;
+ toggle_scripts_button = memnew(ToolButton);
+ toggle_scripts_button->connect("pressed", this, "_toggle_scripts_pressed");
+ status_bar->add_child(toggle_scripts_button);
+ toggle_scripts_button->set_shortcut(ED_SHORTCUT("script_editor/toggle_scripts_panel", TTR("Toggle Scripts Panel"), KEY_MASK_CMD | KEY_BACKSLASH));
+
// Error
ScrollContainer *scroll = memnew(ScrollContainer);
scroll->set_h_size_flags(SIZE_EXPAND_FILL);