summaryrefslogtreecommitdiffstats
path: root/editor/plugins/script_editor_plugin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/plugins/script_editor_plugin.cpp')
-rw-r--r--editor/plugins/script_editor_plugin.cpp46
1 files changed, 40 insertions, 6 deletions
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index d1d858b4db..32dae74ba4 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -38,6 +38,7 @@
#include "core/os/keyboard.h"
#include "core/os/os.h"
#include "core/version.h"
+#include "editor/code_editor.h"
#include "editor/debugger/editor_debugger_node.h"
#include "editor/debugger/script_editor_debugger.h"
#include "editor/editor_command_palette.h"
@@ -1639,7 +1640,7 @@ void ScriptEditor::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
EditorRunBar::get_singleton()->connect("stop_pressed", callable_mp(this, &ScriptEditor::_editor_stop));
- _editor_settings_changed();
+ _apply_editor_settings();
[[fallthrough]];
}
@@ -2481,6 +2482,12 @@ bool ScriptEditor::edit(const Ref<Resource> &p_resource, int p_line, int p_col,
se->connect("replace_in_files_requested", callable_mp(this, &ScriptEditor::_on_replace_in_files_requested));
se->connect("go_to_method", callable_mp(this, &ScriptEditor::script_goto_method));
+ CodeTextEditor *cte = se->get_code_editor();
+ if (cte) {
+ cte->set_zoom_factor(zoom_factor);
+ cte->connect("zoomed", callable_mp(this, &ScriptEditor::_set_zoom_factor));
+ }
+
//test for modification, maybe the script was not edited but was loaded
_test_script_times_on_disk(p_resource);
@@ -2779,11 +2786,16 @@ void ScriptEditor::_save_layout() {
}
void ScriptEditor::_editor_settings_changed() {
- if (!EditorSettings::get_singleton()->check_changed_settings_in_group("text_editor") &&
+ if (!EditorSettings::get_singleton()->check_changed_settings_in_group("interface/editor") &&
+ !EditorSettings::get_singleton()->check_changed_settings_in_group("text_editor") &&
!EditorSettings::get_singleton()->check_changed_settings_in_group("docks/filesystem")) {
return;
}
+ _apply_editor_settings();
+}
+
+void ScriptEditor::_apply_editor_settings() {
textfile_extensions.clear();
const Vector<String> textfile_ext = ((String)(EDITOR_GET("docks/filesystem/textfile_extensions"))).split(",", false);
for (const String &E : textfile_ext) {
@@ -2808,6 +2820,11 @@ void ScriptEditor::_editor_settings_changed() {
EditorSettings::get_singleton()->load_text_editor_theme();
}
+ _update_script_colors();
+ _update_script_names();
+
+ ScriptServer::set_reload_scripts_on_save(EDITOR_GET("text_editor/behavior/files/auto_reload_and_parse_scripts_on_save"));
+
for (int i = 0; i < tab_container->get_tab_count(); i++) {
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(i));
if (!se) {
@@ -2816,10 +2833,6 @@ void ScriptEditor::_editor_settings_changed() {
se->update_settings();
}
- _update_script_colors();
- _update_script_names();
-
- ScriptServer::set_reload_scripts_on_save(EDITOR_GET("text_editor/behavior/files/auto_reload_and_parse_scripts_on_save"));
}
void ScriptEditor::_filesystem_changed() {
@@ -3322,6 +3335,8 @@ void ScriptEditor::set_window_layout(Ref<ConfigFile> p_layout) {
}
}
+ _set_zoom_factor(p_layout->get_value("ScriptEditor", "zoom_factor", 1.0f));
+
restoring_layout = false;
_update_script_names();
@@ -3371,6 +3386,7 @@ void ScriptEditor::get_window_layout(Ref<ConfigFile> p_layout) {
p_layout->set_value("ScriptEditor", "open_help", helps);
p_layout->set_value("ScriptEditor", "script_split_offset", script_split->get_split_offset());
p_layout->set_value("ScriptEditor", "list_split_offset", list_split->get_split_offset());
+ p_layout->set_value("ScriptEditor", "zoom_factor", zoom_factor);
// Save the cache.
script_editor_cache->save(EditorPaths::get_singleton()->get_project_settings_dir().path_join("script_editor_cache.cfg"));
@@ -3806,6 +3822,24 @@ void ScriptEditor::_on_find_in_files_modified_files(PackedStringArray paths) {
_update_modified_scripts_for_external_editor();
}
+void ScriptEditor::_set_zoom_factor(float p_zoom_factor) {
+ if (zoom_factor == p_zoom_factor) {
+ return;
+ }
+ zoom_factor = p_zoom_factor;
+ for (int i = 0; i < tab_container->get_tab_count(); i++) {
+ ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(i));
+ if (se) {
+ CodeTextEditor *cte = se->get_code_editor();
+ if (cte) {
+ if (zoom_factor != cte->get_zoom_factor()) {
+ cte->set_zoom_factor(zoom_factor);
+ }
+ }
+ }
+ }
+}
+
void ScriptEditor::_window_changed(bool p_visible) {
make_floating->set_visible(!p_visible);
is_floating = p_visible;