diff options
Diffstat (limited to 'editor/code_editor.cpp')
-rw-r--r-- | editor/code_editor.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 06a425bab9..30fc3789dc 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -1509,7 +1509,7 @@ void CodeTextEditor::_set_show_warnings_panel(bool 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")); + toggle_scripts_button->set_icon(ScriptEditor::get_singleton()->toggle_scripts_panel(this) ? get_icon("Back", "EditorIcons") : get_icon("Forward", "EditorIcons")); } void CodeTextEditor::_error_pressed(const Ref<InputEvent> &p_event) { @@ -1528,7 +1528,7 @@ void CodeTextEditor::_notification(int p_what) { } break; case NOTIFICATION_THEME_CHANGED: { if (toggle_scripts_button->is_visible()) { - toggle_scripts_button->set_icon(ScriptEditor::get_singleton()->is_scripts_panel_toggled() ? get_icon("Back", "EditorIcons") : get_icon("Forward", "EditorIcons")); + update_toggle_scripts_button(); } _update_font(); } break; @@ -1537,6 +1537,9 @@ void CodeTextEditor::_notification(int p_what) { add_constant_override("separation", 4 * EDSCALE); } break; case NOTIFICATION_VISIBILITY_CHANGED: { + if (toggle_scripts_button->is_visible()) { + update_toggle_scripts_button(); + } set_process_input(is_visible_in_tree()); } break; default: @@ -1649,6 +1652,10 @@ void CodeTextEditor::show_toggle_scripts_button() { toggle_scripts_button->show(); } +void CodeTextEditor::update_toggle_scripts_button() { + toggle_scripts_button->set_icon(ScriptEditor::get_singleton()->is_scripts_panel_toggled() ? get_icon("Back", "EditorIcons") : get_icon("Forward", "EditorIcons")); +} + CodeTextEditor::CodeTextEditor() { code_complete_func = NULL; @@ -1693,7 +1700,7 @@ CodeTextEditor::CodeTextEditor() { 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)); + toggle_scripts_button->set_tooltip(TTR("Toggle Scripts Panel") + " (" + ED_GET_SHORTCUT("script_editor/toggle_scripts_panel")->get_as_text() + ")"); toggle_scripts_button->hide(); // Error |