diff options
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/file_dialog.cpp | 11 | ||||
-rw-r--r-- | scene/gui/file_dialog.h | 3 | ||||
-rw-r--r-- | scene/gui/line_edit.cpp | 2 | ||||
-rw-r--r-- | scene/gui/rich_text_label.cpp | 10 | ||||
-rw-r--r-- | scene/gui/text_edit.cpp | 13 | ||||
-rw-r--r-- | scene/gui/text_edit.h | 2 |
6 files changed, 31 insertions, 10 deletions
diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index 8e428fd71c..22e3a81e52 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -46,6 +46,11 @@ VBoxContainer *FileDialog::get_vbox() { } void FileDialog::_notification(int p_what) { + + if (p_what==NOTIFICATION_ENTER_TREE) { + + refresh->set_icon(get_icon("Reload","EditorIcons")); + } if (p_what==NOTIFICATION_DRAW) { @@ -618,7 +623,7 @@ void FileDialog::_update_drives() { } } -bool FileDialog::default_show_hidden_files=true; +bool FileDialog::default_show_hidden_files=false; void FileDialog::_bind_methods() { @@ -700,6 +705,10 @@ FileDialog::FileDialog() { pathhb->add_child(dir); dir->set_h_size_flags(SIZE_EXPAND_FILL); + refresh = memnew( ToolButton ); + refresh->connect("pressed",this,"_update_file_list"); + pathhb->add_child(refresh); + drives = memnew( OptionButton ); pathhb->add_child(drives); drives->connect("item_selected",this,"_select_drive"); diff --git a/scene/gui/file_dialog.h b/scene/gui/file_dialog.h index ec42c7744a..370088b215 100644 --- a/scene/gui/file_dialog.h +++ b/scene/gui/file_dialog.h @@ -34,6 +34,7 @@ #include "scene/gui/line_edit.h" #include "scene/gui/option_button.h" #include "scene/gui/dialogs.h" +#include "scene/gui/tool_button.h" #include "os/dir_access.h" #include "box_container.h" /** @@ -86,6 +87,8 @@ private: OptionButton *filter; DirAccess *dir_access; ConfirmationDialog *confirm_save; + + ToolButton *refresh; Vector<String> filters; diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 18de8ed568..10ba20a833 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -568,7 +568,7 @@ void LineEdit::set_cursor_at_pixel_pos(int p_x) { int char_w = 0; if (font != NULL) { - int char_w = font->get_char_size(text[ofs]).width; + char_w = font->get_char_size(text[ofs]).width; } pixel_ofs+=char_w; diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 3b0425b223..5abb6c1d01 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -719,7 +719,7 @@ void RichTextLabel::_input_event(InputEvent p_event) { case InputEvent::KEY: { const InputEventKey &k=p_event.key; - if (k.pressed && !k.mod.alt && !k.mod.shift && !k.mod.command && !k.mod.meta) { + if (k.pressed && !k.mod.alt && !k.mod.shift && !k.mod.meta) { bool handled=true; switch(k.scancode) { case KEY_PAGEUP: { @@ -1504,7 +1504,6 @@ Error RichTextLabel::append_bbcode(const String& p_bbcode) { void RichTextLabel::scroll_to_line(int p_line) { - p_line -= 1; ERR_FAIL_INDEX(p_line,lines.size()); _validate_line_caches(); vscroll->set_val(lines[p_line].height_accum_cache-lines[p_line].height_cache); @@ -1572,11 +1571,8 @@ bool RichTextLabel::search(const String& p_string,bool p_from_selection) { } - if (line > 1) { - line-=1; - } - - scroll_to_line(line); + line-=2; + scroll_to_line(line<0?0:line); return true; } diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 5415484009..78792dc785 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -1610,6 +1610,13 @@ void TextEdit::_input_event(const InputEvent& p_input_event) { else break; } + if(auto_indent){ + // indent once again if previous line will end with ':' + // (i.e. colon precedes current cursor position) + if(cursor.column>0 && text[cursor.line][cursor.column-1]==':') { + ins+="\t"; + } + } _insert_text_at_cursor(ins); _push_current_op(); @@ -2869,6 +2876,10 @@ bool TextEdit::is_syntax_coloring_enabled() const { return syntax_coloring; } +void TextEdit::set_auto_indent(bool p_auto_indent) { + auto_indent = p_auto_indent; +} + void TextEdit::cut() { if (!selection.active) @@ -3836,7 +3847,7 @@ TextEdit::TextEdit() { next_operation_is_complex=false; auto_brace_completion_enabled=false; brace_matching_enabled=false; - + auto_indent=false; } TextEdit::~TextEdit() diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h index 059e15dcff..91369309cf 100644 --- a/scene/gui/text_edit.h +++ b/scene/gui/text_edit.h @@ -213,6 +213,7 @@ class TextEdit : public Control { bool auto_brace_completion_enabled; bool brace_matching_enabled; + bool auto_indent; bool cut_copy_line; uint64_t last_dblclk; @@ -323,6 +324,7 @@ public: brace_matching_enabled=p_enabled; update(); } + void set_auto_indent(bool p_auto_indent); void cursor_set_column(int p_col, bool p_adjust_viewport=true); void cursor_set_line(int p_row, bool p_adjust_viewport=true); |