Some UI tweaks as listed by William
authorJoshua Leung <aligorith@gmail.com>
Wed, 23 Sep 2009 11:49:12 +0000 (11:49 +0000)
committerJoshua Leung <aligorith@gmail.com>
Wed, 23 Sep 2009 11:49:12 +0000 (11:49 +0000)
(http://wiki.blender.org/index.php/BlenderDev/Blender2.5/Todo/UserInterface)

* Removed panel docking. "It is too easy to do by accident when reordering panels, is very hard to control and use, and has no real benefit."

* Scoll bars have minimum size now, so that the 'thumb' doesn't disappear in long lists.

source/blender/editors/interface/interface_panel.c
source/blender/editors/interface/view2d.c

index cf29a1ddb584f125ebe5291a20841ff6056c1db4..fa24aa72b9f82d180848da2dcf4afb8ecb1cac40 100644 (file)
@@ -963,6 +963,7 @@ static void check_panel_overlap(ARegion *ar, Panel *panel)
        }
 }
 
+#if 0 // XXX panel docking/tabbing code that's no longer used
 static void test_add_new_tabs(ARegion *ar)
 {
        Panel *pa, *pasel=NULL, *palap=NULL;
@@ -1016,6 +1017,7 @@ static void test_add_new_tabs(ARegion *ar)
                pa= pa->next;
        }
 }
+#endif
 
 /************************ panel dragging ****************************/
 
@@ -1382,7 +1384,12 @@ static void panel_activate_state(const bContext *C, Panel *pa, uiHandlePanelStat
 
        if(state == PANEL_STATE_EXIT || state == PANEL_STATE_ANIMATION) {
                if(data && data->state != PANEL_STATE_ANIMATION) {
-                       test_add_new_tabs(ar);   // also copies locations of tabs in dragged panel
+                       /* XXX:
+                        *      - the panel tabbing function call below (test_add_new_tabs()) has been commented out
+                        *        "It is too easy to do by accident when reordering panels, is very hard to control and use, and has no real benefit." - BillRey
+                        * Aligorith, 2009Sep
+                        */
+                       //test_add_new_tabs(ar);   // also copies locations of tabs in dragged panel
                        check_panel_overlap(ar, NULL);  // clears
                }
 
index f9fb7a9306f25ef210b1c9979b1a9969c7df982e..be58a78ca859908082b25af9418ccdf86e2e8b51 100644 (file)
@@ -1351,7 +1351,7 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short
        vert= v2d->vert;
        hor= v2d->hor;
        
-       /* slider rects smaller than region */
+       /* slider rects need to be smaller than region */
        hor.xmin+=4;
        hor.xmax-=4;
        if (scroll & V2D_SCROLL_BOTTOM)
@@ -1393,13 +1393,18 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short
                else
                        scrollers->hor_max= (int)(hor.xmin + (fac2 * scrollsize));
                
+               /* prevent inverted sliders */
                if (scrollers->hor_min > scrollers->hor_max) 
                        scrollers->hor_min= scrollers->hor_max;
+               /* prevent sliders from being too small, and disappearing */
+               if ((scrollers->hor_max - scrollers->hor_min) < V2D_SCROLLER_HANDLE_SIZE)
+                       scrollers->hor_max+= V2D_SCROLLER_HANDLE_SIZE;
                
                /* check whether sliders can disappear */
-               if(v2d->keeptot)
+               if(v2d->keeptot) {
                        if(fac1 <= 0.0f && fac2 >= 1.0f) 
                                scrollers->horfull= 1;
+               }
        }
        
        /* vertical scrollers */
@@ -1420,13 +1425,18 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short
                else
                        scrollers->vert_max= (int)(vert.ymin + (fac2 * scrollsize));
                
+               /* prevent inverted sliders */
                if (scrollers->vert_min > scrollers->vert_max) 
                        scrollers->vert_min= scrollers->vert_max;
+               /* prevent sliders from being too small, and disappearing */
+               if ((scrollers->vert_max - scrollers->vert_min) < V2D_SCROLLER_HANDLE_SIZE)
+                       scrollers->vert_max+= V2D_SCROLLER_HANDLE_SIZE;
                
                /* check whether sliders can disappear */
-               if(v2d->keeptot)
+               if(v2d->keeptot) {
                        if(fac1 <= 0.0f && fac2 >= 1.0f) 
                                scrollers->vertfull= 1;
+               }
        }
        
        /* grid markings on scrollbars */
@@ -1550,14 +1560,6 @@ static void scroll_printstr(View2DScrollers *scrollers, Scene *scene, float x, f
        BLF_draw_default(x, y, 0.0f, str);
 }
 
-/* local defines for scrollers drawing */
-       /* radius of scroller 'button' caps */
-#define V2D_SCROLLCAP_RAD              5
-       /* shading factor for scroller 'bar' */
-#define V2D_SCROLLBAR_SHADE            0.1f
-       /* shading factor for scroller 'button' caps */
-#define V2D_SCROLLCAP_SHADE            0.2f
-
 /* Draw scrollbars in the given 2d-region */
 void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *vs)
 {
@@ -1571,7 +1573,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
        
        /* horizontal scrollbar */
        if (scroll & V2D_SCROLL_HORIZONTAL) {
-               
+               /* only draw scrollbar when it doesn't fill the entire space */
                if(vs->horfull==0) {
                        bTheme *btheme= U.themes.first;
                        uiWidgetColors wcol= btheme->tui.wcol_scroll;
@@ -1584,13 +1586,15 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
                        slider.ymax= hor.ymax;
                        
                        state= (v2d->scroll_ui & V2D_SCROLL_H_ACTIVE)?UI_SCROLL_PRESSED:0;
+                       
+                       // TODO: disable this for button regions... 
                        if (!(v2d->keepzoom & V2D_LOCKZOOM_X))
                                state |= UI_SCROLL_ARROWS;
+                               
                        uiWidgetScrollDraw(&wcol, &hor, &slider, state);
                }
                
                /* scale indicators */
-               // XXX will need to update the font drawing when the new stuff comes in
                if ((scroll & V2D_SCROLL_SCALE_HORIZONTAL) && (vs->grid)) {
                        View2DGrid *grid= vs->grid;
                        float fac, dfac, fac2, val;
@@ -1667,7 +1671,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
        
        /* vertical scrollbar */
        if (scroll & V2D_SCROLL_VERTICAL) {
-               
+               /* only draw scrollbar when it doesn't fill the entire space */
                if(vs->vertfull==0) {
                        bTheme *btheme= U.themes.first;
                        uiWidgetColors wcol= btheme->tui.wcol_scroll;
@@ -1680,14 +1684,16 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
                        slider.ymax= vs->vert_max;
                        
                        state= (v2d->scroll_ui & V2D_SCROLL_V_ACTIVE)?UI_SCROLL_PRESSED:0;
-                       if (!(v2d->keepzoom & V2D_LOCKZOOM_Y))
+                       
+                       // TODO: disable this for button regions...
+                       if (!(v2d->keepzoom & V2D_LOCKZOOM_Y)) 
                                state |= UI_SCROLL_ARROWS;
+                               
                        uiWidgetScrollDraw(&wcol, &vert, &slider, state);
                }
                
                
                /* scale indiators */
-               // XXX will need to update the font drawing when the new stuff comes in
                if ((scroll & V2D_SCROLL_SCALE_VERTICAL) && (vs->grid)) {
                        View2DGrid *grid= vs->grid;
                        float fac, dfac, val;