Added status bar and toggle scripts panel button to EditorHelp/VScripts

This commit is contained in:
Yuri Roubinsky 2021-09-14 12:17:47 +03:00
parent 3705ad7d8f
commit 1dda47c280
11 changed files with 88 additions and 18 deletions

View file

@ -46,6 +46,7 @@
#include "editor/find_in_files.h"
#include "editor/node_dock.h"
#include "editor/plugins/shader_editor_plugin.h"
#include "modules/visual_script/visual_script_editor.h"
#include "scene/main/window.h"
#include "scene/scene_string_names.h"
#include "script_text_editor.h"
@ -1236,14 +1237,15 @@ void ScriptEditor::_menu_option(int p_option) {
_update_script_names();
} break;
case TOGGLE_SCRIPTS_PANEL: {
toggle_scripts_panel();
if (current) {
ScriptTextEditor *editor = Object::cast_to<ScriptTextEditor>(current);
toggle_scripts_panel();
if (editor) {
editor->update_toggle_scripts_button();
}
current->update_toggle_scripts_button();
} else {
toggle_scripts_panel();
Control *tab = tab_container->get_current_tab_control();
EditorHelp *editor_help = Object::cast_to<EditorHelp>(tab);
if (editor_help) {
editor_help->update_toggle_scripts_button();
}
}
}
}

View file

@ -161,6 +161,7 @@ public:
virtual void update_settings() = 0;
virtual void set_debugger_active(bool p_active) = 0;
virtual bool can_lose_focus_on_node_selection() { return true; }
virtual void update_toggle_scripts_button() {}
virtual bool show_members_overview() = 0;

View file

@ -876,9 +876,7 @@ String ScriptTextEditor::_get_absolute_path(const String &rel_path) {
}
void ScriptTextEditor::update_toggle_scripts_button() {
if (code_editor != nullptr) {
code_editor->update_toggle_scripts_button();
}
code_editor->update_toggle_scripts_button();
}
void ScriptTextEditor::_update_connected_methods() {

View file

@ -197,7 +197,7 @@ public:
virtual void add_syntax_highlighter(Ref<EditorSyntaxHighlighter> p_highlighter) override;
virtual void set_syntax_highlighter(Ref<EditorSyntaxHighlighter> p_highlighter) override;
void update_toggle_scripts_button();
void update_toggle_scripts_button() override;
virtual void apply_code() override;
virtual RES get_edited_resource() const override;

View file

@ -513,6 +513,10 @@ void TextEditor::_make_context_menu(bool p_selection, bool p_can_fold, bool p_is
context_menu->popup();
}
void TextEditor::update_toggle_scripts_button() {
code_editor->update_toggle_scripts_button();
}
TextEditor::TextEditor() {
code_editor = memnew(CodeTextEditor);
add_child(code_editor);
@ -521,6 +525,7 @@ TextEditor::TextEditor() {
code_editor->connect("validate_script", callable_mp(this, &TextEditor::_validate_script));
code_editor->set_anchors_and_offsets_preset(Control::PRESET_WIDE);
code_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
code_editor->show_toggle_scripts_button();
update_settings();

View file

@ -139,6 +139,7 @@ public:
virtual void set_debugger_active(bool p_active) override;
virtual void set_tooltip_request_func(String p_method, Object *p_obj) override;
virtual void add_callback(const String &p_function, PackedStringArray p_args) override;
void update_toggle_scripts_button() override;
virtual Control *get_edit_menu() override;
virtual void clear_edit_menu() override;