View2D: Cleanup of presets and fixed errors in various views
authorJoshua Leung <aligorith@gmail.com>
Wed, 17 Dec 2008 10:25:02 +0000 (10:25 +0000)
committerJoshua Leung <aligorith@gmail.com>
Wed, 17 Dec 2008 10:25:02 +0000 (10:25 +0000)
Now, preset view configurations are only to be used if they define all (scrollers not included) relevant settings for the view they are set for. This should be less confusing than in the previous situation with V2D_COMMONVIEW_TIMELINE stuff.

One implication of this though, is that all Animation Editors (for example), will have to define their own version of the relatively commonly shared info. However, given the great diversity in the range of settings each have, this should not be too much of an issue.

Also, added a 'standard' view config for main 'window' regions. At this stage, it is recommended that this view config should be used only as a placeholder template on which a set of custom settings could be based. I've put it into use for the buttons window/scripts window/info window so far.

16 files changed:
source/blender/blenloader/intern/readfile.c
source/blender/editors/include/UI_view2d.h
source/blender/editors/interface/view2d.c
source/blender/editors/space_action/space_action.c
source/blender/editors/space_buttons/space_buttons.c
source/blender/editors/space_file/space_file.c
source/blender/editors/space_image/space_image.c
source/blender/editors/space_info/space_info.c
source/blender/editors/space_ipo/space_ipo.c
source/blender/editors/space_nla/space_nla.c
source/blender/editors/space_node/space_node.c
source/blender/editors/space_script/space_script.c
source/blender/editors/space_sequencer/space_sequencer.c
source/blender/editors/space_sound/space_sound.c
source/blender/editors/space_text/space_text.c
source/blender/editors/space_time/space_time.c

index 5452429e8ea9d679a50df550bd16f79d04724535..3fcf0beeb263b592f3e0a68c4b3909b539855ba6 100644 (file)
@@ -5196,7 +5196,6 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
                                SpaceButs *sbuts= (SpaceButs *)sl;
                                memcpy(&ar->v2d, &sbuts->v2d, sizeof(View2D));
                                ar->v2d.keepzoom |= V2D_KEEPASPECT;
-                               ar->v2d.flag |= V2D_IS_INITIALISED;
                                break;
                        }
                                //case SPACE_XXX: // FIXME... add other ones
index af517b798dea370646cd3be423090acaadd636e6..479468296f263a76951a6e9b6d663ee848931231 100644 (file)
 /* generic value to use when coordinate lies out of view when converting */
 #define V2D_IS_CLIPPED 12000
 
-/* common View2D view types */
+/* Common View2D view types 
+ * NOTE: only define a type here if it completely sets all (+/- a few) of the relevant flags 
+ *         and settings for a View2D region, and that set of settings is used in more
+ *         than one specific place
+ */
 enum {
                /* custom view type (region has defined all necessary flags already) */
-       V2D_COMMONVIEW_CUSTOM = 0,
-               /* view canvas ('standard' view, view limits/restrictions still need to be set first!) */
-       V2D_COMMONVIEW_VIEWCANVAS,
+       V2D_COMMONVIEW_CUSTOM = -1,
+               /* standard (only use this when setting up a new view, as a sensible base for most settings) */
+       V2D_COMMONVIEW_STANDARD,
                /* listview (i.e. Outliner) */
        V2D_COMMONVIEW_LIST,
                /* headers (this is basically the same as listview, but no y-panning) */
        V2D_COMMONVIEW_HEADER,
-               /* timegrid (this sets the settings for x/horizontal, but y/vertical settings still need to be set first!) */
-       V2D_COMMONVIEW_TIMELINE,
 } eView2D_CommonViewTypes;
 
 /* ---- Defines for Scroller/Grid Arguments ----- */
