diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-03-18 04:07:10 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-03-18 04:07:10 +0400 |
commit | eaf387b8df74c50388137e9c3b9986334478988a (patch) | |
tree | 0d6035baf753dc9fbeaa87857c3ba60337f0f60f | |
parent | ec55074f89220ba729e2b84058a3a55feb13ab34 (diff) |
UI: bypass text clipping on buttons with no text
-rw-r--r-- | source/blender/editors/interface/interface_widgets.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 9eb39f67831..68417f90f04 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -978,6 +978,8 @@ static void ui_text_clip_right_ex(uiFontStyle *fstyle, char *str, const size_t m float tmp; int l_end; + BLI_assert(str[0]); + /* If the trailing ellipsis takes more than 20% of all available width, just cut the string * (as using the ellipsis would remove even more useful chars, and we cannot show much already!). */ @@ -1000,6 +1002,8 @@ static float ui_text_clip_middle_ex(uiFontStyle *fstyle, char *str, const float { float strwidth; + BLI_assert(str[0]); + /* need to set this first */ uiStyleFontSet(fstyle); @@ -1417,6 +1421,11 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB if (but->editstr && but->pos >= 0) { ui_text_clip_cursor(fstyle, but, rect); } + else if (but->drawstr[0] == '\0') { + /* bypass text clipping on icon buttons */ + but->ofs = 0; + but->strwidth = 0; + } else if (ELEM(but->type, NUM, NUMSLI)) { ui_text_clip_right_label(fstyle, but, rect); } |