Add EditorStringNames singleton

This commit is contained in:
kobewi 2023-08-13 02:33:39 +02:00
parent fa3428ff25
commit 6de34fde27
176 changed files with 2549 additions and 2325 deletions

View file

@ -48,6 +48,7 @@
#include "editor/editor_scale.h"
#include "editor/editor_script.h"
#include "editor/editor_settings.h"
#include "editor/editor_string_names.h"
#include "editor/filesystem_dock.h"
#include "editor/find_in_files.h"
#include "editor/gui/editor_file_dialog.h"
@ -382,7 +383,7 @@ void ScriptEditorQuickOpen::_notification(int p_what) {
[[fallthrough]];
}
case NOTIFICATION_VISIBILITY_CHANGED: {
search_box->set_right_icon(search_options->get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
search_box->set_right_icon(search_options->get_editor_theme_icon(SNAME("Search")));
} break;
case NOTIFICATION_EXIT_TREE: {
@ -663,7 +664,7 @@ void ScriptEditor::_go_to_tab(int p_idx) {
}
if (Object::cast_to<EditorHelp>(c)) {
script_name_label->set_text(Object::cast_to<EditorHelp>(c)->get_class());
script_icon->set_texture(get_theme_icon(SNAME("Help"), SNAME("EditorIcons")));
script_icon->set_texture(get_editor_theme_icon(SNAME("Help")));
if (is_visible_in_tree()) {
Object::cast_to<EditorHelp>(c)->set_focused();
}
@ -1611,21 +1612,21 @@ void ScriptEditor::_notification(int p_what) {
case NOTIFICATION_TRANSLATION_CHANGED:
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED:
case NOTIFICATION_THEME_CHANGED: {
help_search->set_icon(get_theme_icon(SNAME("HelpSearch"), SNAME("EditorIcons")));
site_search->set_icon(get_theme_icon(SNAME("ExternalLink"), SNAME("EditorIcons")));
help_search->set_icon(get_editor_theme_icon(SNAME("HelpSearch")));
site_search->set_icon(get_editor_theme_icon(SNAME("ExternalLink")));
if (is_layout_rtl()) {
script_forward->set_icon(get_theme_icon(SNAME("Back"), SNAME("EditorIcons")));
script_back->set_icon(get_theme_icon(SNAME("Forward"), SNAME("EditorIcons")));
script_forward->set_icon(get_editor_theme_icon(SNAME("Back")));
script_back->set_icon(get_editor_theme_icon(SNAME("Forward")));
} else {
script_forward->set_icon(get_theme_icon(SNAME("Forward"), SNAME("EditorIcons")));
script_back->set_icon(get_theme_icon(SNAME("Back"), SNAME("EditorIcons")));
script_forward->set_icon(get_editor_theme_icon(SNAME("Forward")));
script_back->set_icon(get_editor_theme_icon(SNAME("Back")));
}
members_overview_alphabeta_sort_button->set_icon(get_theme_icon(SNAME("Sort"), SNAME("EditorIcons")));
members_overview_alphabeta_sort_button->set_icon(get_editor_theme_icon(SNAME("Sort")));
filter_scripts->set_right_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
filter_methods->set_right_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
filter_scripts->set_right_icon(get_editor_theme_icon(SNAME("Search")));
filter_methods->set_right_icon(get_editor_theme_icon(SNAME("Search")));
filename->add_theme_style_override("normal", EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("normal"), SNAME("LineEdit")));
@ -1957,9 +1958,9 @@ void ScriptEditor::_update_script_colors() {
bool script_temperature_enabled = EDITOR_GET("text_editor/script_list/script_temperature_enabled");
int hist_size = EDITOR_GET("text_editor/script_list/script_temperature_history_size");
Color hot_color = get_theme_color(SNAME("accent_color"), SNAME("Editor"));
Color hot_color = get_theme_color(SNAME("accent_color"), EditorStringName(Editor));
hot_color.set_s(hot_color.get_s() * 0.9);
Color cold_color = get_theme_color(SNAME("font_color"), SNAME("Editor"));
Color cold_color = get_theme_color(SNAME("font_color"), EditorStringName(Editor));
for (int i = 0; i < script_list->get_item_count(); i++) {
int c = script_list->get_item_metadata(i);
@ -2099,7 +2100,7 @@ void ScriptEditor::_update_script_names() {
EditorHelp *eh = Object::cast_to<EditorHelp>(tab_container->get_tab_control(i));
if (eh) {
String name = eh->get_class();
Ref<Texture2D> icon = get_theme_icon(SNAME("Help"), SNAME("EditorIcons"));
Ref<Texture2D> icon = get_editor_theme_icon(SNAME("Help"));
String tooltip = vformat(TTR("%s Class Reference"), name);
_ScriptEditorItemData sd;
@ -2150,7 +2151,7 @@ void ScriptEditor::_update_script_names() {
}
}
Color tool_color = get_theme_color(SNAME("accent_color"), SNAME("Editor"));
Color tool_color = get_theme_color(SNAME("accent_color"), EditorStringName(Editor));
tool_color.set_s(tool_color.get_s() * 1.5);
for (int i = 0; i < sedata_filtered.size(); i++) {
script_list->add_item(sedata_filtered[i].name, sedata_filtered[i].icon);
@ -2885,7 +2886,7 @@ Variant ScriptEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from) {
EditorHelp *eh = Object::cast_to<EditorHelp>(cur_node);
if (eh) {
preview_name = eh->get_class();
preview_icon = get_theme_icon(SNAME("Help"), SNAME("EditorIcons"));
preview_icon = get_editor_theme_icon(SNAME("Help"));
}
if (!preview_icon.is_null()) {
@ -4138,8 +4139,8 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) {
ScriptServer::edit_request_func = _open_script_request;
add_theme_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("ScriptEditorPanel"), SNAME("EditorStyles")));
tab_container->add_theme_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("ScriptEditor"), SNAME("EditorStyles")));
add_theme_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("ScriptEditorPanel"), EditorStringName(EditorStyles)));
tab_container->add_theme_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("ScriptEditor"), EditorStringName(EditorStyles)));
Ref<EditorJSONSyntaxHighlighter> json_syntax_highlighter;
json_syntax_highlighter.instantiate();
@ -4166,9 +4167,9 @@ void ScriptEditorPlugin::_save_last_editor(String p_editor) {
void ScriptEditorPlugin::_window_visibility_changed(bool p_visible) {
_focus_another_editor();
if (p_visible) {
script_editor->add_theme_style_override("panel", script_editor->get_theme_stylebox("ScriptEditorPanelFloating", "EditorStyles"));
script_editor->add_theme_style_override("panel", script_editor->get_theme_stylebox("ScriptEditorPanelFloating", EditorStringName(EditorStyles)));
} else {
script_editor->add_theme_style_override("panel", script_editor->get_theme_stylebox("ScriptEditorPanel", "EditorStyles"));
script_editor->add_theme_style_override("panel", script_editor->get_theme_stylebox("ScriptEditorPanel", EditorStringName(EditorStyles)));
}
}