diff options
author | Jacques Lucke <mail@jlucke.com> | 2019-04-30 15:10:53 +0300 |
---|---|---|
committer | Jacques Lucke <mail@jlucke.com> | 2019-04-30 15:10:53 +0300 |
commit | 7f0b122b668621013afa2950558cb5468bb1b71b (patch) | |
tree | cf9882f68e2ae6ef264e44cb17974673967591d2 /source/blender/editors/space_clip | |
parent | 2445d5abc269123cb0789cc16a5710c6577e9d20 (diff) |
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
Diffstat (limited to 'source/blender/editors/space_clip')
-rw-r--r-- | source/blender/editors/space_clip/space_clip.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c index aa58e4cbe54..c411f9d4e04 100644 --- a/source/blender/editors/space_clip/space_clip.c +++ b/source/blender/editors/space_clip/space_clip.c @@ -1017,7 +1017,6 @@ static void graph_region_draw(const bContext *C, ARegion *ar) View2DScrollers *scrollers; SpaceClip *sc = CTX_wm_space_clip(C); Scene *scene = CTX_data_scene(C); - short unitx, unity; short cfra_flag = 0; if (sc->flag & SC_LOCK_TIMECURSOR) { @@ -1043,13 +1042,19 @@ static void graph_region_draw(const bContext *C, ARegion *ar) UI_view2d_view_restore(C); /* scrollers */ - unitx = (sc->flag & SC_SHOW_SECONDS) ? V2D_UNIT_SECONDS : V2D_UNIT_FRAMES; - unity = V2D_UNIT_VALUES; - scrollers = UI_view2d_scrollers_calc( - C, v2d, NULL, unitx, V2D_GRID_NOCLAMP, unity, V2D_GRID_NOCLAMP); - 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); + /* scale indicators */ + short unitx = (sc->flag & SC_SHOW_SECONDS) ? V2D_UNIT_SECONDS : V2D_UNIT_FRAMES; + short unity = V2D_UNIT_VALUES; + View2DGrid *grid = UI_view2d_grid_calc( + scene, v2d, unitx, V2D_GRID_NOCLAMP, unity, V2D_GRID_NOCLAMP, ar->winx, ar->winy); + UI_view2d_grid_draw_numbers_horizontal(scene, v2d, grid, &v2d->hor, unitx, false); + UI_view2d_grid_draw_numbers_vertical(scene, v2d, grid, &v2d->vert, unity, 0.0); + UI_view2d_grid_free(grid); + /* current frame indicator */ if (sc->flag & SC_SHOW_SECONDS) { cfra_flag |= DRAWCFRA_UNIT_SECONDS; @@ -1083,7 +1088,6 @@ static void dopesheet_region_draw(const bContext *C, ARegion *ar) grid = UI_view2d_grid_calc( scene, v2d, unit, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY, ar->winx, ar->winy); UI_view2d_grid_draw(v2d, grid, V2D_GRIDLINES_ALL); - UI_view2d_grid_free(grid); /* data... */ clip_draw_dopesheet_main(sc, ar, scene); @@ -1098,11 +1102,14 @@ static void dopesheet_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); + /* current frame number indicator */ UI_view2d_view_orthoSpecial(ar, v2d, 1); ANIM_draw_cfra_number(C, v2d, cfra_flag); |