[Bf-blender-cvs] [eaf387b] master: UI: bypass text clipping on buttons with no text

Campbell Barton noreply at git.blender.org
Tue Mar 18 01:07:54 CET 2014


Commit: eaf387b8df74c50388137e9c3b9986334478988a
Author: Campbell Barton
Date:   Tue Mar 18 11:07:10 2014 +1100
https://developer.blender.org/rBeaf387b8df74c50388137e9c3b9986334478988a

UI: bypass text clipping on buttons with no text

===================================================================

M	source/blender/editors/interface/interface_widgets.c

===================================================================

diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 9eb39f6..68417f9 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);
 	}




More information about the Bf-blender-cvs mailing list