[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17689] branches/blender2.5/blender/source /blender/editors: View2D - assorted wip changes (nothing to see here)

Joshua Leung aligorith at gmail.com
Wed Dec 3 10:06:31 CET 2008


Revision: 17689
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17689
Author:   aligorith
Date:     2008-12-03 10:06:30 +0100 (Wed, 03 Dec 2008)

Log Message:
-----------
View2D - assorted wip changes (nothing to see here)

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/include/UI_view2d.h
    branches/blender2.5/blender/source/blender/editors/interface/view2d.c
    branches/blender2.5/blender/source/blender/editors/interface/view2d_ops.c
    branches/blender2.5/blender/source/blender/editors/space_outliner/space_outliner.c
    branches/blender2.5/blender/source/blender/editors/space_time/space_time.c

Modified: branches/blender2.5/blender/source/blender/editors/include/UI_view2d.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/include/UI_view2d.h	2008-12-03 07:51:12 UTC (rev 17688)
+++ branches/blender2.5/blender/source/blender/editors/include/UI_view2d.h	2008-12-03 09:06:30 UTC (rev 17689)
@@ -38,11 +38,14 @@
 /* generic value to use when coordinate lies out of view when converting */
 #define V2D_IS_CLIPPED	12000
 
-/* ---  Grids --- */
 /* grid-units (for drawing time) */
 #define V2D_UNIT_SECONDS	0
 #define V2D_UNIT_FRAMES		1
 
+/* grid-units (for drawing values) */
+#define V2D_UNIT_VALUES		2
+#define V2D_UNIT_DEGREES	3
+
 /* clamping of grid values to whole numbers */
 #define V2D_GRID_CLAMP		0
 #define V2D_GRID_NOCLAMP	1
@@ -53,7 +56,6 @@
 #define V2D_HORIZONTAL_AXIS		(1<<2)
 #define V2D_VERTICAL_AXIS		(1<<3)
 
-/* --- Scrollers --- */
 
 /* ------------------------------------------ */
 /* Macros:								*/
@@ -92,7 +94,7 @@
 void UI_view2d_free_grid(View2DGrid *grid);
 
 /* scrollbar drawing */
-View2DScrollers *UI_view2d_calc_scrollers(const struct bContext *C, struct View2D *v2d, short units, short clamp);
+View2DScrollers *UI_view2d_calc_scrollers(const struct bContext *C, struct View2D *v2d, short xunits, short xclamp, short yunits, short yclamp);
 void UI_view2d_draw_scrollers(const struct bContext *C, struct View2D *v2d, View2DScrollers *scrollers, int flag);
 void UI_view2d_free_scrollers(View2DScrollers *scrollers);
 

Modified: branches/blender2.5/blender/source/blender/editors/interface/view2d.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/interface/view2d.c	2008-12-03 07:51:12 UTC (rev 17688)
+++ branches/blender2.5/blender/source/blender/editors/interface/view2d.c	2008-12-03 09:06:30 UTC (rev 17689)
@@ -628,7 +628,7 @@
 };
 
 /* Calculate relevant scroller properties */
