View2D: Minor tweaks to scrollbar drawing
authorJoshua Leung <aligorith@gmail.com>
Sun, 7 Dec 2008 22:19:41 +0000 (22:19 +0000)
committerJoshua Leung <aligorith@gmail.com>
Sun, 7 Dec 2008 22:19:41 +0000 (22:19 +0000)
Handles on ends of bubble are now drawn as rects. When that axis is zoomable, the handles are darker than when they are not.

source/blender/editors/interface/view2d.c
source/blender/makesdna/DNA_view2d_types.h

index 836228eb18479b96eda8e7f97e502e221787c39e..894e6082d92fce55e593f889ce64f58b9808620c 100644 (file)
@@ -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 */
index 4d027f2efea32eee0581b4747053b3105bea4f7f..8ae70605d47041d40c076f0383541f37a86d9618 100644 (file)
@@ -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) */