From 54c4ed469ad632b06e444ff577f35effca952e38 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Wed, 10 Dec 2008 13:56:54 +0000 Subject: 2.5 Cleanup in area/region management - more intelligence in area management for adding handlers and setting data correct. Space/Region type callbacks only have to do own things. - added option for adding default handlers to areas/regions. (flag in type definition) - ensured that region-types store the minsizes for regions. - added boundbox check for handlers; note that it accepts pointer to boundbox, because handlers don't get reset on area-resizing or view changes. Example: view2d handlers use mask rect. - handlers get now added on correct context levels (example frame change also worked in header) - removed ->refresh() callback. Context refreshing is Listener. - the ->init() is being called on all WM level actions, also after a file read, moving areas, re-opening areas etc. - fixed bug: crash on exit was caused by cleaning up Screen too late. - UI_view2d_size_update() removed from draw callback, is init() - regions now store (winx, winy) subwindow size. --- source/blender/blenkernel/BKE_screen.h | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'source/blender/blenkernel/BKE_screen.h') diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h index 49e6b20725d..77179122b6e 100644 --- a/source/blender/blenkernel/BKE_screen.h +++ b/source/blender/blenkernel/BKE_screen.h @@ -52,16 +52,15 @@ typedef struct SpaceType { int spaceid; /* unique space identifier */ int iconid; /* icon lookup for menus */ - /* calls init too */ + /* initial allocation, after this WM will call init() too */ struct SpaceLink *(*new)(void); /* not free spacelink itself */ void (*free)(struct SpaceLink *); - /* init is to cope with internal contextual changes, adds handlers, - * creates/sets screarea regions */ + /* init is to cope with file load, screen (size) changes, check handlers */ void (*init)(struct wmWindowManager *, struct ScrArea *); - /* refresh is for external bContext changes */ - void (*refresh)(struct bContext *, struct ScrArea *); + /* Listeners can react to bContext changes */ + void (*listener)(struct ARegion *, struct wmNotifier *); /* after a spacedata copy, an init should result in exact same situation */ struct SpaceLink *(*duplicate)(struct SpaceLink *); @@ -76,6 +75,9 @@ typedef struct SpaceType { /* read and write... */ + /* default keymaps to add */ + int keymapflag; + } SpaceType; /* region types are also defined using spacetypes_init, via a callback */ @@ -85,18 +87,24 @@ typedef struct ARegionType { int regionid; /* unique identifier within this space */ - void (*init)(const struct bContext *, struct ARegion *); /* add handlers, stuff you only do once or on area/region changes */ - void (*refresh)(const struct bContext *, struct ARegion *); /* refresh to match contextual changes */ - void (*draw)(const struct bContext *, struct ARegion *); /* draw entirely, windowsize changes should be handled here */ - + /* add handlers, stuff you only do once or on area/region type/size changes */ + void (*init)(struct wmWindowManager *, struct ARegion *); + /* draw entirely, view changes should be handled here */ + void (*draw)(const struct bContext *, struct ARegion *); + /* contextual changes should be handled here */ void (*listener)(struct ARegion *, struct wmNotifier *); + void (*free)(struct ARegion *); /* register operator types on startup */ void (*operatortypes)(void); - /* add default items to keymap */ + /* add own items to keymap */ void (*keymap)(struct wmWindowManager *); + /* hardcoded constraints, smaller than these values region is not visible */ + int minsizex, minsizey; + /* default keymaps to add */ + int keymapflag; } ARegionType; -- cgit v1.2.3