index 605ae4bb23cefbce874aaa10141364a7e60a6da9..cacde59145f90f5fade734671141ec831f086e0e 100644 (file)
@@ -68,6 +68,88 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
 {
        short tot_changed= 0;
        
+       /* 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 */
+               v2d->flag |= V2D_IS_INITIALISED;
+               
+               /* see eView2D_CommonViewTypes in UI_view2d.h for available view presets */
+               switch (type) {
+                       /* 'standard view' - optimum setup for 'standard' view behaviour, that should be used new views as basis for their
+                        *      own unique View2D settings, which should be used instead of this in most cases...
+                        */
+                       case V2D_COMMONVIEW_STANDARD:
+                       {
+                               /* for now, aspect ratio should be maintained, and zoom is clamped within sane default limits */
+                               v2d->keepzoom= (V2D_KEEPASPECT|V2D_KEEPZOOM);
+                               v2d->minzoom= 0.01f;
+                               v2d->maxzoom= 1000.0f;
+                               
+                               /* tot rect and cur should be same size, and aligned using 'standard' OpenGL coordinates for now 
+                                *      - region can resize 'tot' later to fit other data
+                                *      - keeptot is only within bounds, as strict locking is not that critical
+                                *      - view is aligned for (0,0) -> (winx-1, winy-1) setup
+                                */
+                               v2d->align= (V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_NEG_Y);
+                               v2d->keeptot= V2D_KEEPTOT_BOUNDS;
+                               
+                               v2d->tot.xmin= v2d->tot.ymin= 0.0f;
+                               v2d->tot.xmax= (float)(winx - 1);
+                               v2d->tot.ymax= (float)(winy - 1);
+                               
+                               v2d->cur= v2d->tot;
+                               
+                               /* scrollers - should we have these by default? */
+                               // XXX for now, we don't override this, or set it either!
+                       }
+                               break;
+                       
+                       /* 'list/channel view' - zoom, aspect ratio, and alignment restrictions are set here */
+                       case V2D_COMMONVIEW_LIST:
+                       {
+                               /* zoom + aspect ratio are locked */
+                               v2d->keepzoom = (V2D_LOCKZOOM_X|V2D_LOCKZOOM_Y|V2D_KEEPZOOM|V2D_KEEPASPECT);
+                               v2d->minzoom= v2d->maxzoom= 1.0f;
+                               
+                               /* tot rect has strictly regulated placement, and must only occur in +/- quadrant */
+                               v2d->align = (V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_POS_Y);
+                               v2d->keeptot = V2D_KEEPTOT_STRICT;
+                               tot_changed= 1;
+                               
+                               /* scroller settings are currently not set here... that is left for regions... */
+                       }
+                               break;
+                               
+                       /* 'header' regions - zoom, aspect ratio, alignment, and panning restrictions are set here */
+                       case V2D_COMMONVIEW_HEADER:
+                       {
+                               /* zoom + aspect ratio are locked */
+                               v2d->keepzoom = (V2D_LOCKZOOM_X|V2D_LOCKZOOM_Y|V2D_KEEPZOOM|V2D_KEEPASPECT);
+                               v2d->minzoom= v2d->maxzoom= 1.0f;
+                               v2d->min[0]= v2d->max[0]= winx;
+                               v2d->min[1]= v2d->max[1]= winy;
+                               
+                               /* tot rect has strictly regulated placement, and must only occur in +/+ quadrant */
+                               v2d->align = (V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_NEG_Y);
+                               v2d->keeptot = V2D_KEEPTOT_STRICT;
+                               tot_changed= 1;
+                               
+                               /* panning in y-axis is prohibited */
+                               v2d->keepofs= V2D_LOCKOFS_Y;
+                               
+                               /* absolutely no scrollers allowed */
+                               v2d->scroll= 0;
+                       }
+                               break;
+                       
+                       /* other view types are completely defined using their own settings already */
+                       default:
+                               /* we don't do anything here, as settings should be fine, but just make sure that rect */
+                               break;  
+               }
+       }
+       
+       
        /* store view size */
        v2d->winx= winx;
        v2d->winy= winy;
