Refactor: Separate scrollers from text drawing in API
authorJacques Lucke <mail@jlucke.com>
Tue, 30 Apr 2019 12:10:53 +0000 (14:10 +0200)
committerJacques Lucke <mail@jlucke.com>
Tue, 30 Apr 2019 12:10:53 +0000 (14:10 +0200)
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

15 files changed:
source/blender/editors/include/UI_view2d.h
source/blender/editors/interface/view2d.c
source/blender/editors/interface/view2d_ops.c
source/blender/editors/screen/area.c
source/blender/editors/space_action/space_action.c
source/blender/editors/space_clip/space_clip.c
source/blender/editors/space_console/space_console.c
source/blender/editors/space_file/space_file.c
source/blender/editors/space_graph/space_graph.c
source/blender/editors/space_image/space_image.c
source/blender/editors/space_info/space_info.c
source/blender/editors/space_nla/space_nla.c
source/blender/editors/space_node/node_draw.c
source/blender/editors/space_outliner/space_outliner.c
source/blender/editors/space_sequencer/sequencer_draw.c

index a16c1efd6cfb2a186004d82c3e39017c6abfb631..fee1efcf25bb31c52fe7fe01ad0e04fb726d5066 100644 (file)
@@ -192,16 +192,8 @@ void UI_view2d_grid_draw_numbers_vertical(const struct Scene *scene,
 void UI_view2d_grid_free(View2DGrid *grid);
 
 /* scrollbar drawing */
-View2DScrollers *UI_view2d_scrollers_calc(const struct bContext *C,
-                                          struct View2D *v2d,
-                                          const struct rcti *mask_custom,
-                                          short xunits,
-                                          short xclamp,
-                                          short yunits,
-                                          short yclamp);
-void UI_view2d_scrollers_draw(const struct bContext *C,
-                              struct View2D *v2d,
-                              View2DScrollers *scrollers);
+View2DScrollers *UI_view2d_scrollers_calc(struct View2D *v2d, const struct rcti *mask_custom);
+void UI_view2d_scrollers_draw(struct View2D *v2d, View2DScrollers *scrollers);
 void UI_view2d_scrollers_free(View2DScrollers *scrollers);
 
 /* list view tools */
index 952778cfc6d4da3b420f6073a438652b8cf532c0..072497dbb7435400a00b1d404b63c59d845dac49 100644 (file)
@@ -1312,7 +1312,6 @@ static void step_to_grid(float *step, const int unit, int *r_power)
  *
  * - Currently, will return pointer to View2DGrid struct that needs to
  *   be freed with UI_view2d_grid_free()
- * - Is used for scrollbar drawing too (for units drawing)
  * - Units + clamping args will be checked, to make sure they are valid values that can be used
  *   so it is very possible that we won't return grid at all!
  *
@@ -1753,7 +1752,7 @@ void UI_view2d_grid_draw_numbers_horizontal(const Scene *scene,
   }
 
   float initial_xpos = UI_view2d_view_to_region_x(v2d, grid->startx);
-  float ypos = (float)rect->ymin + 2 * UI_DPI_FAC;
+  float ypos = (float)rect->ymin + 4 * UI_DPI_FAC;
   float initial_value = grid->startx;
   float value_step = grid->dx;
   int brevity_level = grid->powerx;
@@ -1872,21 +1871,10 @@ struct View2DScrollers {
 
   rcti hor, vert;        /* exact size of slider backdrop */
   int horfull, vertfull; /* set if sliders are full, we don't draw them */
-
-  /* scales */
-  View2DGrid *grid;     /* grid for coordinate drawing */
-  short xunits, xclamp; /* units and clamping options for x-axis */
-  short yunits, yclamp; /* units and clamping options for y-axis */
 };
 
 /* Calculate relevant scroller properties */
-View2DScrollers *UI_view2d_scrollers_calc(const bContext *C,
-                                          View2D *v2d,
-                                          const rcti *mask_custom,
-                                          short xunits,
-                                          short xclamp,
-                                          short yunits,
-                                          short yclamp)
+View2DScrollers *UI_view2d_scrollers_calc(View2D *v2d, const rcti *mask_custom)
 {
   View2DScrollers *scrollers;
   rcti vert, hor;
@@ -2014,30 +2002,11 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C,
     }
   }
 
-  /* grid markings on scrollbars */
-  if (scroll & (V2D_SCROLL_SCALE_HORIZONTAL | V2D_SCROLL_SCALE_VERTICAL)) {
-    /* store clamping */
-    scrollers->xclamp = xclamp;
-    scrollers->xunits = xunits;
-    scrollers->yclamp = yclamp;
-    scrollers->yunits = yunits;
-
-    scrollers->grid = UI_view2d_grid_calc(CTX_data_scene(C),
-                                          v2d,
-                                          xunits,
-                                          xclamp,
-                                          yunits,
-                                          yclamp,
-                                          BLI_rcti_size_x(&hor),
-                                          BLI_rcti_size_y(&vert));
-  }
-
-  /* return scrollers */
   return scrollers;
 }
 
 /* Draw scrollbars in the given 2d-region */
