diff options
author | Julian Eisel <julian@blender.org> | 2020-06-29 18:19:43 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2020-06-29 18:28:37 +0300 |
commit | 937d89afba36ea0f22ad929d2c8bdf8a853dc7d8 (patch) | |
tree | d2e70cf1d6bdd00d203784a196116a8c9ce4070e /source/blender/editors/interface/interface_region_search.c | |
parent | 5024c5427140c2d23b1c4c21853becd23c39cd57 (diff) |
UI: Show library status icons in search menus, rather than letter prefix
Rather than a `L` (linked), `O` (overridden) or `M` (missing) prefix for the
name, show the existing library status icons. See D7999 for screenshots.
Note that when using preview icons, or if the search menu contains items with
own icons (e.g. brush icons), we still fallback to the prefix solution.
Zero or fake user is still indicated with a prefix.
Differential Revision: https://developer.blender.org/D7999
Reviewed by: Bastien Montagne, William Reynish
Diffstat (limited to 'source/blender/editors/interface/interface_region_search.c')
-rw-r--r-- | source/blender/editors/interface/interface_region_search.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface_region_search.c b/source/blender/editors/interface/interface_region_search.c index 68be08ef4f8..c88dd1954c9 100644 --- a/source/blender/editors/interface/interface_region_search.c +++ b/source/blender/editors/interface/interface_region_search.c @@ -77,6 +77,9 @@ struct uiSearchItems { int *icons; int *states; + /** Is there any item with an icon? */ + bool has_icon; + AutoComplete *autocpl; void *active; }; @@ -122,6 +125,10 @@ bool UI_search_item_add(uiSearchItems *items, const char *name, void *poin, int return true; } + if (iconid) { + items->has_icon = true; + } + /* hijack for finding active item */ if (items->active) { if (poin == items->active) { @@ -562,6 +569,10 @@ static void ui_searchbox_region_draw_cb(const bContext *C, ARegion *region) /* widget itself */ if ((search_sep_len == 0) || !(name_sep_test = strstr(data->items.names[a], data->sep_string))) { + if (!icon && data->items.has_icon) { + /* If there is any icon item, make sure all items line up. */ + icon = ICON_BLANK1; + } /* Simple menu item. */ ui_draw_menu_item(&data->fstyle, &rect, name, icon, state, use_sep_char, NULL); |