2.5 - View2D fixes for User Prefs
authorJoshua Leung <aligorith@gmail.com>
Thu, 16 Jul 2009 11:05:16 +0000 (11:05 +0000)
committerJoshua Leung <aligorith@gmail.com>
Thu, 16 Jul 2009 11:05:16 +0000 (11:05 +0000)
Added NULL check for View2D code for invalid style pointer (this underlying problem should get addressed at some point), and reinstated the reinitialisation hack for panel regions.

source/blender/editors/interface/view2d.c
source/blender/editors/screen/area.c

index 2f92901c8f55cd6d5ef6192aa8b6e397cff9288f..0f7532383c9599acb64be1756269f79483b8d674 100644 (file)
@@ -254,6 +254,8 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
                        /* panels view, with horizontal/vertical align */
                        case V2D_COMMONVIEW_PANELS_UI:
                        {
+                               float panelzoom= (style) ? style->panelzoom : 1.0f;
+                               
                                /* 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;
@@ -271,13 +273,10 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
                                v2d->tot.ymin= -winy;
                                
                                v2d->cur.xmin= 0.0f;
-                               v2d->cur.xmax= winx*style->panelzoom;
-                               
-                               v2d->cur.ymax= 0.0f;
-                               v2d->cur.ymin= -winy*style->panelzoom;
+                               v2d->cur.xmax= winx*panelzoom;
                                
                                v2d->cur.ymax= 0.0f;
-                               v2d->cur.ymin= -winy*style->panelzoom;
+                               v2d->cur.ymin= -winy*panelzoom;
                        }
                                break;
                                
index efd8754a760e0c7cc4026e9a0477eb016a75ce47..e84aab787c1bf13c547a02952fbbd0e6f494a7d2 100644 (file)
@@ -1256,9 +1256,11 @@ void ED_region_panels_init(wmWindowManager *wm, ARegion *ar)
        ListBase *keymap;
        
        // XXX quick hacks for files saved with 2.5 already (i.e. the builtin defaults file)
+               // scrollbars for button regions
        ar->v2d.scroll |= (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM); 
-       //if(!(ar->v2d.align & V2D_ALIGN_NO_POS_Y))
-       //      ar->v2d.flag &= ~V2D_IS_INITIALISED;
+               // correctly initialised User-Prefs?
+       if(!(ar->v2d.align & V2D_ALIGN_NO_POS_Y))
+               ar->v2d.flag &= ~V2D_IS_INITIALISED;
        
        UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_PANELS_UI, ar->winx, ar->winy);