-void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *vs)
+void UI_view2d_scrollers_draw(View2D *v2d, View2DScrollers *vs)
 {
   bTheme *btheme = UI_GetTheme();
   rcti vert, hor;
@@ -2084,13 +2053,6 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
     }
 
     UI_draw_widget_scroll(&wcol, &hor, &slider, state);
-
-    {
-      if (scroll & V2D_SCROLL_SCALE_HORIZONTAL) {
-        UI_view2d_grid_draw_numbers_horizontal(
-            CTX_data_scene(C), v2d, vs->grid, &vs->hor, vs->xunits, vs->xclamp == V2D_GRID_CLAMP);
-      }
-    }
   }
 
   /* vertical scrollbar */
@@ -2125,17 +2087,6 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
     }
 
     UI_draw_widget_scroll(&wcol, &vert, &slider, state);
-
-    {
-      if (scroll & V2D_SCROLL_SCALE_VERTICAL) {
-        float text_offset = 0.0f;
-        if (vs->yclamp & V2D_GRID_CLAMP) {
-          text_offset = 0.5f;
-        }
-        UI_view2d_grid_draw_numbers_vertical(
-            CTX_data_scene(C), v2d, vs->grid, &vs->vert, vs->yunits, text_offset);
-      }
-    }
   }
 
   /* Was changed above, so reset. */
@@ -2145,10 +2096,6 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
 /* free temporary memory used for drawing scrollers */
 void UI_view2d_scrollers_free(View2DScrollers *scrollers)
 {
-  /* need to free grid as well... */
-  if (scrollers->grid) {
-    MEM_freeN(scrollers->grid);
-  }
   MEM_freeN(scrollers);
 }
 
index 8880072b82bbd7d1fe0a1adea87d2b3611f8e9b3..ab8d1cf9bf621dc0ca48c08fd1a906c21f3906f5 100644 (file)
@@ -1785,8 +1785,7 @@ static void scroller_activate_init(bContext *C,
   /* 'zone' depends on where mouse is relative to bubble
    * - zooming must be allowed on this axis, otherwise, default to pan
    */
-  scrollers = UI_view2d_scrollers_calc(
-      C, v2d, NULL, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
+  scrollers = UI_view2d_scrollers_calc(v2d, NULL);
 
   /* use a union of 'cur' & 'tot' incase the current view is far outside 'tot'. In this cases
    * moving the scroll bars has far too little effect and the view can get stuck T31476. */
index 485a47bfaf7562e7c8c8ba8ab8832879b96c202a..38684afec39edcd8ce13bcac5c6b9c4f03302a34 100644 (file)
@@ -2516,9 +2516,8 @@ void ED_region_panels_draw(const bContext *C, ARegion *ar)
     mask_buf.xmax -= UI_PANEL_CATEGORY_MARGIN_WIDTH;
     mask = &mask_buf;
   }
-  View2DScrollers *scrollers = UI_view2d_scrollers_calc(
-      C, v2d, mask, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
-  UI_view2d_scrollers_draw(C, v2d, scrollers);
+  View2DScrollers *scrollers = UI_view2d_scrollers_calc(v2d, mask);
+  UI_view2d_scrollers_draw(v2d, scrollers);
   UI_view2d_scrollers_free(scrollers);
 }
 
index 5a9c3a66f2bea8eded772b546666ffe5ac8ae683..ce1b53b7bf9cf3484bf71292c892aa2a0a1ca273 100644 (file)
@@ -202,7 +202,6 @@ static void action_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);
 
@@ -247,11 +246,14 @@ static void action_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 ((saction->flag & SACTION_NODRAWCFRANUM) == 0) {
     UI_view2d_view_orthoSpecial(ar, v2d, 1);
index aa58e4cbe54a871824f3d89fae4184bcc6f8e3d2..c411f9d4e045bd9640259ef7e9ba333e492d0e2b 100644 (file)
@@ -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);
index 834ede2a9274b6b8a532bf13cade58457d18740c..9632eadeccf07122425428d25f3c3755eefbcbc7 100644 (file)
@@ -231,9 +231,8 @@ static void console_main_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_GRID_CLAMP);
-  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);
 }
 
index 1216755151ba81b18537edb7b1e7e3f28ca47e4e..9fb07042104defcb616941e68ded5acac2d68f5f 100644 (file)
@@ -441,9 +441,8 @@ static void file_main_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);
 }
 
