Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2008-12-15 14:45:17 +0300
committerTon Roosendaal <ton@blender.org>2008-12-15 14:45:17 +0300
commitf7106acde8a2b4ac9e1ef94bb3f30c75eda2d432 (patch)
tree157536acd8136e113cff52ea20380ef6a273ce87 /source
parent4a6d3b2ded36e5a5ea74121678d699c1ae9087c2 (diff)
2.5
funtion WM_keymap_add_item() now returns keymap-item, so you can use it to set default properties for operators with WM_keymap_property_set(). Brecht will fill in this function, requires rna magic! Example: an operator ED_OB_OT_add_primitive can be configured with keymap like this: WM_keymap_property_set(keymapitem, "Primitivetype", "Sphere"); Similar conventions we can use later for button/menu calls. This will make creating operators easier, allowing a developer to group tools functionality nicely.
Diffstat (limited to 'source')
-rw-r--r--source/blender/windowmanager/WM_api.h7
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c1
-rw-r--r--source/blender/windowmanager/intern/wm_keymap.c15
3 files changed, 16 insertions, 7 deletions
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index 908070d33fa..fd9e05fa107 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -61,12 +61,13 @@ void WM_waitcursor (struct bContext *C, int val);
void WM_timecursor (struct bContext *C, int nr);
/* keymap and handlers */
-void WM_keymap_set_item (ListBase *lb, char *idname, short type,
+wmKeymapItem *WM_keymap_set_item (ListBase *lb, char *idname, short type,
short val, int modifier, short keymodifier);
-void WM_keymap_verify_item(ListBase *lb, char *idname, short type,
+wmKeymapItem *WM_keymap_verify_item(ListBase *lb, char *idname, short type,
short val, int modifier, short keymodifier);
-void WM_keymap_add_item (ListBase *lb, char *idname, short type,
+wmKeymapItem *WM_keymap_add_item (ListBase *lb, char *idname, short type,
short val, int modifier, short keymodifier);
+void WM_keymap_property_set(wmKeymapItem *km, const char *propname, const char *propval);
ListBase *WM_keymap_listbase (wmWindowManager *wm, const char *nameid,
int spaceid, int regionid);
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index cd66d0b479b..100bdbc6d2b 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -643,6 +643,7 @@ void wm_event_do_handlers(bContext *C)
ARegion *ar;
int doit= 0;
+ /* XXX to solve, here screen handlers? */
ED_screen_set_subwinactive(win); /* state variables in screen */
for(sa= win->screen->areabase.first; sa; sa= sa->next) {
diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c
index 439f5c304d1..f01ca55c319 100644
--- a/source/blender/windowmanager/intern/wm_keymap.c
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -72,7 +72,7 @@ static void keymap_set(wmKeymapItem *kmi, short type, short val, int modifier, s
}
/* if item was added, then bail out */
-void WM_keymap_verify_item(ListBase *lb, char *idname, short type, short val, int modifier, short keymodifier)
+wmKeymapItem *WM_keymap_verify_item(ListBase *lb, char *idname, short type, short val, int modifier, short keymodifier)
{
wmKeymapItem *kmi;
@@ -87,11 +87,11 @@ void WM_keymap_verify_item(ListBase *lb, char *idname, short type, short val, in
keymap_set(kmi, type, val, modifier, keymodifier);
}
-
+ return kmi;
}
/* if item was added, then replace */
-void WM_keymap_set_item(ListBase *lb, char *idname, short type, short val, int modifier, short keymodifier)
+wmKeymapItem *WM_keymap_set_item(ListBase *lb, char *idname, short type, short val, int modifier, short keymodifier)
{
wmKeymapItem *kmi;
@@ -105,10 +105,11 @@ void WM_keymap_set_item(ListBase *lb, char *idname, short type, short val, int m
BLI_strncpy(kmi->idname, idname, OP_MAX_TYPENAME);
}
keymap_set(kmi, type, val, modifier, keymodifier);
+ return kmi;
}
/* always add item */
-void WM_keymap_add_item(ListBase *lb, char *idname, short type, short val, int modifier, short keymodifier)
+wmKeymapItem *WM_keymap_add_item(ListBase *lb, char *idname, short type, short val, int modifier, short keymodifier)
{
wmKeymapItem *kmi= MEM_callocN(sizeof(wmKeymapItem), "keymap entry");
@@ -116,6 +117,12 @@ void WM_keymap_add_item(ListBase *lb, char *idname, short type, short val, int m
BLI_strncpy(kmi->idname, idname, OP_MAX_TYPENAME);
keymap_set(kmi, type, val, modifier, keymodifier);
+ return kmi;
+}
+
+void WM_keymap_property_set(wmKeymapItem *km, const char *propname, const char *propval)
+{
+ /* todo */
}
/* ****************** storage in WM ************ */