View2D - assorted wip changes (nothing to see here)

This commit is contained in:
2008-12-03 09:06:30 +00:00
parent 8f1847e4c3
commit 92cbb4b033
5 changed files with 42 additions and 9 deletions

View File

@@ -628,7 +628,7 @@ struct View2DScrollers {
};
/* 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 @@ View2DScrollers *UI_view2d_calc_scrollers(const bContext *C, View2D *v2d, short
/* 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 @@ View2DScrollers *UI_view2d_calc_scrollers(const bContext *C, View2D *v2d, short
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;

View File

@@ -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 @@ typedef struct v2dViewPanData {
/* 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 */