diff options
author | Julian Eisel <julian@blender.org> | 2020-04-03 14:25:03 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2020-04-03 14:34:50 +0300 |
commit | 905c0269f302e8e0e7a27dda8d5256fdcd06ce60 (patch) | |
tree | 1c720d4f0069879d5b4c0c9ea8db867106920d4f /source/blender/blenkernel | |
parent | 1a69384e76e2b1ab11c87a582eb2cdf26386ac59 (diff) |
Cleanup: Rename ScrArea variables from sa to area
Follow up of b2ee1770d4c3 and 10c2254d412d, part of T74432.
Now the area and region naming conventions should be less confusing.
Mostly a careful batch rename but had to do few smaller fixes.
Also ran clang-format on affected files.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_context.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_screen.h | 43 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/anim_sys.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/context.c | 118 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/image.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/screen.c | 146 |
6 files changed, 162 insertions, 157 deletions
diff --git a/source/blender/blenkernel/BKE_context.h b/source/blender/blenkernel/BKE_context.h index 9e2a124491c..c4fb19ea355 100644 --- a/source/blender/blenkernel/BKE_context.h +++ b/source/blender/blenkernel/BKE_context.h @@ -178,7 +178,7 @@ struct SpaceTopBar *CTX_wm_space_topbar(const bContext *C); void CTX_wm_manager_set(bContext *C, struct wmWindowManager *wm); void CTX_wm_window_set(bContext *C, struct wmWindow *win); void CTX_wm_screen_set(bContext *C, struct bScreen *screen); /* to be removed */ -void CTX_wm_area_set(bContext *C, struct ScrArea *sa); +void CTX_wm_area_set(bContext *C, struct ScrArea *area); void CTX_wm_region_set(bContext *C, struct ARegion *region); void CTX_wm_menu_set(bContext *C, struct ARegion *menu); void CTX_wm_gizmo_group_set(bContext *C, struct wmGizmoGroup *gzgroup); diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h index 2231cc36861..ca25d7f8d95 100644 --- a/source/blender/blenkernel/BKE_screen.h +++ b/source/blender/blenkernel/BKE_screen.h @@ -72,25 +72,25 @@ typedef struct SpaceType { /* Initial allocation, after this WM will call init() too. Some editors need * area and scene data (e.g. frame range) to set their initial scrolling. */ - struct SpaceLink *(*new)(const struct ScrArea *sa, const struct Scene *scene); + struct SpaceLink *(*new)(const struct ScrArea *area, const struct Scene *scene); /* not free spacelink itself */ void (*free)(struct SpaceLink *sl); /* init is to cope with file load, screen (size) changes, check handlers */ - void (*init)(struct wmWindowManager *wm, struct ScrArea *sa); + void (*init)(struct wmWindowManager *wm, struct ScrArea *area); /* exit is called when the area is hidden or removed */ - void (*exit)(struct wmWindowManager *wm, struct ScrArea *sa); + void (*exit)(struct wmWindowManager *wm, struct ScrArea *area); /* Listeners can react to bContext changes */ void (*listener)(struct wmWindow *win, - struct ScrArea *sa, + struct ScrArea *area, struct wmNotifier *wmn, struct Scene *scene); /* called when the mouse moves out of the area */ - void (*deactivate)(struct ScrArea *sa); + void (*deactivate)(struct ScrArea *area); /* refresh context, called after filereads, ED_area_tag_refresh() */ - void (*refresh)(const struct bContext *C, struct ScrArea *sa); + void (*refresh)(const struct bContext *C, struct ScrArea *area); /* after a spacedata copy, an init should result in exact same situation */ struct SpaceLink *(*duplicate)(struct SpaceLink *sl); @@ -109,10 +109,13 @@ typedef struct SpaceType { int (*context)(const struct bContext *C, const char *member, struct bContextDataResult *result); /* Used when we want to replace an ID by another (or NULL). */ - void (*id_remap)(struct ScrArea *sa, struct SpaceLink *sl, struct ID *old_id, struct ID *new_id); + void (*id_remap)(struct ScrArea *area, + struct SpaceLink *sl, + struct ID *old_id, + struct ID *new_id); - int (*space_subtype_get)(struct ScrArea *sa); - void (*space_subtype_set)(struct ScrArea *sa, int value); + int (*space_subtype_get)(struct ScrArea *area); + void (*space_subtype_set)(struct ScrArea *area, int value); void (*space_subtype_item_extend)(struct bContext *C, EnumPropertyItem **item, int *totitem); /* region type definitions */ @@ -144,7 +147,7 @@ typedef struct ARegionType { int (*snap_size)(const struct ARegion *region, int size, int axis); /* contextual changes should be handled here */ void (*listener)(struct wmWindow *win, - struct ScrArea *sa, + struct ScrArea *area, struct ARegion *region, struct wmNotifier *wmn, const struct Scene *scene); @@ -153,7 +156,7 @@ typedef struct ARegionType { struct WorkSpace *workspace, struct Scene *scene, struct bScreen *sc, - struct ScrArea *sa, + struct ScrArea *area, struct ARegion *region, struct wmMsgBus *mbus); @@ -167,7 +170,7 @@ typedef struct ARegionType { /* add own items to keymap */ void (*keymap)(struct wmKeyConfig *keyconf); /* allows default cursor per region */ - void (*cursor)(struct wmWindow *win, struct ScrArea *sa, struct ARegion *region); + void (*cursor)(struct wmWindow *win, struct ScrArea *area, struct ARegion *region); /* return context data */ int (*context)(const struct bContext *C, const char *member, struct bContextDataResult *result); @@ -333,27 +336,27 @@ void BKE_spacedata_copylist(ListBase *lb1, ListBase *lb2); void BKE_spacedata_draw_locks(int set); struct ARegion *BKE_spacedata_find_region_type(const struct SpaceLink *slink, - const struct ScrArea *sa, + const struct ScrArea *area, int region_type) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); -void BKE_spacedata_callback_id_remap_set( - void (*func)(struct ScrArea *sa, struct SpaceLink *sl, struct ID *old_id, struct ID *new_id)); -void BKE_spacedata_id_unref(struct ScrArea *sa, struct SpaceLink *sl, struct ID *id); +void BKE_spacedata_callback_id_remap_set(void (*func)( + struct ScrArea *area, struct SpaceLink *sl, struct ID *old_id, struct ID *new_id)); +void BKE_spacedata_id_unref(struct ScrArea *area, struct SpaceLink *sl, struct ID *id); /* area/regions */ struct ARegion *BKE_area_region_copy(struct SpaceType *st, struct ARegion *region); void BKE_area_region_free(struct SpaceType *st, struct ARegion *region); void BKE_area_region_panels_free(struct ListBase *panels); -void BKE_screen_area_free(struct ScrArea *sa); +void BKE_screen_area_free(struct ScrArea *area); /* Gizmo-maps of a region need to be freed with the region. * Uses callback to avoid low-level call. */ void BKE_region_callback_free_gizmomap_set(void (*callback)(struct wmGizmoMap *)); void BKE_region_callback_refresh_tag_gizmomap_set(void (*callback)(struct wmGizmoMap *)); -struct ARegion *BKE_area_find_region_type(const struct ScrArea *sa, int type); -struct ARegion *BKE_area_find_region_active_win(struct ScrArea *sa); -struct ARegion *BKE_area_find_region_xy(struct ScrArea *sa, const int regiontype, int x, int y); +struct ARegion *BKE_area_find_region_type(const struct ScrArea *area, int type); +struct ARegion *BKE_area_find_region_active_win(struct ScrArea *area); +struct ARegion *BKE_area_find_region_xy(struct ScrArea *area, const int regiontype, int x, int y); struct ARegion *BKE_screen_find_region_xy(struct bScreen *sc, const int regiontype, int x, int y) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index 2027dbe6c23..25582700e9e 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -674,7 +674,7 @@ char *BKE_animdata_driver_path_hack(bContext *C, char *base_path) { ID *id = ptr->owner_id; - ScrArea *sa = CTX_wm_area(C); + ScrArea *area = CTX_wm_area(C); /* get standard path which may be extended */ char *basepath = base_path ? base_path : RNA_path_from_ID_to_property(ptr, prop); @@ -684,7 +684,7 @@ char *BKE_animdata_driver_path_hack(bContext *C, * restricts the subspace of options to the 'active' data (a manageable state) */ /* TODO: watch out for pinned context? */ - if ((sa) && (sa->spacetype == SPACE_PROPERTIES)) { + if ((area) && (area->spacetype == SPACE_PROPERTIES)) { Object *ob = CTX_data_active_object(C); if (ob && id) { diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c index f6db23111a1..6beb95ca0b0 100644 --- a/source/blender/blenkernel/intern/context.c +++ b/source/blender/blenkernel/intern/context.c @@ -279,7 +279,7 @@ static void *ctx_wm_python_context_get(const bContext *C, static int ctx_data_get(bContext *C, const char *member, bContextDataResult *result) { bScreen *sc; - ScrArea *sa; + ScrArea *area; ARegion *region; int done = 0, recursion = C->data.recursion; int ret = 0; @@ -327,10 +327,10 @@ static int ctx_data_get(bContext *C, const char *member, bContextDataResult *res } } } - if (done != 1 && recursion < 3 && (sa = CTX_wm_area(C))) { + if (done != 1 && recursion < 3 && (area = CTX_wm_area(C))) { C->data.recursion = 3; - if (sa->type && sa->type->context) { - ret = sa->type->context(C, member, result); + if (area->type && area->type->context) { + ret = area->type->context(C, member, result); if (ret) { done = -(-ret | -done); } @@ -544,7 +544,7 @@ ListBase CTX_data_dir_get_ex(const bContext *C, bContextDataResult result; ListBase lb; bScreen *sc; - ScrArea *sa; + ScrArea *area; ARegion *region; int a; @@ -588,9 +588,9 @@ ListBase CTX_data_dir_get_ex(const bContext *C, } } } - if ((sa = CTX_wm_area(C)) && sa->type && sa->type->context) { + if ((area = CTX_wm_area(C)) && area->type && area->type->context) { memset(&result, 0, sizeof(result)); - sa->type->context(C, "", &result); + area->type->context(C, "", &result); if (result.dir) { for (a = 0; result.dir[a]; a++) { @@ -716,8 +716,8 @@ ScrArea *CTX_wm_area(const bContext *C) SpaceLink *CTX_wm_space_data(const bContext *C) { - ScrArea *sa = CTX_wm_area(C); - return (sa) ? sa->spacedata.first : NULL; + ScrArea *area = CTX_wm_area(C); + return (area) ? area->spacedata.first : NULL; } ARegion *CTX_wm_region(const bContext *C) @@ -757,19 +757,19 @@ struct ReportList *CTX_wm_reports(const bContext *C) View3D *CTX_wm_view3d(const bContext *C) { - ScrArea *sa = CTX_wm_area(C); - if (sa && sa->spacetype == SPACE_VIEW3D) { - return sa->spacedata.first; + ScrArea *area = CTX_wm_area(C); + if (area && area->spacetype == SPACE_VIEW3D) { + return area->spacedata.first; } return NULL; } RegionView3D *CTX_wm_region_view3d(const bContext *C) { - ScrArea *sa = CTX_wm_area(C); + ScrArea *area = CTX_wm_area(C); ARegion *region = CTX_wm_region(C); - if (sa && sa->spacetype == SPACE_VIEW3D) { + if (area && area->spacetype == SPACE_VIEW3D) { if (region && region->regiontype == RGN_TYPE_WINDOW) { return region->regiondata; } @@ -779,135 +779,135 @@ RegionView3D *CTX_wm_region_view3d(const bContext *C) struct SpaceText *CTX_wm_space_text(const bContext *C) { - ScrArea *sa = CTX_wm_area(C); - if (sa && sa->spacetype == SPACE_TEXT) { - return sa->spacedata.first; + ScrArea *area = CTX_wm_area(C); + if (area && area->spacetype == SPACE_TEXT) { + return area->spacedata.first; } return NULL; } struct SpaceConsole *CTX_wm_space_console(const bContext *C) { - ScrArea *sa = CTX_wm_area(C); - if (sa && sa->spacetype == SPACE_CONSOLE) { - return sa->spacedata.first; + ScrArea *area = CTX_wm_area(C); + if (area && area->spacetype == SPACE_CONSOLE) { + return area->spacedata.first; } return NULL; } struct SpaceImage *CTX_wm_space_image(const bContext *C) { - ScrArea *sa = CTX_wm_area(C); - if (sa && sa->spacetype == SPACE_IMAGE) { - return sa->spacedata.first; + ScrArea *area = CTX_wm_area(C); + if (area && area->spacetype == SPACE_IMAGE) { + return area->spacedata.first; } return NULL; } struct SpaceProperties *CTX_wm_space_properties(const bContext *C) { - ScrArea *sa = CTX_wm_area(C); - if (sa && sa->spacetype == SPACE_PROPERTIES) { - return sa->spacedata.first; + ScrArea *area = CTX_wm_area(C); + if (area && area->spacetype == SPACE_PROPERTIES) { + return area->spacedata.first; } return NULL; } struct SpaceFile *CTX_wm_space_file(const bContext *C) { - ScrArea *sa = CTX_wm_area(C); - if (sa && sa->spacetype == SPACE_FILE) { - return sa->spacedata.first; + ScrArea *area = CTX_wm_area(C); + if (area && area->spacetype == SPACE_FILE) { + return area->spacedata.first; } return NULL; } struct SpaceSeq *CTX_wm_space_seq(const bContext *C) { - ScrArea *sa = CTX_wm_area(C); - if (sa && sa->spacetype == SPACE_SEQ) { - return sa->spacedata.first; + ScrArea *area = CTX_wm_area(C); + if (area && area->spacetype == SPACE_SEQ) { + return area->spacedata.first; } return NULL; } struct SpaceOutliner *CTX_wm_space_outliner(const bContext *C) { - ScrArea *sa = CTX_wm_area(C); - if (sa && sa->spacetype == SPACE_OUTLINER) { - return sa->spacedata.first; + ScrArea *area = CTX_wm_area(C); + if (area && area->spacetype == SPACE_OUTLINER) { + return area->spacedata.first; } return NULL; } struct SpaceNla *CTX_wm_space_nla(const bContext *C) { - ScrArea *sa = CTX_wm_area(C); - if (sa && sa->spacetype == SPACE_NLA) { - return sa->spacedata.first; + ScrArea *area = CTX_wm_area(C); + if (area && area->spacetype == SPACE_NLA) { + return area->spacedata.first; } return NULL; } struct SpaceNode *CTX_wm_space_node(const bContext *C) { - ScrArea *sa = CTX_wm_area(C); - if (sa && sa->spacetype == SPACE_NODE) { - return sa->spacedata.first; + ScrArea *area = CTX_wm_area(C); + if (area && area->spacetype == SPACE_NODE) { + return area->spacedata.first; } return NULL; } struct SpaceGraph *CTX_wm_space_graph(const bContext *C) { - ScrArea *sa = CTX_wm_area(C); - if (sa && sa->spacetype == SPACE_GRAPH) { - return sa->spacedata.first; + ScrArea *area = CTX_wm_area(C); + if (area && area->spacetype == SPACE_GRAPH) { + return area->spacedata.first; } return NULL; } struct SpaceAction *CTX_wm_space_action(const bContext *C) { - ScrArea *sa = CTX_wm_area(C); - if (sa && sa->spacetype == SPACE_ACTION) { - return sa->spacedata.first; + ScrArea *area = CTX_wm_area(C); + if (area && area->spacetype == SPACE_ACTION) { + return area->spacedata.first; } return NULL; } struct SpaceInfo *CTX_wm_space_info(const bContext *C) { - ScrArea *sa = CTX_wm_area(C); - if (sa && sa->spacetype == SPACE_INFO) { - return sa->spacedata.first; + ScrArea *area = CTX_wm_area(C); + if (area && area->spacetype == SPACE_INFO) { + return area->spacedata.first; } return NULL; } struct SpaceUserPref *CTX_wm_space_userpref(const bContext *C) { - ScrArea *sa = CTX_wm_area(C); - if (sa && sa->spacetype == SPACE_USERPREF) { - return sa->spacedata.first; + ScrArea *area = CTX_wm_area(C); + if (area && area->spacetype == SPACE_USERPREF) { + return area->spacedata.first; } return NULL; } struct SpaceClip *CTX_wm_space_clip(const bContext *C) { - ScrArea *sa = CTX_wm_area(C); - if (sa && sa->spacetype == SPACE_CLIP) { - return sa->spacedata.first; + ScrArea *area = CTX_wm_area(C); + if (area && area->spacetype == SPACE_CLIP) { + return area->spacedata.first; } return NULL; } struct SpaceTopBar *CTX_wm_space_topbar(const bContext *C) { - ScrArea *sa = CTX_wm_area(C); - if (sa && sa->spacetype == SPACE_TOPBAR) { - return sa->spacedata.first; + ScrArea *area = CTX_wm_area(C); + if (area && area->spacetype == SPACE_TOPBAR) { + return area->spacedata.first; } return NULL; } diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 5dca9bf2ac5..0fb70869ac0 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -3199,9 +3199,9 @@ static void image_walk_id_all_users( for (wmWindow *win = wm->windows.first; win; win = win->next) { const bScreen *screen = BKE_workspace_active_screen_get(win->workspace_hook); - for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) { - if (sa->spacetype == SPACE_IMAGE) { - SpaceImage *sima = sa->spacedata.first; + for (ScrArea *area = screen->areabase.first; area; area = area->next) { + if (area->spacetype == SPACE_IMAGE) { + SpaceImage *sima = area->spacedata.first; callback(sima->image, NULL, &sima->iuser, customdata); } } diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c index 6c888e7b19e..96615ced904 100644 --- a/source/blender/blenkernel/intern/screen.c +++ b/source/blender/blenkernel/intern/screen.c @@ -338,15 +338,17 @@ void BKE_spacedata_draw_locks(int set) /** * Version of #BKE_area_find_region_type that also works if \a slink - * is not the active space of \a sa. + * is not the active space of \a area. */ -ARegion *BKE_spacedata_find_region_type(const SpaceLink *slink, const ScrArea *sa, int region_type) +ARegion *BKE_spacedata_find_region_type(const SpaceLink *slink, + const ScrArea *area, + int region_type) { - const bool is_slink_active = slink == sa->spacedata.first; - const ListBase *regionbase = (is_slink_active) ? &sa->regionbase : &slink->regionbase; + const bool is_slink_active = slink == area->spacedata.first; + const ListBase *regionbase = (is_slink_active) ? &area->regionbase : &slink->regionbase; ARegion *region = NULL; - BLI_assert(BLI_findindex(&sa->spacedata, slink) != -1); + BLI_assert(BLI_findindex(&area->spacedata, slink) != -1); for (region = regionbase->first; region; region = region->next) { if (region->regiontype == region_type) { break; @@ -354,26 +356,26 @@ ARegion *BKE_spacedata_find_region_type(const SpaceLink *slink, const ScrArea *s } /* Should really unit test this instead. */ - BLI_assert(!is_slink_active || region == BKE_area_find_region_type(sa, region_type)); + BLI_assert(!is_slink_active || region == BKE_area_find_region_type(area, region_type)); return region; } -static void (*spacedata_id_remap_cb)(struct ScrArea *sa, +static void (*spacedata_id_remap_cb)(struct ScrArea *area, struct SpaceLink *sl, ID *old_id, ID *new_id) = NULL; -void BKE_spacedata_callback_id_remap_set(void (*func)(ScrArea *sa, SpaceLink *sl, ID *, ID *)) +void BKE_spacedata_callback_id_remap_set(void (*func)(ScrArea *area, SpaceLink *sl, ID *, ID *)) { spacedata_id_remap_cb = func; } /* UNUSED!!! */ -void BKE_spacedata_id_unref(struct ScrArea *sa, struct SpaceLink *sl, struct ID *id) +void BKE_spacedata_id_unref(struct ScrArea *area, struct SpaceLink *sl, struct ID *id) { if (spacedata_id_remap_cb) { - spacedata_id_remap_cb(sa, sl, id, NULL); + spacedata_id_remap_cb(area, sl, id, NULL); } } @@ -393,10 +395,10 @@ void BKE_screen_gizmo_tag_refresh(struct bScreen *sc) return; } - ScrArea *sa; + ScrArea *area; ARegion *region; - for (sa = sc->areabase.first; sa; sa = sa->next) { - for (region = sa->regionbase.first; region; region = region->next) { + for (area = sc->areabase.first; area; area = area->next) { + for (region = area->regionbase.first; region; region = region->next) { if (region->gizmo_map != NULL) { region_refresh_tag_gizmomap_callback(region->gizmo_map); } @@ -482,21 +484,21 @@ void BKE_area_region_free(SpaceType *st, ARegion *region) } /* not area itself */ -void BKE_screen_area_free(ScrArea *sa) +void BKE_screen_area_free(ScrArea *area) { - SpaceType *st = BKE_spacetype_from_id(sa->spacetype); + SpaceType *st = BKE_spacetype_from_id(area->spacetype); ARegion *region; - for (region = sa->regionbase.first; region; region = region->next) { + for (region = area->regionbase.first; region; region = region->next) { BKE_area_region_free(st, region); } - MEM_SAFE_FREE(sa->global); - BLI_freelistN(&sa->regionbase); + MEM_SAFE_FREE(area->global); + BLI_freelistN(&area->regionbase); - BKE_spacedata_freelist(&sa->spacedata); + BKE_spacedata_freelist(&area->spacedata); - BLI_freelistN(&sa->actionzones); + BLI_freelistN(&area->actionzones); } void BKE_screen_area_map_free(ScrAreaMap *area_map) @@ -548,7 +550,7 @@ void BKE_screen_remove_double_scrverts(bScreen *sc) { ScrVert *v1, *verg; ScrEdge *se; - ScrArea *sa; + ScrArea *area; verg = sc->vertbase.first; while (verg) { @@ -580,21 +582,21 @@ void BKE_screen_remove_double_scrverts(bScreen *sc) BKE_screen_sort_scrvert(&(se->v1), &(se->v2)); se = se->next; } - sa = sc->areabase.first; - while (sa) { - if (sa->v1->newv) { - sa->v1 = sa->v1->newv; + area = sc->areabase.first; + while (area) { + if (area->v1->newv) { + area->v1 = area->v1->newv; } - if (sa->v2->newv) { - sa->v2 = sa->v2->newv; + if (area->v2->newv) { + area->v2 = area->v2->newv; } - if (sa->v3->newv) { - sa->v3 = sa->v3->newv; + if (area->v3->newv) { + area->v3 = area->v3->newv; } - if (sa->v4->newv) { - sa->v4 = sa->v4->newv; + if (area->v4->newv) { + area->v4 = area->v4->newv; } - sa = sa->next; + area = area->next; } /* remove */ @@ -632,41 +634,41 @@ void BKE_screen_remove_double_scredges(bScreen *sc) void BKE_screen_remove_unused_scredges(bScreen *sc) { ScrEdge *se, *sen; - ScrArea *sa; + ScrArea *area; int a = 0; /* sets flags when edge is used in area */ - sa = sc->areabase.first; - while (sa) { - se = BKE_screen_find_edge(sc, sa->v1, sa->v2); + area = sc->areabase.first; + while (area) { + se = BKE_screen_find_edge(sc, area->v1, area->v2); if (se == NULL) { printf("error: area %d edge 1 doesn't exist\n", a); } else { se->flag = 1; } - se = BKE_screen_find_edge(sc, sa->v2, sa->v3); + se = BKE_screen_find_edge(sc, area->v2, area->v3); if (se == NULL) { printf("error: area %d edge 2 doesn't exist\n", a); } else { se->flag = 1; } - se = BKE_screen_find_edge(sc, sa->v3, sa->v4); + se = BKE_screen_find_edge(sc, area->v3, area->v4); if (se == NULL) { printf("error: area %d edge 3 doesn't exist\n", a); } else { se->flag = 1; } - se = BKE_screen_find_edge(sc, sa->v4, sa->v1); + se = BKE_screen_find_edge(sc, area->v4, area->v1); if (se == NULL) { printf("error: area %d edge 4 doesn't exist\n", a); } else { se->flag = 1; } - sa = sa->next; + area = area->next; a++; } se = sc->edgebase.first; @@ -714,15 +716,15 @@ void BKE_screen_remove_unused_scrverts(bScreen *sc) /* ***************** Utilities ********************** */ /** - * Find a region of type \a region_type in the currently active space of \a sa. + * Find a region of type \a region_type in the currently active space of \a area. * * \note This does _not_ work if the region to look up is not in the active * space. Use #BKE_spacedata_find_region_type if that may be the case. */ -ARegion *BKE_area_find_region_type(const ScrArea *sa, int region_type) +ARegion *BKE_area_find_region_type(const ScrArea *area, int region_type) { - if (sa) { - for (ARegion *region = sa->regionbase.first; region; region = region->next) { + if (area) { + for (ARegion *region = area->regionbase.first; region; region = region->next) { if (region->regiontype == region_type) { return region; } @@ -732,26 +734,26 @@ ARegion *BKE_area_find_region_type(const ScrArea *sa, int region_type) return NULL; } -ARegion *BKE_area_find_region_active_win(ScrArea *sa) +ARegion *BKE_area_find_region_active_win(ScrArea *area) { - if (sa) { - ARegion *region = BLI_findlink(&sa->regionbase, sa->region_active_win); + if (area) { + ARegion *region = BLI_findlink(&area->regionbase, area->region_active_win); if (region && (region->regiontype == RGN_TYPE_WINDOW)) { return region; } /* fallback to any */ - return BKE_area_find_region_type(sa, RGN_TYPE_WINDOW); + return BKE_area_find_region_type(area, RGN_TYPE_WINDOW); } return NULL; } -ARegion *BKE_area_find_region_xy(ScrArea *sa, const int regiontype, int x, int y) +ARegion *BKE_area_find_region_xy(ScrArea *area, const int regiontype, int x, int y) { ARegion *region_found = NULL; - if (sa) { + if (area) { ARegion *region; - for (region = sa->regionbase.first; region; region = region->next) { + for (region = area->regionbase.first; region; region = region->next) { if ((regiontype == RGN_TYPE_ANY) || (region->regiontype == regiontype)) { if (BLI_rcti_isect_pt(®ion->winrct, x, y)) { region_found = region; @@ -786,15 +788,15 @@ ARegion *BKE_screen_find_region_xy(bScreen *sc, const int regiontype, int x, int */ ScrArea *BKE_screen_find_area_from_space(struct bScreen *sc, SpaceLink *sl) { - ScrArea *sa; + ScrArea *area; - for (sa = sc->areabase.first; sa; sa = sa->next) { - if (BLI_findindex(&sa->spacedata, sl) != -1) { + for (area = sc->areabase.first; area; area = area->next) { + if (BLI_findindex(&area->spacedata, sl) != -1) { break; } } - return sa; + return area; } /** @@ -803,16 +805,16 @@ ScrArea *BKE_screen_find_area_from_space(struct bScreen *sc, SpaceLink *sl) */ ScrArea *BKE_screen_find_big_area(bScreen *sc, const int spacetype, const short min) { - ScrArea *sa, *big = NULL; + ScrArea *area, *big = NULL; int size, maxsize = 0; - for (sa = sc->areabase.first; sa; sa = sa->next) { - if ((spacetype == SPACE_TYPE_ANY) || (sa->spacetype == spacetype)) { - if (min <= sa->winx && min <= sa->winy) { - size = sa->winx * sa->winy; + for (area = sc->areabase.first; area; area = area->next) { + if ((spacetype == SPACE_TYPE_ANY) || (area->spacetype == spacetype)) { + if (min <= area->winx && min <= area->winy) { + size = area->winx * area->winy; if (size > maxsize) { maxsize = size; - big = sa; + big = area; } } } @@ -826,10 +828,10 @@ ScrArea *BKE_screen_area_map_find_area_xy(const ScrAreaMap *areamap, int x, int y) { - for (ScrArea *sa = areamap->areabase.first; sa; sa = sa->next) { - if (BLI_rcti_isect_pt(&sa->totrct, x, y)) { - if ((spacetype == SPACE_TYPE_ANY) || (sa->spacetype == spacetype)) { - return sa; + for (ScrArea *area = areamap->areabase.first; area; area = area->next) { + if (BLI_rcti_isect_pt(&area->totrct, x, y)) { + if ((spacetype == SPACE_TYPE_ANY) || (area->spacetype == spacetype)) { + return area; } break; } @@ -864,10 +866,10 @@ void BKE_screen_view3d_sync(View3D *v3d, struct Scene *scene) void BKE_screen_view3d_scene_sync(bScreen *sc, Scene *scene) { /* are there cameras in the views that are not in the scene? */ - ScrArea *sa; - for (sa = sc->areabase.first; sa; sa = sa->next) { + ScrArea *area; + for (area = sc->areabase.first; area; area = area->next) { SpaceLink *sl; - for (sl = sa->spacedata.first; sl; sl = sl->next) { + for (sl = area->spacedata.first; sl; sl = sl->next) { if (sl->spacetype == SPACE_VIEW3D) { View3D *v3d = (View3D *)sl; BKE_screen_view3d_sync(v3d, scene); @@ -913,17 +915,17 @@ bool BKE_screen_is_used(const bScreen *screen) void BKE_screen_header_alignment_reset(bScreen *screen) { int alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP; - for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) { - for (ARegion *region = sa->regionbase.first; region; region = region->next) { + for (ScrArea *area = screen->areabase.first; area; area = area->next) { + for (ARegion *region = area->regionbase.first; region; region = region->next) { if (ELEM(region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) { - if (ELEM(sa->spacetype, SPACE_FILE, SPACE_USERPREF, SPACE_OUTLINER, SPACE_PROPERTIES)) { + if (ELEM(area->spacetype, SPACE_FILE, SPACE_USERPREF, SPACE_OUTLINER, SPACE_PROPERTIES)) { region->alignment = RGN_ALIGN_TOP; continue; } region->alignment = alignment; } if (region->regiontype == RGN_TYPE_FOOTER) { - if (ELEM(sa->spacetype, SPACE_FILE, SPACE_USERPREF, SPACE_OUTLINER, SPACE_PROPERTIES)) { + if (ELEM(area->spacetype, SPACE_FILE, SPACE_USERPREF, SPACE_OUTLINER, SPACE_PROPERTIES)) { region->alignment = RGN_ALIGN_BOTTOM; continue; } |