diff options
author | Pablo Vazquez <venomgfx@gmail.com> | 2018-08-24 02:37:55 +0300 |
---|---|---|
committer | Pablo Vazquez <venomgfx@gmail.com> | 2018-08-24 02:38:08 +0300 |
commit | 1c63a3a100414f504b25571fd0b8fd29af42922c (patch) | |
tree | d10781d64a4d070045c564401e8127470e0fb952 /source/blender/editors/interface/interface_context_menu.c | |
parent | cf64a83edc2621aaeafed417f22081ef7b81ad1b (diff) |
UI: re-arrange some items in context menu
* Move Add to Quick Favorites before Assign Shortcut, as it is more often
that we add items to favorites, than changing shortcuts.
* Move Header menu last. In some cases the Online Manual for that item
would appear after the header menu.
* No icon for "Remove from Quick Favorites", matches Remove Shortcut
Diffstat (limited to 'source/blender/editors/interface/interface_context_menu.c')
-rw-r--r-- | source/blender/editors/interface/interface_context_menu.c | 71 |
1 files changed, 35 insertions, 36 deletions
diff --git a/source/blender/editors/interface/interface_context_menu.c b/source/blender/editors/interface/interface_context_menu.c index 281c2fb7104..253de3d3d5a 100644 --- a/source/blender/editors/interface/interface_context_menu.c +++ b/source/blender/editors/interface/interface_context_menu.c @@ -639,6 +639,33 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but) } } + /* Favorites Menu */ + if (ui_but_is_user_menu_compatible(C, but)) { + uiBlock *block = uiLayoutGetBlock(layout); + const int w = uiLayoutGetWidth(layout); + uiBut *but2; + + but2 = uiDefIconTextBut( + block, UI_BTYPE_BUT, 0, ICON_MENU_PANEL, + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Add to Quick Favorites"), + 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, + "Add to a user defined context menu (stored in the user preferences)"); + UI_but_func_set(but2, popup_user_menu_add_or_replace_func, but, NULL); + + bUserMenu *um = ED_screen_user_menu_find(C); + if (um) { + bUserMenuItem *umi = ui_but_user_menu_find(C, but, um); + if (umi != NULL) { + but2 = uiDefIconTextBut( + block, UI_BTYPE_BUT, 0, ICON_BLANK1, + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Remove from Quick Favorites"), + 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); + UI_but_func_set(but2, popup_user_menu_remove_func, um, umi); + } + } + uiItemS(layout); + } + /* Operator buttons */ if (but->optype) { uiBlock *block = uiLayoutGetBlock(layout); @@ -694,42 +721,6 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but) uiItemS(layout); } - /* Favorites Menu */ - if (ui_but_is_user_menu_compatible(C, but)) { - uiBlock *block = uiLayoutGetBlock(layout); - const int w = uiLayoutGetWidth(layout); - uiBut *but2; - - but2 = uiDefIconTextBut( - block, UI_BTYPE_BUT, 0, ICON_MENU_PANEL, - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Add to Quick Favorites"), - 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, - "Add to a user defined context menu (stored in the user preferences)"); - UI_but_func_set(but2, popup_user_menu_add_or_replace_func, but, NULL); - - bUserMenu *um = ED_screen_user_menu_find(C); - if (um) { - bUserMenuItem *umi = ui_but_user_menu_find(C, but, um); - if (umi != NULL) { - but2 = uiDefIconTextBut( - block, UI_BTYPE_BUT, 0, ICON_CANCEL, - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Remove from Quick Favorites"), - 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); - UI_but_func_set(but2, popup_user_menu_remove_func, um, umi); - } - } - uiItemS(layout); - } - - /* 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)) { - uiItemMenuF(layout, IFACE_("Header"), ICON_NONE, ED_screens_header_tools_menu_create, NULL); - uiItemS(layout); - } - } - { /* Docs */ char buf[512]; @@ -773,6 +764,14 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but) uiItemFullO(layout, "UI_OT_edittranslation_init", NULL, ICON_NONE, NULL, WM_OP_INVOKE_DEFAULT, 0, NULL); } + /* 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)) { + uiItemMenuF(layout, IFACE_("Header"), ICON_NONE, ED_screens_header_tools_menu_create, NULL); + } + } + MenuType *mt = WM_menutype_find("WM_MT_button_context", true); if (mt) { UI_menutype_draw(C, mt, uiLayoutColumn(layout, false)); |