diff options
author | Julian Eisel <julian@blender.org> | 2020-04-03 14:25:03 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2020-04-03 14:34:50 +0300 |
commit | 905c0269f302e8e0e7a27dda8d5256fdcd06ce60 (patch) | |
tree | 1c720d4f0069879d5b4c0c9ea8db867106920d4f /source/blender/editors/interface | |
parent | 1a69384e76e2b1ab11c87a582eb2cdf26386ac59 (diff) |
Cleanup: Rename ScrArea variables from sa to area
Follow up of b2ee1770d4c3 and 10c2254d412d, part of T74432.
Now the area and region naming conventions should be less confusing.
Mostly a careful batch rename but had to do few smaller fixes.
Also ran clang-format on affected files.
Diffstat (limited to 'source/blender/editors/interface')
15 files changed, 141 insertions, 141 deletions
diff --git a/source/blender/editors/interface/interface_eyedropper.c b/source/blender/editors/interface/interface_eyedropper.c index 5fd1cef6451..817cb44db29 100644 --- a/source/blender/editors/interface/interface_eyedropper.c +++ b/source/blender/editors/interface/interface_eyedropper.c @@ -139,8 +139,8 @@ void eyedropper_draw_cursor_text(const struct bContext *C, const ARegion *region uiBut *eyedropper_get_property_button_under_mouse(bContext *C, const wmEvent *event) { bScreen *screen = CTX_wm_screen(C); - ScrArea *sa = BKE_screen_find_area_xy(screen, SPACE_TYPE_ANY, event->x, event->y); - ARegion *region = BKE_area_find_region_xy(sa, RGN_TYPE_ANY, event->x, event->y); + ScrArea *area = BKE_screen_find_area_xy(screen, SPACE_TYPE_ANY, event->x, event->y); + ARegion *region = BKE_area_find_region_xy(area, RGN_TYPE_ANY, event->x, event->y); uiBut *but = ui_but_find_mouse_over(region, event); diff --git a/source/blender/editors/interface/interface_eyedropper_color.c b/source/blender/editors/interface/interface_eyedropper_color.c index 372fd841bc1..7527a1e0662 100644 --- a/source/blender/editors/interface/interface_eyedropper_color.c +++ b/source/blender/editors/interface/interface_eyedropper_color.c @@ -137,15 +137,15 @@ void eyedropper_color_sample_fl(bContext *C, int mx, int my, float r_col[3]) /* we could use some clever */ Main *bmain = CTX_data_main(C); bScreen *screen = CTX_wm_screen(C); - ScrArea *sa = BKE_screen_find_area_xy(screen, SPACE_TYPE_ANY, mx, my); + ScrArea *area = BKE_screen_find_area_xy(screen, SPACE_TYPE_ANY, mx, my); const char *display_device = CTX_data_scene(C)->display_settings.display_device; struct ColorManagedDisplay *display = IMB_colormanagement_display_get_named(display_device); - if (sa) { - if (sa->spacetype == SPACE_IMAGE) { - ARegion *region = BKE_area_find_region_xy(sa, RGN_TYPE_WINDOW, mx, my); + if (area) { + if (area->spacetype == SPACE_IMAGE) { + ARegion *region = BKE_area_find_region_xy(area, RGN_TYPE_WINDOW, mx, my); if (region) { - SpaceImage *sima = sa->spacedata.first; + SpaceImage *sima = area->spacedata.first; int mval[2] = {mx - region->winrct.xmin, my - region->winrct.ymin}; if (ED_space_image_color_sample(sima, region, mval, r_col)) { @@ -153,10 +153,10 @@ void eyedropper_color_sample_fl(bContext *C, int mx, int my, float r_col[3]) } } } - else if (sa->spacetype == SPACE_NODE) { - ARegion *region = BKE_area_find_region_xy(sa, RGN_TYPE_WINDOW, mx, my); + else if (area->spacetype == SPACE_NODE) { + ARegion *region = BKE_area_find_region_xy(area, RGN_TYPE_WINDOW, mx, my); if (region) { - SpaceNode *snode = sa->spacedata.first; + SpaceNode *snode = area->spacedata.first; int mval[2] = {mx - region->winrct.xmin, my - region->winrct.ymin}; if (ED_space_node_color_sample(bmain, snode, region, mval, r_col)) { @@ -164,10 +164,10 @@ void eyedropper_color_sample_fl(bContext *C, int mx, int my, float r_col[3]) } } } - else if (sa->spacetype == SPACE_CLIP) { - ARegion *region = BKE_area_find_region_xy(sa, RGN_TYPE_WINDOW, mx, my); + else if (area->spacetype == SPACE_CLIP) { + ARegion *region = BKE_area_find_region_xy(area, RGN_TYPE_WINDOW, mx, my); if (region) { - SpaceClip *sc = sa->spacedata.first; + SpaceClip *sc = area->spacedata.first; int mval[2] = {mx - region->winrct.xmin, my - region->winrct.ymin}; if (ED_space_clip_color_sample(sc, region, mval, r_col)) { diff --git a/source/blender/editors/interface/interface_eyedropper_datablock.c b/source/blender/editors/interface/interface_eyedropper_datablock.c index bf118481be2..d9c77c26941 100644 --- a/source/blender/editors/interface/interface_eyedropper_datablock.c +++ b/source/blender/editors/interface/interface_eyedropper_datablock.c @@ -152,27 +152,27 @@ static void datadropper_id_sample_pt(bContext *C, DataDropper *ddr, int mx, int { /* we could use some clever */ bScreen *screen = CTX_wm_screen(C); - ScrArea *sa = BKE_screen_find_area_xy(screen, -1, mx, my); + ScrArea *area = BKE_screen_find_area_xy(screen, -1, mx, my); ScrArea *area_prev = CTX_wm_area(C); ARegion *region_prev = CTX_wm_region(C); ddr->name[0] = '\0'; - if (sa) { - if (ELEM(sa->spacetype, SPACE_VIEW3D, SPACE_OUTLINER)) { - ARegion *region = BKE_area_find_region_xy(sa, RGN_TYPE_WINDOW, mx, my); + if (area) { + if (ELEM(area->spacetype, SPACE_VIEW3D, SPACE_OUTLINER)) { + ARegion *region = BKE_area_find_region_xy(area, RGN_TYPE_WINDOW, mx, my); if (region) { const int mval[2] = {mx - region->winrct.xmin, my - region->winrct.ymin}; Base *base; - CTX_wm_area_set(C, sa); + CTX_wm_area_set(C, area); CTX_wm_region_set(C, region); /* grr, always draw else we leave stale text */ ED_region_tag_redraw(region); - if (sa->spacetype == SPACE_VIEW3D) { + if (area->spacetype == SPACE_VIEW3D) { base = ED_view3d_give_base_under_cursor(C, mval); } else { @@ -250,11 +250,11 @@ static void datadropper_set_draw_callback_region(bContext *C, const int my) { bScreen *screen = CTX_wm_screen(C); - ScrArea *sa = BKE_screen_find_area_xy(screen, -1, mx, my); + ScrArea *area = BKE_screen_find_area_xy(screen, -1, mx, my); - if (sa) { + if (area) { /* If spacetype changed */ - if (sa->spacetype != ddr->cursor_area->spacetype) { + if (area->spacetype != ddr->cursor_area->spacetype) { /* Remove old callback */ ED_region_draw_cb_exit(ddr->art, ddr->draw_handle_pixel); @@ -263,9 +263,9 @@ static void datadropper_set_draw_callback_region(bContext *C, ED_region_tag_redraw(region); /* Set draw callback in new region */ - ARegionType *art = BKE_regiontype_from_id(sa->type, RGN_TYPE_WINDOW); + ARegionType *art = BKE_regiontype_from_id(area->type, RGN_TYPE_WINDOW); - ddr->cursor_area = sa; + ddr->cursor_area = area; ddr->art = art; ddr->draw_handle_pixel = ED_region_draw_cb_activate( art, datadropper_draw_cb, ddr, REGION_DRAW_POST_PIXEL); diff --git a/source/blender/editors/interface/interface_eyedropper_depth.c b/source/blender/editors/interface/interface_eyedropper_depth.c index 26a6109e8cf..907da917e75 100644 --- a/source/blender/editors/interface/interface_eyedropper_depth.c +++ b/source/blender/editors/interface/interface_eyedropper_depth.c @@ -156,7 +156,7 @@ static void depthdropper_depth_sample_pt( { /* we could use some clever */ bScreen *screen = CTX_wm_screen(C); - ScrArea *sa = BKE_screen_find_area_xy(screen, SPACE_TYPE_ANY, mx, my); + ScrArea *area = BKE_screen_find_area_xy(screen, SPACE_TYPE_ANY, mx, my); Scene *scene = CTX_data_scene(C); ScrArea *area_prev = CTX_wm_area(C); @@ -164,19 +164,19 @@ static void depthdropper_depth_sample_pt( ddr->name[0] = '\0'; - if (sa) { - if (sa->spacetype == SPACE_VIEW3D) { - ARegion *region = BKE_area_find_region_xy(sa, RGN_TYPE_WINDOW, mx, my); + if (area) { + if (area->spacetype == SPACE_VIEW3D) { + ARegion *region = BKE_area_find_region_xy(area, RGN_TYPE_WINDOW, mx, my); if (region) { struct Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); - View3D *v3d = sa->spacedata.first; + View3D *v3d = area->spacedata.first; RegionView3D *rv3d = region->regiondata; /* weak, we could pass in some reference point */ const float *view_co = v3d->camera ? v3d->camera->obmat[3] : rv3d->viewinv[3]; const int mval[2] = {mx - region->winrct.xmin, my - region->winrct.ymin}; float co[3]; - CTX_wm_area_set(C, sa); + CTX_wm_area_set(C, area); CTX_wm_region_set(C, region); /* grr, always draw else we leave stale text */ diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 075bd8af906..084eb943665 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -2015,8 +2015,8 @@ static int ui_id_brush_get_icon(const bContext *C, ID *id) Object *ob = CTX_data_active_object(C); const EnumPropertyItem *items = NULL; ePaintMode paint_mode = PAINT_MODE_INVALID; - ScrArea *sa = CTX_wm_area(C); - char space_type = sa->spacetype; + ScrArea *area = CTX_wm_area(C); + char space_type = area->spacetype; /* Fallback to 3D view. */ if (space_type == SPACE_PROPERTIES) { space_type = SPACE_VIEW3D; @@ -2041,8 +2041,8 @@ static int ui_id_brush_get_icon(const bContext *C, ID *id) } } else if (space_type == SPACE_IMAGE) { - if (sa->spacetype == space_type) { - const SpaceImage *sima = sa->spacedata.first; + if (area->spacetype == space_type) { + const SpaceImage *sima = area->spacedata.first; if (sima->mode == SI_MODE_PAINT) { paint_mode = PAINT_MODE_TEXTURE_2D; } diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index 5a4a549ea3e..ed5d02a5a03 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -1308,9 +1308,9 @@ static int editsource_text_edit(bContext *C, else { /* naughty!, find text area to set, not good behavior * but since this is a dev tool lets allow it - campbell */ - ScrArea *sa = BKE_screen_find_big_area(CTX_wm_screen(C), SPACE_TEXT, 0); - if (sa) { - SpaceText *st = sa->spacedata.first; + ScrArea *area = BKE_screen_find_big_area(CTX_wm_screen(C), SPACE_TEXT, 0); + if (area) { + SpaceText *st = area->spacedata.first; st->text = text; } else { diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index d57b4d444bd..04d1181a8a1 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -131,18 +131,18 @@ typedef enum eSpaceButtons_Align { BUT_AUTO = 2, } eSpaceButtons_Align; -static int panel_aligned(const ScrArea *sa, const ARegion *region) +static int panel_aligned(const ScrArea *area, const ARegion *region) { - if (sa->spacetype == SPACE_PROPERTIES && region->regiontype == RGN_TYPE_WINDOW) { + if (area->spacetype == SPACE_PROPERTIES && region->regiontype == RGN_TYPE_WINDOW) { return BUT_VERTICAL; } - else if (sa->spacetype == SPACE_USERPREF && region->regiontype == RGN_TYPE_WINDOW) { + else if (area->spacetype == SPACE_USERPREF && region->regiontype == RGN_TYPE_WINDOW) { return BUT_VERTICAL; } - else if (sa->spacetype == SPACE_FILE && region->regiontype == RGN_TYPE_CHANNELS) { + else if (area->spacetype == SPACE_FILE && region->regiontype == RGN_TYPE_CHANNELS) { return BUT_VERTICAL; } - else if (sa->spacetype == SPACE_IMAGE && region->regiontype == RGN_TYPE_PREVIEW) { + else if (area->spacetype == SPACE_IMAGE && region->regiontype == RGN_TYPE_PREVIEW) { return BUT_VERTICAL; } else if (ELEM(region->regiontype, @@ -196,21 +196,21 @@ static bool panel_active_animation_changed(ListBase *lb, Panel **pa_animation, b return false; } -static bool panels_need_realign(ScrArea *sa, ARegion *region, Panel **r_pa_animate) +static bool panels_need_realign(ScrArea *area, ARegion *region, Panel **r_pa_animate) { *r_pa_animate = NULL; - if (sa->spacetype == SPACE_PROPERTIES && region->regiontype == RGN_TYPE_WINDOW) { - SpaceProperties *sbuts = sa->spacedata.first; + if (area->spacetype == SPACE_PROPERTIES && region->regiontype == RGN_TYPE_WINDOW) { + SpaceProperties *sbuts = area->spacedata.first; if (sbuts->mainbo != sbuts->mainb) { return true; } } - else if (sa->spacetype == SPACE_IMAGE && region->regiontype == RGN_TYPE_PREVIEW) { + else if (area->spacetype == SPACE_IMAGE && region->regiontype == RGN_TYPE_PREVIEW) { return true; } - else if (sa->spacetype == SPACE_FILE && region->regiontype == RGN_TYPE_CHANNELS) { + else if (area->spacetype == SPACE_FILE && region->regiontype == RGN_TYPE_CHANNELS) { return true; } @@ -234,11 +234,11 @@ static bool panels_need_realign(ScrArea *sa, ARegion *region, Panel **r_pa_anima /****************************** panels ******************************/ -static void panels_collapse_all(ScrArea *sa, ARegion *region, const Panel *from_pa) +static void panels_collapse_all(ScrArea *area, ARegion *region, const Panel *from_pa) { const bool has_category_tabs = UI_panel_category_is_visible(region); const char *category = has_category_tabs ? UI_panel_category_active_get(region, false) : NULL; - const int flag = ((panel_aligned(sa, region) == BUT_HORIZONTAL) ? PNL_CLOSEDX : PNL_CLOSEDY); + const int flag = ((panel_aligned(area, region) == BUT_HORIZONTAL) ? PNL_CLOSEDX : PNL_CLOSEDY); const PanelType *from_pt = from_pa->type; Panel *pa; @@ -274,7 +274,7 @@ Panel *UI_panel_find_by_type(ListBase *lb, PanelType *pt) /** * \note \a pa should be return value from #UI_panel_find_by_type and can be NULL. */ -Panel *UI_panel_begin(ScrArea *sa, +Panel *UI_panel_begin(ScrArea *area, ARegion *region, ListBase *lb, uiBlock *block, @@ -286,7 +286,7 @@ Panel *UI_panel_begin(ScrArea *sa, const char *drawname = CTX_IFACE_(pt->translation_context, pt->label); const char *idname = pt->idname; const bool newpanel = (pa == NULL); - int align = panel_aligned(sa, region); + int align = panel_aligned(area, region); if (!newpanel) { pa->type = pt; @@ -385,7 +385,7 @@ static float panel_region_offset_x_get(const ARegion *region, int align) } void UI_panel_end( - const ScrArea *sa, const ARegion *region, uiBlock *block, int width, int height, bool open) + const ScrArea *area, const ARegion *region, uiBlock *block, int width, int height, bool open) { Panel *pa = block->panel; @@ -425,7 +425,7 @@ void UI_panel_end( pa->ofsy += old_sizey - pa->sizey; } - int align = panel_aligned(sa, region); + int align = panel_aligned(area, region); if (old_region_ofsx != panel_region_offset_x_get(region, align)) { pa->runtime_flag |= PNL_ANIM_ALIGN; } @@ -1021,13 +1021,13 @@ static void align_sub_panels(Panel *pa) /* this doesn't draw */ /* returns 1 when it did something */ -static bool uiAlignPanelStep(ScrArea *sa, ARegion *region, const float fac, const bool drag) +static bool uiAlignPanelStep(ScrArea *area, ARegion *region, const float fac, const bool drag) { Panel *pa; PanelSort *ps, *panelsort, *psnext; int a, tot = 0; bool done; - int align = panel_aligned(sa, region); + int align = panel_aligned(area, region); /* count active, not tabbed panels */ for (pa = region->panels.first; pa; pa = pa->next) { @@ -1135,10 +1135,10 @@ static bool uiAlignPanelStep(ScrArea *sa, ARegion *region, const float fac, cons return done; } -static void ui_panels_size(ScrArea *sa, ARegion *region, int *r_x, int *r_y) +static void ui_panels_size(ScrArea *area, ARegion *region, int *r_x, int *r_y) { Panel *pa; - int align = panel_aligned(sa, region); + int align = panel_aligned(area, region); int sizex = 0; int sizey = 0; @@ -1175,7 +1175,7 @@ static void ui_panels_size(ScrArea *sa, ARegion *region, int *r_x, int *r_y) static void ui_do_animate(const bContext *C, Panel *panel) { uiHandlePanelData *data = panel->activedata; - ScrArea *sa = CTX_wm_area(C); + ScrArea *area = CTX_wm_area(C); ARegion *region = CTX_wm_region(C); float fac; @@ -1183,7 +1183,7 @@ static void ui_do_animate(const bContext *C, Panel *panel) fac = min_ff(sqrtf(fac), 1.0f); /* for max 1 second, interpolate positions */ - if (uiAlignPanelStep(sa, region, fac, false)) { + if (uiAlignPanelStep(area, region, fac, false)) { ED_region_tag_redraw(region); } else { @@ -1220,7 +1220,7 @@ void UI_panels_begin(const bContext *UNUSED(C), ARegion *region) /* only draws blocks with panels */ void UI_panels_end(const bContext *C, ARegion *region, int *r_x, int *r_y) { - ScrArea *sa = CTX_wm_area(C); + ScrArea *area = CTX_wm_area(C); uiBlock *block; Panel *pa, *firstpa; @@ -1232,12 +1232,12 @@ void UI_panels_end(const bContext *C, ARegion *region, int *r_x, int *r_y) } /* re-align, possibly with animation */ - if (panels_need_realign(sa, region, &pa)) { + if (panels_need_realign(area, region, &pa)) { if (pa) { panel_activate_state(C, pa, PANEL_STATE_ANIMATION); } else { - uiAlignPanelStep(sa, region, 1.0, false); + uiAlignPanelStep(area, region, 1.0, false); } } @@ -1256,7 +1256,7 @@ void UI_panels_end(const bContext *C, ARegion *region, int *r_x, int *r_y) } /* compute size taken up by panel */ - ui_panels_size(sa, region, r_x, r_y); + ui_panels_size(area, region, r_x, r_y); } void UI_panels_draw(const bContext *C, ARegion *region) @@ -1347,9 +1347,9 @@ static void check_panel_overlap(ARegion *region, Panel *panel) static void ui_do_drag(const bContext *C, const wmEvent *event, Panel *panel) { uiHandlePanelData *data = panel->activedata; - ScrArea *sa = CTX_wm_area(C); + ScrArea *area = CTX_wm_area(C); ARegion *region = CTX_wm_region(C); - short align = panel_aligned(sa, region), dx = 0, dy = 0; + short align = panel_aligned(area, region), dx = 0, dy = 0; /* first clip for window, no dragging outside */ if (!BLI_rcti_isect_pt_v(®ion->winrct, &event->x)) { @@ -1381,7 +1381,7 @@ static void ui_do_drag(const bContext *C, const wmEvent *event, Panel *panel) check_panel_overlap(region, panel); if (align) { - uiAlignPanelStep(sa, region, 0.2, true); + uiAlignPanelStep(area, region, 0.2, true); } } @@ -1441,7 +1441,7 @@ static void ui_panel_drag_collapse(bContext *C, uiPanelDragCollapseHandle *dragcol_data, const int xy_dst[2]) { - ScrArea *sa = CTX_wm_area(C); + ScrArea *area = CTX_wm_area(C); ARegion *region = CTX_wm_region(C); uiBlock *block; Panel *pa; @@ -1451,7 +1451,7 @@ static void ui_panel_drag_collapse(bContext *C, float xy_b_block[2] = {UNPACK2(xy_dst)}; rctf rect = block->rect; int oldflag; - const bool is_horizontal = (panel_aligned(sa, region) == BUT_HORIZONTAL); + const bool is_horizontal = (panel_aligned(area, region) == BUT_HORIZONTAL); if ((pa = block->panel) == 0 || (pa->type && (pa->type->flag & PNL_NO_HEADER))) { continue; @@ -1553,7 +1553,7 @@ static void ui_panel_drag_collapse_handler_add(const bContext *C, const bool was static void ui_handle_panel_header( const bContext *C, uiBlock *block, int mx, int my, int event, short ctrl, short shift) { - ScrArea *sa = CTX_wm_area(C); + ScrArea *area = CTX_wm_area(C); ARegion *region = CTX_wm_region(C); #ifdef USE_PIN_HIDDEN const bool show_pin = UI_panel_category_is_visible(region) && @@ -1565,7 +1565,7 @@ static void ui_handle_panel_header( const bool is_subpanel = (block->panel->type && block->panel->type->parent); const bool show_drag = !is_subpanel; - int align = panel_aligned(sa, region), button = 0; + int align = panel_aligned(area, region), button = 0; rctf rect_drag, rect_pin; float rect_leftmost; @@ -1620,7 +1620,7 @@ static void ui_handle_panel_header( } else { /* collapse */ if (ctrl) { - panels_collapse_all(sa, region, block->panel); + panels_collapse_all(area, region, block->panel); /* reset the view - we don't want to display a view without content */ UI_view2d_offset(®ion->v2d, 0.0f, 1.0f); @@ -2400,7 +2400,7 @@ int ui_handler_panel_region(bContext *C, /*XXX 2.50*/ #if 0 if (block->handler) { - rem_blockhandler(sa, block->handler); + rem_blockhandler(area, block->handler); ED_region_tag_redraw(region); retval = WM_UI_HANDLER_BREAK; } @@ -2421,10 +2421,10 @@ int ui_handler_panel_region(bContext *C, } if (zoom) { - ScrArea *sa = CTX_wm_area(C); - SpaceLink *sl = sa->spacedata.first; + ScrArea *area = CTX_wm_area(C); + SpaceLink *sl = area->spacedata.first; - if (sa->spacetype != SPACE_PROPERTIES) { + if (area->spacetype != SPACE_PROPERTIES) { if (!(pa->control & UI_PNL_SCALE)) { if (event->type == PADPLUSKEY) { sl->blockscale += 0.1; @@ -2458,9 +2458,9 @@ static int ui_handler_panel(bContext *C, const wmEvent *event, void *userdata) /* verify if we can stop */ if (event->type == LEFTMOUSE && event->val == KM_RELEASE) { - ScrArea *sa = CTX_wm_area(C); + ScrArea *area = CTX_wm_area(C); ARegion *region = CTX_wm_region(C); - int align = panel_aligned(sa, region); + int align = panel_aligned(area, region); if (align) { panel_activate_state(C, panel, PANEL_STATE_ANIMATION); diff --git a/source/blender/editors/interface/interface_region_hud.c b/source/blender/editors/interface/interface_region_hud.c index e0fc7a3ee71..a7508894c54 100644 --- a/source/blender/editors/interface/interface_region_hud.c +++ b/source/blender/editors/interface/interface_region_hud.c @@ -74,8 +74,8 @@ static bool last_redo_poll(const bContext *C, short region_type) * operator call. Otherwise we would be polling the operator with the * wrong context. */ - ScrArea *sa = CTX_wm_area(C); - ARegion *region_op = (region_type != -1) ? BKE_area_find_region_type(sa, region_type) : NULL; + ScrArea *area = CTX_wm_area(C); + ARegion *region_op = (region_type != -1) ? BKE_area_find_region_type(area, region_type) : NULL; ARegion *region_prev = CTX_wm_region(C); CTX_wm_region_set((bContext *)C, region_op); @@ -103,8 +103,8 @@ static void hud_region_hide(ARegion *region) static bool hud_panel_operator_redo_poll(const bContext *C, PanelType *UNUSED(pt)) { - ScrArea *sa = CTX_wm_area(C); - ARegion *region = BKE_area_find_region_type(sa, RGN_TYPE_HUD); + ScrArea *area = CTX_wm_area(C); + ARegion *region = BKE_area_find_region_type(area, RGN_TYPE_HUD); if (region != NULL) { struct HudRegionData *hrd = region->regiondata; if (hrd != NULL) { @@ -250,15 +250,15 @@ ARegionType *ED_area_type_hud(int space_type) return art; } -static ARegion *hud_region_add(ScrArea *sa) +static ARegion *hud_region_add(ScrArea *area) { ARegion *region = MEM_callocN(sizeof(ARegion), "area region"); - ARegion *region_win = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW); + ARegion *region_win = BKE_area_find_region_type(area, RGN_TYPE_WINDOW); if (region_win) { - BLI_insertlinkbefore(&sa->regionbase, region_win, region); + BLI_insertlinkbefore(&area->regionbase, region_win, region); } else { - BLI_addtail(&sa->regionbase, region); + BLI_addtail(&area->regionbase, region); } region->regiontype = RGN_TYPE_HUD; region->alignment = RGN_ALIGN_FLOAT; @@ -276,18 +276,18 @@ static ARegion *hud_region_add(ScrArea *sa) return region; } -void ED_area_type_hud_clear(wmWindowManager *wm, ScrArea *sa_keep) +void ED_area_type_hud_clear(wmWindowManager *wm, ScrArea *area_keep) { for (wmWindow *win = wm->windows.first; win; win = win->next) { bScreen *screen = WM_window_get_active_screen(win); - for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) { - if (sa != sa_keep) { - for (ARegion *region = sa->regionbase.first; region; region = region->next) { + for (ScrArea *area = screen->areabase.first; area; area = area->next) { + if (area != area_keep) { + for (ARegion *region = area->regionbase.first; region; region = region->next) { if (region->regiontype == RGN_TYPE_HUD) { if ((region->flag & RGN_FLAG_HIDDEN) == 0) { hud_region_hide(region); ED_region_tag_redraw(region); - ED_area_tag_redraw(sa); + ED_area_tag_redraw(area); } } } @@ -296,17 +296,17 @@ void ED_area_type_hud_clear(wmWindowManager *wm, ScrArea *sa_keep) } } -void ED_area_type_hud_ensure(bContext *C, ScrArea *sa) +void ED_area_type_hud_ensure(bContext *C, ScrArea *area) { wmWindowManager *wm = CTX_wm_manager(C); - ED_area_type_hud_clear(wm, sa); + ED_area_type_hud_clear(wm, area); - ARegionType *art = BKE_regiontype_from_id(sa->type, RGN_TYPE_HUD); + ARegionType *art = BKE_regiontype_from_id(area->type, RGN_TYPE_HUD); if (art == NULL) { return; } - ARegion *region = BKE_area_find_region_type(sa, RGN_TYPE_HUD); + ARegion *region = BKE_area_find_region_type(area, RGN_TYPE_HUD); if (region && (region->flag & RGN_FLAG_HIDDEN_BY_USER)) { /* The region is intentionally hidden by the user, don't show it. */ @@ -328,18 +328,18 @@ void ED_area_type_hud_ensure(bContext *C, ScrArea *sa) if (region == NULL) { init = true; - region = hud_region_add(sa); + region = hud_region_add(area); region->type = art; } /* Let 'ED_area_update_region_sizes' do the work of placing the region. * Otherwise we could set the 'region->winrct' & 'region->winx/winy' here. */ if (init) { - sa->flag |= AREA_FLAG_REGION_SIZE_UPDATE; + area->flag |= AREA_FLAG_REGION_SIZE_UPDATE; } else { if (region->flag & RGN_FLAG_HIDDEN) { - sa->flag |= AREA_FLAG_REGION_SIZE_UPDATE; + area->flag |= AREA_FLAG_REGION_SIZE_UPDATE; } region->flag &= ~RGN_FLAG_HIDDEN; } @@ -361,7 +361,7 @@ void ED_area_type_hud_ensure(bContext *C, ScrArea *sa) if (init) { /* This is needed or 'winrct' will be invalid. */ wmWindow *win = CTX_wm_window(C); - ED_area_update_region_sizes(wm, win, sa); + ED_area_update_region_sizes(wm, win, area); } ED_region_floating_initialize(region); diff --git a/source/blender/editors/interface/interface_region_menu_popup.c b/source/blender/editors/interface/interface_region_menu_popup.c index b3c10e8d6b8..dbec8e6d653 100644 --- a/source/blender/editors/interface/interface_region_menu_popup.c +++ b/source/blender/editors/interface/interface_region_menu_popup.c @@ -276,17 +276,17 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi else { /* for a header menu we set the direction automatic */ if (!pup->slideout && flip) { - ScrArea *sa = CTX_wm_area(C); + ScrArea *area = CTX_wm_area(C); ARegion *region = CTX_wm_region(C); - if (sa && region) { + if (area && region) { if (ELEM(region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) { - if (RGN_ALIGN_ENUM_FROM_MASK(ED_area_header_alignment(sa)) == RGN_ALIGN_BOTTOM) { + if (RGN_ALIGN_ENUM_FROM_MASK(ED_area_header_alignment(area)) == RGN_ALIGN_BOTTOM) { UI_block_direction_set(block, UI_DIR_UP); UI_block_order_flip(block); } } if (region->regiontype == RGN_TYPE_FOOTER) { - if (RGN_ALIGN_ENUM_FROM_MASK(ED_area_footer_alignment(sa)) == RGN_ALIGN_BOTTOM) { + if (RGN_ALIGN_ENUM_FROM_MASK(ED_area_footer_alignment(area)) == RGN_ALIGN_BOTTOM) { UI_block_direction_set(block, UI_DIR_UP); UI_block_order_flip(block); } diff --git a/source/blender/editors/interface/interface_region_popover.c b/source/blender/editors/interface/interface_region_popover.c index b889f1d6d01..0ad7e570e80 100644 --- a/source/blender/editors/interface/interface_region_popover.c +++ b/source/blender/editors/interface/interface_region_popover.c @@ -171,7 +171,7 @@ static uiBlock *ui_block_func_POPOVER(bContext *C, uiPopupBlockHandle *handle, v } if (!slideout) { - ScrArea *sa = CTX_wm_area(C); + ScrArea *area = CTX_wm_area(C); ARegion *region = CTX_wm_region(C); if (region && region->panels.first) { @@ -180,14 +180,14 @@ static uiBlock *ui_block_func_POPOVER(bContext *C, uiPopupBlockHandle *handle, v UI_block_direction_set(block, UI_DIR_UP | UI_DIR_CENTER_X); } /* Prefer popover from header to be positioned into the editor. */ - else if (sa && region) { + else if (area && region) { if (ELEM(region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) { - if (RGN_ALIGN_ENUM_FROM_MASK(ED_area_header_alignment(sa)) == RGN_ALIGN_BOTTOM) { + if (RGN_ALIGN_ENUM_FROM_MASK(ED_area_header_alignment(area)) == RGN_ALIGN_BOTTOM) { UI_block_direction_set(block, UI_DIR_UP | UI_DIR_CENTER_X); } } if (region->regiontype == RGN_TYPE_FOOTER) { - if (RGN_ALIGN_ENUM_FROM_MASK(ED_area_footer_alignment(sa)) == RGN_ALIGN_BOTTOM) { + if (RGN_ALIGN_ENUM_FROM_MASK(ED_area_footer_alignment(area)) == RGN_ALIGN_BOTTOM) { UI_block_direction_set(block, UI_DIR_UP | UI_DIR_CENTER_X); } } diff --git a/source/blender/editors/interface/interface_region_popup.c b/source/blender/editors/interface/interface_region_popup.c index 7e32a91d08d..e6381fd08e6 100644 --- a/source/blender/editors/interface/interface_region_popup.c +++ b/source/blender/editors/interface/interface_region_popup.c @@ -420,7 +420,7 @@ static void ui_block_region_draw(const bContext *C, ARegion *region) * Use to refresh centered popups on screen resizing (for splash). */ static void ui_block_region_popup_window_listener(wmWindow *UNUSED(win), - ScrArea *UNUSED(sa), + ScrArea *UNUSED(area), ARegion *region, wmNotifier *wmn, const Scene *UNUSED(scene)) @@ -525,7 +525,7 @@ void ui_popup_block_scrolltest(uiBlock *block) static void ui_popup_block_remove(bContext *C, uiPopupBlockHandle *handle) { wmWindow *ctx_win = CTX_wm_window(C); - ScrArea *ctx_sa = CTX_wm_area(C); + ScrArea *ctx_area = CTX_wm_area(C); ARegion *ctx_region = CTX_wm_region(C); wmWindowManager *wm = CTX_wm_manager(C); @@ -550,7 +550,7 @@ static void ui_popup_block_remove(bContext *C, uiPopupBlockHandle *handle) /* Reset context (area and region were NULL'ed when chaning context window). */ CTX_wm_window_set(C, ctx_win); - CTX_wm_area_set(C, ctx_sa); + CTX_wm_area_set(C, ctx_area); CTX_wm_region_set(C, ctx_region); /* reset to region cursor (only if there's not another menu open) */ diff --git a/source/blender/editors/interface/interface_region_tooltip.c b/source/blender/editors/interface/interface_region_tooltip.c index cf8ff51eccf..61676ba43d6 100644 --- a/source/blender/editors/interface/interface_region_tooltip.c +++ b/source/blender/editors/interface/interface_region_tooltip.c @@ -393,15 +393,15 @@ static uiTooltipData *ui_tooltip_data_from_tool(bContext *C, uiBut *but, bool is bool has_valid_context = true; const char *has_valid_context_error = IFACE_("Unsupported context"); { - ScrArea *sa = CTX_wm_area(C); - if (sa == NULL) { + ScrArea *area = CTX_wm_area(C); + if (area == NULL) { has_valid_context = false; } else { PropertyRNA *prop = RNA_struct_find_property(but->opptr, "space_type"); if (RNA_property_is_set(but->opptr, prop)) { const int space_type_prop = RNA_property_enum_get(but->opptr, prop); - if (space_type_prop != sa->spacetype) { + if (space_type_prop != area->spacetype) { has_valid_context = false; } } diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index c750187d7a3..6bd956c87b0 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -6819,7 +6819,7 @@ static bool menu_items_from_ui_create_item_from_button(struct MenuSearch_Data *d */ static void menu_types_add_from_keymap_items(bContext *C, wmWindow *win, - ScrArea *sa, + ScrArea *area, ARegion *region, LinkNode **menuid_stack_p, GHash *menu_to_kmi, @@ -6828,7 +6828,7 @@ static void menu_types_add_from_keymap_items(bContext *C, wmWindowManager *wm = CTX_wm_manager(C); ListBase *handlers[] = { region ? ®ion->handlers : NULL, - sa ? &sa->handlers : NULL, + area ? &area->handlers : NULL, &win->handlers, }; @@ -6883,7 +6883,7 @@ static void menu_types_add_from_keymap_items(bContext *C, */ static struct MenuSearch_Data *menu_items_from_ui_create(bContext *C, wmWindow *win, - ScrArea *sa, + ScrArea *area, ARegion *region) { MemArena *memarena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, __func__); @@ -6941,8 +6941,8 @@ static struct MenuSearch_Data *menu_items_from_ui_create(bContext *C, case space_type: \ break - if (sa != NULL) { - switch (sa->spacetype) { + if (area != NULL) { + switch (area->spacetype) { SPACE_MENU_MAP(SPACE_VIEW3D, "VIEW3D_MT_editor_menus"); SPACE_MENU_MAP(SPACE_GRAPH, "GRAPH_MT_editor_menus"); SPACE_MENU_MAP(SPACE_OUTLINER, "OUTLINER_MT_editor_menus"); @@ -6958,13 +6958,13 @@ static struct MenuSearch_Data *menu_items_from_ui_create(bContext *C, SPACE_MENU_MAP(SPACE_CONSOLE, "CONSOLE_MT_editor_menus"); SPACE_MENU_MAP(SPACE_USERPREF, "USERPREF_MT_editor_menus"); SPACE_MENU_MAP(SPACE_CLIP, - (((const SpaceClip *)sa->spacedata.first)->mode == SC_MODE_TRACKING) ? + (((const SpaceClip *)area->spacedata.first)->mode == SC_MODE_TRACKING) ? "CLIP_MT_tracking_editor_menus" : "CLIP_MT_masking_editor_menus"); SPACE_MENU_NOP(SPACE_TOPBAR); SPACE_MENU_NOP(SPACE_STATUSBAR); default: - printf("Unknown space type '%d'\n", sa->spacetype); + printf("Unknown space type '%d'\n", area->spacetype); } } for (int i = 0; i < idname_array_len; i++) { @@ -7110,7 +7110,8 @@ static struct MenuSearch_Data *menu_items_from_ui_create(bContext *C, * so all menus are accessed from the header & top-bar before key shortcuts are expanded. */ if ((menu_stack == NULL) && (has_keymap_menu_items == false)) { has_keymap_menu_items = true; - menu_types_add_from_keymap_items(C, win, sa, region, &menu_stack, menu_to_kmi, menu_tagged); + menu_types_add_from_keymap_items( + C, win, area, region, &menu_stack, menu_to_kmi, menu_tagged); } } @@ -7299,9 +7300,9 @@ void UI_but_func_menu_search(uiBut *but) { bContext *C = but->block->evil_C; wmWindow *win = CTX_wm_window(C); - ScrArea *sa = CTX_wm_area(C); + ScrArea *area = CTX_wm_area(C); ARegion *region = CTX_wm_region(C); - struct MenuSearch_Data *data = menu_items_from_ui_create(C, win, sa, region); + struct MenuSearch_Data *data = menu_items_from_ui_create(C, win, area, region); UI_but_func_search_set(but, ui_searchbox_create_menu, menu_search_cb, @@ -7586,7 +7587,7 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C) { Main *bmain = CTX_data_main(C); wmWindowManager *wm = CTX_wm_manager(C); - ScrArea *sa = CTX_wm_area(C); + ScrArea *area = CTX_wm_area(C); uiBlock *block; void *owner = NULL; int handle_event, icon = 0; @@ -7660,7 +7661,7 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C) * progress bar which is not being updated (bake jobs only need * to update NC_IMAGE context. */ - if (sa->spacetype != SPACE_NODE) { + if (area->spacetype != SPACE_NODE) { handle_event = B_STOPOTHER; icon = ICON_IMAGE; break; diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index adf0d6e372c..6fcce3a18e1 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -865,7 +865,6 @@ void UI_view2d_curRect_validate(View2D *v2d) * to make sure 'related' views stay in synchrony */ void UI_view2d_sync(bScreen *screen, ScrArea *area, View2D *v2dcur, int flag) { - ScrArea *sa; ARegion *region; /* don't continue if no view syncing to be done */ @@ -900,8 +899,8 @@ void UI_view2d_sync(bScreen *screen, ScrArea *area, View2D *v2dcur, int flag) /* check if doing whole screen syncing (i.e. time/horizontal) */ if ((v2dcur->flag & V2D_VIEWSYNC_SCREEN_TIME) && (screen)) { - for (sa = screen->areabase.first; sa; sa = sa->next) { - for (region = sa->regionbase.first; region; region = region->next) { + for (ScrArea *area_iter = screen->areabase.first; area_iter; area_iter = area_iter->next) { + for (region = area_iter->regionbase.first; region; region = region->next) { /* don't operate on self */ if (v2dcur != ®ion->v2d) { /* only if view has horizontal locks enabled */ @@ -1915,17 +1914,17 @@ View2D *UI_view2d_fromcontext(const bContext *C) /* same as above, but it returns regionwindow. Utility for pulldowns or buttons */ View2D *UI_view2d_fromcontext_rwin(const bContext *C) { - ScrArea *sa = CTX_wm_area(C); + ScrArea *area = CTX_wm_area(C); ARegion *region = CTX_wm_region(C); - if (sa == NULL) { + if (area == NULL) { return NULL; } if (region == NULL) { return NULL; } if (region->regiontype != RGN_TYPE_WINDOW) { - ARegion *region_win = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW); + ARegion *region_win = BKE_area_find_region_type(area, RGN_TYPE_WINDOW); return region_win ? &(region_win->v2d) : NULL; } return &(region->v2d); diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index 2adf441514b..18e14798767 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -81,7 +81,7 @@ typedef struct v2dViewPanData { /** screen where view pan was initiated */ bScreen *sc; /** area where view pan was initiated */ - ScrArea *sa; + ScrArea *area; /** region where view pan was initiated */ ARegion *region; /** view2d we're operating in */ @@ -127,7 +127,7 @@ static int view_pan_init(bContext *C, wmOperator *op) /* set pointers to owners */ vpd->sc = CTX_wm_screen(C); - vpd->sa = CTX_wm_area(C); + vpd->area = CTX_wm_area(C); vpd->v2d = v2d; vpd->region = region; @@ -190,7 +190,7 @@ static void view_pan_apply_ex(bContext *C, v2dViewPanData *vpd, float dx, float /* request updates to be done... */ WM_event_add_mousemove(CTX_wm_window(C)); - UI_view2d_sync(vpd->sc, vpd->sa, v2d, V2D_LOCK_COPY); + UI_view2d_sync(vpd->sc, vpd->area, v2d, V2D_LOCK_COPY); } static void view_pan_apply(bContext *C, wmOperator *op) @@ -589,13 +589,13 @@ typedef struct v2dViewZoomData { */ static void view_zoom_axis_lock_defaults(bContext *C, bool r_do_zoom_xy[2]) { - ScrArea *sa = CTX_wm_area(C); + ScrArea *area = CTX_wm_area(C); r_do_zoom_xy[0] = true; r_do_zoom_xy[1] = true; /* default not to zoom the sequencer vertically */ - if (sa && sa->spacetype == SPACE_SEQ) { + if (area && area->spacetype == SPACE_SEQ) { ARegion *region = CTX_wm_region(C); if (region && region->regiontype == RGN_TYPE_WINDOW) { @@ -758,8 +758,8 @@ static void view_zoomstep_apply_ex( UI_view2d_curRect_validate(v2d); if (ED_region_snap_size_apply(region, snap_test)) { - ScrArea *sa = CTX_wm_area(C); - ED_area_tag_redraw(sa); + ScrArea *area = CTX_wm_area(C); + ED_area_tag_redraw(area); WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL); } @@ -1017,8 +1017,8 @@ static void view_zoomdrag_apply(bContext *C, wmOperator *op) UI_view2d_curRect_validate(v2d); if (ED_region_snap_size_apply(vzd->region, snap_test)) { - ScrArea *sa = CTX_wm_area(C); - ED_area_tag_redraw(sa); + ScrArea *area = CTX_wm_area(C); + ED_area_tag_redraw(area); WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL); } @@ -2211,8 +2211,8 @@ static int reset_exec(bContext *C, wmOperator *UNUSED(op)) UI_view2d_curRect_validate(v2d); if (ED_region_snap_size_apply(region, snap_test)) { - ScrArea *sa = CTX_wm_area(C); - ED_area_tag_redraw(sa); + ScrArea *area = CTX_wm_area(C); + ED_area_tag_redraw(area); WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL); } |