diff options
Diffstat (limited to 'source/blender/makesdna/DNA_windowmanager_types.h')
-rw-r--r-- | source/blender/makesdna/DNA_windowmanager_types.h | 130 |
1 files changed, 111 insertions, 19 deletions
diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h index e02d2984771..ea9d0e86c38 100644 --- a/source/blender/makesdna/DNA_windowmanager_types.h +++ b/source/blender/makesdna/DNA_windowmanager_types.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -41,6 +41,7 @@ struct wmEvent; struct wmGesture; struct wmOperatorType; struct wmOperator; +struct wmKeyMap; /* forwards */ struct bContext; @@ -52,6 +53,51 @@ struct wmTimer; struct StructRNA; struct PointerRNA; struct ReportList; +struct Report; +struct uiLayout; + +#define OP_MAX_TYPENAME 64 +#define KMAP_MAX_NAME 64 + + +typedef enum ReportType { + RPT_DEBUG = 1<<0, + RPT_INFO = 1<<1, + RPT_OPERATOR = 1<<2, + RPT_WARNING = 1<<3, + RPT_ERROR = 1<<4, + RPT_ERROR_INVALID_INPUT = 1<<5, + RPT_ERROR_INVALID_CONTEXT = 1<<6, + RPT_ERROR_OUT_OF_MEMORY = 1<<7 +} ReportType; + +#define RPT_DEBUG_ALL (RPT_DEBUG) +#define RPT_INFO_ALL (RPT_INFO) +#define RPT_OPERATOR_ALL (RPT_OPERATOR) +#define RPT_WARNING_ALL (RPT_WARNING) +#define RPT_ERROR_ALL (RPT_ERROR|RPT_ERROR_INVALID_INPUT|RPT_ERROR_INVALID_CONTEXT|RPT_ERROR_OUT_OF_MEMORY) + +enum ReportListFlags { + RPT_PRINT = 1, + RPT_STORE = 2, + RPT_FREE = 4, +}; +typedef struct Report { + struct Report *next, *prev; + short type; /* ReportType */ + short flag; + int len; /* strlen(message), saves some time calculating the word wrap */ + char *typestr; + char *message; +} Report; +typedef struct ReportList { + ListBase list; + int printlevel; /* ReportType */ + int storelevel; /* ReportType */ + int flag, pad; +} ReportList; +/* reports need to be before wmWindowManager */ + /* windowmanager is saved, tag WMAN */ typedef struct wmWindowManager { @@ -68,7 +114,7 @@ typedef struct wmWindowManager { ListBase queue; /* refresh/redraw wmNotifier structs */ - ListBase reports; /* information and error reports */ + struct ReportList reports; /* information and error reports */ ListBase jobs; /* threaded jobs manager */ @@ -79,6 +125,9 @@ typedef struct wmWindowManager { } wmWindowManager; +/* wmWindowManager.initialized */ +#define WM_INIT_WINDOW 1<<0 +#define WM_INIT_KEYMAP 1<<1 /* the savable part, rest of data is local in ghostwinlay */ typedef struct wmWindow { @@ -88,7 +137,8 @@ typedef struct wmWindow { int winid, pad; /* winid also in screens, is for retrieving this window after read */ - struct bScreen *screen; /* active screen */ + struct bScreen *screen; /* active screen */ + struct bScreen *newscreen; /* temporary when switching */ char screenname[32]; /* MAX_ID_NAME for matching window with active screen after file read */ short posx, posy, sizex, sizey; /* window coords */ @@ -112,7 +162,8 @@ typedef struct wmWindow { ListBase timers; ListBase queue; /* all events (ghost level events were handled) */ - ListBase handlers; /* window+screen handlers, overriding all queues */ + ListBase handlers; /* window+screen handlers, handled last */ + ListBase modalhandlers; /* priority handlers, handled first */ ListBase subwindows; /* opengl stuff for sub windows, see notes in wm_subwindow.c */ ListBase gesture; /* gesture stuff */ @@ -123,6 +174,18 @@ typedef struct wmWindow { # # +typedef struct wmOperatorTypeMacro { + struct wmOperatorTypeMacro *next, *prev; + + /* operator id */ + char idname[MAX_ID_NAME]; + /* rna pointer to access properties, like keymap */ + struct PointerRNA *ptr; + +} wmOperatorTypeMacro; + +# +# typedef struct wmOperatorType { struct wmOperatorType *next, *prev; @@ -148,21 +211,27 @@ typedef struct wmOperatorType { * that the operator might still fail to execute even if this return true */ int (*poll)(struct bContext *); - /* panel for redo and repeat */ - void *(*uiBlock)(struct wmOperator *); + /* optional panel for redo and repeat, autogenerated if not set */ + void (*ui)(struct bContext *, struct PointerRNA *, struct uiLayout *); /* rna for properties */ struct StructRNA *srna; + /* struct wmOperatorTypeMacro */ + ListBase macro; + short flag; - + + /* pointer to modal keymap, do not free! */ + struct wmKeyMap *modalkeymap; + /* only used for operators defined with python * use to store pointers to python functions */ void *pyop_data; + int (*pyop_poll)(struct bContext *, struct wmOperatorType *ot); } wmOperatorType; -#define OP_MAX_TYPENAME 64 /* partial copy of the event, for matching by eventhandler */ typedef struct wmKeymapItem { @@ -176,10 +245,13 @@ typedef struct wmKeymapItem { short shift, ctrl, alt, oskey; /* oskey is apple or windowskey, value denotes order of pressed */ short keymodifier; /* rawkey modifier */ - short pad; + short propvalue; /* if used, the item is from modal map */ + + short inactive; /* if set, deactivated item */ + short maptype; /* keymap editor */ + short pad2, pad3; } wmKeymapItem; -#define KMAP_MAX_NAME 64 /* stored in WM, the actively used keymaps */ typedef struct wmKeyMap { @@ -188,8 +260,16 @@ typedef struct wmKeyMap { ListBase keymap; char nameid[64]; /* global editor keymaps, or for more per space/region */ - int spaceid; /* same IDs as in DNA_space_types.h */ - int regionid; /* see above */ + short spaceid; /* same IDs as in DNA_space_types.h */ + short regionid; /* see above */ + + short is_modal; /* modal map, not using operatornames */ + short pad; + + void *items; /* struct EnumPropertyItem for now */ + + /* verify if the keymap is enabled in the current context */ + int (*poll)(struct bContext *); } wmKeyMap; @@ -205,8 +285,14 @@ typedef struct wmOperator { /* runtime */ wmOperatorType *type; /* operator type definition from idname */ void *customdata; /* custom storage, only while operator runs */ + struct PointerRNA *ptr; /* rna pointer to access properties */ struct ReportList *reports; /* errors and warnings storage */ + + ListBase macro; /* list of operators, can be a tree */ + struct wmOperator *opm; /* current running macro, not saved */ + short flag, pad[3]; + } wmOperator; /* operator type exec(), invoke() modal(), return values */ @@ -216,11 +302,8 @@ typedef struct wmOperator { /* add this flag if the event should pass through */ #define OPERATOR_PASS_THROUGH 8 -typedef enum wmRadialControlMode { - WM_RADIALCONTROL_SIZE, - WM_RADIALCONTROL_STRENGTH, - WM_RADIALCONTROL_ANGLE -} wmRadialControlMode; +/* wmOperator flag */ + /* ************** wmEvent ************************ */ /* for read-only rna access, dont save this */ @@ -243,15 +326,24 @@ typedef struct wmEvent { short shift, ctrl, alt, oskey; /* oskey is apple or windowskey, value denotes order of pressed */ short keymodifier; /* rawkey modifier */ + short pad1; + /* keymap item, set by handler (weak?) */ const char *keymap_idname; /* custom data */ - short custom; /* custom data type, stylus, 6dof, see wm_event_types.h */ - void *customdata; /* ascii, unicode, mouse coords, angles, vectors, dragdrop info */ + short custom; /* custom data type, stylus, 6dof, see wm_event_types.h */ short customdatafree; + int pad2; + void *customdata; /* ascii, unicode, mouse coords, angles, vectors, dragdrop info */ } wmEvent; +typedef enum wmRadialControlMode { + WM_RADIALCONTROL_SIZE, + WM_RADIALCONTROL_STRENGTH, + WM_RADIALCONTROL_ANGLE +} wmRadialControlMode; + #endif /* DNA_WINDOWMANAGER_TYPES_H */ |