UI: make text editor scrollbar with consistent with other editors.
authorHarley Acheson <harley>
Fri, 4 Jan 2019 14:11:59 +0000 (15:11 +0100)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Fri, 4 Jan 2019 14:26:11 +0000 (15:26 +0100)
Differential Revision: https://developer.blender.org/D4144

source/blender/editors/space_text/text_draw.c

index aa499d52589698ba2de83be686c2cb47e11c9578..765bfbd9b83f12811772c0b80754b88b80aab26b 100644 (file)
@@ -798,22 +798,22 @@ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll, rcti *back)
        short barheight, barstart, hlstart, hlend, blank_lines;
        short pix_available, pix_top_margin, pix_bottom_margin, pix_bardiff;
 
-       pix_top_margin = 8;
-       pix_bottom_margin = 4;
+       pix_top_margin = (0.4 * U.widget_unit);
+       pix_bottom_margin = (0.4 * U.widget_unit);
        pix_available = ar->winy - pix_top_margin - pix_bottom_margin;
        ltexth = text_get_total_lines(st, ar);
        blank_lines = st->viewlines / 2;
 
        /* nicer code: use scroll rect for entire bar */
-       back->xmin = ar->winx - (V2D_SCROLL_WIDTH + 1);
+       back->xmin = ar->winx - (0.6 * U.widget_unit);
        back->xmax = ar->winx;
        back->ymin = 0;
        back->ymax = ar->winy;
 
-       scroll->xmin = ar->winx - V2D_SCROLL_WIDTH;
-       scroll->xmax = ar->winx - 5;
-       scroll->ymin = 4;
-       scroll->ymax = 4 + pix_available;
+       scroll->xmax = ar->winx - (0.2 * U.widget_unit);
+       scroll->xmin = scroll->xmax - (0.4 * U.widget_unit);
+       scroll->ymin = pix_top_margin;
+       scroll->ymax = pix_available;
 
        /* when re-sizing a view-port with the bar at the bottom to a greater height more blank lines will be added */
        if (ltexth + blank_lines < st->top + st->viewlines) {