Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface_context_menu.cc
| Show First 20 Lines • Show All 468 Lines • ▼ Show 20 Lines | |||||
| bool ui_popup_context_menu_for_button(bContext *C, uiBut *but, const wmEvent *event) | bool ui_popup_context_menu_for_button(bContext *C, uiBut *but, const wmEvent *event) | ||||
| { | { | ||||
| /* ui_but_is_interactive() may let some buttons through that should not get a context menu - it | /* ui_but_is_interactive() may let some buttons through that should not get a context menu - it | ||||
| * doesn't make sense for them. */ | * doesn't make sense for them. */ | ||||
| if (ELEM(but->type, UI_BTYPE_LABEL, UI_BTYPE_IMAGE)) { | if (ELEM(but->type, UI_BTYPE_LABEL, UI_BTYPE_IMAGE)) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| /* Don't open the "Online manual" popup if the current popup is already the "Online manual" one | |||||
| */ | |||||
| if (but->optype && STREQ(but->optype->idname, "WM_OT_doc_view_manual_ui_context") && | |||||
| but->prev != NULL) { | |||||
| /* Fetch the header label of the popup (second-to-last element) */ | |||||
| uiBut *header = but; | |||||
| while (header->prev->prev != NULL) { | |||||
| header = header->prev; | |||||
| } | |||||
| if (header->type == UI_BTYPE_LABEL && | |||||
| STREQ(header->str, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Online Manual"))) { | |||||
| return false; | |||||
| } | |||||
| } | |||||
| /* Idem for the "Online Python Reference" popup */ | |||||
| else if (but->optype && STREQ(but->optype->idname, "WM_OT_doc_view") && but->prev != NULL) { | |||||
| uiBut *header = but; | |||||
| while (header->prev->prev != NULL) { | |||||
| header = header->prev; | |||||
| } | |||||
| if (header->type == UI_BTYPE_LABEL && | |||||
| STREQ(header->str, | |||||
| CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Online Python Reference"))) { | |||||
| return false; | |||||
| } | |||||
| } | |||||
| uiPopupMenu *pup; | uiPopupMenu *pup; | ||||
| uiLayout *layout; | uiLayout *layout; | ||||
| bContextStore *previous_ctx = CTX_store_get(C); | bContextStore *previous_ctx = CTX_store_get(C); | ||||
| { | { | ||||
| uiStringInfo label = {BUT_GET_LABEL, nullptr}; | uiStringInfo label = {BUT_GET_LABEL, nullptr}; | ||||
| /* highly unlikely getting the label ever fails */ | /* highly unlikely getting the label ever fails */ | ||||
| UI_but_string_info_get(C, but, &label, nullptr); | UI_but_string_info_get(C, but, &label, nullptr); | ||||
| ▲ Show 20 Lines • Show All 820 Lines • Show Last 20 Lines | |||||