[Bf-blender-cvs] [f4b3975] UI-graphical-redesign: Make scrollbars thinner! (And draw them without outline)

Julian Eisel noreply at git.blender.org
Tue Jun 2 20:11:14 CEST 2015


Commit: f4b3975d65792f8cdb258fcdce6d3af6321e6e88
Author: Julian Eisel
Date:   Tue Jun 2 19:02:24 2015 +0200
Branches: UI-graphical-redesign
https://developer.blender.org/rBf4b3975d65792f8cdb258fcdce6d3af6321e6e88

Make scrollbars thinner! (And draw them without outline)

Scrollbars with units printed on them stay the same size.

===================================================================

M	source/blender/blenloader/intern/versioning_270.c
M	source/blender/editors/include/UI_view2d.h
M	source/blender/editors/interface/interface_widgets.c
M	source/blender/editors/interface/view2d.c
M	source/blender/editors/space_action/space_action.c
M	source/blender/editors/space_graph/space_graph.c
M	source/blender/editors/space_nla/space_nla.c
M	source/blender/editors/space_sequencer/space_sequencer.c
M	source/blender/editors/space_time/space_time.c
M	source/blender/makesdna/DNA_view2d_types.h

===================================================================

diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c
index df98544..1e54aa8 100644
--- a/source/blender/blenloader/intern/versioning_270.c
+++ b/source/blender/blenloader/intern/versioning_270.c
@@ -831,4 +831,40 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
 			}
 		}
 	}
+
+	{
+		bScreen *screen;
+		for (screen = main->screen.first; screen; screen = screen->id.next) {
+			ScrArea *sa;
+
+			for (sa = screen->areabase.first; sa; sa = sa->next) {
+				ARegion *ar;
+				SpaceLink *sl;
+
+				for (ar = sa->regionbase.first; ar; ar = ar->next) {
+					if (ar->regiontype == RGN_TYPE_WINDOW) {
+						break;
+					}
+				}
+
+				if (ar) {
+					for (sl = sa->spacedata.first; sl; sl = sl->next) {
+						switch (sl->spacetype) {
+							case SPACE_TIME:
+							case SPACE_ACTION:
+							case SPACE_NLA:
+								ar->v2d.flag |= V2D_USES_UNITS_HORIZONTAL;
+								break;
+							case SPACE_IPO:
+							case SPACE_SEQ:
+								ar->v2d.flag |= (V2D_USES_UNITS_HORIZONTAL | V2D_USES_UNITS_VERTICAL);
+								break;
+							default:
+								break;
+						}
+					}
+				}
+			}
+		}
+	}
 }
