[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [23435] trunk/blender/source/blender/ editors/interface: Some UI tweaks as listed by William

Joshua Leung aligorith at gmail.com
Wed Sep 23 13:49:14 CEST 2009


Revision: 23435
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23435
Author:   aligorith
Date:     2009-09-23 13:49:12 +0200 (Wed, 23 Sep 2009)

Log Message:
-----------
Some UI tweaks as listed by William 
(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. 

Modified Paths:
--------------
    trunk/blender/source/blender/editors/interface/interface_panel.c
    trunk/blender/source/blender/editors/interface/view2d.c

Modified: trunk/blender/source/blender/editors/interface/interface_panel.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_panel.c	2009-09-23 11:26:16 UTC (rev 23434)
+++ trunk/blender/source/blender/editors/interface/interface_panel.c	2009-09-23 11:49:12 UTC (rev 23435)
@@ -963,6 +963,7 @@
 	}
 }
 
+#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 @@
 		pa= pa->next;
 	}
 }
+#endif
 
 /************************ panel dragging ****************************/
 
@@ -1382,7 +1384,12 @@
 
 	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
 		}
 

Modified: trunk/blender/source/blender/editors/interface/view2d.c
===================================================================
--- trunk/blender/source/blender/editors/interface/view2d.c	2009-09-23 11:26:16 UTC (rev 23434)
+++ trunk/blender/source/blender/editors/interface/view2d.c	2009-09-23 11:49:12 UTC (rev 23435)
@@ -1351,7 +1351,7 @@
 	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 @@
 		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 @@
 		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 @@
 	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 @@
 	
 	/* 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 @@
 			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 @@
 	
 	/* 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 @@
 			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;





More information about the Bf-blender-cvs mailing list