Revision: 17696
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17696
Author:   ton
Date:     2008-12-03 18:11:50 +0100 (Wed, 03 Dec 2008)

Log Message:
-----------
2.5

- Tooltips now respect view2d view (rna viewer).
- Bugfix in viewd.c UI_view2d_view_to_region() (typo)

Modified Paths:
--------------
    
branches/blender2.5/blender/source/blender/editors/interface/interface_regions.c
    branches/blender2.5/blender/source/blender/editors/interface/view2d.c

Modified: 
branches/blender2.5/blender/source/blender/editors/interface/interface_regions.c
===================================================================
--- 
branches/blender2.5/blender/source/blender/editors/interface/interface_regions.c
    2008-12-03 16:17:59 UTC (rev 17695)
+++ 
branches/blender2.5/blender/source/blender/editors/interface/interface_regions.c
    2008-12-03 17:11:50 UTC (rev 17696)
@@ -5,6 +5,7 @@
 #include "MEM_guardedalloc.h"
 
 #include "DNA_screen_types.h"
+#include "DNA_view2d_types.h"
 #include "DNA_windowmanager_types.h"
 
 #include "BLI_arithb.h"
@@ -21,8 +22,9 @@
 
 #include "BIF_gl.h"
 
+#include "UI_interface.h"
 #include "UI_text.h"
-#include "UI_interface.h"
+#include "UI_view2d.h"
 
 #include "ED_screen.h"
 
@@ -309,6 +311,15 @@
        x2 += 4;
 
        if(butregion) {
+               /* XXX temp, region v2ds can be empty still */
+               if(butregion->v2d.cur.xmin != butregion->v2d.cur.xmax) {
+                       short tx, ty;
+                       UI_view2d_to_region_no_clip(&butregion->v2d, x1, y1, 
&tx, &ty);
+                       x1= (int)tx; y1= (int)ty;
+                       UI_view2d_to_region_no_clip(&butregion->v2d, x2, y2, 
&tx, &ty);
+                       x2= (int)tx; y2= (int)ty;
+               }
+
                x1 += butregion->winrct.xmin;
                x2 += butregion->winrct.xmin;
                y1 += butregion->winrct.ymin;
@@ -318,14 +329,21 @@
        wm_window_get_size(C->window, &winx, &winy);
 
        if(x2 > winx) {
-               x1 -= x2-winx;
-               x2= winx;
+               /* super size */
+               if(x2 > winx + x1) {
+                       x2= winx;
+                       x1= 0;
+               }
+               else {
+                       x1 -= x2-winx;
+                       x2= winx;
+               }
        }
        if(y1 < 0) {
                y1 += 36;
                y2 += 36;
        }
-
+       
        ar->winrct.xmin= x1;
        ar->winrct.ymin= y1;
        ar->winrct.xmax= x2;

Modified: branches/blender2.5/blender/source/blender/editors/interface/view2d.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/interface/view2d.c       
2008-12-03 16:17:59 UTC (rev 17695)
+++ branches/blender2.5/blender/source/blender/editors/interface/view2d.c       
2008-12-03 17:11:50 UTC (rev 17696)
@@ -786,7 +786,7 @@
        
        /* express given coordinates as proportional values */
        x= (x - v2d->cur.xmin) / (v2d->cur.xmax - v2d->cur.xmin);
-       y= (x - v2d->cur.ymin) / (v2d->cur.ymax - v2d->cur.ymin);
+       y= (y - v2d->cur.ymin) / (v2d->cur.ymax - v2d->cur.ymin);
        
        /* check if values are within bounds */
        if ((x>=0.0f) && (x<=1.0f) && (y>=0.0f) && (y<=1.0f)) {
@@ -807,7 +807,7 @@
 {
        /* step 1: express given coordinates as proportional values */
        x= (x - v2d->cur.xmin) / (v2d->cur.xmax - v2d->cur.xmin);
-       y= (x - v2d->cur.ymin) / (v2d->cur.ymax - v2d->cur.ymin);
+       y= (y - v2d->cur.ymin) / (v2d->cur.ymax - v2d->cur.ymin);
        
        /* step 2: convert proportional distances to screen coordinates  */
        x= v2d->mask.xmin + x*(v2d->mask.xmax - v2d->mask.xmin);


_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to