2.5
Part one of wrapping up area/region management. Read design doc here: http://wiki.blender.org/index.php/BlenderDev/Blender2.5/AreaManager This commit: - brings keymap storage to WM, based on names/types. This structure allows rna-ifying it too, so you can browse keymaps etc. - creating areas and regions works slightly different now, wich regiontypes stored in areatype. Todo: - better callbacks and structure for defining which handlers need to be added. - using region types to validate regions - proper implementation of local region data - code method for customizing keymaps. Current idea is that you have to indicate an entire keymap to be custom, to prevent too complicated merging problems of default and custom maps (like order, multiple keys for same operator, disabling options, etc).
This commit is contained in:
@@ -1327,14 +1327,16 @@ void ED_operatortypes_screen(void)
|
||||
/* called in spacetypes.c */
|
||||
void ED_keymap_screen(wmWindowManager *wm)
|
||||
{
|
||||
WM_keymap_verify_item(&wm->screenkeymap, "ED_SCR_OT_cursor_type", MOUSEMOVE, 0, 0, 0);
|
||||
WM_keymap_verify_item(&wm->screenkeymap, "ED_SCR_OT_actionzone", LEFTMOUSE, KM_PRESS, 0, 0);
|
||||
ListBase *keymap= WM_keymap_listbase(wm, "Screen", 0, 0);
|
||||
|
||||
WM_keymap_verify_item(&wm->screenkeymap, "ED_SCR_OT_area_move", LEFTMOUSE, KM_PRESS, 0, 0);
|
||||
WM_keymap_verify_item(&wm->screenkeymap, "ED_SCR_OT_area_split", EVT_ACTIONZONE, 0, 0, 0); /* action tria */
|
||||
WM_keymap_verify_item(&wm->screenkeymap, "ED_SCR_OT_area_join", EVT_ACTIONZONE, 0, 0, 0); /* action tria */
|
||||
WM_keymap_verify_item(&wm->screenkeymap, "ED_SCR_OT_area_rip", RKEY, KM_PRESS, KM_ALT, 0);
|
||||
WM_keymap_verify_item(keymap, "ED_SCR_OT_cursor_type", MOUSEMOVE, 0, 0, 0);
|
||||
WM_keymap_verify_item(keymap, "ED_SCR_OT_actionzone", LEFTMOUSE, KM_PRESS, 0, 0);
|
||||
|
||||
WM_keymap_verify_item(keymap, "ED_SCR_OT_area_move", LEFTMOUSE, KM_PRESS, 0, 0);
|
||||
WM_keymap_verify_item(keymap, "ED_SCR_OT_area_split", EVT_ACTIONZONE, 0, 0, 0); /* action tria */
|
||||
WM_keymap_verify_item(keymap, "ED_SCR_OT_area_join", EVT_ACTIONZONE, 0, 0, 0); /* action tria */
|
||||
WM_keymap_verify_item(keymap, "ED_SCR_OT_area_rip", RKEY, KM_PRESS, KM_ALT, 0);
|
||||
|
||||
WM_keymap_verify_item(&wm->screenkeymap, "ED_SCR_OT_repeat_last", F4KEY, KM_PRESS, 0, 0);
|
||||
WM_keymap_verify_item(keymap, "ED_SCR_OT_repeat_last", F4KEY, KM_PRESS, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -43,8 +43,20 @@
|
||||
|
||||
#include "screen_intern.h" /* own module include */
|
||||
|
||||
ARegionType *ED_regiontype_from_id(SpaceType *st, int regionid)
|
||||
{
|
||||
ARegionType *art;
|
||||
|
||||
for(art= st->regiontypes.first; art; art= art->next)
|
||||
if(art->regionid==regionid)
|
||||
return art;
|
||||
|
||||
printf("Error, region type missing in %s\n", st->name);
|
||||
return st->regiontypes.first;
|
||||
}
|
||||
|
||||
/* only call once on startup, storage is static data (no malloc!) in kernel listbase */
|
||||
|
||||
/* only call once on startup, storage is global in BKE kernel listbase */
|
||||
void ED_spacetypes_init(void)
|
||||
{
|
||||
const ListBase *spacetypes;
|
||||
@@ -59,13 +71,17 @@ void ED_spacetypes_init(void)
|
||||
|
||||
/* register operator types for screen and all spaces */
|
||||
ED_operatortypes_screen();
|
||||
|
||||
ui_operatortypes();
|
||||
ui_view2d_operatortypes();
|
||||
|
||||
spacetypes = BKE_spacetypes_list();
|
||||
for(type=spacetypes->first; type; type=type->next)
|
||||
type->operatortypes();
|
||||
}
|
||||
|
||||
/* called in wm.c */
|
||||
/* keymap definitions are registered only once per WM initialize, usually on file read,
|
||||
using the keymap the actual areas/regions add the handlers */
|
||||
void ED_spacetypes_keymap(wmWindowManager *wm)
|
||||
{
|
||||
const ListBase *spacetypes;
|
||||
|
||||
Reference in New Issue
Block a user