diff --git a/source/blender/editors/include/UI_view2d.h b/source/blender/editors/include/UI_view2d.h
index 2c8f5f6..43a5584 100644
--- a/source/blender/editors/include/UI_view2d.h
+++ b/source/blender/editors/include/UI_view2d.h
@@ -103,8 +103,10 @@ enum eView2D_Gridlines {
 /* ------ Defines for Scrollers ----- */
 
 /* scroller area */
-#define V2D_SCROLL_HEIGHT   (0.85f * U.widget_unit)
-#define V2D_SCROLL_WIDTH    (0.85f * U.widget_unit)
+#define V2D_SCROLL_HEIGHT      (0.50f * U.widget_unit)
+#define V2D_SCROLL_WIDTH       (0.50f * U.widget_unit)
+#define V2D_SCROLL_HEIGHT_TEXT (0.85f * U.widget_unit)
+#define V2D_SCROLL_WIDTH_TEXT  (0.85f * U.widget_unit)
 
 /* scroller 'handles' hotspot radius for mouse */
 #define V2D_SCROLLER_HANDLE_SIZE    (0.6f * U.widget_unit)
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 52020ff..03932c6 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -2742,6 +2742,7 @@ void UI_draw_widget_scroll(uiWidgetColors *wcol, const rcti *rect, const rcti *s
 		rad = wcol->roundness * BLI_rcti_size_x(rect);
 	
 	wtb.draw_shadedir = (horizontal) ? true : false;
+	wtb.draw_outline = false;
 	
 	/* draw back part, colors swapped and shading inverted */
 	if (horizontal)
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index 04ab500..0af8386 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -152,18 +152,21 @@ static void view2d_masks(View2D *v2d, int check_scrollers)
 	 *	- if they overlap, they must not occupy the corners (which are reserved for other widgets)
 	 */
 	if (scroll) {
+		const int scroll_width = (v2d->flag & V2D_USES_UNITS_VERTICAL) ? V2D_SCROLL_WIDTH_TEXT : V2D_SCROLL_WIDTH;
+		const int scroll_height = (v2d->flag & V2D_USES_UNITS_HORIZONTAL) ? V2D_SCROLL_HEIGHT_TEXT : V2D_SCROLL_HEIGHT;
+
 		/* vertical scroller */
 		if (scroll & V2D_SCROLL_LEFT) {
 			/* on left-hand edge of region */
 			v2d->vert = v2d->mask;
-			v2d->vert.xmax = V2D_SCROLL_WIDTH;
+			v2d->vert.xmax = scroll_width;
 			v2d->mask.xmin = v2d->vert.xmax + 1;
 		}
 		else if (scroll & V2D_SCROLL_RIGHT) {
 			/* on right-hand edge of region */
 			v2d->vert = v2d->mask;
 			v2d->vert.xmax++; /* one pixel extra... was leaving a minor gap... */
-			v2d->vert.xmin = v2d->vert.xmax - V2D_SCROLL_WIDTH;
+			v2d->vert.xmin = v2d->vert.xmax - scroll_width;
 			v2d->mask.xmax = v2d->vert.xmin - 1;
 		}
 		
@@ -171,13 +174,13 @@ static void view2d_masks(View2D *v2d, int check_scrollers)
 		if (scroll & (V2D_SCROLL_BOTTOM)) {
 			/* on bottom edge of region */
 			v2d->hor = v2d->mask;
-			v2d->hor.ymax = V2D_SCROLL_HEIGHT;
+			v2d->hor.ymax = scroll_height;
 			v2d->mask.ymin = v2d->hor.ymax + 1;
 		}
 		else if (scroll & V2D_SCROLL_TOP) {
 			/* on upper edge of region */
 			v2d->hor = v2d->mask;
-			v2d->hor.ymin = v2d->hor.ymax - V2D_SCROLL_HEIGHT;
+			v2d->hor.ymin = v2d->hor.ymax - scroll_height;
 			v2d->mask.ymax = v2d->hor.ymin - 1;
 		}
 		
diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c
index 5d0b34a..af16f9c 100644
--- a/source/blender/editors/space_action/space_action.c
+++ b/source/blender/editors/space_action/space_action.c
@@ -118,7 +118,7 @@ static SpaceLink *action_new(const bContext *C)
 	ar->v2d.keepzoom = V2D_LOCKZOOM_Y;
 	ar->v2d.keepofs = V2D_KEEPOFS_Y;
 	ar->v2d.align = V2D_ALIGN_NO_POS_Y;
-	ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
+	ar->v2d.flag = (V2D_VIEWSYNC_AREA_VERTICAL | V2D_USES_UNITS_HORIZONTAL);
 	
 	return (SpaceLink *)saction;
 }
diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c
index ad6f3ff..8b2f7e7 100644
--- a/source/blender/editors/space_graph/space_graph.c
+++ b/source/blender/editors/space_graph/space_graph.c
@@ -156,6 +156,7 @@ static SpaceLink *graph_new(const bContext *C)
 	
 	ar->v2d.scroll = (V2D_SCROLL_BOTTOM | V2D_SCROLL_SCALE_HORIZONTAL);
 	ar->v2d.scroll |= (V2D_SCROLL_LEFT | V2D_SCROLL_SCALE_VERTICAL);
+	ar->v2d.flag |= (V2D_USES_UNITS_HORIZONTAL | V2D_USES_UNITS_VERTICAL);
 	
 	ar->v2d.keeptot = 0;
 	
diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c
index ec58452..9da9ef3 100644
--- a/source/blender/editors/space_nla/space_nla.c
+++ b/source/blender/editors/space_nla/space_nla.c
@@ -158,7 +158,7 @@ static SpaceLink *nla_new(const bContext *C)
 	ar->v2d.keepzoom = V2D_LOCKZOOM_Y;
 	ar->v2d.keepofs = V2D_KEEPOFS_Y;
 	ar->v2d.align = V2D_ALIGN_NO_POS_Y;
-	ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
+	ar->v2d.flag = (V2D_VIEWSYNC_AREA_VERTICAL | V2D_USES_UNITS_HORIZONTAL);
 	
 	return (SpaceLink *)snla;
 }
diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c
index 769718e..704e6c5 100644
--- a/source/blender/editors/space_sequencer/space_sequencer.c
+++ b/source/blender/editors/space_sequencer/space_sequencer.c
@@ -190,6 +190,7 @@ static SpaceLink *sequencer_new(const bContext *C)
 	ar->v2d.keepzoom = 0;
 	ar->v2d.keeptot = 0;
 	ar->v2d.align = V2D_ALIGN_NO_NEG_Y;
+	ar->v2d.flag |= (V2D_USES_UNITS_HORIZONTAL | V2D_USES_UNITS_VERTICAL);
 
 	return (SpaceLink *)sseq;
 }
diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c
index 91a0970..dbd6bff 100644
--- a/source/blender/editors/space_time/space_time.c
+++ b/source/blender/editors/space_time/space_time.c
@@ -671,6 +671,7 @@ static SpaceLink *time_new(const bContext *C)
 	ar->v2d.align |= V2D_ALIGN_NO_NEG_Y;
 	ar->v2d.keepofs |= V2D_LOCKOFS_Y;
 	ar->v2d.keepzoom |= V2D_LOCKZOOM_Y;
+	ar->v2d.flag |= V2D_USES_UNITS_HORIZONTAL;
 
 
 	return (SpaceLink *)stime;
diff --git a/source/blender/makesdna/DNA_view2d_types.h b/source/blender/makesdna/DNA_view2d_types.h
index 6f2e347..4a01947 100644
--- a/source/blender/makesdna/DNA_view2d_types.h
+++ b/source/blender/makesdna/DNA_view2d_types.h
@@ -114,6 +114,9 @@ typedef struct View2D {
 #define V2D_PIXELOFS_Y				(1<<3)
 	/* view settings need to be set still... */
 #define V2D_IS_INITIALISED			(1<<10)
+	/* for screens that need to draw units on top of the scroller */
+#define V2D_USES_UNITS_VERTICAL     (1 << 11)
+#define V2D_USES_UNITS_HORIZONTAL   (1 << 12)
 
 /* scroller flags for View2D (v2d->scroll) */
 	/* left scrollbar */




More information about the Bf-blender-cvs mailing list