View2D: Simplification and documentation of settings
authorJoshua Leung <aligorith@gmail.com>
Mon, 15 Dec 2008 11:58:57 +0000 (11:58 +0000)
committerJoshua Leung <aligorith@gmail.com>
Mon, 15 Dec 2008 11:58:57 +0000 (11:58 +0000)
I've gone through and simplified some of the redundant options while documenting the various settings (in the code and also in the Wiki Doc), to make it clearer how to use each option.

'Preset' view-types have yet to be fully implemented, but started groundwork for this. Only some commonly used view configurations will be defined using this method. For all others, they still need to define all relavent view settings themselves (as there's too much variation in terms of the various editor's use of View2D).

IPO Editor now draws with channels on the left, like all other anim editors. Now, how to make this wider...

source/blender/blenloader/intern/readfile.c
source/blender/editors/include/UI_view2d.h
source/blender/editors/interface/view2d.c
source/blender/editors/interface/view2d_ops.c
source/blender/editors/space_action/space_action.c
source/blender/editors/space_ipo/space_ipo.c
source/blender/editors/space_nla/space_nla.c
source/blender/editors/space_sequencer/space_sequencer.c
source/blender/editors/space_sound/space_sound.c
source/blender/editors/space_time/space_time.c
source/blender/makesdna/DNA_view2d_types.h

index 91120f78e9ac43d4297ff784c639ae63d0412196..d4fd70fbc6dd6ed77c4e0cab39c4339061efe99c 100644 (file)
@@ -5078,7 +5078,7 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
                                ar= MEM_callocN(sizeof(ARegion), "area region from do_versions");
                                BLI_addtail(lb, ar);
                                ar->regiontype= RGN_TYPE_CHANNELS;
-                               ar->alignment= RGN_ALIGN_RIGHT;
+                               ar->alignment= RGN_ALIGN_LEFT; 
                                
                                break;
                        case SPACE_ACTION:
@@ -5113,7 +5113,7 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
                                memcpy(&ar->v2d, &soops->v2d, sizeof(View2D));
                                
                                ar->v2d.scroll &= ~V2D_SCROLL_LEFT;
-                               ar->v2d.scroll |= (V2D_SCROLL_RIGHT|V2D_SCROLL_HORIZONTAL_O);
+                               ar->v2d.scroll |= (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM_O);
                                ar->v2d.align = (V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_POS_Y);
                                ar->v2d.keepzoom |= (V2D_LOCKZOOM_X|V2D_LOCKZOOM_Y|V2D_KEEPASPECT);
                                ar->v2d.keeptot = 2;
@@ -5124,7 +5124,7 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
                                SpaceTime *stime= (SpaceTime *)sl;
                                memcpy(&ar->v2d, &stime->v2d, sizeof(View2D));
                                
-                               ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_BOTTOM);
+                               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;
@@ -5137,8 +5137,8 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
                                SpaceIpo *sipo= (SpaceIpo *)sl;
                                memcpy(&ar->v2d, &sipo->v2d, sizeof(View2D));
                                
-                               ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_BOTTOM);
-                               ar->v2d.scroll |= (V2D_SCROLL_LEFT|V2D_SCROLL_SCALE_LEFT);
+                               ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
+                               ar->v2d.scroll |= (V2D_SCROLL_LEFT|V2D_SCROLL_SCALE_VERTICAL);
                                break;
                        }
                        case SPACE_SOUND:
@@ -5146,7 +5146,7 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
                                SpaceSound *ssound= (SpaceSound *)sl;
                                memcpy(&ar->v2d, &ssound->v2d, sizeof(View2D));
                                
-                               ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_BOTTOM);
+                               ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
                                ar->v2d.scroll |= (V2D_SCROLL_LEFT);
                                break;
                        }
@@ -5155,7 +5155,7 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
                                SpaceNla *snla= (SpaceNla *)sl;
                                memcpy(&ar->v2d, &snla->v2d, sizeof(View2D));
                                
-                               ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_BOTTOM);
+                               ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
                                ar->v2d.scroll |= (V2D_SCROLL_RIGHT);
                                break;
                        }