-View2DScrollers *UI_view2d_calc_scrollers(const bContext *C, View2D *v2d, short units, short clamp)
+View2DScrollers *UI_view2d_calc_scrollers(const bContext *C, View2D *v2d, short xunits, short xclamp, short yunits, short yclamp)
 {
 	View2DScrollers *scrollers;
 	rcti vert, hor;
@@ -640,12 +640,14 @@
 	/* scrollers is allocated here... */
 	scrollers= MEM_callocN(sizeof(View2DScrollers), "View2DScrollers");
 	
-	/* slider 'buttons':
+	/* scroller 'buttons':
 	 *	- These should always remain within the visible region of the scrollbar
 	 *	- They represent the region of 'tot' that is visible in 'cur'
 	 */
-	/* slider 'button' extents - horizontal */
+	
+	/* horizontal scrollers */
 	if (v2d->scroll & (HOR_SCROLL|HOR_SCROLLO)) {
+		/* slider 'button' extents */
 		totsize= v2d->tot.xmax - v2d->tot.xmin;
 		scrollsize= hor.xmax - hor.xmin;
 		
@@ -661,8 +663,9 @@
 			scrollers->hor_min= scrollers->hor_max;
 	}
 	
-	/* slider 'button' extents - vertical */
+	/* vertical scrollers */
 	if (v2d->scroll & VERT_SCROLL) {
+		/* slider 'button' extents */
 		totsize= v2d->tot.ymax - v2d->tot.ymin;
 		scrollsize= vert.ymax - vert.ymin;
 		

Modified: branches/blender2.5/blender/source/blender/editors/interface/view2d_ops.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/interface/view2d_ops.c	2008-12-03 07:51:12 UTC (rev 17688)
+++ branches/blender2.5/blender/source/blender/editors/interface/view2d_ops.c	2008-12-03 09:06:30 UTC (rev 17689)
@@ -51,6 +51,32 @@
 /* ********************************************************* */
 /* General Polling Funcs */
 
+/* Check if mouse is within scrollbars 
+ *	- Returns true or false (1 or 0)
+ *	
+ *	- x,y	= mouse coordinates in screen (not region) space
+ */
+static short mouse_in_v2d_scrollers (const bContext *C, View2D *v2d, int x, int y)
+{
+	ARegion *ar= C->region;
+	int co[2];
+	
+	/* clamp x,y to region-coordinates first */
+	// FIXME: is this needed?
+	co[0]= x - ar->winrct.xmin;
+	co[1]= y - ar->winrct.ymin;
+	
+	/* check if within scrollbars */
+	if (v2d->scroll & (HOR_SCROLL|HOR_SCROLLO)) {
+		if (IN_2D_HORIZ_SCROLL(v2d, co)) return 1;
+	}
+	if (v2d->scroll & VERT_SCROLL) {
+		if (IN_2D_VERT_SCROLL(v2d, co)) return 1;
+	}	
+	
+	/* not found */
+	return 0;
+} 
 
 
 /* ********************************************************* */
@@ -76,6 +102,8 @@
 		/* options for version 1 */
 	int startx, starty;		/* mouse x/y values in window when operator was initiated */
 	int lastx, lasty;		/* previous x/y values of mouse in window */
+	
+	short in_scroller;		/* activated in scrollbar */
 } v2dViewPanData;
  
 /* initialise panning customdata */

Modified: branches/blender2.5/blender/source/blender/editors/space_outliner/space_outliner.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_outliner/space_outliner.c	2008-12-03 07:51:12 UTC (rev 17688)
+++ branches/blender2.5/blender/source/blender/editors/space_outliner/space_outliner.c	2008-12-03 09:06:30 UTC (rev 17689)
@@ -423,7 +423,7 @@
 	UI_view2d_view_restore(C);
 	
 	/* scrollers */
-	scrollers= UI_view2d_calc_scrollers(C, v2d, 0, 0); // XXX last two vars here are useless
+	scrollers= UI_view2d_calc_scrollers(C, v2d, 0, 0, 0, 0); // XXX last two vars here are useless
 	UI_view2d_draw_scrollers(C, v2d, scrollers, (0));
 	UI_view2d_free_scrollers(scrollers);
 }

Modified: branches/blender2.5/blender/source/blender/editors/space_time/space_time.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_time/space_time.c	2008-12-03 07:51:12 UTC (rev 17688)
+++ branches/blender2.5/blender/source/blender/editors/space_time/space_time.c	2008-12-03 09:06:30 UTC (rev 17689)
@@ -152,7 +152,7 @@
 	UI_view2d_view_restore(C);
 	
 	/* scrollers */
-	scrollers= UI_view2d_calc_scrollers(C, v2d, unit, V2D_GRID_CLAMP);
+	scrollers= UI_view2d_calc_scrollers(C, v2d, unit, V2D_GRID_CLAMP, 0, 0);
 	UI_view2d_draw_scrollers(C, v2d, scrollers, (0));
 	UI_view2d_free_scrollers(scrollers);
 }





More information about the Bf-blender-cvs mailing list