2.5
authorTon Roosendaal <ton@blender.org>
Fri, 10 Apr 2009 17:39:37 +0000 (17:39 +0000)
committerTon Roosendaal <ton@blender.org>
Fri, 10 Apr 2009 17:39:37 +0000 (17:39 +0000)
Quick hack to enable zoom in buttons window again.
It uses bad old conventions for fixed panel width still, view2d has
to be tweaked for new system. But, it shows layout to work. :)

source/blender/editors/interface/interface_layout.c
source/blender/editors/interface/view2d.c

index f2bab0284a270f083a0b6f559c7e755574ac5d67..52250ca2559f4c901764578ac00e6bcceaed403a 100644 (file)
@@ -941,7 +941,7 @@ void uiRegionPanelLayout(const bContext *C, ARegion *ar, int vertical, char *con
                        block= uiBeginBlock(C, ar, pt->idname, UI_EMBOSS, UI_HELV);
                        
                        if(vertical)
-                               w= (ar->type->minsizex)? ar->type->minsizex-12: ar->winx-12;
+                               w= (ar->type->minsizex)? ar->type->minsizex-12: block->aspect*ar->winx-12;
                        else
                                w= (ar->type->minsizex)? ar->type->minsizex-12: UI_PANEL_WIDTH-12;
 
index 34c8bfaab7495d3104ececf0f391a6907c708298..3b503f00fd3d752de1a426dddda8a3d0ac0e0734 100644 (file)
@@ -155,6 +155,23 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
 {
        short tot_changed= 0;
        
+       /* XXX always set state vars for buttonsview, this is hardcoded */
+       switch (type) {
+                       /* panels view, with free/horizontal/vertical align */
+               case V2D_COMMONVIEW_PANELS_UI:
+               {
+                       /* for now, aspect ratio should be maintained, and zoom is clamped within sane default limits */
+                       v2d->keepzoom= (V2D_KEEPASPECT|V2D_KEEPZOOM);
+                       v2d->minzoom= 0.5f;
+                       v2d->maxzoom= 2.0f;
+                       
+                       v2d->align= (V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_POS_Y);
+                       v2d->keeptot= V2D_KEEPTOT_BOUNDS;
+               }
+                       break;
+       }
+       
+       
        /* initialise data if there is a need for such */
        if ((v2d->flag & V2D_IS_INITIALISED) == 0) {
                /* set initialised flag so that View2D doesn't get reinitialised next time again */
@@ -257,12 +274,12 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
                        case V2D_COMMONVIEW_PANELS_UI:
                        {
                                /* for now, aspect ratio should be maintained, and zoom is clamped within sane default limits */
-                               v2d->keepzoom= (V2D_LOCKZOOM_X|V2D_LOCKZOOM_Y|V2D_KEEPASPECT|V2D_KEEPZOOM);
+                               v2d->keepzoom= (V2D_KEEPASPECT|V2D_KEEPZOOM);
                                v2d->minzoom= 0.5f;
                                v2d->maxzoom= 2.0f;
                                
                                v2d->align= (V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_POS_Y);
-                               v2d->keeptot= V2D_KEEPTOT_STRICT;
+                               v2d->keeptot= V2D_KEEPTOT_BOUNDS;
                                
                                v2d->tot.xmin= 0.0f;
                                v2d->tot.xmax= winx;