2.5
authorTon Roosendaal <ton@blender.org>
Sun, 19 Jul 2009 11:13:15 +0000 (11:13 +0000)
committerTon Roosendaal <ton@blender.org>
Sun, 19 Jul 2009 11:13:15 +0000 (11:13 +0000)
Requested UI feature: when scaling Blender window, the buttons view keeps
scale (in visible pixels) as previously. Also works for the .B25.blend, which
currently will show the buttons a bit too large for small screens... this
because the .B25.blend was created on a 1920x1200 screen. Might need a config
inbetween... 1440x1080 or so? Or we make a couple of defaults later.

Additional feature could be to also scale the buttons area itself, but that
will change the entire screen layout too much, potentially giving bad issues
with extremer scaling.

source/blender/editors/screen/screen_edit.c

index 6da00f12a256d09e04b0246136a4642168c2f8f0..e7a615140104199f8b13b3e8e9ca1487ae15873e 100644 (file)
@@ -603,6 +603,21 @@ void select_connected_scredge(bScreen *sc, ScrEdge *edge)
        }
 }
 
+/* helper call for below, correct buttons view */
+static void screen_test_scale_region(ListBase *regionbase, float facx, float facy)
+{
+       ARegion *ar;
+       
+       for(ar= regionbase->first; ar; ar= ar->next) {
+               if(ar->regiontype==RGN_TYPE_WINDOW) {
+                       ar->v2d.cur.xmin *= facx;
+                       ar->v2d.cur.xmax *= facx;
+                       ar->v2d.cur.ymin *= facy;
+                       ar->v2d.cur.ymax *= facy;
+               }
+       }
+}
+
 /* test if screen vertices should be scaled */
 static void screen_test_scale(bScreen *sc, int winsizex, int winsizey)
 {
@@ -653,6 +668,19 @@ static void screen_test_scale(bScreen *sc, int winsizex, int winsizey)
                        
                        CLAMP(sv->vec.y, 0, winsizey);
                }
+               
+               /* keep buttons view2d same size */
+               for(sa= sc->areabase.first; sa; sa= sa->next) {
+                       SpaceLink *sl;
+                       
+                       if(sa->spacetype==SPACE_BUTS)
+                               screen_test_scale_region(&sa->regionbase, facx, facy);
+                       
+                       for(sl= sa->spacedata.first; sl; sl= sl->next)
+                               if(sl->spacetype==SPACE_BUTS)
+                                       screen_test_scale_region(&sl->regionbase, facx, facy);
+               }
+               
        }
        
        /* test for collapsed areas. This could happen in some blender version... */