@@ -124,91 +206,6 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
                }
        }
        
-       /* initialise data if there is a need for such */
-       if ((v2d->flag & V2D_IS_INITIALISED) == 0) {
-               v2d->flag |= V2D_IS_INITIALISED;
-               
-               /* see eView2D_CommonViewTypes in UI_view2d.h for available view presets */
-               switch (type) {
-                       /* 'standard view' - from (0,0) to (winx,winy), with other restrictions defined by region already */
-                       case V2D_COMMONVIEW_VIEWCANVAS: 
-                       {
-                               /* just set 'tot' rect alignment restictions for now */
-                               v2d->align= V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_NEG_Y;
-                               tot_changed= 1;
-                               
-                               // XXX... should we set min/max here too? probably not essential yet
-                       }
-                               break;
-                       
-                       /* 'list/channel view' - zoom, aspect ratio, and alignment restrictions are set here */
-                       case V2D_COMMONVIEW_LIST:
-                       {
-                               /* zoom + aspect ratio are locked */
-                               v2d->keepzoom = (V2D_LOCKZOOM_X|V2D_LOCKZOOM_Y|V2D_KEEPZOOM|V2D_KEEPASPECT);
-                               v2d->minzoom= v2d->maxzoom= 1.0f;
-                               
-                               /* tot rect has strictly regulated placement, and must only occur in +/- quadrant */
-                               v2d->align = (V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_POS_Y);
-                               v2d->keeptot = V2D_KEEPTOT_STRICT;
-                               tot_changed= 1;
-                               
-                               /* scroller settings are currently not set here... that is left for regions... */
-                       }
-                               break;
-                               
-                       /* 'header' regions - zoom, aspect ratio, alignment, and panning restrictions are set here */
-                       case V2D_COMMONVIEW_HEADER:
-                       {
-                               /* zoom + aspect ratio are locked */
-                               v2d->keepzoom = (V2D_LOCKZOOM_X|V2D_LOCKZOOM_Y|V2D_KEEPZOOM|V2D_KEEPASPECT);
-                               v2d->minzoom= v2d->maxzoom= 1.0f;
-                               v2d->min[0]= v2d->max[0]= winx;
-                               v2d->min[1]= v2d->max[1]= winy;
-                               
-                               /* tot rect has strictly regulated placement, and must only occur in +/+ quadrant */
-                               v2d->align = (V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_NEG_Y);
-                               v2d->keeptot = V2D_KEEPTOT_STRICT;
-                               tot_changed= 1;
-                               
-                               /* panning in y-axis is prohibited */
-                               v2d->keepofs= V2D_LOCKOFS_Y;
-                               
-                               /* absolutely no scrollers allowed */
-                               v2d->scroll= 0;
-                       }
-                               break;
-                               
-                       /* 'timeline/animeditors' - only set x-axis settings (y axis settings have already been set by regions, so don't overwrite! */
-                       case V2D_COMMONVIEW_TIMELINE:
-                       {
-                               /* zoom on x-axis is free, but zoom factors are usually standard */
-                               v2d->minzoom= 0.5f;
-                               v2d->maxzoom= 10.0f;
-                               
-                               /* size limits on x-axis are also standard */
-                               v2d->min[0]= 0.0f; // XXX... would 1.0f be better?
-                               v2d->max[0]= MAXFRAMEF;
-                               
-                               /* scrollers for x-axis must be shown, and with scales */
-                               v2d->scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
-                               
-                               /* 'tot' rect x-axis size */
-                               v2d->tot.xmin= (float)(SFRA - 10);
-                               v2d->tot.xmax= (float)(EFRA + 10);
-                               v2d->cur.xmin= v2d->mask.xmin;
-                               v2d->cur.xmax= v2d->mask.xmax;
-                               tot_changed= 0; // er..
-                       }
-                               break;
-                               
-                       /* other view types are completely defined using their own settings already */
-                       default:
-                               /* we don't do anything here, as settings should be fine, but just make sure that rect */
-                               break;  
-               }
-       }
-       
        /* set 'tot' rect before setting cur? */
        if (tot_changed) 
                UI_view2d_totRect_set(v2d, winx, winy);
