mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-02-08 09:05:54 +01:00
Reworked the wide mode setting for the filesystem dock. Now the code is more flexible and less error prone.
This commit is contained in:
parent
edb250930d
commit
4628e5354e
@ -159,12 +159,15 @@
|
|||||||
If [code]true[/code], displays folders in the FileSystem dock's bottom pane when split mode is enabled. If [code]false[/code], only files will be displayed in the bottom pane. Split mode can be toggled by pressing the icon next to the [code]res://[/code] folder path.
|
If [code]true[/code], displays folders in the FileSystem dock's bottom pane when split mode is enabled. If [code]false[/code], only files will be displayed in the bottom pane. Split mode can be toggled by pressing the icon next to the [code]res://[/code] folder path.
|
||||||
[b]Note:[/b] This setting has no effect when split mode is disabled (which is the default).
|
[b]Note:[/b] This setting has no effect when split mode is disabled (which is the default).
|
||||||
</member>
|
</member>
|
||||||
|
<member name="docks/filesystem/dock_mode" type="int" setter="" getter="">
|
||||||
|
Controls where the editor will display the FileSystem panel.
|
||||||
|
</member>
|
||||||
|
<member name="docks/filesystem/split_mode" type="int" setter="" getter="">
|
||||||
|
Controls whether the FileSystem panel can be split horizontally or vertically.
|
||||||
|
</member>
|
||||||
<member name="docks/filesystem/thumbnail_size" type="int" setter="" getter="">
|
<member name="docks/filesystem/thumbnail_size" type="int" setter="" getter="">
|
||||||
The thumbnail size to use in the FileSystem dock (in pixels). See also [member filesystem/file_dialog/thumbnail_size].
|
The thumbnail size to use in the FileSystem dock (in pixels). See also [member filesystem/file_dialog/thumbnail_size].
|
||||||
</member>
|
</member>
|
||||||
<member name="docks/filesystem/wide_bottom_panel" type="bool" setter="" getter="">
|
|
||||||
If [code]true[/code], the editor will display the FileSystem panel at the bottom as an openable panel instead of a dock.
|
|
||||||
</member>
|
|
||||||
<member name="docks/property_editor/auto_refresh_interval" type="float" setter="" getter="">
|
<member name="docks/property_editor/auto_refresh_interval" type="float" setter="" getter="">
|
||||||
The refresh interval to use for the inspector dock's properties. The effect of this setting is mainly noticeable when adjusting gizmos in the 2D/3D editor and looking at the inspector at the same time. Lower values make the inspector more often, but take up more CPU time.
|
The refresh interval to use for the inspector dock's properties. The effect of this setting is mainly noticeable when adjusting gizmos in the 2D/3D editor and looking at the inspector at the same time. Lower values make the inspector more often, but take up more CPU time.
|
||||||
</member>
|
</member>
|
||||||
|
@ -4547,6 +4547,7 @@ void EditorNode::_save_docks_to_config(Ref<ConfigFile> p_layout, const String &p
|
|||||||
p_layout->set_value(p_section, "dock_filesystem_split", filesystem_dock->get_split_offset());
|
p_layout->set_value(p_section, "dock_filesystem_split", filesystem_dock->get_split_offset());
|
||||||
p_layout->set_value(p_section, "dock_filesystem_display_mode", filesystem_dock->get_display_mode());
|
p_layout->set_value(p_section, "dock_filesystem_display_mode", filesystem_dock->get_display_mode());
|
||||||
p_layout->set_value(p_section, "dock_filesystem_file_list_display_mode", filesystem_dock->get_file_list_display_mode());
|
p_layout->set_value(p_section, "dock_filesystem_file_list_display_mode", filesystem_dock->get_file_list_display_mode());
|
||||||
|
p_layout->set_value(p_section, "dock_filesystem_split_mode", filesystem_dock->get_split_mode());
|
||||||
|
|
||||||
for (int i = 0; i < vsplits.size(); i++) {
|
for (int i = 0; i < vsplits.size(); i++) {
|
||||||
if (vsplits[i]->is_visible_in_tree()) {
|
if (vsplits[i]->is_visible_in_tree()) {
|
||||||
@ -4732,21 +4733,26 @@ void EditorNode::_load_docks_from_config(Ref<ConfigFile> p_layout, const String
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p_layout->has_section_key(p_section, "dock_filesystem_split")) {
|
|
||||||
int fs_split_ofs = p_layout->get_value(p_section, "dock_filesystem_split");
|
|
||||||
filesystem_dock->set_split_offset(fs_split_ofs);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (p_layout->has_section_key(p_section, "dock_filesystem_display_mode")) {
|
if (p_layout->has_section_key(p_section, "dock_filesystem_display_mode")) {
|
||||||
FileSystemDock::DisplayMode dock_filesystem_display_mode = FileSystemDock::DisplayMode(int(p_layout->get_value(p_section, "dock_filesystem_display_mode")));
|
FileSystemDock::DisplayMode dock_filesystem_display_mode = FileSystemDock::DisplayMode(int(p_layout->get_value(p_section, "dock_filesystem_display_mode")));
|
||||||
filesystem_dock->set_display_mode(dock_filesystem_display_mode);
|
filesystem_dock->set_display_mode(dock_filesystem_display_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (p_layout->has_section_key(p_section, "dock_filesystem_split_mode")) {
|
||||||
|
FileSystemDock::SplitMode dock_filesystem_split_mode = FileSystemDock::SplitMode(int(p_layout->get_value(p_section, "dock_filesystem_split_mode")));
|
||||||
|
filesystem_dock->set_split_mode(dock_filesystem_split_mode);
|
||||||
|
}
|
||||||
|
|
||||||
if (p_layout->has_section_key(p_section, "dock_filesystem_file_list_display_mode")) {
|
if (p_layout->has_section_key(p_section, "dock_filesystem_file_list_display_mode")) {
|
||||||
FileSystemDock::FileListDisplayMode dock_filesystem_file_list_display_mode = FileSystemDock::FileListDisplayMode(int(p_layout->get_value(p_section, "dock_filesystem_file_list_display_mode")));
|
FileSystemDock::FileListDisplayMode dock_filesystem_file_list_display_mode = FileSystemDock::FileListDisplayMode(int(p_layout->get_value(p_section, "dock_filesystem_file_list_display_mode")));
|
||||||
filesystem_dock->set_file_list_display_mode(dock_filesystem_file_list_display_mode);
|
filesystem_dock->set_file_list_display_mode(dock_filesystem_file_list_display_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (p_layout->has_section_key(p_section, "dock_filesystem_split")) {
|
||||||
|
int fs_split_ofs = p_layout->get_value(p_section, "dock_filesystem_split");
|
||||||
|
filesystem_dock->set_split_offset(fs_split_ofs);
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < vsplits.size(); i++) {
|
for (int i = 0; i < vsplits.size(); i++) {
|
||||||
if (!p_layout->has_section_key(p_section, "dock_split_" + itos(i + 1))) {
|
if (!p_layout->has_section_key(p_section, "dock_split_" + itos(i + 1))) {
|
||||||
continue;
|
continue;
|
||||||
@ -6841,7 +6847,7 @@ EditorNode::EditorNode() {
|
|||||||
filesystem_dock->connect("instance", this, "_instance_request");
|
filesystem_dock->connect("instance", this, "_instance_request");
|
||||||
filesystem_dock->connect("display_mode_changed", this, "_save_docks");
|
filesystem_dock->connect("display_mode_changed", this, "_save_docks");
|
||||||
|
|
||||||
bool filesystem_dock_wide = EDITOR_GET("docks/filesystem/wide_bottom_panel");
|
int filesystem_dock_mode = EDITOR_GET("docks/filesystem/dock_mode");
|
||||||
|
|
||||||
// Scene: Top left
|
// Scene: Top left
|
||||||
dock_slot[DOCK_SLOT_LEFT_UR]->add_child(scene_tree_dock);
|
dock_slot[DOCK_SLOT_LEFT_UR]->add_child(scene_tree_dock);
|
||||||
@ -6851,10 +6857,13 @@ EditorNode::EditorNode() {
|
|||||||
dock_slot[DOCK_SLOT_LEFT_UR]->add_child(import_dock);
|
dock_slot[DOCK_SLOT_LEFT_UR]->add_child(import_dock);
|
||||||
dock_slot[DOCK_SLOT_LEFT_UR]->set_tab_title(import_dock->get_index(), TTR("Import"));
|
dock_slot[DOCK_SLOT_LEFT_UR]->set_tab_title(import_dock->get_index(), TTR("Import"));
|
||||||
|
|
||||||
if (!filesystem_dock_wide) {
|
if (filesystem_dock_mode == static_cast<int>(FileSystemDock::DOCK_MODE_DOCK)) {
|
||||||
// FileSystem: Bottom left
|
// FileSystem: Bottom left
|
||||||
dock_slot[DOCK_SLOT_LEFT_BR]->add_child(filesystem_dock);
|
dock_slot[DOCK_SLOT_LEFT_BR]->add_child(filesystem_dock);
|
||||||
dock_slot[DOCK_SLOT_LEFT_BR]->set_tab_title(filesystem_dock->get_index(), TTR("FileSystem"));
|
dock_slot[DOCK_SLOT_LEFT_BR]->set_tab_title(filesystem_dock->get_index(), TTR("FileSystem"));
|
||||||
|
|
||||||
|
filesystem_dock->set_dock_mode(FileSystemDock::DOCK_MODE_DOCK);
|
||||||
|
filesystem_dock->set_applied_dock_mode(FileSystemDock::DOCK_MODE_DOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inspector: Full height right
|
// Inspector: Full height right
|
||||||
@ -6957,11 +6966,14 @@ EditorNode::EditorNode() {
|
|||||||
bottom_panel_raise->set_toggle_mode(true);
|
bottom_panel_raise->set_toggle_mode(true);
|
||||||
bottom_panel_raise->connect("toggled", this, "_bottom_panel_raise_toggled");
|
bottom_panel_raise->connect("toggled", this, "_bottom_panel_raise_toggled");
|
||||||
|
|
||||||
if (filesystem_dock_wide) {
|
if (filesystem_dock_mode == static_cast<int>(FileSystemDock::DOCK_MODE_BOTTOM_BAR)) {
|
||||||
filesystem_dock->set_custom_minimum_size(Size2(0, 230 * EDSCALE));
|
filesystem_dock->set_custom_minimum_size(Size2(0, 230 * EDSCALE));
|
||||||
ToolButton *fs_button = add_bottom_panel_item(TTR("FileSystem"), filesystem_dock);
|
ToolButton *fs_button = add_bottom_panel_item(TTR("FileSystem"), filesystem_dock);
|
||||||
filesystem_dock->set_bottom_panel_tool_button(fs_button);
|
filesystem_dock->set_bottom_panel_tool_button(fs_button);
|
||||||
fs_button->set_shortcut(ED_SHORTCUT("editor/toggle_filesystem_panel", TTR("Toggle FileSystem Panel"), KEY_MASK_CMD | KEY_MASK_ALT | KEY_QUOTELEFT));
|
fs_button->set_shortcut(ED_SHORTCUT("editor/toggle_filesystem_panel", TTR("Toggle FileSystem Panel"), KEY_MASK_CMD | KEY_MASK_ALT | KEY_QUOTELEFT));
|
||||||
|
|
||||||
|
filesystem_dock->set_dock_mode(FileSystemDock::DOCK_MODE_BOTTOM_BAR);
|
||||||
|
filesystem_dock->set_applied_dock_mode(FileSystemDock::DOCK_MODE_BOTTOM_BAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
log = memnew(EditorLog);
|
log = memnew(EditorLog);
|
||||||
|
@ -427,8 +427,12 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
|
|||||||
_initial_set("docks/filesystem/thumbnail_size", 64);
|
_initial_set("docks/filesystem/thumbnail_size", 64);
|
||||||
hints["docks/filesystem/thumbnail_size"] = PropertyInfo(Variant::INT, "docks/filesystem/thumbnail_size", PROPERTY_HINT_RANGE, "32,128,16");
|
hints["docks/filesystem/thumbnail_size"] = PropertyInfo(Variant::INT, "docks/filesystem/thumbnail_size", PROPERTY_HINT_RANGE, "32,128,16");
|
||||||
_initial_set("docks/filesystem/always_show_folders", true);
|
_initial_set("docks/filesystem/always_show_folders", true);
|
||||||
_initial_set("docks/filesystem/wide_bottom_panel", false);
|
|
||||||
hints["docks/filesystem/wide_bottom_panel"] = PropertyInfo(Variant::BOOL, "docks/filesystem/wide_bottom_panel", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
|
_initial_set("docks/filesystem/dock_mode", 0);
|
||||||
|
hints["docks/filesystem/dock_mode"] = PropertyInfo(Variant::INT, "docks/filesystem/dock_mode", PROPERTY_HINT_ENUM, "Dock,Bottom Bar", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
|
||||||
|
|
||||||
|
_initial_set("docks/filesystem/split_mode", 0);
|
||||||
|
hints["docks/filesystem/split_mode"] = PropertyInfo(Variant::INT, "docks/filesystem/split_mode", PROPERTY_HINT_ENUM, "Vertical,Horizontal", PROPERTY_USAGE_DEFAULT);
|
||||||
|
|
||||||
// Property editor
|
// Property editor
|
||||||
_initial_set("docks/property_editor/auto_refresh_interval", 0.3);
|
_initial_set("docks/property_editor/auto_refresh_interval", 0.3);
|
||||||
@ -641,9 +645,9 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
|
|||||||
_initial_set("editors/visual_editors/minimap_opacity", 0.85);
|
_initial_set("editors/visual_editors/minimap_opacity", 0.85);
|
||||||
hints["editors/visual_editors/minimap_opacity"] = PropertyInfo(Variant::REAL, "editors/visual_editors/minimap_opacity", PROPERTY_HINT_RANGE, "0.0,1.0,0.01", PROPERTY_USAGE_DEFAULT);
|
hints["editors/visual_editors/minimap_opacity"] = PropertyInfo(Variant::REAL, "editors/visual_editors/minimap_opacity", PROPERTY_HINT_RANGE, "0.0,1.0,0.01", PROPERTY_USAGE_DEFAULT);
|
||||||
|
|
||||||
/* Run */
|
/* Run */
|
||||||
|
|
||||||
// Window placement
|
// Window placement
|
||||||
_initial_set("run/window_placement/rect", 1);
|
_initial_set("run/window_placement/rect", 1);
|
||||||
hints["run/window_placement/rect"] = PropertyInfo(Variant::INT, "run/window_placement/rect", PROPERTY_HINT_ENUM, "Top Left,Centered,Custom Position,Force Maximized,Force Fullscreen");
|
hints["run/window_placement/rect"] = PropertyInfo(Variant::INT, "run/window_placement/rect", PROPERTY_HINT_ENUM, "Top Left,Centered,Custom Position,Force Maximized,Force Fullscreen");
|
||||||
String screen_hints = "Same as Editor,Previous Monitor,Next Monitor";
|
String screen_hints = "Same as Editor,Previous Monitor,Next Monitor";
|
||||||
|
@ -190,11 +190,6 @@ bool FileSystemDock::_create_tree(TreeItem *p_parent, EditorFileSystemDirectory
|
|||||||
subdirectory_item->select(0);
|
subdirectory_item->select(0);
|
||||||
subdirectory_item->set_as_cursor(0);
|
subdirectory_item->set_as_cursor(0);
|
||||||
}
|
}
|
||||||
} else if (display_mode == DISPLAY_MODE_WIDE) {
|
|
||||||
if (lpath.get_base_dir() == path.get_base_dir()) {
|
|
||||||
subdirectory_item->select(0);
|
|
||||||
subdirectory_item->set_as_cursor(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searched_string.length() > 0) {
|
if (searched_string.length() > 0) {
|
||||||
@ -334,34 +329,17 @@ void FileSystemDock::_update_tree(const Vector<String> &p_uncollapsed_paths, boo
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FileSystemDock::set_display_mode(DisplayMode p_display_mode) {
|
void FileSystemDock::set_display_mode(DisplayMode p_display_mode) {
|
||||||
if (display_mode != DISPLAY_MODE_WIDE && p_display_mode != DISPLAY_MODE_WIDE) {
|
display_mode = p_display_mode;
|
||||||
display_mode = p_display_mode;
|
_update_display_mode(false);
|
||||||
_update_display_mode(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileSystemDock::_update_display_mode(bool p_force) {
|
void FileSystemDock::_update_display_mode(bool p_force) {
|
||||||
if (old_display_mode == DISPLAY_MODE_WIDE || display_mode == DISPLAY_MODE_WIDE) {
|
|
||||||
// Changing between wide and normal needs restart, ignore
|
|
||||||
|
|
||||||
if (p_force || old_display_mode != display_mode) {
|
|
||||||
tree->ensure_cursor_is_visible();
|
|
||||||
_update_tree(_compute_uncollapsed_paths());
|
|
||||||
_update_file_list(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
old_display_mode = display_mode;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Compute the new display mode.
|
// Compute the new display mode.
|
||||||
if (p_force || old_display_mode != display_mode) {
|
if (p_force || old_display_mode != display_mode) {
|
||||||
|
button_toggle_display_mode->set_pressed_no_signal(display_mode == DISPLAY_MODE_SPLIT);
|
||||||
|
|
||||||
switch (display_mode) {
|
switch (display_mode) {
|
||||||
case DISPLAY_MODE_TREE_ONLY:
|
case DISPLAY_MODE_TREE_ONLY:
|
||||||
button_toggle_display_mode->set_pressed(display_mode == DISPLAY_MODE_SPLIT);
|
|
||||||
button_toggle_display_mode->show();
|
|
||||||
|
|
||||||
tree->show();
|
tree->show();
|
||||||
tree->set_v_size_flags(SIZE_EXPAND_FILL);
|
tree->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||||
toolbar2_hbc->show();
|
toolbar2_hbc->show();
|
||||||
@ -371,9 +349,6 @@ void FileSystemDock::_update_display_mode(bool p_force) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case DISPLAY_MODE_SPLIT:
|
case DISPLAY_MODE_SPLIT:
|
||||||
button_toggle_display_mode->set_pressed(display_mode == DISPLAY_MODE_SPLIT);
|
|
||||||
button_toggle_display_mode->show();
|
|
||||||
|
|
||||||
tree->show();
|
tree->show();
|
||||||
tree->set_v_size_flags(SIZE_EXPAND_FILL);
|
tree->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||||
tree->ensure_cursor_is_visible();
|
tree->ensure_cursor_is_visible();
|
||||||
@ -383,9 +358,6 @@ void FileSystemDock::_update_display_mode(bool p_force) {
|
|||||||
file_list_vb->show();
|
file_list_vb->show();
|
||||||
_update_file_list(true);
|
_update_file_list(true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DISPLAY_MODE_WIDE:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
old_display_mode = display_mode;
|
old_display_mode = display_mode;
|
||||||
}
|
}
|
||||||
@ -1038,11 +1010,9 @@ void FileSystemDock::_preview_invalidated(const String &p_path) {
|
|||||||
void FileSystemDock::_fs_changed() {
|
void FileSystemDock::_fs_changed() {
|
||||||
button_hist_prev->set_disabled(history_pos == 0);
|
button_hist_prev->set_disabled(history_pos == 0);
|
||||||
button_hist_next->set_disabled(history_pos == history.size() - 1);
|
button_hist_next->set_disabled(history_pos == history.size() - 1);
|
||||||
scanning_vb->hide();
|
|
||||||
|
|
||||||
if (split_box) {
|
scanning_vb->hide();
|
||||||
split_box->show();
|
split_box->show();
|
||||||
}
|
|
||||||
|
|
||||||
if (tree->is_visible()) {
|
if (tree->is_visible()) {
|
||||||
_update_tree(_compute_uncollapsed_paths());
|
_update_tree(_compute_uncollapsed_paths());
|
||||||
@ -1059,11 +1029,9 @@ void FileSystemDock::_set_scanning_mode() {
|
|||||||
button_hist_prev->set_disabled(true);
|
button_hist_prev->set_disabled(true);
|
||||||
button_hist_next->set_disabled(true);
|
button_hist_next->set_disabled(true);
|
||||||
|
|
||||||
if (split_box) {
|
split_box->hide();
|
||||||
split_box->hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
scanning_vb->show();
|
scanning_vb->show();
|
||||||
|
|
||||||
set_process(true);
|
set_process(true);
|
||||||
if (EditorFileSystem::get_singleton()->is_scanning()) {
|
if (EditorFileSystem::get_singleton()->is_scanning()) {
|
||||||
scanning_progress->set_value(EditorFileSystem::get_singleton()->get_scanning_progress() * 100);
|
scanning_progress->set_value(EditorFileSystem::get_singleton()->get_scanning_progress() * 100);
|
||||||
@ -1994,8 +1962,6 @@ void FileSystemDock::_focus_current_search_box() {
|
|||||||
current_search_box = tree_search_box;
|
current_search_box = tree_search_box;
|
||||||
} else if (display_mode == DISPLAY_MODE_SPLIT) {
|
} else if (display_mode == DISPLAY_MODE_SPLIT) {
|
||||||
current_search_box = file_list_search_box;
|
current_search_box = file_list_search_box;
|
||||||
} else if (display_mode == DISPLAY_MODE_WIDE) {
|
|
||||||
current_search_box = file_list_search_box;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current_search_box) {
|
if (current_search_box) {
|
||||||
@ -2027,10 +1993,6 @@ void FileSystemDock::_search_changed(const String &p_text, const Control *p_from
|
|||||||
_update_file_list(false);
|
_update_file_list(false);
|
||||||
_update_tree(searched_string.length() == 0 ? uncollapsed_paths_before_search : Vector<String>(), false, false, unfold_path);
|
_update_tree(searched_string.length() == 0 ? uncollapsed_paths_before_search : Vector<String>(), false, false, unfold_path);
|
||||||
} break;
|
} break;
|
||||||
case DISPLAY_MODE_WIDE: {
|
|
||||||
_update_file_list(false);
|
|
||||||
_update_tree(searched_string.length() == 0 ? uncollapsed_paths_before_search : Vector<String>(), false, false, unfold_path);
|
|
||||||
} break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2040,11 +2002,6 @@ void FileSystemDock::_rescan() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FileSystemDock::_toggle_split_mode(bool p_active) {
|
void FileSystemDock::_toggle_split_mode(bool p_active) {
|
||||||
if (display_mode == DISPLAY_MODE_WIDE) {
|
|
||||||
//shouldn't happen
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
set_display_mode(p_active ? DISPLAY_MODE_SPLIT : DISPLAY_MODE_TREE_ONLY);
|
set_display_mode(p_active ? DISPLAY_MODE_SPLIT : DISPLAY_MODE_TREE_ONLY);
|
||||||
emit_signal("display_mode_changed");
|
emit_signal("display_mode_changed");
|
||||||
}
|
}
|
||||||
@ -2065,6 +2022,27 @@ void FileSystemDock::set_file_list_display_mode(FileListDisplayMode p_mode) {
|
|||||||
_toggle_file_display();
|
_toggle_file_display();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FileSystemDock::set_dock_mode(DockMode p_dock_mode) {
|
||||||
|
dock_mode = p_dock_mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FileSystemDock::set_applied_dock_mode(DockMode p_dock_mode) {
|
||||||
|
applied_dock_mode = p_dock_mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FileSystemDock::set_split_mode(SplitMode p_split_mode) {
|
||||||
|
split_mode = p_split_mode;
|
||||||
|
|
||||||
|
if (split_mode == SPLIT_MODE_HORIZONTAL) {
|
||||||
|
split_box->set_mode(CSplitContainer::CONTAINER_MODE_HORIZONTAL);
|
||||||
|
} else {
|
||||||
|
split_box->set_mode(CSplitContainer::CONTAINER_MODE_VERTICAL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FileSystemDock::SplitMode FileSystemDock::get_split_mode() {
|
||||||
|
return split_mode;
|
||||||
|
}
|
||||||
|
|
||||||
int FileSystemDock::add_custom_popup_creation_entry(const String &entry_text, const String &theme_icon_name, const String &theme_icon_category) {
|
int FileSystemDock::add_custom_popup_creation_entry(const String &entry_text, const String &theme_icon_name, const String &theme_icon_category) {
|
||||||
int current_max_id = FILE_NEW_CUSTOM_ENTRY_START;
|
int current_max_id = FILE_NEW_CUSTOM_ENTRY_START;
|
||||||
|
|
||||||
@ -2096,7 +2074,7 @@ void FileSystemDock::remove_custom_popup_creation_entry(const int id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FileSystemDock::ensure_visible() {
|
void FileSystemDock::ensure_visible() {
|
||||||
if (display_mode == DISPLAY_MODE_WIDE) {
|
if (applied_dock_mode == DOCK_MODE_BOTTOM_BAR) {
|
||||||
if (bottom_panel_tool_button) {
|
if (bottom_panel_tool_button) {
|
||||||
bottom_panel_tool_button->set_pressed(true);
|
bottom_panel_tool_button->set_pressed(true);
|
||||||
}
|
}
|
||||||
@ -2910,7 +2888,7 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
|
|||||||
#endif
|
#endif
|
||||||
ED_SHORTCUT("filesystem_dock/open_search", TTR("Focus the search box"), KEY_MASK_CMD | KEY_F);
|
ED_SHORTCUT("filesystem_dock/open_search", TTR("Focus the search box"), KEY_MASK_CMD | KEY_F);
|
||||||
|
|
||||||
bool wide = EDITOR_DEF_RST("docks/filesystem/wide_bottom_panel", false);
|
bool wide = static_cast<SplitMode>(static_cast<int>(EDITOR_GET("docks/filesystem/dock_mode")));
|
||||||
|
|
||||||
VBoxContainer *top_vbc = memnew(VBoxContainer);
|
VBoxContainer *top_vbc = memnew(VBoxContainer);
|
||||||
add_child(top_vbc);
|
add_child(top_vbc);
|
||||||
@ -2952,10 +2930,6 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
|
|||||||
button_toggle_display_mode->set_tooltip(TTR("Toggle Split Mode"));
|
button_toggle_display_mode->set_tooltip(TTR("Toggle Split Mode"));
|
||||||
toolbar_hbc->add_child(button_toggle_display_mode);
|
toolbar_hbc->add_child(button_toggle_display_mode);
|
||||||
|
|
||||||
if (wide) {
|
|
||||||
button_toggle_display_mode->hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
toolbar2_hbc = memnew(HBoxContainer);
|
toolbar2_hbc = memnew(HBoxContainer);
|
||||||
toolbar2_hbc->add_theme_constant_override("separation", 0);
|
toolbar2_hbc->add_theme_constant_override("separation", 0);
|
||||||
top_vbc->add_child(toolbar2_hbc);
|
top_vbc->add_child(toolbar2_hbc);
|
||||||
@ -2969,10 +2943,6 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
|
|||||||
tree_button_sort = _create_file_menu_button();
|
tree_button_sort = _create_file_menu_button();
|
||||||
toolbar2_hbc->add_child(tree_button_sort);
|
toolbar2_hbc->add_child(tree_button_sort);
|
||||||
|
|
||||||
if (wide) {
|
|
||||||
toolbar2_hbc->hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
file_list_popup = memnew(PopupMenu);
|
file_list_popup = memnew(PopupMenu);
|
||||||
file_list_popup->set_hide_on_window_lose_focus(true);
|
file_list_popup->set_hide_on_window_lose_focus(true);
|
||||||
add_child(file_list_popup);
|
add_child(file_list_popup);
|
||||||
@ -2981,22 +2951,10 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
|
|||||||
tree_popup->set_hide_on_window_lose_focus(true);
|
tree_popup->set_hide_on_window_lose_focus(true);
|
||||||
add_child(tree_popup);
|
add_child(tree_popup);
|
||||||
|
|
||||||
wide_hsplit_box = NULL;
|
split_box = memnew(CSplitContainer);
|
||||||
split_box = NULL;
|
split_box->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||||
SplitContainer *split_container = NULL;
|
split_box->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||||
|
add_child(split_box);
|
||||||
if (!wide) {
|
|
||||||
split_box = memnew(VSplitContainer);
|
|
||||||
split_box->set_v_size_flags(SIZE_EXPAND_FILL);
|
|
||||||
add_child(split_box);
|
|
||||||
split_container = split_box;
|
|
||||||
} else {
|
|
||||||
wide_hsplit_box = memnew(HSplitContainer);
|
|
||||||
wide_hsplit_box->set_v_size_flags(SIZE_EXPAND_FILL);
|
|
||||||
wide_hsplit_box->set_h_size_flags(SIZE_EXPAND_FILL);
|
|
||||||
add_child(wide_hsplit_box);
|
|
||||||
split_container = wide_hsplit_box;
|
|
||||||
}
|
|
||||||
|
|
||||||
tree = memnew(Tree);
|
tree = memnew(Tree);
|
||||||
|
|
||||||
@ -3005,7 +2963,7 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
|
|||||||
tree->set_allow_rmb_select(true);
|
tree->set_allow_rmb_select(true);
|
||||||
tree->set_select_mode(Tree::SELECT_MULTI);
|
tree->set_select_mode(Tree::SELECT_MULTI);
|
||||||
tree->set_custom_minimum_size(Size2(0, 15 * EDSCALE));
|
tree->set_custom_minimum_size(Size2(0, 15 * EDSCALE));
|
||||||
split_container->add_child(tree);
|
split_box->add_child(tree);
|
||||||
|
|
||||||
tree->connect("item_activated", this, "_tree_activate_file");
|
tree->connect("item_activated", this, "_tree_activate_file");
|
||||||
tree->connect("multi_selected", this, "_tree_multi_selected");
|
tree->connect("multi_selected", this, "_tree_multi_selected");
|
||||||
@ -3016,7 +2974,7 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
|
|||||||
|
|
||||||
file_list_vb = memnew(VBoxContainer);
|
file_list_vb = memnew(VBoxContainer);
|
||||||
file_list_vb->set_v_size_flags(SIZE_EXPAND_FILL);
|
file_list_vb->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||||
split_container->add_child(file_list_vb);
|
split_box->add_child(file_list_vb);
|
||||||
|
|
||||||
path_hb = memnew(HBoxContainer);
|
path_hb = memnew(HBoxContainer);
|
||||||
file_list_vb->add_child(path_hb);
|
file_list_vb->add_child(path_hb);
|
||||||
@ -3137,16 +3095,25 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
|
|||||||
history.push_back("res://");
|
history.push_back("res://");
|
||||||
|
|
||||||
if (wide) {
|
if (wide) {
|
||||||
display_mode = DISPLAY_MODE_WIDE;
|
display_mode = DISPLAY_MODE_SPLIT;
|
||||||
old_display_mode = DISPLAY_MODE_WIDE;
|
old_display_mode = DISPLAY_MODE_SPLIT;
|
||||||
|
split_mode = SPLIT_MODE_VERTICAL;
|
||||||
} else {
|
} else {
|
||||||
display_mode = DISPLAY_MODE_TREE_ONLY;
|
display_mode = DISPLAY_MODE_TREE_ONLY;
|
||||||
old_display_mode = DISPLAY_MODE_TREE_ONLY;
|
old_display_mode = DISPLAY_MODE_TREE_ONLY;
|
||||||
|
split_mode = SPLIT_MODE_HORIZONTAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set_split_mode(split_mode);
|
||||||
|
|
||||||
|
_update_display_mode(true);
|
||||||
|
|
||||||
file_list_display_mode = FILE_LIST_DISPLAY_THUMBNAILS;
|
file_list_display_mode = FILE_LIST_DISPLAY_THUMBNAILS;
|
||||||
|
|
||||||
always_show_folders = false;
|
always_show_folders = false;
|
||||||
|
|
||||||
|
dock_mode = DOCK_MODE_DOCK;
|
||||||
|
applied_dock_mode = DOCK_MODE_DOCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileSystemDock::~FileSystemDock() {
|
FileSystemDock::~FileSystemDock() {
|
||||||
|
@ -83,7 +83,16 @@ public:
|
|||||||
enum DisplayMode {
|
enum DisplayMode {
|
||||||
DISPLAY_MODE_TREE_ONLY,
|
DISPLAY_MODE_TREE_ONLY,
|
||||||
DISPLAY_MODE_SPLIT,
|
DISPLAY_MODE_SPLIT,
|
||||||
DISPLAY_MODE_WIDE,
|
};
|
||||||
|
|
||||||
|
enum SplitMode {
|
||||||
|
SPLIT_MODE_VERTICAL,
|
||||||
|
SPLIT_MODE_HORIZONTAL,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum DockMode {
|
||||||
|
DOCK_MODE_DOCK,
|
||||||
|
DOCK_MODE_BOTTOM_BAR,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum FileSortOption {
|
enum FileSortOption {
|
||||||
@ -130,8 +139,7 @@ private:
|
|||||||
VBoxContainer *scanning_vb;
|
VBoxContainer *scanning_vb;
|
||||||
ProgressBar *scanning_progress;
|
ProgressBar *scanning_progress;
|
||||||
|
|
||||||
HSplitContainer *wide_hsplit_box;
|
CSplitContainer *split_box;
|
||||||
VSplitContainer *split_box;
|
|
||||||
|
|
||||||
VBoxContainer *file_list_vb;
|
VBoxContainer *file_list_vb;
|
||||||
|
|
||||||
@ -162,6 +170,11 @@ private:
|
|||||||
DisplayMode display_mode;
|
DisplayMode display_mode;
|
||||||
DisplayMode old_display_mode;
|
DisplayMode old_display_mode;
|
||||||
|
|
||||||
|
DockMode dock_mode;
|
||||||
|
DockMode applied_dock_mode;
|
||||||
|
|
||||||
|
SplitMode split_mode;
|
||||||
|
|
||||||
PopupMenu *file_list_popup;
|
PopupMenu *file_list_popup;
|
||||||
PopupMenu *tree_popup;
|
PopupMenu *tree_popup;
|
||||||
|
|
||||||
@ -345,18 +358,10 @@ public:
|
|||||||
void fix_dependencies(const String &p_for_file);
|
void fix_dependencies(const String &p_for_file);
|
||||||
|
|
||||||
int get_split_offset() {
|
int get_split_offset() {
|
||||||
if (split_box) {
|
return split_box->get_split_offset();
|
||||||
return split_box->get_split_offset();
|
|
||||||
} else {
|
|
||||||
return wide_hsplit_box->get_split_offset();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
void set_split_offset(int p_offset) {
|
void set_split_offset(int p_offset) {
|
||||||
if (split_box) {
|
split_box->set_split_offset(p_offset);
|
||||||
split_box->set_split_offset(p_offset);
|
|
||||||
} else {
|
|
||||||
wide_hsplit_box->set_split_offset(p_offset);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
void select_file(const String &p_file);
|
void select_file(const String &p_file);
|
||||||
|
|
||||||
@ -369,6 +374,15 @@ public:
|
|||||||
void set_file_list_display_mode(FileListDisplayMode p_mode);
|
void set_file_list_display_mode(FileListDisplayMode p_mode);
|
||||||
FileListDisplayMode get_file_list_display_mode() { return file_list_display_mode; }
|
FileListDisplayMode get_file_list_display_mode() { return file_list_display_mode; }
|
||||||
|
|
||||||
|
void set_dock_mode(DockMode p_dock_mode);
|
||||||
|
DockMode get_dock_mode() { return dock_mode; }
|
||||||
|
|
||||||
|
void set_applied_dock_mode(DockMode p_dock_mode);
|
||||||
|
DockMode get_applied_dock_mode() { return applied_dock_mode; }
|
||||||
|
|
||||||
|
void set_split_mode(SplitMode p_split_mode);
|
||||||
|
SplitMode get_split_mode();
|
||||||
|
|
||||||
int add_custom_popup_creation_entry(const String &entry_text, const String &theme_icon_name = "", const String &theme_icon_category = "");
|
int add_custom_popup_creation_entry(const String &entry_text, const String &theme_icon_name = "", const String &theme_icon_category = "");
|
||||||
void remove_custom_popup_creation_entry(const int id);
|
void remove_custom_popup_creation_entry(const int id);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user