[Bf-blender-cvs] [76d9244] master: Fix core issue with clipping labels (labels have no margins, so border should be 0 in this case!).

Bastien Montagne noreply at git.blender.org
Sat Jan 4 16:53:34 CET 2014


Commit: 76d9244843457c8c5bc3be6085167d85e0a20232
Author: Bastien Montagne
Date:   Sat Jan 4 14:47:20 2014 +0100
https://developer.blender.org/rB76d9244843457c8c5bc3be6085167d85e0a20232

Fix core issue with clipping labels (labels have no margins, so border should be 0 in this case!).

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

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 4756303..5e91b5c 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -812,7 +812,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
 
 /* *********************** text/icon ************************************** */
 
-#define UI_TEXT_CLIP_MARGIN (0.22f * U.widget_unit / but->block->aspect)
+#define UI_TEXT_CLIP_MARGIN (0.25f * U.widget_unit / but->block->aspect)
 
 #define PREVIEW_PAD 4
 
@@ -942,7 +942,8 @@ static void ui_text_clip_give_next_off(uiBut *but)
  */
 static void ui_text_clip_left(uiFontStyle *fstyle, uiBut *but, const rcti *rect)
 {
-	const int border = UI_TEXT_CLIP_MARGIN + 1;
+	/* We are not supposed to use labels with that clipping, so we can always apply margins. */
+	const int border = (int)(UI_TEXT_CLIP_MARGIN + 0.5f);
 	const int okwidth = max_ii(BLI_rcti_size_x(rect) - border, 0);
 
 	/* need to set this first */
@@ -971,7 +972,8 @@ static void ui_text_clip_left(uiFontStyle *fstyle, uiBut *but, const rcti *rect)
  */
 static void ui_text_clip_middle(uiFontStyle *fstyle, uiBut *but, const rcti *rect)
 {
-	const int border = UI_TEXT_CLIP_MARGIN + 1;
+	/* No margin for labels! */
+	const int border = (but->type == LABEL) ? 0 : (int)(UI_TEXT_CLIP_MARGIN + 0.5f);
 	const int okwidth = max_ii(BLI_rcti_size_x(rect) - border, 0);
 	float strwidth;
 
@@ -1034,7 +1036,7 @@ static void ui_text_clip_middle(uiFontStyle *fstyle, uiBut *but, const rcti *rec
  */
 static void ui_text_clip_cursor(uiFontStyle *fstyle, uiBut *but, const rcti *rect)
 {
-	const int border = UI_TEXT_CLIP_MARGIN + 1;
+	const int border = (int)(UI_TEXT_CLIP_MARGIN + 0.5f);
 	const int okwidth = max_ii(BLI_rcti_size_x(rect) - border, 0);
 
 	BLI_assert(but->editstr && but->pos >= 0);




More information about the Bf-blender-cvs mailing list