diff options
-rw-r--r-- | doc/classes/EditorFileDialog.xml | 10 | ||||
-rw-r--r-- | editor/editor_file_dialog.cpp | 17 | ||||
-rw-r--r-- | editor/editor_file_dialog.h | 2 | ||||
-rw-r--r-- | platform/linuxbsd/x11/key_mapping_x11.cpp | 4 | ||||
-rw-r--r-- | platform/macos/key_mapping_macos.mm | 4 | ||||
-rw-r--r-- | platform/windows/display_server_windows.cpp | 2 | ||||
-rw-r--r-- | platform/windows/key_mapping_windows.cpp | 4 | ||||
-rw-r--r-- | scene/gui/label.cpp | 5 |
8 files changed, 37 insertions, 11 deletions
diff --git a/doc/classes/EditorFileDialog.xml b/doc/classes/EditorFileDialog.xml index 29a8f470a1..7f8808acc7 100644 --- a/doc/classes/EditorFileDialog.xml +++ b/doc/classes/EditorFileDialog.xml @@ -25,6 +25,13 @@ Removes all filters except for "All Files (*)". </description> </method> + <method name="get_line_edit"> + <return type="LineEdit" /> + <description> + Returns the LineEdit for the selected file. + [b]Warning:[/b] This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their [member CanvasItem.visible] property. + </description> + </method> <method name="get_vbox"> <return type="VBoxContainer" /> <description> @@ -62,6 +69,9 @@ <member name="file_mode" type="int" setter="set_file_mode" getter="get_file_mode" enum="EditorFileDialog.FileMode" default="4"> The dialog's open or save mode, which affects the selection behavior. See [enum FileMode] </member> + <member name="filters" type="PackedStringArray" setter="set_filters" getter="get_filters" default="PackedStringArray()"> + The available file type filters. For example, this shows only [code].png[/code] and [code].gd[/code] files: [code]set_filters(PackedStringArray(["*.png ; PNG Images","*.gd ; GDScript Files"]))[/code]. Multiple file types can also be specified in a single filter. [code]"*.png, *.jpg, *.jpeg ; Supported Images"[/code] will show both PNG and JPEG files when selected. + </member> <member name="show_hidden_files" type="bool" setter="set_show_hidden_files" getter="is_showing_hidden_files" default="false"> If [code]true[/code], hidden files and directories will be visible in the [EditorFileDialog]. This property is synchronized with [member EditorSettings.filesystem/file_dialog/show_hidden_files]. </member> diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp index 50826f572a..b4ef719ab0 100644 --- a/editor/editor_file_dialog.cpp +++ b/editor/editor_file_dialog.cpp @@ -1015,6 +1015,19 @@ void EditorFileDialog::add_filter(const String &p_filter, const String &p_descri invalidate(); } +void EditorFileDialog::set_filters(const Vector<String> &p_filters) { + if (filters == p_filters) { + return; + } + filters = p_filters; + update_filters(); + invalidate(); +} + +Vector<String> EditorFileDialog::get_filters() const { + return filters; +} + String EditorFileDialog::get_current_dir() const { return dir_access->get_current_dir(); } @@ -1570,6 +1583,8 @@ void EditorFileDialog::_bind_methods() { ClassDB::bind_method(D_METHOD("clear_filters"), &EditorFileDialog::clear_filters); ClassDB::bind_method(D_METHOD("add_filter", "filter", "description"), &EditorFileDialog::add_filter, DEFVAL("")); + ClassDB::bind_method(D_METHOD("set_filters", "filters"), &EditorFileDialog::set_filters); + ClassDB::bind_method(D_METHOD("get_filters"), &EditorFileDialog::get_filters); ClassDB::bind_method(D_METHOD("get_current_dir"), &EditorFileDialog::get_current_dir); ClassDB::bind_method(D_METHOD("get_current_file"), &EditorFileDialog::get_current_file); ClassDB::bind_method(D_METHOD("get_current_path"), &EditorFileDialog::get_current_path); @@ -1579,6 +1594,7 @@ void EditorFileDialog::_bind_methods() { ClassDB::bind_method(D_METHOD("set_file_mode", "mode"), &EditorFileDialog::set_file_mode); ClassDB::bind_method(D_METHOD("get_file_mode"), &EditorFileDialog::get_file_mode); ClassDB::bind_method(D_METHOD("get_vbox"), &EditorFileDialog::get_vbox); + ClassDB::bind_method(D_METHOD("get_line_edit"), &EditorFileDialog::get_line_edit); ClassDB::bind_method(D_METHOD("set_access", "access"), &EditorFileDialog::set_access); ClassDB::bind_method(D_METHOD("get_access"), &EditorFileDialog::get_access); ClassDB::bind_method(D_METHOD("set_show_hidden_files", "show"), &EditorFileDialog::set_show_hidden_files); @@ -1605,6 +1621,7 @@ void EditorFileDialog::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::STRING, "current_dir", PROPERTY_HINT_DIR, "", PROPERTY_USAGE_NONE), "set_current_dir", "get_current_dir"); ADD_PROPERTY(PropertyInfo(Variant::STRING, "current_file", PROPERTY_HINT_FILE, "*", PROPERTY_USAGE_NONE), "set_current_file", "get_current_file"); ADD_PROPERTY(PropertyInfo(Variant::STRING, "current_path", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE), "set_current_path", "get_current_path"); + ADD_PROPERTY(PropertyInfo(Variant::PACKED_STRING_ARRAY, "filters"), "set_filters", "get_filters"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "show_hidden_files"), "set_show_hidden_files", "is_showing_hidden_files"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "disable_overwrite_warning"), "set_disable_overwrite_warning", "is_overwrite_warning_disabled"); diff --git a/editor/editor_file_dialog.h b/editor/editor_file_dialog.h index 1944cacf70..e3515f8073 100644 --- a/editor/editor_file_dialog.h +++ b/editor/editor_file_dialog.h @@ -242,6 +242,8 @@ public: void popup_file_dialog(); void clear_filters(); void add_filter(const String &p_filter, const String &p_description = ""); + void set_filters(const Vector<String> &p_filters); + Vector<String> get_filters() const; void set_enable_multiple_selection(bool p_enable); Vector<String> get_selected_files() const; diff --git a/platform/linuxbsd/x11/key_mapping_x11.cpp b/platform/linuxbsd/x11/key_mapping_x11.cpp index e5eba6ccad..f21c151288 100644 --- a/platform/linuxbsd/x11/key_mapping_x11.cpp +++ b/platform/linuxbsd/x11/key_mapping_x11.cpp @@ -217,8 +217,8 @@ void KeyMappingX11::initialize() { scancode_map[0x1F] = Key::I; scancode_map[0x20] = Key::O; scancode_map[0x21] = Key::P; - scancode_map[0x22] = Key::BRACELEFT; - scancode_map[0x23] = Key::BRACERIGHT; + scancode_map[0x22] = Key::BRACKETLEFT; + scancode_map[0x23] = Key::BRACKETRIGHT; scancode_map[0x24] = Key::ENTER; scancode_map[0x25] = Key::CTRL; scancode_map[0x26] = Key::A; diff --git a/platform/macos/key_mapping_macos.mm b/platform/macos/key_mapping_macos.mm index 31b71ac1b8..c3f147e33f 100644 --- a/platform/macos/key_mapping_macos.mm +++ b/platform/macos/key_mapping_macos.mm @@ -98,10 +98,10 @@ void KeyMappingMacOS::initialize() { keysym_map[0x1b] = Key::MINUS; keysym_map[0x1c] = Key::KEY_8; keysym_map[0x1d] = Key::KEY_0; - keysym_map[0x1e] = Key::BRACERIGHT; + keysym_map[0x1e] = Key::BRACKETRIGHT; keysym_map[0x1f] = Key::O; keysym_map[0x20] = Key::U; - keysym_map[0x21] = Key::BRACELEFT; + keysym_map[0x21] = Key::BRACKETLEFT; keysym_map[0x22] = Key::I; keysym_map[0x23] = Key::P; keysym_map[0x24] = Key::ENTER; diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp index d2889a3442..92af3fef69 100644 --- a/platform/windows/display_server_windows.cpp +++ b/platform/windows/display_server_windows.cpp @@ -4237,7 +4237,7 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win window_position = screen_get_position(p_screen) + (screen_get_size(p_screen) - p_resolution) / 2; } - WindowID main_window = _create_window(p_mode, p_vsync_mode, 0, Rect2i(window_position, p_resolution)); + WindowID main_window = _create_window(p_mode, p_vsync_mode, p_flags, Rect2i(window_position, p_resolution)); ERR_FAIL_COND_MSG(main_window == INVALID_WINDOW_ID, "Failed to create main window."); joypad = new JoypadWindows(&windows[MAIN_WINDOW_ID].hWnd); diff --git a/platform/windows/key_mapping_windows.cpp b/platform/windows/key_mapping_windows.cpp index d43f74126d..aa393464b6 100644 --- a/platform/windows/key_mapping_windows.cpp +++ b/platform/windows/key_mapping_windows.cpp @@ -257,8 +257,8 @@ void KeyMappingWindows::initialize() { scansym_map[0x17] = Key::I; scansym_map[0x18] = Key::O; scansym_map[0x19] = Key::P; - scansym_map[0x1A] = Key::BRACELEFT; - scansym_map[0x1B] = Key::BRACERIGHT; + scansym_map[0x1A] = Key::BRACKETLEFT; + scansym_map[0x1B] = Key::BRACKETRIGHT; scansym_map[0x1C] = Key::ENTER; scansym_map[0x1D] = Key::CTRL; scansym_map[0x1E] = Key::A; diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp index b861d7af01..81426158a2 100644 --- a/scene/gui/label.cpp +++ b/scene/gui/label.cpp @@ -209,10 +209,7 @@ bool Label::_shape() { // Fill after min_size calculation. - int visible_lines = lines_rid.size(); - if (max_lines_visible >= 0 && visible_lines > max_lines_visible) { - visible_lines = max_lines_visible; - } + int visible_lines = get_visible_line_count(); if (autowrap_mode != TextServer::AUTOWRAP_OFF) { bool lines_hidden = visible_lines > 0 && visible_lines < lines_rid.size(); if (lines_hidden) { |