Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <campbell@blender.org>2022-04-12 04:59:25 +0300
committerCampbell Barton <campbell@blender.org>2022-04-12 04:59:25 +0300
commit2451d7d57ed354aa3721153af417f06b2cebeec0 (patch)
treedc6ff0850383ffbb5b7663ef5ca0aeb4fa14a1e4 /source
parent6f1ad5f5e77ca5b5c257db97798e9a2087c9defd (diff)
Cleanup: use _NUM suffix for space/region type ranges
- Replace SPACE_TYPE_LAST with SPACE_TYPE_NUM (adding 1). - Rename RGN_TYPE_LEN to RGN_TYPE_NUM This makes it possible to tag space-type/region-type combinations with `bool tag[SPACE_TYPE_NUM][RGN_TYPE_NUM]` which reads more clearly than `bool tag[SPACE_TYPE_LAST + 1][RGN_TYPE_LEN]`.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/screen/area.c16
-rw-r--r--source/blender/makesdna/DNA_screen_types.h2
-rw-r--r--source/blender/makesdna/DNA_space_types.h2
-rw-r--r--source/blender/windowmanager/intern/wm_toolsystem.c2
4 files changed, 11 insertions, 11 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 30bf23e0987..ad815f0d998 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -2176,12 +2176,12 @@ struct RegionTypeAlignInfo {
* Needed for detecting which header displays the space-type switcher.
*/
bool hidden;
- } by_type[RGN_TYPE_LEN];
+ } by_type[RGN_TYPE_NUM];
};
static void region_align_info_from_area(ScrArea *area, struct RegionTypeAlignInfo *r_align_info)
{
- for (int index = 0; index < RGN_TYPE_LEN; index++) {
+ for (int index = 0; index < RGN_TYPE_NUM; index++) {
r_align_info->by_type[index].alignment = -1;
/* Default to true, when it doesn't exist - it's effectively hidden. */
r_align_info->by_type[index].hidden = true;
@@ -2189,7 +2189,7 @@ static void region_align_info_from_area(ScrArea *area, struct RegionTypeAlignInf
LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
const int index = region->regiontype;
- if ((uint)index < RGN_TYPE_LEN) {
+ if ((uint)index < RGN_TYPE_NUM) {
r_align_info->by_type[index].alignment = RGN_ALIGN_ENUM_FROM_MASK(region->alignment);
r_align_info->by_type[index].hidden = (region->flag & RGN_FLAG_HIDDEN) != 0;
}
@@ -2252,7 +2252,7 @@ static short region_alignment_from_header_and_tool_header_state(
static void region_align_info_to_area_for_headers(
const struct RegionTypeAlignInfo *region_align_info_src,
const struct RegionTypeAlignInfo *region_align_info_dst,
- ARegion *region_by_type[RGN_TYPE_LEN])
+ ARegion *region_by_type[RGN_TYPE_NUM])
{
/* Abbreviate access. */
const short header_alignment_src = region_align_info_src->by_type[RGN_TYPE_HEADER].alignment;
@@ -2365,12 +2365,12 @@ static void region_align_info_to_area_for_headers(
}
static void region_align_info_to_area(
- ScrArea *area, const struct RegionTypeAlignInfo region_align_info_src[RGN_TYPE_LEN])
+ ScrArea *area, const struct RegionTypeAlignInfo region_align_info_src[RGN_TYPE_NUM])
{
- ARegion *region_by_type[RGN_TYPE_LEN] = {NULL};
+ ARegion *region_by_type[RGN_TYPE_NUM] = {NULL};
LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
const int index = region->regiontype;
- if ((uint)index < RGN_TYPE_LEN) {
+ if ((uint)index < RGN_TYPE_NUM) {
region_by_type[index] = region;
}
}
@@ -2437,7 +2437,7 @@ void ED_area_newspace(bContext *C, ScrArea *area, int type, const bool skip_regi
*/
bool sync_header_alignment = false;
- struct RegionTypeAlignInfo region_align_info[RGN_TYPE_LEN];
+ struct RegionTypeAlignInfo region_align_info[RGN_TYPE_NUM];
if ((slold != NULL) && (slold->link_flag & SPACE_FLAG_TYPE_TEMPORARY) == 0) {
region_align_info_from_area(area, region_align_info);
sync_header_alignment = true;
diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h
index c1eee109630..8560f8a454e 100644
--- a/source/blender/makesdna/DNA_screen_types.h
+++ b/source/blender/makesdna/DNA_screen_types.h
@@ -664,7 +664,7 @@ typedef enum eRegion_Type {
* context (surface, mirror view). Does not represent any real region. */
RGN_TYPE_XR = 13,
-#define RGN_TYPE_LEN (RGN_TYPE_XR + 1)
+#define RGN_TYPE_NUM (RGN_TYPE_XR + 1)
} eRegion_Type;
/* use for function args */
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index bcf54ee47a0..1b70d8497b6 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -2057,7 +2057,7 @@ typedef enum eSpace_Type {
SPACE_STATUSBAR = 22,
SPACE_SPREADSHEET = 23
-#define SPACE_TYPE_LAST SPACE_SPREADSHEET
+#define SPACE_TYPE_NUM (SPACE_SPREADSHEET + 1)
} eSpace_Type;
/* use for function args */
diff --git a/source/blender/windowmanager/intern/wm_toolsystem.c b/source/blender/windowmanager/intern/wm_toolsystem.c
index a8d4ca0f02b..388abe21578 100644
--- a/source/blender/windowmanager/intern/wm_toolsystem.c
+++ b/source/blender/windowmanager/intern/wm_toolsystem.c
@@ -551,7 +551,7 @@ void WM_toolsystem_refresh_screen_area(WorkSpace *workspace, ViewLayer *view_lay
void WM_toolsystem_refresh_screen_window(wmWindow *win)
{
WorkSpace *workspace = WM_window_get_active_workspace(win);
- bool space_type_has_tools[SPACE_TYPE_LAST + 1] = {0};
+ bool space_type_has_tools[SPACE_TYPE_NUM] = {0};
LISTBASE_FOREACH (bToolRef *, tref, &workspace->tools) {
space_type_has_tools[tref->space_type] = true;
}