Blender V2.61 - r43446

DNA_screen_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  * Contributor(s): Blender Foundation
00022  *
00023  * ***** END GPL LICENSE BLOCK *****
00024  */
00025 
00030 #ifndef DNA_SCREEN_TYPES_H
00031 #define DNA_SCREEN_TYPES_H
00032 
00033 #include "DNA_listBase.h"
00034 #include "DNA_view2d_types.h"
00035 #include "DNA_vec_types.h"
00036 
00037 #include "DNA_ID.h"
00038 
00039 struct SpaceType;
00040 struct SpaceLink;
00041 struct ARegion;
00042 struct ARegionType;
00043 struct PanelType;
00044 struct HeaderType;
00045 struct Scene;
00046 struct uiLayout;
00047 struct wmTimer;
00048 
00049 typedef struct bScreen {
00050     ID id;
00051     
00052     ListBase vertbase;                  /* screens have vertices/edges to define areas */
00053     ListBase edgebase;
00054     ListBase areabase;
00055     ListBase regionbase;                /* screen level regions (menus), runtime only */
00056     
00057     struct Scene *scene;
00058     struct Scene *newscene;             /* temporary when switching */
00059     
00060     int redraws_flag;                   /* user-setting for which editors get redrawn during anim playback (used to be time->redraws) */
00061     int pad1;
00062     
00063     short full;                         /* temp screen for image render display or fileselect */
00064     short temp;                         /* temp screen in a temp window, don't save (like user prefs) */
00065     short winid;                        /* winid from WM, starts with 1 */
00066     short do_draw;                      /* notifier for drawing edges */
00067     short do_refresh;                   /* notifier for scale screen, changed screen, etc */
00068     short do_draw_gesture;              /* notifier for gesture draw. */
00069     short do_draw_paintcursor;          /* notifier for paint cursor draw. */
00070     short do_draw_drag;                 /* notifier for dragging draw. */
00071     short swap;                         /* indicator to survive swap-exchange systems */
00072     
00073     short mainwin;                      /* screensize subwindow, for screenedges and global menus */
00074     short subwinactive;                 /* active subwindow */
00075     
00076     short pad;
00077     
00078     struct wmTimer *animtimer;          /* if set, screen has timer handler added in window */
00079     void *context;                      /* context callback */
00080     
00081     short handler[8];                   /* similar to space handler */
00082 } bScreen;
00083 
00084 typedef struct ScrVert {
00085     struct ScrVert *next, *prev, *newv;
00086     vec2s vec;
00087     int flag;
00088 } ScrVert;
00089 
00090 typedef struct ScrEdge {
00091     struct ScrEdge *next, *prev;
00092     ScrVert *v1, *v2;
00093     short border;           /* 1 when at edge of screen */
00094     short flag;
00095     int pad;
00096 } ScrEdge;
00097 
00098 typedef struct Panel {      /* the part from uiBlock that needs saved in file */
00099     struct Panel *next, *prev;
00100 
00101     struct PanelType *type;         /* runtime */
00102     struct uiLayout *layout;        /* runtime for drawing */
00103 
00104     char panelname[64], tabname[64];    /* defined as UI_MAX_NAME_STR */
00105     char drawname[64];                  /* panelname is identifier for restoring location */
00106     short ofsx, ofsy, sizex, sizey;
00107     short labelofs, pad;
00108     short flag, runtime_flag;
00109     short control;
00110     short snap;
00111     int sortorder;          /* panels are aligned according to increasing sortorder */
00112     struct Panel *paneltab;     /* this panel is tabbed in *paneltab */
00113     void *activedata;           /* runtime for panel manipulation */
00114 
00115     int list_scroll, list_size;
00116     int list_last_len, list_grip_size;
00117     char list_search[64];
00118 } Panel;
00119 
00120 typedef struct ScrArea {
00121     struct ScrArea *next, *prev;
00122     
00123     ScrVert *v1, *v2, *v3, *v4;
00124     bScreen *full;          /* if area==full, this is the parent */
00125 
00126     rcti totrct;            /* rect bound by v1 v2 v3 v4 */
00127 
00128     char spacetype, butspacetype;   /* SPACE_..., butspacetype is button arg  */
00129     short winx, winy;               /* size */
00130     
00131     short headertype;               /* OLD! 0=no header, 1= down, 2= up */
00132     short pad;
00133     short do_refresh;               /* private, for spacetype refresh callback */
00134     short cursor, flag;
00135     
00136     struct SpaceType *type;     /* callbacks for this space type */
00137     
00138     ListBase spacedata;     /* SpaceLink */
00139     ListBase regionbase;    /* ARegion */
00140     ListBase handlers;      /* wmEventHandler */
00141     
00142     ListBase actionzones;   /* AZone */
00143 } ScrArea;
00144 
00145 typedef struct ARegion {
00146     struct ARegion *next, *prev;
00147     
00148     View2D v2d;                 /* 2D-View scrolling/zoom info (most regions are 2d anyways) */
00149     rcti winrct;                /* coordinates of region */
00150     rcti drawrct;               /* runtime for partial redraw, same or smaller than winrct */
00151     short winx, winy;           /* size */
00152     
00153     short swinid;
00154     short regiontype;           /* window, header, etc. identifier for drawing */
00155     short alignment;            /* how it should split */
00156     short flag;                 /* hide, ... */
00157     
00158     float fsize;                /* current split size in float (unused) */
00159     short sizex, sizey;         /* current split size in pixels (if zero it uses regiontype) */
00160     
00161     short do_draw;              /* private, cached notifier events */
00162     short do_draw_overlay;      /* private, cached notifier events */
00163     short swap;                 /* private, indicator to survive swap-exchange */
00164     short pad[3];
00165     
00166     struct ARegionType *type;   /* callbacks for this region type */
00167     
00168     ListBase uiblocks;          /* uiBlock */
00169     ListBase panels;            /* Panel */
00170     ListBase handlers;          /* wmEventHandler */
00171     
00172     char *headerstr;            /* use this string to draw info */
00173     void *regiondata;           /* XXX 2.50, need spacedata equivalent? */
00174 } ARegion;
00175 
00176 /* swap */
00177 #define WIN_BACK_OK     1
00178 #define WIN_FRONT_OK    2
00179 #define WIN_EQUAL       3
00180 
00181 /* area->flag */
00182 #define HEADER_NO_PULLDOWN      1
00183 #define AREA_FLAG_DRAWJOINTO    2
00184 #define AREA_FLAG_DRAWJOINFROM  4
00185 #define AREA_TEMP_INFO          8
00186 #define AREA_FLAG_DRAWSPLIT_H   16
00187 #define AREA_FLAG_DRAWSPLIT_V   32
00188 
00189 #define EDGEWIDTH   1
00190 #define AREAGRID    4
00191 #define AREAMINX    32
00192 #define HEADERY     26
00193 #define AREAMINY    (HEADERY+EDGEWIDTH)
00194 
00195 #define HEADERDOWN  1
00196 #define HEADERTOP   2
00197 
00198 /* screen->full */
00199 #define SCREENNORMAL    0
00200 #define SCREENFULL      1
00201 #define SCREENFULLTEMP  2
00202 
00203 
00204 /* Panel->snap - for snapping to screen edges */
00205 #define PNL_SNAP_NONE       0
00206 /* #define PNL_SNAP_TOP     1 */
00207 /* #define PNL_SNAP_RIGHT       2 */
00208 #define PNL_SNAP_BOTTOM     4
00209 /* #define PNL_SNAP_LEFT        8 */
00210 
00211 /* #define PNL_SNAP_DIST        9.0 */
00212 
00213 /* paneltype flag */
00214 #define PNL_DEFAULT_CLOSED      1
00215 #define PNL_NO_HEADER           2
00216 
00217 /* screen handlers */
00218 #define SCREEN_MAXHANDLER       8
00219 
00220 #define SCREEN_HANDLER_ANIM     1
00221 #define SCREEN_HANDLER_PYTHON   2
00222 #define SCREEN_HANDLER_VERSE    3
00223 
00224 /* regiontype, first two are the default set */
00225 /* Do NOT change order, append on end. Types are hardcoded needed */
00226 enum {
00227     RGN_TYPE_WINDOW = 0,
00228     RGN_TYPE_HEADER,
00229     RGN_TYPE_CHANNELS,
00230     RGN_TYPE_TEMPORARY,
00231     RGN_TYPE_UI,
00232     RGN_TYPE_TOOLS,
00233     RGN_TYPE_TOOL_PROPS,
00234     RGN_TYPE_PREVIEW
00235 };
00236 
00237 /* region alignment */
00238 #define RGN_ALIGN_NONE      0
00239 #define RGN_ALIGN_TOP       1
00240 #define RGN_ALIGN_BOTTOM    2
00241 #define RGN_ALIGN_LEFT      3
00242 #define RGN_ALIGN_RIGHT     4
00243 #define RGN_ALIGN_HSPLIT    5
00244 #define RGN_ALIGN_VSPLIT    6
00245 #define RGN_ALIGN_FLOAT     7
00246 #define RGN_ALIGN_QSPLIT    8
00247 #define RGN_OVERLAP_TOP     9
00248 #define RGN_OVERLAP_BOTTOM  10
00249 #define RGN_OVERLAP_LEFT    11
00250 #define RGN_OVERLAP_RIGHT   12
00251 
00252 #define RGN_SPLIT_PREV      32
00253 
00254 /* region flag */
00255 #define RGN_FLAG_HIDDEN     1
00256 #define RGN_FLAG_TOO_SMALL  2
00257 
00258 /* region do_draw */
00259 #define RGN_DRAW            1
00260 #define RGN_DRAW_PARTIAL    2
00261 
00262 #endif
00263