[Bf-blender-cvs] [c509922605f] blender2.8: UI: use a wider minimum menu width
Campbell Barton
noreply at git.blender.org
Wed Apr 25 21:55:11 CEST 2018
Commit: c509922605ffb61c7f04c2d4c12f8c5e651d0214
Author: Campbell Barton
Date: Wed Apr 25 21:54:29 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBc509922605ffb61c7f04c2d4c12f8c5e651d0214
UI: use a wider minimum menu width
Icon only buttons with menus would be too narrow,
especially buttons for selecting tools.
===================================================================
M source/blender/editors/interface/interface_intern.h
M source/blender/editors/interface/interface_region_menu_pie.c
M source/blender/editors/interface/interface_region_menu_popup.c
M source/blender/editors/interface/interface_region_popover.c
===================================================================
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;
More information about the Bf-blender-cvs
mailing list