diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/include/ED_screen.h | 1 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_context_menu.c | 11 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 17 | ||||
-rw-r--r-- | source/blender/editors/space_buttons/buttons_ops.c | 6 |
4 files changed, 33 insertions, 2 deletions
diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h index faa9233bff1..7c05bfd829d 100644 --- a/source/blender/editors/include/ED_screen.h +++ b/source/blender/editors/include/ED_screen.h @@ -195,6 +195,7 @@ void ED_screen_full_prevspace(struct bContext *C, ScrArea *sa); void ED_screen_full_restore(struct bContext *C, ScrArea *sa); struct ScrArea *ED_screen_state_toggle(struct bContext *C, struct wmWindow *win, struct ScrArea *sa, const short state); void ED_screens_header_tools_menu_create(struct bContext *C, struct uiLayout *layout, void *arg); +void ED_screens_navigation_bar_tools_menu_create(struct bContext *C, struct uiLayout *layout, void *arg); bool ED_screen_stereo3d_required(const struct bScreen *screen, const struct Scene *scene); Scene *ED_screen_scene_find(const struct bScreen *screen, const struct wmWindowManager *wm); Scene *ED_screen_scene_find_with_window(const struct bScreen *screen, const struct wmWindowManager *wm, struct wmWindow **r_window); diff --git a/source/blender/editors/interface/interface_context_menu.c b/source/blender/editors/interface/interface_context_menu.c index 253de3d3d5a..03d941c2387 100644 --- a/source/blender/editors/interface/interface_context_menu.c +++ b/source/blender/editors/interface/interface_context_menu.c @@ -766,10 +766,17 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but) /* Show header tools for header buttons. */ if (ui_block_is_popup_any(but->block) == false) { - ARegion *ar = CTX_wm_region(C); - if (ar && (ar->regiontype == RGN_TYPE_HEADER)) { + const ARegion *ar = CTX_wm_region(C); + + if (!ar) { + /* skip */ + } + else if (ar->regiontype == RGN_TYPE_HEADER) { uiItemMenuF(layout, IFACE_("Header"), ICON_NONE, ED_screens_header_tools_menu_create, NULL); } + else if (ar->regiontype == RGN_TYPE_NAV_BAR) { + uiItemMenuF(layout, IFACE_("Navigation Bar"), ICON_NONE, ED_screens_navigation_bar_tools_menu_create, NULL); + } } MenuType *mt = WM_menutype_find("WM_MT_button_context", true); diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 7a447bb41d4..5377ccb5a44 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -3757,6 +3757,23 @@ static void SCREEN_OT_header_context_menu(wmOperatorType *ot) /** \} */ /* -------------------------------------------------------------------- */ +/** \name Navigation Bar Tools Menu + * \{ */ + +void ED_screens_navigation_bar_tools_menu_create(bContext *C, uiLayout *layout, void *UNUSED(arg)) +{ + const ARegion *ar = CTX_wm_region(C); + const char *but_flip_str = (ar->alignment == RGN_ALIGN_LEFT) ? IFACE_("Flip to Right") : IFACE_("Flip to Left"); + + /* default is WM_OP_INVOKE_REGION_WIN, which we don't want here. */ + uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_DEFAULT); + + uiItemO(layout, but_flip_str, ICON_NONE, "SCREEN_OT_region_flip"); +} + +/** \} */ + +/* -------------------------------------------------------------------- */ /** \name Animation Step Operator * * Animation Step. diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c index fb2907983c8..473deb35aac 100644 --- a/source/blender/editors/space_buttons/buttons_ops.c +++ b/source/blender/editors/space_buttons/buttons_ops.c @@ -64,9 +64,15 @@ static int context_menu_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNUSED(event)) { + const ARegion *ar = CTX_wm_region(C); uiPopupMenu *pup = UI_popup_menu_begin(C, IFACE_("Context Menu"), ICON_NONE); uiLayout *layout = UI_popup_menu_layout(pup); + uiItemM(layout, "INFO_MT_area", NULL, ICON_NONE); + if (ar->regiontype == RGN_TYPE_NAV_BAR) { + ED_screens_navigation_bar_tools_menu_create(C, layout, NULL); + } + UI_popup_menu_end(C, pup); return OPERATOR_INTERFACE; |