@@ -5164,7 +5164,7 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
                                SpaceAction *saction= (SpaceAction *)sl;
                                memcpy(&ar->v2d, &saction->v2d, sizeof(View2D));
                                
-                               ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_BOTTOM);
+                               ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
                                ar->v2d.scroll |= (V2D_SCROLL_RIGHT);
                                break;
                        }
@@ -5173,8 +5173,8 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
                                SpaceSeq *sseq= (SpaceSeq *)sl;
                                memcpy(&ar->v2d, &sseq->v2d, sizeof(View2D));
                                
-                               ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_BOTTOM);
-                               ar->v2d.scroll |= (V2D_SCROLL_RIGHT|V2D_SCROLL_SCALE_RIGHT);
+                               ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
+                               ar->v2d.scroll |= (V2D_SCROLL_LEFT|V2D_SCROLL_SCALE_VERTICAL);
                                break;
                        }
                        case SPACE_NODE:
index 2705c5de4f6e0b63125abb95f9023ac185fcba25..0eb93580220ff0325c9a9240ada99d4d4df38e1c 100644 (file)
 /* ------------------------------------------ */
 /* Settings and Defines:                                       */
 
+/* ---- General Defines ---- */
+
 /* generic value to use when coordinate lies out of view when converting */
 #define V2D_IS_CLIPPED 12000
 
-/* 'dummy' argument to pass when argument is irrelevant */
-#define V2D_ARG_DUMMY          -1
+/* common View2D view types */
+enum {
+               /* custom view type (region has defined all necessary flags already) */
+       V2D_COMMONVIEW_CUSTOM = 0,
+               /* listview (i.e. Outliner) */
+       V2D_COMMONVIEW_LIST,
+               /* headers (this is basically the same as listview, but no y-panning) */
+       V2D_COMMONVIEW_HEADER,
+} eView2D_CommonViewTypes;
 
+/* ---- Defines for Scroller/Grid Arguments ----- */
 
-/* grid-units (for drawing time) */
-#define V2D_UNIT_SECONDS       0
-#define V2D_UNIT_FRAMES                1
+/* 'dummy' argument to pass when argument is irrelevant */
+#define V2D_ARG_DUMMY          -1
 
-/* grid-units (for drawing values) */
-#define V2D_UNIT_VALUES                2
-#define V2D_UNIT_DEGREES       3
-#define V2D_UNIT_TIME          4
-#define V2D_UNIT_SECONDSSEQ    5
+/* Grid units */
+enum {
+       /* for drawing time */
+       V2D_UNIT_SECONDS = 0,
+       V2D_UNIT_FRAMES,
+       
+       /* for drawing values */
+       V2D_UNIT_VALUES,
+       V2D_UNIT_DEGREES,
+       V2D_UNIT_TIME,
+       V2D_UNIT_SECONDSSEQ,
+} eView2D_Units;
 
 /* clamping of grid values to whole numbers */
-#define V2D_GRID_NOCLAMP       0
-#define V2D_GRID_CLAMP         1
-
+enum {
+       V2D_GRID_NOCLAMP = 0,
+       V2D_GRID_CLAMP,
+} eView2D_Clamp;
 
 /* flags for grid-lines to draw */