index 79e5fe243f856cb6324d39f1391741629f1c738f..26c99734d2d40538647f8b330c45c7c8f94dc234 100644 (file)
@@ -91,13 +91,23 @@ static SpaceLink *action_new(void)
        ar->v2d.tot.xmax= 1000.0f;
        ar->v2d.tot.ymax= 0.0f;
        
-       ar->v2d.min[1]= 0.0f;
-       ar->v2d.max[1]= 1000.0f;
-       
-       ar->v2d.scroll = V2D_SCROLL_RIGHT;
-       
-       ar->v2d.align= saction->v2d.align= V2D_ALIGN_NO_POS_Y;
-       ar->v2d.keepzoom= saction->v2d.keepzoom= V2D_LOCKZOOM_Y;
+       ar->v2d.cur.xmin= -5.0f;
+       ar->v2d.cur.ymin= -75.0f;
+       ar->v2d.cur.xmax= 65.0f;
+       ar->v2d.cur.ymax= 5.0f;
+       
+       ar->v2d.min[0]= 0.0f;
+       ar->v2d.min[1]= 0.0f;
+       
+       ar->v2d.max[0]= MAXFRAMEF;
+       ar->v2d.max[1]= 1000.0f;
+       
+       ar->v2d.minzoom= 0.01f;
+       ar->v2d.maxzoom= 50;
+       ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
+       ar->v2d.scroll |= (V2D_SCROLL_RIGHT);
+       ar->v2d.keepzoom= V2D_LOCKZOOM_Y;
+       ar->v2d.align= V2D_ALIGN_NO_POS_X;
        
        /* channel list region XXX */
        ar= MEM_callocN(sizeof(ARegion), "area region from do_versions");
@@ -139,7 +149,7 @@ static void action_main_area_init(wmWindowManager *wm, ARegion *ar)
 {
        ListBase *keymap;
        
-       UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_TIMELINE, ar->winx, ar->winy);
+       UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
        
        /* own keymap */
        keymap= WM_keymap_listbase(wm, "Action", SPACE_ACTION, 0);      /* XXX weak? */
index a042e915f136bd5d289013fc08fb077a6b00bad8..9ed56afec1867e23c3037c32711a630e64f786f5 100644 (file)
@@ -84,27 +84,29 @@ static SpaceLink *buttons_new(void)
        BLI_addtail(&sbuts->regionbase, ar);
        ar->regiontype= RGN_TYPE_WINDOW;
        
+#if 0 // disabled, as this currently draws badly in new system
        /* buts space goes from (0,0) to (1280, 228) */
+       ar->v2d.tot.xmin= 0.0f;
+       ar->v2d.tot.ymin= 0.0f;
+       ar->v2d.tot.xmax= 1279.0f;
+       ar->v2d.tot.ymax= 228.0f;
        
-       sbuts->v2d.tot.xmin= 0.0f;
-       sbuts->v2d.tot.ymin= 0.0f;
-       sbuts->v2d.tot.xmax= 1279.0f;
-       sbuts->v2d.tot.ymax= 228.0f;
+       ar->v2d.cur= sbuts->v2d.tot;
        
-       sbuts->v2d.min[0]= 256.0f;
-       sbuts->v2d.min[1]= 42.0f;
+       ar->v2d.min[0]= 256.0f;
+       ar->v2d.min[1]= 42.0f;
        
-       sbuts->v2d.max[0]= 2048.0f;
-       sbuts->v2d.max[1]= 450.0f;
+       ar->v2d.max[0]= 2048.0f;
+       ar->v2d.max[1]= 450.0f;
        
