Blender V2.61 - r43446

DNA_view2d_types.h

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