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_graph/graph_buttons.c | 4 +- source/blender/editors/space_graph/graph_draw.c | 39 ++--- source/blender/editors/space_graph/graph_edit.c | 22 +-- source/blender/editors/space_graph/graph_intern.h | 8 +- source/blender/editors/space_graph/graph_ops.c | 6 +- source/blender/editors/space_graph/graph_select.c | 8 +- source/blender/editors/space_graph/space_graph.c | 159 +++++++++++---------- 7 files changed, 126 insertions(+), 120 deletions(-) (limited to 'source/blender/editors/space_graph') diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index f61eb15b3c2..e1edb07ab68 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -352,9 +352,9 @@ static void graph_panel_key_properties(const bContext *C, Panel *pa) BezTriple *bezt, *prevbezt; uiLayout *layout = pa->layout; - const ARegion *ar = CTX_wm_region(C); + const ARegion *region = CTX_wm_region(C); /* Just a width big enough so buttons use entire layout width (will be clamped by it then). */ - const int but_max_width = ar->winx; + const int but_max_width = region->winx; uiLayout *col; uiBlock *block; diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index 8dd5a7c7d0c..f86ca60cefe 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -274,9 +274,12 @@ static void draw_fcurve_handle_vertices(FCurve *fcu, View2D *v2d, bool sel_handl immUnbindProgram(); } -static void draw_fcurve_vertices(ARegion *ar, FCurve *fcu, bool do_handles, bool sel_handle_only) +static void draw_fcurve_vertices(ARegion *region, + FCurve *fcu, + bool do_handles, + bool sel_handle_only) { - View2D *v2d = &ar->v2d; + View2D *v2d = ®ion->v2d; /* only draw points if curve is visible * - Draw unselected points before selected points as separate passes @@ -446,14 +449,14 @@ static void draw_fcurve_sample_control( } /* helper func - draw keyframe vertices only for an F-Curve */ -static void draw_fcurve_samples(SpaceGraph *sipo, ARegion *ar, FCurve *fcu) +static void draw_fcurve_samples(SpaceGraph *sipo, ARegion *region, FCurve *fcu) { FPoint *first, *last; float hsize, xscale, yscale; /* get view settings */ hsize = UI_GetThemeValuef(TH_VERTEX_SIZE); - UI_view2d_scale_get(&ar->v2d, &xscale, &yscale); + UI_view2d_scale_get(®ion->v2d, &xscale, &yscale); /* get verts */ first = fcu->fpt; @@ -869,7 +872,7 @@ static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2 static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu) { ChannelDriver *driver = fcu->driver; - View2D *v2d = &ac->ar->v2d; + View2D *v2d = &ac->region->v2d; short mapping_flag = ANIM_get_normalization_flags(ac); float offset; float unitfac = ANIM_unit_mapping_get_factor(ac->scene, id, fcu, mapping_flag, &offset); @@ -982,7 +985,7 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu) /* Draw the 'ghost' F-Curves (i.e. snapshots of the curve) * NOTE: unit mapping has already been applied to the values, so do not try and apply again */ -void graph_draw_ghost_curves(bAnimContext *ac, SpaceGraph *sipo, ARegion *ar) +void graph_draw_ghost_curves(bAnimContext *ac, SpaceGraph *sipo, ARegion *region) { FCurve *fcu; @@ -1017,7 +1020,7 @@ void graph_draw_ghost_curves(bAnimContext *ac, SpaceGraph *sipo, ARegion *ar) immUniformColor3fvAlpha(fcu->color, 0.5f); /* simply draw the stored samples */ - draw_fcurve_curve_samples(ac, NULL, fcu, &ar->v2d, shdr_pos); + draw_fcurve_curve_samples(ac, NULL, fcu, ®ion->v2d, shdr_pos); } immUnbindProgram(); @@ -1031,7 +1034,7 @@ void graph_draw_ghost_curves(bAnimContext *ac, SpaceGraph *sipo, ARegion *ar) /* This is called twice from space_graph.c -> graph_main_region_draw() * Unselected then selected F-Curves are drawn so that they do not occlude each other. */ -void graph_draw_curves(bAnimContext *ac, SpaceGraph *sipo, ARegion *ar, short sel) +void graph_draw_curves(bAnimContext *ac, SpaceGraph *sipo, ARegion *region, short sel) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; @@ -1118,20 +1121,20 @@ void graph_draw_curves(bAnimContext *ac, SpaceGraph *sipo, ARegion *ar, short se /* draw a curve affected by modifiers or only allowed to have integer values * by sampling it at various small-intervals over the visible region */ - draw_fcurve_curve(ac, ale->id, fcu, &ar->v2d, shdr_pos); + draw_fcurve_curve(ac, ale->id, fcu, ®ion->v2d, shdr_pos); } else if (((fcu->bezt) || (fcu->fpt)) && (fcu->totvert)) { /* just draw curve based on defined data (i.e. no modifiers) */ if (fcu->bezt) { if (fcurve_can_use_simple_bezt_drawing(fcu)) { - draw_fcurve_curve_bezts(ac, ale->id, fcu, &ar->v2d, shdr_pos); + draw_fcurve_curve_bezts(ac, ale->id, fcu, ®ion->v2d, shdr_pos); } else { - draw_fcurve_curve(ac, ale->id, fcu, &ar->v2d, shdr_pos); + draw_fcurve_curve(ac, ale->id, fcu, ®ion->v2d, shdr_pos); } } else if (fcu->fpt) { - draw_fcurve_curve_samples(ac, ale->id, fcu, &ar->v2d, shdr_pos); + draw_fcurve_curve_samples(ac, ale->id, fcu, ®ion->v2d, shdr_pos); } } @@ -1153,7 +1156,7 @@ void graph_draw_curves(bAnimContext *ac, SpaceGraph *sipo, ARegion *ar, short se if ((fcu->flag & FCURVE_ACTIVE) && (fcm)) { switch (fcm->type) { case FMODIFIER_TYPE_ENVELOPE: /* envelope */ - draw_fcurve_modifier_controls_envelope(fcm, &ar->v2d); + draw_fcurve_modifier_controls_envelope(fcm, ®ion->v2d); break; } } @@ -1183,11 +1186,11 @@ void graph_draw_curves(bAnimContext *ac, SpaceGraph *sipo, ARegion *ar, short se GPU_blend(false); } - draw_fcurve_vertices(ar, fcu, do_handles, (sipo->flag & SIPO_SELVHANDLESONLY)); + draw_fcurve_vertices(region, fcu, do_handles, (sipo->flag & SIPO_SELVHANDLESONLY)); } else { /* samples: only draw two indicators at either end as indicators */ - draw_fcurve_samples(sipo, ar, fcu); + draw_fcurve_samples(sipo, region, fcu); } GPU_matrix_pop(); @@ -1213,13 +1216,13 @@ void graph_draw_curves(bAnimContext *ac, SpaceGraph *sipo, ARegion *ar, short se /* Channel List */ /* left hand part */ -void graph_draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar) +void graph_draw_channel_names(bContext *C, bAnimContext *ac, ARegion *region) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; int filter; - View2D *v2d = &ar->v2d; + View2D *v2d = ®ion->v2d; float height; size_t items; @@ -1250,7 +1253,7 @@ void graph_draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar) } } { /* second pass: widgets */ - uiBlock *block = UI_block_begin(C, ar, __func__, UI_EMBOSS); + uiBlock *block = UI_block_begin(C, region, __func__, UI_EMBOSS); size_t channel_index = 0; float ymax = ACHANNEL_FIRST_TOP(ac); diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index 623d7e287d2..7580666c5f0 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -297,9 +297,9 @@ static int graphkeys_viewall(bContext *C, float pad_top = UI_TIME_SCRUB_MARGIN_Y; float pad_bottom = BLI_listbase_is_empty(ED_context_get_markers(C)) ? V2D_SCROLL_HANDLE_HEIGHT : UI_MARKER_MARGIN_Y; - BLI_rctf_pad_y(&cur_new, ac.ar->winy, pad_bottom, pad_top); + BLI_rctf_pad_y(&cur_new, ac.region->winy, pad_bottom, pad_top); - UI_view2d_smooth_view(C, ac.ar, &cur_new, smooth_viewtx); + UI_view2d_smooth_view(C, ac.region, &cur_new, smooth_viewtx); return OPERATOR_FINISHED; } @@ -486,7 +486,7 @@ static int graphkeys_create_ghostcurves_exec(bContext *C, wmOperator *UNUSED(op) /* Ghost curves are snapshots of the visible portions of the curves, * so set range to be the visible range. */ - v2d = &ac.ar->v2d; + v2d = &ac.region->v2d; start = (int)v2d->cur.xmin; end = (int)v2d->cur.xmax; @@ -871,7 +871,7 @@ static int graphkeys_click_insert_exec(bContext *C, wmOperator *op) static int graphkeys_click_insert_invoke(bContext *C, wmOperator *op, const wmEvent *event) { bAnimContext ac; - ARegion *ar; + ARegion *region; View2D *v2d; int mval[2]; float x, y; @@ -882,11 +882,11 @@ static int graphkeys_click_insert_invoke(bContext *C, wmOperator *op, const wmEv } /* store mouse coordinates in View2D space, into the operator's properties */ - ar = ac.ar; - v2d = &ar->v2d; + region = ac.region; + v2d = ®ion->v2d; - mval[0] = (event->x - ar->winrct.xmin); - mval[1] = (event->y - ar->winrct.ymin); + mval[0] = (event->x - region->winrct.xmin); + mval[1] = (event->y - region->winrct.ymin); UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, &y); @@ -1337,7 +1337,7 @@ typedef struct tDecimateGraphOp { bAnimContext ac; Scene *scene; ScrArea *sa; - ARegion *ar; + ARegion *region; /** A 0-1 value for determining how much we should decimate. */ PropertyRNA *percentage_prop; @@ -1460,7 +1460,7 @@ static void decimate_mouse_update_percentage(tDecimateGraphOp *dgo, wmOperator *op, const wmEvent *event) { - float percentage = (event->x - dgo->ar->winrct.xmin) / ((float)dgo->ar->winx); + float percentage = (event->x - dgo->region->winrct.xmin) / ((float)dgo->region->winx); RNA_property_float_set(op->ptr, dgo->percentage_prop, percentage); } @@ -1483,7 +1483,7 @@ static int graphkeys_decimate_invoke(bContext *C, wmOperator *op, const wmEvent dgo->scene = CTX_data_scene(C); dgo->sa = CTX_wm_area(C); - dgo->ar = CTX_wm_region(C); + dgo->region = CTX_wm_region(C); /* initialise percentage so that it will have the correct value before the first mouse move. */ decimate_mouse_update_percentage(dgo, op, event); diff --git a/source/blender/editors/space_graph/graph_intern.h b/source/blender/editors/space_graph/graph_intern.h index abd8d2db04a..3ec36e43278 100644 --- a/source/blender/editors/space_graph/graph_intern.h +++ b/source/blender/editors/space_graph/graph_intern.h @@ -35,13 +35,15 @@ struct bContext; /* ***************************************** */ /* graph_draw.c */ -void graph_draw_channel_names(struct bContext *C, struct bAnimContext *ac, struct ARegion *ar); +void graph_draw_channel_names(struct bContext *C, struct bAnimContext *ac, struct ARegion *region); void graph_draw_curves(struct bAnimContext *ac, struct SpaceGraph *sipo, - struct ARegion *ar, + struct ARegion *region, short sel); -void graph_draw_ghost_curves(struct bAnimContext *ac, struct SpaceGraph *sipo, struct ARegion *ar); +void graph_draw_ghost_curves(struct bAnimContext *ac, + struct SpaceGraph *sipo, + struct ARegion *region); /* ***************************************** */ /* graph_select.c */ diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c index 17cf5dca594..83aa0aa6eab 100644 --- a/source/blender/editors/space_graph/graph_ops.c +++ b/source/blender/editors/space_graph/graph_ops.c @@ -129,16 +129,16 @@ static int graphview_cursor_exec(bContext *C, wmOperator *op) /* set the operator properties from the initial event */ static void graphview_cursor_setprops(bContext *C, wmOperator *op, const wmEvent *event) { - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); float viewx, viewy; /* abort if not active region (should not really be possible) */ - if (ar == NULL) { + if (region == NULL) { return; } /* convert from region coordinates to View2D 'tot' space */ - UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &viewx, &viewy); + UI_view2d_region_to_view(®ion->v2d, event->mval[0], event->mval[1], &viewx, &viewy); /* store the values in the operator properties */ /* NOTE: we don't clamp frame here, as it might be used for the drivers cursor */ diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c index 82b8277cde5..94870cf0d81 100644 --- a/source/blender/editors/space_graph/graph_select.c +++ b/source/blender/editors/space_graph/graph_select.c @@ -179,7 +179,7 @@ static void get_nearest_fcurve_verts_list(bAnimContext *ac, const int mval[2], L int filter; SpaceGraph *sipo = (SpaceGraph *)ac->sl; - View2D *v2d = &ac->ar->v2d; + View2D *v2d = &ac->region->v2d; short mapping_flag = 0; /* get curves to search through @@ -521,7 +521,7 @@ static void box_select_graphkeys(bAnimContext *ac, SpaceGraph *sipo = (SpaceGraph *)ac->sl; KeyframeEditData ked; KeyframeEditFunc ok_cb, select_cb; - View2D *v2d = &ac->ar->v2d; + View2D *v2d = &ac->region->v2d; rctf rectf, scaled_rectf; /* Convert mouse coordinates to frame ranges and @@ -1370,8 +1370,8 @@ static int graphkeys_select_leftright_invoke(bContext *C, wmOperator *op, const /* handle mode-based testing */ if (leftright == GRAPHKEYS_LRSEL_TEST) { Scene *scene = ac.scene; - ARegion *ar = ac.ar; - View2D *v2d = &ar->v2d; + ARegion *region = ac.region; + View2D *v2d = ®ion->v2d; float x; /* determine which side of the current frame mouse is on */ diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index d01e4112fd0..330d309411e 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -66,7 +66,7 @@ static SpaceLink *graph_new(const ScrArea *UNUSED(sa), const Scene *scene) { - ARegion *ar; + ARegion *region; SpaceGraph *sipo; /* Graph Editor - general stuff */ @@ -84,52 +84,52 @@ static SpaceLink *graph_new(const ScrArea *UNUSED(sa), const Scene *scene) sipo->flag |= SIPO_SELVHANDLESONLY | SIPO_SHOW_MARKERS; /* header */ - ar = MEM_callocN(sizeof(ARegion), "header for graphedit"); + region = MEM_callocN(sizeof(ARegion), "header for graphedit"); - BLI_addtail(&sipo->regionbase, ar); - ar->regiontype = RGN_TYPE_HEADER; - ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP; + BLI_addtail(&sipo->regionbase, region); + region->regiontype = RGN_TYPE_HEADER; + region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP; /* channels */ - ar = MEM_callocN(sizeof(ARegion), "channels region for graphedit"); + region = MEM_callocN(sizeof(ARegion), "channels region for graphedit"); - BLI_addtail(&sipo->regionbase, ar); - ar->regiontype = RGN_TYPE_CHANNELS; - ar->alignment = RGN_ALIGN_LEFT; + BLI_addtail(&sipo->regionbase, region); + region->regiontype = RGN_TYPE_CHANNELS; + region->alignment = RGN_ALIGN_LEFT; - ar->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM); + region->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM); /* ui buttons */ - ar = MEM_callocN(sizeof(ARegion), "buttons region for graphedit"); + region = MEM_callocN(sizeof(ARegion), "buttons region for graphedit"); - BLI_addtail(&sipo->regionbase, ar); - ar->regiontype = RGN_TYPE_UI; - ar->alignment = RGN_ALIGN_RIGHT; - ar->flag = RGN_FLAG_HIDDEN; + BLI_addtail(&sipo->regionbase, region); + region->regiontype = RGN_TYPE_UI; + region->alignment = RGN_ALIGN_RIGHT; + region->flag = RGN_FLAG_HIDDEN; /* main region */ - ar = MEM_callocN(sizeof(ARegion), "main region for graphedit"); + region = MEM_callocN(sizeof(ARegion), "main region for graphedit"); - BLI_addtail(&sipo->regionbase, ar); - ar->regiontype = RGN_TYPE_WINDOW; + BLI_addtail(&sipo->regionbase, region); + region->regiontype = RGN_TYPE_WINDOW; - ar->v2d.tot.xmin = 0.0f; - ar->v2d.tot.ymin = (float)scene->r.sfra - 10.0f; - ar->v2d.tot.xmax = (float)scene->r.efra; - ar->v2d.tot.ymax = 10.0f; + region->v2d.tot.xmin = 0.0f; + region->v2d.tot.ymin = (float)scene->r.sfra - 10.0f; + region->v2d.tot.xmax = (float)scene->r.efra; + region->v2d.tot.ymax = 10.0f; - ar->v2d.cur = ar->v2d.tot; + region->v2d.cur = region->v2d.tot; - ar->v2d.min[0] = FLT_MIN; - ar->v2d.min[1] = FLT_MIN; + region->v2d.min[0] = FLT_MIN; + region->v2d.min[1] = FLT_MIN; - ar->v2d.max[0] = MAXFRAMEF; - ar->v2d.max[1] = FLT_MAX; + region->v2d.max[0] = MAXFRAMEF; + region->v2d.max[1] = FLT_MAX; - ar->v2d.scroll = (V2D_SCROLL_BOTTOM | V2D_SCROLL_HORIZONTAL_HANDLES); - ar->v2d.scroll |= (V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HANDLES); + region->v2d.scroll = (V2D_SCROLL_BOTTOM | V2D_SCROLL_HORIZONTAL_HANDLES); + region->v2d.scroll |= (V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HANDLES); - ar->v2d.keeptot = 0; + region->v2d.keeptot = 0; return (SpaceLink *)sipo; } @@ -180,26 +180,26 @@ static SpaceLink *graph_duplicate(SpaceLink *sl) } /* add handlers, stuff you only do once or on area/region changes */ -static void graph_main_region_init(wmWindowManager *wm, ARegion *ar) +static void graph_main_region_init(wmWindowManager *wm, ARegion *region) { wmKeyMap *keymap; - 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, "Graph Editor", SPACE_GRAPH, 0); - WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap); + WM_event_add_keymap_handler_v2d_mask(®ion->handlers, keymap); keymap = WM_keymap_ensure(wm->defaultconf, "Graph Editor Generic", SPACE_GRAPH, 0); - WM_event_add_keymap_handler(&ar->handlers, keymap); + WM_event_add_keymap_handler(®ion->handlers, keymap); } -static void graph_main_region_draw(const bContext *C, ARegion *ar) +static void graph_main_region_draw(const bContext *C, ARegion *region) { /* draw entirely, view changes should be handled here */ SpaceGraph *sipo = CTX_wm_space_graph(C); Scene *scene = CTX_data_scene(C); bAnimContext ac; - View2D *v2d = &ar->v2d; + View2D *v2d = ®ion->v2d; View2DScrollers *scrollers; float col[3]; short cfra_flag = 0; @@ -216,7 +216,7 @@ static void graph_main_region_draw(const bContext *C, ARegion *ar) UI_view2d_draw_lines_x__frames_or_seconds(v2d, scene, display_seconds); UI_view2d_draw_lines_y__values(v2d); - ED_region_draw_cb_draw(C, ar, REGION_DRAW_PRE_VIEW); + ED_region_draw_cb_draw(C, region, REGION_DRAW_PRE_VIEW); /* start and end frame (in F-Curve mode only) */ if (sipo->mode != SIPO_MODE_DRIVERS) { @@ -226,11 +226,11 @@ static void graph_main_region_draw(const bContext *C, ARegion *ar) /* draw data */ if (ANIM_animdata_get_context(C, &ac)) { /* draw ghost curves */ - graph_draw_ghost_curves(&ac, sipo, ar); + graph_draw_ghost_curves(&ac, sipo, region); /* draw curves twice - unselected, then selected, so that the are fewer occlusion problems */ - graph_draw_curves(&ac, sipo, ar, 0); - graph_draw_curves(&ac, sipo, ar, 1); + graph_draw_curves(&ac, sipo, region, 0); + graph_draw_curves(&ac, sipo, region, 1); /* XXX the slow way to set tot rect... but for nice sliders needed (ton) */ get_graph_keyframe_extents( @@ -294,7 +294,7 @@ static void graph_main_region_draw(const bContext *C, ARegion *ar) /* markers */ if (sipo->mode != SIPO_MODE_DRIVERS) { - UI_view2d_view_orthoSpecial(ar, v2d, 1); + UI_view2d_view_orthoSpecial(region, v2d, 1); int marker_draw_flag = DRAW_MARKERS_MARGIN; if (sipo->flag & SIPO_SHOW_MARKERS) { ED_markers_draw(C, marker_draw_flag); @@ -309,13 +309,13 @@ static void graph_main_region_draw(const bContext *C, ARegion *ar) /* callback */ UI_view2d_view_ortho(v2d); - ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW); + ED_region_draw_cb_draw(C, region, REGION_DRAW_POST_VIEW); /* reset view matrix */ UI_view2d_view_restore(C); /* time-scrubbing */ - ED_time_scrub_draw(ar, scene, display_seconds, false); + ED_time_scrub_draw(region, scene, display_seconds, false); /* scrollers */ // FIXME: args for scrollers depend on the type of data being shown... @@ -326,37 +326,38 @@ static void graph_main_region_draw(const bContext *C, ARegion *ar) /* scale numbers */ { rcti rect; - BLI_rcti_init(&rect, 0, 15 * UI_DPI_FAC, 15 * UI_DPI_FAC, ar->winy - UI_TIME_SCRUB_MARGIN_Y); - UI_view2d_draw_scale_y__values(ar, v2d, &rect, TH_SCROLL_TEXT); + BLI_rcti_init( + &rect, 0, 15 * UI_DPI_FAC, 15 * UI_DPI_FAC, region->winy - UI_TIME_SCRUB_MARGIN_Y); + UI_view2d_draw_scale_y__values(region, v2d, &rect, TH_SCROLL_TEXT); } } -static void graph_channel_region_init(wmWindowManager *wm, ARegion *ar) +static void graph_channel_region_init(wmWindowManager *wm, ARegion *region) { wmKeyMap *keymap; /* make sure we keep the hide flags */ - ar->v2d.scroll |= V2D_SCROLL_RIGHT; + region->v2d.scroll |= V2D_SCROLL_RIGHT; /* prevent any noise of past */ - ar->v2d.scroll &= ~(V2D_SCROLL_LEFT | V2D_SCROLL_TOP | V2D_SCROLL_BOTTOM); + region->v2d.scroll &= ~(V2D_SCROLL_LEFT | V2D_SCROLL_TOP | V2D_SCROLL_BOTTOM); - ar->v2d.scroll |= V2D_SCROLL_HORIZONTAL_HIDE; - ar->v2d.scroll |= V2D_SCROLL_VERTICAL_HIDE; + region->v2d.scroll |= V2D_SCROLL_HORIZONTAL_HIDE; + region->v2d.scroll |= V2D_SCROLL_VERTICAL_HIDE; - UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy); + UI_view2d_region_reinit(®ion->v2d, V2D_COMMONVIEW_LIST, region->winx, region->winy); /* own keymap */ keymap = WM_keymap_ensure(wm->defaultconf, "Animation Channels", 0, 0); - WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap); + WM_event_add_keymap_handler_v2d_mask(®ion->handlers, keymap); keymap = WM_keymap_ensure(wm->defaultconf, "Graph Editor Generic", SPACE_GRAPH, 0); - WM_event_add_keymap_handler(&ar->handlers, keymap); + WM_event_add_keymap_handler(®ion->handlers, keymap); } -static void graph_channel_region_draw(const bContext *C, ARegion *ar) +static void graph_channel_region_draw(const bContext *C, ARegion *region) { bAnimContext ac; - View2D *v2d = &ar->v2d; + View2D *v2d = ®ion->v2d; View2DScrollers *scrollers; float col[3]; @@ -369,11 +370,11 @@ static void graph_channel_region_draw(const bContext *C, ARegion *ar) /* draw channels */ if (ANIM_animdata_get_context(C, &ac)) { - graph_draw_channel_names((bContext *)C, &ac, ar); + graph_draw_channel_names((bContext *)C, &ac, region); } /* channel filter next to scrubbing area */ - ED_time_scrub_channel_search_draw(C, ar, ac.ads); + ED_time_scrub_channel_search_draw(C, region, ac.ads); /* reset view matrix */ UI_view2d_view_restore(C); @@ -385,42 +386,42 @@ static void graph_channel_region_draw(const bContext *C, ARegion *ar) } /* add handlers, stuff you only do once or on area/region changes */ -static void graph_header_region_init(wmWindowManager *UNUSED(wm), ARegion *ar) +static void graph_header_region_init(wmWindowManager *UNUSED(wm), ARegion *region) { - ED_region_header_init(ar); + ED_region_header_init(region); } -static void graph_header_region_draw(const bContext *C, ARegion *ar) +static void graph_header_region_draw(const bContext *C, ARegion *region) { - ED_region_header(C, ar); + ED_region_header(C, region); } /* add handlers, stuff you only do once or on area/region changes */ -static void graph_buttons_region_init(wmWindowManager *wm, ARegion *ar) +static void graph_buttons_region_init(wmWindowManager *wm, ARegion *region) { wmKeyMap *keymap; - ED_region_panels_init(wm, ar); + ED_region_panels_init(wm, region); keymap = WM_keymap_ensure(wm->defaultconf, "Graph Editor Generic", SPACE_GRAPH, 0); - WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap); + WM_event_add_keymap_handler_v2d_mask(®ion->handlers, keymap); } -static void graph_buttons_region_draw(const bContext *C, ARegion *ar) +static void graph_buttons_region_draw(const bContext *C, ARegion *region) { - ED_region_panels(C, ar); + ED_region_panels(C, region); } static void graph_region_listener(wmWindow *UNUSED(win), ScrArea *UNUSED(sa), - ARegion *ar, + ARegion *region, wmNotifier *wmn, const Scene *UNUSED(scene)) { /* context changes */ switch (wmn->category) { case NC_ANIMATION: - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); break; case NC_SCENE: switch (wmn->data) { @@ -429,11 +430,11 @@ static void graph_region_listener(wmWindow *UNUSED(win), case ND_FRAME: case ND_FRAME_RANGE: case ND_MARKERS: - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); break; case ND_SEQUENCER: if (wmn->action == NA_SELECTED) { - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); } break; } @@ -443,11 +444,11 @@ static void graph_region_listener(wmWindow *UNUSED(win), case ND_BONE_ACTIVE: case ND_BONE_SELECT: case ND_KEYS: - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); break; case ND_MODIFIER: if (wmn->action == NA_RENAME) { - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); } break; } @@ -456,23 +457,23 @@ static void graph_region_listener(wmWindow *UNUSED(win), switch (wmn->action) { case NA_EDITED: case NA_SELECTED: - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); break; } break; case NC_ID: if (wmn->action == NA_RENAME) { - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); } break; case NC_SCREEN: if (ELEM(wmn->data, ND_LAYER)) { - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); } break; default: if (wmn->data == ND_KEYS) { - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); } break; } @@ -483,15 +484,15 @@ static void graph_region_message_subscribe(const struct bContext *UNUSED(C), struct Scene *scene, struct bScreen *screen, struct ScrArea *sa, - struct ARegion *ar, + struct ARegion *region, struct wmMsgBus *mbus) { PointerRNA ptr; RNA_pointer_create(&screen->id, &RNA_SpaceGraphEditor, sa->spacedata.first, &ptr); 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