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. --- .../blender/windowmanager/intern/wm_toolsystem.c | 100 ++++++++++----------- 1 file changed, 50 insertions(+), 50 deletions(-) (limited to 'source/blender/windowmanager/intern/wm_toolsystem.c') diff --git a/source/blender/windowmanager/intern/wm_toolsystem.c b/source/blender/windowmanager/intern/wm_toolsystem.c index 1abef2ec173..f1928819c26 100644 --- a/source/blender/windowmanager/intern/wm_toolsystem.c +++ b/source/blender/windowmanager/intern/wm_toolsystem.c @@ -72,18 +72,18 @@ struct bToolRef *WM_toolsystem_ref_from_context(struct bContext *C) { WorkSpace *workspace = CTX_wm_workspace(C); ViewLayer *view_layer = CTX_data_view_layer(C); - ScrArea *sa = CTX_wm_area(C); - if ((sa == NULL) || ((1 << sa->spacetype) & WM_TOOLSYSTEM_SPACE_MASK) == 0) { + ScrArea *area = CTX_wm_area(C); + if ((area == NULL) || ((1 << area->spacetype) & WM_TOOLSYSTEM_SPACE_MASK) == 0) { return NULL; } const bToolKey tkey = { - .space_type = sa->spacetype, - .mode = WM_toolsystem_mode_from_spacetype(view_layer, sa, sa->spacetype), + .space_type = area->spacetype, + .mode = WM_toolsystem_mode_from_spacetype(view_layer, area, area->spacetype), }; bToolRef *tref = WM_toolsystem_ref_find(workspace, &tkey); - /* We could return 'sa->runtime.tool' in this case. */ - if (sa->runtime.is_tool_set) { - BLI_assert(tref == sa->runtime.tool); + /* We could return 'area->runtime.tool' in this case. */ + if (area->runtime.is_tool_set) { + BLI_assert(tref == area->runtime.tool); } return tref; } @@ -279,15 +279,15 @@ void WM_toolsystem_reinit_all(struct bContext *C, wmWindow *win) { bScreen *screen = WM_window_get_active_screen(win); ViewLayer *view_layer = WM_window_get_active_view_layer(win); - for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) { - if (((1 << sa->spacetype) & WM_TOOLSYSTEM_SPACE_MASK) == 0) { + for (ScrArea *area = screen->areabase.first; area; area = area->next) { + if (((1 << area->spacetype) & WM_TOOLSYSTEM_SPACE_MASK) == 0) { continue; } WorkSpace *workspace = WM_window_get_active_workspace(win); const bToolKey tkey = { - .space_type = sa->spacetype, - .mode = WM_toolsystem_mode_from_spacetype(view_layer, sa, sa->spacetype), + .space_type = area->spacetype, + .mode = WM_toolsystem_mode_from_spacetype(view_layer, area, area->spacetype), }; bToolRef *tref = WM_toolsystem_ref_find(workspace, &tkey); if (tref) { @@ -450,12 +450,12 @@ static bool toolsystem_key_ensure_check(const bToolKey *tkey) return false; } -int WM_toolsystem_mode_from_spacetype(ViewLayer *view_layer, ScrArea *sa, int spacetype) +int WM_toolsystem_mode_from_spacetype(ViewLayer *view_layer, ScrArea *area, int spacetype) { int mode = -1; switch (spacetype) { case SPACE_VIEW3D: { - /* 'sa' may be NULL in this case. */ + /* 'area' may be NULL in this case. */ Object *obact = OBACT(view_layer); if (obact != NULL) { Object *obedit = OBEDIT_FROM_OBACT(obact); @@ -467,7 +467,7 @@ int WM_toolsystem_mode_from_spacetype(ViewLayer *view_layer, ScrArea *sa, int sp break; } case SPACE_IMAGE: { - SpaceImage *sima = sa->spacedata.first; + SpaceImage *sima = area->spacedata.first; mode = sima->mode; break; } @@ -476,7 +476,7 @@ int WM_toolsystem_mode_from_spacetype(ViewLayer *view_layer, ScrArea *sa, int sp break; } case SPACE_SEQ: { - SpaceSeq *sseq = sa->spacedata.first; + SpaceSeq *sseq = area->spacedata.first; mode = sseq->view; break; } @@ -484,14 +484,14 @@ int WM_toolsystem_mode_from_spacetype(ViewLayer *view_layer, ScrArea *sa, int sp return mode; } -bool WM_toolsystem_key_from_context(ViewLayer *view_layer, ScrArea *sa, bToolKey *tkey) +bool WM_toolsystem_key_from_context(ViewLayer *view_layer, ScrArea *area, bToolKey *tkey) { int space_type = SPACE_EMPTY; int mode = -1; - if (sa != NULL) { - space_type = sa->spacetype; - mode = WM_toolsystem_mode_from_spacetype(view_layer, sa, space_type); + if (area != NULL) { + space_type = area->spacetype; + mode = WM_toolsystem_mode_from_spacetype(view_layer, area, space_type); } if (mode != -1) { @@ -520,18 +520,18 @@ void WM_toolsystem_refresh_active(bContext *C) ViewLayer *view_layer = WM_window_get_active_view_layer(win); /* Could skip loop for modes that don't depend on space type. */ int space_type_mask_handled = 0; - for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) { + for (ScrArea *area = screen->areabase.first; area; area = area->next) { /* Don't change the space type of the active tool, only update it's mode. */ - const int space_type_mask = (1 << sa->spacetype); + const int space_type_mask = (1 << area->spacetype); if ((space_type_mask & WM_TOOLSYSTEM_SPACE_MASK) && ((space_type_mask_handled & space_type_mask) == 0)) { space_type_mask_handled |= space_type_mask; const bToolKey tkey = { - .space_type = sa->spacetype, - .mode = WM_toolsystem_mode_from_spacetype(view_layer, sa, sa->spacetype), + .space_type = area->spacetype, + .mode = WM_toolsystem_mode_from_spacetype(view_layer, area, area->spacetype), }; bToolRef *tref = WM_toolsystem_ref_find(workspace, &tkey); - if (tref != sa->runtime.tool) { + if (tref != area->runtime.tool) { toolsystem_reinit_ensure_toolref(C, workspace, &tkey, NULL); } } @@ -554,15 +554,15 @@ void WM_toolsystem_refresh_active(bContext *C) } } -void WM_toolsystem_refresh_screen_area(WorkSpace *workspace, ViewLayer *view_layer, ScrArea *sa) +void WM_toolsystem_refresh_screen_area(WorkSpace *workspace, ViewLayer *view_layer, ScrArea *area) { - sa->runtime.tool = NULL; - sa->runtime.is_tool_set = true; - const int mode = WM_toolsystem_mode_from_spacetype(view_layer, sa, sa->spacetype); + area->runtime.tool = NULL; + area->runtime.is_tool_set = true; + const int mode = WM_toolsystem_mode_from_spacetype(view_layer, area, area->spacetype); for (bToolRef *tref = workspace->tools.first; tref; tref = tref->next) { - if (tref->space_type == sa->spacetype) { + if (tref->space_type == area->spacetype) { if (tref->mode == mode) { - sa->runtime.tool = tref; + area->runtime.tool = tref; break; } } @@ -581,11 +581,11 @@ void WM_toolsystem_refresh_screen_all(Main *bmain) } bScreen *screen = WM_window_get_active_screen(win); ViewLayer *view_layer = WM_window_get_active_view_layer(win); - for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) { - sa->runtime.tool = NULL; - sa->runtime.is_tool_set = true; - if (space_type_has_tools[sa->spacetype]) { - WM_toolsystem_refresh_screen_area(workspace, view_layer, sa); + for (ScrArea *area = screen->areabase.first; area; area = area->next) { + area->runtime.tool = NULL; + area->runtime.is_tool_set = true; + if (space_type_has_tools[area->spacetype]) { + WM_toolsystem_refresh_screen_area(workspace, view_layer, area); } } } @@ -602,12 +602,12 @@ static void toolsystem_refresh_screen_from_active_tool(Main *bmain, if (workspace == WM_window_get_active_workspace(win)) { bScreen *screen = WM_window_get_active_screen(win); ViewLayer *view_layer = WM_window_get_active_view_layer(win); - for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) { - if (sa->spacetype == tref->space_type) { - int mode = WM_toolsystem_mode_from_spacetype(view_layer, sa, sa->spacetype); + for (ScrArea *area = screen->areabase.first; area; area = area->next) { + if (area->spacetype == tref->space_type) { + int mode = WM_toolsystem_mode_from_spacetype(view_layer, area, area->spacetype); if (mode == tref->mode) { - sa->runtime.tool = tref; - sa->runtime.is_tool_set = true; + area->runtime.tool = tref; + area->runtime.is_tool_set = true; } } } @@ -649,9 +649,9 @@ bToolRef *WM_toolsystem_ref_set_by_id_ex( bToolRef *WM_toolsystem_ref_set_by_id(bContext *C, const char *name) { ViewLayer *view_layer = CTX_data_view_layer(C); - ScrArea *sa = CTX_wm_area(C); + ScrArea *area = CTX_wm_area(C); bToolKey tkey; - if (WM_toolsystem_key_from_context(view_layer, sa, &tkey)) { + if (WM_toolsystem_key_from_context(view_layer, area, &tkey)) { WorkSpace *workspace = CTX_wm_workspace(C); return WM_toolsystem_ref_set_by_id_ex(C, workspace, &tkey, name, false); } @@ -782,11 +782,11 @@ void WM_toolsystem_update_from_context_view3d(bContext *C) void WM_toolsystem_update_from_context(bContext *C, WorkSpace *workspace, ViewLayer *view_layer, - ScrArea *sa) + ScrArea *area) { const bToolKey tkey = { - .space_type = sa->spacetype, - .mode = WM_toolsystem_mode_from_spacetype(view_layer, sa, sa->spacetype), + .space_type = area->spacetype, + .mode = WM_toolsystem_mode_from_spacetype(view_layer, area, area->spacetype), }; if (toolsystem_key_ensure_check(&tkey)) { toolsystem_reinit_ensure_toolref(C, workspace, &tkey, NULL); @@ -807,13 +807,13 @@ void WM_toolsystem_do_msg_notify_tag_refresh(bContext *C, wmMsgSubscribeKey *UNUSED(msg_key), wmMsgSubscribeValue *msg_val) { - ScrArea *sa = msg_val->user_data; + ScrArea *area = msg_val->user_data; Main *bmain = CTX_data_main(C); wmWindow *win = ((wmWindowManager *)bmain->wm.first)->windows.first; if (win->next != NULL) { do { bScreen *screen = WM_window_get_active_screen(win); - if (BLI_findindex(&screen->areabase, sa) != -1) { + if (BLI_findindex(&screen->areabase, area) != -1) { break; } } while ((win = win->next)); @@ -823,11 +823,11 @@ void WM_toolsystem_do_msg_notify_tag_refresh(bContext *C, ViewLayer *view_layer = WM_window_get_active_view_layer(win); const bToolKey tkey = { - .space_type = sa->spacetype, - .mode = WM_toolsystem_mode_from_spacetype(view_layer, sa, sa->spacetype), + .space_type = area->spacetype, + .mode = WM_toolsystem_mode_from_spacetype(view_layer, area, area->spacetype), }; WM_toolsystem_refresh(C, workspace, &tkey); - WM_toolsystem_refresh_screen_area(workspace, view_layer, sa); + WM_toolsystem_refresh_screen_area(workspace, view_layer, area); } IDProperty *WM_toolsystem_ref_properties_ensure_idprops(bToolRef *tref) -- cgit v1.2.3