diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-05-13 11:25:18 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-05-13 11:27:44 +0300 |
commit | 06a786f12d5b56fc71f4996aff767dea3fedba6e (patch) | |
tree | d7ce034522e49003b790aa7bb60882843c4c0b57 /source/blender/editors/interface | |
parent | e7ee9cfd9e510561d87d2fd974a9f336e7eb32eb (diff) |
UI: show toolbar shortcuts
When toobar text is expanded, show shortcuts
(normally confined to menus).
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r-- | source/blender/editors/interface/interface.c | 12 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_layout.c | 4 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_widgets.c | 2 |
3 files changed, 14 insertions, 4 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index ee511eff215..b63ba4166a7 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1096,7 +1096,7 @@ static void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block) uiBut *but; char buf[128]; - BLI_assert(block->flag & UI_BLOCK_LOOP); + BLI_assert(block->flag & (UI_BLOCK_LOOP | UI_BLOCK_SHOW_SHORTCUT_ALWAYS)); /* only do it before bounding */ if (block->rect.xmin != block->rect.xmax) @@ -1112,7 +1112,13 @@ static void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block) } else { for (but = block->buttons.first; but; but = but->next) { - if (but->dt != UI_EMBOSS_PULLDOWN) { + if (block->flag & UI_BLOCK_SHOW_SHORTCUT_ALWAYS) { + /* Skip icon-only buttons (as used in the toolbar). */ + if (but->drawstr[0] == '\0') { + continue; + } + } + else if (but->dt != UI_EMBOSS_PULLDOWN) { continue; } @@ -1216,7 +1222,7 @@ void UI_block_end_ex(const bContext *C, uiBlock *block, const int xy[2], int r_x ui_menu_block_set_keyaccels(block); /* could use a different flag to check */ } - if (block->flag & UI_BLOCK_LOOP) { + if (block->flag & (UI_BLOCK_LOOP | UI_BLOCK_SHOW_SHORTCUT_ALWAYS)) { ui_menu_block_set_keymaps(C, block); } diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 3a8e53d3e90..da1f57409a8 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -3504,6 +3504,10 @@ uiLayout *UI_block_layout(uiBlock *block, int dir, int type, int x, int y, int s if (type == UI_LAYOUT_MENU || type == UI_LAYOUT_PIEMENU) layout->space = 0; + if (type == UI_LAYOUT_TOOLBAR) { + block->flag |= UI_BLOCK_SHOW_SHORTCUT_ALWAYS; + } + if (dir == UI_LAYOUT_HORIZONTAL) { layout->h = size; layout->root->emh = em * UI_UNIT_Y; diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index d5631ab8eb3..6c558bcc961 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -1868,7 +1868,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b #endif /* cut string in 2 parts - only for menu entries */ - if ((but->block->flag & UI_BLOCK_LOOP) && + if ((but->block->flag & (UI_BLOCK_LOOP | UI_BLOCK_SHOW_SHORTCUT_ALWAYS)) && (but->editstr == NULL)) { if (but->flag & UI_BUT_HAS_SEP_CHAR) { |