index c02021591db4a505be36662cc035ab3836c60cd3..1ae69394d0a6eb4eac0f2dea54d162ab2defca33 100644 (file)
@@ -248,9 +248,6 @@ static void graph_main_region_draw(const bContext *C, ARegion *ar)
     v2d->tot.xmax += 10.0f;
   }
 
-  /* only free grid after drawing data, as we need to use it to determine sampling rate */
-  UI_view2d_grid_free(grid);
-
   if (((sipo->flag & SIPO_NODRAWCURSOR) == 0) || (sipo->mode == SIPO_MODE_DRIVERS)) {
     uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
 
@@ -324,11 +321,15 @@ static void graph_main_region_draw(const bContext *C, ARegion *ar)
 
   /* scrollers */
   // FIXME: args for scrollers depend on the type of data being shown...
-  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 numbers */
+  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.0f);
+  UI_view2d_grid_free(grid);
+
   /* draw current frame number-indicator on top of scrollers */
   if ((sipo->mode != SIPO_MODE_DRIVERS) && ((sipo->flag & SIPO_NODRAWCFRANUM) == 0)) {
     UI_view2d_view_orthoSpecial(ar, v2d, 1);
@@ -381,9 +382,8 @@ static void graph_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);
 }
 
index 20bcf19d7f220096d2d5c12df159c3ca2aad18c2..67176f9bc499384e255694d6dee3d1e2d61add3d 100644 (file)
@@ -686,14 +686,6 @@ static void image_main_region_draw(const bContext *C, ARegion *ar)
   WM_gizmomap_draw(ar->gizmo_map, C, WM_GIZMOMAP_DRAWSTEP_2D);
 
   draw_image_cache(C, ar);
-
-  /* scrollers? */
-#if 0
-  scrollers = UI_view2d_scrollers_calc(
-      C, v2d, V2D_UNIT_VALUES, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
-  UI_view2d_scrollers_draw(C, v2d, scrollers);
-  UI_view2d_scrollers_free(scrollers);
-#endif
 }
 
 static void image_main_region_listener(
index 6ed9d80d1453073c34ae3becfb1bacccba5d5818..bbe2acfa5d78780831cae0a462700312182f7ee3 100644 (file)
@@ -160,9 +160,8 @@ static void info_main_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_GRID_CLAMP);
-  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);
 }
 
index 69fc97e8ea5391680fc1d3a6ebfb62f5b966464a..6c5a046a0cb53e887b126f386d6624c036735eb3 100644 (file)
@@ -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);
index a694ac2c38bba4550ac3c9c3d181725f1faed707..b8753d0cbfb48d464839ccb5fe2b4a82795ebcbc 100644 (file)
@@ -1728,8 +1728,7 @@ void drawnodespace(const bContext *C, ARegion *ar)
   draw_tree_path(snode);
 
   /* scrollers */
-  scrollers = UI_view2d_scrollers_calc(
-      C, v2d, NULL, 10, 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);
 }
index 8e9cd9743b626483c49d97238c7f12dcb45a0a2f..a8e3129b5b4d3e4eeb59f8e0595886fd70bfdcd5 100644 (file)
@@ -96,9 +96,8 @@ static void outliner_main_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);
 }
 
index 2fce8c42a24adec68cb7dd8f132040186a42c0d8..052917d16d02653a9f862ed3d9902741fd185c66 100644 (file)
@@ -2088,11 +2088,17 @@ void draw_timeline_seq(const bContext *C, ARegion *ar)
 
   /* scrollers */
   unit = (sseq->flag & SEQ_DRAWFRAMES) ? V2D_UNIT_FRAMES : V2D_UNIT_SECONDS;
-  scrollers = UI_view2d_scrollers_calc(
-      C, v2d, NULL, unit, V2D_GRID_CLAMP, V2D_UNIT_VALUES, V2D_GRID_CLAMP);
-  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 numbers */
+  View2DGrid *grid = UI_view2d_grid_calc(
+      scene, v2d, unit, V2D_GRID_CLAMP, V2D_UNIT_VALUES, V2D_GRID_CLAMP, ar->winx, ar->winy);
+  UI_view2d_grid_draw_numbers_horizontal(scene, v2d, grid, &v2d->hor, unit, true);
+  UI_view2d_grid_draw_numbers_vertical(scene, v2d, grid, &v2d->vert, V2D_UNIT_VALUES, 0.5f);
+  UI_view2d_grid_free(grid);
+
   /* draw current frame number-indicator on top of scrollers */
   if ((sseq->flag & SEQ_NO_DRAW_CFRANUM) == 0) {
     UI_view2d_view_orthoSpecial(ar, v2d, 1);