Blender  V2.59
DNA_view2d_types.h
Go to the documentation of this file.
00001 /*
00002  * $Id: DNA_view2d_types.h 34941 2011-02-17 20:48:12Z jesterking $ 
00003  *
00004  * ***** BEGIN GPL LICENSE BLOCK *****
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software Foundation,
00018  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019  *
00020  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00021  * All rights reserved.
00022  *
00023  * The Original Code is: all of this file.
00024  *
00025  * Contributor(s): Joshua Leung
00026  *
00027  * ***** END GPL LICENSE BLOCK *****
00028  */
00029 #ifndef DNA_VIEW2D_TYPES_H
00030 #define DNA_VIEW2D_TYPES_H
00031 
00036 #include "DNA_vec_types.h"
00037 
00038 /* ---------------------------------- */
00039 
00040 /* View 2D data - stored per region */
00041 typedef struct View2D {
00042         rctf tot, cur;                                  /* tot - area that data can be drawn in; cur - region of tot that is visible in viewport */
00043         rcti vert, hor;                                 /* vert - vertical scrollbar region; hor - horizontal scrollbar region */
00044         rcti mask;                                              /* mask - region (in screenspace) within which 'cur' can be viewed */
00045         
00046         float min[2], max[2];                   /* min/max sizes of 'cur' rect (only when keepzoom not set) */
00047         float minzoom, maxzoom;                 /* self explanatory. allowable zoom factor range (only when keepzoom set) */
00048         
00049         short scroll;                                   /* scroll - scrollbars to display (bitflag) */
00050         short scroll_ui;                                /* scroll_ui - temp settings used for UI drawing of scrollers */
00051         
00052         short keeptot;                                  /* keeptot - 'cur' rect cannot move outside the 'tot' rect? */
00053         short keepzoom;                                 /* keepzoom - axes that zooming cannot occur on, and also clamp within zoom-limits */
00054         short keepofs;                                  /* keepofs - axes that translation is not allowed to occur on */
00055         
00056         short flag;                                             /* settings */
00057         short align;                                    /* alignment of content in totrect */
00058         
00059         short winx, winy;                               /* storage of current winx/winy values, set in UI_view2d_size_update */
00060         short oldwinx, oldwiny;                 /* storage of previous winx/winy values encountered by UI_view2d_curRect_validate(), for keepaspect */
00061         
00062         short around;                                   /* pivot point for transforms (rotate and scale) */
00063 
00064         float *tab_offset;                              /* different offset per tab, for buttons */
00065         int tab_num;                                    /* number of tabs stored */
00066         int tab_cur;                                    /* current tab */
00067 } View2D;
00068 
00069 /* ---------------------------------- */
00070 
00071 /* view zooming restrictions, per axis (v2d->keepzoom) */
00072         /* zoom is clamped to lie within limits set by minzoom and maxzoom */
00073 #define V2D_LIMITZOOM           0x0001
00074         /* aspect ratio is maintained on view resize */
00075 #define V2D_KEEPASPECT          0x0002
00076         /* zoom is kept when the window resizes */
00077 #define V2D_KEEPZOOM            0x0004
00078         /* zooming on x-axis is not allowed */
00079 #define V2D_LOCKZOOM_X          0x0100
00080         /* zooming on y-axis is not allowed */
00081 #define V2D_LOCKZOOM_Y          0x0200
00082 
00083 /* view panning restrictions, per axis (v2d->keepofs) */
00084         /* panning on x-axis is not allowed */
00085 #define V2D_LOCKOFS_X   (1<<1)
00086         /* panning on y-axis is not allowed */
00087 #define V2D_LOCKOFS_Y   (1<<2)
00088         /* on resize, keep the x offset */
00089 #define V2D_KEEPOFS_X   (1<<3)
00090         /* on resize, keep the y offset */
00091 #define V2D_KEEPOFS_Y   (1<<4)
00092 
00093 /* view extent restrictions (v2d->keeptot) */
00094         /* 'cur' view can be out of extents of 'tot' */
00095 #define V2D_KEEPTOT_FREE                0
00096         /* 'cur' rect is adjusted so that it satisfies the extents of 'tot', with some compromises */
00097 #define V2D_KEEPTOT_BOUNDS              1
00098         /* 'cur' rect is moved so that the 'minimum' bounds of the 'tot' rect are always respected (particularly in x-axis) */
00099 #define V2D_KEEPTOT_STRICT              2
00100 
00101 /* general refresh settings (v2d->flag) */
00102         /* global view2d horizontal locking (for showing same time interval) */
00103 #define V2D_VIEWSYNC_SCREEN_TIME        (1<<0)
00104         /* within area (i.e. between regions) view2d vertical locking */
00105 #define V2D_VIEWSYNC_AREA_VERTICAL      (1<<1)
00106         /* apply pixel offsets on x-axis when setting view matrices */
00107 #define V2D_PIXELOFS_X                          (1<<2)
00108         /* apply pixel offsets on y-axis when setting view matrices */
00109 #define V2D_PIXELOFS_Y                          (1<<3)
00110         /* view settings need to be set still... */
00111 #define V2D_IS_INITIALISED                      (1<<10)
00112 
00113 /* scroller flags for View2D (v2d->scroll) */
00114         /* left scrollbar */
00115 #define V2D_SCROLL_LEFT                         (1<<0)          
00116 #define V2D_SCROLL_RIGHT                        (1<<1)
00117 #define V2D_SCROLL_VERTICAL             (V2D_SCROLL_LEFT|V2D_SCROLL_RIGHT)
00118         /* horizontal scrollbar */
00119 #define V2D_SCROLL_TOP                          (1<<2)
00120 #define V2D_SCROLL_BOTTOM                       (1<<3)
00121         /* special hack for outliner hscroll - prevent hanging older versions of Blender */
00122 #define V2D_SCROLL_BOTTOM_O             (1<<4)
00123 #define V2D_SCROLL_HORIZONTAL           (V2D_SCROLL_TOP|V2D_SCROLL_BOTTOM|V2D_SCROLL_BOTTOM_O)
00124         /* scale markings - vertical */
00125 #define V2D_SCROLL_SCALE_VERTICAL       (1<<5)
00126         /* scale markings - horizontal */       
00127 #define V2D_SCROLL_SCALE_HORIZONTAL     (1<<6)
00128         /* induce hiding of scrollbars - set by region drawing in response to size of region */
00129 #define V2D_SCROLL_VERTICAL_HIDE        (1<<7)          
00130 #define V2D_SCROLL_HORIZONTAL_HIDE      (1<<8)
00131         /* scrollbar extends beyond its available window - set when calculating scrollbars for drawing */
00132 #define V2D_SCROLL_VERTICAL_FULLR       (1<<9)  
00133 #define V2D_SCROLL_HORIZONTAL_FULLR (1<<10)     
00134 
00135 /* scroll_ui, activate flag for drawing */
00136 #define V2D_SCROLL_H_ACTIVE                     (1<<0)
00137 #define V2D_SCROLL_V_ACTIVE                     (1<<1)
00138 
00139 /* alignment flags for totrect, flags use 'shading-out' convention (v2d->align) */
00140         /* all quadrants free */
00141 #define V2D_ALIGN_FREE                  0
00142         /* horizontal restrictions */
00143 #define V2D_ALIGN_NO_POS_X              (1<<0)
00144 #define V2D_ALIGN_NO_NEG_X              (1<<1)
00145         /* vertical restrictions */
00146 #define V2D_ALIGN_NO_POS_Y              (1<<2)
00147 #define V2D_ALIGN_NO_NEG_Y              (1<<3)
00148 
00149 
00150 #endif
00151