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