diff options
Diffstat (limited to 'tools/editor')
25 files changed, 755 insertions, 108 deletions
diff --git a/tools/editor/code_editor.cpp b/tools/editor/code_editor.cpp index c92b40628c..a9e31a6561 100644 --- a/tools/editor/code_editor.cpp +++ b/tools/editor/code_editor.cpp @@ -30,6 +30,7 @@ #include "editor_settings.h" #include "scene/gui/margin_container.h" #include "scene/gui/separator.h" +#include "os/keyboard.h" void GotoLineDialog::popup_find_line(TextEdit *p_edit) { @@ -76,6 +77,436 @@ GotoLineDialog::GotoLineDialog() { } +void FindReplaceBar::_notification(int p_what) { + + if (p_what == NOTIFICATION_READY) { + + find_prev->set_icon(get_icon("MoveUp", "EditorIcons")); + find_next->set_icon(get_icon("MoveDown", "EditorIcons")); + hide_button->set_normal_texture(get_icon("Close","EditorIcons")); + hide_button->set_hover_texture(get_icon("CloseHover","EditorIcons")); + hide_button->set_pressed_texture(get_icon("Close","EditorIcons")); + + } else if (p_what == NOTIFICATION_VISIBILITY_CHANGED) { + + set_process_unhandled_input(is_visible()); + } +} + +void FindReplaceBar::_unhandled_input(const InputEvent &p_event) { + + if (p_event.type == InputEvent::KEY) { + + const InputEventKey& k = p_event.key; + + if (k.pressed && (text_edit->has_focus() || text_vbc->is_a_parent_of(get_focus_owner()))) { + + bool accepted = true; + + switch (k.scancode) { + + case KEY_ESCAPE: { + + _hide_bar(); + } break; + default: { + + accepted = false; + } break; + } + + if (accepted) { + accept_event(); + } + } + } +} + +bool FindReplaceBar::_search(bool p_include_current, bool p_backwards) { + + String text=get_search_text(); + uint32_t flags=0; + + if (is_whole_words()) + flags|=TextEdit::SEARCH_WHOLE_WORDS; + if (is_case_sensitive()) + flags|=TextEdit::SEARCH_MATCH_CASE; + if (p_backwards) + flags|=TextEdit::SEARCH_BACKWARDS; + + int line=text_edit->cursor_get_line(); + int col=text_edit->cursor_get_column(); + + if (text_edit->is_selection_active() && !replace_all_mode) { + line = text_edit->get_selection_from_line(); + col = text_edit->get_selection_from_column(); + } + + bool cursor_at_result=false; + + if (line==current_result_line && col>=current_result_col && col<=current_result_col+text.length()) { + col=current_result_col; + cursor_at_result=true; + } + + if (!p_include_current) { + if (p_backwards) { + col-=text.length(); + if (col<0) { + line-=1; + if (line<0) + line=text_edit->get_line_count()-1; + col=text_edit->get_line(line).length(); + } + } else if (cursor_at_result) { + col+=text.length(); + if (col>text_edit->get_line(line).length()) { + line+=1; + if (line>=text_edit->get_line_count()) + line=0; + col=0; + } + } + } + + bool found = text_edit->search(text,flags,line,col,line,col); + + if (!found) { + if (p_backwards) { + line = text_edit->get_line_count()-1; + col = text_edit->get_line(line).length()-1; + } else { + line = 0; + col = 0; + } + + found = text_edit->search(text,flags,line,col,line,col); + } + + if (found) { + text_edit->cursor_set_line(line); + text_edit->cursor_set_column(p_backwards?col:col+text.length()); + text_edit->select(line,col,line,col+text.length()); + text_edit->set_search_text(text); + text_edit->set_search_flags(flags); + text_edit->set_current_search_result(line,col); + + current_result_line = line; + current_result_col = col; + + set_error(""); + } else { + current_result_line = -1; + current_result_col = -1; + text_edit->set_search_text(""); + set_error(text.empty()?"":TTR("No Matches")); + } + + return found; +} + +void FindReplaceBar::_replace() { + + if (text_edit->get_selection_text()==get_search_text()) { + text_edit->insert_text_at_cursor(get_replace_text()); + } + + search_current(); +} + +void FindReplaceBar::_replace_all() { + + // line as x so it gets priority in comparison, column as y + Point2i orig_cursor(text_edit->cursor_get_line(),text_edit->cursor_get_column()); + Point2i prev_match=Point2(-1,-1); + + bool selection_enabled = text_edit->is_selection_active(); + Point2i selection_begin,selection_end; + if (selection_enabled) { + selection_begin=Point2i(text_edit->get_selection_from_line(),text_edit->get_selection_from_column()); + selection_end=Point2i(text_edit->get_selection_to_line(),text_edit->get_selection_to_column()); + } + + int vsval = text_edit->get_v_scroll(); + + text_edit->cursor_set_line(0); + text_edit->cursor_set_column(0); + + int rc=0; + + replace_all_mode = true; + + text_edit->begin_complex_operation(); + + while(_search(false)) { + + if (!text_edit->is_selection_active()) { + // search selects + break; + } + + // replace area + Point2i match_from(text_edit->get_selection_from_line(),text_edit->get_selection_from_column()); + Point2i match_to(text_edit->get_selection_to_line(),text_edit->get_selection_to_column()); + + if (match_from < prev_match) + break; // done + + prev_match=match_to; + + if (selection_enabled && is_selection_only()) { + + if (match_from<selection_begin || match_to>selection_end) + continue; + + // replace but adjust selection bounds + text_edit->insert_text_at_cursor(get_replace_text()); + if (match_to.x==selection_end.x) + selection_end.y+=get_replace_text().length() - get_search_text().length(); + } else { + //just replace + text_edit->insert_text_at_cursor(get_replace_text()); + } + + rc++; + } + + text_edit->end_complex_operation(); + + replace_all_mode = false; + + // restore editor state (selection, cursor, scroll) + text_edit->cursor_set_line(orig_cursor.x); + text_edit->cursor_set_column(orig_cursor.y); + + if (selection_enabled && is_selection_only()) { + // reselect + text_edit->select(selection_begin.x,selection_begin.y,selection_end.x,selection_end.y); + } else { + text_edit->deselect(); + } + + text_edit->set_v_scroll(vsval); + set_error(vformat(TTR("Replaced %d Ocurrence(s)."), rc)); +} + +void FindReplaceBar::search_current() { + + _search(true); +} + +void FindReplaceBar::search_prev() { + + _search(false, true); +} + +void FindReplaceBar::search_next() { + + _search(); +} + +void FindReplaceBar::_hide_bar() { + + text_edit->set_search_text(""); + current_result_line = -1; + current_result_col = -1; + replace_hbc->hide(); + replace_options_hbc->hide(); + hide(); +} + +void FindReplaceBar::_show_search() { + + show(); + search_text->grab_focus(); + + if (text_edit->is_selection_active()) { + search_text->set_text(text_edit->get_selection_text()); + } + + if (!get_search_text().empty()) { + search_text->select_all(); + search_text->set_cursor_pos(search_text->get_text().length()); + search_current(); + } +} + +void FindReplaceBar::popup_search() { + + replace_hbc->hide(); + replace_options_hbc->hide(); + _show_search(); +} + +void FindReplaceBar::popup_replace() { + + if (!replace_hbc->is_visible() || !replace_options_hbc->is_visible()) { + replace_text->clear(); + replace_hbc->show(); + replace_options_hbc->show(); + } + + _show_search(); +} + +void FindReplaceBar::_search_options_changed(bool p_pressed) { + + search_current(); +} + +void FindReplaceBar::_search_text_changed(const String& p_text) { + + search_current(); +} + +void FindReplaceBar::_search_text_entered(const String& p_text) { + + search_next(); +} + +String FindReplaceBar::get_search_text() const { + + return search_text->get_text(); +} + +String FindReplaceBar::get_replace_text() const { + + return replace_text->get_text(); +} + +bool FindReplaceBar::is_case_sensitive() const { + + return case_sensitive->is_pressed(); +} + +bool FindReplaceBar::is_whole_words() const { + + return whole_words->is_pressed(); +} + +bool FindReplaceBar::is_selection_only() const { + + return selection_only->is_pressed(); +} + +void FindReplaceBar::set_error(const String &p_label) { + + error_label->set_text(p_label); +} + +void FindReplaceBar::set_text_edit(TextEdit *p_text_edit) { + + text_edit = p_text_edit; + text_edit->connect("_text_changed",this,"_search_text_changed",varray(String())); +} + +void FindReplaceBar::_bind_methods() { + + ObjectTypeDB::bind_method("_unhandled_input",&FindReplaceBar::_unhandled_input); + + ObjectTypeDB::bind_method("_search_text_changed",&FindReplaceBar::_search_text_changed); + ObjectTypeDB::bind_method("_search_text_entered",&FindReplaceBar::_search_text_entered); + ObjectTypeDB::bind_method("_search_current",&FindReplaceBar::search_current); + ObjectTypeDB::bind_method("_search_next",&FindReplaceBar::search_next); + ObjectTypeDB::bind_method("_search_prev",&FindReplaceBar::search_prev); + ObjectTypeDB::bind_method("_replace_pressed",&FindReplaceBar::_replace); + ObjectTypeDB::bind_method("_replace_all_pressed",&FindReplaceBar::_replace_all); + ObjectTypeDB::bind_method("_search_options_changed",&FindReplaceBar::_search_options_changed); + ObjectTypeDB::bind_method("_hide_pressed",&FindReplaceBar::_hide_bar); + + ADD_SIGNAL(MethodInfo("search")); +} + +FindReplaceBar::FindReplaceBar() { + + text_vbc = memnew(VBoxContainer); + add_child(text_vbc); + + HBoxContainer *search_hbc = memnew(HBoxContainer); + text_vbc->add_child(search_hbc); + + search_text = memnew(LineEdit); + search_hbc->add_child(search_text); + search_text->set_custom_minimum_size(Size2(200, 0)); + search_text->connect("text_changed",this,"_search_text_changed"); + search_text->connect("text_entered",this,"_search_text_entered"); + + find_prev = memnew(ToolButton); + search_hbc->add_child(find_prev); + find_prev->set_focus_mode(FOCUS_NONE); + find_prev->connect("pressed",this,"_search_prev"); + + find_next = memnew(ToolButton); + search_hbc->add_child(find_next); + find_next->set_focus_mode(FOCUS_NONE); + find_next->connect("pressed",this,"_search_next"); + + replace_hbc = memnew(HBoxContainer); + text_vbc->add_child(replace_hbc); + replace_hbc->hide(); + + replace_text = memnew(LineEdit); + replace_hbc->add_child(replace_text); + replace_text->set_custom_minimum_size(Size2(200, 0)); + replace_text->connect("text_entered",this,"_search_text_entered"); + + replace = memnew(ToolButton); + replace_hbc->add_child(replace); + replace->set_text(TTR("Replace")); + replace->set_focus_mode(FOCUS_NONE); + replace->connect("pressed",this,"_replace_pressed"); + + replace_all = memnew(ToolButton); + replace_hbc->add_child(replace_all); + replace_all->set_text(TTR("Replace All")); + replace_all->set_focus_mode(FOCUS_NONE); + replace_all->connect("pressed",this,"_replace_all_pressed"); + + Control *spacer_split = memnew( Control ); + spacer_split->set_custom_minimum_size(Size2(0, 1)); + text_vbc->add_child(spacer_split); + + VBoxContainer *options_vbc = memnew(VBoxContainer); + add_child(options_vbc); + options_vbc->set_h_size_flags(SIZE_EXPAND_FILL); + + HBoxContainer *search_options = memnew(HBoxContainer); + options_vbc->add_child(search_options); + + case_sensitive = memnew(CheckBox); + search_options->add_child(case_sensitive); + case_sensitive->set_text(TTR("Match Case")); + case_sensitive->set_focus_mode(FOCUS_NONE); + case_sensitive->connect("toggled",this,"_search_options_changed"); + + whole_words = memnew(CheckBox); + search_options->add_child(whole_words); + whole_words->set_text(TTR("Whole Words")); + whole_words->set_focus_mode(FOCUS_NONE); + whole_words->connect("toggled",this,"_search_options_changed"); + + error_label = memnew(Label); + search_options->add_child(error_label); + + search_options->add_spacer(); + + hide_button = memnew(TextureButton); + search_options->add_child(hide_button); + hide_button->set_focus_mode(FOCUS_NONE); + hide_button->connect("pressed",this,"_hide_pressed"); + + replace_options_hbc = memnew(HBoxContainer); + options_vbc->add_child(replace_options_hbc); + replace_options_hbc->hide(); + + selection_only = memnew(CheckBox); + replace_options_hbc->add_child(selection_only); + selection_only->set_text(TTR("Selection Only")); + selection_only->set_focus_mode(FOCUS_NONE); + selection_only->connect("toggled",this,"_search_options_changed"); +} + + void FindReplaceDialog::popup_search() { set_title(TTR("Search")); @@ -544,7 +975,7 @@ void CodeTextEditor::set_error(const String& p_error) { } -void CodeTextEditor::_on_settings_change() { +void CodeTextEditor::_update_font() { // FONTS String editor_font = EDITOR_DEF("text_editor/font", ""); @@ -557,7 +988,12 @@ void CodeTextEditor::_on_settings_change() { } } if(!font_overrode) - text_editor->add_font_override("font",get_font("source","Fonts")); + text_editor->add_font_override("font",get_font("source","EditorFonts")); +} + +void CodeTextEditor::_on_settings_change() { + + _update_font(); // AUTO BRACE COMPLETION text_editor->set_auto_brace_completion( @@ -588,6 +1024,9 @@ void CodeTextEditor::_notification(int p_what) { if (p_what==EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) _load_theme_settings(); + if (p_what==NOTIFICATION_ENTER_TREE) { + _update_font(); + } } void CodeTextEditor::_bind_methods() { @@ -602,35 +1041,32 @@ void CodeTextEditor::_bind_methods() { CodeTextEditor::CodeTextEditor() { + find_replace_bar = memnew( FindReplaceBar ); + add_child(find_replace_bar); + find_replace_bar->set_h_size_flags(SIZE_EXPAND_FILL); + find_replace_bar->hide(); + text_editor = memnew( TextEdit ); add_child(text_editor); - text_editor->set_area_as_parent_rect(); - text_editor->set_margin(MARGIN_BOTTOM,20); + text_editor->set_v_size_flags(SIZE_EXPAND_FILL); - String editor_font = EDITOR_DEF("text_editor/font", ""); - bool font_overrode = false; - if (editor_font!="") { - Ref<Font> fnt = ResourceLoader::load(editor_font); - if (fnt.is_valid()) { - text_editor->add_font_override("font",fnt); - font_overrode = true; - } - } - - if (!font_overrode) - text_editor->add_font_override("font",get_font("source","Fonts")); + find_replace_bar->set_text_edit(text_editor); text_editor->set_show_line_numbers(true); text_editor->set_brace_matching(true); text_editor->set_auto_indent(true); - line_col = memnew( Label ); - add_child(line_col); - line_col->set_anchor_and_margin(MARGIN_LEFT,ANCHOR_END,135); - line_col->set_anchor_and_margin(MARGIN_TOP,ANCHOR_END,15); - line_col->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END,1); - line_col->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END,5); - //line_col->set_align(Label::ALIGN_RIGHT); + MarginContainer *status_mc = memnew( MarginContainer ); + add_child(status_mc); + status_mc->set("custom_constants/margin_left", 2); + status_mc->set("custom_constants/margin_top", 5); + status_mc->set("custom_constants/margin_right", 2); + status_mc->set("custom_constants/margin_bottom", 1); + + HBoxContainer *status_bar = memnew( HBoxContainer ); + status_mc->add_child(status_bar); + status_bar->set_h_size_flags(SIZE_EXPAND_FILL); + idle = memnew( Timer ); add_child(idle); idle->set_one_shot(true); @@ -644,14 +1080,16 @@ CodeTextEditor::CodeTextEditor() { code_complete_timer->set_wait_time(EDITOR_DEF("text_editor/code_complete_delay",.3f)); error = memnew( Label ); - add_child(error); - error->set_anchor_and_margin(MARGIN_LEFT,ANCHOR_BEGIN,5); - error->set_anchor_and_margin(MARGIN_TOP,ANCHOR_END,15); - error->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END,1); - error->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END,130); + status_bar->add_child(error); error->hide(); + error->set_valign(Label::VALIGN_CENTER); error->add_color_override("font_color",Color(1,0.7,0.6,0.9)); + status_bar->add_spacer(); + + line_col = memnew( Label ); + status_bar->add_child(line_col); + line_col->set_valign(Label::VALIGN_CENTER); text_editor->connect("cursor_changed", this,"_line_col_changed"); diff --git a/tools/editor/code_editor.h b/tools/editor/code_editor.h index e28517c601..52a36c979d 100644 --- a/tools/editor/code_editor.h +++ b/tools/editor/code_editor.h @@ -33,7 +33,9 @@ #include "scene/gui/text_edit.h" #include "scene/gui/dialogs.h" #include "scene/main/timer.h" +#include "scene/gui/tool_button.h" #include "scene/gui/check_button.h" +#include "scene/gui/check_box.h" #include "scene/gui/line_edit.h" @@ -58,8 +60,71 @@ public: GotoLineDialog(); }; +class FindReplaceBar : public HBoxContainer { + OBJ_TYPE(FindReplaceBar,HBoxContainer); + LineEdit *search_text; + ToolButton *find_prev; + ToolButton *find_next; + CheckBox *case_sensitive; + CheckBox *whole_words; + Label *error_label; + TextureButton *hide_button; + + LineEdit *replace_text; + ToolButton *replace; + ToolButton *replace_all; + CheckBox *selection_only; + + VBoxContainer *text_vbc; + HBoxContainer *replace_hbc; + HBoxContainer *replace_options_hbc; + + TextEdit *text_edit; + + int current_result_line; + int current_result_col; + + bool replace_all_mode; + + void _show_search(); + void _hide_bar(); + void _search_options_changed(bool p_pressed); + void _search_text_changed(const String& p_text); + void _search_text_entered(const String& p_text); + +protected: + void _notification(int p_what); + void _unhandled_input(const InputEvent &p_event); + + bool _search(bool p_include_current=false, bool p_backwards=false); + + void _replace(); + void _replace_all(); + + static void _bind_methods(); + +public: + String get_search_text() const; + String get_replace_text() const; + + bool is_case_sensitive() const; + bool is_whole_words() const; + bool is_selection_only() const; + void set_error(const String& p_label); + + void set_text_edit(TextEdit *p_text_edit); + + void popup_search(); + void popup_replace(); + + void search_current(); + void search_prev(); + void search_next(); + + FindReplaceBar(); +}; class FindReplaceDialog : public ConfirmationDialog { @@ -119,11 +184,12 @@ public: }; -class CodeTextEditor : public Control { +class CodeTextEditor : public VBoxContainer { - OBJ_TYPE(CodeTextEditor,Control); + OBJ_TYPE(CodeTextEditor,VBoxContainer); TextEdit *text_editor; + FindReplaceBar *find_replace_bar; Label *line_col; Label *info; @@ -135,6 +201,7 @@ class CodeTextEditor : public Control { void _on_settings_change(); + void _update_font(); void _complete_request(); protected: @@ -157,6 +224,7 @@ protected: public: TextEdit *get_text_edit() { return text_editor; } + FindReplaceBar *get_find_replace_bar() { return find_replace_bar; } virtual void apply_code() {} CodeTextEditor(); diff --git a/tools/editor/dependency_editor.cpp b/tools/editor/dependency_editor.cpp index 633a414b07..a702d3c687 100644 --- a/tools/editor/dependency_editor.cpp +++ b/tools/editor/dependency_editor.cpp @@ -240,8 +240,8 @@ DependencyEditor::DependencyEditor() { tree = memnew( Tree ); tree->set_columns(2); tree->set_column_titles_visible(true); - tree->set_column_title(0,"Resource"); - tree->set_column_title(1,"Path"); + tree->set_column_title(0,TTR("Resource")); + tree->set_column_title(1,TTR("Path")); tree->set_hide_root(true); tree->connect("button_pressed",this,"_load_pressed"); @@ -401,7 +401,7 @@ void DependencyRemoveDialog::show(const Vector<String> &to_erase) { if (exist) { owners->show(); - text->set_text("The files being removed are required by other resources in order for them to work.\nRemove them anyway? (no undo)"); + text->set_text(TTR("The files being removed are required by other resources in order for them to work.\nRemove them anyway? (no undo)")); popup_centered_minsize(Size2(500,220)); } else { owners->hide(); @@ -675,7 +675,7 @@ OrphanResourcesDialog::OrphanResourcesDialog(){ files->set_column_min_width(1,100); files->set_column_expand(0,true); files->set_column_expand(1,false); - files->set_column_title(0,"Resource"); + files->set_column_title(0,TTR("Resource")); files->set_column_title(1,TTR("Owns")); files->set_hide_root(true); vbc->add_margin_child(TTR("Resources Without Explicit Ownership:"),files,true); diff --git a/tools/editor/editor_fonts.cpp b/tools/editor/editor_fonts.cpp index a3ec08f986..e04dce294a 100644 --- a/tools/editor/editor_fonts.cpp +++ b/tools/editor/editor_fonts.cpp @@ -30,6 +30,9 @@ #include "doc_font.h" #include "doc_title_font.h" #include "doc_code_font.h" +#include "builtin_fonts.h" +#include "editor_settings.h" +#include "scene/resources/dynamic_font.h" static Ref<BitmapFont> make_font(int p_height,int p_ascent, int p_valign, int p_charcount, const int *p_chars,const Ref<Texture> &p_texture) { @@ -64,12 +67,54 @@ static Ref<BitmapFont> make_font(int p_height,int p_ascent, int p_valign, int p_ void editor_register_fonts(Ref<Theme> p_theme) { + Ref<DynamicFontData> dfd; + dfd.instance(); + dfd->set_font_ptr(_font_droid_sans,_font_droid_sans_size); + dfd->set_force_autohinter(true); //just looks better..i think? - Ref<BitmapFont> doc_font = make_font(_bi_font_doc_font_height,_bi_font_doc_font_ascent,0,_bi_font_doc_font_charcount,_bi_font_doc_font_characters,p_theme->get_icon("DocFont","EditorIcons")); - Ref<BitmapFont> doc_code_font = make_font(_bi_font_doc_code_font_height,_bi_font_doc_code_font_ascent,0,_bi_font_doc_code_font_charcount,_bi_font_doc_code_font_characters,p_theme->get_icon("DocCodeFont","EditorIcons")); - Ref<BitmapFont> doc_title_font = make_font(_bi_font_doc_title_font_height,_bi_font_doc_title_font_ascent,0,_bi_font_doc_title_font_charcount,_bi_font_doc_title_font_characters,p_theme->get_icon("DocTitleFont","EditorIcons")); - p_theme->set_font("doc","EditorFonts",doc_font); - p_theme->set_font("doc_code","EditorFonts",doc_code_font); - p_theme->set_font("doc_title","EditorFonts",doc_title_font); + Ref<DynamicFontData> dfmono; + dfmono.instance(); + dfmono->set_font_ptr(_font_source_code_pro,_font_source_code_pro_size); + //dfd->set_force_autohinter(true); //just looks better..i think? + + Ref<DynamicFont> df; + df.instance(); + df->set_size(int(EditorSettings::get_singleton()->get("global/font_size"))); + df->set_font_data(dfd); + + + p_theme->set_default_theme_font(df); + +// Ref<BitmapFont> doc_font = make_font(_bi_font_doc_font_height,_bi_font_doc_font_ascent,0,_bi_font_doc_font_charcount,_bi_font_doc_font_characters,p_theme->get_icon("DocFont","EditorIcons")); +// Ref<BitmapFont> doc_title_font = make_font(_bi_font_doc_title_font_height,_bi_font_doc_title_font_ascent,0,_bi_font_doc_title_font_charcount,_bi_font_doc_title_font_characters,p_theme->get_icon("DocTitleFont","EditorIcons")); +// Ref<BitmapFont> doc_code_font = make_font(_bi_font_doc_code_font_height,_bi_font_doc_code_font_ascent,0,_bi_font_doc_code_font_charcount,_bi_font_doc_code_font_characters,p_theme->get_icon("DocCodeFont","EditorIcons")); + + Ref<DynamicFont> df_title; + df_title.instance(); + df_title->set_size(int(EDITOR_DEF("help/help_title_font_size",18))); + df_title->set_font_data(dfd); + + Ref<DynamicFont> df_doc; + df_doc.instance(); + df_doc->set_size(int(EDITOR_DEF("help/help_font_size",16))); + df_doc->set_font_data(dfd); + + p_theme->set_font("doc","EditorFonts",df_doc); + p_theme->set_font("doc_title","EditorFonts",df_title); + + + Ref<DynamicFont> df_code; + df_code.instance(); + df_code->set_size(int(EditorSettings::get_singleton()->get("global/source_font_size"))); + df_code->set_font_data(dfmono); + + p_theme->set_font("source","EditorFonts",df_code); + + Ref<DynamicFont> df_doc_code; + df_doc_code.instance(); + df_doc_code->set_size(int(EDITOR_DEF("help/help_source_font_size",14))); + df_doc_code->set_font_data(dfmono); + + p_theme->set_font("doc_source","EditorFonts",df_doc_code); } diff --git a/tools/editor/editor_help.cpp b/tools/editor/editor_help.cpp index 616037c545..b426def503 100644 --- a/tools/editor/editor_help.cpp +++ b/tools/editor/editor_help.cpp @@ -130,6 +130,7 @@ void EditorHelpSearch::_update_search() { else cicon=def_icon; + for(int i=0;i<c.methods.size();i++) { if( (term.begins_with(".") && c.methods[i].name.begins_with(term.right(1))) || (term.ends_with("(") && c.methods[i].name.ends_with(term.left(term.length()-1).strip_edges())) @@ -697,13 +698,13 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { //edited_class->show(); - DocData::ClassDoc &cd=doc->class_list[p_class]; + DocData::ClassDoc cd=doc->class_list[p_class]; //make a copy, so we can sort without worrying Color h_color; - Ref<Font> doc_font = get_font("normal","Fonts"); - Ref<Font> doc_code_font = get_font("source","Fonts"); - Ref<Font> doc_title_font = get_font("large","Fonts"); + Ref<Font> doc_font = get_font("doc","EditorFonts"); + Ref<Font> doc_title_font = get_font("doc_title","EditorFonts"); + Ref<Font> doc_code_font = get_font("doc_source","EditorFonts"); h_color=Color(1,1,1,1); @@ -794,7 +795,7 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { //class_desc->add_newline(); class_desc->add_newline(); class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/text_color")); - class_desc->push_font( get_font("normal","Fonts") ); + class_desc->push_font( doc_font ); class_desc->push_indent(1); _add_text(cd.brief_description); class_desc->pop(); @@ -805,9 +806,14 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { } bool method_descr=false; + bool sort_methods = EditorSettings::get_singleton()->get("help/sort_functions_alphabetically"); + if (cd.methods.size()) { + if (sort_methods) + cd.methods.sort(); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/keyword_color")); class_desc->push_font(doc_title_font); class_desc->add_text(TTR("Public Methods:")); @@ -979,6 +985,9 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { } if (cd.signals.size()) { + if (sort_methods) { + cd.signals.sort(); + } class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/keyword_color")); class_desc->push_font(doc_title_font); class_desc->add_text(TTR("Signals:")); @@ -1098,7 +1107,7 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { class_desc->add_newline(); class_desc->add_newline(); class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/text_color")); - class_desc->push_font( get_font("normal","Fonts") ); + class_desc->push_font( doc_font ); class_desc->push_indent(1); _add_text(cd.description); class_desc->pop(); @@ -1168,7 +1177,7 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { class_desc->add_newline(); class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/text_color")); - class_desc->push_font( get_font("normal","Fonts") ); + class_desc->push_font( doc_font ); class_desc->push_indent(1); _add_text(cd.methods[i].description); class_desc->pop(); @@ -1248,9 +1257,12 @@ void EditorHelp::_add_text(const String& p_bbcode) { class_desc->push_indent(1);*/ int pos = 0; + Ref<Font> doc_font = get_font("doc","EditorFonts"); + Ref<Font> doc_code_font = get_font("doc_source","EditorFonts"); + String bbcode=p_bbcode.replace("\t"," ").replace("\r"," ").strip_edges(); - //find double newlines, keep them + //change newlines for double newlines for(int i=0;i<bbcode.length();i++) { //find valid newlines (double) @@ -1269,10 +1281,13 @@ void EditorHelp::_add_text(const String& p_bbcode) { if (dnl) { bbcode[i]=0xFFFF; + //keep i=j; } else { - bbcode[i]=' '; - i=j-1; + bbcode=bbcode.insert(i,"\n"); + i++; + //bbcode[i]=' '; + //i=j-1; } } } @@ -1280,7 +1295,7 @@ void EditorHelp::_add_text(const String& p_bbcode) { //remove double spaces or spaces after newlines for(int i=0;i<bbcode.length();i++) { - if (bbcode[i]==' ' || bbcode[i]==0xFFFF) { + if (bbcode[i]==' ' || bbcode[i]=='\n' || bbcode[i]==0xFFFF) { for(int j=i+1;j<p_bbcode.length();j++) { if (bbcode[j]==' ') { @@ -1353,35 +1368,45 @@ void EditorHelp::_add_text(const String& p_bbcode) { } else if (tag.begins_with("method ")) { String m = tag.substr(7,tag.length()); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/keyword_color")); class_desc->push_meta("@"+m); class_desc->add_text(m+"()"); class_desc->pop(); + class_desc->pop(); pos=brk_end+1; } else if (doc->class_list.has(tag)) { + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/keyword_color")); class_desc->push_meta("#"+tag); class_desc->add_text(tag); class_desc->pop(); + class_desc->pop(); pos=brk_end+1; } else if (tag=="b") { //use bold font - class_desc->push_font(get_font("source","Fonts")); + class_desc->push_font(doc_code_font); pos=brk_end+1; tag_stack.push_front(tag); } else if (tag=="i") { //use italics font - class_desc->push_font(get_font("italic","Fonts")); + Color text_color = EditorSettings::get_singleton()->get("text_editor/text_color"); + //no italics so emphasize with color + text_color.r*=1.1; + text_color.g*=1.1; + text_color.b*=1.1; + class_desc->push_color(text_color); + //class_desc->push_font(get_font("italic","Fonts")); pos=brk_end+1; tag_stack.push_front(tag); } else if (tag=="code" || tag=="codeblock") { //use monospace font - class_desc->push_font(get_font("source","EditorFonts")); + class_desc->push_font(doc_code_font); pos=brk_end+1; tag_stack.push_front(tag); } else if (tag=="center") { @@ -1496,7 +1521,7 @@ void EditorHelp::_add_text(const String& p_bbcode) { if (font.is_valid()) class_desc->push_font(font); else { - class_desc->push_font(get_font("source","rFonts")); + class_desc->push_font(doc_font); } pos=brk_end+1; @@ -1618,6 +1643,7 @@ EditorHelp::EditorHelp() { VBoxContainer *vbc = this; + EDITOR_DEF("help/sort_functions_alphabetically",true); //class_list->connect("meta_clicked",this,"_class_list_select"); //class_list->set_selection_enabled(true); diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index fedf738af4..8313e38f02 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -5225,7 +5225,7 @@ EditorNode::EditorNode() { //theme->set_icon("folder","EditorFileDialog",Theme::get_default()->get_icon("folder","EditorFileDialog")); //theme->set_color("files_disabled","EditorFileDialog",Color(0,0,0,0.7)); - String global_font = EditorSettings::get_singleton()->get("global/font"); + String global_font = EditorSettings::get_singleton()->get("global/custom_font"); if (global_font!="") { Ref<Font> fnt = ResourceLoader::load(global_font); if (fnt.is_valid()) { diff --git a/tools/editor/editor_plugin_settings.cpp b/tools/editor/editor_plugin_settings.cpp index 3eefe10448..1a6be05af3 100644 --- a/tools/editor/editor_plugin_settings.cpp +++ b/tools/editor/editor_plugin_settings.cpp @@ -150,7 +150,7 @@ void EditorPluginSettings::_bind_methods() { EditorPluginSettings::EditorPluginSettings() { HBoxContainer *title_hb = memnew( HBoxContainer ); - title_hb->add_child(memnew( Label("Installed Plugins:"))); + title_hb->add_child(memnew( Label(TTR("Installed Plugins:")))); title_hb->add_spacer(); update_list = memnew( Button(TTR("Update")) ); update_list->connect("pressed",this,"update_plugins"); @@ -162,9 +162,9 @@ EditorPluginSettings::EditorPluginSettings() { plugin_list->set_columns(4); plugin_list->set_column_titles_visible(true); plugin_list->set_column_title(0,TTR("Name:")); - plugin_list->set_column_title(1,"Version:"); - plugin_list->set_column_title(2,"Author:"); - plugin_list->set_column_title(3,"Status:"); + plugin_list->set_column_title(1,TTR("Version:")); + plugin_list->set_column_title(2,TTR("Author:")); + plugin_list->set_column_title(3,TTR("Status:")); plugin_list->set_column_expand(0,true); plugin_list->set_column_expand(1,false); plugin_list->set_column_expand(2,false); @@ -185,4 +185,3 @@ EditorPluginSettings::EditorPluginSettings() { updating=false; } - diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp index 0b7e389773..1080509b8f 100644 --- a/tools/editor/editor_settings.cpp +++ b/tools/editor/editor_settings.cpp @@ -443,8 +443,12 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { } set("global/show_script_in_scene_tabs",false); - set("global/font",""); - hints["global/font"]=PropertyInfo(Variant::STRING,"global/font",PROPERTY_HINT_GLOBAL_FILE,"*.fnt"); + set("global/font_size",14); + hints["global/font_size"]=PropertyInfo(Variant::INT,"global/font_size",PROPERTY_HINT_RANGE,"10,40,1",PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_RESTART_IF_CHANGED); + set("global/source_font_size",14); + hints["global/source_font_size"]=PropertyInfo(Variant::INT,"global/source_font_size",PROPERTY_HINT_RANGE,"10,40,1",PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_RESTART_IF_CHANGED); + set("global/custom_font",""); + hints["global/custom_font"]=PropertyInfo(Variant::STRING,"global/custom_font",PROPERTY_HINT_GLOBAL_FILE,"*.fnt",PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_RESTART_IF_CHANGED); set("global/autoscan_project_path",""); hints["global/autoscan_project_path"]=PropertyInfo(Variant::STRING,"global/autoscan_project_path",PROPERTY_HINT_GLOBAL_DIR); set("global/default_project_path",""); @@ -469,6 +473,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { set("text_editor/draw_tabs", true); set("text_editor/show_line_numbers", true); + set("text_editor/show_breakpoint_gutter", true); set("text_editor/trim_trailing_whitespace_on_save", false); set("text_editor/idle_parse_delay",2); @@ -616,6 +621,8 @@ void EditorSettings::_load_default_text_editor_theme() { set("text_editor/mark_color", Color(1.0,0.4,0.4,0.4)); set("text_editor/breakpoint_color", Color(0.8,0.8,0.4,0.2)); set("text_editor/word_highlighted_color",Color(0.8,0.9,0.9,0.15)); + set("text_editor/search_result_color",Color(0.05,0.25,0.05,1)); + set("text_editor/search_result_border_color",Color(0.1,0.45,0.1,1)); } void EditorSettings::notify_changes() { @@ -847,6 +854,8 @@ bool EditorSettings::_save_text_editor_theme(String p_file) { cf->set_value(theme_section, "mark_color", ((Color)get("text_editor/mark_color")).to_html()); cf->set_value(theme_section, "breakpoint_color", ((Color)get("text_editor/breakpoint_color")).to_html()); cf->set_value(theme_section, "word_highlighted_color", ((Color)get("text_editor/word_highlighted_color")).to_html()); + cf->set_value(theme_section, "search_result_color", ((Color)get("text_editor/search_result_color")).to_html()); + cf->set_value(theme_section, "search_result_border_color", ((Color)get("text_editor/search_result_border_color")).to_html()); Error err = cf->save(p_file); if (err == OK) { diff --git a/tools/editor/icons/SCsub b/tools/editor/icons/SCsub index addf6879a2..14d2be66f6 100644 --- a/tools/editor/icons/SCsub +++ b/tools/editor/icons/SCsub @@ -35,7 +35,9 @@ def make_editor_icons_action(target, source, env): s.write("static Ref<ImageTexture> make_icon(const uint8_t* p_png) {\n") s.write("\tRef<ImageTexture> texture( memnew( ImageTexture ) );\n") - s.write("\ttexture->create_from_image( Image(p_png),ImageTexture::FLAG_FILTER );\n") + s.write("\tImage img(p_png);\n") + #s.write("\timg.expand_x2_hq2x();\n") + s.write("\ttexture->create_from_image( img,ImageTexture::FLAG_FILTER );\n") s.write("\treturn texture;\n") s.write("}\n\n") diff --git a/tools/editor/io_plugins/editor_font_import_plugin.cpp b/tools/editor/io_plugins/editor_font_import_plugin.cpp index 7cc5b579fe..f4d6af7e10 100644 --- a/tools/editor/io_plugins/editor_font_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_font_import_plugin.cpp @@ -1614,7 +1614,7 @@ String EditorFontImportPlugin::get_name() const { } String EditorFontImportPlugin::get_visible_name() const{ - return "Font"; + return TTR("Font"); } void EditorFontImportPlugin::import_dialog(const String& p_from){ diff --git a/tools/editor/io_plugins/editor_mesh_import_plugin.cpp b/tools/editor/io_plugins/editor_mesh_import_plugin.cpp index c77256f27b..45da42969c 100644 --- a/tools/editor/io_plugins/editor_mesh_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_mesh_import_plugin.cpp @@ -331,7 +331,7 @@ String EditorMeshImportPlugin::get_name() const { } String EditorMeshImportPlugin::get_visible_name() const{ - return "Mesh"; + return TTR("Mesh"); } void EditorMeshImportPlugin::import_dialog(const String& p_from){ @@ -561,4 +561,3 @@ EditorMeshImportPlugin::EditorMeshImportPlugin(EditorNode* p_editor) { dialog = memnew( EditorMeshImportDialog(this)); p_editor->get_gui_base()->add_child(dialog); } - diff --git a/tools/editor/io_plugins/editor_sample_import_plugin.cpp b/tools/editor/io_plugins/editor_sample_import_plugin.cpp index 631273a878..120bdc6f44 100644 --- a/tools/editor/io_plugins/editor_sample_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_sample_import_plugin.cpp @@ -406,7 +406,7 @@ String EditorSampleImportPlugin::get_name() const { } String EditorSampleImportPlugin::get_visible_name() const{ - return "Audio Sample"; + return TTR("Audio Sample"); } void EditorSampleImportPlugin::import_dialog(const String& p_from){ @@ -921,5 +921,3 @@ Vector<uint8_t> EditorSampleExportPlugin::custom_export(String& p_path,const Ref EditorSampleExportPlugin::EditorSampleExportPlugin() { } - - diff --git a/tools/editor/io_plugins/editor_scene_import_plugin.cpp b/tools/editor/io_plugins/editor_scene_import_plugin.cpp index 00bd5413d3..3effb1d0aa 100644 --- a/tools/editor/io_plugins/editor_scene_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_scene_import_plugin.cpp @@ -2647,7 +2647,7 @@ String EditorSceneAnimationImportPlugin::get_name() const { String EditorSceneAnimationImportPlugin::get_visible_name() const{ - return "3D Scene Animation"; + return TTR("3D Scene Animation"); } void EditorSceneAnimationImportPlugin::import_dialog(const String& p_from){ @@ -2662,4 +2662,3 @@ EditorSceneAnimationImportPlugin::EditorSceneAnimationImportPlugin(EditorNode* p } - diff --git a/tools/editor/io_plugins/editor_texture_import_plugin.cpp b/tools/editor/io_plugins/editor_texture_import_plugin.cpp index c7598466d5..2376f3a395 100644 --- a/tools/editor/io_plugins/editor_texture_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_texture_import_plugin.cpp @@ -828,7 +828,7 @@ String EditorTextureImportPlugin::get_name() const { String EditorTextureImportPlugin::get_visible_name() const { - return "Texture"; + return TTR("Texture"); } void EditorTextureImportPlugin::import_dialog(const String& p_from) { @@ -1805,7 +1805,7 @@ EditorTextureImportPlugin *EditorTextureImportPlugin::singleton=NULL; EditorTextureImportPlugin::EditorTextureImportPlugin(EditorNode *p_editor) { singleton=this; - editor=p_editor; + editor=p_editor; dialog = memnew( EditorTextureImportDialog(this) ); editor->get_gui_base()->add_child(dialog); diff --git a/tools/editor/io_plugins/editor_translation_import_plugin.cpp b/tools/editor/io_plugins/editor_translation_import_plugin.cpp index 282153fa73..2b5bd29ac8 100644 --- a/tools/editor/io_plugins/editor_translation_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_translation_import_plugin.cpp @@ -387,7 +387,7 @@ String EditorTranslationImportPlugin::get_name() const { } String EditorTranslationImportPlugin::get_visible_name() const { - return "Translation"; + return TTR("Translation"); } void EditorTranslationImportPlugin::import_dialog(const String& p_from) { diff --git a/tools/editor/plugins/animation_player_editor_plugin.cpp b/tools/editor/plugins/animation_player_editor_plugin.cpp index 343fcce5cd..4bbcb396af 100644 --- a/tools/editor/plugins/animation_player_editor_plugin.cpp +++ b/tools/editor/plugins/animation_player_editor_plugin.cpp @@ -1544,7 +1544,7 @@ AnimationPlayerEditorPlugin::AnimationPlayerEditorPlugin(EditorNode *p_node) { anim_editor = memnew( AnimationPlayerEditor(editor) ); anim_editor->set_undo_redo(editor->get_undo_redo()); - editor->add_bottom_panel_item("Animation",anim_editor); + editor->add_bottom_panel_item(TTR("Animation"),anim_editor); /* editor->get_viewport()->add_child(anim_editor); anim_editor->set_area_as_parent_rect(); @@ -1562,5 +1562,3 @@ AnimationPlayerEditorPlugin::AnimationPlayerEditorPlugin(EditorNode *p_node) { AnimationPlayerEditorPlugin::~AnimationPlayerEditorPlugin() { } - - diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index e3c339f1d6..6d87777a79 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -300,6 +300,8 @@ void ScriptTextEditor::_load_theme_settings() { get_text_edit()->add_color_override("member_variable_color",EDITOR_DEF("text_editor/member_variable_color",Color(0.9,0.3,0.3))); get_text_edit()->add_color_override("mark_color", EDITOR_DEF("text_editor/mark_color", Color(1.0,0.4,0.4,0.4))); get_text_edit()->add_color_override("breakpoint_color", EDITOR_DEF("text_editor/breakpoint_color", Color(0.8,0.8,0.4,0.2))); + get_text_edit()->add_color_override("search_result_color",EDITOR_DEF("text_editor/search_result_color",Color(0.05,0.25,0.05,1))); + get_text_edit()->add_color_override("search_result_border_color",EDITOR_DEF("text_editor/search_result_border_color",Color(0.1,0.45,0.1,1))); Color keyword_color= EDITOR_DEF("text_editor/keyword_color",Color(0.5,0.0,0.2)); @@ -586,7 +588,7 @@ void ScriptTextEditor::_bind_methods() { } ScriptTextEditor::ScriptTextEditor() { - + get_text_edit()->set_breakpoint_gutter_width(12); } /*** SCRIPT EDITOR ******/ @@ -1405,18 +1407,19 @@ void ScriptEditor::_menu_option(int p_option) { } break; case SEARCH_FIND: { - find_replace_dialog->set_text_edit(current->get_text_edit()); - find_replace_dialog->popup_search(); + current->get_find_replace_bar()->popup_search(); } break; case SEARCH_FIND_NEXT: { - find_replace_dialog->set_text_edit(current->get_text_edit()); - find_replace_dialog->search_next(); + current->get_find_replace_bar()->search_next(); + } break; + case SEARCH_FIND_PREV: { + + current->get_find_replace_bar()->search_prev(); } break; case SEARCH_REPLACE: { - find_replace_dialog->set_text_edit(current->get_text_edit()); - find_replace_dialog->popup_replace(); + current->get_find_replace_bar()->popup_replace(); } break; case SEARCH_LOCATE_FUNCTION: { @@ -1434,6 +1437,61 @@ void ScriptEditor::_menu_option(int p_option) { current->get_text_edit()->set_line_as_breakpoint(line,dobreak); get_debugger()->set_breakpoint(current->get_edited_script()->get_path(),line+1,dobreak); } break; + case DEBUG_REMOVE_ALL_BREAKPOINTS: { + List<int> bpoints; + current->get_text_edit()->get_breakpoints(&bpoints); + + for(List<int>::Element *E=bpoints.front();E;E=E->next()) { + int line = E->get(); + bool dobreak = !current->get_text_edit()->is_line_set_as_breakpoint(line); + current->get_text_edit()->set_line_as_breakpoint(line,dobreak); + get_debugger()->set_breakpoint(current->get_edited_script()->get_path(),line+1,dobreak); + } + } + case DEBUG_GOTO_NEXT_BREAKPOINT: { + List<int> bpoints; + current->get_text_edit()->get_breakpoints(&bpoints); + if (bpoints.size() <= 0) { + return; + } + + int line=current->get_text_edit()->cursor_get_line(); + // wrap around + if (line >= bpoints[bpoints.size() - 1]) { + current->get_text_edit()->cursor_set_line(bpoints[0]); + } else { + for(List<int>::Element *E=bpoints.front();E;E=E->next()) { + int bline = E->get(); + if (bline > line) { + current->get_text_edit()->cursor_set_line(bline); + return; + } + } + } + + } break; + case DEBUG_GOTO_PREV_BREAKPOINT: { + List<int> bpoints; + current->get_text_edit()->get_breakpoints(&bpoints); + if (bpoints.size() <= 0) { + return; + } + + int line=current->get_text_edit()->cursor_get_line(); + // wrap around + if (line <= bpoints[0]) { + current->get_text_edit()->cursor_set_line(bpoints[bpoints.size() - 1]); + } else { + for(List<int>::Element *E=bpoints.back();E;E=E->prev()) { + int bline = E->get(); + if (bline < line) { + current->get_text_edit()->cursor_set_line(bline); + return; + } + } + } + + } break; case DEBUG_NEXT: { if (debugger) @@ -2034,6 +2092,7 @@ void ScriptEditor::edit(const Ref<Script>& p_script) { ste->get_text_edit()->set_highlight_all_occurrences(EditorSettings::get_singleton()->get("text_editor/highlight_all_occurrences")); ste->get_text_edit()->cursor_set_blink_enabled(EditorSettings::get_singleton()->get("text_editor/caret_blink")); ste->get_text_edit()->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/caret_blink_speed")); + ste->get_text_edit()->set_draw_breakpoint_gutter(EditorSettings::get_singleton()->get("text_editor/show_breakpoint_gutter")); ste->get_text_edit()->set_callhint_settings( EditorSettings::get_singleton()->get("text_editor/put_callhint_tooltip_below_current_line"), EditorSettings::get_singleton()->get("text_editor/callhint_tooltip_offset")); @@ -2190,6 +2249,7 @@ void ScriptEditor::_editor_settings_changed() { ste->get_text_edit()->set_highlight_all_occurrences(EditorSettings::get_singleton()->get("text_editor/highlight_all_occurrences")); ste->get_text_edit()->cursor_set_blink_enabled(EditorSettings::get_singleton()->get("text_editor/caret_blink")); ste->get_text_edit()->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/caret_blink_speed")); + ste->get_text_edit()->set_draw_breakpoint_gutter(EditorSettings::get_singleton()->get("text_editor/show_breakpoint_gutter")); } } @@ -2531,6 +2591,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { search_menu->set_text(TTR("Search")); search_menu->get_popup()->add_item(TTR("Find.."),SEARCH_FIND,KEY_MASK_CMD|KEY_F); search_menu->get_popup()->add_item(TTR("Find Next"),SEARCH_FIND_NEXT,KEY_F3); + search_menu->get_popup()->add_item(TTR("Find Previous"),SEARCH_FIND_PREV,KEY_MASK_SHIFT|KEY_F3); search_menu->get_popup()->add_item(TTR("Replace.."),SEARCH_REPLACE,KEY_MASK_CMD|KEY_R); search_menu->get_popup()->add_separator(); search_menu->get_popup()->add_item(TTR("Goto Function.."),SEARCH_LOCATE_FUNCTION,KEY_MASK_SHIFT|KEY_MASK_CMD|KEY_F); @@ -2550,6 +2611,9 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { menu_hb->add_child(debug_menu); debug_menu->set_text(TTR("Debug")); debug_menu->get_popup()->add_item(TTR("Toggle Breakpoint"),DEBUG_TOGGLE_BREAKPOINT,KEY_F9); + debug_menu->get_popup()->add_item(TTR("Remove All Breakpoints"), DEBUG_REMOVE_ALL_BREAKPOINTS, KEY_MASK_CTRL|KEY_MASK_SHIFT|KEY_F9); + debug_menu->get_popup()->add_item(TTR("Goto Next Breakpoint"), DEBUG_GOTO_NEXT_BREAKPOINT, KEY_MASK_CTRL|KEY_PERIOD); + debug_menu->get_popup()->add_item(TTR("Goto Previous Breakpoint"), DEBUG_GOTO_PREV_BREAKPOINT, KEY_MASK_CTRL|KEY_COMMA); debug_menu->get_popup()->add_separator(); debug_menu->get_popup()->add_item(TTR("Step Over"),DEBUG_NEXT,KEY_F10); debug_menu->get_popup()->add_item(TTR("Step Into"),DEBUG_STEP,KEY_F11); @@ -2635,9 +2699,6 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { tab_container->connect("tab_changed", this,"_tab_changed"); - find_replace_dialog = memnew(FindReplaceDialog); - add_child(find_replace_dialog); - erase_tab_confirm = memnew( ConfirmationDialog ); add_child(erase_tab_confirm); erase_tab_confirm->connect("confirmed", this,"_close_current_tab"); diff --git a/tools/editor/plugins/script_editor_plugin.h b/tools/editor/plugins/script_editor_plugin.h index 20e0b621c4..cbcfd9a77e 100644 --- a/tools/editor/plugins/script_editor_plugin.h +++ b/tools/editor/plugins/script_editor_plugin.h @@ -144,6 +144,7 @@ class ScriptEditor : public VBoxContainer { EDIT_CLONE_DOWN, SEARCH_FIND, SEARCH_FIND_NEXT, + SEARCH_FIND_PREV, SEARCH_REPLACE, SEARCH_LOCATE_FUNCTION, SEARCH_GOTO_LINE, @@ -151,6 +152,9 @@ class ScriptEditor : public VBoxContainer { SEARCH_CLASSES, SEARCH_WEBSITE, DEBUG_TOGGLE_BREAKPOINT, + DEBUG_REMOVE_ALL_BREAKPOINTS, + DEBUG_GOTO_NEXT_BREAKPOINT, + DEBUG_GOTO_PREV_BREAKPOINT, DEBUG_NEXT, DEBUG_STEP, DEBUG_BREAK, @@ -184,7 +188,6 @@ class ScriptEditor : public VBoxContainer { HSplitContainer *script_split; TabContainer *tab_container; EditorFileDialog *file_dialog; - FindReplaceDialog *find_replace_dialog; GotoLineDialog *goto_line_dialog; ConfirmationDialog *erase_tab_confirm; ScriptCreateDialog *script_create_dialog; diff --git a/tools/editor/plugins/shader_editor_plugin.cpp b/tools/editor/plugins/shader_editor_plugin.cpp index cc121d6c6f..0ca6a069bc 100644 --- a/tools/editor/plugins/shader_editor_plugin.cpp +++ b/tools/editor/plugins/shader_editor_plugin.cpp @@ -90,6 +90,8 @@ void ShaderTextEditor::_load_theme_settings() { get_text_edit()->add_color_override("member_variable_color",EDITOR_DEF("text_editor/member_variable_color",Color(0.9,0.3,0.3))); get_text_edit()->add_color_override("mark_color", EDITOR_DEF("text_editor/mark_color", Color(1.0,0.4,0.4,0.4))); get_text_edit()->add_color_override("breakpoint_color", EDITOR_DEF("text_editor/breakpoint_color", Color(0.8,0.8,0.4,0.2))); + get_text_edit()->add_color_override("search_result_color",EDITOR_DEF("text_editor/search_result_color",Color(0.05,0.25,0.05,1))); + get_text_edit()->add_color_override("search_result_border_color",EDITOR_DEF("text_editor/search_result_border_color",Color(0.1,0.45,0.1,1))); Color keyword_color= EDITOR_DEF("text_editor/keyword_color",Color(0.5,0.0,0.2)); @@ -212,18 +214,19 @@ void ShaderEditor::_menu_option(int p_option) { } break; case SEARCH_FIND: { - find_replace_dialog->set_text_edit(current->get_text_edit()); - find_replace_dialog->popup_search(); + current->get_find_replace_bar()->popup_search(); } break; case SEARCH_FIND_NEXT: { - find_replace_dialog->set_text_edit(current->get_text_edit()); - find_replace_dialog->search_next(); + current->get_find_replace_bar()->search_next(); + } break; + case SEARCH_FIND_PREV: { + + current->get_find_replace_bar()->search_prev(); } break; case SEARCH_REPLACE: { - find_replace_dialog->set_text_edit(current->get_text_edit()); - find_replace_dialog->popup_replace(); + current->get_find_replace_bar()->popup_replace(); } break; // case SEARCH_LOCATE_SYMBOL: { @@ -507,6 +510,7 @@ ShaderEditor::ShaderEditor() { search_menu->set_text(TTR("Search")); search_menu->get_popup()->add_item(TTR("Find.."),SEARCH_FIND,KEY_MASK_CMD|KEY_F); search_menu->get_popup()->add_item(TTR("Find Next"),SEARCH_FIND_NEXT,KEY_F3); + search_menu->get_popup()->add_item(TTR("Find Previous"),SEARCH_FIND_PREV,KEY_MASK_SHIFT|KEY_F3); search_menu->get_popup()->add_item(TTR("Replace.."),SEARCH_REPLACE,KEY_MASK_CMD|KEY_R); search_menu->get_popup()->add_separator(); // search_menu->get_popup()->add_item("Locate Symbol..",SEARCH_LOCATE_SYMBOL,KEY_MASK_CMD|KEY_K); @@ -516,9 +520,6 @@ ShaderEditor::ShaderEditor() { tab_container->connect("tab_changed", this,"_tab_changed"); - find_replace_dialog = memnew(FindReplaceDialog); - add_child(find_replace_dialog); - erase_tab_confirm = memnew( ConfirmationDialog ); add_child(erase_tab_confirm); erase_tab_confirm->connect("confirmed", this,"_close_current_tab"); diff --git a/tools/editor/plugins/shader_editor_plugin.h b/tools/editor/plugins/shader_editor_plugin.h index e10c10a446..9219a1fbc2 100644 --- a/tools/editor/plugins/shader_editor_plugin.h +++ b/tools/editor/plugins/shader_editor_plugin.h @@ -76,6 +76,7 @@ class ShaderEditor : public Control { EDIT_SELECT_ALL, SEARCH_FIND, SEARCH_FIND_NEXT, + SEARCH_FIND_PREV, SEARCH_REPLACE, //SEARCH_LOCATE_SYMBOL, SEARCH_GOTO_LINE, @@ -88,7 +89,6 @@ class ShaderEditor : public Control { uint64_t idle; TabContainer *tab_container; - FindReplaceDialog *find_replace_dialog; GotoLineDialog *goto_line_dialog; ConfirmationDialog *erase_tab_confirm; diff --git a/tools/editor/plugins/tile_map_editor_plugin.cpp b/tools/editor/plugins/tile_map_editor_plugin.cpp index a5147851ac..6d5f2a519c 100644 --- a/tools/editor/plugins/tile_map_editor_plugin.cpp +++ b/tools/editor/plugins/tile_map_editor_plugin.cpp @@ -205,7 +205,9 @@ void TileMapEditor::_update_palette() { if (tiles.empty()) return; + palette->set_max_columns(0); + palette->add_constant_override("hseparation", 6); palette->set_icon_mode(ItemList::ICON_MODE_TOP); palette->set_max_text_lines(2); @@ -239,6 +241,8 @@ void TileMapEditor::_update_palette() { palette->set_item_metadata(palette->get_item_count()-1, E->get()); } + + palette->set_same_column_width(true); if (selected != -1) set_selected_tile(selected); @@ -1210,10 +1214,7 @@ void TileMapEditor::_tileset_settings_changed() { void TileMapEditor::_icon_size_changed(float p_value) { if (node) { - Size2 size = node->get_cell_size() * p_value; - palette->set_min_icon_size(size + Size2(4, 0)); //4px gap between tiles - palette->set_icon_stretch_to_max_size(true); - palette->set_max_icon_size(size); + palette->set_icon_scale(p_value); _update_palette(); } } diff --git a/tools/editor/project_export.cpp b/tools/editor/project_export.cpp index dea15ebd35..2045f2c030 100644 --- a/tools/editor/project_export.cpp +++ b/tools/editor/project_export.cpp @@ -1427,7 +1427,7 @@ ProjectExportDialog::ProjectExportDialog(EditorNode *p_editor) { sample_vbox->add_margin_child(TTR("Trailing Silence:"),sample_trim); script_vbox = memnew( VBoxContainer ); - script_vbox->set_name("Script"); + script_vbox->set_name(TTR("Script")); sections->add_child(script_vbox); script_mode = memnew( OptionButton ); script_vbox->add_margin_child(TTR("Script Export Mode:"),script_mode); diff --git a/tools/editor/project_manager.cpp b/tools/editor/project_manager.cpp index c06a8cd081..af57d5264e 100644 --- a/tools/editor/project_manager.cpp +++ b/tools/editor/project_manager.cpp @@ -1016,7 +1016,7 @@ void ProjectListFilter::_setup_filters() { filter_option->clear(); filter_option->add_item(TTR("Name")); - filter_option->add_item("Path"); + filter_option->add_item(TTR("Path")); } void ProjectListFilter::_command(int p_command) { diff --git a/tools/editor/project_settings.cpp b/tools/editor/project_settings.cpp index 605b12c879..ed26af29f7 100644 --- a/tools/editor/project_settings.cpp +++ b/tools/editor/project_settings.cpp @@ -1761,7 +1761,7 @@ ProjectSettings::ProjectSettings(EditorData *p_data) { tmc->add_child(translation_remap_options); translation_remap_options->set_columns(2); - translation_remap_options->set_column_title(0,"Path"); + translation_remap_options->set_column_title(0,TTR("Path")); translation_remap_options->set_column_title(1,TTR("Locale")); translation_remap_options->set_column_titles_visible(true); translation_remap_options->set_column_expand(0,true); @@ -1827,7 +1827,7 @@ ProjectSettings::ProjectSettings(EditorData *p_data) { autoload_list->set_column_title(0,TTR("Name")); autoload_list->set_column_expand(0,true); autoload_list->set_column_min_width(0,100); - autoload_list->set_column_title(1,"Path"); + autoload_list->set_column_title(1,TTR("Path")); autoload_list->set_column_expand(1,true); autoload_list->set_column_min_width(1,100); autoload_list->set_column_title(2,TTR("Singleton")); diff --git a/tools/editor/script_editor_debugger.cpp b/tools/editor/script_editor_debugger.cpp index 7c7801a203..bd01e62158 100644 --- a/tools/editor/script_editor_debugger.cpp +++ b/tools/editor/script_editor_debugger.cpp @@ -615,7 +615,7 @@ void ScriptEditorDebugger::_parse_message(const String& p_msg,const Array& p_dat bool warning = err[9]; bool e; String time = String("%d:%02d:%02d:%04d").sprintf(vals,&e); - String txt=time+" - "+String(err[8]); + String txt=time+" - "+(err[8].is_zero()?String(err[7]):String(err[8])); String tooltip=TTR("Type:")+String(warning?TTR("Warning"):TTR("Error")); tooltip+="\n"+TTR("Description:")+" "+String(err[8]); |