[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [26468] trunk/blender/source/blender: Various tweaks to View2D code for handling of scrollbar interactions in relation to bug 19881 :
Joshua Leung
aligorith at gmail.com
Sun Jan 31 12:13:33 CET 2010
Revision: 26468
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26468
Author: aligorith
Date: 2010-01-31 12:13:31 +0100 (Sun, 31 Jan 2010)
Log Message:
-----------
Various tweaks to View2D code for handling of scrollbar interactions in relation to bug 19881:
* Clearly labelled the way that the scrollbar hiding works. Also see the report comments for an overview
* Added another pair of flags for another one of the cases in which scrollbars should also get ignored; when the entire contents of the view are visible, a pair of flags is now set in the view2d data (instead of for the scrollers tempdata only) for detecting this case too
* Fixed the potential for scrollbars without zoom handles shown to have those handles still considered. This still happened in the User Preferences window, but has now been disabled.
--
These changes still don't solve the bug though. Currently after the scrollbar operator passes through, the Outliner's activate-selection operators still fail to start.
Modified Paths:
--------------
trunk/blender/source/blender/editors/interface/interface_draw.c
trunk/blender/source/blender/editors/interface/interface_handlers.c
trunk/blender/source/blender/editors/interface/view2d.c
trunk/blender/source/blender/editors/interface/view2d_ops.c
trunk/blender/source/blender/makesdna/DNA_view2d_types.h
Modified: trunk/blender/source/blender/editors/interface/interface_draw.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_draw.c 2010-01-31 11:01:13 UTC (rev 26467)
+++ trunk/blender/source/blender/editors/interface/interface_draw.c 2010-01-31 11:13:31 UTC (rev 26468)
@@ -731,7 +731,7 @@
glScissor(ar->winrct.xmin + (rect.xmin-1), ar->winrct.ymin+(rect.ymin-1), (rect.xmax+1)-(rect.xmin-1), (rect.ymax+1)-(rect.ymin-1));
for (rgb=0; rgb<3; rgb++) {
- float *data;
+ float *data = NULL;
if (rgb==0) data = hist->data_r;
else if (rgb==1) data = hist->data_g;
Modified: trunk/blender/source/blender/editors/interface/interface_handlers.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_handlers.c 2010-01-31 11:01:13 UTC (rev 26467)
+++ trunk/blender/source/blender/editors/interface/interface_handlers.c 2010-01-31 11:13:31 UTC (rev 26468)
@@ -4234,13 +4234,13 @@
mask_rct.ymin= v2d->mask.ymin;
mask_rct.ymax= v2d->mask.ymax;
- if (v2d->scroll & V2D_SCROLL_VERTICAL_HIDE) {
+ if (v2d->scroll & (V2D_SCROLL_VERTICAL_HIDE|V2D_SCROLL_VERTICAL_FULLR)) {
if (v2d->scroll & V2D_SCROLL_LEFT)
mask_rct.xmin= v2d->vert.xmin;
else if (v2d->scroll & V2D_SCROLL_RIGHT)
mask_rct.xmax= v2d->vert.xmax;
}
- if (v2d->scroll & V2D_SCROLL_HORIZONTAL_HIDE) {
+ if (v2d->scroll & (V2D_SCROLL_HORIZONTAL_HIDE|V2D_SCROLL_HORIZONTAL_FULLR)) {
if (v2d->scroll & (V2D_SCROLL_BOTTOM|V2D_SCROLL_BOTTOM_O))
mask_rct.ymin= v2d->hor.ymin;
else if (v2d->scroll & V2D_SCROLL_TOP)
Modified: trunk/blender/source/blender/editors/interface/view2d.c
===================================================================
--- trunk/blender/source/blender/editors/interface/view2d.c 2010-01-31 11:01:13 UTC (rev 26467)
+++ trunk/blender/source/blender/editors/interface/view2d.c 2010-01-31 11:13:31 UTC (rev 26468)
@@ -62,7 +62,12 @@
/* *********************************************************************** */
-/* helper to allow scrollbars to dynamically hide */
+/* helper to allow scrollbars to dynamically hide
+ * - returns a copy of the scrollbar settings with the flags to display
+ * horizontal/vertical scrollbars removed
+ * - input scroll value is the v2d->scroll var
+ * - hide flags are set per region at drawtime
+ */
static int view2d_scroll_mapped(int scroll)
{
if(scroll & V2D_SCROLL_HORIZONTAL_HIDE)
@@ -1411,10 +1416,14 @@
CLAMP(scrollers->hor_min, hor.xmin, hor.xmax-V2D_SCROLLER_HANDLE_SIZE);
}
- /* check whether sliders can disappear */
+ /* check whether sliders can disappear due to the full-range being used */
if(v2d->keeptot) {
- if(fac1 <= 0.0f && fac2 >= 1.0f)
+ if ((fac1 <= 0.0f) && (fac2 >= 1.0f)) {
+ v2d->scroll |= V2D_SCROLL_HORIZONTAL_FULLR;
scrollers->horfull= 1;
+ }
+ else
+ v2d->scroll &= ~V2D_SCROLL_HORIZONTAL_FULLR;
}
}
@@ -1448,10 +1457,14 @@
CLAMP(scrollers->vert_min, vert.ymin, vert.ymax-V2D_SCROLLER_HANDLE_SIZE);
}
- /* check whether sliders can disappear */
+ /* check whether sliders can disappear due to the full-range being used */
if(v2d->keeptot) {
- if(fac1 <= 0.0f && fac2 >= 1.0f)
+ if ((fac1 <= 0.0f) && (fac2 >= 1.0f)) {
+ v2d->scroll |= V2D_SCROLL_VERTICAL_FULLR;
scrollers->vertfull= 1;
+ }
+ else
+ v2d->scroll &= ~V2D_SCROLL_VERTICAL_FULLR;
}
}
Modified: trunk/blender/source/blender/editors/interface/view2d_ops.c
===================================================================
--- trunk/blender/source/blender/editors/interface/view2d_ops.c 2010-01-31 11:01:13 UTC (rev 26467)
+++ trunk/blender/source/blender/editors/interface/view2d_ops.c 2010-01-31 11:13:31 UTC (rev 26468)
@@ -1414,6 +1414,18 @@
scroller_activate_init(C, op, event, in_scroller);
vsm= (v2dScrollerMove *)op->customdata;
+ /* check if zoom zones are inappropriate (i.e. zoom widgets not shown), so cannot continue
+ * NOTE: see view2d.c for latest conditions, and keep this in sync with that
+ */
+ if (ELEM(vsm->zone, SCROLLHANDLE_MIN, SCROLLHANDLE_MAX)) {
+ if ( ((vsm->scroller=='h') && (v2d->scroll & V2D_SCROLL_SCALE_HORIZONTAL)==0) ||
+ ((vsm->scroller=='v') && (v2d->scroll & V2D_SCROLL_SCALE_VERTICAL)==0) )
+ {
+ /* switch to bar (i.e. no scaling gets handled) */
+ vsm->zone= SCROLLHANDLE_BAR;
+ }
+ }
+
/* check if zone is inappropriate (i.e. 'bar' but panning is banned), so cannot continue */
if (vsm->zone == SCROLLHANDLE_BAR) {
if ( ((vsm->scroller=='h') && (v2d->keepofs & V2D_LOCKOFS_X)) ||
@@ -1426,15 +1438,21 @@
return OPERATOR_PASS_THROUGH;
}
}
+
/* zone is also inappropriate if scroller is not visible... */
- if ( ((vsm->scroller=='h') && (v2d->scroll & V2D_SCROLL_HORIZONTAL_HIDE)) ||
- ((vsm->scroller=='v') && (v2d->scroll & V2D_SCROLL_VERTICAL_HIDE)) )
+ if ( ((vsm->scroller=='h') && (v2d->scroll & (V2D_SCROLL_HORIZONTAL_HIDE|V2D_SCROLL_HORIZONTAL_FULLR))) ||
+ ((vsm->scroller=='v') && (v2d->scroll & (V2D_SCROLL_VERTICAL_HIDE|V2D_SCROLL_VERTICAL_FULLR))) )
{
+ /* free customdata initialised */
+ scroller_activate_exit(C, op);
+
/* can't catch this event for ourselves, so let it go to someone else? */
+ // FIXME: still this doesn't fall through to the item_activate callback for the outliner...
return OPERATOR_PASS_THROUGH;
}
- if(vsm->scroller=='h')
+ /* activate the scroller */
+ if (vsm->scroller=='h')
v2d->scroll_ui |= V2D_SCROLL_H_ACTIVE;
else
v2d->scroll_ui |= V2D_SCROLL_V_ACTIVE;
Modified: trunk/blender/source/blender/makesdna/DNA_view2d_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_view2d_types.h 2010-01-31 11:01:13 UTC (rev 26467)
+++ trunk/blender/source/blender/makesdna/DNA_view2d_types.h 2010-01-31 11:13:31 UTC (rev 26468)
@@ -124,9 +124,12 @@
#define V2D_SCROLL_SCALE_VERTICAL (1<<5)
/* scale markings - horizontal */
#define V2D_SCROLL_SCALE_HORIZONTAL (1<<6)
- /* disable draw temporary */
+ /* induce hiding of scrollbars - set by region drawing in response to size of region */
#define V2D_SCROLL_VERTICAL_HIDE (1<<7)
#define V2D_SCROLL_HORIZONTAL_HIDE (1<<8)
+ /* scrollbar extends beyond its available window - set when calculating scrollbars for drawing */
+#define V2D_SCROLL_VERTICAL_FULLR (1<<9)
+#define V2D_SCROLL_HORIZONTAL_FULLR (1<<10)
/* scroll_ui, activate flag for drawing */
#define V2D_SCROLL_H_ACTIVE (1<<0)
More information about the Bf-blender-cvs
mailing list