diff options
author | Joshua Leung <aligorith@gmail.com> | 2008-12-08 01:19:41 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2008-12-08 01:19:41 +0300 |
commit | 63b8fca5b3decef4b1f5e0b74587daddd26b73fb (patch) | |
tree | 8f90f1e388fd6ed93f53a54518acd7d1459ad68a /source/blender | |
parent | f4d823fa029133d5837e1b25f02c1326f3723a93 (diff) |
View2D: Minor tweaks to scrollbar drawing
Handles on ends of bubble are now drawn as rects. When that axis is zoomable, the handles are darker than when they are not.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/interface/view2d.c | 36 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_view2d_types.h | 2 |
2 files changed, 26 insertions, 12 deletions
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index 836228eb184..894e6082d92 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -934,7 +934,7 @@ static void scroll_printstr(View2DScrollers *scrollers, float x, float y, float /* Draw scrollbars in the given 2d-region */ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *scrollers) { - const int darker= -40, dark= 0, light= 20, lighter= 50; + const int darker= -50, midark= -20, dark= 0, light= 20, lighter= 50; rcti vert, hor; vert= v2d->vert; @@ -952,12 +952,19 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *s UI_ThemeColorShade(TH_SHADE1, dark); glRecti(scrollers->hor_min, hor.ymin+2, scrollers->hor_max, hor.ymax-2); - /* draw lines on either end of 'box' */ - glLineWidth(2.0); + /* draw 'handles' on either end of bar */ + if ((v2d->keepzoom & V2D_LOCKZOOM_X)==0) UI_ThemeColorShade(TH_SHADE1, darker); - sdrawline(scrollers->hor_min, hor.ymin+2, scrollers->hor_min, hor.ymax-2); - sdrawline(scrollers->hor_max, hor.ymin+2, scrollers->hor_max, hor.ymax-2); - glLineWidth(1.0); + else + UI_ThemeColorShade(TH_SHADE1, midark); + + /* 'minimum' handle */ + glRecti(scrollers->hor_min-V2D_SCROLLER_HANDLE_SIZE, hor.ymin+2, + scrollers->hor_min+V2D_SCROLLER_HANDLE_SIZE, hor.ymax-2); + + /* maximum handle */ + glRecti(scrollers->hor_max-V2D_SCROLLER_HANDLE_SIZE, hor.ymin+2, + scrollers->hor_max+V2D_SCROLLER_HANDLE_SIZE, hor.ymax-2); } /* scale indicators */ @@ -1044,12 +1051,19 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *s UI_ThemeColorShade(TH_SHADE1, dark); glRecti(vert.xmin+2, scrollers->vert_min, vert.xmax-2, scrollers->vert_max); - /* draw lines on either end of 'box' */ - glLineWidth(2.0); + /* draw 'handles' on either end of bar */ + if ((v2d->keepzoom & V2D_LOCKZOOM_Y)==0) UI_ThemeColorShade(TH_SHADE1, darker); - sdrawline(vert.xmin+2, scrollers->vert_min, vert.xmax-2, scrollers->vert_min); - sdrawline(vert.xmin+2, scrollers->vert_max, vert.xmax-2, scrollers->vert_max); - glLineWidth(1.0); + else + UI_ThemeColorShade(TH_SHADE1, midark); + + /* 'minimum' handle */ + glRecti(vert.xmin+2, scrollers->vert_min-V2D_SCROLLER_HANDLE_SIZE, + vert.xmax-2, scrollers->vert_min+V2D_SCROLLER_HANDLE_SIZE); + + /* maximum handle */ + glRecti(vert.xmin+2, scrollers->vert_max-V2D_SCROLLER_HANDLE_SIZE, + vert.xmax-2, scrollers->vert_max+V2D_SCROLLER_HANDLE_SIZE); } /* scale indiators */ diff --git a/source/blender/makesdna/DNA_view2d_types.h b/source/blender/makesdna/DNA_view2d_types.h index 4d027f2efea..8ae70605d47 100644 --- a/source/blender/makesdna/DNA_view2d_types.h +++ b/source/blender/makesdna/DNA_view2d_types.h @@ -83,7 +83,7 @@ typedef struct View2D { #define V2D_SCROLL_WIDTH 16 /* half the size (in pixels) of scroller 'handles' */ -#define V2D_SCROLLER_HANDLE_SIZE 8 +#define V2D_SCROLLER_HANDLE_SIZE 5 /* scroller flags for View2D (v2d->scroll) */ |