[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17699] branches/blender2.5/blender/source /blender/editors/interface: 2.5
Ton Roosendaal
ton at blender.org
Wed Dec 3 19:14:52 CET 2008
Revision: 17699
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17699
Author: ton
Date: 2008-12-03 19:14:52 +0100 (Wed, 03 Dec 2008)
Log Message:
-----------
2.5
Another view2d fix: buttons now get clipped for region and mask, so
sliders will work fine, but also buttons overlapping region edges.
Modified Paths:
--------------
branches/blender2.5/blender/source/blender/editors/interface/interface_ops.c
branches/blender2.5/blender/source/blender/editors/interface/view2d.c
Modified: branches/blender2.5/blender/source/blender/editors/interface/interface_ops.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/interface/interface_ops.c 2008-12-03 17:36:50 UTC (rev 17698)
+++ branches/blender2.5/blender/source/blender/editors/interface/interface_ops.c 2008-12-03 18:14:52 UTC (rev 17699)
@@ -2590,28 +2590,41 @@
return NULL;
}
+static int inside_region(ARegion *ar, int x, int y)
+{
+ if(BLI_in_rcti(&ar->winrct, x, y)) {
+ /* XXX still can be zero */
+ if(ar->v2d.mask.xmin!=ar->v2d.mask.xmax) {
+ return BLI_in_rcti(&ar->v2d.mask, x, y);
+ }
+ return 1;
+ }
+ return 0;
+}
+
static uiBut *ui_but_find_mouse_over(ARegion *ar, int x, int y, uiBlock **rblock)
{
uiBlock *block, *blockover= NULL;
uiBut *but, *butover= NULL;
int mx, my;
- for(block=ar->uiblocks.first; block; block=block->next) {
- mx= x;
- my= y;
- ui_window_to_block(ar, block, &mx, &my);
+ if(inside_region(ar, x, y)) {
+ for(block=ar->uiblocks.first; block; block=block->next) {
+ mx= x;
+ my= y;
+ ui_window_to_block(ar, block, &mx, &my);
- for(but=block->buttons.first; but; but= but->next) {
- /* give precedence to already activated buttons */
- if(ui_but_contains_pt(but, mx, my)) {
- if(!butover || (!butover->activate && but->activate)) {
- butover= but;
- blockover= block;
+ for(but=block->buttons.first; but; but= but->next) {
+ /* give precedence to already activated buttons */
+ if(ui_but_contains_pt(but, mx, my)) {
+ if(!butover || (!butover->activate && but->activate)) {
+ butover= but;
+ blockover= block;
+ }
}
}
}
}
-
if(rblock)
*rblock= blockover;
Modified: branches/blender2.5/blender/source/blender/editors/interface/view2d.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/interface/view2d.c 2008-12-03 17:36:50 UTC (rev 17698)
+++ branches/blender2.5/blender/source/blender/editors/interface/view2d.c 2008-12-03 18:14:52 UTC (rev 17699)
@@ -42,6 +42,8 @@
#include "BIF_gl.h"
#include "BIF_glutil.h"
+#include "ED_screen.h"
+
#include "UI_resources.h"
#include "UI_view2d.h"
@@ -363,17 +365,7 @@
/* Restore view matrices after drawing */
void UI_view2d_view_restore(const bContext *C)
{
- ARegion *region= C->region;
- int winx, winy;
-
- /* calculate extents of region */
- winx= region->winrct.xmax - region->winrct.xmin;
- winy= region->winrct.ymax - region->winrct.ymin;
-
- /* set default region matrix - pixel offsets (0.375) for 1:1 correspondance are not applied,
- * as they were causing some unwanted offsets when drawing
- */
- wmOrtho2(C->window, 0, winx, 0, winy);
+ ED_region_pixelspace(C, C->region);
}
/* *********************************************************************** */
More information about the Bf-blender-cvs
mailing list