diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-06-06 09:31:31 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-06-06 09:32:25 +0300 |
commit | 1889eec918196527aaa7deb3064129e448568d06 (patch) | |
tree | d150568d1529d8abac587a104252c5b85f9c276d /source/blender/editors | |
parent | c1a880bc5e919da044f6c9599cec4653f88c29d9 (diff) |
UI: use regular size icons for toolbar popup
Test this since the popup feels disruptive/flashing when its too large
when set smaller it looks closer to a menu w/ key-accelerators which is
the intention in this case.
It's also more likely the active tool can be placed under the cursor.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/interface/interface_widgets.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 928ac8c9171..b20fe3c62dd 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -2008,6 +2008,15 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB else if (but->flag & UI_HAS_ICON || show_menu_icon) { const bool is_tool = UI_but_is_tool(but); + /* XXX add way to draw icons at a different size! + * Use small icons for popup. */ +#ifdef USE_TOOLBAR_HACK + const float aspect_orig = but->block->aspect; + if (is_tool && (but->block->flag & UI_BLOCK_POPOVER)) { + but->block->aspect *= 2.0f; + } +#endif + const BIFIconID icon = (but->flag & UI_HAS_ICON) ? but->icon + but->iconadd : ICON_NONE; int icon_size_init = is_tool ? ICON_DEFAULT_HEIGHT_TOOLBAR : ICON_DEFAULT_HEIGHT; const float icon_size = icon_size_init / (but->block->aspect / UI_DPI_FAC); @@ -2031,9 +2040,13 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB } else if (ui_block_is_menu(but->block)) rect->xmin += 0.3f * U.widget_unit; - + widget_draw_icon(but, icon, alpha, rect, show_menu_icon); +#ifdef USE_TOOLBAR_HACK + but->block->aspect = aspect_orig; +#endif + rect->xmin += icon_size; /* without this menu keybindings will overlap the arrow icon [#38083] */ if (show_menu_icon) { |