From b617b44419613ae87d64b5d4692515750c83b417 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Mon, 15 Mar 2021 09:58:38 +0100 Subject: 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 --- source/blender/blenloader/intern/versioning_290.c | 37 +++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'source/blender/blenloader') 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; + } + } + } + } + } } } -- cgit v1.2.3