From 7f0b122b668621013afa2950558cb5468bb1b71b Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Tue, 30 Apr 2019 14:10:53 +0200 Subject: Refactor: Separate scrollers from text drawing in API This is a continuation of rB7fdffd735ff24, where I separated the e.g. frame number drawing from scrollers internally. This patch changes the API, so that space draw handlers have to draw these numbers explicitely. This greatly simplifies the scrollers API for all spaces that just need scrollers without any frame numbers. Reviewers: campbellbarton Differential Revision: https://developer.blender.org/D4747 --- source/blender/editors/space_nla/space_nla.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'source/blender/editors/space_nla') diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c index 69fc97e8ea5..6c5a046a0cb 100644 --- a/source/blender/editors/space_nla/space_nla.c +++ b/source/blender/editors/space_nla/space_nla.c @@ -205,9 +205,8 @@ static void nla_channel_region_draw(const bContext *C, ARegion *ar) UI_view2d_view_restore(C); /* scrollers */ - scrollers = UI_view2d_scrollers_calc( - C, v2d, NULL, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY); - UI_view2d_scrollers_draw(C, v2d, scrollers); + scrollers = UI_view2d_scrollers_calc(v2d, NULL); + UI_view2d_scrollers_draw(v2d, scrollers); UI_view2d_scrollers_free(scrollers); } @@ -253,7 +252,6 @@ static void nla_main_region_draw(const bContext *C, ARegion *ar) ar->winx, ar->winy); UI_view2d_grid_draw(v2d, grid, V2D_GRIDLINES_ALL); - UI_view2d_grid_free(grid); ED_region_draw_cb_draw(C, ar, REGION_DRAW_PRE_VIEW); @@ -297,11 +295,14 @@ static void nla_main_region_draw(const bContext *C, ARegion *ar) UI_view2d_view_restore(C); /* scrollers */ - scrollers = UI_view2d_scrollers_calc( - C, v2d, NULL, unit, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY); - UI_view2d_scrollers_draw(C, v2d, scrollers); + scrollers = UI_view2d_scrollers_calc(v2d, NULL); + UI_view2d_scrollers_draw(v2d, scrollers); UI_view2d_scrollers_free(scrollers); + /* frame numbers */ + UI_view2d_grid_draw_numbers_horizontal(scene, v2d, grid, &v2d->hor, unit, true); + UI_view2d_grid_free(grid); + /* draw current frame number-indicator on top of scrollers */ if ((snla->flag & SNLA_NODRAWCFRANUM) == 0) { UI_view2d_view_orthoSpecial(ar, v2d, 1); -- cgit v1.2.3