2 * blenlib/DNA_view2d_types.h (mar-2001 nzc)
6 * ***** BEGIN GPL LICENSE BLOCK *****
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software Foundation,
20 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
23 * All rights reserved.
25 * The Original Code is: all of this file.
27 * Contributor(s): Joshua Leung
29 * ***** END GPL LICENSE BLOCK *****
31 #ifndef DNA_VIEW2D_TYPES_H
32 #define DNA_VIEW2D_TYPES_H
34 #include "DNA_vec_types.h"
36 /* ---------------------------------- */
38 /* View 2D data - stored per region */
39 typedef struct View2D {
40 rctf tot, cur; /* tot - area that data can be drawn in; cur - region of tot that is visible in viewport */
41 rcti vert, hor; /* vert - vertical scrollbar region; hor - horizontal scrollbar region */
42 rcti mask; /* mask - region (in screenspace) within which 'cur' can be viewed */
44 float min[2], max[2]; /* min/max sizes of 'cur' rect (only when keepzoom not set) */
45 float minzoom, maxzoom; /* self explanatory. allowable zoom factor range (only when keepzoom set) */
47 short scroll; /* scroll - scrollbars to display (bitflag) */
48 short scroll_ui; /* scroll_ui - temp settings used for UI drawing of scrollers */
50 short keeptot; /* keeptot - 'cur' rect cannot move outside the 'tot' rect? */
51 short keepzoom; /* keepzoom - axes that zooming cannot occur on, and also clamp within zoom-limits */
52 short keepofs; /* keepofs - axes that translation is not allowed to occur on */
54 short flag; /* settings */
55 short align; /* alignment of content in totrect */
57 short winx, winy; /* storage of current winx/winy values, set in UI_view2d_size_update */
58 short oldwinx, oldwiny; /* storage of previous winx/winy values encountered by UI_view2d_curRect_validate(), for keepaspect */
60 short around; /* pivot point for transforms (rotate and scale) */
61 float cursor[2]; /* only used in the UV view for now (for 2D-cursor) */
64 /* ---------------------------------- */
66 /* view zooming restrictions, per axis (v2d->keepzoom) */
67 /* zoom is clamped to lie within limits set by minzoom and maxzoom */
68 #define V2D_KEEPZOOM 0x0001
69 /* aspect ratio is maintained on view resize */
70 #define V2D_KEEPASPECT 0x0002
71 /* zooming on x-axis is not allowed */
72 #define V2D_LOCKZOOM_X 0x0100
73 /* zooming on y-axis is not allowed */
74 #define V2D_LOCKZOOM_Y 0x0200
76 /* view panning restrictions, per axis (v2d->keepofs) */
77 /* panning on x-axis is not allowed */
78 #define V2D_LOCKOFS_X (1<<1)
79 /* panning on y-axis is not allowed */
80 #define V2D_LOCKOFS_Y (1<<2)
82 /* view extent restrictions (v2d->keeptot) */
83 /* 'cur' view can be out of extents of 'tot' */
84 #define V2D_KEEPTOT_FREE 0
85 /* 'cur' rect is adjusted so that it satisfies the extents of 'tot', with some compromises */
86 #define V2D_KEEPTOT_BOUNDS 1
87 /* 'cur' rect is moved so that the 'minimum' bounds of the 'tot' rect are always respected (particularly in x-axis) */
88 #define V2D_KEEPTOT_STRICT 2
90 /* general refresh settings (v2d->flag) */
91 /* global view2d horizontal locking (for showing same time interval) */
92 #define V2D_VIEWSYNC_X (1<<0)
93 /* within region view2d vertical locking */
94 #define V2D_VIEWSYNC_Y (1<<1)
95 /* view settings need to be set still... */
96 #define V2D_IS_INITIALISED (1<<10)
98 /* scroller flags for View2D (v2d->scroll) */
100 #define V2D_SCROLL_LEFT (1<<0)
101 #define V2D_SCROLL_RIGHT (1<<1)
102 #define V2D_SCROLL_VERTICAL (V2D_SCROLL_LEFT|V2D_SCROLL_RIGHT)
103 /* horizontal scrollbar */
104 #define V2D_SCROLL_TOP (1<<2)
105 #define V2D_SCROLL_BOTTOM (1<<3)
106 /* special hack for outliner hscroll - prevent hanging older versions of Blender */
107 #define V2D_SCROLL_BOTTOM_O (1<<4)
108 #define V2D_SCROLL_HORIZONTAL (V2D_SCROLL_TOP|V2D_SCROLL_BOTTOM|V2D_SCROLL_BOTTOM_O)
109 /* scale markings - vertical */
110 #define V2D_SCROLL_SCALE_VERTICAL (1<<5)
111 /* scale markings - horizontal */
112 #define V2D_SCROLL_SCALE_HORIZONTAL (1<<6)
114 /* alignment flags for totrect, flags use 'shading-out' convention (v2d->align) */
115 /* all quadrants free */
116 #define V2D_ALIGN_FREE 0
117 /* horizontal restrictions */
118 #define V2D_ALIGN_NO_POS_X (1<<0)
119 #define V2D_ALIGN_NO_NEG_X (1<<1)
120 /* vertical restrictions */
121 #define V2D_ALIGN_NO_POS_Y (1<<2)
122 #define V2D_ALIGN_NO_NEG_Y (1<<3)