diff options
author | Ton Roosendaal <ton@blender.org> | 2007-12-24 21:53:37 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2007-12-24 21:53:37 +0300 |
commit | 463cf8e3328bf8a00117567a59343a90ec17ee3d (patch) | |
tree | 90a8725de1d8dd5e15d48247d9001d67beb345fd /source/blender/makesdna | |
parent | c79966be52e251cc7b1028ea4d3012b44eb6a8af (diff) |
Part 4 of the event refactor branch: all changes in existing files,
Makefiles especially, and of course the windowmanager DNA!
Diffstat (limited to 'source/blender/makesdna')
-rw-r--r-- | source/blender/makesdna/DNA_ID.h | 9 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_screen_types.h | 32 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_windowmanager_types.h | 159 | ||||
-rw-r--r-- | source/blender/makesdna/intern/makesdna.c | 5 |
4 files changed, 191 insertions, 14 deletions
diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index 57aec75700f..3b078e2bd68 100644 --- a/source/blender/makesdna/DNA_ID.h +++ b/source/blender/makesdna/DNA_ID.h @@ -77,11 +77,11 @@ typedef struct IDProperty { #define IDP_FLOAT 2 #define IDP_ARRAY 5 #define IDP_GROUP 6 -/*the ID link property type hasn't been implemented yet, this will require - some cleanup of blenkernel, most likely.*/ +/* the ID link property type hasn't been implemented yet, this will require + some cleanup of blenkernel, most likely.*/ #define IDP_ID 7 -/*add any future new id property types here.*/ +/* add any future new id property types here.*/ /* watch it: Sequence has identical beginning. */ /** @@ -89,6 +89,8 @@ typedef struct IDProperty { * provides a common handle to place all data in double-linked lists. * */ +#define MAX_ID_NAME 24 + /* There's a nasty circular dependency here.... void* to the rescue! I * really wonder why this is needed. */ typedef struct ID { @@ -184,6 +186,7 @@ typedef struct PreviewImage { #define ID_NT MAKE_ID2('N', 'T') #define ID_BR MAKE_ID2('B', 'R') #define ID_PA MAKE_ID2('P', 'A') +#define ID_WM MAKE_ID2('W', 'M') /* NOTE! Fake IDs, needed for g.sipo->blocktype or outliner */ #define ID_SEQ MAKE_ID2('S', 'Q') diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h index 65374983af5..7b34ee2482d 100644 --- a/source/blender/makesdna/DNA_screen_types.h +++ b/source/blender/makesdna/DNA_screen_types.h @@ -3,15 +3,12 @@ * * $Id$ * - * ***** BEGIN GPL/BL DUAL LICENSE BLOCK ***** + * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. The Blender - * Foundation also sells licenses for use in proprietary software under - * the Blender License. See http://www.blender.org/BL/ for information - * about this. + * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -25,11 +22,10 @@ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. * - * The Original Code is: all of this file. + * + * Contributor(s): Blender Foundation * - * Contributor(s): none yet. - * - * ***** END GPL/BL DUAL LICENSE BLOCK ***** + * ***** END GPL LICENSE BLOCK ***** */ #ifndef DNA_SCREEN_TYPES_H #define DNA_SCREEN_TYPES_H @@ -44,14 +40,17 @@ struct Scene; typedef struct bScreen { ID id; + ListBase vertbase, edgebase, areabase; struct Scene *scene; short startx, endx, starty, endy; /* framebuffer coords */ short sizex, sizey; short scenenr, screennr; /* only for pupmenu */ - short full, pad; + short full, winid; /* win id from WM, starts with 1 */ short mainwin, winakt; short handler[8]; /* similar to space handler now */ + + ListBase handlers; } bScreen; typedef struct ScrVert { @@ -82,6 +81,7 @@ typedef unsigned short dna_ushort_fix; typedef struct Panel { /* the part from uiBlock that needs saved in file */ struct Panel *next, *prev; + char panelname[64], tabname[64]; /* defined as UI_MAX_NAME_STR */ char drawname[64]; /* panelname is identifier for restoring location */ short ofsx, ofsy, sizex, sizey; @@ -95,6 +95,7 @@ typedef struct Panel { /* the part from uiBlock that needs saved in file */ typedef struct ScrArea { struct ScrArea *next, *prev; + ScrVert *v1, *v2, *v3, *v4; bScreen *full; /* if area==full, this is the parent */ float winmat[4][4]; @@ -115,8 +116,19 @@ typedef struct ScrArea { ListBase spacedata; ListBase uiblocks; ListBase panels; + ListBase regionbase; + ListBase handlers; } ScrArea; +typedef struct ARegion { + struct ARegion *next, *prev; + + rcti winrct; + + ListBase handlers; + +} ARegion; + #define MAXWIN 128 /* area->flag */ diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h new file mode 100644 index 00000000000..dd05e5ee397 --- /dev/null +++ b/source/blender/makesdna/DNA_windowmanager_types.h @@ -0,0 +1,159 @@ +/** + * $Id: + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * The Original Code is Copyright (C) 2007 Blender Foundation. + * All rights reserved. + * + * + * Contributor(s): Blender Foundation + * + * ***** END GPL LICENSE BLOCK ***** + */ +#ifndef DNA_WINDOWMANAGER_TYPES_H +#define DNA_WINDOWMANAGER_TYPES_H + +#include "DNA_listBase.h" +#include "DNA_vec_types.h" + +#include "DNA_ID.h" + +/* defined here: */ +struct wmWindowManager; +struct wmWindow; + +struct wmEvent; +struct wmOperatorType; +struct wmOperator; + +/* forwards */ +struct bContext; +struct wmLocal; +struct bScreen; +struct uiBlock; + +/* windowmanager is saved, tag WMAN */ +typedef struct wmWindowManager { + ID id; + + struct wmWindow *windrawable, *winactive; /* separate active from drawable */ + ListBase windows; + + int initialized; /* set on file read */ + int pad; + + ListBase operators; /* operator registry */ + + /* custom keymaps */ + ListBase windowkeymap; + ListBase screenkeymap; + +} wmWindowManager; + + +/* the savable part, rest of data is local in ghostwinlay */ +typedef struct wmWindow { + struct wmWindow *next, *prev; + + void *ghostwin; /* dont want to include ghost.h stuff */ + void *timer; + int timer_event; + + int winid; /* winid also in screens, is for retrieving this window after read */ + + struct bScreen *screen; /* active screen */ + char screenname[32]; /* MAX_ID_NAME for matching window with active screen after file read */ + + short posx, posy, sizex, sizey; /* window coords */ + short windowstate; /* borderless, full */ + short monitor; /* multiscreen... no idea how to store yet */ + short active; /* set to 1 if an active window, for quick rejects */ + short cursor; /* mouse cursor */ + + struct wmEvent *eventstate; /* storage for event system */ + + ListBase queue; /* events */ + ListBase handlers; +} wmWindow; + +# +# +typedef struct wmOperatorType { + struct wmOperatorType *next, *prev; + + char *name; /* text for ui, undo */ + char *idname; /* unique identifier */ + + /* this callback alters UI, adds handlers, uses cb's below */ + int (*interactive)(struct bContext *, struct wmOperator *, struct wmEvent *event); + + void (*init)(struct bContext *, struct wmOperator *); + int (*exec)(struct bContext *, struct wmOperator *); + void (*exit)(struct bContext *, struct wmOperator *); + + int (*poll)(struct bContext *); + + void *(*uiBlock)(struct wmOperator *); /* panel for redo or repeat */ + + char *customname; /* dna name */ + void *customdata; /* defaults */ + + short flag; + +} wmOperatorType; + +#define OP_MAX_TYPENAME 64 + +/* partial copy of the event, for matching by eventhandler */ +typedef struct wmKeymapItem { + struct wmKeymapItem *next, *prev; + + char idname[64]; /* used to retrieve operator type pointer */ + + short type; /* event code itself */ + short val; /* 0=any, 1=click, 2=release, or wheelvalue, or... */ + short shift, ctrl, alt, oskey; /* oskey is apple or windowskey, value denotes order of pressed */ + short keymodifier; /* rawkey modifier */ + + short pad; +} wmKeymapItem; + + +/* this one is the operator itself, stored in files for macros etc */ +/* operator + operatortype should be able to redo entirely, but for different contextes */ +typedef struct wmOperator { + struct wmOperator *next, *prev; + + wmOperatorType *type; + char idname[64]; /* used to retrieve type pointer */ + + /* default storage (lazy?) */ + void *argv1, *argv2; + float argf1, argf2; + int arg1, arg2; + + /* custom storage, dna pointer */ + void *customdata; /* XXX dynamic properties! */ + + +} wmOperator; + + + +#endif /* DNA_WINDOWMANAGER_TYPES_H */ + diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c index f696c45b315..efc2c8b1f34 100644 --- a/source/blender/makesdna/intern/makesdna.c +++ b/source/blender/makesdna/intern/makesdna.c @@ -130,6 +130,7 @@ char *includefiles[] = { "DNA_particle_types.h", // if you add files here, please add them at the end // of makesdna.c (this file) as well + "DNA_windowmanager_types.h", // empty string to indicate end of includefiles "" @@ -517,7 +518,7 @@ int convert_include(char *filename) overslaan= 0; while(count<filelen) { - /* code for skipping a struct: two hashes. (preprocess added a space) */ + /* code for skipping a struct: two hashes on 2 lines. (preprocess added a space) */ if(md[0]=='#' && md[1]==' ' && md[2]=='#') { overslaan= 1; } @@ -1148,4 +1149,6 @@ int main(int argc, char ** argv) #include "DNA_brush_types.h" #include "DNA_customdata_types.h" #include "DNA_particle_types.h" +#include "DNA_windowmanager_types.h" + /* end of list */ |