From b2ee1770d4c31078518f4ec9edd5196a41345162 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Fri, 6 Mar 2020 16:56:42 +0100 Subject: Cleanup: Rename ARegion variables from ar to region The old convention was easy to confuse with ScrArea. Part of https://developer.blender.org/T74432. This is mostly a batch rename with some manual fixing. Only single word variable names are changed, no prefixed/suffixed names. Brecht van Lommel and Campbell Barton both gave me a green light for this convention change. Also ran clan clang format on affected files. --- source/blender/editors/space_info/space_info.c | 85 +++++++++++++------------- 1 file changed, 43 insertions(+), 42 deletions(-) (limited to 'source/blender/editors/space_info/space_info.c') diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c index 8eddf90b06b..789a0d8ea08 100644 --- a/source/blender/editors/space_info/space_info.c +++ b/source/blender/editors/space_info/space_info.c @@ -55,7 +55,7 @@ static SpaceLink *info_new(const ScrArea *UNUSED(area), const Scene *UNUSED(scene)) { - ARegion *ar; + ARegion *region; SpaceInfo *sinfo; sinfo = MEM_callocN(sizeof(SpaceInfo), "initinfo"); @@ -64,28 +64,28 @@ static SpaceLink *info_new(const ScrArea *UNUSED(area), const Scene *UNUSED(scen sinfo->rpt_mask = INFO_RPT_OP; /* header */ - ar = MEM_callocN(sizeof(ARegion), "header for info"); + region = MEM_callocN(sizeof(ARegion), "header for info"); - BLI_addtail(&sinfo->regionbase, ar); - ar->regiontype = RGN_TYPE_HEADER; - ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP; + BLI_addtail(&sinfo->regionbase, region); + region->regiontype = RGN_TYPE_HEADER; + region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP; /* main region */ - ar = MEM_callocN(sizeof(ARegion), "main region for info"); + region = MEM_callocN(sizeof(ARegion), "main region for info"); - BLI_addtail(&sinfo->regionbase, ar); - ar->regiontype = RGN_TYPE_WINDOW; + BLI_addtail(&sinfo->regionbase, region); + region->regiontype = RGN_TYPE_WINDOW; /* keep in sync with console */ - ar->v2d.scroll |= (V2D_SCROLL_RIGHT); - ar->v2d.align |= V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_NEG_Y; /* align bottom left */ - ar->v2d.keepofs |= V2D_LOCKOFS_X; - ar->v2d.keepzoom = (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM | V2D_KEEPASPECT); - ar->v2d.keeptot = V2D_KEEPTOT_BOUNDS; - ar->v2d.minzoom = ar->v2d.maxzoom = 1.0f; + region->v2d.scroll |= (V2D_SCROLL_RIGHT); + region->v2d.align |= V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_NEG_Y; /* align bottom left */ + region->v2d.keepofs |= V2D_LOCKOFS_X; + region->v2d.keepzoom = (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM | V2D_KEEPASPECT); + region->v2d.keeptot = V2D_KEEPTOT_BOUNDS; + region->v2d.minzoom = region->v2d.maxzoom = 1.0f; /* for now, aspect ratio should be maintained, and zoom is clamped within sane default limits */ - // ar->v2d.keepzoom = (V2D_KEEPASPECT|V2D_LIMITZOOM); + // region->v2d.keepzoom = (V2D_KEEPASPECT|V2D_LIMITZOOM); return (SpaceLink *)sinfo; } @@ -111,33 +111,34 @@ static SpaceLink *info_duplicate(SpaceLink *sl) } /* add handlers, stuff you only do once or on area/region changes */ -static void info_main_region_init(wmWindowManager *wm, ARegion *ar) +static void info_main_region_init(wmWindowManager *wm, ARegion *region) { wmKeyMap *keymap; /* force it on init, for old files, until it becomes config */ - ar->v2d.scroll = (V2D_SCROLL_RIGHT); + region->v2d.scroll = (V2D_SCROLL_RIGHT); - UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy); + UI_view2d_region_reinit(®ion->v2d, V2D_COMMONVIEW_CUSTOM, region->winx, region->winy); /* own keymap */ keymap = WM_keymap_ensure(wm->defaultconf, "Info", SPACE_INFO, 0); - WM_event_add_keymap_handler(&ar->handlers, keymap); + WM_event_add_keymap_handler(®ion->handlers, keymap); } -static void info_textview_update_rect(const bContext *C, ARegion *ar) +static void info_textview_update_rect(const bContext *C, ARegion *region) { SpaceInfo *sinfo = CTX_wm_space_info(C); - View2D *v2d = &ar->v2d; + View2D *v2d = ®ion->v2d; - UI_view2d_totRect_set(v2d, ar->winx - 1, info_textview_height(sinfo, ar, CTX_wm_reports(C))); + UI_view2d_totRect_set( + v2d, region->winx - 1, info_textview_height(sinfo, region, CTX_wm_reports(C))); } -static void info_main_region_draw(const bContext *C, ARegion *ar) +static void info_main_region_draw(const bContext *C, ARegion *region) { /* draw entirely, view changes should be handled here */ SpaceInfo *sinfo = CTX_wm_space_info(C); - View2D *v2d = &ar->v2d; + View2D *v2d = ®ion->v2d; View2DScrollers *scrollers; /* clear and setup matrix */ @@ -145,16 +146,16 @@ static void info_main_region_draw(const bContext *C, ARegion *ar) GPU_clear(GPU_COLOR_BIT); /* quick way to avoid drawing if not bug enough */ - if (ar->winy < 16) { + if (region->winy < 16) { return; } - info_textview_update_rect(C, ar); + info_textview_update_rect(C, region); /* worlks best with no view2d matrix set */ UI_view2d_view_ortho(v2d); - info_textview_main(sinfo, ar, CTX_wm_reports(C)); + info_textview_main(sinfo, region, CTX_wm_reports(C)); /* reset view matrix */ UI_view2d_view_restore(C); @@ -197,19 +198,19 @@ static void info_keymap(struct wmKeyConfig *keyconf) } /* add handlers, stuff you only do once or on area/region changes */ -static void info_header_region_init(wmWindowManager *UNUSED(wm), ARegion *ar) +static void info_header_region_init(wmWindowManager *UNUSED(wm), ARegion *region) { - ED_region_header_init(ar); + ED_region_header_init(region); } -static void info_header_region_draw(const bContext *C, ARegion *ar) +static void info_header_region_draw(const bContext *C, ARegion *region) { - ED_region_header(C, ar); + ED_region_header(C, region); } static void info_main_region_listener(wmWindow *UNUSED(win), ScrArea *UNUSED(sa), - ARegion *ar, + ARegion *region, wmNotifier *wmn, const Scene *UNUSED(scene)) { @@ -220,7 +221,7 @@ static void info_main_region_listener(wmWindow *UNUSED(win), case NC_SPACE: if (wmn->data == ND_SPACE_INFO_REPORT) { /* redraw also but only for report view, could do less redraws by checking the type */ - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); } break; } @@ -228,7 +229,7 @@ static void info_main_region_listener(wmWindow *UNUSED(win), static void info_header_listener(wmWindow *UNUSED(win), ScrArea *UNUSED(sa), - ARegion *ar, + ARegion *region, wmNotifier *wmn, const Scene *UNUSED(scene)) { @@ -236,27 +237,27 @@ static void info_header_listener(wmWindow *UNUSED(win), switch (wmn->category) { case NC_SCREEN: if (ELEM(wmn->data, ND_LAYER, ND_ANIMPLAY)) { - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); } break; case NC_WM: if (wmn->data == ND_JOB) { - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); } break; case NC_SCENE: if (wmn->data == ND_RENDER_RESULT) { - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); } break; case NC_SPACE: if (wmn->data == ND_SPACE_INFO) { - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); } break; case NC_ID: if (wmn->action == NA_RENAME) { - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); } break; } @@ -267,12 +268,12 @@ static void info_header_region_message_subscribe(const bContext *UNUSED(C), Scene *UNUSED(scene), bScreen *UNUSED(screen), ScrArea *UNUSED(sa), - ARegion *ar, + ARegion *region, struct wmMsgBus *mbus) { wmMsgSubscribeValue msg_sub_value_region_tag_redraw = { - .owner = ar, - .user_data = ar, + .owner = region, + .user_data = region, .notify = ED_region_do_msg_notify_tag_redraw, }; -- cgit v1.2.3