-       sbuts->v2d.minzoom= 0.5f;
-       sbuts->v2d.maxzoom= 1.21f;
+       ar->v2d.minzoom= 0.5f;
+       ar->v2d.maxzoom= 1.21f;
        
-       sbuts->v2d.scroll= 0;  // TODO: will we need scrollbars?
-       sbuts->v2d.align= V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_NEG_Y;
-       sbuts->v2d.keepzoom= V2D_KEEPZOOM|V2D_KEEPASPECT;
-       sbuts->v2d.keeptot= 1;
-       sbuts->v2d.cur= sbuts->v2d.tot;
+       ar->v2d.scroll= 0;  // TODO: will we need scrollbars?
+       ar->v2d.align= V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_NEG_Y;
+       ar->v2d.keepzoom= V2D_KEEPZOOM|V2D_KEEPASPECT;
+       ar->v2d.keeptot= V2D_KEEPTOT_BOUNDS;
+#endif 
        
        
        return (SpaceLink *)sbuts;
@@ -146,7 +148,7 @@ static void buttons_main_area_init(wmWindowManager *wm, ARegion *ar)
 {
        ListBase *keymap;
        
-       UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
+       UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_STANDARD, ar->winx, ar->winy);
        
        /* own keymap */
        keymap= WM_keymap_listbase(wm, "Buttons", SPACE_BUTS, 0);       /* XXX weak? */
index 972e852f481009de5d0133b80b342ebf75d69962..b8bc573e2cda7b08007be64c8869b3c6d890cdb2 100644 (file)
@@ -232,6 +232,7 @@ void ED_spacetype_file(void)
        /* regions: header */
        art= MEM_callocN(sizeof(ARegionType), "spacetype file region");
        art->regionid = RGN_TYPE_HEADER;
+       art->minsizey= HEADERY;
        art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
        
        art->init= file_header_area_init;
@@ -242,6 +243,7 @@ void ED_spacetype_file(void)
        /* regions: channels */
        art= MEM_callocN(sizeof(ARegionType), "spacetype file region");
        art->regionid = RGN_TYPE_CHANNELS;
+       art->minsizex= 80;
        art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
        
 //     art->init= file_channel_area_init;
index 7d34f724de2d58e694b754ffe880a73b852a9b43..7a96fb0622ca83b6d1f07c6e51afcc60e4195049 100644 (file)
@@ -131,7 +131,7 @@ static void image_main_area_init(wmWindowManager *wm, ARegion *ar)
 {
        ListBase *keymap;
        
-       UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_VIEWCANVAS, ar->winx, ar->winy);
+       UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_STANDARD, ar->winx, ar->winy);
        
        /* own keymap */
        keymap= WM_keymap_listbase(wm, "Image", SPACE_IMAGE, 0);        /* XXX weak? */
index 82bc6949c6117659188d1798116c59e3da5612bf..7ef08495ae1341f71f9df8fd411ea3033316fbdc 100644 (file)
@@ -119,7 +119,7 @@ static void info_main_area_init(wmWindowManager *wm, ARegion *ar)
 {
        ListBase *keymap;
        
-       UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_VIEWCANVAS, ar->winx, ar->winy);
+       UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_STANDARD, ar->winx, ar->winy);
        
        /* own keymap */
        keymap= WM_keymap_listbase(wm, "info", SPACE_INFO, 0);  /* XXX weak? */
index 3395af35cd2a409c9badb4840ca9ec48e6431e30..325d14120aeaf944aa1bdf389d43fa6627cc07eb 100644 (file)
@@ -104,7 +104,7 @@ static SpaceLink *ipo_new(void)
        ar->v2d.min[1]= 0.01f;
        
        ar->v2d.max[0]= MAXFRAMEF;
