diff options
author | Jacques Lucke <jacques@blender.org> | 2021-03-15 11:58:38 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-03-15 12:00:02 +0300 |
commit | b617b44419613ae87d64b5d4692515750c83b417 (patch) | |
tree | 71375c9578ea7427e18e72d3c3f6004d43ef74eb /source/blender/blenloader/intern | |
parent | 2ca48b967894dc2be786e0db1b0ed1fa6abd5383 (diff) |
Spreadsheet: add status bar
This implements the status bar as footer region in the
spreadsheet editor.
It shows the total number of rows and columns as well
as how many rows are actually visible (based on the filter).
The implementation stores the stats in a runtime struct during
drawing and the status bar reads from that struct.
Ref T86142.
Differential Revision: https://developer.blender.org/D10693
Diffstat (limited to 'source/blender/blenloader/intern')
-rw-r--r-- | source/blender/blenloader/intern/versioning_290.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c index 8cf840f665b..05762c479ff 100644 --- a/source/blender/blenloader/intern/versioning_290.c +++ b/source/blender/blenloader/intern/versioning_290.c @@ -796,6 +796,26 @@ static void version_node_join_geometry_for_multi_input_socket(bNodeTree *ntree) } } +static ARegion *do_versions_add_region_if_not_found(ListBase *regionbase, + int region_type, + const char *name, + int link_after_region_type) +{ + ARegion *link_after_region = NULL; + LISTBASE_FOREACH (ARegion *, region, regionbase) { + if (region->regiontype == region_type) { + return NULL; + } + if (region->regiontype == link_after_region_type) { + link_after_region = region; + } + } + ARegion *new_region = MEM_callocN(sizeof(ARegion), name); + new_region->regiontype = region_type; + BLI_insertlinkafter(regionbase, link_after_region, new_region); + return new_region; +} + /* NOLINTNEXTLINE: readability-function-size */ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain) { @@ -1832,5 +1852,22 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain) */ { /* Keep this block, even when empty. */ + + LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) { + LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { + LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) { + if (sl->spacetype == SPACE_SPREADSHEET) { + ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase : + &sl->regionbase; + ARegion *new_footer = do_versions_add_region_if_not_found( + regionbase, RGN_TYPE_FOOTER, "footer for spreadsheet", RGN_TYPE_HEADER); + if (new_footer != NULL) { + new_footer->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_TOP : + RGN_ALIGN_BOTTOM; + } + } + } + } + } } } |