diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-04-25 22:54:29 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-04-25 22:54:29 +0300 |
commit | c509922605ffb61c7f04c2d4c12f8c5e651d0214 (patch) | |
tree | c71d69332cf76001da0bb4a3f32024b38efbd631 /source/blender/editors/interface | |
parent | 84302497918191b751311fa1bc7f72017f5af2eb (diff) |
UI: use a wider minimum menu width
Icon only buttons with menus would be too narrow,
especially buttons for selecting tools.
Diffstat (limited to 'source/blender/editors/interface')
4 files changed, 12 insertions, 4 deletions
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 79238ef0d76..f7f30b00a49 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -105,6 +105,8 @@ typedef enum { UI_WTYPE_PROGRESSBAR, } uiWidgetTypeEnum; +#define UI_MENU_WIDTH_MIN (UI_UNIT_Y * 9) + /* menu scrolling */ #define UI_MENU_SCROLL_ARROW 12 #define UI_MENU_SCROLL_MOUSE (UI_MENU_SCROLL_ARROW + 2) diff --git a/source/blender/editors/interface/interface_region_menu_pie.c b/source/blender/editors/interface/interface_region_menu_pie.c index 37a603d967f..98fab5f42aa 100644 --- a/source/blender/editors/interface/interface_region_menu_pie.c +++ b/source/blender/editors/interface/interface_region_menu_pie.c @@ -76,7 +76,7 @@ static uiBlock *ui_block_func_PIE(bContext *UNUSED(C), uiPopupBlockHandle *handl uiPieMenu *pie = arg_pie; int minwidth, width, height; - minwidth = 50; + minwidth = UI_MENU_WIDTH_MIN; block = pie->block_radial; /* in some cases we create the block before the region, diff --git a/source/blender/editors/interface/interface_region_menu_popup.c b/source/blender/editors/interface/interface_region_menu_popup.c index 1555942adeb..53f9c47a401 100644 --- a/source/blender/editors/interface/interface_region_menu_popup.c +++ b/source/blender/editors/interface/interface_region_menu_popup.c @@ -191,7 +191,13 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi if (pup->but) { /* minimum width to enforece */ - minwidth = BLI_rctf_size_x(&pup->but->rect); + if (pup->but->drawstr[0]) { + minwidth = BLI_rctf_size_x(&pup->but->rect); + } + else { + /* For buttons with no text, use the minimum (typically icon only). */ + minwidth = UI_MENU_WIDTH_MIN; + } /* settings (typically rna-enum-popups) show above the button, * menu's like file-menu, show below */ @@ -209,7 +215,7 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi } } else { - minwidth = 50; + minwidth = UI_MENU_WIDTH_MIN; direction = UI_DIR_DOWN; } diff --git a/source/blender/editors/interface/interface_region_popover.c b/source/blender/editors/interface/interface_region_popover.c index 5e37ce9df8b..bf75af524b7 100644 --- a/source/blender/editors/interface/interface_region_popover.c +++ b/source/blender/editors/interface/interface_region_popover.c @@ -100,7 +100,7 @@ static uiBlock *ui_block_func_POPOVER(bContext *C, uiPopupBlockHandle *handle, v minwidth = BLI_rctf_size_x(&pup->but->rect); } else { - minwidth = 50; + minwidth = UI_MENU_WIDTH_MIN; } block = pup->block; |