-#define V2D_HORIZONTAL_LINES           (1<<0)
-#define V2D_VERTICAL_LINES                     (1<<1)
-#define V2D_HORIZONTAL_AXIS                    (1<<2)
-#define V2D_VERTICAL_AXIS                      (1<<3)
-#define V2D_HORIZONTAL_FINELINES       (1<<4)
-
-#define V2D_GRIDLINES_MAJOR                    (V2D_VERTICAL_LINES|V2D_VERTICAL_AXIS|V2D_HORIZONTAL_LINES|V2D_HORIZONTAL_AXIS)
-#define V2D_GRIDLINES_ALL                      (V2D_GRIDLINES_MAJOR|V2D_HORIZONTAL_FINELINES)
-
+enum {
+       V2D_HORIZONTAL_LINES            = (1<<0),
+       V2D_VERTICAL_LINES                      = (1<<1),
+       V2D_HORIZONTAL_AXIS                     = (1<<2),
+       V2D_VERTICAL_AXIS                       = (1<<3),
+       V2D_HORIZONTAL_FINELINES        = (1<<4),
+       
+       V2D_GRIDLINES_MAJOR                     = (V2D_VERTICAL_LINES|V2D_VERTICAL_AXIS|V2D_HORIZONTAL_LINES|V2D_HORIZONTAL_AXIS),
+       V2D_GRIDLINES_ALL                       = (V2D_GRIDLINES_MAJOR|V2D_HORIZONTAL_FINELINES),
+} eView2D_Gridlines;
+
+/* ------ Defines for Scrollers ----- */
+
+/* scroller thickness */
+#define V2D_SCROLL_HEIGHT      16
+#define V2D_SCROLL_WIDTH       16
+
+/* half the size (in pixels) of scroller 'handles' */
+#define V2D_SCROLLER_HANDLE_SIZE       5
 
 /* ------------------------------------------ */
 /* Macros:                                                             */
 
-/* test if mouse in a scrollbar */
+/* test if mouse in a scrollbar (assume that scroller availability has been tested) */
 #define IN_2D_VERT_SCROLL(v2d, co) (BLI_in_rcti(&v2d->vert, co[0], co[1]))
 #define IN_2D_HORIZ_SCROLL(v2d, co) (BLI_in_rcti(&v2d->hor, co[0], co[1]))
 
@@ -92,9 +119,14 @@ typedef struct View2DScrollers View2DScrollers;
 /* Prototypes:                                             */
 
 /* refresh and validation (of view rects) */
+void UI_view2d_regiondata_init(struct View2D *v2d, short type, int winx, int winy);
+void UI_view2d_header_default(struct View2D *v2d);
+
 void UI_view2d_size_update(struct View2D *v2d, int winx, int winy);
+
 void UI_view2d_curRect_validate(struct View2D *v2d);
 void UI_view2d_curRect_reset(struct View2D *v2d);
+
 void UI_view2d_totRect_set(struct View2D *v2d, int width, int height);
 
 /* view matrix operations */