-       ar->v2d.max[1]= 10000.0f;
+       ar->v2d.max[1]= 50000.0f;
        
        ar->v2d.scroll= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
        ar->v2d.scroll |= (V2D_SCROLL_LEFT|V2D_SCROLL_SCALE_VERTICAL);
@@ -194,7 +194,7 @@ static void ipo_main_area_init(wmWindowManager *wm, ARegion *ar)
 {
        ListBase *keymap;
        
-       UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_TIMELINE, ar->winx, ar->winy);
+       UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
        
        /* own keymap */
        keymap= WM_keymap_listbase(wm, "Ipo", SPACE_IPO, 0);    /* XXX weak? */
index 17f92c305026ca283a85e7d4f9217214096ca2bc..71c5a8c0fe4f3c34d1fffac9db20bd037ec39fd4 100644 (file)
@@ -113,7 +113,7 @@ static SpaceLink *nla_new(void)
        BLI_addtail(&snla->regionbase, ar);
        ar->regiontype= RGN_TYPE_CHANNELS;
        ar->alignment= RGN_ALIGN_LEFT;
-                               
+               
        
        return (SpaceLink *)snla;
 }
@@ -148,7 +148,7 @@ static void nla_main_area_init(wmWindowManager *wm, ARegion *ar)
 {
        ListBase *keymap;
        
-       UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_TIMELINE, ar->winx, ar->winy);
+       UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
        
        /* own keymap */
        keymap= WM_keymap_listbase(wm, "NLA", SPACE_NLA, 0);    /* XXX weak? */
index 938cd2833612917d36c35cf1d8e1d7cd30311608..ba460900bf2e0b94f630848f209b6a0b0671354b 100644 (file)
@@ -142,7 +142,7 @@ static void node_main_area_init(wmWindowManager *wm, ARegion *ar)
 {
        ListBase *keymap;
        
-       UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_VIEWCANVAS, ar->winx, ar->winy);
+       UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
        
        /* own keymap */
        keymap= WM_keymap_listbase(wm, "Node", SPACE_NODE, 0);  /* XXX weak? */
@@ -154,6 +154,7 @@ static void node_main_area_draw(const bContext *C, ARegion *ar)
        /* draw entirely, view changes should be handled here */
        // SpaceNode *snode= C->area->spacedata.first;
        View2D *v2d= &ar->v2d;
+       //View2DGrid *grid;
        float col[3];
        
        /* clear and setup matrix */
@@ -162,7 +163,14 @@ static void node_main_area_draw(const bContext *C, ARegion *ar)
        glClear(GL_COLOR_BUFFER_BIT);
        
        UI_view2d_view_ortho(C, v2d);
-               
+       
+#if 0
+       /* grid */
+       grid= UI_view2d_grid_calc(C, v2d, V2D_UNIT_VALUES, V2D_GRID_CLAMP, V2D_UNIT_VALUES, V2D_GRID_CLAMP, ar->winx, ar->winy);
+       UI_view2d_grid_draw(C, v2d, grid, V2D_GRIDLINES_ALL);
+       UI_view2d_grid_free(grid);
+#endif
+       
        /* data... */
        
        
index bb31dd8dc03591ac526df05b96453f4da721a435..8b9196ac506cfe3490b0d805fa4028765a6c4988 100644 (file)
@@ -129,7 +129,7 @@ static void script_main_area_init(wmWindowManager *wm, ARegion *ar)
 {
        ListBase *keymap;
        
-       UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_VIEWCANVAS, ar->winx, ar->winy);
+       UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_STANDARD, ar->winx, ar->winy);
        
        /* own keymap */
        keymap= WM_keymap_listbase(wm, "Script", SPACE_SCRIPT, 0);      /* XXX weak? */
