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
diff options
context:
space:
mode:
authorMatt Ebb <matt@mke3.net>2010-01-26 04:02:10 +0300
committerMatt Ebb <matt@mke3.net>2010-01-26 04:02:10 +0300
commitba2257b57e56cc410288756de491969f4e207985 (patch)
tree4d058bcfad7168527b6f976d7d86bdb0a29d48ea /source/blender/editors/interface/interface_handlers.c
parentaba738aa34bf8078e0b6e698166576faf1462d5d (diff)
Fix [#20798] - Add/change/remove shortcut options dissapearing from buttons @ Tool Shelf
Made the RMB menus for manipulating shortcuts a bit more robust (only dealing with mouse clicks/key events, rather than all tweaks/timers/etc) and added ability to add key shortcuts for transform tools from the RMB menu.
Diffstat (limited to 'source/blender/editors/interface/interface_handlers.c')
-rw-r--r--source/blender/editors/interface/interface_handlers.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index dcb2f1810ce..b4da74b4664 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -3456,7 +3456,7 @@ static uiBlock *menu_change_shortcut(bContext *C, ARegion *ar, void *arg)
uiLayout *layout;
uiStyle *style= U.uistyles.first;
IDProperty *prop= (but->opptr)? but->opptr->data: NULL;
- int kmi_id = WM_key_event_operator_id(C, but->optype->idname, but->opcontext, prop, &km);
+ int kmi_id = WM_key_event_operator_id(C, but->optype->idname, but->opcontext, prop, 1, &km);
kmi = WM_keymap_item_find_id(km, kmi_id);
@@ -3524,7 +3524,7 @@ static void remove_shortcut_func(bContext *C, void *arg1, void *arg2)
wmKeyMap *km;
wmKeyMapItem *kmi;
IDProperty *prop= (but->opptr)? but->opptr->data: NULL;
- int kmi_id = WM_key_event_operator_id(C, but->optype->idname, but->opcontext, prop, &km);
+ int kmi_id = WM_key_event_operator_id(C, but->optype->idname, but->opcontext, prop, 1, &km);
kmi = WM_keymap_item_find_id(km, kmi_id);
WM_keymap_remove_item(km, kmi);
@@ -3662,10 +3662,12 @@ static int ui_but_menu(bContext *C, uiBut *but)
uiBut *but2;
IDProperty *prop= (but->opptr)? but->opptr->data: NULL;
int w = uiLayoutGetWidth(layout);
- char buf[512];
+ wmKeyMap *km;
+ int kmi_id= WM_key_event_operator_id(C, but->optype->idname, but->opcontext, prop, 1, &km);
+ wmKeyMapItem *kmi = WM_keymap_item_find_id(km, kmi_id);
/* keyboard shortcuts */
- if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, buf, sizeof(buf))) {
+ if ((kmi) && ISKEYBOARD(kmi->type)) {
// would rather use a block but, but gets weirdly positioned...
//uiDefBlockBut(block, menu_change_shortcut, but, "Change Shortcut", 0, 0, uiLayoutGetWidth(layout), UI_UNIT_Y, "");