| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
#pragma once |
| 32 |
|
| 33 |
#include "editor/translations/editor_locale_dialog.h" |
| 34 |
#include "scene/gui/check_box.h" |
| 35 |
#include "scene/gui/tree.h" |
| 36 |
|
| 37 |
class EditorFileDialog; |
| 38 |
class FileSystemDock; |
| 39 |
|
| 40 |
class LocalizationEditor : public VBoxContainer { |
| 41 |
GDCLASS(LocalizationEditor, VBoxContainer); |
| 42 |
|
| 43 |
Tree *translation_list = nullptr; |
| 44 |
|
| 45 |
EditorLocaleDialog *locale_select = nullptr; |
| 46 |
EditorFileDialog *translation_file_open = nullptr; |
| 47 |
|
| 48 |
Button *translation_res_option_add_button = nullptr; |
| 49 |
EditorFileDialog *translation_res_file_open_dialog = nullptr; |
| 50 |
EditorFileDialog *translation_res_option_file_open_dialog = nullptr; |
| 51 |
Tree *translation_remap = nullptr; |
| 52 |
Tree *translation_remap_options = nullptr; |
| 53 |
|
| 54 |
Tree *template_source_list = nullptr; |
| 55 |
CheckBox *template_add_builtin = nullptr; |
| 56 |
EditorFileDialog *template_source_open_dialog = nullptr; |
| 57 |
EditorFileDialog *template_generate_dialog = nullptr; |
| 58 |
Button *template_generate_button = nullptr; |
| 59 |
|
| 60 |
bool updating_translations = false; |
| 61 |
String localization_changed; |
| 62 |
|
| 63 |
LocalVector<Tree *> trees; |
| 64 |
HashMap<Tree *, String> tree_data_types; |
| 65 |
HashMap<Tree *, StringName> tree_settings; |
| 66 |
|
| 67 |
void _translation_file_open(); |
| 68 |
void _translation_add(const PackedStringArray &p_paths); |
| 69 |
void _translation_delete(Object *p_item, int p_column, int p_button, MouseButton p_mouse_button); |
| 70 |
|
| 71 |
void _translation_res_file_open(); |
| 72 |
void _translation_res_add(const PackedStringArray &p_paths); |
| 73 |
void _translation_res_delete(Object *p_item, int p_column, int p_button, MouseButton p_mouse_button); |
| 74 |
void _translation_res_select(); |
| 75 |
void _translation_res_option_file_open(); |
| 76 |
void _translation_res_option_add(const PackedStringArray &p_paths); |
| 77 |
void _translation_res_option_changed(); |
| 78 |
void _translation_res_option_delete(Object *p_item, int p_column, int p_button, MouseButton p_mouse_button); |
| 79 |
void _translation_res_option_popup(bool p_arrow_clicked); |
| 80 |
void _translation_res_option_selected(const String &p_locale); |
| 81 |
|
| 82 |
void _template_source_add(const PackedStringArray &p_paths); |
| 83 |
void _template_source_delete(Object *p_item, int p_column, int p_button, MouseButton p_mouse_button); |
| 84 |
void _template_source_file_open(); |
| 85 |
void _template_generate_open(); |
| 86 |
void _template_add_builtin_toggled(); |
| 87 |
void _template_generate(const String &p_file); |
| 88 |
void _update_template_source_file_extensions(); |
| 89 |
|
| 90 |
void _filesystem_files_moved(const String &p_old_file, const String &p_new_file); |
| 91 |
void _filesystem_file_removed(const String &p_file); |
| 92 |
|
| 93 |
Variant get_drag_data_fw(const Point2 &p_point, Control *p_from); |
| 94 |
bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const; |
| 95 |
void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from); |
| 96 |
|
| 97 |
protected: |
| 98 |
void _notification(int p_what); |
| 99 |
static void _bind_methods(); |
| 100 |
|
| 101 |
public: |
| 102 |
void add_translation(const String &p_translation); |
| 103 |
void update_translations(); |
| 104 |
void connect_filesystem_dock_signals(FileSystemDock *p_fs_dock); |
| 105 |
|
| 106 |
LocalizationEditor(); |
| 107 |
}; |