index 714e6be24167610f453a4fbf1ca7ee933c1db340..20618b6ab9bec7bbca8f1e663f7f61130694654b 100644 (file)
@@ -148,7 +148,7 @@ static void sequencer_main_area_init(wmWindowManager *wm, ARegion *ar)
 {
        ListBase *keymap;
        
-       UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_TIMELINE, ar->winx, ar->winy);
+       UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
        
        /* own keymap */
        keymap= WM_keymap_listbase(wm, "Sequencer", SPACE_SEQ, 0);      /* XXX weak? */
index e02f7f4be121463386bcc52b887b7b750d851072..712e4f27192c3b0fe17a95967d110afb7e9ac1c7 100644 (file)
@@ -144,7 +144,7 @@ static void sound_main_area_init(wmWindowManager *wm, ARegion *ar)
 {
        ListBase *keymap;
        
-       UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_TIMELINE, ar->winx, ar->winy);
+       UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
        
        /* own keymap */
        keymap= WM_keymap_listbase(wm, "Sound", SPACE_SOUND, 0);        /* XXX weak? */
index dee5c4b2d254b584c828ed0ac48bb585afb1d061..e37dbdc613e6b0d9a4083d866e4d2dd13b3b2177 100644 (file)
@@ -122,7 +122,7 @@ static void text_main_area_init(wmWindowManager *wm, ARegion *ar)
 {
        ListBase *keymap;
        
-       UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_VIEWCANVAS, ar->winx, ar->winy);
+       UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_STANDARD, ar->winx, ar->winy);
        
        /* own keymap */
        keymap= WM_keymap_listbase(wm, "Text", SPACE_TEXT, 0);  /* XXX weak? */
index a472c2d2717fd6305fcb850fe2d38aaf4c2602ad..3c4152366ee5ece999a7cfa573f64da5b613e2a2 100644 (file)
@@ -109,7 +109,7 @@ static void time_main_area_init(wmWindowManager *wm, ARegion *ar)
 {
        ListBase *keymap;
        
-       UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_TIMELINE, ar->winx, ar->winy);
+       UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
        
        /* own keymap */
        keymap= WM_keymap_listbase(wm, "TimeLine", SPACE_TIME, 0);      /* XXX weak? */
@@ -227,18 +227,27 @@ static SpaceLink *time_new(void)
        BLI_addtail(&stime->regionbase, ar);
        ar->regiontype= RGN_TYPE_WINDOW;
        
-               /* only need to set y-locks for view2d of main area, 
-                * as the rest is taken care of by View2D preset for TimeGrids 
-                */
-       ar->v2d.min[1]= 20.0;
-       ar->v2d.max[1]= 20.0; 
+       ar->v2d.tot.xmin= (float)(SFRA - 4);
+       ar->v2d.tot.ymin= 0.0f;
+       ar->v2d.tot.xmax= (float)(EFRA + 4);
+       ar->v2d.tot.ymax= 50.0f;
        
-       ar->v2d.cur.ymin= ar->v2d.tot.ymin= 0.0f;
-       ar->v2d.cur.ymax= ar->v2d.tot.ymax= 20.0f;
+       ar->v2d.cur= ar->v2d.tot;
+
+       ar->v2d.min[0]= 1.0f;
+       ar->v2d.min[1]= 50.0f;
+
+       ar->v2d.max[0]= MAXFRAMEF;
+       ar->v2d.max[1]= 50.0; 
+
+       ar->v2d.minzoom= 0.1f;
+       ar->v2d.maxzoom= 10.0;
+
+       ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
+       ar->v2d.align |= V2D_ALIGN_NO_NEG_Y;
+       ar->v2d.keepofs |= V2D_LOCKOFS_Y;
+       ar->v2d.keepzoom |= V2D_LOCKZOOM_Y;
 
-       ar->v2d.align = V2D_ALIGN_NO_NEG_Y;
-       ar->v2d.keepofs = V2D_LOCKOFS_Y;
-       ar->v2d.keepzoom = V2D_LOCKZOOM_Y;
 
        return (SpaceLink*)stime;
 }