UI: Let file browser tool/bookmarks region push upper bar in

Main reason for doing this is that the navigation buttons are very
close to the file list now, making them much faster to reach.

Initially we let the upper bar (the one with the file path, navigation
and display buttons) use full area width, because designs back then had
more horizontal space problems. The designs have changed meanwhile, and
horizontal space is less of an issue.

However, when the file browser is shrunk horizontally, or if it's open
in a small area (e.g. see "Shading" workspace), having the tool region
open brings back the space issues. But even the file list layout becomes
problematic then, and the same issue was present before the new file
browser design, so we've decided this is an acceptable tradeoff.
This commit is contained in:
Julian Eisel 2019-09-29 20:16:19 +02:00
parent 02c4410a37
commit 57519f237a
Notes: blender-bot 2023-02-14 08:25:14 +01:00
Referenced by issue #69652, File Browser GUI: Planned Changes for 2.81
2 changed files with 13 additions and 11 deletions

View File

@ -3880,6 +3880,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
else if (sl->spacetype == SPACE_FILE) {
ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
ARegion *ar_tools = do_versions_find_region_or_null(regionbase, RGN_TYPE_TOOLS);
ARegion *ar_header = do_versions_find_region(regionbase, RGN_TYPE_HEADER);
if (ar_tools) {
ARegion *ar_next = ar_tools->next;
@ -3888,12 +3889,13 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (ar_next && ar_next->regiontype == RGN_TYPE_TOOLS) {
do_versions_remove_region(regionbase, RGN_TYPE_TOOLS);
}
BLI_remlink(regionbase, ar_tools);
BLI_insertlinkafter(regionbase, ar_header, ar_tools);
}
else {
ARegion *ar_ui = do_versions_find_region(regionbase, RGN_TYPE_UI);
ar_tools = do_versions_add_region(RGN_TYPE_TOOLS, "versioning file tools region");
BLI_insertlinkafter(regionbase, ar_ui, ar_tools);
BLI_insertlinkafter(regionbase, ar_header, ar_tools);
ar_tools->alignment = RGN_ALIGN_LEFT;
}
}

View File

@ -106,6 +106,12 @@ static SpaceLink *file_new(const ScrArea *UNUSED(area), const Scene *UNUSED(scen
/* Ignore user preference "USER_HEADER_BOTTOM" here (always show top for new types). */
ar->alignment = RGN_ALIGN_TOP;
/* Tools region */
ar = MEM_callocN(sizeof(ARegion), "tools region for file");
BLI_addtail(&sfile->regionbase, ar);
ar->regiontype = RGN_TYPE_TOOLS;
ar->alignment = RGN_ALIGN_LEFT;
/* ui list region */
ar = MEM_callocN(sizeof(ARegion), "ui region for file");
BLI_addtail(&sfile->regionbase, ar);
@ -113,12 +119,6 @@ static SpaceLink *file_new(const ScrArea *UNUSED(area), const Scene *UNUSED(scen
ar->alignment = RGN_ALIGN_TOP;
ar->flag |= RGN_FLAG_DYNAMIC_SIZE;
/* Tools region */
ar = MEM_callocN(sizeof(ARegion), "tools region for file");
BLI_addtail(&sfile->regionbase, ar);
ar->regiontype = RGN_TYPE_TOOLS;
ar->alignment = RGN_ALIGN_LEFT;
/* Tool props and execute region are added as needed, see file_refresh(). */
/* main region */
@ -239,14 +239,14 @@ static void file_ensure_valid_region_state(bContext *C,
SpaceFile *sfile,
FileSelectParams *params)
{
ARegion *ar_tools = BKE_area_find_region_type(sa, RGN_TYPE_TOOLS);
ARegion *ar_ui = BKE_area_find_region_type(sa, RGN_TYPE_UI);
ARegion *ar_props = BKE_area_find_region_type(sa, RGN_TYPE_TOOL_PROPS);
ARegion *ar_execute = BKE_area_find_region_type(sa, RGN_TYPE_EXECUTE);
bool needs_init = false; /* To avoid multiple ED_area_initialize() calls. */
/* If there's an file-operation, ensure we have the option and execute region */
if (sfile->op && (ar_props == NULL)) {
ar_execute = file_execute_region_ensure(sa, ar_tools);
ar_execute = file_execute_region_ensure(sa, ar_ui);
ar_props = file_tool_props_region_ensure(sa, ar_execute);
if (params->flag & FILE_HIDE_TOOL_PROPS) {