2.5 - View2D fixes for User Prefs

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.
This commit is contained in:
Joshua Leung 2009-07-16 11:05:16 +00:00
parent 9f2a13b263
commit 0621225b38
2 changed files with 8 additions and 7 deletions

@ -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.xmax= winx*panelzoom;
v2d->cur.ymax= 0.0f;
v2d->cur.ymin= -winy*style->panelzoom;
v2d->cur.ymax= 0.0f;
v2d->cur.ymin= -winy*style->panelzoom;
v2d->cur.ymin= -winy*panelzoom;
}
break;

@ -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);