Revision: 17839 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17839 Author: aligorith Date: 2008-12-14 12:50:28 +0100 (Sun, 14 Dec 2008)
Log Message: ----------- View2D: More scroller related things * Scrollers now keep corners free for drawing widgets if there are horizontal and vertical ones in use. They draw a rect which covers up all of the excess over-flowing drawing that was previously masked by the vertical scrollers. * Tweaked the behaviour of the scroller zoom-handles again as they still weren't behaving correctly on vertical scrollers. This was partly caused by a typo, but also wrong checks... Modified Paths: -------------- branches/blender2.5/blender/source/blender/editors/interface/view2d.c branches/blender2.5/blender/source/blender/editors/interface/view2d_ops.c Modified: branches/blender2.5/blender/source/blender/editors/interface/view2d.c =================================================================== --- branches/blender2.5/blender/source/blender/editors/interface/view2d.c 2008-12-14 11:43:38 UTC (rev 17838) +++ branches/blender2.5/blender/source/blender/editors/interface/view2d.c 2008-12-14 11:50:28 UTC (rev 17839) @@ -125,9 +125,8 @@ v2d->mask.ymax= v2d->hor.ymin - 1; } -#if 0 // FIXME: we currently have overlap bugs there... /* adjust vertical scroller if there's a horizontal scroller, to leave corner free */ - if (v2d->scroll & /*V2D_SCROLL_VERTICAL*/) { + if (v2d->scroll & V2D_SCROLL_VERTICAL) { /* just set y min/max for vertical scroller to y min/max of mask as appropriate */ if (v2d->scroll & (V2D_SCROLL_BOTTOM|V2D_SCROLL_BOTTOM_O)) { /* on bottom edge of region (V2D_SCROLL_BOTTOM_O is outliner, the other is for standard) */ @@ -138,7 +137,6 @@ v2d->vert.ymax= v2d->mask.ymax; } } -#endif } /* cope with unitialized veriables for simple cases, like header or outliner */ @@ -1081,7 +1079,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *vs) { const short darker= -50, dark= -10, light= 20, lighter= 50; - rcti vert, hor; + rcti vert, hor, corner; /* make copies of rects for less typing */ vert= v2d->vert; @@ -1325,6 +1323,29 @@ else if (v2d->scroll & V2D_SCROLL_LEFT) sdrawline(vert.xmax, vert.ymin, vert.xmax, vert.ymax); } + + /* draw a 'sunken square' to cover up any overlapping corners resulting from intersection of overflowing scroller data */ + if ((v2d->scroll & V2D_SCROLL_VERTICAL) && (v2d->scroll & V2D_SCROLL_HORIZONTAL)) { + /* set bounds (these should be right) */ + corner.xmin= vert.xmin; + corner.xmax= vert.xmax; + corner.ymin= hor.ymin; + corner.ymax= hor.ymax; + + /* firstly, draw using background color to cover up any overlapping junk */ + UI_ThemeColor(TH_SHADE1); + glRecti(corner.xmin, corner.ymin, corner.xmax, corner.ymax); + + /* now, draw suggestive highlighting... */ + /* first, dark lines on top to suggest scrollers overlap box */ + UI_ThemeColorShade(TH_SHADE1, darker); + sdrawline(corner.xmin, corner.ymin, corner.xmin, corner.ymax); + sdrawline(corner.xmin, corner.ymax, corner.xmax, corner.ymax); + /* now, light lines on bottom to show box is sunken in */ + UI_ThemeColorShade(TH_SHADE1, lighter); + sdrawline(corner.xmax, corner.ymin, corner.xmax, corner.ymax); + sdrawline(corner.xmin, corner.ymin, corner.xmax, corner.ymin); + } } /* free temporary memory used for drawing scrollers */ 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-14 11:43:38 UTC (rev 17838) +++ branches/blender2.5/blender/source/blender/editors/interface/view2d_ops.c 2008-12-14 11:50:28 UTC (rev 17839) @@ -868,16 +868,24 @@ */ static short mouse_in_scroller_handle(int mouse, int sc_min, int sc_max, int sh_min, int sh_max) { - short in_min, in_max; + short in_min, in_max, in_view=1; /* firstly, check if * - 'bubble' fills entire scroller * - 'bubble' completely out of view on either side */ - if ( ((sh_min <= sc_min) && (sh_max >= sc_max)) || - ((sh_min <= sc_min) && (sh_max <= sc_max)) || - ((sh_min >= sc_max) && (sh_max >= sc_max)) ) - { + if ((sh_min <= sc_min) && (sh_max >= sc_max)) in_view= 0; + if (sh_min == sh_max) { + if (sh_min <= sc_min) in_view= 0; + if (sh_max >= sc_max) in_view= 0; + } + else { + if (sh_max <= sc_min) in_view= 0; + if (sh_min >= sc_max) in_view= 0; + } + + + if (in_view == 0) { /* handles are only activated if the mouse is within the relative quater lengths of the scroller */ int qLen = (sc_max + sc_min) / 4; @@ -890,15 +898,15 @@ } /* check if mouse is in or past either handle */ - in_max= (mouse >= (sh_max - V2D_SCROLLER_HANDLE_SIZE)); - in_min= (mouse <= (sh_min + V2D_SCROLLER_HANDLE_SIZE)); + in_max= ( (mouse >= (sh_max - V2D_SCROLLER_HANDLE_SIZE)) && (mouse <= (sh_max + V2D_SCROLLER_HANDLE_SIZE)) ); + in_min= ( (mouse <= (sh_min + V2D_SCROLLER_HANDLE_SIZE)) && (mouse >= (sh_min - V2D_SCROLLER_HANDLE_SIZE)) ); /* check if overlap --> which means user clicked on bar, as bar is within handles region */ if (in_max && in_min) return SCROLLHANDLE_BAR; - if (in_max) + else if (in_max) return SCROLLHANDLE_MAX; - if (in_min) + else if (in_min) return SCROLLHANDLE_MIN; /* unlikely to happen, though we just cover it in case */ @@ -960,7 +968,7 @@ } else { /* check which handle we're in */ - vsm->zone= mouse_in_scroller_handle(y, v2d->vert.xmin, v2d->vert.xmax, scrollers->vert_min, scrollers->vert_max); + vsm->zone= mouse_in_scroller_handle(y, v2d->vert.ymin, v2d->vert.ymax, scrollers->vert_min, scrollers->vert_max); } } UI_view2d_scrollers_free(scrollers); _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs