diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2019-09-29 21:16:19 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2019-09-29 21:37:51 +0300 |
commit | 57519f237a914aa2645c44bf86917c05f6e45e30 (patch) | |
tree | db0905759ccfff7a1150e867ee160cb39ea4f905 /source | |
parent | 02c4410a370413b88b90a1403136c60cf21c870b (diff) |
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.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenloader/intern/versioning_280.c | 8 | ||||
-rw-r--r-- | source/blender/editors/space_file/space_file.c | 16 |
2 files changed, 13 insertions, 11 deletions
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index ff088d83358..7ea1d25f86d 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -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; } } diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c index 2f0e796d500..d63fcf402de 100644 --- a/source/blender/editors/space_file/space_file.c +++ b/source/blender/editors/space_file/space_file.c @@ -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) { |