diff options
Diffstat (limited to 'source/blender/editors/space_info')
-rw-r--r-- | source/blender/editors/space_info/info_header.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/source/blender/editors/space_info/info_header.c b/source/blender/editors/space_info/info_header.c index 38e778848b9..09f5640dbf6 100644 --- a/source/blender/editors/space_info/info_header.c +++ b/source/blender/editors/space_info/info_header.c @@ -387,6 +387,14 @@ static void scene_idpoin_handle(bContext *C, ID *id, int event) } } +static void operator_call_cb(struct bContext *C, void *arg1, void *arg2) +{ + wmOperatorType *ot= arg2; + + if(ot) + WM_operator_name_call(C, ot->idname, WM_OP_INVOKE_DEFAULT, NULL); +} + static void operator_search_cb(const struct bContext *C, void *arg, char *str, uiSearchItems *items) { wmOperatorType *ot = WM_operatortype_first(); @@ -395,19 +403,19 @@ static void operator_search_cb(const struct bContext *C, void *arg, char *str, u if(BLI_strcasestr(ot->name, str)) { if(ot->poll==NULL || ot->poll((bContext *)C)) { + char name[256]; int len= strlen(ot->name); - BLI_strncpy(items->names[items->totitem], ot->name, items->maxstrlen); + /* display name for menu, can hold hotkey */ + BLI_strncpy(name, ot->name, 256); /* check for hotkey */ - if(len < items->maxstrlen-6) { - if(WM_key_event_operator_string(C, ot->idname, WM_OP_EXEC_DEFAULT, NULL, items->names[items->totitem]+len+1, items->maxstrlen-len-1)) { - items->names[items->totitem][len]= '|'; - } + if(len < 256-6) { + if(WM_key_event_operator_string(C, ot->idname, WM_OP_EXEC_DEFAULT, NULL, &name[len+1], 256-len-1)) + name[len]= '|'; } - items->totitem++; - if(items->totitem>=items->maxitem) + if(0==uiSearchItemAdd(items, name, ot)) break; } } @@ -483,7 +491,7 @@ void info_header_buttons(const bContext *C, ARegion *ar) static char search[256]= ""; uiBut *but= uiDefSearchBut(block, search, 0, ICON_PROP_ON, 256, xco+5, yco, 120, 19, ""); - uiButSetSearchFunc(but, operator_search_cb, NULL); + uiButSetSearchFunc(but, operator_search_cb, NULL, operator_call_cb); xco+= 125; } |