@@ -121,7 +153,6 @@ void UI_view2d_to_region_no_clip(struct View2D *v2d, float x, float y, short *re
 struct View2D *UI_view2d_fromcontext(const struct bContext *C);
 struct View2D *UI_view2d_fromcontext_rwin(const struct bContext *C);
 void UI_view2d_getscale(struct View2D *v2d, float *x, float *y);
-void UI_view2d_header_default(struct View2D *v2d);
 
 /* operators */
 void ui_view2d_operatortypes(void);
index 7177d62ef4e558a064494d4b1996a2ee159b1e74..d9d00702234ddb948ef3c9333a67ab88a77a9177 100644 (file)
 /* *********************************************************************** */
 /* Refresh and Validation */
 
-#if 0 // experimental code - not ready to be used yet!
-/* common View2D view types */
-// XXX move this to header as part of API
-enum {
-               /* 4 quadrants, centered at (0,0), zoomable and pannable, best for flexible sized data with precision needed */
-       V2D_VIEWTYPE_CANVAS     = 0,
-       V2D_VIEWTYPE_LIST,
-       V2D_VIEWTYPE_PANEL,
-               /* same as canvas, except aspect ratio is important */
-               // XXX is this more of the sort tweaks that region should do to its view2d data first?
-       V2D_VIEWTYPE_IMAGE,
-} eView2D_CommonViewTypes;
-
 /* Initialise all View2D data for a given region */
+// eView2D_CommonViewTypes <--- only check handle these types...
 void UI_view2d_regiondata_init(View2D *v2d, short type, int winx, int winy)
 {
        
 }
-#endif
+
+
+/* allowing horizontal pan */
+// XXX this should become one of 'standard' setups...
+void UI_view2d_header_default(View2D *v2d)
+{
+       v2d->keepzoom = (V2D_LOCKZOOM_X|V2D_LOCKZOOM_Y|V2D_KEEPZOOM|V2D_KEEPASPECT);
+       v2d->keepofs = V2D_LOCKOFS_Y;
+       v2d->keeptot = 2; // this keeps the view in place when region size changes...
+       v2d->align = V2D_ALIGN_NO_NEG_X;
+       
+}
 
 /* Adjust mask size in response to view size changes 
  *     - This should only be called in region init() callbacks, which are
@@ -614,16 +613,6 @@ void UI_view2d_view_restore(const bContext *C)
        ED_region_pixelspace(C, C->region);
 }
 
-/* allowing horizontal pan */
-void UI_view2d_header_default(View2D *v2d)
-{
-       v2d->keepzoom = (V2D_LOCKZOOM_X|V2D_LOCKZOOM_Y|V2D_KEEPZOOM|V2D_KEEPASPECT);
-       v2d->keepofs = V2D_LOCKOFS_Y;
-       v2d->keeptot = 2; // this keeps the view in place when region size changes...
-       v2d->align = V2D_ALIGN_NO_NEG_X;
-       
-}
-
 /* *********************************************************************** */
 /* Gridlines */
 
@@ -915,7 +904,7 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short
         */
        
        /* horizontal scrollers */
-       if (v2d->scroll & (V2D_SCROLL_HORIZONTAL|V2D_SCROLL_HORIZONTAL_O)) {
+       if (v2d->scroll & V2D_SCROLL_HORIZONTAL) {
                /* scroller 'button' extents */
                totsize= v2d->tot.xmax - v2d->tot.xmin;
                scrollsize= hor.xmax - hor.xmin;
@@ -1086,7 +1075,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
        hor= v2d->hor;
        
        /* horizontal scrollbar */
-       if (v2d->scroll & (V2D_SCROLL_HORIZONTAL|V2D_SCROLL_HORIZONTAL_O)) {
+       if (v2d->scroll & V2D_SCROLL_HORIZONTAL) {
                /* scroller backdrop */
                UI_ThemeColorShade(TH_SHADE1, light);
                glRecti(hor.xmin,  hor.ymin,  hor.xmax,  hor.ymax);
index f1dde562c9df702809af02bb793795d4a5eb0fb0..d84932c82feab15ac29b2a03d050c9ab647d77e3 100644 (file)
@@ -72,7 +72,7 @@ static short mouse_in_v2d_scrollers (const bContext *C, View2D *v2d, int x, int
        co[1]= y - ar->winrct.ymin;
        
        /* check if within scrollbars */
-       if (v2d->scroll & (V2D_SCROLL_HORIZONTAL|V2D_SCROLL_HORIZONTAL_O)) {
+       if (v2d->scroll & V2D_SCROLL_HORIZONTAL) {
                if (IN_2D_HORIZ_SCROLL(v2d, co)) return 'h';
        }
        if (v2d->scroll & V2D_SCROLL_VERTICAL) {
index 5409fa07397513ac3f9483481d70a0c9a50e27c4..bf37f89e18720f41a967e2e3219cfc906661108b 100644 (file)
@@ -106,7 +106,7 @@ static SpaceLink *action_new(void)
        ar->v2d.minzoom= 0.01f;
        ar->v2d.maxzoom= 50;
        
-       ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_BOTTOM);
+       ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
        ar->v2d.scroll |= (V2D_SCROLL_RIGHT);
        saction->v2d.keepzoom= V2D_LOCKZOOM_Y;
        
index 520a99d166bf8e8fcf04a79d3c46529491bb7fd7..4272f45ea6d8af9218facfdd551c770ab6d07f00 100644 (file)
@@ -84,7 +84,7 @@ static SpaceLink *ipo_new(void)
        
        BLI_addtail(&sipo->regionbase, ar);
        ar->regiontype= RGN_TYPE_CHANNELS;
-       ar->alignment= RGN_ALIGN_RIGHT;
+       ar->alignment= RGN_ALIGN_LEFT;
        
        /* XXX view2d init for channels */
        
@@ -107,8 +107,8 @@ static SpaceLink *ipo_new(void)
        ar->v2d.max[0]= MAXFRAMEF;
        ar->v2d.max[1]= 10000.0f;
        
-       ar->v2d.scroll= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_BOTTOM);
-       ar->v2d.scroll |= (V2D_SCROLL_LEFT|V2D_SCROLL_SCALE_LEFT);
+       ar->v2d.scroll= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
+       ar->v2d.scroll |= (V2D_SCROLL_LEFT|V2D_SCROLL_SCALE_VERTICAL);
        
        ar->v2d.keeptot= 0;
        
index 2d05bc06c8ba50db6546bf0f698890846d688214..71d837249faae8edc6d712721d9949d0e8b54e7a 100644 (file)
@@ -104,7 +104,7 @@ static SpaceLink *nla_new(void)
        ar->v2d.minzoom= 0.1f;
        ar->v2d.maxzoom= 50.0f;
        
-       ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_BOTTOM);
+       ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
        ar->v2d.scroll |= (V2D_SCROLL_RIGHT);
        ar->v2d.keepzoom= V2D_LOCKZOOM_Y;
        
index fc45b06e3c716b1bb00af037a7380eb632f031a1..b2e2aa67c2553c0f4b0dbd407302cca07674b5ef 100644 (file)
@@ -106,8 +106,8 @@ static SpaceLink *sequencer_new(void)
        ar->v2d.minzoom= 0.01f;
        ar->v2d.maxzoom= 100.0f;
        
-       ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_BOTTOM);
-       ar->v2d.scroll |= (V2D_SCROLL_RIGHT|V2D_SCROLL_SCALE_RIGHT);
+       ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
+       ar->v2d.scroll |= (V2D_SCROLL_LEFT|V2D_SCROLL_SCALE_VERTICAL);
        ar->v2d.keepzoom= 0;
        ar->v2d.keeptot= 0;
        
index 787d86634881e649d7b3c2bdb7deb0187fc36191..18e2c01a2e87e059251b65816aa55a59bf5d5f4e 100644 (file)
@@ -104,7 +104,7 @@ static SpaceLink *sound_new(void)
        ar->v2d.minzoom= 0.1f;
        ar->v2d.maxzoom= 10.0f;
        
-       ar->v2d.scroll = (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_BOTTOM);
+       ar->v2d.scroll = (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
        ar->v2d.scroll |= (V2D_SCROLL_LEFT);
        ar->v2d.keepzoom= 0;
        ar->v2d.keeptot= 0;
index b74896782f36dd653c717f3a4decdec9ab422060..182f0a02f6cb47df8f16a6e6ca450321584d0d0a 100644 (file)
@@ -238,7 +238,7 @@ static SpaceLink *time_new(void)
        ar->v2d.minzoom= 0.1f;
        ar->v2d.maxzoom= 10.0;
 
-       ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_BOTTOM);
+       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;
index 986996e43416bfb6cef7341b745fec8bfbba440b..96b3febf7f367361305f24ffde7d77a90c484910 100644 (file)
@@ -45,13 +45,14 @@ typedef struct View2D {
        float minzoom, maxzoom;                 /* self explanatory. allowable zoom factor range (only when keepzoom set) */
        
        short scroll;                                   /* scroll - scrollbars to display (bitflag) */
+       short scroll_ui;                                /* scroll_ui - temp settings used for UI drawing of scrollers */
+       
        short keeptot;                                  /* keeptot - 'cur' rect cannot move outside the 'tot' rect? */
        short keepzoom;                                 /* keepzoom - axes that zooming cannot occur on, and also clamp within zoom-limits */
        short keepofs;                                  /* keepofs - axes that translation is not allowed to occur on */
        
        short flag;                                             /* settings */
        short align;                                    /* alignment of content in totrect */
-       short type;                                             /* basic 'type' of View2D (for easy init) */ // err... do we want to store this?
        
        short winx, winy;                               /* storage of current winx/winy values, set in UI_view2d_size_update */
        short oldwinx, oldwiny;                 /* storage of previous winx/winy values encountered by UI_view2d_curRect_validate(), for keepaspect */
@@ -63,29 +64,36 @@ typedef struct View2D {
 /* ---------------------------------- */
 
 /* view zooming restrictions, per axis (v2d->keepzoom) */
+       /* zoom is clamped to lie within limits set by minzoom and maxzoom */
 #define V2D_KEEPZOOM           0x0001
+       /* aspect ratio is maintained on view resize */
 #define V2D_KEEPASPECT         0x0002
+       /* zooming on x-axis is not allowed */
 #define V2D_LOCKZOOM_X         0x0100
+       /* zooming on y-axis is not allowed */
 #define V2D_LOCKZOOM_Y         0x0200
 
 /* view panning restrictions, per axis (v2d->keepofs) */
+       /* panning on x-axis is not allowed */
 #define V2D_LOCKOFS_X  (1<<1)
+       /* panning on y-axis is not allowed */
 #define V2D_LOCKOFS_Y  (1<<2)
 
+/* view extent restrictions (v2d->keeptot) */
+       /* 'cur' view can be out of extents of 'tot' */
+#define V2D_KEEPTOT_FREE               0
+       /* 'cur' rect is adjusted so that it satisfies the extents of 'tot', with some compromises */
+#define V2D_KEEPTOT_BOUNDS             1
+       /* 'cur' rect is moved so that the 'minimum' bounds of the 'tot' rect are always respected (particularly in x-axis) */
+#define V2D_KEEPTOT_STRICT             2
+
 /* general refresh settings (v2d->flag) */
        /* global view2d horizontal locking (for showing same time interval) */
 #define V2D_VIEWSYNC_X         (1<<0)
        /* within region view2d vertical locking */
 #define V2D_VIEWSYNC_Y         (1<<1)
-
-
-/* scroller thickness */
-#define V2D_SCROLL_HEIGHT      16
-#define V2D_SCROLL_WIDTH       16
-
-/* half the size (in pixels) of scroller 'handles' */
-#define V2D_SCROLLER_HANDLE_SIZE       5
-
+       /* view settings need to be set still... */
+#define V2D_NEEDS_INIT         (1<<10)
 
 /* scroller flags for View2D (v2d->scroll) */
        /* left scrollbar */
@@ -95,18 +103,13 @@ typedef struct View2D {
        /* horizontal scrollbar */
 #define V2D_SCROLL_TOP                                 (1<<2)
 #define V2D_SCROLL_BOTTOM                      (1<<3)
-#define V2D_SCROLL_HORIZONTAL                  (V2D_SCROLL_TOP|V2D_SCROLL_BOTTOM)
-       /* special hacks for outliner hscroll - prevent hanging older versions of Blender */
+       /* special hack for outliner hscroll - prevent hanging older versions of Blender */
 #define V2D_SCROLL_BOTTOM_O            (1<<4)
-#define V2D_SCROLL_HORIZONTAL_O        (V2D_SCROLL_TOP|V2D_SCROLL_BOTTOM_O)
+#define V2D_SCROLL_HORIZONTAL                  (V2D_SCROLL_TOP|V2D_SCROLL_BOTTOM|V2D_SCROLL_BOTTOM_O)
        /* scale markings - vertical */
-#define V2D_SCROLL_SCALE_LEFT          (1<<5)
-#define V2D_SCROLL_SCALE_RIGHT         (1<<6)
-#define V2D_SCROLL_SCALE_VERTICAL      (V2D_SCROLL_SCALE_LEFT|V2D_SCROLL_SCALE_RIGHT)
-       /* scale markings - horizontal */
-#define V2D_SCROLL_SCALE_BOTTOM                (1<<7)
-#define V2D_SCROLL_SCALE_TOP           (1<<8)  
-#define V2D_SCROLL_SCALE_HORIZONTAL    (V2D_SCROLL_SCALE_BOTTOM|V2D_SCROLL_SCALE_TOP)
+#define V2D_SCROLL_SCALE_VERTICAL      (1<<5)
+       /* scale markings - horizontal */       
+#define V2D_SCROLL_SCALE_HORIZONTAL    (1<<6)
 
 /* alignment flags for totrect, flags use 'shading-out' convention (v2d->align) */
        /* all quadrants free */