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
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenkernel/intern/screen.c')
-rw-r--r--source/blender/blenkernel/intern/screen.c146
1 files changed, 74 insertions, 72 deletions
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(&region->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;
}