diff options
Diffstat (limited to 'source/blender/editors/space_info/info_header.c')
-rw-r--r-- | source/blender/editors/space_info/info_header.c | 64 |
1 files changed, 58 insertions, 6 deletions
diff --git a/source/blender/editors/space_info/info_header.c b/source/blender/editors/space_info/info_header.c index af792d0b22c..c8dd3df8425 100644 --- a/source/blender/editors/space_info/info_header.c +++ b/source/blender/editors/space_info/info_header.c @@ -72,8 +72,9 @@ static int error() {return 0;} /* ************************ header area region *********************** */ -#define B_STOPRENDER 1 -#define B_STOPCAST 2 +#define B_STOPRENDER 1 +#define B_STOPCAST 2 +#define B_STOPANIM 3 static void do_viewmenu(bContext *C, void *arg, int event) { @@ -261,18 +262,18 @@ uiBlock *info_externalfiles(bContext *C, ARegion *ar, void *arg_unused) static void info_filemenu(bContext *C, uiLayout *layout, void *arg_unused) { - uiLayoutContext(layout, WM_OP_EXEC_AREA); + uiLayoutSetOperatorContext(layout, WM_OP_EXEC_AREA); uiItemO(layout, NULL, 0, "WM_OT_read_homefile"); - uiLayoutContext(layout, WM_OP_INVOKE_AREA); + uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_AREA); uiItemO(layout, NULL, 0, "WM_OT_open_mainfile"); // uiDefIconTextBlockBut(block, info_openrecentmenu, NULL, ICON_RIGHTARROW_THIN, "Open Recent",0, yco-=20, 120, 19, ""); // uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Recover Last Session", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 15, ""); uiItemS(layout); - uiLayoutContext(layout, WM_OP_EXEC_AREA); + uiLayoutSetOperatorContext(layout, WM_OP_EXEC_AREA); uiItemO(layout, NULL, 0, "WM_OT_save_mainfile"); - uiLayoutContext(layout, WM_OP_INVOKE_AREA); + uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_AREA); uiItemO(layout, NULL, 0, "WM_OT_save_as_mainfile"); #if 0 @@ -328,6 +329,9 @@ static void do_info_buttons(bContext *C, void *arg, int event) case B_STOPCAST: WM_jobs_stop(CTX_wm_manager(C), CTX_wm_screen(C)); break; + case B_STOPANIM: + ED_screen_animation_timer(C, 0, 0); + break; } } @@ -383,6 +387,40 @@ 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(); + + for(; ot; ot= ot->next) { + + if(BLI_strcasestr(ot->name, str)) { + if(ot->poll==NULL || ot->poll((bContext *)C)) { + char name[256]; + int len= strlen(ot->name); + + /* display name for menu, can hold hotkey */ + BLI_strncpy(name, ot->name, 256); + + /* check for hotkey */ + 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]= '|'; + } + + if(0==uiSearchItemAdd(items, name, ot)) + break; + } + } + } +} void info_header_buttons(const bContext *C, ARegion *ar) { @@ -444,6 +482,20 @@ void info_header_buttons(const bContext *C, ARegion *ar) uiDefIconTextBut(block, BUT, B_STOPCAST, ICON_REC, "Capture", xco+5,yco,85,19, NULL, 0.0f, 0.0f, 0, 0, "Stop screencast"); xco+= 90; } + if(screen->animtimer) { + uiDefIconTextBut(block, BUT, B_STOPANIM, ICON_REC, "Anim Player", xco+5,yco,85,19, NULL, 0.0f, 0.0f, 0, 0, "Stop animation playback"); + xco+= 90; + } + + { + static char search[256]= ""; + uiBut *but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, 256, xco+5, yco, 120, 19, ""); + + uiButSetSearchFunc(but, operator_search_cb, NULL, operator_call_cb); + + xco+= 125; + } + /* always as last */ UI_view2d_totRect_set(&ar->v2d, xco+XIC+80, ar->v2d.tot.ymax-ar->v2d.tot.ymin); |