From 905c0269f302e8e0e7a27dda8d5256fdcd06ce60 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Fri, 3 Apr 2020 13:25:03 +0200 Subject: 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. --- source/blender/editors/screen/area.c | 462 ++++++++++----------- source/blender/editors/screen/area_utils.c | 2 +- source/blender/editors/screen/screen_context.c | 24 +- source/blender/editors/screen/screen_draw.c | 176 ++++---- source/blender/editors/screen/screen_edit.c | 375 ++++++++--------- source/blender/editors/screen/screen_geometry.c | 59 ++- source/blender/editors/screen/screen_intern.h | 11 +- source/blender/editors/screen/screen_ops.c | 366 ++++++++-------- source/blender/editors/screen/screendump.c | 6 +- .../blender/editors/screen/workspace_layout_edit.c | 8 +- 10 files changed, 747 insertions(+), 742 deletions(-) (limited to 'source/blender/editors/screen') diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index efa98c358df..58e2bb8d037 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -146,7 +146,7 @@ void ED_region_pixelspace(ARegion *region) /* only exported for WM */ void ED_region_do_listen( - wmWindow *win, ScrArea *sa, ARegion *region, wmNotifier *note, const Scene *scene) + wmWindow *win, ScrArea *area, ARegion *region, wmNotifier *note, const Scene *scene) { /* generic notes first */ switch (note->category) { @@ -161,27 +161,27 @@ void ED_region_do_listen( } if (region->type && region->type->listener) { - region->type->listener(win, sa, region, note, scene); + region->type->listener(win, area, region, note, scene); } } /* only exported for WM */ -void ED_area_do_listen(wmWindow *win, ScrArea *sa, wmNotifier *note, Scene *scene) +void ED_area_do_listen(wmWindow *win, ScrArea *area, wmNotifier *note, Scene *scene) { /* no generic notes? */ - if (sa->type && sa->type->listener) { - sa->type->listener(win, sa, note, scene); + if (area->type && area->type->listener) { + area->type->listener(win, area, note, scene); } } /* only exported for WM */ -void ED_area_do_refresh(bContext *C, ScrArea *sa) +void ED_area_do_refresh(bContext *C, ScrArea *area) { /* no generic notes? */ - if (sa->type && sa->type->refresh) { - sa->type->refresh(C, sa); + if (area->type && area->type->refresh) { + area->type->refresh(C, area); } - sa->do_refresh = false; + area->do_refresh = false; } /** @@ -294,16 +294,16 @@ static void region_draw_azone_tab_arrow(AZone *az) draw_azone_arrow((float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, az->edge); } -static void area_azone_tag_update(ScrArea *sa) +static void area_azone_tag_update(ScrArea *area) { - sa->flag |= AREA_FLAG_ACTIONZONES_UPDATE; + area->flag |= AREA_FLAG_ACTIONZONES_UPDATE; } -static void region_draw_azones(ScrArea *sa, ARegion *region) +static void region_draw_azones(ScrArea *area, ARegion *region) { AZone *az; - if (!sa) { + if (!area) { return; } @@ -315,7 +315,7 @@ static void region_draw_azones(ScrArea *sa, ARegion *region) GPU_matrix_push(); GPU_matrix_translate_2f(-region->winrct.xmin, -region->winrct.ymin); - for (az = sa->actionzones.first; az; az = az->next) { + for (az = area->actionzones.first; az; az = az->next) { /* test if action zone is over this region */ rcti azrct; BLI_rcti_init(&azrct, az->x1, az->x2, az->y1, az->y2); @@ -339,7 +339,7 @@ static void region_draw_azones(ScrArea *sa, ARegion *region) } } if (!IS_EQF(az->alpha, 0.0f) && ELEM(az->type, AZONE_FULLSCREEN, AZONE_REGION_SCROLL)) { - area_azone_tag_update(sa); + area_azone_tag_update(area); } } @@ -348,9 +348,9 @@ static void region_draw_azones(ScrArea *sa, ARegion *region) GPU_blend(false); } -static void region_draw_status_text(ScrArea *sa, ARegion *region) +static void region_draw_status_text(ScrArea *area, ARegion *region) { - bool overlap = ED_region_is_overlap(sa->spacetype, region->regiontype); + bool overlap = ED_region_is_overlap(area->spacetype, region->regiontype); if (overlap) { GPU_clear_color(0.0, 0.0, 0.0, 0.0); @@ -421,8 +421,8 @@ void ED_area_do_msg_notify_tag_refresh( wmMsgSubscribeKey *UNUSED(msg_key), wmMsgSubscribeValue *msg_val) { - ScrArea *sa = msg_val->user_data; - ED_area_tag_refresh(sa); + ScrArea *area = msg_val->user_data; + ED_area_tag_refresh(area); } void ED_area_do_mgs_subscribe_for_tool_header( @@ -431,7 +431,7 @@ void ED_area_do_mgs_subscribe_for_tool_header( struct WorkSpace *workspace, struct Scene *UNUSED(scene), struct bScreen *UNUSED(screen), - struct ScrArea *UNUSED(sa), + struct ScrArea *UNUSED(area), struct ARegion *region, struct wmMsgBus *mbus) { @@ -451,7 +451,7 @@ void ED_area_do_mgs_subscribe_for_tool_ui( struct WorkSpace *workspace, struct Scene *UNUSED(scene), struct bScreen *UNUSED(screen), - struct ScrArea *UNUSED(sa), + struct ScrArea *UNUSED(area), struct ARegion *region, struct wmMsgBus *mbus) { @@ -483,20 +483,20 @@ static bool area_is_pseudo_minimized(const ScrArea *area) void ED_region_do_layout(bContext *C, ARegion *region) { /* This is optional, only needed for dynamically sized regions. */ - ScrArea *sa = CTX_wm_area(C); + ScrArea *area = CTX_wm_area(C); ARegionType *at = region->type; if (!at->layout) { return; } - if (at->do_lock || (sa && area_is_pseudo_minimized(sa))) { + if (at->do_lock || (area && area_is_pseudo_minimized(area))) { return; } region->do_draw |= RGN_DRAWING; - UI_SetTheme(sa ? sa->spacetype : 0, at->regionid); + UI_SetTheme(area ? area->spacetype : 0, at->regionid); at->layout(C, region); } @@ -504,7 +504,7 @@ void ED_region_do_layout(bContext *C, ARegion *region) void ED_region_do_draw(bContext *C, ARegion *region) { wmWindow *win = CTX_wm_window(C); - ScrArea *sa = CTX_wm_area(C); + ScrArea *area = CTX_wm_area(C); ARegionType *at = region->type; /* see BKE_spacedata_draw_locks() */ @@ -519,16 +519,16 @@ void ED_region_do_draw(bContext *C, ARegion *region) wmOrtho2_region_pixelspace(region); - UI_SetTheme(sa ? sa->spacetype : 0, at->regionid); + UI_SetTheme(area ? area->spacetype : 0, at->regionid); - if (sa && area_is_pseudo_minimized(sa)) { + if (area && area_is_pseudo_minimized(area)) { UI_ThemeClearColor(TH_EDITOR_OUTLINE); glClear(GL_COLOR_BUFFER_BIT); return; } /* optional header info instead? */ else if (region->headerstr) { - region_draw_status_text(sa, region); + region_draw_status_text(area, region); } else if (at->draw) { at->draw(C, region); @@ -540,7 +540,7 @@ void ED_region_do_draw(bContext *C, ARegion *region) ED_region_draw_cb_draw(C, region, REGION_DRAW_POST_PIXEL); - region_draw_azones(sa, region); + region_draw_azones(area, region); /* for debugging unneeded area redraws and partial redraw */ if (G.debug_value == 888) { @@ -562,11 +562,11 @@ void ED_region_do_draw(bContext *C, ARegion *region) UI_blocklist_free_inactive(C, ®ion->uiblocks); - if (sa) { + if (area) { const bScreen *screen = WM_window_get_active_screen(win); /* Only region emboss for top-bar */ - if ((screen->state != SCREENFULL) && ED_area_is_global(sa)) { + if ((screen->state != SCREENFULL) && ED_area_is_global(area)) { region_draw_emboss(region, ®ion->winrct, (REGION_EMBOSS_LEFT | REGION_EMBOSS_RIGHT)); } else if ((region->regiontype == RGN_TYPE_WINDOW) && (region->alignment == RGN_ALIGN_QSPLIT)) { @@ -604,7 +604,7 @@ void ED_region_do_draw(bContext *C, ARegion *region) */ if (ELEM( region->regiontype, RGN_TYPE_WINDOW, RGN_TYPE_CHANNELS, RGN_TYPE_UI, RGN_TYPE_TOOLS)) { - SpaceLink *sl = sa->spacedata.first; + SpaceLink *sl = area->spacedata.first; PointerRNA ptr; RNA_pointer_create(&screen->id, &RNA_Space, sl, &ptr); @@ -618,7 +618,7 @@ void ED_region_do_draw(bContext *C, ARegion *region) WM_msg_subscribe_rna(mbus, &ptr, NULL, &msg_sub_value_region_tag_redraw, __func__); } - ED_region_message_subscribe(C, workspace, scene, screen, sa, region, mbus); + ED_region_message_subscribe(C, workspace, scene, screen, area, region, mbus); } } @@ -705,34 +705,34 @@ void ED_region_tag_redraw_partial(ARegion *region, const rcti *rct, bool rebuild } } -void ED_area_tag_redraw(ScrArea *sa) +void ED_area_tag_redraw(ScrArea *area) { ARegion *region; - if (sa) { - for (region = sa->regionbase.first; region; region = region->next) { + if (area) { + for (region = area->regionbase.first; region; region = region->next) { ED_region_tag_redraw(region); } } } -void ED_area_tag_redraw_no_rebuild(ScrArea *sa) +void ED_area_tag_redraw_no_rebuild(ScrArea *area) { ARegion *region; - if (sa) { - for (region = sa->regionbase.first; region; region = region->next) { + if (area) { + for (region = area->regionbase.first; region; region = region->next) { ED_region_tag_redraw_no_rebuild(region); } } } -void ED_area_tag_redraw_regiontype(ScrArea *sa, int regiontype) +void ED_area_tag_redraw_regiontype(ScrArea *area, int regiontype) { ARegion *region; - if (sa) { - for (region = sa->regionbase.first; region; region = region->next) { + if (area) { + for (region = area->regionbase.first; region; region = region->next) { if (region->regiontype == regiontype) { ED_region_tag_redraw(region); } @@ -740,26 +740,26 @@ void ED_area_tag_redraw_regiontype(ScrArea *sa, int regiontype) } } -void ED_area_tag_refresh(ScrArea *sa) +void ED_area_tag_refresh(ScrArea *area) { - if (sa) { - sa->do_refresh = true; + if (area) { + area->do_refresh = true; } } /* *************************************************************** */ /* use NULL to disable it */ -void ED_area_status_text(ScrArea *sa, const char *str) +void ED_area_status_text(ScrArea *area, const char *str) { ARegion *region; /* happens when running transform operators in background mode */ - if (sa == NULL) { + if (area == NULL) { return; } - for (region = sa->regionbase.first; region; region = region->next) { + for (region = area->regionbase.first; region; region = region->next) { if (region->regiontype == RGN_TYPE_HEADER) { if (str) { if (region->headerstr == NULL) { @@ -799,9 +799,9 @@ void ED_workspace_status_text(bContext *C, const char *str) } /* Redraw status bar. */ - for (ScrArea *sa = win->global_areas.areabase.first; sa; sa = sa->next) { - if (sa->spacetype == SPACE_STATUSBAR) { - ED_area_tag_redraw(sa); + for (ScrArea *area = win->global_areas.areabase.first; area; area = area->next) { + if (area->spacetype == SPACE_STATUSBAR) { + ED_area_tag_redraw(area); break; } } @@ -809,12 +809,12 @@ void ED_workspace_status_text(bContext *C, const char *str) /* ************************************************************ */ -static void area_azone_initialize(wmWindow *win, const bScreen *screen, ScrArea *sa) +static void area_azone_initialize(wmWindow *win, const bScreen *screen, ScrArea *area) { AZone *az; /* reinitialize entirely, regions and fullscreen add azones too */ - BLI_freelistN(&sa->actionzones); + BLI_freelistN(&area->actionzones); if (screen->state != SCREENNORMAL) { return; @@ -824,7 +824,7 @@ static void area_azone_initialize(wmWindow *win, const bScreen *screen, ScrArea return; } - if (ED_area_is_global(sa)) { + if (ED_area_is_global(area)) { return; } @@ -834,25 +834,25 @@ static void area_azone_initialize(wmWindow *win, const bScreen *screen, ScrArea const float coords[4][4] = { /* Bottom-left. */ - {sa->totrct.xmin - U.pixelsize, - sa->totrct.ymin - U.pixelsize, - sa->totrct.xmin + AZONESPOTW, - sa->totrct.ymin + AZONESPOTH}, + {area->totrct.xmin - U.pixelsize, + area->totrct.ymin - U.pixelsize, + area->totrct.xmin + AZONESPOTW, + area->totrct.ymin + AZONESPOTH}, /* Bottom-right. */ - {sa->totrct.xmax - AZONESPOTW, - sa->totrct.ymin - U.pixelsize, - sa->totrct.xmax + U.pixelsize, - sa->totrct.ymin + AZONESPOTH}, + {area->totrct.xmax - AZONESPOTW, + area->totrct.ymin - U.pixelsize, + area->totrct.xmax + U.pixelsize, + area->totrct.ymin + AZONESPOTH}, /* Top-left. */ - {sa->totrct.xmin - U.pixelsize, - sa->totrct.ymax - AZONESPOTH, - sa->totrct.xmin + AZONESPOTW, - sa->totrct.ymax + U.pixelsize}, + {area->totrct.xmin - U.pixelsize, + area->totrct.ymax - AZONESPOTH, + area->totrct.xmin + AZONESPOTW, + area->totrct.ymax + U.pixelsize}, /* Top-right. */ - {sa->totrct.xmax - AZONESPOTW, - sa->totrct.ymax - AZONESPOTH, - sa->totrct.xmax + U.pixelsize, - sa->totrct.ymax + U.pixelsize}, + {area->totrct.xmax - AZONESPOTW, + area->totrct.ymax - AZONESPOTH, + area->totrct.xmax + U.pixelsize, + area->totrct.ymax + U.pixelsize}, }; for (int i = 0; i < 4; i++) { @@ -869,7 +869,7 @@ static void area_azone_initialize(wmWindow *win, const bScreen *screen, ScrArea /* set area action zones */ az = (AZone *)MEM_callocN(sizeof(AZone), "actionzone"); - BLI_addtail(&(sa->actionzones), az); + BLI_addtail(&(area->actionzones), az); az->type = AZONE_AREA; az->x1 = coords[i][0]; az->y1 = coords[i][1]; @@ -879,16 +879,16 @@ static void area_azone_initialize(wmWindow *win, const bScreen *screen, ScrArea } } -static void fullscreen_azone_initialize(ScrArea *sa, ARegion *region) +static void fullscreen_azone_initialize(ScrArea *area, ARegion *region) { AZone *az; - if (ED_area_is_global(sa) || (region->regiontype != RGN_TYPE_WINDOW)) { + if (ED_area_is_global(area) || (region->regiontype != RGN_TYPE_WINDOW)) { return; } az = (AZone *)MEM_callocN(sizeof(AZone), "fullscreen action zone"); - BLI_addtail(&(sa->actionzones), az); + BLI_addtail(&(area->actionzones), az); az->type = AZONE_FULLSCREEN; az->region = region; az->alpha = 0.0f; @@ -942,7 +942,7 @@ static void region_azone_edge(AZone *az, ARegion *region) } /* region already made zero sized, in shape of edge */ -static void region_azone_tab_plus(ScrArea *sa, AZone *az, ARegion *region) +static void region_azone_tab_plus(ScrArea *area, AZone *az, ARegion *region) { AZone *azt; int tot = 0, add; @@ -952,7 +952,7 @@ static void region_azone_tab_plus(ScrArea *sa, AZone *az, ARegion *region) const float tab_size_x = 0.7f * U.widget_unit; const float tab_size_y = 0.4f * U.widget_unit; - for (azt = sa->actionzones.first; azt; azt = azt->next) { + for (azt = area->actionzones.first; azt; azt = azt->next) { if (azt->edge == az->edge) { tot++; } @@ -960,7 +960,7 @@ static void region_azone_tab_plus(ScrArea *sa, AZone *az, ARegion *region) switch (az->edge) { case AE_TOP_TO_BOTTOMRIGHT: - add = (region->winrct.ymax == sa->totrct.ymin) ? 1 : 0; + add = (region->winrct.ymax == area->totrct.ymin) ? 1 : 0; az->x1 = region->winrct.xmax - ((edge_offset + 1.0f) * tab_size_x); az->y1 = region->winrct.ymax - add; az->x2 = region->winrct.xmax - (edge_offset * tab_size_x); @@ -1003,7 +1003,7 @@ static bool region_azone_edge_poll(const ARegion *region, const bool is_fullscre return true; } -static void region_azone_edge_initialize(ScrArea *sa, +static void region_azone_edge_initialize(ScrArea *area, ARegion *region, AZEdge edge, const bool is_fullscreen) @@ -1016,27 +1016,27 @@ static void region_azone_edge_initialize(ScrArea *sa, } az = (AZone *)MEM_callocN(sizeof(AZone), "actionzone"); - BLI_addtail(&(sa->actionzones), az); + BLI_addtail(&(area->actionzones), az); az->type = AZONE_REGION; az->region = region; az->edge = edge; if (is_hidden) { - region_azone_tab_plus(sa, az, region); + region_azone_tab_plus(area, az, region); } else { region_azone_edge(az, region); } } -static void region_azone_scrollbar_initialize(ScrArea *sa, +static void region_azone_scrollbar_initialize(ScrArea *area, ARegion *region, AZScrollDirection direction) { rcti scroller_vert = (direction == AZ_SCROLL_VERT) ? region->v2d.vert : region->v2d.hor; AZone *az = MEM_callocN(sizeof(*az), __func__); - BLI_addtail(&sa->actionzones, az); + BLI_addtail(&area->actionzones, az); az->type = AZONE_REGION_SCROLL; az->region = region; az->direction = direction; @@ -1057,21 +1057,21 @@ static void region_azone_scrollbar_initialize(ScrArea *sa, BLI_rcti_init(&az->rect, az->x1, az->x2, az->y1, az->y2); } -static void region_azones_scrollbars_initialize(ScrArea *sa, ARegion *region) +static void region_azones_scrollbars_initialize(ScrArea *area, ARegion *region) { const View2D *v2d = ®ion->v2d; if ((v2d->scroll & V2D_SCROLL_VERTICAL) && ((v2d->scroll & V2D_SCROLL_VERTICAL_HANDLES) == 0)) { - region_azone_scrollbar_initialize(sa, region, AZ_SCROLL_VERT); + region_azone_scrollbar_initialize(area, region, AZ_SCROLL_VERT); } if ((v2d->scroll & V2D_SCROLL_HORIZONTAL) && ((v2d->scroll & V2D_SCROLL_HORIZONTAL_HANDLES) == 0)) { - region_azone_scrollbar_initialize(sa, region, AZ_SCROLL_HOR); + region_azone_scrollbar_initialize(area, region, AZ_SCROLL_HOR); } } /* *************************************************************** */ -static void region_azones_add_edge(ScrArea *sa, +static void region_azones_add_edge(ScrArea *area, ARegion *region, const int alignment, const bool is_fullscreen) @@ -1079,20 +1079,20 @@ static void region_azones_add_edge(ScrArea *sa, /* edge code (t b l r) is along which area edge azone will be drawn */ if (alignment == RGN_ALIGN_TOP) { - region_azone_edge_initialize(sa, region, AE_BOTTOM_TO_TOPLEFT, is_fullscreen); + region_azone_edge_initialize(area, region, AE_BOTTOM_TO_TOPLEFT, is_fullscreen); } else if (alignment == RGN_ALIGN_BOTTOM) { - region_azone_edge_initialize(sa, region, AE_TOP_TO_BOTTOMRIGHT, is_fullscreen); + region_azone_edge_initialize(area, region, AE_TOP_TO_BOTTOMRIGHT, is_fullscreen); } else if (alignment == RGN_ALIGN_RIGHT) { - region_azone_edge_initialize(sa, region, AE_LEFT_TO_TOPRIGHT, is_fullscreen); + region_azone_edge_initialize(area, region, AE_LEFT_TO_TOPRIGHT, is_fullscreen); } else if (alignment == RGN_ALIGN_LEFT) { - region_azone_edge_initialize(sa, region, AE_RIGHT_TO_TOPLEFT, is_fullscreen); + region_azone_edge_initialize(area, region, AE_RIGHT_TO_TOPLEFT, is_fullscreen); } } -static void region_azones_add(const bScreen *screen, ScrArea *sa, ARegion *region) +static void region_azones_add(const bScreen *screen, ScrArea *area, ARegion *region) { const bool is_fullscreen = screen->state == SCREENFULL; @@ -1102,20 +1102,20 @@ static void region_azones_add(const bScreen *screen, ScrArea *sa, ARegion *regio return; } - region_azones_add_edge(sa, region, RGN_ALIGN_ENUM_FROM_MASK(region->alignment), is_fullscreen); + region_azones_add_edge(area, region, RGN_ALIGN_ENUM_FROM_MASK(region->alignment), is_fullscreen); /* For a split region also continue the azone edge from the next region if this region is aligned * with the next */ if ((region->alignment & RGN_SPLIT_PREV) && region->prev) { region_azones_add_edge( - sa, region, RGN_ALIGN_ENUM_FROM_MASK(region->prev->alignment), is_fullscreen); + area, region, RGN_ALIGN_ENUM_FROM_MASK(region->prev->alignment), is_fullscreen); } if (is_fullscreen) { - fullscreen_azone_initialize(sa, region); + fullscreen_azone_initialize(area, region); } - region_azones_scrollbars_initialize(sa, region); + region_azones_scrollbars_initialize(area, region); } /* dir is direction to check, not the splitting edge direction! */ @@ -1133,7 +1133,7 @@ static int rct_fits(const rcti *rect, char dir, int size) /* region should be overlapping */ /* function checks if some overlapping region was defined before - on same place */ -static void region_overlap_fix(ScrArea *sa, ARegion *region) +static void region_overlap_fix(ScrArea *area, ARegion *region) { ARegion *ar1; const int align = RGN_ALIGN_ENUM_FROM_MASK(region->alignment); @@ -1168,7 +1168,7 @@ static void region_overlap_fix(ScrArea *sa, ARegion *region) /* translate or close */ if (ar1) { if (align1 == RGN_ALIGN_LEFT) { - if (region->winrct.xmax + ar1->winx > sa->winx - U.widget_unit) { + if (region->winrct.xmax + ar1->winx > area->winx - U.widget_unit) { region->flag |= RGN_FLAG_TOO_SMALL; return; } @@ -1235,7 +1235,7 @@ bool ED_region_is_overlap(int spacetype, int regiontype) } static void region_rect_recursive( - ScrArea *sa, ARegion *region, rcti *remainder, rcti *overlap_remainder, int quad) + ScrArea *area, ARegion *region, rcti *remainder, rcti *overlap_remainder, int quad) { rcti *remainder_prev = remainder; @@ -1259,7 +1259,7 @@ static void region_rect_recursive( int alignment = RGN_ALIGN_ENUM_FROM_MASK(region->alignment); /* set here, assuming userpref switching forces to call this again */ - region->overlap = ED_region_is_overlap(sa->spacetype, region->regiontype); + region->overlap = ED_region_is_overlap(area->spacetype, region->regiontype); /* clear state flags first */ region->flag &= ~(RGN_FLAG_TOO_SMALL | RGN_FLAG_SIZE_CLAMP_X | RGN_FLAG_SIZE_CLAMP_Y); @@ -1300,7 +1300,7 @@ static void region_rect_recursive( else if (region->regiontype == RGN_TYPE_FOOTER) { prefsizey = ED_area_footersize(); } - else if (ED_area_is_global(sa)) { + else if (ED_area_is_global(area)) { prefsizey = ED_region_global_size_y(); } else { @@ -1501,7 +1501,7 @@ static void region_rect_recursive( /* exception for multiple overlapping regions on same spot */ if (region->overlap && (alignment != RGN_ALIGN_FLOAT)) { - region_overlap_fix(sa, region); + region_overlap_fix(area, region); } /* set winrect for azones */ @@ -1548,7 +1548,7 @@ static void region_rect_recursive( BLI_assert(BLI_rcti_is_valid(®ion->winrct)); - region_rect_recursive(sa, region->next, remainder, overlap_remainder, quad); + region_rect_recursive(area, region->next, remainder, overlap_remainder, quad); /* Tag for redraw if size changes. */ if (region->winx != prev_winx || region->winy != prev_winy) { @@ -1559,42 +1559,42 @@ static void region_rect_recursive( memset(®ion->runtime.visible_rect, 0, sizeof(region->runtime.visible_rect)); } -static void area_calc_totrct(ScrArea *sa, const rcti *window_rect) +static void area_calc_totrct(ScrArea *area, const rcti *window_rect) { short px = (short)U.pixelsize; - sa->totrct.xmin = sa->v1->vec.x; - sa->totrct.xmax = sa->v4->vec.x; - sa->totrct.ymin = sa->v1->vec.y; - sa->totrct.ymax = sa->v2->vec.y; + area->totrct.xmin = area->v1->vec.x; + area->totrct.xmax = area->v4->vec.x; + area->totrct.ymin = area->v1->vec.y; + area->totrct.ymax = area->v2->vec.y; /* scale down totrct by 1 pixel on all sides not matching window borders */ - if (sa->totrct.xmin > window_rect->xmin) { - sa->totrct.xmin += px; + if (area->totrct.xmin > window_rect->xmin) { + area->totrct.xmin += px; } - if (sa->totrct.xmax < (window_rect->xmax - 1)) { - sa->totrct.xmax -= px; + if (area->totrct.xmax < (window_rect->xmax - 1)) { + area->totrct.xmax -= px; } - if (sa->totrct.ymin > window_rect->ymin) { - sa->totrct.ymin += px; + if (area->totrct.ymin > window_rect->ymin) { + area->totrct.ymin += px; } - if (sa->totrct.ymax < (window_rect->ymax - 1)) { - sa->totrct.ymax -= px; + if (area->totrct.ymax < (window_rect->ymax - 1)) { + area->totrct.ymax -= px; } /* Although the following asserts are correct they lead to a very unstable Blender. * And the asserts would fail even in 2.7x * (they were added in 2.8x as part of the top-bar commit). * For more details see T54864. */ #if 0 - BLI_assert(sa->totrct.xmin >= 0); - BLI_assert(sa->totrct.xmax >= 0); - BLI_assert(sa->totrct.ymin >= 0); - BLI_assert(sa->totrct.ymax >= 0); + BLI_assert(area->totrct.xmin >= 0); + BLI_assert(area->totrct.xmax >= 0); + BLI_assert(area->totrct.ymin >= 0); + BLI_assert(area->totrct.ymax >= 0); #endif /* for speedup */ - sa->winx = BLI_rcti_size_x(&sa->totrct) + 1; - sa->winy = BLI_rcti_size_y(&sa->totrct) + 1; + area->winx = BLI_rcti_size_x(&area->totrct) + 1; + area->winy = BLI_rcti_size_y(&area->totrct) + 1; } /* used for area initialize below */ @@ -1617,12 +1617,12 @@ static bool event_in_markers_region(const ARegion *region, const wmEvent *event) } /** - * \param region: Region, may be NULL when adding handlers for \a sa. + * \param region: Region, may be NULL when adding handlers for \a area. */ static void ed_default_handlers( - wmWindowManager *wm, ScrArea *sa, ARegion *region, ListBase *handlers, int flag) + wmWindowManager *wm, ScrArea *area, ARegion *region, ListBase *handlers, int flag) { - BLI_assert(region ? (®ion->handlers == handlers) : (&sa->handlers == handlers)); + BLI_assert(region ? (®ion->handlers == handlers) : (&area->handlers == handlers)); /* note, add-handler checks if it already exists */ @@ -1641,7 +1641,7 @@ static void ed_default_handlers( BLI_assert(®ion->handlers == handlers); if (region->gizmo_map == NULL) { region->gizmo_map = WM_gizmomap_new_from_type( - &(const struct wmGizmoMapType_Params){sa->spacetype, region->type->regionid}); + &(const struct wmGizmoMapType_Params){area->spacetype, region->type->regionid}); } WM_gizmomap_add_handlers(region, region->gizmo_map); } @@ -1668,9 +1668,9 @@ static void ed_default_handlers( } if (flag & ED_KEYMAP_TOOL) { WM_event_add_keymap_handler_dynamic( - ®ion->handlers, WM_event_get_keymap_from_toolsystem_fallback, sa); + ®ion->handlers, WM_event_get_keymap_from_toolsystem_fallback, area); WM_event_add_keymap_handler_dynamic( - ®ion->handlers, WM_event_get_keymap_from_toolsystem, sa); + ®ion->handlers, WM_event_get_keymap_from_toolsystem, area); } if (flag & ED_KEYMAP_FRAMES) { /* frame changing/jumping (for all spaces) */ @@ -1841,7 +1841,7 @@ void ED_area_update_region_sizes(wmWindowManager *wm, wmWindow *win, ScrArea *ar } /* called in screen_refresh, or screens_init, also area size changes */ -void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *sa) +void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *area) { WorkSpace *workspace = WM_window_get_active_workspace(win); const bScreen *screen = BKE_workspace_active_screen_get(win->workspace_hook); @@ -1850,49 +1850,49 @@ void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *sa) rcti rect, overlap_rect; rcti window_rect; - if (ED_area_is_global(sa) && (sa->global->flag & GLOBAL_AREA_IS_HIDDEN)) { + if (ED_area_is_global(area) && (area->global->flag & GLOBAL_AREA_IS_HIDDEN)) { return; } WM_window_rect_calc(win, &window_rect); /* set typedefinitions */ - sa->type = BKE_spacetype_from_id(sa->spacetype); + area->type = BKE_spacetype_from_id(area->spacetype); - if (sa->type == NULL) { - sa->spacetype = SPACE_VIEW3D; - sa->type = BKE_spacetype_from_id(sa->spacetype); + if (area->type == NULL) { + area->spacetype = SPACE_VIEW3D; + area->type = BKE_spacetype_from_id(area->spacetype); } - for (region = sa->regionbase.first; region; region = region->next) { - region->type = BKE_regiontype_from_id_or_first(sa->type, region->regiontype); + for (region = area->regionbase.first; region; region = region->next) { + region->type = BKE_regiontype_from_id_or_first(area->type, region->regiontype); } /* area sizes */ - area_calc_totrct(sa, &window_rect); + area_calc_totrct(area, &window_rect); /* region rect sizes */ - rect = sa->totrct; + rect = area->totrct; overlap_rect = rect; - region_rect_recursive(sa, sa->regionbase.first, &rect, &overlap_rect, 0); - sa->flag &= ~AREA_FLAG_REGION_SIZE_UPDATE; + region_rect_recursive(area, area->regionbase.first, &rect, &overlap_rect, 0); + area->flag &= ~AREA_FLAG_REGION_SIZE_UPDATE; /* default area handlers */ - ed_default_handlers(wm, sa, NULL, &sa->handlers, sa->type->keymapflag); + ed_default_handlers(wm, area, NULL, &area->handlers, area->type->keymapflag); /* checks spacedata, adds own handlers */ - if (sa->type->init) { - sa->type->init(wm, sa); + if (area->type->init) { + area->type->init(wm, area); } /* clear all azones, add the area triangle widgets */ - area_azone_initialize(win, screen, sa); + area_azone_initialize(win, screen, area); /* region windows, default and own handlers */ - for (region = sa->regionbase.first; region; region = region->next) { + for (region = area->regionbase.first; region; region = region->next) { region_subwindow(region); if (region->visible) { /* default region handlers */ - ed_default_handlers(wm, sa, region, ®ion->handlers, region->type->keymapflag); + ed_default_handlers(wm, area, region, ®ion->handlers, region->type->keymapflag); /* own handlers */ if (region->type->init) { region->type->init(wm, region); @@ -1904,18 +1904,18 @@ void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *sa) } /* Some AZones use View2D data which is only updated in region init, so call that first! */ - region_azones_add(screen, sa, region); + region_azones_add(screen, area, region); } /* Avoid re-initializing tools while resizing the window. */ if ((G.moving & G_TRANSFORM_WM) == 0) { - if ((1 << sa->spacetype) & WM_TOOLSYSTEM_SPACE_MASK) { - WM_toolsystem_refresh_screen_area(workspace, view_layer, sa); - sa->flag |= AREA_FLAG_ACTIVE_TOOL_UPDATE; + if ((1 << area->spacetype) & WM_TOOLSYSTEM_SPACE_MASK) { + WM_toolsystem_refresh_screen_area(workspace, view_layer, area); + area->flag |= AREA_FLAG_ACTIVE_TOOL_UPDATE; } else { - sa->runtime.tool = NULL; - sa->runtime.is_tool_set = true; + area->runtime.tool = NULL; + area->runtime.is_tool_set = true; } } } @@ -1948,19 +1948,19 @@ void ED_region_floating_initialize(ARegion *region) region_update_rect(region); } -void ED_region_cursor_set(wmWindow *win, ScrArea *sa, ARegion *region) +void ED_region_cursor_set(wmWindow *win, ScrArea *area, ARegion *region) { if (region != NULL) { if ((region->gizmo_map != NULL) && WM_gizmomap_cursor_set(region->gizmo_map, win)) { return; } - if (sa && region->type && region->type->cursor) { - region->type->cursor(win, sa, region); + if (area && region->type && region->type->cursor) { + region->type->cursor(win, area, region); return; } } - if (WM_cursor_set_from_tool(win, sa, region)) { + if (WM_cursor_set_from_tool(win, area, region)) { return; } @@ -1968,29 +1968,29 @@ void ED_region_cursor_set(wmWindow *win, ScrArea *sa, ARegion *region) } /* for use after changing visibility of regions */ -void ED_region_visibility_change_update(bContext *C, ScrArea *sa, ARegion *region) +void ED_region_visibility_change_update(bContext *C, ScrArea *area, ARegion *region) { if (region->flag & RGN_FLAG_HIDDEN) { WM_event_remove_handlers(C, ®ion->handlers); } - ED_area_initialize(CTX_wm_manager(C), CTX_wm_window(C), sa); - ED_area_tag_redraw(sa); + ED_area_initialize(CTX_wm_manager(C), CTX_wm_window(C), area); + ED_area_tag_redraw(area); } /* for quick toggle, can skip fades */ void region_toggle_hidden(bContext *C, ARegion *region, const bool do_fade) { - ScrArea *sa = CTX_wm_area(C); + ScrArea *area = CTX_wm_area(C); region->flag ^= RGN_FLAG_HIDDEN; if (do_fade && region->overlap) { /* starts a timer, and in end calls the stuff below itself (region_sblend_invoke()) */ - ED_region_visibility_change_update_animated(C, sa, region); + ED_region_visibility_change_update_animated(C, area, region); } else { - ED_region_visibility_change_update(C, sa, region); + ED_region_visibility_change_update(C, area, region); } } @@ -2003,48 +2003,48 @@ void ED_region_toggle_hidden(bContext *C, ARegion *region) /** * we swap spaces for fullscreen to keep all allocated data area vertices were set */ -void ED_area_data_copy(ScrArea *sa_dst, ScrArea *sa_src, const bool do_free) +void ED_area_data_copy(ScrArea *area_dst, ScrArea *area_src, const bool do_free) { SpaceType *st; ARegion *region; - const char spacetype = sa_dst->spacetype; + const char spacetype = area_dst->spacetype; const short flag_copy = HEADER_NO_PULLDOWN; - sa_dst->spacetype = sa_src->spacetype; - sa_dst->type = sa_src->type; + area_dst->spacetype = area_src->spacetype; + area_dst->type = area_src->type; - sa_dst->flag = (sa_dst->flag & ~flag_copy) | (sa_src->flag & flag_copy); + area_dst->flag = (area_dst->flag & ~flag_copy) | (area_src->flag & flag_copy); /* area */ if (do_free) { - BKE_spacedata_freelist(&sa_dst->spacedata); + BKE_spacedata_freelist(&area_dst->spacedata); } - BKE_spacedata_copylist(&sa_dst->spacedata, &sa_src->spacedata); + BKE_spacedata_copylist(&area_dst->spacedata, &area_src->spacedata); /* Note; SPACE_EMPTY is possible on new screens */ /* regions */ if (do_free) { st = BKE_spacetype_from_id(spacetype); - for (region = sa_dst->regionbase.first; region; region = region->next) { + for (region = area_dst->regionbase.first; region; region = region->next) { BKE_area_region_free(st, region); } - BLI_freelistN(&sa_dst->regionbase); + BLI_freelistN(&area_dst->regionbase); } - st = BKE_spacetype_from_id(sa_src->spacetype); - for (region = sa_src->regionbase.first; region; region = region->next) { + st = BKE_spacetype_from_id(area_src->spacetype); + for (region = area_src->regionbase.first; region; region = region->next) { ARegion *newar = BKE_area_region_copy(st, region); - BLI_addtail(&sa_dst->regionbase, newar); + BLI_addtail(&area_dst->regionbase, newar); } } -void ED_area_data_swap(ScrArea *sa_dst, ScrArea *sa_src) +void ED_area_data_swap(ScrArea *area_dst, ScrArea *area_src) { - SWAP(char, sa_dst->spacetype, sa_src->spacetype); - SWAP(SpaceType *, sa_dst->type, sa_src->type); + SWAP(char, area_dst->spacetype, area_src->spacetype); + SWAP(SpaceType *, area_dst->type, area_src->type); - SWAP(ListBase, sa_dst->spacedata, sa_src->spacedata); - SWAP(ListBase, sa_dst->regionbase, sa_src->regionbase); + SWAP(ListBase, area_dst->spacedata, area_src->spacedata); + SWAP(ListBase, area_dst->regionbase, area_src->regionbase); } /* *********** Space switching code *********** */ @@ -2078,16 +2078,16 @@ void ED_area_swapspace(bContext *C, ScrArea *sa1, ScrArea *sa2) /** * \param skip_region_exit: Skip calling area exit callback. Set for opening temp spaces. */ -void ED_area_newspace(bContext *C, ScrArea *sa, int type, const bool skip_region_exit) +void ED_area_newspace(bContext *C, ScrArea *area, int type, const bool skip_region_exit) { wmWindow *win = CTX_wm_window(C); - if (sa->spacetype != type) { + if (area->spacetype != type) { SpaceType *st; - SpaceLink *slold = sa->spacedata.first; + SpaceLink *slold = area->spacedata.first; SpaceLink *sl; - /* store sa->type->exit callback */ - void *sa_exit = sa->type ? sa->type->exit : NULL; + /* store area->type->exit callback */ + void *area_exit = area->type ? area->type->exit : NULL; /* When the user switches between space-types from the type-selector, * changing the header-type is jarring (especially when using Ctrl-MouseWheel). * @@ -2098,34 +2098,34 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type, const bool skip_region * the space type defaults to in this case instead * (needed for preferences to have space-type on bottom). */ - int header_alignment = ED_area_header_alignment_or_fallback(sa, -1); + int header_alignment = ED_area_header_alignment_or_fallback(area, -1); const bool sync_header_alignment = ((header_alignment != -1) && ((slold->link_flag & SPACE_FLAG_TYPE_TEMPORARY) == 0)); /* in some cases (opening temp space) we don't want to * call area exit callback, so we temporarily unset it */ - if (skip_region_exit && sa->type) { - sa->type->exit = NULL; + if (skip_region_exit && area->type) { + area->type->exit = NULL; } - ED_area_exit(C, sa); + ED_area_exit(C, area); /* restore old area exit callback */ - if (skip_region_exit && sa->type) { - sa->type->exit = sa_exit; + if (skip_region_exit && area->type) { + area->type->exit = area_exit; } st = BKE_spacetype_from_id(type); - sa->spacetype = type; - sa->type = st; + area->spacetype = type; + area->type = st; /* If st->new may be called, don't use context until then. The - * sa->type->context() callback has changed but data may be invalid + * area->type->context() callback has changed but data may be invalid * (e.g. with properties editor) until space-data is properly created */ /* check previously stored space */ - for (sl = sa->spacedata.first; sl; sl = sl->next) { + for (sl = area->spacedata.first; sl; sl = sl->next) { if (sl->spacetype == type) { break; } @@ -2134,7 +2134,7 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type, const bool skip_region /* old spacedata... happened during work on 2.50, remove */ if (sl && BLI_listbase_is_empty(&sl->regionbase)) { st->free(sl); - BLI_freelinkN(&sa->spacedata, sl); + BLI_freelinkN(&area->spacedata, sl); if (slold == sl) { slold = NULL; } @@ -2143,8 +2143,8 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type, const bool skip_region if (sl) { /* swap regions */ - slold->regionbase = sa->regionbase; - sa->regionbase = sl->regionbase; + slold->regionbase = area->regionbase; + area->regionbase = sl->regionbase; BLI_listbase_clear(&sl->regionbase); /* SPACE_FLAG_TYPE_WAS_ACTIVE is only used to go back to a previously active space that is * overlapped by temporary ones. It's now properly activated, so the flag should be cleared @@ -2152,22 +2152,22 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type, const bool skip_region sl->link_flag &= ~SPACE_FLAG_TYPE_WAS_ACTIVE; /* put in front of list */ - BLI_remlink(&sa->spacedata, sl); - BLI_addhead(&sa->spacedata, sl); + BLI_remlink(&area->spacedata, sl); + BLI_addhead(&area->spacedata, sl); } else { /* new space */ if (st) { /* Don't get scene from context here which may depend on space-data. */ Scene *scene = WM_window_get_active_scene(win); - sl = st->new (sa, scene); - BLI_addhead(&sa->spacedata, sl); + sl = st->new (area, scene); + BLI_addhead(&area->spacedata, sl); /* swap regions */ if (slold) { - slold->regionbase = sa->regionbase; + slold->regionbase = area->regionbase; } - sa->regionbase = sl->regionbase; + area->regionbase = sl->regionbase; BLI_listbase_clear(&sl->regionbase); } } @@ -2176,7 +2176,7 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type, const bool skip_region if (sync_header_alignment) { /* Spaces with footer. */ if (st->spaceid == SPACE_TEXT) { - for (ARegion *region = sa->regionbase.first; region; region = region->next) { + for (ARegion *region = area->regionbase.first; region; region = region->next) { if (ELEM(region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) { region->alignment = header_alignment; } @@ -2189,7 +2189,7 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type, const bool skip_region } } else { - for (ARegion *region = sa->regionbase.first; region; region = region->next) { + for (ARegion *region = area->regionbase.first; region; region = region->next) { if (ELEM(region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) { region->alignment = header_alignment; break; @@ -2198,24 +2198,24 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type, const bool skip_region } } - ED_area_initialize(CTX_wm_manager(C), win, sa); + ED_area_initialize(CTX_wm_manager(C), win, area); /* tell WM to refresh, cursor types etc */ WM_event_add_mousemove(win); /* send space change notifier */ - WM_event_add_notifier(C, NC_SPACE | ND_SPACE_CHANGED, sa); + WM_event_add_notifier(C, NC_SPACE | ND_SPACE_CHANGED, area); - ED_area_tag_refresh(sa); + ED_area_tag_refresh(area); } /* also redraw when re-used */ - ED_area_tag_redraw(sa); + ED_area_tag_redraw(area); } -static SpaceLink *area_get_prevspace(ScrArea *sa) +static SpaceLink *area_get_prevspace(ScrArea *area) { - SpaceLink *sl = sa->spacedata.first; + SpaceLink *sl = area->spacedata.first; /* First toggle to the next temporary space in the list. */ for (SpaceLink *sl_iter = sl->next; sl_iter; sl_iter = sl_iter->next) { @@ -2235,13 +2235,13 @@ static SpaceLink *area_get_prevspace(ScrArea *sa) return sl->next; } -void ED_area_prevspace(bContext *C, ScrArea *sa) +void ED_area_prevspace(bContext *C, ScrArea *area) { - SpaceLink *sl = sa->spacedata.first; - SpaceLink *prevspace = sl ? area_get_prevspace(sa) : NULL; + SpaceLink *sl = area->spacedata.first; + SpaceLink *prevspace = sl ? area_get_prevspace(area) : NULL; if (prevspace) { - ED_area_newspace(C, sa, prevspace->spacetype, false); + ED_area_newspace(C, area, prevspace->spacetype, false); /* We've exited the space, so it can't be considered temporary anymore. */ sl->link_flag &= ~SPACE_FLAG_TYPE_TEMPORARY; } @@ -2251,23 +2251,23 @@ void ED_area_prevspace(bContext *C, ScrArea *sa) } /* If this is a stacked fullscreen, changing to previous area exits it (meaning we're still in a * fullscreen, but not in a stacked one). */ - sa->flag &= ~AREA_FLAG_STACKED_FULLSCREEN; + area->flag &= ~AREA_FLAG_STACKED_FULLSCREEN; - ED_area_tag_redraw(sa); + ED_area_tag_redraw(area); /* send space change notifier */ - WM_event_add_notifier(C, NC_SPACE | ND_SPACE_CHANGED, sa); + WM_event_add_notifier(C, NC_SPACE | ND_SPACE_CHANGED, area); } /* returns offset for next button in header */ int ED_area_header_switchbutton(const bContext *C, uiBlock *block, int yco) { - ScrArea *sa = CTX_wm_area(C); + ScrArea *area = CTX_wm_area(C); bScreen *scr = CTX_wm_screen(C); PointerRNA areaptr; int xco = 0.4 * U.widget_unit; - RNA_pointer_create(&(scr->id), &RNA_Area, sa, &areaptr); + RNA_pointer_create(&(scr->id), &RNA_Area, area, &areaptr); uiDefButR(block, UI_BTYPE_MENU, @@ -2342,7 +2342,7 @@ BLI_INLINE bool streq_array_any(const char *s, const char *arr[]) } static void ed_panel_draw(const bContext *C, - ScrArea *sa, + ScrArea *area, ARegion *region, ListBase *lb, PanelType *pt, @@ -2357,7 +2357,7 @@ static void ed_panel_draw(const bContext *C, uiBlock *block = UI_block_begin(C, region, pt->idname, UI_EMBOSS); bool open; - panel = UI_panel_begin(sa, region, lb, block, pt, panel, &open); + panel = UI_panel_begin(area, region, lb, block, pt, panel, &open); /* bad fixed values */ int xco, yco, h = 0; @@ -2445,12 +2445,12 @@ static void ed_panel_draw(const bContext *C, Panel *child_panel = UI_panel_find_by_type(&panel->children, child_pt); if (child_pt->draw && (!child_pt->poll || child_pt->poll(C, child_pt))) { - ed_panel_draw(C, sa, region, &panel->children, child_pt, child_panel, w, em, vertical); + ed_panel_draw(C, area, region, &panel->children, child_pt, child_panel, w, em, vertical); } } } - UI_panel_end(sa, region, block, w, h, open); + UI_panel_end(area, region, block, w, h, open); } /** @@ -2499,7 +2499,7 @@ void ED_region_panels_layout_ex(const bContext *C, region->runtime.category = NULL; - ScrArea *sa = CTX_wm_area(C); + ScrArea *area = CTX_wm_area(C); View2D *v2d = ®ion->v2d; int x, y, w, em; @@ -2508,7 +2508,7 @@ void ED_region_panels_layout_ex(const bContext *C, bool use_category_tabs = (category_override == NULL) && ((((1 << region->regiontype) & RGN_TYPE_HAS_CATEGORY_MASK) || (region->regiontype == RGN_TYPE_TOOLS && - sa->spacetype == SPACE_CLIP))); + area->spacetype == SPACE_CLIP))); /* offset panels for small vertical tab area */ const char *category = NULL; const int category_tabs_width = UI_PANEL_CATEGORY_MARGIN_WIDTH; @@ -2584,7 +2584,7 @@ void ED_region_panels_layout_ex(const bContext *C, } } - ed_panel_draw(C, sa, region, ®ion->panels, pt, panel, w, em, vertical); + ed_panel_draw(C, area, region, ®ion->panels, pt, panel, w, em, vertical); } /* align panels and return size */ @@ -2605,7 +2605,7 @@ void ED_region_panels_layout_ex(const bContext *C, if ((region->sizex != size_dyn[0]) || (region->sizey != size_dyn[1])) { region->sizex = size_dyn[0]; region->sizey = size_dyn[1]; - sa->flag |= AREA_FLAG_REGION_SIZE_UPDATE; + area->flag |= AREA_FLAG_REGION_SIZE_UPDATE; } y = fabsf(region->sizey * UI_DPI_FAC - 1); } @@ -2799,10 +2799,10 @@ void ED_region_header_layout(const bContext *C, ARegion *region) if (region_layout_based && (region->sizex != new_sizex)) { /* region size is layout based and needs to be updated */ - ScrArea *sa = CTX_wm_area(C); + ScrArea *area = CTX_wm_area(C); region->sizex = new_sizex; - sa->flag |= AREA_FLAG_REGION_SIZE_UPDATE; + area->flag |= AREA_FLAG_REGION_SIZE_UPDATE; } UI_block_end(C, block); @@ -3575,7 +3575,7 @@ void ED_region_message_subscribe(bContext *C, struct WorkSpace *workspace, struct Scene *scene, struct bScreen *screen, - struct ScrArea *sa, + struct ScrArea *area, struct ARegion *region, struct wmMsgBus *mbus) { @@ -3588,7 +3588,7 @@ void ED_region_message_subscribe(bContext *C, } if (region->type->message_subscribe != NULL) { - region->type->message_subscribe(C, workspace, scene, screen, sa, region, mbus); + region->type->message_subscribe(C, workspace, scene, screen, area, region, mbus); } } diff --git a/source/blender/editors/screen/area_utils.c b/source/blender/editors/screen/area_utils.c index cacd6b1edd7..075759f1120 100644 --- a/source/blender/editors/screen/area_utils.c +++ b/source/blender/editors/screen/area_utils.c @@ -46,7 +46,7 @@ void ED_region_generic_tools_region_message_subscribe(const struct bContext *UNU struct WorkSpace *UNUSED(workspace), struct Scene *UNUSED(scene), struct bScreen *UNUSED(screen), - struct ScrArea *UNUSED(sa), + struct ScrArea *UNUSED(area), struct ARegion *region, struct wmMsgBus *mbus) { diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c index 5ae1a89ba9b..778a3740622 100644 --- a/source/blender/editors/screen/screen_context.c +++ b/source/blender/editors/screen/screen_context.c @@ -114,7 +114,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult wmWindow *win = CTX_wm_window(C); View3D *v3d = CTX_wm_view3d(C); /* This may be NULL in a lot of cases. */ bScreen *sc = CTX_wm_screen(C); - ScrArea *sa = CTX_wm_area(C); + ScrArea *area = CTX_wm_area(C); Scene *scene = WM_window_get_active_scene(win); ViewLayer *view_layer = WM_window_get_active_view_layer(win); Object *obact = (view_layer && view_layer->basact) ? view_layer->basact->object : NULL; @@ -533,7 +533,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult * That causes the get_active function to fail when called from context. * For that reason, we end up using an alternative where we pass everything in! */ - bGPdata *gpd = ED_gpencil_data_get_active_direct(sa, obact); + bGPdata *gpd = ED_gpencil_data_get_active_direct(area, obact); if (gpd) { CTX_data_id_pointer_set(result, &gpd->id); @@ -547,7 +547,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult PointerRNA ptr; /* get pointer to Grease Pencil Data */ - gpd_ptr = ED_gpencil_data_get_pointers_direct(sa, obact, &ptr); + gpd_ptr = ED_gpencil_data_get_pointers_direct(area, obact, &ptr); if (gpd_ptr) { CTX_data_pointer_set(result, ptr.owner_id, ptr.type, ptr.data); @@ -555,7 +555,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult } } else if (CTX_data_equals(member, "annotation_data")) { - bGPdata *gpd = ED_annotation_data_get_active_direct((ID *)sc, sa, scene); + bGPdata *gpd = ED_annotation_data_get_active_direct((ID *)sc, area, scene); if (gpd) { CTX_data_id_pointer_set(result, &gpd->id); @@ -568,7 +568,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult PointerRNA ptr; /* Get pointer to Grease Pencil Data. */ - gpd_ptr = ED_annotation_data_get_pointers_direct((ID *)sc, sa, scene, &ptr); + gpd_ptr = ED_annotation_data_get_pointers_direct((ID *)sc, area, scene, &ptr); if (gpd_ptr) { CTX_data_pointer_set(result, ptr.owner_id, ptr.type, ptr.data); @@ -576,7 +576,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult } } else if (CTX_data_equals(member, "active_gpencil_layer")) { - bGPdata *gpd = ED_gpencil_data_get_active_direct(sa, obact); + bGPdata *gpd = ED_gpencil_data_get_active_direct(area, obact); if (gpd) { bGPDlayer *gpl = BKE_gpencil_layer_active_get(gpd); @@ -588,7 +588,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult } } else if (CTX_data_equals(member, "active_annotation_layer")) { - bGPdata *gpd = ED_annotation_data_get_active_direct((ID *)sc, sa, scene); + bGPdata *gpd = ED_annotation_data_get_active_direct((ID *)sc, area, scene); if (gpd) { bGPDlayer *gpl = BKE_gpencil_layer_active_get(gpd); @@ -600,7 +600,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult } } else if (CTX_data_equals(member, "active_gpencil_frame")) { - bGPdata *gpd = ED_gpencil_data_get_active_direct(sa, obact); + bGPdata *gpd = ED_gpencil_data_get_active_direct(area, obact); if (gpd) { bGPDlayer *gpl = BKE_gpencil_layer_active_get(gpd); @@ -612,7 +612,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult } } else if (CTX_data_equals(member, "visible_gpencil_layers")) { - bGPdata *gpd = ED_gpencil_data_get_active_direct(sa, obact); + bGPdata *gpd = ED_gpencil_data_get_active_direct(area, obact); if (gpd) { bGPDlayer *gpl; @@ -627,7 +627,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult } } else if (CTX_data_equals(member, "editable_gpencil_layers")) { - bGPdata *gpd = ED_gpencil_data_get_active_direct(sa, obact); + bGPdata *gpd = ED_gpencil_data_get_active_direct(area, obact); if (gpd) { bGPDlayer *gpl; @@ -642,7 +642,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult } } else if (CTX_data_equals(member, "editable_gpencil_strokes")) { - bGPdata *gpd = ED_gpencil_data_get_active_direct(sa, obact); + bGPdata *gpd = ED_gpencil_data_get_active_direct(area, obact); const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd); if (gpd) { @@ -660,7 +660,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult for (gpf = init_gpf; gpf; gpf = gpf->next) { if ((gpf == gpl->actframe) || ((gpf->flag & GP_FRAME_SELECT) && (is_multiedit))) { for (gps = gpf->strokes.first; gps; gps = gps->next) { - if (ED_gpencil_stroke_can_use_direct(sa, gps)) { + if (ED_gpencil_stroke_can_use_direct(area, gps)) { /* check if the color is editable */ if (ED_gpencil_stroke_color_use(obact, gpl, gps) == false) { continue; diff --git a/source/blender/editors/screen/screen_draw.c b/source/blender/editors/screen/screen_draw.c index dbc7609722c..c1b6df07129 100644 --- a/source/blender/editors/screen/screen_draw.c +++ b/source/blender/editors/screen/screen_draw.c @@ -41,10 +41,10 @@ * Draw horizontal shape visualizing future joining * (left as well right direction of future joining). */ -static void draw_horizontal_join_shape(ScrArea *sa, char dir, uint pos) +static void draw_horizontal_join_shape(ScrArea *area, char dir, uint pos) { - const float width = screen_geom_area_width(sa) - 1; - const float height = screen_geom_area_height(sa) - 1; + const float width = screen_geom_area_width(area) - 1; + const float height = screen_geom_area_height(area) - 1; vec2f points[10]; short i; float w, h; @@ -58,43 +58,43 @@ static void draw_horizontal_join_shape(ScrArea *sa, char dir, uint pos) w = width / 4; } - points[0].x = sa->v1->vec.x; - points[0].y = sa->v1->vec.y + height / 2; + points[0].x = area->v1->vec.x; + points[0].y = area->v1->vec.y + height / 2; - points[1].x = sa->v1->vec.x; - points[1].y = sa->v1->vec.y; + points[1].x = area->v1->vec.x; + points[1].y = area->v1->vec.y; - points[2].x = sa->v4->vec.x - w; - points[2].y = sa->v4->vec.y; + points[2].x = area->v4->vec.x - w; + points[2].y = area->v4->vec.y; - points[3].x = sa->v4->vec.x - w; - points[3].y = sa->v4->vec.y + height / 2 - 2 * h; + points[3].x = area->v4->vec.x - w; + points[3].y = area->v4->vec.y + height / 2 - 2 * h; - points[4].x = sa->v4->vec.x - 2 * w; - points[4].y = sa->v4->vec.y + height / 2; + points[4].x = area->v4->vec.x - 2 * w; + points[4].y = area->v4->vec.y + height / 2; - points[5].x = sa->v4->vec.x - w; - points[5].y = sa->v4->vec.y + height / 2 + 2 * h; + points[5].x = area->v4->vec.x - w; + points[5].y = area->v4->vec.y + height / 2 + 2 * h; - points[6].x = sa->v3->vec.x - w; - points[6].y = sa->v3->vec.y; + points[6].x = area->v3->vec.x - w; + points[6].y = area->v3->vec.y; - points[7].x = sa->v2->vec.x; - points[7].y = sa->v2->vec.y; + points[7].x = area->v2->vec.x; + points[7].y = area->v2->vec.y; - points[8].x = sa->v4->vec.x; - points[8].y = sa->v4->vec.y + height / 2 - h; + points[8].x = area->v4->vec.x; + points[8].y = area->v4->vec.y + height / 2 - h; - points[9].x = sa->v4->vec.x; - points[9].y = sa->v4->vec.y + height / 2 + h; + points[9].x = area->v4->vec.x; + points[9].y = area->v4->vec.y + height / 2 + h; if (dir == 'l') { /* when direction is left, then we flip direction of arrow */ - float cx = sa->v1->vec.x + width; + float cx = area->v1->vec.x + width; for (i = 0; i < 10; i++) { points[i].x -= cx; points[i].x = -points[i].x; - points[i].x += sa->v1->vec.x; + points[i].x += area->v1->vec.x; } } @@ -122,10 +122,10 @@ static void draw_horizontal_join_shape(ScrArea *sa, char dir, uint pos) /** * Draw vertical shape visualizing future joining (up/down direction). */ -static void draw_vertical_join_shape(ScrArea *sa, char dir, uint pos) +static void draw_vertical_join_shape(ScrArea *area, char dir, uint pos) { - const float width = screen_geom_area_width(sa) - 1; - const float height = screen_geom_area_height(sa) - 1; + const float width = screen_geom_area_width(area) - 1; + const float height = screen_geom_area_height(area) - 1; vec2f points[10]; short i; float w, h; @@ -139,43 +139,43 @@ static void draw_vertical_join_shape(ScrArea *sa, char dir, uint pos) w = width / 8; } - points[0].x = sa->v1->vec.x + width / 2; - points[0].y = sa->v3->vec.y; + points[0].x = area->v1->vec.x + width / 2; + points[0].y = area->v3->vec.y; - points[1].x = sa->v2->vec.x; - points[1].y = sa->v2->vec.y; + points[1].x = area->v2->vec.x; + points[1].y = area->v2->vec.y; - points[2].x = sa->v1->vec.x; - points[2].y = sa->v1->vec.y + h; + points[2].x = area->v1->vec.x; + points[2].y = area->v1->vec.y + h; - points[3].x = sa->v1->vec.x + width / 2 - 2 * w; - points[3].y = sa->v1->vec.y + h; + points[3].x = area->v1->vec.x + width / 2 - 2 * w; + points[3].y = area->v1->vec.y + h; - points[4].x = sa->v1->vec.x + width / 2; - points[4].y = sa->v1->vec.y + 2 * h; + points[4].x = area->v1->vec.x + width / 2; + points[4].y = area->v1->vec.y + 2 * h; - points[5].x = sa->v1->vec.x + width / 2 + 2 * w; - points[5].y = sa->v1->vec.y + h; + points[5].x = area->v1->vec.x + width / 2 + 2 * w; + points[5].y = area->v1->vec.y + h; - points[6].x = sa->v4->vec.x; - points[6].y = sa->v4->vec.y + h; + points[6].x = area->v4->vec.x; + points[6].y = area->v4->vec.y + h; - points[7].x = sa->v3->vec.x; - points[7].y = sa->v3->vec.y; + points[7].x = area->v3->vec.x; + points[7].y = area->v3->vec.y; - points[8].x = sa->v1->vec.x + width / 2 - w; - points[8].y = sa->v1->vec.y; + points[8].x = area->v1->vec.x + width / 2 - w; + points[8].y = area->v1->vec.y; - points[9].x = sa->v1->vec.x + width / 2 + w; - points[9].y = sa->v1->vec.y; + points[9].x = area->v1->vec.x + width / 2 + w; + points[9].y = area->v1->vec.y; if (dir == 'u') { /* when direction is up, then we flip direction of arrow */ - float cy = sa->v1->vec.y + height; + float cy = area->v1->vec.y + height; for (i = 0; i < 10; i++) { points[i].y -= cy; points[i].y = -points[i].y; - points[i].y += sa->v1->vec.y; + points[i].y += area->v1->vec.y; } } @@ -203,13 +203,13 @@ static void draw_vertical_join_shape(ScrArea *sa, char dir, uint pos) /** * Draw join shape due to direction of joining. */ -static void draw_join_shape(ScrArea *sa, char dir, uint pos) +static void draw_join_shape(ScrArea *area, char dir, uint pos) { if (dir == 'u' || dir == 'd') { - draw_vertical_join_shape(sa, dir, pos); + draw_vertical_join_shape(area, dir, pos); } else { - draw_horizontal_join_shape(sa, dir, pos); + draw_horizontal_join_shape(area, dir, pos); } } @@ -294,26 +294,26 @@ static GPUBatch *batch_screen_edges_get(int *corner_len) /** * Draw screen area darker with arrow (visualization of future joining). */ -static void scrarea_draw_shape_dark(ScrArea *sa, char dir, uint pos) +static void scrarea_draw_shape_dark(ScrArea *area, char dir, uint pos) { GPU_blend_set_func_separate( GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); immUniformColor4ub(0, 0, 0, 50); - draw_join_shape(sa, dir, pos); + draw_join_shape(area, dir, pos); } /** * Draw screen area lighter with arrow shape ("eraser" of previous dark shape). */ -static void scrarea_draw_shape_light(ScrArea *sa, char UNUSED(dir), uint pos) +static void scrarea_draw_shape_light(ScrArea *area, char UNUSED(dir), uint pos) { GPU_blend_set_func(GPU_DST_COLOR, GPU_SRC_ALPHA); /* value 181 was hardly computed: 181~105 */ immUniformColor4ub(255, 255, 255, 50); - /* draw_join_shape(sa, dir); */ + /* draw_join_shape(area, dir); */ - immRectf(pos, sa->v1->vec.x, sa->v1->vec.y, sa->v3->vec.x, sa->v3->vec.y); + immRectf(pos, area->v1->vec.x, area->v1->vec.y, area->v3->vec.x, area->v3->vec.y); } static void drawscredge_area_draw( @@ -350,12 +350,12 @@ static void drawscredge_area_draw( /** * \brief Screen edges drawing. */ -static void drawscredge_area(ScrArea *sa, int sizex, int sizey, float edge_thickness) +static void drawscredge_area(ScrArea *area, int sizex, int sizey, float edge_thickness) { - short x1 = sa->v1->vec.x; - short y1 = sa->v1->vec.y; - short x2 = sa->v3->vec.x; - short y2 = sa->v3->vec.y; + short x1 = area->v1->vec.x; + short y1 = area->v1->vec.y; + short x2 = area->v3->vec.x; + short y2 = area->v3->vec.y; drawscredge_area_draw(sizex, sizey, x1, y1, x2, y2, edge_thickness); } @@ -381,13 +381,13 @@ void ED_screen_draw_edges(wmWindow *win) float col[4], corner_scale, edge_thickness; int verts_per_corner = 0; - ScrArea *sa; + ScrArea *area; rcti scissor_rect; BLI_rcti_init_minmax(&scissor_rect); - for (sa = screen->areabase.first; sa; sa = sa->next) { - BLI_rcti_do_minmax_v(&scissor_rect, (int[2]){sa->v1->vec.x, sa->v1->vec.y}); - BLI_rcti_do_minmax_v(&scissor_rect, (int[2]){sa->v3->vec.x, sa->v3->vec.y}); + for (area = screen->areabase.first; area; area = area->next) { + BLI_rcti_do_minmax_v(&scissor_rect, (int[2]){area->v1->vec.x, area->v1->vec.y}); + BLI_rcti_do_minmax_v(&scissor_rect, (int[2]){area->v3->vec.x, area->v3->vec.y}); } if (GPU_type_matches(GPU_DEVICE_INTEL_UHD, GPU_OS_UNIX, GPU_DRIVER_ANY)) { @@ -422,8 +422,8 @@ void ED_screen_draw_edges(wmWindow *win) GPU_batch_uniform_1f(batch, "scale", corner_scale); GPU_batch_uniform_4fv(batch, "color", col); - for (sa = screen->areabase.first; sa; sa = sa->next) { - drawscredge_area(sa, winsize_x, winsize_y, edge_thickness); + for (area = screen->areabase.first; area; area = area->next) { + drawscredge_area(area, winsize_x, winsize_y, edge_thickness); } GPU_blend(false); @@ -480,7 +480,7 @@ void ED_screen_draw_join_shape(ScrArea *sa1, ScrArea *sa2) immUnbindProgram(); } -void ED_screen_draw_split_preview(ScrArea *sa, const int dir, const float fac) +void ED_screen_draw_split_preview(ScrArea *area, const int dir, const float fac) { uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -495,10 +495,10 @@ void ED_screen_draw_split_preview(ScrArea *sa, const int dir, const float fac) immBegin(GPU_PRIM_LINES, 2); if (dir == 'h') { - const float y = (1 - fac) * sa->totrct.ymin + fac * sa->totrct.ymax; + const float y = (1 - fac) * area->totrct.ymin + fac * area->totrct.ymax; - immVertex2f(pos, sa->totrct.xmin, y); - immVertex2f(pos, sa->totrct.xmax, y); + immVertex2f(pos, area->totrct.xmin, y); + immVertex2f(pos, area->totrct.xmax, y); immEnd(); @@ -506,17 +506,17 @@ void ED_screen_draw_split_preview(ScrArea *sa, const int dir, const float fac) immBegin(GPU_PRIM_LINES, 2); - immVertex2f(pos, sa->totrct.xmin, y + 1); - immVertex2f(pos, sa->totrct.xmax, y + 1); + immVertex2f(pos, area->totrct.xmin, y + 1); + immVertex2f(pos, area->totrct.xmax, y + 1); immEnd(); } else { BLI_assert(dir == 'v'); - const float x = (1 - fac) * sa->totrct.xmin + fac * sa->totrct.xmax; + const float x = (1 - fac) * area->totrct.xmin + fac * area->totrct.xmax; - immVertex2f(pos, x, sa->totrct.ymin); - immVertex2f(pos, x, sa->totrct.ymax); + immVertex2f(pos, x, area->totrct.ymin); + immVertex2f(pos, x, area->totrct.ymax); immEnd(); @@ -524,8 +524,8 @@ void ED_screen_draw_split_preview(ScrArea *sa, const int dir, const float fac) immBegin(GPU_PRIM_LINES, 2); - immVertex2f(pos, x + 1, sa->totrct.ymin); - immVertex2f(pos, x + 1, sa->totrct.ymax); + immVertex2f(pos, x + 1, area->totrct.ymin); + immVertex2f(pos, x + 1, area->totrct.ymax); immEnd(); } @@ -547,9 +547,9 @@ static void screen_preview_scale_get( { float max_x = 0, max_y = 0; - for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) { - max_x = MAX2(max_x, sa->totrct.xmax); - max_y = MAX2(max_y, sa->totrct.ymax); + for (ScrArea *area = screen->areabase.first; area; area = area->next) { + max_x = MAX2(max_x, area->totrct.xmax); + max_y = MAX2(max_y, area->totrct.ymax); } r_scale[0] = (size_x * asp[0]) / max_x; r_scale[1] = (size_y * asp[1]) / max_y; @@ -566,12 +566,12 @@ static void screen_preview_draw_areas(const bScreen *screen, immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4fv(col); - for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) { + for (ScrArea *area = screen->areabase.first; area; area = area->next) { rctf rect = { - .xmin = sa->totrct.xmin * scale[0] + ofs_h, - .xmax = sa->totrct.xmax * scale[0] - ofs_h, - .ymin = sa->totrct.ymin * scale[1] + ofs_h, - .ymax = sa->totrct.ymax * scale[1] - ofs_h, + .xmin = area->totrct.xmin * scale[0] + ofs_h, + .xmax = area->totrct.xmax * scale[0] - ofs_h, + .ymin = area->totrct.ymin * scale[1] + ofs_h, + .ymax = area->totrct.ymax * scale[1] - ofs_h, }; immBegin(GPU_PRIM_TRI_FAN, 4); diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 01a30f7d6a4..11a12452ce3 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -70,17 +70,17 @@ static ScrArea *screen_addarea_ex(ScrAreaMap *area_map, ScrVert *bottom_right, short spacetype) { - ScrArea *sa = MEM_callocN(sizeof(ScrArea), "addscrarea"); + ScrArea *area = MEM_callocN(sizeof(ScrArea), "addscrarea"); - sa->v1 = bottom_left; - sa->v2 = top_left; - sa->v3 = top_right; - sa->v4 = bottom_right; - sa->spacetype = spacetype; + area->v1 = bottom_left; + area->v2 = top_left; + area->v3 = top_right; + area->v4 = bottom_right; + area->spacetype = spacetype; - BLI_addtail(&area_map->areabase, sa); + BLI_addtail(&area_map->areabase, area); - return sa; + return area; } static ScrArea *screen_addarea(bScreen *sc, ScrVert *left_bottom, @@ -93,31 +93,32 @@ static ScrArea *screen_addarea(bScreen *sc, AREAMAP_FROM_SCREEN(sc), left_bottom, left_top, right_top, right_bottom, spacetype); } -static void screen_delarea(bContext *C, bScreen *sc, ScrArea *sa) +static void screen_delarea(bContext *C, bScreen *sc, ScrArea *area) { - ED_area_exit(C, sa); + ED_area_exit(C, area); - BKE_screen_area_free(sa); + BKE_screen_area_free(area); - BLI_remlink(&sc->areabase, sa); - MEM_freeN(sa); + BLI_remlink(&sc->areabase, area); + MEM_freeN(area); } -ScrArea *area_split(const wmWindow *win, bScreen *sc, ScrArea *sa, char dir, float fac, int merge) +ScrArea *area_split( + const wmWindow *win, bScreen *sc, ScrArea *area, char dir, float fac, int merge) { ScrArea *newa = NULL; ScrVert *sv1, *sv2; short split; rcti window_rect; - if (sa == NULL) { + if (area == NULL) { return NULL; } WM_window_rect_calc(win, &window_rect); - split = screen_geom_find_area_split_point(sa, &window_rect, dir, fac); + split = screen_geom_find_area_split_point(area, &window_rect, dir, fac); if (split == 0) { return NULL; } @@ -128,65 +129,65 @@ ScrArea *area_split(const wmWindow *win, bScreen *sc, ScrArea *sa, char dir, flo if (dir == 'h') { /* new vertices */ - sv1 = screen_geom_vertex_add(sc, sa->v1->vec.x, split); - sv2 = screen_geom_vertex_add(sc, sa->v4->vec.x, split); + sv1 = screen_geom_vertex_add(sc, area->v1->vec.x, split); + sv2 = screen_geom_vertex_add(sc, area->v4->vec.x, split); /* new edges */ - screen_geom_edge_add(sc, sa->v1, sv1); - screen_geom_edge_add(sc, sv1, sa->v2); - screen_geom_edge_add(sc, sa->v3, sv2); - screen_geom_edge_add(sc, sv2, sa->v4); + screen_geom_edge_add(sc, area->v1, sv1); + screen_geom_edge_add(sc, sv1, area->v2); + screen_geom_edge_add(sc, area->v3, sv2); + screen_geom_edge_add(sc, sv2, area->v4); screen_geom_edge_add(sc, sv1, sv2); if (fac > 0.5f) { /* new areas: top */ - newa = screen_addarea(sc, sv1, sa->v2, sa->v3, sv2, sa->spacetype); + newa = screen_addarea(sc, sv1, area->v2, area->v3, sv2, area->spacetype); /* area below */ - sa->v2 = sv1; - sa->v3 = sv2; + area->v2 = sv1; + area->v3 = sv2; } else { /* new areas: bottom */ - newa = screen_addarea(sc, sa->v1, sv1, sv2, sa->v4, sa->spacetype); + newa = screen_addarea(sc, area->v1, sv1, sv2, area->v4, area->spacetype); /* area above */ - sa->v1 = sv1; - sa->v4 = sv2; + area->v1 = sv1; + area->v4 = sv2; } - ED_area_data_copy(newa, sa, true); + ED_area_data_copy(newa, area, true); } else { /* new vertices */ - sv1 = screen_geom_vertex_add(sc, split, sa->v1->vec.y); - sv2 = screen_geom_vertex_add(sc, split, sa->v2->vec.y); + sv1 = screen_geom_vertex_add(sc, split, area->v1->vec.y); + sv2 = screen_geom_vertex_add(sc, split, area->v2->vec.y); /* new edges */ - screen_geom_edge_add(sc, sa->v1, sv1); - screen_geom_edge_add(sc, sv1, sa->v4); - screen_geom_edge_add(sc, sa->v2, sv2); - screen_geom_edge_add(sc, sv2, sa->v3); + screen_geom_edge_add(sc, area->v1, sv1); + screen_geom_edge_add(sc, sv1, area->v4); + screen_geom_edge_add(sc, area->v2, sv2); + screen_geom_edge_add(sc, sv2, area->v3); screen_geom_edge_add(sc, sv1, sv2); if (fac > 0.5f) { /* new areas: right */ - newa = screen_addarea(sc, sv1, sv2, sa->v3, sa->v4, sa->spacetype); + newa = screen_addarea(sc, sv1, sv2, area->v3, area->v4, area->spacetype); /* area left */ - sa->v3 = sv2; - sa->v4 = sv1; + area->v3 = sv2; + area->v4 = sv1; } else { /* new areas: left */ - newa = screen_addarea(sc, sa->v1, sa->v2, sv2, sv1, sa->spacetype); + newa = screen_addarea(sc, area->v1, area->v2, sv2, sv1, area->spacetype); /* area right */ - sa->v1 = sv1; - sa->v2 = sv2; + area->v1 = sv1; + area->v2 = sv2; } - ED_area_data_copy(newa, sa, true); + ED_area_data_copy(newa, area, true); } /* remove double vertices en edges */ @@ -231,7 +232,7 @@ void screen_data_copy(bScreen *to, bScreen *from) { ScrVert *s1, *s2; ScrEdge *se; - ScrArea *sa, *saf; + ScrArea *area, *saf; /* free contents of 'to', is from blenkernel screen.c */ BKE_screen_free(to); @@ -255,18 +256,18 @@ void screen_data_copy(bScreen *to, bScreen *from) } saf = from->areabase.first; - for (sa = to->areabase.first; sa; sa = sa->next, saf = saf->next) { - sa->v1 = sa->v1->newv; - sa->v2 = sa->v2->newv; - sa->v3 = sa->v3->newv; - sa->v4 = sa->v4->newv; + for (area = to->areabase.first; area; area = area->next, saf = saf->next) { + area->v1 = area->v1->newv; + area->v2 = area->v2->newv; + area->v3 = area->v3->newv; + area->v4 = area->v4->newv; - BLI_listbase_clear(&sa->spacedata); - BLI_listbase_clear(&sa->regionbase); - BLI_listbase_clear(&sa->actionzones); - BLI_listbase_clear(&sa->handlers); + BLI_listbase_clear(&area->spacedata); + BLI_listbase_clear(&area->regionbase); + BLI_listbase_clear(&area->actionzones); + BLI_listbase_clear(&area->handlers); - ED_area_data_copy(sa, saf, true); + ED_area_data_copy(area, saf, true); } /* put at zero (needed?) */ @@ -285,19 +286,19 @@ void screen_new_activate_prepare(const wmWindow *win, bScreen *screen_new) screen_new->do_draw = true; } -/* with sa as center, sb is located at: 0=W, 1=N, 2=E, 3=S */ +/* with area as center, sb is located at: 0=W, 1=N, 2=E, 3=S */ /* -1 = not valid check */ /* used with join operator */ -int area_getorientation(ScrArea *sa, ScrArea *sb) +int area_getorientation(ScrArea *area, ScrArea *sb) { - if (sa == NULL || sb == NULL) { + if (area == NULL || sb == NULL) { return -1; } - ScrVert *saBL = sa->v1; - ScrVert *saTL = sa->v2; - ScrVert *saTR = sa->v3; - ScrVert *saBR = sa->v4; + ScrVert *saBL = area->v1; + ScrVert *saTL = area->v2; + ScrVert *saTR = area->v3; + ScrVert *saBR = area->v4; ScrVert *sbBL = sb->v1; ScrVert *sbTL = sb->v2; @@ -306,25 +307,26 @@ int area_getorientation(ScrArea *sa, ScrArea *sb) int tolerance = U.pixelsize * 4; - if (saBL->vec.x == sbBR->vec.x && saTL->vec.x == sbTR->vec.x) { /* sa to right of sb = W */ + if (saBL->vec.x == sbBR->vec.x && saTL->vec.x == sbTR->vec.x) { /* area to right of sb = W */ if ((abs(saBL->vec.y - sbBR->vec.y) <= tolerance) && (abs(saTL->vec.y - sbTR->vec.y) <= tolerance)) { return 0; } } - else if (saTL->vec.y == sbBL->vec.y && saTR->vec.y == sbBR->vec.y) { /* sa to bottom of sb = N */ + else if (saTL->vec.y == sbBL->vec.y && + saTR->vec.y == sbBR->vec.y) { /* area to bottom of sb = N */ if ((abs(saTL->vec.x - sbBL->vec.x) <= tolerance) && (abs(saTR->vec.x - sbBR->vec.x) <= tolerance)) { return 1; } } - else if (saTR->vec.x == sbTL->vec.x && saBR->vec.x == sbBL->vec.x) { /* sa to left of sb = E */ + else if (saTR->vec.x == sbTL->vec.x && saBR->vec.x == sbBL->vec.x) { /* area to left of sb = E */ if ((abs(saTR->vec.y - sbTL->vec.y) <= tolerance) && (abs(saBR->vec.y - sbBL->vec.y) <= tolerance)) { return 2; } } - else if (saBL->vec.y == sbTL->vec.y && saBR->vec.y == sbTR->vec.y) { /* sa on top of sb = S*/ + else if (saBL->vec.y == sbTL->vec.y && saBR->vec.y == sbTR->vec.y) { /* area on top of sb = S*/ if ((abs(saBL->vec.x - sbTL->vec.x) <= tolerance) && (abs(saBR->vec.x - sbTR->vec.x) <= tolerance)) { return 3; @@ -398,12 +400,12 @@ int screen_area_join(bContext *C, bScreen *scr, ScrArea *sa1, ScrArea *sa2) /* ****************** EXPORTED API TO OTHER MODULES *************************** */ /* screen sets cursor based on active region */ -static void region_cursor_set_ex(wmWindow *win, ScrArea *sa, ARegion *region, bool swin_changed) +static void region_cursor_set_ex(wmWindow *win, ScrArea *area, ARegion *region, bool swin_changed) { BLI_assert(WM_window_get_active_screen(win)->active_region == region); if (win->tag_cursor_refresh || swin_changed || (region->type && region->type->event_cursor)) { win->tag_cursor_refresh = false; - ED_region_cursor_set(win, sa, region); + ED_region_cursor_set(win, area, region); } } @@ -411,11 +413,11 @@ static void region_cursor_set(wmWindow *win, bool swin_changed) { bScreen *screen = WM_window_get_active_screen(win); - ED_screen_areas_iter(win, screen, sa) + ED_screen_areas_iter(win, screen, area) { - for (ARegion *region = sa->regionbase.first; region; region = region->next) { + for (ARegion *region = area->regionbase.first; region; region = region->next) { if (region == screen->active_region) { - region_cursor_set_ex(win, sa, region, swin_changed); + region_cursor_set_ex(win, area, region, swin_changed); return; } } @@ -522,11 +524,11 @@ void ED_screen_ensure_updated(wmWindowManager *wm, wmWindow *win, bScreen *scree * Utility to exit and free an area-region. Screen level regions (menus/popups) need to be treated * slightly differently, see #ui_region_temp_remove(). */ -void ED_region_remove(bContext *C, ScrArea *sa, ARegion *region) +void ED_region_remove(bContext *C, ScrArea *area, ARegion *region) { ED_region_exit(C, region); - BKE_area_region_free(sa->type, region); - BLI_freelinkN(&sa->regionbase, region); + BKE_area_region_free(area->type, region); + BLI_freelinkN(&area->regionbase, region); } /* *********** exit calls are for closing running stuff ******** */ @@ -562,25 +564,25 @@ void ED_region_exit(bContext *C, ARegion *region) CTX_wm_region_set(C, prevar); } -void ED_area_exit(bContext *C, ScrArea *sa) +void ED_area_exit(bContext *C, ScrArea *area) { wmWindowManager *wm = CTX_wm_manager(C); wmWindow *win = CTX_wm_window(C); ScrArea *prevsa = CTX_wm_area(C); ARegion *region; - if (sa->type && sa->type->exit) { - sa->type->exit(wm, sa); + if (area->type && area->type->exit) { + area->type->exit(wm, area); } - CTX_wm_area_set(C, sa); + CTX_wm_area_set(C, area); - for (region = sa->regionbase.first; region; region = region->next) { + for (region = area->regionbase.first; region; region = region->next) { ED_region_exit(C, region); } - WM_event_remove_handlers(C, &sa->handlers); - WM_event_modal_handler_area_replace(win, sa, NULL); + WM_event_remove_handlers(C, &area->handlers); + WM_event_modal_handler_area_replace(win, area, NULL); CTX_wm_area_set(C, prevsa); } @@ -608,12 +610,12 @@ void ED_screen_exit(bContext *C, wmWindow *window, bScreen *screen) for (ARegion *region = screen->regionbase.first; region; region = region->next) { ED_region_exit(C, region); } - for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) { - ED_area_exit(C, sa); + for (ScrArea *area = screen->areabase.first; area; area = area->next) { + ED_area_exit(C, area); } /* Don't use ED_screen_areas_iter here, it skips hidden areas. */ - for (ScrArea *sa = window->global_areas.areabase.first; sa; sa = sa->next) { - ED_area_exit(C, sa); + for (ScrArea *area = window->global_areas.areabase.first; area; area = area->next) { + ED_area_exit(C, area); } /* mark it available for use for other windows */ @@ -636,15 +638,15 @@ static void screen_cursor_set(wmWindow *win, const int xy[2]) { const bScreen *screen = WM_window_get_active_screen(win); AZone *az = NULL; - ScrArea *sa; + ScrArea *area; - for (sa = screen->areabase.first; sa; sa = sa->next) { - if ((az = ED_area_actionzone_find_xy(sa, xy))) { + for (area = screen->areabase.first; area; area = area->next) { + if ((az = ED_area_actionzone_find_xy(area, xy))) { break; } } - if (sa) { + if (area) { if (az->type == AZONE_AREA) { WM_cursor_set(win, WM_CURSOR_EDIT); } @@ -685,7 +687,7 @@ void ED_screen_set_active_region(bContext *C, wmWindow *win, const int xy[2]) return; } - ScrArea *sa = NULL; + ScrArea *area = NULL; ARegion *region; ARegion *region_prev = scr->active_region; @@ -694,15 +696,15 @@ void ED_screen_set_active_region(bContext *C, wmWindow *win, const int xy[2]) if (xy[0] > area_iter->totrct.xmin && xy[0] < area_iter->totrct.xmax) { if (xy[1] > area_iter->totrct.ymin && xy[1] < area_iter->totrct.ymax) { if (ED_area_azones_update(area_iter, xy) == NULL) { - sa = area_iter; + area = area_iter; break; } } } } - if (sa) { + if (area) { /* Make overlap active when mouse over. */ - for (region = sa->regionbase.first; region; region = region->next) { + for (region = area->regionbase.first; region; region = region->next) { if (ED_region_contains_xy(region, xy)) { scr->active_region = region; break; @@ -758,7 +760,7 @@ void ED_screen_set_active_region(bContext *C, wmWindow *win, const int xy[2]) } else { /* Notifier invokes freeing the buttons... causing a bit too much redraws. */ - region_cursor_set_ex(win, sa, scr->active_region, region_prev != scr->active_region); + region_cursor_set_ex(win, area, scr->active_region, region_prev != scr->active_region); if (region_prev != scr->active_region) { /* This used to be a notifier, but needs to be done immediate @@ -775,17 +777,17 @@ int ED_screen_area_active(const bContext *C) { wmWindow *win = CTX_wm_window(C); bScreen *sc = CTX_wm_screen(C); - ScrArea *sa = CTX_wm_area(C); + ScrArea *area = CTX_wm_area(C); - if (win && sc && sa) { - AZone *az = ED_area_actionzone_find_xy(sa, &win->eventstate->x); + if (win && sc && area) { + AZone *az = ED_area_actionzone_find_xy(area, &win->eventstate->x); ARegion *region; if (az && az->type == AZONE_REGION) { return 1; } - for (region = sa->regionbase.first; region; region = region->next) { + for (region = area->regionbase.first; region; region = region->next) { if (region == sc->active_region) { return 1; } @@ -815,16 +817,16 @@ static ScrArea *screen_area_create_with_geometry(ScrAreaMap *area_map, return screen_addarea_ex(area_map, bottom_left, top_left, top_right, bottom_right, spacetype); } -static void screen_area_set_geometry_rect(ScrArea *sa, const rcti *rect) +static void screen_area_set_geometry_rect(ScrArea *area, const rcti *rect) { - sa->v1->vec.x = rect->xmin; - sa->v1->vec.y = rect->ymin; - sa->v2->vec.x = rect->xmin; - sa->v2->vec.y = rect->ymax; - sa->v3->vec.x = rect->xmax; - sa->v3->vec.y = rect->ymax; - sa->v4->vec.x = rect->xmax; - sa->v4->vec.y = rect->ymin; + area->v1->vec.x = rect->xmin; + area->v1->vec.y = rect->ymin; + area->v2->vec.x = rect->xmin; + area->v2->vec.y = rect->ymax; + area->v3->vec.x = rect->xmax; + area->v3->vec.y = rect->ymax; + area->v4->vec.x = rect->xmax; + area->v4->vec.y = rect->ymin; } static void screen_global_area_refresh(wmWindow *win, @@ -943,8 +945,8 @@ static bScreen *screen_fullscreen_find_associated_normal_screen(const Main *bmai for (bScreen *screen_iter = bmain->screens.first; screen_iter; screen_iter = screen_iter->id.next) { if ((screen_iter != screen) && ELEM(screen_iter->state, SCREENMAXIMIZED, SCREENFULL)) { - ScrArea *sa = screen_iter->areabase.first; - if (sa && sa->full == screen) { + ScrArea *area = screen_iter->areabase.first; + if (area && area->full == screen) { return screen_iter; } } @@ -976,8 +978,8 @@ bScreen *screen_change_prepare( wmTimer *wt = screen_old->animtimer; /* remove handlers referencing areas in old screen */ - for (ScrArea *sa = screen_old->areabase.first; sa; sa = sa->next) { - WM_event_remove_area_handler(&win->modalhandlers, sa); + for (ScrArea *area = screen_old->areabase.first; area; area = area->next) { + WM_event_remove_area_handler(&win->modalhandlers, area); } /* we put timer to sleep, so screen_exit has to think there's no timer */ @@ -1042,7 +1044,10 @@ bool ED_screen_change(bContext *C, bScreen *sc) return false; } -static void screen_set_3dview_camera(Scene *scene, ViewLayer *view_layer, ScrArea *sa, View3D *v3d) +static void screen_set_3dview_camera(Scene *scene, + ViewLayer *view_layer, + ScrArea *area, + View3D *v3d) { /* fix any cameras that are used in the 3d view but not in the scene */ BKE_screen_view3d_sync(v3d, scene); @@ -1055,8 +1060,8 @@ static void screen_set_3dview_camera(Scene *scene, ViewLayer *view_layer, ScrAre ListBase *regionbase; /* regionbase is in different place depending if space is active */ - if (v3d == sa->spacedata.first) { - regionbase = &sa->regionbase; + if (v3d == area->spacedata.first) { + regionbase = &area->regionbase; } else { regionbase = &v3d->regionbase; @@ -1104,28 +1109,28 @@ void ED_screen_scene_change(bContext *C, wmWindow *win, Scene *scene) /* Update 3D view cameras. */ const bScreen *screen = WM_window_get_active_screen(win); - for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) { - for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) { + for (ScrArea *area = screen->areabase.first; area; area = area->next) { + for (SpaceLink *sl = area->spacedata.first; sl; sl = sl->next) { if (sl->spacetype == SPACE_VIEW3D) { View3D *v3d = (View3D *)sl; - screen_set_3dview_camera(scene, view_layer, sa, v3d); + screen_set_3dview_camera(scene, view_layer, area, v3d); } } } } -ScrArea *ED_screen_full_newspace(bContext *C, ScrArea *sa, int type) +ScrArea *ED_screen_full_newspace(bContext *C, ScrArea *area, int type) { wmWindow *win = CTX_wm_window(C); ScrArea *newsa = NULL; SpaceLink *newsl; - if (!sa || sa->full == NULL) { - newsa = ED_screen_state_toggle(C, win, sa, SCREENMAXIMIZED); + if (!area || area->full == NULL) { + newsa = ED_screen_state_toggle(C, win, area, SCREENMAXIMIZED); } if (!newsa) { - newsa = sa; + newsa = area; } BLI_assert(newsa); @@ -1144,40 +1149,40 @@ ScrArea *ED_screen_full_newspace(bContext *C, ScrArea *sa, int type) /** * \a was_prev_temp for the case previous space was a temporary fullscreen as well */ -void ED_screen_full_prevspace(bContext *C, ScrArea *sa) +void ED_screen_full_prevspace(bContext *C, ScrArea *area) { - BLI_assert(sa->full); + BLI_assert(area->full); - if (sa->flag & AREA_FLAG_STACKED_FULLSCREEN) { + if (area->flag & AREA_FLAG_STACKED_FULLSCREEN) { /* stacked fullscreen -> only go back to previous area and don't toggle out of fullscreen */ - ED_area_prevspace(C, sa); + ED_area_prevspace(C, area); } else { - ED_screen_restore_temp_type(C, sa); + ED_screen_restore_temp_type(C, area); } } -void ED_screen_restore_temp_type(bContext *C, ScrArea *sa) +void ED_screen_restore_temp_type(bContext *C, ScrArea *area) { - SpaceLink *sl = sa->spacedata.first; + SpaceLink *sl = area->spacedata.first; /* In case nether functions below run. */ - ED_area_tag_redraw(sa); + ED_area_tag_redraw(area); if (sl->link_flag & SPACE_FLAG_TYPE_TEMPORARY) { - ED_area_prevspace(C, sa); + ED_area_prevspace(C, area); } - if (sa->full) { - ED_screen_state_toggle(C, CTX_wm_window(C), sa, SCREENMAXIMIZED); + if (area->full) { + ED_screen_state_toggle(C, CTX_wm_window(C), area, SCREENMAXIMIZED); } } /* restore a screen / area back to default operation, after temp fullscreen modes */ -void ED_screen_full_restore(bContext *C, ScrArea *sa) +void ED_screen_full_restore(bContext *C, ScrArea *area) { wmWindow *win = CTX_wm_window(C); - SpaceLink *sl = sa->spacedata.first; + SpaceLink *sl = area->spacedata.first; bScreen *screen = CTX_wm_screen(C); short state = (screen ? screen->state : SCREENMAXIMIZED); @@ -1186,25 +1191,25 @@ void ED_screen_full_restore(bContext *C, ScrArea *sa) if (sl->next) { if (sl->link_flag & SPACE_FLAG_TYPE_TEMPORARY) { - ED_screen_full_prevspace(C, sa); + ED_screen_full_prevspace(C, area); } else { - ED_screen_state_toggle(C, win, sa, state); + ED_screen_state_toggle(C, win, area, state); } - /* warning: 'sa' may be freed */ + /* warning: 'area' may be freed */ } /* otherwise just tile the area again */ else { - ED_screen_state_toggle(C, win, sa, state); + ED_screen_state_toggle(C, win, area, state); } } /** * this function toggles: if area is maximized/full then the parent will be restored * - * \warning \a sa may be freed. + * \warning \a area may be freed. */ -ScrArea *ED_screen_state_toggle(bContext *C, wmWindow *win, ScrArea *sa, const short state) +ScrArea *ED_screen_state_toggle(bContext *C, wmWindow *win, ScrArea *area, const short state) { Main *bmain = CTX_data_main(C); wmWindowManager *wm = CTX_wm_manager(C); @@ -1212,11 +1217,11 @@ ScrArea *ED_screen_state_toggle(bContext *C, wmWindow *win, ScrArea *sa, const s bScreen *sc, *oldscreen; ARegion *region; - if (sa) { + if (area) { /* ensure we don't have a button active anymore, can crash when * switching screens with tooltip open because region and tooltip * are no longer in the same screen */ - for (region = sa->regionbase.first; region; region = region->next) { + for (region = area->regionbase.first; region; region = region->next) { UI_blocklist_free(C, ®ion->uiblocks); if (region->regiontimer) { @@ -1226,14 +1231,14 @@ ScrArea *ED_screen_state_toggle(bContext *C, wmWindow *win, ScrArea *sa, const s } /* prevent hanging status prints */ - ED_area_status_text(sa, NULL); + ED_area_status_text(area, NULL); ED_workspace_status_text(C, NULL); } - if (sa && sa->full) { + if (area && area->full) { WorkSpaceLayout *layout_old = WM_window_get_active_layout(win); /* restoring back to SCREENNORMAL */ - sc = sa->full; /* the old screen to restore */ + sc = area->full; /* the old screen to restore */ oldscreen = WM_window_get_active_screen(win); /* the one disappearing */ BLI_assert(BKE_workspace_layout_screen_get(layout_old) != sc); @@ -1254,7 +1259,7 @@ ScrArea *ED_screen_state_toggle(bContext *C, wmWindow *win, ScrArea *sa, const s old->full = NULL; } - sa->full = NULL; + area->full = NULL; if (fullsa == NULL) { if (G.debug & G_DEBUG) { @@ -1270,12 +1275,12 @@ ScrArea *ED_screen_state_toggle(bContext *C, wmWindow *win, ScrArea *sa, const s glob_area->global->flag &= ~GLOBAL_AREA_IS_HIDDEN; } /* restore the old side panels/header visibility */ - for (region = sa->regionbase.first; region; region = region->next) { + for (region = area->regionbase.first; region; region = region->next) { region->flag = region->flagfullscreen; } } - ED_area_data_swap(fullsa, sa); + ED_area_data_swap(fullsa, area); /* animtimer back */ sc->animtimer = oldscreen->animtimer; @@ -1318,15 +1323,15 @@ ScrArea *ED_screen_state_toggle(bContext *C, wmWindow *win, ScrArea *sa, const s /* use random area when we have no active one, e.g. when the * mouse is outside of the window and we open a file browser */ - if (!sa || sa->global) { - sa = oldscreen->areabase.first; + if (!area || area->global) { + area = oldscreen->areabase.first; } newa = (ScrArea *)sc->areabase.first; /* copy area */ - ED_area_data_swap(newa, sa); - newa->flag = sa->flag; /* mostly for AREA_FLAG_WASFULLSCREEN */ + ED_area_data_swap(newa, area); + newa->flag = area->flag; /* mostly for AREA_FLAG_WASFULLSCREEN */ if (state == SCREENFULL) { /* temporarily hide global areas */ @@ -1351,7 +1356,7 @@ ScrArea *ED_screen_state_toggle(bContext *C, wmWindow *win, ScrArea *sa, const s } } - sa->full = oldscreen; + area->full = oldscreen; newa->full = oldscreen; ED_screen_change(C, sc); @@ -1381,35 +1386,35 @@ ScrArea *ED_screen_temp_space_open(bContext *C, int display_type, bool dialog) { - ScrArea *sa = NULL; + ScrArea *area = NULL; switch (display_type) { case USER_TEMP_SPACE_DISPLAY_WINDOW: if (WM_window_open_temp(C, title, x, y, sizex, sizey, (int)space_type, dialog)) { - sa = CTX_wm_area(C); + area = CTX_wm_area(C); } break; case USER_TEMP_SPACE_DISPLAY_FULLSCREEN: { - ScrArea *ctx_sa = CTX_wm_area(C); + ScrArea *ctx_area = CTX_wm_area(C); - if (ctx_sa != NULL && ctx_sa->full) { - sa = ctx_sa; - ED_area_newspace(C, ctx_sa, space_type, true); - sa->flag |= AREA_FLAG_STACKED_FULLSCREEN; - ((SpaceLink *)sa->spacedata.first)->link_flag |= SPACE_FLAG_TYPE_TEMPORARY; + if (ctx_area != NULL && ctx_area->full) { + area = ctx_area; + ED_area_newspace(C, ctx_area, space_type, true); + area->flag |= AREA_FLAG_STACKED_FULLSCREEN; + ((SpaceLink *)area->spacedata.first)->link_flag |= SPACE_FLAG_TYPE_TEMPORARY; } - else if (ctx_sa != NULL && ctx_sa->spacetype == space_type) { - sa = ED_screen_state_toggle(C, CTX_wm_window(C), ctx_sa, SCREENMAXIMIZED); + else if (ctx_area != NULL && ctx_area->spacetype == space_type) { + area = ED_screen_state_toggle(C, CTX_wm_window(C), ctx_area, SCREENMAXIMIZED); } else { - sa = ED_screen_full_newspace(C, ctx_sa, (int)space_type); - ((SpaceLink *)sa->spacedata.first)->link_flag |= SPACE_FLAG_TYPE_TEMPORARY; + area = ED_screen_full_newspace(C, ctx_area, (int)space_type); + ((SpaceLink *)area->spacedata.first)->link_flag |= SPACE_FLAG_TYPE_TEMPORARY; } break; } } - return sa; + return area; } /* update frame rate info for viewport drawing */ @@ -1487,12 +1492,12 @@ void ED_screen_animation_timer(bContext *C, int redraws, int sync, int enable) sad->flag |= (enable < 0) ? ANIMPLAY_FLAG_REVERSE : 0; sad->flag |= (sync == 0) ? ANIMPLAY_FLAG_NO_SYNC : (sync == 1) ? ANIMPLAY_FLAG_SYNC : 0; - ScrArea *sa = CTX_wm_area(C); + ScrArea *area = CTX_wm_area(C); char spacetype = -1; - if (sa) { - spacetype = sa->spacetype; + if (area) { + spacetype = area->spacetype; } sad->from_anim_edit = (ELEM(spacetype, SPACE_GRAPH, SPACE_ACTION, SPACE_NLA)); @@ -1508,13 +1513,13 @@ void ED_screen_animation_timer(bContext *C, int redraws, int sync, int enable) static ARegion *time_top_left_3dwindow(bScreen *screen) { ARegion *aret = NULL; - ScrArea *sa; + ScrArea *area; int min = 10000; - for (sa = screen->areabase.first; sa; sa = sa->next) { - if (sa->spacetype == SPACE_VIEW3D) { + for (area = screen->areabase.first; area; area = area->next) { + if (area->spacetype == SPACE_VIEW3D) { ARegion *region; - for (region = sa->regionbase.first; region; region = region->next) { + for (region = area->regionbase.first; region; region = region->next) { if (region->regiontype == RGN_TYPE_WINDOW) { if (region->winrct.xmin - region->winrct.ymin < min) { aret = region; @@ -1573,11 +1578,11 @@ void ED_update_for_newframe(Main *bmain, Depsgraph *depsgraph) */ bool ED_screen_stereo3d_required(const bScreen *screen, const Scene *scene) { - ScrArea *sa; + ScrArea *area; const bool is_multiview = (scene->r.scemode & R_MULTIVIEW) != 0; - for (sa = screen->areabase.first; sa; sa = sa->next) { - switch (sa->spacetype) { + for (area = screen->areabase.first; area; area = area->next) { + switch (area->spacetype) { case SPACE_VIEW3D: { View3D *v3d; @@ -1585,10 +1590,10 @@ bool ED_screen_stereo3d_required(const bScreen *screen, const Scene *scene) continue; } - v3d = sa->spacedata.first; + v3d = area->spacedata.first; if (v3d->camera && v3d->stereo3d_camera == STEREO_3D_ID) { ARegion *region; - for (region = sa->regionbase.first; region; region = region->next) { + for (region = area->regionbase.first; region; region = region->next) { if (region->regiondata && region->regiontype == RGN_TYPE_WINDOW) { RegionView3D *rv3d = region->regiondata; if (rv3d->persp == RV3D_CAMOB) { @@ -1604,7 +1609,7 @@ bool ED_screen_stereo3d_required(const bScreen *screen, const Scene *scene) /* images should always show in stereo, even if * the file doesn't have views enabled */ - sima = sa->spacedata.first; + sima = area->spacedata.first; if (sima->image && BKE_image_is_stereo(sima->image) && (sima->iuser.flag & IMA_SHOW_STEREO)) { return true; @@ -1618,7 +1623,7 @@ bool ED_screen_stereo3d_required(const bScreen *screen, const Scene *scene) continue; } - snode = sa->spacedata.first; + snode = area->spacedata.first; if ((snode->flag & SNODE_BACKDRAW) && ED_node_is_compositor(snode)) { return true; } @@ -1631,7 +1636,7 @@ bool ED_screen_stereo3d_required(const bScreen *screen, const Scene *scene) continue; } - sseq = sa->spacedata.first; + sseq = area->spacedata.first; if (ELEM(sseq->view, SEQ_VIEW_PREVIEW, SEQ_VIEW_SEQUENCE_PREVIEW)) { return true; } @@ -1675,16 +1680,16 @@ ScrArea *ED_screen_area_find_with_spacedata(const bScreen *screen, const bool only_visible) { if (only_visible) { - for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) { - if (sa->spacedata.first == sl) { - return sa; + for (ScrArea *area = screen->areabase.first; area; area = area->next) { + if (area->spacedata.first == sl) { + return area; } } } else { - for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) { - if (BLI_findindex(&sa->spacedata, sl) != -1) { - return sa; + for (ScrArea *area = screen->areabase.first; area; area = area->next) { + if (BLI_findindex(&area->spacedata, sl) != -1) { + return area; } } } diff --git a/source/blender/editors/screen/screen_geometry.c b/source/blender/editors/screen/screen_geometry.c index 25855382307..9169bf37116 100644 --- a/source/blender/editors/screen/screen_geometry.c +++ b/source/blender/editors/screen/screen_geometry.c @@ -163,7 +163,6 @@ void screen_geom_vertices_scale(const wmWindow *win, bScreen *sc) const int screen_size_x = BLI_rcti_size_x(&screen_rect); const int screen_size_y = BLI_rcti_size_y(&screen_rect); ScrVert *sv = NULL; - ScrArea *sa; int screen_size_x_prev, screen_size_y_prev; float min[2], max[2]; @@ -199,19 +198,19 @@ void screen_geom_vertices_scale(const wmWindow *win, bScreen *sc) if (facy > 1) { /* Keep timeline small in video edit workspace. */ - for (sa = sc->areabase.first; sa; sa = sa->next) { - if (sa->spacetype == SPACE_ACTION && sa->v1->vec.y == screen_rect.ymin && - screen_geom_area_height(sa) <= headery * facy + 1) { - ScrEdge *se = BKE_screen_find_edge(sc, sa->v2, sa->v3); + for (ScrArea *area = sc->areabase.first; area; area = area->next) { + if (area->spacetype == SPACE_ACTION && area->v1->vec.y == screen_rect.ymin && + screen_geom_area_height(area) <= headery * facy + 1) { + ScrEdge *se = BKE_screen_find_edge(sc, area->v2, area->v3); if (se) { - const int yval = sa->v1->vec.y + headery - 1; + const int yval = area->v1->vec.y + headery - 1; screen_geom_select_connected_edge(win, se); /* all selected vertices get the right offset */ for (sv = sc->vertbase.first; sv; sv = sv->next) { /* if is a collapsed area */ - if (sv != sa->v1 && sv != sa->v4) { + if (sv != area->v1 && sv != area->v4) { if (sv->flag) { sv->vec.y = yval; } @@ -223,19 +222,19 @@ void screen_geom_vertices_scale(const wmWindow *win, bScreen *sc) } if (facy < 1) { /* make each window at least ED_area_headersize() high */ - for (sa = sc->areabase.first; sa; sa = sa->next) { - if (screen_geom_area_height(sa) < headery) { + for (ScrArea *area = sc->areabase.first; area; area = area->next) { + if (screen_geom_area_height(area) < headery) { /* lower edge */ - ScrEdge *se = BKE_screen_find_edge(sc, sa->v4, sa->v1); - if (se && sa->v1 != sa->v2) { - const int yval = sa->v2->vec.y - headery + 1; + ScrEdge *se = BKE_screen_find_edge(sc, area->v4, area->v1); + if (se && area->v1 != area->v2) { + const int yval = area->v2->vec.y - headery + 1; screen_geom_select_connected_edge(win, se); /* all selected vertices get the right offset */ for (sv = sc->vertbase.first; sv; sv = sv->next) { /* if is not a collapsed area */ - if (sv != sa->v2 && sv != sa->v3) { + if (sv != area->v2 && sv != area->v3) { if (sv->flag) { sv->vec.y = yval; } @@ -284,14 +283,14 @@ void screen_geom_vertices_scale(const wmWindow *win, bScreen *sc) /** * \return 0 if no split is possible, otherwise the screen-coordinate at which to split. */ -short screen_geom_find_area_split_point(const ScrArea *sa, +short screen_geom_find_area_split_point(const ScrArea *area, const rcti *window_rect, char dir, float fac) { short x, y; - const int cur_area_width = screen_geom_area_width(sa); - const int cur_area_height = screen_geom_area_height(sa); + const int cur_area_width = screen_geom_area_width(area); + const int cur_area_height = screen_geom_area_height(area); const short area_min_x = AREAMINX; const short area_min_y = ED_area_headersize(); int area_min; @@ -308,43 +307,43 @@ short screen_geom_find_area_split_point(const ScrArea *sa, CLAMP(fac, 0.0f, 1.0f); if (dir == 'h') { - y = sa->v1->vec.y + round_fl_to_short(fac * cur_area_height); + y = area->v1->vec.y + round_fl_to_short(fac * cur_area_height); area_min = area_min_y; - if (sa->v1->vec.y > window_rect->ymin) { + if (area->v1->vec.y > window_rect->ymin) { area_min += U.pixelsize; } - if (sa->v2->vec.y < (window_rect->ymax - 1)) { + if (area->v2->vec.y < (window_rect->ymax - 1)) { area_min += U.pixelsize; } - if (y - sa->v1->vec.y < area_min) { - y = sa->v1->vec.y + area_min; + if (y - area->v1->vec.y < area_min) { + y = area->v1->vec.y + area_min; } - else if (sa->v2->vec.y - y < area_min) { - y = sa->v2->vec.y - area_min; + else if (area->v2->vec.y - y < area_min) { + y = area->v2->vec.y - area_min; } return y; } else { - x = sa->v1->vec.x + round_fl_to_short(fac * cur_area_width); + x = area->v1->vec.x + round_fl_to_short(fac * cur_area_width); area_min = area_min_x; - if (sa->v1->vec.x > window_rect->xmin) { + if (area->v1->vec.x > window_rect->xmin) { area_min += U.pixelsize; } - if (sa->v4->vec.x < (window_rect->xmax - 1)) { + if (area->v4->vec.x < (window_rect->xmax - 1)) { area_min += U.pixelsize; } - if (x - sa->v1->vec.x < area_min) { - x = sa->v1->vec.x + area_min; + if (x - area->v1->vec.x < area_min) { + x = area->v1->vec.x + area_min; } - else if (sa->v4->vec.x - x < area_min) { - x = sa->v4->vec.x - area_min; + else if (area->v4->vec.x - x < area_min) { + x = area->v4->vec.x - area_min; } return x; diff --git a/source/blender/editors/screen/screen_intern.h b/source/blender/editors/screen/screen_intern.h index e1a75e51cf2..af57d95c086 100644 --- a/source/blender/editors/screen/screen_intern.h +++ b/source/blender/editors/screen/screen_intern.h @@ -36,7 +36,7 @@ struct bContextDataResult; #define AZONEFADEOUT (6.5f * U.widget_unit) /* when we start seeing the azone */ /* area.c */ -void ED_area_data_copy(ScrArea *sa_dst, ScrArea *sa_src, const bool do_free); +void ED_area_data_copy(ScrArea *area_dst, ScrArea *area_src, const bool do_free); void ED_area_data_swap(ScrArea *sa1, ScrArea *sa2); void region_toggle_hidden(struct bContext *C, ARegion *region, const bool do_fade); @@ -50,11 +50,12 @@ bScreen *screen_change_prepare(bScreen *screen_old, struct Main *bmain, struct bContext *C, wmWindow *win); -ScrArea *area_split(const wmWindow *win, bScreen *sc, ScrArea *sa, char dir, float fac, int merge); +ScrArea *area_split( + const wmWindow *win, bScreen *sc, ScrArea *area, char dir, float fac, int merge); int screen_area_join(struct bContext *C, bScreen *scr, ScrArea *sa1, ScrArea *sa2); -int area_getorientation(ScrArea *sa, ScrArea *sb); +int area_getorientation(ScrArea *area, ScrArea *sb); -struct AZone *ED_area_actionzone_find_xy(ScrArea *sa, const int xy[2]); +struct AZone *ED_area_actionzone_find_xy(ScrArea *area, const int xy[2]); /* screen_geometry.c */ int screen_geom_area_height(const ScrArea *area); @@ -73,7 +74,7 @@ ScrEdge *screen_geom_find_active_scredge(const wmWindow *win, const int mx, const int my); void screen_geom_vertices_scale(const wmWindow *win, bScreen *sc); -short screen_geom_find_area_split_point(const ScrArea *sa, +short screen_geom_find_area_split_point(const ScrArea *area, const rcti *window_rect, char dir, float fac); diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 5eb676cd25c..2e4734e75a5 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -590,20 +590,20 @@ bool ED_operator_editmball(bContext *C) bool ED_operator_mask(bContext *C) { - ScrArea *sa = CTX_wm_area(C); - if (sa && sa->spacedata.first) { - switch (sa->spacetype) { + ScrArea *area = CTX_wm_area(C); + if (area && area->spacedata.first) { + switch (area->spacetype) { case SPACE_CLIP: { - SpaceClip *sc = sa->spacedata.first; + SpaceClip *sc = area->spacedata.first; return ED_space_clip_check_show_maskedit(sc); } case SPACE_SEQ: { - SpaceSeq *sseq = sa->spacedata.first; + SpaceSeq *sseq = area->spacedata.first; Scene *scene = CTX_data_scene(C); return ED_space_sequencer_check_show_maskedit(sseq, scene); } case SPACE_IMAGE: { - SpaceImage *sima = sa->spacedata.first; + SpaceImage *sima = area->spacedata.first; ViewLayer *view_layer = CTX_data_view_layer(C); return ED_space_image_check_show_maskedit(sima, view_layer); } @@ -681,8 +681,8 @@ static bool actionzone_area_poll(bContext *C) const int *xy = &win->eventstate->x; AZone *az; - for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) { - for (az = sa->actionzones.first; az; az = az->next) { + for (ScrArea *area = screen->areabase.first; area; area = area->next) { + for (az = area->actionzones.first; az; az = az->next) { if (BLI_rcti_isect_pt_v(&az->rect, xy)) { return 1; } @@ -743,11 +743,11 @@ static bool azone_clipped_rect_calc(const AZone *az, rcti *r_rect_clip) return false; } -static AZone *area_actionzone_refresh_xy(ScrArea *sa, const int xy[2], const bool test_only) +static AZone *area_actionzone_refresh_xy(ScrArea *area, const int xy[2], const bool test_only) { AZone *az = NULL; - for (az = sa->actionzones.first; az; az = az->next) { + for (az = area->actionzones.first; az; az = az->next) { rcti az_rect_clip; if (BLI_rcti_isect_pt_v(&az->rect, xy) && /* Check clipping if this is clipped */ @@ -798,7 +798,7 @@ static AZone *area_actionzone_refresh_xy(ScrArea *sa, const int xy[2], const boo } /* XXX force redraw to show/hide the action zone */ - ED_area_tag_redraw(sa); + ED_area_tag_redraw(area); break; } } @@ -868,18 +868,18 @@ static AZone *area_actionzone_refresh_xy(ScrArea *sa, const int xy[2], const boo else if (!test_only && !IS_EQF(az->alpha, 0.0f)) { if (az->type == AZONE_FULLSCREEN) { az->alpha = 0.0f; - sa->flag &= ~AREA_FLAG_ACTIONZONES_UPDATE; - ED_area_tag_redraw_no_rebuild(sa); + area->flag &= ~AREA_FLAG_ACTIONZONES_UPDATE; + ED_area_tag_redraw_no_rebuild(area); } else if (az->type == AZONE_REGION_SCROLL) { if (az->direction == AZ_SCROLL_VERT) { az->alpha = az->region->v2d.alpha_vert = 0; - sa->flag &= ~AREA_FLAG_ACTIONZONES_UPDATE; + area->flag &= ~AREA_FLAG_ACTIONZONES_UPDATE; ED_region_tag_redraw_no_rebuild(az->region); } else if (az->direction == AZ_SCROLL_HOR) { az->alpha = az->region->v2d.alpha_hor = 0; - sa->flag &= ~AREA_FLAG_ACTIONZONES_UPDATE; + area->flag &= ~AREA_FLAG_ACTIONZONES_UPDATE; ED_region_tag_redraw_no_rebuild(az->region); } else { @@ -895,8 +895,8 @@ static AZone *area_actionzone_refresh_xy(ScrArea *sa, const int xy[2], const boo /* Finds an action-zone by position in entire screen so azones can overlap. */ static AZone *screen_actionzone_find_xy(bScreen *sc, const int xy[2]) { - for (ScrArea *sa = sc->areabase.first; sa; sa = sa->next) { - AZone *az = area_actionzone_refresh_xy(sa, xy, true); + for (ScrArea *area = sc->areabase.first; area; area = area->next) { + AZone *az = area_actionzone_refresh_xy(area, xy, true); if (az != NULL) { return az; } @@ -917,14 +917,14 @@ static ScrArea *screen_actionzone_area(bScreen *sc, const AZone *az) return NULL; } -AZone *ED_area_actionzone_find_xy(ScrArea *sa, const int xy[2]) +AZone *ED_area_actionzone_find_xy(ScrArea *area, const int xy[2]) { - return area_actionzone_refresh_xy(sa, xy, true); + return area_actionzone_refresh_xy(area, xy, true); } -AZone *ED_area_azones_update(ScrArea *sa, const int xy[2]) +AZone *ED_area_azones_update(ScrArea *area, const int xy[2]) { - return area_actionzone_refresh_xy(sa, xy, false); + return area_actionzone_refresh_xy(area, xy, false); } static void actionzone_exit(wmOperator *op) @@ -1327,12 +1327,12 @@ static int area_dupli_invoke(bContext *C, wmOperator *op, const wmEvent *event) WorkSpaceLayout *layout_old = WM_window_get_active_layout(win); WorkSpaceLayout *layout_new; bScreen *newsc; - ScrArea *sa; + ScrArea *area; rcti rect; win = CTX_wm_window(C); scene = CTX_data_scene(C); - sa = CTX_wm_area(C); + area = CTX_wm_area(C); /* XXX hrmf! */ if (event->type == EVT_ACTIONZONE_AREA) { @@ -1342,11 +1342,11 @@ static int area_dupli_invoke(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_PASS_THROUGH; } - sa = sad->sa1; + area = sad->sa1; } /* adds window to WM */ - rect = sa->totrct; + rect = area->totrct; BLI_rcti_translate(&rect, win->posx, win->posy); rect.xmax = rect.xmin + BLI_rcti_size_x(&rect) / U.pixelsize; rect.ymax = rect.ymin + BLI_rcti_size_y(&rect) / U.pixelsize; @@ -1371,7 +1371,7 @@ static int area_dupli_invoke(bContext *C, wmOperator *op, const wmEvent *event) WM_window_set_active_layout(newwin, workspace, layout_new); /* copy area to new screen */ - ED_area_data_copy((ScrArea *)newsc->areabase.first, sa, true); + ED_area_data_copy((ScrArea *)newsc->areabase.first, area, true); ED_area_tag_redraw((ScrArea *)newsc->areabase.first); @@ -1507,25 +1507,25 @@ static void area_move_set_limits( WM_window_rect_calc(win, &window_rect); - for (ScrArea *sa = sc->areabase.first; sa; sa = sa->next) { + for (ScrArea *area = sc->areabase.first; area; area = area->next) { if (dir == 'h') { int y1; areamin = areaminy; - if (sa->v1->vec.y > window_rect.ymin) { + if (area->v1->vec.y > window_rect.ymin) { areamin += U.pixelsize; } - if (sa->v2->vec.y < (window_rect.ymax - 1)) { + if (area->v2->vec.y < (window_rect.ymax - 1)) { areamin += U.pixelsize; } - y1 = screen_geom_area_height(sa) - areamin; + y1 = screen_geom_area_height(area) - areamin; /* if top or down edge selected, test height */ - if (sa->v1->editflag && sa->v4->editflag) { + if (area->v1->editflag && area->v4->editflag) { *bigger = min_ii(*bigger, y1); } - else if (sa->v2->editflag && sa->v3->editflag) { + else if (area->v2->editflag && area->v3->editflag) { *smaller = min_ii(*smaller, y1); } } @@ -1533,20 +1533,20 @@ static void area_move_set_limits( int x1; areamin = AREAMINX; - if (sa->v1->vec.x > window_rect.xmin) { + if (area->v1->vec.x > window_rect.xmin) { areamin += U.pixelsize; } - if (sa->v4->vec.x < (window_rect.xmax - 1)) { + if (area->v4->vec.x < (window_rect.xmax - 1)) { areamin += U.pixelsize; } - x1 = screen_geom_area_width(sa) - areamin; + x1 = screen_geom_area_width(area) - areamin; /* if left or right edge selected, test width */ - if (sa->v1->editflag && sa->v2->editflag) { + if (area->v1->editflag && area->v2->editflag) { *bigger = min_ii(*bigger, x1); } - else if (sa->v3->editflag && sa->v4->editflag) { + else if (area->v3->editflag && area->v4->editflag) { *smaller = min_ii(*smaller, x1); } } @@ -1737,29 +1737,29 @@ static void area_move_apply_do(const bContext *C, /* only redraw if we actually moved a screen vert, for AREAGRID */ if (doredraw) { bool redraw_all = false; - ED_screen_areas_iter(win, sc, sa) + ED_screen_areas_iter(win, sc, area) { - if (sa->v1->editflag || sa->v2->editflag || sa->v3->editflag || sa->v4->editflag) { - if (ED_area_is_global(sa)) { + if (area->v1->editflag || area->v2->editflag || area->v3->editflag || area->v4->editflag) { + if (ED_area_is_global(area)) { /* Snap to minimum or maximum for global areas. */ - int height = round_fl_to_int(screen_geom_area_height(sa) / UI_DPI_FAC); - if (abs(height - sa->global->size_min) < abs(height - sa->global->size_max)) { - sa->global->cur_fixed_height = sa->global->size_min; + int height = round_fl_to_int(screen_geom_area_height(area) / UI_DPI_FAC); + if (abs(height - area->global->size_min) < abs(height - area->global->size_max)) { + area->global->cur_fixed_height = area->global->size_min; } else { - sa->global->cur_fixed_height = sa->global->size_max; + area->global->cur_fixed_height = area->global->size_max; } sc->do_refresh = true; redraw_all = true; } - ED_area_tag_redraw(sa); + ED_area_tag_redraw(area); } } if (redraw_all) { - ED_screen_areas_iter(win, sc, sa) + ED_screen_areas_iter(win, sc, area) { - ED_area_tag_redraw(sa); + ED_area_tag_redraw(area); } } @@ -1984,13 +1984,13 @@ static int area_split_menu_init(bContext *C, wmOperator *op) /* generic init, no UI stuff here, assumes active area */ static int area_split_init(bContext *C, wmOperator *op) { - ScrArea *sa = CTX_wm_area(C); + ScrArea *area = CTX_wm_area(C); sAreaSplitData *sd; int areaminy = ED_area_headersize(); int dir; /* required context */ - if (sa == NULL) { + if (area == NULL) { return 0; } @@ -1998,10 +1998,10 @@ static int area_split_init(bContext *C, wmOperator *op) dir = RNA_enum_get(op->ptr, "direction"); /* minimal size */ - if (dir == 'v' && sa->winx < 2 * AREAMINX) { + if (dir == 'v' && area->winx < 2 * AREAMINX) { return 0; } - if (dir == 'h' && sa->winy < 2 * areaminy) { + if (dir == 'h' && area->winy < 2 * areaminy) { return 0; } @@ -2009,42 +2009,42 @@ static int area_split_init(bContext *C, wmOperator *op) sd = (sAreaSplitData *)MEM_callocN(sizeof(sAreaSplitData), "op_area_split"); op->customdata = sd; - sd->sarea = sa; + sd->sarea = area; if (dir == 'v') { - sd->origmin = sa->v1->vec.x; - sd->origsize = sa->v4->vec.x - sd->origmin; + sd->origmin = area->v1->vec.x; + sd->origsize = area->v4->vec.x - sd->origmin; } else { - sd->origmin = sa->v1->vec.y; - sd->origsize = sa->v2->vec.y - sd->origmin; + sd->origmin = area->v1->vec.y; + sd->origsize = area->v2->vec.y - sd->origmin; } return 1; } -/* with sa as center, sb is located at: 0=W, 1=N, 2=E, 3=S */ +/* with area as center, sb is located at: 0=W, 1=N, 2=E, 3=S */ /* used with split operator */ -static ScrEdge *area_findsharededge(bScreen *screen, ScrArea *sa, ScrArea *sb) +static ScrEdge *area_findsharededge(bScreen *screen, ScrArea *area, ScrArea *sb) { - ScrVert *sav1 = sa->v1; - ScrVert *sav2 = sa->v2; - ScrVert *sav3 = sa->v3; - ScrVert *sav4 = sa->v4; + ScrVert *sav1 = area->v1; + ScrVert *sav2 = area->v2; + ScrVert *sav3 = area->v3; + ScrVert *sav4 = area->v4; ScrVert *sbv1 = sb->v1; ScrVert *sbv2 = sb->v2; ScrVert *sbv3 = sb->v3; ScrVert *sbv4 = sb->v4; - if (sav1 == sbv4 && sav2 == sbv3) { /* sa to right of sb = W */ + if (sav1 == sbv4 && sav2 == sbv3) { /* area to right of sb = W */ return BKE_screen_find_edge(screen, sav1, sav2); } - else if (sav2 == sbv1 && sav3 == sbv4) { /* sa to bottom of sb = N */ + else if (sav2 == sbv1 && sav3 == sbv4) { /* area to bottom of sb = N */ return BKE_screen_find_edge(screen, sav2, sav3); } - else if (sav3 == sbv2 && sav4 == sbv1) { /* sa to left of sb = E */ + else if (sav3 == sbv2 && sav4 == sbv1) { /* area to left of sb = E */ return BKE_screen_find_edge(screen, sav3, sav4); } - else if (sav1 == sbv2 && sav4 == sbv3) { /* sa on top of sb = S*/ + else if (sav1 == sbv2 && sav4 == sbv3) { /* area on top of sb = S*/ return BKE_screen_find_edge(screen, sav1, sav4); } @@ -2198,18 +2198,18 @@ static int area_split_invoke(bContext *C, wmOperator *op, const wmEvent *event) } } else if (RNA_property_is_set(op->ptr, prop_dir)) { - ScrArea *sa = CTX_wm_area(C); - if (sa == NULL) { + ScrArea *area = CTX_wm_area(C); + if (area == NULL) { return OPERATOR_CANCELLED; } dir = RNA_property_enum_get(op->ptr, prop_dir); if (dir == 'h') { RNA_property_float_set( - op->ptr, prop_factor, ((float)(event->x - sa->v1->vec.x)) / (float)sa->winx); + op->ptr, prop_factor, ((float)(event->x - area->v1->vec.x)) / (float)area->winx); } else { RNA_property_float_set( - op->ptr, prop_factor, ((float)(event->y - sa->v1->vec.y)) / (float)sa->winy); + op->ptr, prop_factor, ((float)(event->y - area->v1->vec.y)) / (float)area->winy); } if (!area_split_init(C, op)) { @@ -2389,18 +2389,18 @@ static int area_split_modal(bContext *C, wmOperator *op, const wmEvent *event) sd->sarea = BKE_screen_find_area_xy(CTX_wm_screen(C), SPACE_TYPE_ANY, event->x, event->y); if (sd->sarea) { - ScrArea *sa = sd->sarea; + ScrArea *area = sd->sarea; if (dir == 'v') { - sd->origmin = sa->v1->vec.x; - sd->origsize = sa->v4->vec.x - sd->origmin; + sd->origmin = area->v1->vec.x; + sd->origsize = area->v4->vec.x - sd->origmin; } else { - sd->origmin = sa->v1->vec.y; - sd->origsize = sa->v2->vec.y - sd->origmin; + sd->origmin = area->v1->vec.y; + sd->origsize = area->v2->vec.y - sd->origmin; } if (sd->do_snap) { - sa->v1->editflag = sa->v2->editflag = sa->v3->editflag = sa->v4->editflag = 1; + area->v1->editflag = area->v2->editflag = area->v3->editflag = area->v4->editflag = 1; const int snap_loc = area_snap_calc_location(CTX_wm_screen(C), SNAP_FRACTION_AND_ADJACENT, @@ -2410,7 +2410,7 @@ static int area_split_modal(bContext *C, wmOperator *op, const wmEvent *event) sd->origmin + sd->origsize, -sd->origmin); - sa->v1->editflag = sa->v2->editflag = sa->v3->editflag = sa->v4->editflag = 0; + area->v1->editflag = area->v2->editflag = area->v3->editflag = area->v4->editflag = 0; sd->delta = snap_loc - sd->origval; } @@ -2465,7 +2465,7 @@ static void SCREEN_OT_area_split(wmOperatorType *ot) typedef struct RegionMoveData { AZone *az; ARegion *region; - ScrArea *sa; + ScrArea *area; int bigger, smaller, origval; int origx, origy; int maxsize; @@ -2473,7 +2473,7 @@ typedef struct RegionMoveData { } RegionMoveData; -static int area_max_regionsize(ScrArea *sa, ARegion *scalear, AZEdge edge) +static int area_max_regionsize(ScrArea *area, ARegion *scalear, AZEdge edge) { int dist; @@ -2492,15 +2492,15 @@ static int area_max_regionsize(ScrArea *sa, ARegion *scalear, AZEdge edge) } else { if (edge == AE_RIGHT_TO_TOPLEFT || edge == AE_LEFT_TO_TOPRIGHT) { - dist = BLI_rcti_size_x(&sa->totrct); + dist = BLI_rcti_size_x(&area->totrct); } else { /* AE_BOTTOM_TO_TOPLEFT, AE_TOP_TO_BOTTOMRIGHT */ - dist = BLI_rcti_size_y(&sa->totrct); + dist = BLI_rcti_size_y(&area->totrct); } /* subtractwidth of regions on opposite side * prevents dragging regions into other opposite regions */ - for (ARegion *region = sa->regionbase.first; region; region = region->next) { + for (ARegion *region = area->regionbase.first; region; region = region->next) { if (region == scalear) { continue; } @@ -2574,11 +2574,11 @@ static int region_scale_invoke(bContext *C, wmOperator *op, const wmEvent *event else { rmd->region = az->region; } - rmd->sa = sad->sa1; + rmd->area = sad->sa1; rmd->edge = az->edge; rmd->origx = event->x; rmd->origy = event->y; - rmd->maxsize = area_max_regionsize(rmd->sa, rmd->region, rmd->edge); + rmd->maxsize = area_max_regionsize(rmd->area, rmd->region, rmd->edge); /* if not set we do now, otherwise it uses type */ if (rmd->region->sizex == 0) { @@ -2641,7 +2641,7 @@ static void region_scale_toggle_hidden(bContext *C, RegionMoveData *rmd) if ((rmd->region->flag & RGN_FLAG_HIDDEN) == 0) { if (rmd->region->regiontype == RGN_TYPE_HEADER) { - ARegion *region_tool_header = BKE_area_find_region_type(rmd->sa, RGN_TYPE_TOOL_HEADER); + ARegion *region_tool_header = BKE_area_find_region_type(rmd->area, RGN_TYPE_TOOL_HEADER); if (region_tool_header != NULL) { if ((region_tool_header->flag & RGN_FLAG_HIDDEN_BY_USER) == 0 && (region_tool_header->flag & RGN_FLAG_HIDDEN) != 0) { @@ -2732,7 +2732,7 @@ static int region_scale_modal(bContext *C, wmOperator *op, const wmEvent *event) rmd->region->sizey = rmd->origval; } } - ED_area_tag_redraw(rmd->sa); + ED_area_tag_redraw(rmd->area); WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL); break; @@ -2747,7 +2747,7 @@ static int region_scale_modal(bContext *C, wmOperator *op, const wmEvent *event) region_scale_validate_size(rmd); } - ED_area_tag_redraw(rmd->sa); + ED_area_tag_redraw(rmd->area); WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL); } @@ -2800,13 +2800,13 @@ static void areas_do_frame_follow(bContext *C, bool middle) for (wmWindow *window = wm->windows.first; window; window = window->next) { const bScreen *screen = WM_window_get_active_screen(window); - 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) { /* do follow here if editor type supports it */ if ((scr->redraws_flag & TIME_FOLLOW)) { if ((region->regiontype == RGN_TYPE_WINDOW && - ELEM(sa->spacetype, SPACE_SEQ, SPACE_GRAPH, SPACE_ACTION, SPACE_NLA)) || - (sa->spacetype == SPACE_CLIP && region->regiontype == RGN_TYPE_PREVIEW)) { + ELEM(area->spacetype, SPACE_SEQ, SPACE_GRAPH, SPACE_ACTION, SPACE_NLA)) || + (area->spacetype == SPACE_CLIP && region->regiontype == RGN_TYPE_PREVIEW)) { float w = BLI_rctf_size_x(®ion->v2d.cur); if (middle) { @@ -3155,32 +3155,32 @@ static void SCREEN_OT_screen_set(wmOperatorType *ot) static int screen_maximize_area_exec(bContext *C, wmOperator *op) { bScreen *screen = CTX_wm_screen(C); - ScrArea *sa = NULL; + ScrArea *area = NULL; const bool hide_panels = RNA_boolean_get(op->ptr, "use_hide_panels"); /* search current screen for 'fullscreen' areas */ /* prevents restoring info header, when mouse is over it */ - for (sa = screen->areabase.first; sa; sa = sa->next) { - if (sa->full) { + for (area = screen->areabase.first; area; area = area->next) { + if (area->full) { break; } } - if (sa == NULL) { - sa = CTX_wm_area(C); + if (area == NULL) { + area = CTX_wm_area(C); } if (hide_panels) { if (!ELEM(screen->state, SCREENNORMAL, SCREENFULL)) { return OPERATOR_CANCELLED; } - ED_screen_state_toggle(C, CTX_wm_window(C), sa, SCREENFULL); + ED_screen_state_toggle(C, CTX_wm_window(C), area, SCREENFULL); } else { if (!ELEM(screen->state, SCREENNORMAL, SCREENMAXIMIZED)) { return OPERATOR_CANCELLED; } - ED_screen_state_toggle(C, CTX_wm_window(C), sa, SCREENMAXIMIZED); + ED_screen_state_toggle(C, CTX_wm_window(C), area, SCREENMAXIMIZED); } return OPERATOR_FINISHED; @@ -3396,24 +3396,24 @@ static int area_join_modal(bContext *C, wmOperator *op, const wmEvent *event) switch (event->type) { case MOUSEMOVE: { - ScrArea *sa = BKE_screen_find_area_xy(sc, SPACE_TYPE_ANY, event->x, event->y); + ScrArea *area = BKE_screen_find_area_xy(sc, SPACE_TYPE_ANY, event->x, event->y); int dir = -1; - if (sa) { - if (jd->sa1 != sa) { - dir = area_getorientation(jd->sa1, sa); + if (area) { + if (jd->sa1 != area) { + dir = area_getorientation(jd->sa1, area); if (dir != -1) { - jd->sa2 = sa; + jd->sa2 = area; } else { /* we are not bordering on the previously selected area * we check if area has common border with the one marked for removal * in this case we can swap areas. */ - dir = area_getorientation(sa, jd->sa2); + dir = area_getorientation(area, jd->sa2); if (dir != -1) { jd->sa1 = jd->sa2; - jd->sa2 = sa; + jd->sa2 = area; } else { jd->sa2 = NULL; @@ -3426,16 +3426,16 @@ static int area_join_modal(bContext *C, wmOperator *op, const wmEvent *event) * we swap the areas if possible to allow user to choose */ if (jd->sa2 != NULL) { jd->sa1 = jd->sa2; - jd->sa2 = sa; + jd->sa2 = area; dir = area_getorientation(jd->sa1, jd->sa2); if (dir == -1) { printf("oops, didn't expect that!\n"); } } else { - dir = area_getorientation(jd->sa1, sa); + dir = area_getorientation(jd->sa1, area); if (dir != -1) { - jd->sa2 = sa; + jd->sa2 = area; } } WM_event_add_notifier(C, NC_WINDOW, NULL); @@ -3612,18 +3612,18 @@ static int spacedata_cleanup_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); bScreen *screen; - ScrArea *sa; + ScrArea *area; int tot = 0; for (screen = bmain->screens.first; screen; screen = screen->id.next) { - for (sa = screen->areabase.first; sa; sa = sa->next) { - if (sa->spacedata.first != sa->spacedata.last) { - SpaceLink *sl = sa->spacedata.first; - - BLI_remlink(&sa->spacedata, sl); - tot += BLI_listbase_count(&sa->spacedata); - BKE_spacedata_freelist(&sa->spacedata); - BLI_addtail(&sa->spacedata, sl); + for (area = screen->areabase.first; area; area = area->next) { + if (area->spacedata.first != area->spacedata.last) { + SpaceLink *sl = area->spacedata.first; + + BLI_remlink(&area->spacedata, sl); + tot += BLI_listbase_count(&area->spacedata); + BKE_spacedata_freelist(&area->spacedata); + BLI_addtail(&area->spacedata, sl); } } } @@ -3809,7 +3809,7 @@ static void view3d_localview_update_rv3d(struct RegionView3D *rv3d) } static void region_quadview_init_rv3d( - ScrArea *sa, ARegion *region, const char viewlock, const char view, const char persp) + ScrArea *area, ARegion *region, const char viewlock, const char view, const char persp) { RegionView3D *rv3d = region->regiondata; @@ -3826,7 +3826,7 @@ static void region_quadview_init_rv3d( ED_view3d_lock(rv3d); view3d_localview_update_rv3d(rv3d); if ((viewlock & RV3D_BOXCLIP) && (persp == RV3D_ORTHO)) { - ED_view3d_quadview_update(sa, region, true); + ED_view3d_quadview_update(area, region, true); } } @@ -3841,13 +3841,13 @@ static int region_quadview_exec(bContext *C, wmOperator *op) } else if (region->alignment == RGN_ALIGN_QSPLIT) { /* Exit quad-view */ - ScrArea *sa = CTX_wm_area(C); + ScrArea *area = CTX_wm_area(C); ARegion *arn; /* keep current region */ region->alignment = 0; - if (sa->spacetype == SPACE_VIEW3D) { + if (area->spacetype == SPACE_VIEW3D) { ARegion *region_iter; RegionView3D *rv3d = region->regiondata; @@ -3869,7 +3869,7 @@ static int region_quadview_exec(bContext *C, wmOperator *op) rv3d->rflag &= ~RV3D_CLIPPING; /* Accumulate locks, in case they're mixed. */ - for (region_iter = sa->regionbase.first; region_iter; region_iter = region_iter->next) { + for (region_iter = area->regionbase.first; region_iter; region_iter = region_iter->next) { if (region_iter->regiontype == RGN_TYPE_WINDOW) { RegionView3D *rv3d_iter = region_iter->regiondata; rv3d->viewlock_quad |= rv3d_iter->viewlock; @@ -3877,13 +3877,13 @@ static int region_quadview_exec(bContext *C, wmOperator *op) } } - for (region = sa->regionbase.first; region; region = arn) { + for (region = area->regionbase.first; region; region = arn) { arn = region->next; if (region->alignment == RGN_ALIGN_QSPLIT) { - ED_region_remove(C, sa, region); + ED_region_remove(C, area, region); } } - ED_area_tag_redraw(sa); + ED_area_tag_redraw(area); WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL); } else if (region->next) { @@ -3891,20 +3891,20 @@ static int region_quadview_exec(bContext *C, wmOperator *op) } else { /* Enter quad-view */ - ScrArea *sa = CTX_wm_area(C); + ScrArea *area = CTX_wm_area(C); ARegion *newar; int count; region->alignment = RGN_ALIGN_QSPLIT; for (count = 0; count < 3; count++) { - newar = BKE_area_region_copy(sa->type, region); - BLI_addtail(&sa->regionbase, newar); + newar = BKE_area_region_copy(area->type, region); + BLI_addtail(&area->regionbase, newar); } /* lock views and set them */ - if (sa->spacetype == SPACE_VIEW3D) { - View3D *v3d = sa->spacedata.first; + if (area->spacetype == SPACE_VIEW3D) { + View3D *v3d = area->spacedata.first; int index_qsplit = 0; /* run ED_view3d_lock() so the correct 'rv3d->viewquat' is set, @@ -3919,13 +3919,13 @@ static int region_quadview_exec(bContext *C, wmOperator *op) RV3D_LOCK_ROTATION; region_quadview_init_rv3d( - sa, region, viewlock, ED_view3d_lock_view_from_index(index_qsplit++), RV3D_ORTHO); - region_quadview_init_rv3d(sa, + area, region, viewlock, ED_view3d_lock_view_from_index(index_qsplit++), RV3D_ORTHO); + region_quadview_init_rv3d(area, (region = region->next), viewlock, ED_view3d_lock_view_from_index(index_qsplit++), RV3D_ORTHO); - region_quadview_init_rv3d(sa, + region_quadview_init_rv3d(area, (region = region->next), viewlock, ED_view3d_lock_view_from_index(index_qsplit++), @@ -3933,16 +3933,16 @@ static int region_quadview_exec(bContext *C, wmOperator *op) /* forcing camera is distracting */ #if 0 if (v3d->camera) { - region_quadview_init_rv3d(sa, (region = region->next), 0, RV3D_VIEW_CAMERA, RV3D_CAMOB); + region_quadview_init_rv3d(area, (region = region->next), 0, RV3D_VIEW_CAMERA, RV3D_CAMOB); } else { - region_quadview_init_rv3d(sa, (region = region->next), 0, RV3D_VIEW_USER, RV3D_PERSP); + region_quadview_init_rv3d(area, (region = region->next), 0, RV3D_VIEW_USER, RV3D_PERSP); } #else (void)v3d; #endif } - ED_area_tag_redraw(sa); + ED_area_tag_redraw(area); WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL); } @@ -4091,11 +4091,11 @@ static void SCREEN_OT_region_flip(wmOperatorType *ot) /* show/hide header text menus */ static int header_toggle_menus_exec(bContext *C, wmOperator *UNUSED(op)) { - ScrArea *sa = CTX_wm_area(C); + ScrArea *area = CTX_wm_area(C); - sa->flag = sa->flag ^ HEADER_NO_PULLDOWN; + area->flag = area->flag ^ HEADER_NO_PULLDOWN; - ED_area_tag_redraw(sa); + ED_area_tag_redraw(area); WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL); return OPERATOR_FINISHED; @@ -4122,42 +4122,42 @@ static void SCREEN_OT_header_toggle_menus(wmOperatorType *ot) static bool screen_region_context_menu_poll(bContext *C) { - ScrArea *sa = CTX_wm_area(C); - return (sa && sa->spacetype != SPACE_STATUSBAR); + ScrArea *area = CTX_wm_area(C); + return (area && area->spacetype != SPACE_STATUSBAR); } void ED_screens_header_tools_menu_create(bContext *C, uiLayout *layout, void *UNUSED(arg)) { - ScrArea *sa = CTX_wm_area(C); + ScrArea *area = CTX_wm_area(C); ARegion *region = CTX_wm_region(C); const char *but_flip_str = (RGN_ALIGN_ENUM_FROM_MASK(region->alignment) == RGN_ALIGN_TOP) ? IFACE_("Flip to Bottom") : IFACE_("Flip to Top"); { PointerRNA ptr; - RNA_pointer_create((ID *)CTX_wm_screen(C), &RNA_Space, sa->spacedata.first, &ptr); - if (!ELEM(sa->spacetype, SPACE_TOPBAR)) { + RNA_pointer_create((ID *)CTX_wm_screen(C), &RNA_Space, area->spacedata.first, &ptr); + if (!ELEM(area->spacetype, SPACE_TOPBAR)) { uiItemR(layout, &ptr, "show_region_header", 0, IFACE_("Show Header"), ICON_NONE); } - ARegion *region_header = BKE_area_find_region_type(sa, RGN_TYPE_HEADER); + ARegion *region_header = BKE_area_find_region_type(area, RGN_TYPE_HEADER); uiLayout *col = uiLayoutColumn(layout, 0); uiLayoutSetActive(col, (region_header->flag & RGN_FLAG_HIDDEN) == 0); - if (BKE_area_find_region_type(sa, RGN_TYPE_TOOL_HEADER)) { + if (BKE_area_find_region_type(area, RGN_TYPE_TOOL_HEADER)) { uiItemR(col, &ptr, "show_region_tool_header", 0, IFACE_("Show Tool Settings"), ICON_NONE); } uiItemO(col, IFACE_("Show Menus"), - (sa->flag & HEADER_NO_PULLDOWN) ? ICON_CHECKBOX_DEHLT : ICON_CHECKBOX_HLT, + (area->flag & HEADER_NO_PULLDOWN) ? ICON_CHECKBOX_DEHLT : ICON_CHECKBOX_HLT, "SCREEN_OT_header_toggle_menus"); } /* default is WM_OP_INVOKE_REGION_WIN, which we don't want here. */ uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_DEFAULT); - if (!ELEM(sa->spacetype, SPACE_TOPBAR)) { + if (!ELEM(area->spacetype, SPACE_TOPBAR)) { uiItemS(layout); uiItemO(layout, but_flip_str, ICON_NONE, "SCREEN_OT_region_flip"); @@ -4165,24 +4165,24 @@ void ED_screens_header_tools_menu_create(bContext *C, uiLayout *layout, void *UN /* File browser should be fullscreen all the time, top-bar should * never be. But other regions can be maximized/restored. */ - if (!ELEM(sa->spacetype, SPACE_FILE, SPACE_TOPBAR)) { + if (!ELEM(area->spacetype, SPACE_FILE, SPACE_TOPBAR)) { uiItemS(layout); - const char *but_str = sa->full ? IFACE_("Tile Area") : IFACE_("Maximize Area"); + const char *but_str = area->full ? IFACE_("Tile Area") : IFACE_("Maximize Area"); uiItemO(layout, but_str, ICON_NONE, "SCREEN_OT_screen_full_area"); } } void ED_screens_footer_tools_menu_create(bContext *C, uiLayout *layout, void *UNUSED(arg)) { - ScrArea *sa = CTX_wm_area(C); + ScrArea *area = CTX_wm_area(C); ARegion *region = CTX_wm_region(C); const char *but_flip_str = (RGN_ALIGN_ENUM_FROM_MASK(region->alignment) == RGN_ALIGN_TOP) ? IFACE_("Flip to Bottom") : IFACE_("Flip to Top"); { PointerRNA ptr; - RNA_pointer_create((ID *)CTX_wm_screen(C), &RNA_Space, sa->spacedata.first, &ptr); + RNA_pointer_create((ID *)CTX_wm_screen(C), &RNA_Space, area->spacedata.first, &ptr); uiItemR(layout, &ptr, "show_region_footer", 0, IFACE_("Show Footer"), ICON_NONE); } @@ -4193,10 +4193,10 @@ void ED_screens_footer_tools_menu_create(bContext *C, uiLayout *layout, void *UN /* File browser should be fullscreen all the time, top-bar should * never be. But other regions can be maximized/restored... */ - if (!ELEM(sa->spacetype, SPACE_FILE, SPACE_TOPBAR)) { + if (!ELEM(area->spacetype, SPACE_FILE, SPACE_TOPBAR)) { uiItemS(layout); - const char *but_str = sa->full ? IFACE_("Tile Area") : IFACE_("Maximize Area"); + const char *but_str = area->full ? IFACE_("Tile Area") : IFACE_("Maximize Area"); uiItemO(layout, but_str, ICON_NONE, "SCREEN_OT_screen_full_area"); } } @@ -4383,7 +4383,7 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), const wmEv ScreenAnimData *sad = wt->customdata; wmWindowManager *wm = CTX_wm_manager(C); wmWindow *window; - ScrArea *sa; + ScrArea *area; int sync; float time; @@ -4514,15 +4514,15 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), const wmEv for (window = wm->windows.first; window; window = window->next) { const bScreen *win_screen = WM_window_get_active_screen(window); - for (sa = win_screen->areabase.first; sa; sa = sa->next) { + for (area = win_screen->areabase.first; area; area = area->next) { ARegion *region; - for (region = sa->regionbase.first; region; region = region->next) { + for (region = area->regionbase.first; region; region = region->next) { bool redraw = false; if (region == sad->region) { redraw = true; } else if (match_region_with_redraws( - sa->spacetype, region->regiontype, sad->redraws, sad->from_anim_edit)) { + area->spacetype, region->regiontype, sad->redraws, sad->from_anim_edit)) { redraw = true; } @@ -4531,8 +4531,8 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), const wmEv /* do follow here if editor type supports it */ if ((sad->redraws & TIME_FOLLOW)) { if ((region->regiontype == RGN_TYPE_WINDOW && - ELEM(sa->spacetype, SPACE_SEQ, SPACE_GRAPH, SPACE_ACTION, SPACE_NLA)) || - (sa->spacetype == SPACE_CLIP && region->regiontype == RGN_TYPE_PREVIEW)) { + ELEM(area->spacetype, SPACE_SEQ, SPACE_GRAPH, SPACE_ACTION, SPACE_NLA)) || + (area->spacetype == SPACE_CLIP && region->regiontype == RGN_TYPE_PREVIEW)) { float w = BLI_rctf_size_x(®ion->v2d.cur); if (scene->r.cfra < region->v2d.cur.xmin) { region->v2d.cur.xmax = scene->r.cfra; @@ -4803,20 +4803,20 @@ static void SCREEN_OT_box_select(wmOperatorType *ot) static int fullscreen_back_exec(bContext *C, wmOperator *op) { bScreen *screen = CTX_wm_screen(C); - ScrArea *sa = NULL; + ScrArea *area = NULL; /* search current screen for 'fullscreen' areas */ - for (sa = screen->areabase.first; sa; sa = sa->next) { - if (sa->full) { + for (area = screen->areabase.first; area; area = area->next) { + if (area->full) { break; } } - if (!sa) { + if (!area) { BKE_report(op->reports, RPT_ERROR, "No fullscreen areas were found"); return OPERATOR_CANCELLED; } - ED_screen_full_prevspace(C, sa); + ED_screen_full_prevspace(C, area); return OPERATOR_FINISHED; } @@ -5069,7 +5069,7 @@ static void SCREEN_OT_delete(wmOperatorType *ot) * \{ */ typedef struct RegionAlphaInfo { - ScrArea *sa; + ScrArea *area; ARegion *region, *child_region; /* other region */ int hidden; } RegionAlphaInfo; @@ -5120,10 +5120,10 @@ static void region_blend_end(bContext *C, ARegion *region, const bool is_running else { if (rgi->hidden) { rgi->region->flag |= rgi->hidden; - ED_area_initialize(CTX_wm_manager(C), CTX_wm_window(C), rgi->sa); + ED_area_initialize(CTX_wm_manager(C), CTX_wm_window(C), rgi->area); } /* area decoration needs redraw in end */ - ED_area_tag_redraw(rgi->sa); + ED_area_tag_redraw(rgi->area); } WM_event_remove_timer(CTX_wm_manager(C), NULL, region->regiontimer); /* frees rgi */ region->regiontimer = NULL; @@ -5131,7 +5131,7 @@ static void region_blend_end(bContext *C, ARegion *region, const bool is_running /** * \note Assumes that \a region itself is not a split version from previous region. */ -void ED_region_visibility_change_update_animated(bContext *C, ScrArea *sa, ARegion *region) +void ED_region_visibility_change_update_animated(bContext *C, ScrArea *area, ARegion *region) { wmWindowManager *wm = CTX_wm_manager(C); wmWindow *win = CTX_wm_window(C); @@ -5145,13 +5145,13 @@ void ED_region_visibility_change_update_animated(bContext *C, ScrArea *sa, ARegi rgi = MEM_callocN(sizeof(RegionAlphaInfo), "RegionAlphaInfo"); rgi->hidden = region->flag & RGN_FLAG_HIDDEN; - rgi->sa = sa; + rgi->area = area; rgi->region = region; region->flag &= ~RGN_FLAG_HIDDEN; /* blend in, reinitialize regions because it got unhidden */ if (rgi->hidden == 0) { - ED_area_initialize(wm, win, sa); + ED_area_initialize(wm, win, area); } else { WM_event_remove_handlers(C, ®ion->handlers); @@ -5220,8 +5220,8 @@ static void SCREEN_OT_region_blend(wmOperatorType *ot) static bool space_type_set_or_cycle_poll(bContext *C) { - ScrArea *sa = CTX_wm_area(C); - return (sa && !ELEM(sa->spacetype, SPACE_TOPBAR, SPACE_STATUSBAR)); + ScrArea *area = CTX_wm_area(C); + return (area && !ELEM(area->spacetype, SPACE_TOPBAR, SPACE_STATUSBAR)); } static int space_type_set_or_cycle_exec(bContext *C, wmOperator *op) @@ -5229,12 +5229,12 @@ static int space_type_set_or_cycle_exec(bContext *C, wmOperator *op) const int space_type = RNA_enum_get(op->ptr, "space_type"); PointerRNA ptr; - ScrArea *sa = CTX_wm_area(C); - RNA_pointer_create((ID *)CTX_wm_screen(C), &RNA_Area, sa, &ptr); + ScrArea *area = CTX_wm_area(C); + RNA_pointer_create((ID *)CTX_wm_screen(C), &RNA_Area, area, &ptr); PropertyRNA *prop_type = RNA_struct_find_property(&ptr, "type"); PropertyRNA *prop_ui_type = RNA_struct_find_property(&ptr, "ui_type"); - if (sa->spacetype != space_type) { + if (area->spacetype != space_type) { /* Set the type. */ RNA_property_enum_set(&ptr, prop_type, space_type); RNA_property_update(C, &ptr, prop_type); @@ -5293,25 +5293,25 @@ static const EnumPropertyItem space_context_cycle_direction[] = { static bool space_context_cycle_poll(bContext *C) { - ScrArea *sa = CTX_wm_area(C); - /* sa might be NULL if called out of window bounds */ - return (sa && ELEM(sa->spacetype, SPACE_PROPERTIES, SPACE_USERPREF)); + ScrArea *area = CTX_wm_area(C); + /* area might be NULL if called out of window bounds */ + return (area && ELEM(area->spacetype, SPACE_PROPERTIES, SPACE_USERPREF)); } /** * Helper to get the correct RNA pointer/property pair for changing - * the display context of active space type in \a sa. + * the display context of active space type in \a area. */ static void context_cycle_prop_get(bScreen *screen, - const ScrArea *sa, + const ScrArea *area, PointerRNA *r_ptr, PropertyRNA **r_prop) { const char *propname; - switch (sa->spacetype) { + switch (area->spacetype) { case SPACE_PROPERTIES: - RNA_pointer_create(&screen->id, &RNA_SpaceProperties, sa->spacedata.first, r_ptr); + RNA_pointer_create(&screen->id, &RNA_SpaceProperties, area->spacedata.first, r_ptr); propname = "context"; break; case SPACE_USERPREF: diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c index 89b83b3518a..83ded5b3503 100644 --- a/source/blender/editors/screen/screendump.c +++ b/source/blender/editors/screen/screendump.c @@ -76,13 +76,13 @@ static int screenshot_data_create(bContext *C, wmOperator *op) if (dumprect) { ScreenshotData *scd = MEM_callocN(sizeof(ScreenshotData), "screenshot"); - ScrArea *sa = CTX_wm_area(C); + ScrArea *area = CTX_wm_area(C); scd->dumpsx = dumprect_size[0]; scd->dumpsy = dumprect_size[1]; scd->dumprect = dumprect; - if (sa) { - scd->crop = sa->totrct; + if (area) { + scd->crop = area->totrct; } BKE_imformat_defaults(&scd->im_format); diff --git a/source/blender/editors/screen/workspace_layout_edit.c b/source/blender/editors/screen/workspace_layout_edit.c index 276e36b97dc..1e85a6e256f 100644 --- a/source/blender/editors/screen/workspace_layout_edit.c +++ b/source/blender/editors/screen/workspace_layout_edit.c @@ -172,9 +172,9 @@ bool ED_workspace_layout_cycle(WorkSpace *workspace, const short direction, bCon WorkSpaceLayout *old_layout = BKE_workspace_active_layout_get(win->workspace_hook); WorkSpaceLayout *new_layout; const bScreen *old_screen = BKE_workspace_layout_screen_get(old_layout); - ScrArea *sa = CTX_wm_area(C); + ScrArea *area = CTX_wm_area(C); - if (old_screen->temp || (sa && sa->full && sa->full->temp)) { + if (old_screen->temp || (area && area->full && area->full->temp)) { return false; } @@ -188,9 +188,9 @@ bool ED_workspace_layout_cycle(WorkSpace *workspace, const short direction, bCon if (new_layout && (old_layout != new_layout)) { bScreen *new_screen = BKE_workspace_layout_screen_get(new_layout); - if (sa && sa->full) { + if (area && area->full) { /* return to previous state before switching screens */ - ED_screen_full_restore(C, sa); /* may free screen of old_layout */ + ED_screen_full_restore(C, area); /* may free screen of old_layout */ } ED_screen_change(C, new_screen); -- cgit v1.2.3