diff options
Diffstat (limited to 'source/blender/editors/interface/interface_context_menu.c')
-rw-r--r-- | source/blender/editors/interface/interface_context_menu.c | 47 |
1 files changed, 34 insertions, 13 deletions
diff --git a/source/blender/editors/interface/interface_context_menu.c b/source/blender/editors/interface/interface_context_menu.c index 0884a9ea470..b84b07adba5 100644 --- a/source/blender/editors/interface/interface_context_menu.c +++ b/source/blender/editors/interface/interface_context_menu.c @@ -176,11 +176,21 @@ static uiBlock *menu_change_shortcut(bContext *C, ARegion *ar, void *arg) UI_block_flag_enable(block, UI_BLOCK_MOVEMOUSE_QUIT); UI_block_direction_set(block, UI_DIR_CENTER_Y); - layout = UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, 200, 20, 0, style); - + layout = UI_block_layout(block, + UI_LAYOUT_VERTICAL, + UI_LAYOUT_PANEL, + 0, + 0, + U.widget_unit * 10, + U.widget_unit * 2, + 0, + style); + + uiItemL(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Change Shortcut"), ICON_HAND); uiItemR(layout, &ptr, "type", UI_ITEM_R_FULL_EVENT | UI_ITEM_R_IMMEDIATE, "", ICON_NONE); - UI_block_bounds_set_popup(block, 6, (const int[2]){-50, 26}); + UI_block_bounds_set_popup( + block, 6 * U.dpi_fac, (const int[2]){-100 * U.dpi_fac, 36 * U.dpi_fac}); shortcut_free_operator_property(prop); @@ -227,11 +237,21 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion *ar, void *arg) UI_block_func_handle_set(block, but_shortcut_name_func, but); UI_block_direction_set(block, UI_DIR_CENTER_Y); - layout = UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, 200, 20, 0, style); - + layout = UI_block_layout(block, + UI_LAYOUT_VERTICAL, + UI_LAYOUT_PANEL, + 0, + 0, + U.widget_unit * 10, + U.widget_unit * 2, + 0, + style); + + uiItemL(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Assign Shortcut"), ICON_HAND); uiItemR(layout, &ptr, "type", UI_ITEM_R_FULL_EVENT | UI_ITEM_R_IMMEDIATE, "", ICON_NONE); - UI_block_bounds_set_popup(block, 6, (const int[2]){-50, 26}); + UI_block_bounds_set_popup( + block, 6 * U.dpi_fac, (const int[2]){-100 * U.dpi_fac, 36 * U.dpi_fac}); #ifdef USE_KEYMAP_ADD_HACK g_kmi_id_hack = kmi_id; @@ -470,8 +490,9 @@ static void ui_but_menu_add_path_operators(uiLayout *layout, PointerRNA *ptr, Pr bool ui_popup_context_menu_for_button(bContext *C, uiBut *but) { - /* having this menu for some buttons makes no sense */ - if (but->type == UI_BTYPE_IMAGE) { + /* ui_but_is_interactive() may let some buttons through that should not get a context menu - it + * doesn't make sense for them. */ + if (ELEM(but->type, UI_BTYPE_LABEL, UI_BTYPE_IMAGE)) { return false; } @@ -878,13 +899,13 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but) if (is_array_component) { uiItemBooleanO(layout, - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy All To Selected"), + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy All to Selected"), ICON_NONE, "UI_OT_copy_to_selected_button", "all", true); uiItemBooleanO(layout, - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy Single To Selected"), + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy Single to Selected"), ICON_NONE, "UI_OT_copy_to_selected_button", "all", @@ -892,7 +913,7 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but) } else { uiItemBooleanO(layout, - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy To Selected"), + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy to Selected"), ICON_NONE, "UI_OT_copy_to_selected_button", "all", @@ -907,7 +928,7 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but) if (ptr->owner_id && !is_whole_array && ELEM(type, PROP_BOOLEAN, PROP_INT, PROP_FLOAT, PROP_ENUM)) { uiItemO(layout, - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy As New Driver"), + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy as New Driver"), ICON_NONE, "UI_OT_copy_as_driver_button"); } @@ -929,7 +950,7 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but) but->search_func == ui_rna_collection_search_cb)) && ui_jump_to_target_button_poll(C)) { uiItemO(layout, - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Jump To Target"), + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Jump to Target"), ICON_NONE, "UI_OT_jump_to_target_button"); uiItemS(layout); |