Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2008-12-15 14:58:57 +0300
committerJoshua Leung <aligorith@gmail.com>2008-12-15 14:58:57 +0300
commit21ca5946258a6a79e309e8e2f7de3c9caa8d7a53 (patch)
tree59c445499af4ee3795ea613aee7fc81141bc834d /source
parentf7106acde8a2b4ac9e1ef94bb3f30c75eda2d432 (diff)
View2D: Simplification and documentation of settings
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...
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenloader/intern/readfile.c20
-rw-r--r--source/blender/editors/include/UI_view2d.h79
-rw-r--r--source/blender/editors/interface/view2d.c41
-rw-r--r--source/blender/editors/interface/view2d_ops.c2
-rw-r--r--source/blender/editors/space_action/space_action.c2
-rw-r--r--source/blender/editors/space_ipo/space_ipo.c6
-rw-r--r--source/blender/editors/space_nla/space_nla.c2
-rw-r--r--source/blender/editors/space_sequencer/space_sequencer.c4
-rw-r--r--source/blender/editors/space_sound/space_sound.c2
-rw-r--r--source/blender/editors/space_time/space_time.c2
-rw-r--r--source/blender/makesdna/DNA_view2d_types.h43
11 files changed, 113 insertions, 90 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 91120f78e9a..d4fd70fbc6d 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -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:
diff --git a/source/blender/editors/include/UI_view2d.h b/source/blender/editors/include/UI_view2d.h
index 2705c5de4f6..0eb93580220 100644
--- a/source/blender/editors/include/UI_view2d.h
+++ b/source/blender/editors/include/UI_view2d.h
@@ -35,43 +35,70 @@
/* ------------------------------------------ */
/* 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);
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index 7177d62ef4e..d9d00702234 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -57,25 +57,24 @@
/* *********************************************************************** */
/* 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);
diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c
index f1dde562c9d..d84932c82fe 100644
--- a/source/blender/editors/interface/view2d_ops.c
+++ b/source/blender/editors/interface/view2d_ops.c
@@ -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) {
diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c
index 5409fa07397..bf37f89e187 100644
--- a/source/blender/editors/space_action/space_action.c
+++ b/source/blender/editors/space_action/space_action.c
@@ -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;
diff --git a/source/blender/editors/space_ipo/space_ipo.c b/source/blender/editors/space_ipo/space_ipo.c
index 520a99d166b..4272f45ea6d 100644
--- a/source/blender/editors/space_ipo/space_ipo.c
+++ b/source/blender/editors/space_ipo/space_ipo.c
@@ -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;
diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c
index 2d05bc06c8b..71d837249fa 100644
--- a/source/blender/editors/space_nla/space_nla.c
+++ b/source/blender/editors/space_nla/space_nla.c
@@ -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;
diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c
index fc45b06e3c7..b2e2aa67c25 100644
--- a/source/blender/editors/space_sequencer/space_sequencer.c
+++ b/source/blender/editors/space_sequencer/space_sequencer.c
@@ -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;
diff --git a/source/blender/editors/space_sound/space_sound.c b/source/blender/editors/space_sound/space_sound.c
index 787d8663488..18e2c01a2e8 100644
--- a/source/blender/editors/space_sound/space_sound.c
+++ b/source/blender/editors/space_sound/space_sound.c
@@ -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;
diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c
index b74896782f3..182f0a02f6c 100644
--- a/source/blender/editors/space_time/space_time.c
+++ b/source/blender/editors/space_time/space_time.c
@@ -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;
diff --git a/source/blender/makesdna/DNA_view2d_types.h b/source/blender/makesdna/DNA_view2d_types.h
index 986996e4341..96b3febf7f3 100644
--- a/source/blender/makesdna/DNA_view2d_types.h
+++ b/source/blender/makesdna/DNA_view2d_types.h
@@ -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 */