[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36174] trunk/blender: fix [#26937] Radio button text truncation should start at beginning of string

Campbell Barton ideasman42 at gmail.com
Fri Apr 15 03:32:41 CEST 2011


Revision: 36174
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36174
Author:   campbellbarton
Date:     2011-04-15 01:32:37 +0000 (Fri, 15 Apr 2011)
Log Message:
-----------
fix [#26937] Radio button text truncation should start at beginning of string
ensure start of text is always visible.

- also left in test for fix [#26933] which left it broken.
- quiet warning in AUD Py API.

Modified Paths:
--------------
    trunk/blender/intern/audaspace/Python/AUD_PyAPI.cpp
    trunk/blender/source/blender/editors/interface/interface_style.c
    trunk/blender/source/blender/render/intern/source/convertblender.c

Modified: trunk/blender/intern/audaspace/Python/AUD_PyAPI.cpp
===================================================================
--- trunk/blender/intern/audaspace/Python/AUD_PyAPI.cpp	2011-04-15 01:19:13 UTC (rev 36173)
+++ trunk/blender/intern/audaspace/Python/AUD_PyAPI.cpp	2011-04-15 01:32:37 UTC (rev 36174)
@@ -2214,6 +2214,7 @@
 			switch(device)
 			{
 			case AUD_DEVICE_NULL:
+				(void)specs; /* quiet warning when others disabled */
 				self->device = new AUD_NULLDevice();
 				break;
 			case AUD_DEVICE_OPENAL:

Modified: trunk/blender/source/blender/editors/interface/interface_style.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_style.c	2011-04-15 01:19:13 UTC (rev 36173)
+++ trunk/blender/source/blender/editors/interface/interface_style.c	2011-04-15 01:32:37 UTC (rev 36174)
@@ -153,10 +153,16 @@
 	height= BLF_height(fs->uifont_id, "2"); /* correct offset is on baseline, the j is below that */
 	yofs= floor( 0.5f*(rect->ymax - rect->ymin - height));
 
-	if(fs->align==UI_STYLE_TEXT_CENTER)
+	if(fs->align==UI_STYLE_TEXT_CENTER) {
 		xofs= floor( 0.5f*(rect->xmax - rect->xmin - BLF_width(fs->uifont_id, str)));
-	else if(fs->align==UI_STYLE_TEXT_RIGHT)
+		/* don't center text if it chops off the start of the text, 2 gives some margin */
+		if(xofs < 2) {
+			xofs= 2;
+		}
+	}
+	else if(fs->align==UI_STYLE_TEXT_RIGHT) {
 		xofs= rect->xmax - rect->xmin - BLF_width(fs->uifont_id, str) - 1;
+	}
 	
 	/* clip is very strict, so we give it some space */
 	BLF_clipping(fs->uifont_id, rect->xmin-1, rect->ymin-4, rect->xmax+1, rect->ymax+4);

Modified: trunk/blender/source/blender/render/intern/source/convertblender.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/convertblender.c	2011-04-15 01:19:13 UTC (rev 36173)
+++ trunk/blender/source/blender/render/intern/source/convertblender.c	2011-04-15 01:32:37 UTC (rev 36174)
@@ -548,7 +548,7 @@
 		coord= tface->uv[vert_index];
 		fUV[0]= coord[0]; fUV[1]= coord[1];
 	}
-	else if(1 || (coord= (&vlr->v1)[vert_index]->orco)) {
+	else if((coord= (&vlr->v1)[vert_index]->orco)) {
 		map_to_sphere(&fUV[0], &fUV[1], coord[0], coord[1], coord[2]);
 	}
 	else { /* else we get un-initialized value, 0.0 ok default? */




More information about the Bf-blender-cvs mailing list