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
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/makesdna/DNA_view2d_types.h')
-rw-r--r--source/blender/makesdna/DNA_view2d_types.h101
1 files changed, 80 insertions, 21 deletions
diff --git a/source/blender/makesdna/DNA_view2d_types.h b/source/blender/makesdna/DNA_view2d_types.h
index d7c422407ca..986996e4341 100644
--- a/source/blender/makesdna/DNA_view2d_types.h
+++ b/source/blender/makesdna/DNA_view2d_types.h
@@ -24,7 +24,7 @@
*
* The Original Code is: all of this file.
*
- * Contributor(s): none yet.
+ * Contributor(s): Joshua Leung
*
* ***** END GPL LICENSE BLOCK *****
*/
@@ -33,32 +33,91 @@
#include "DNA_vec_types.h"
+/* ---------------------------------- */
+
+/* View 2D data - stored per region */
typedef struct View2D {
- rctf tot, cur;
- rcti vert, hor, mask;
- float min[2], max[2];
- float minzoom, maxzoom;
- short scroll, keeptot;
- short keepaspect, keepzoom;
- short oldwinx, oldwiny;
- int flag;
+ rctf tot, cur; /* tot - area that data can be drawn in; cur - region of tot that is visible in viewport */
+ rcti vert, hor; /* vert - vertical scrollbar region; hor - horizontal scrollbar region */
+ rcti mask; /* mask - region (in screenspace) within which 'cur' can be viewed */
+
+ float min[2], max[2]; /* min/max sizes of 'cur' rect (only when keepzoom not set) */
+ float minzoom, maxzoom; /* self explanatory. allowable zoom factor range (only when keepzoom set) */
+
+ short scroll; /* scroll - scrollbars to display (bitflag) */
+ 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?
- float cursor[2]; /* only used in the UV view for now*/
- short around;
- char pad[6];
+ 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 */
+
+ short around; /* pivot point for transforms (rotate and scale) */
+ float cursor[2]; /* only used in the UV view for now (for 2D-cursor) */
} View2D;
-/* v2d->keepzoom */
-#define V2D_KEEPZOOM 0x0001
-#define V2D_LOCKZOOM_X 0x0100
-#define V2D_LOCKZOOM_Y 0x0200
+/* ---------------------------------- */
+
+/* view zooming restrictions, per axis (v2d->keepzoom) */
+#define V2D_KEEPZOOM 0x0001
+#define V2D_KEEPASPECT 0x0002
+#define V2D_LOCKZOOM_X 0x0100
+#define V2D_LOCKZOOM_Y 0x0200
+
+/* view panning restrictions, per axis (v2d->keepofs) */
+#define V2D_LOCKOFS_X (1<<1)
+#define V2D_LOCKOFS_Y (1<<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
+
+
+/* scroller flags for View2D (v2d->scroll) */
+ /* left scrollbar */
+#define V2D_SCROLL_LEFT (1<<0)
+#define V2D_SCROLL_RIGHT (1<<1)
+#define V2D_SCROLL_VERTICAL (V2D_SCROLL_LEFT|V2D_SCROLL_RIGHT)
+ /* 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 */
+#define V2D_SCROLL_BOTTOM_O (1<<4)
+#define V2D_SCROLL_HORIZONTAL_O (V2D_SCROLL_TOP|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)
-/* event codes for locking function */
-#define V2D_LOCK_COPY 1
-#define V2D_LOCK_REDRAW 2
+/* alignment flags for totrect, flags use 'shading-out' convention (v2d->align) */
+ /* all quadrants free */
+#define V2D_ALIGN_FREE 0
+ /* horizontal restrictions */
+#define V2D_ALIGN_NO_POS_X (1<<0)
+#define V2D_ALIGN_NO_NEG_X (1<<1)
+ /* vertical restrictions */
+#define V2D_ALIGN_NO_POS_Y (1<<2)
+#define V2D_ALIGN_NO_NEG_Y (1<<3)
-/* v2d->flag */
-#define V2D_VIEWLOCK 1
#endif