[Bf-committers] Stable patch for correct Chinese characters in Open Box

Drip Stone wisitvenita at gmail.com
Sat Jun 24 06:59:21 CEST 2006


Skipped content of type multipart/alternative-------------- next part --------------
Index: config/win32-vc-config.py
===================================================================
RCS file: /cvsroot/bf-blender/blender/config/win32-vc-config.py,v
retrieving revision 1.11
diff -u -r1.11 win32-vc-config.py
--- config/win32-vc-config.py	16 Mar 2006 19:16:26 -0000	1.11
+++ config/win32-vc-config.py	17 Jun 2006 02:48:51 -0000
@@ -134,7 +134,7 @@
 C_WARN = []
 CC_WARN = []
 
-LLIBS = 'ws2_32 dxguid vfw32 winmm kernel32 user32 gdi32 comdlg32 advapi32 shell32 ole32 oleaut32 uuid'
+LLIBS = 'ws2_32 dxguid vfw32 winmm kernel32 user32 gdi32 comdlg32 advapi32 shell32 ole32 oleaut32 uuid iconv'
 
 PLATFORM_LINKFLAGS = '''
                         /SUBSYSTEM:CONSOLE 
Index: source/blender/src/SConscript
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/SConscript,v
retrieving revision 1.33
diff -u -r1.33 SConscript
--- source/blender/src/SConscript	6 Feb 2006 00:49:25 -0000	1.33
+++ source/blender/src/SConscript	17 Jun 2006 02:32:31 -0000
@@ -28,6 +28,10 @@
 if env['WITH_BF_OPENEXR'] == 1:
     defs.append('WITH_OPENEXR')
 
+if env['WITH_BF_ICONV'] == 1:
+    incs += ' ' + env['BF_ICONV_INC']
+    defs.append('WITH_ICONV')
+
 if env['WITH_BF_QUICKTIME']==1:
     incs += ' ' + env['BF_QUICKTIME_INC']
     defs.append('WITH_QUICKTIME')
Index: source/blender/src/filesel.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/filesel.c,v
retrieving revision 1.76
diff -u -r1.76 filesel.c
--- source/blender/src/filesel.c	16 Jun 2006 12:17:35 -0000	1.76
+++ source/blender/src/filesel.c	19 Jun 2006 01:05:30 -0000
@@ -92,6 +92,7 @@
 #include "BIF_space.h"
 #include "BIF_screen.h"
 #include "BIF_resources.h"
+#include "BIF_language.h"
 
 #include "BLO_readfile.h"
 
@@ -108,6 +109,8 @@
 
 #include "BIF_fsmenu.h"  /* include ourselves */
 
+#include "iconv.h"
+
 #if defined WIN32 || defined __BeOS
 int fnmatch(const char *pattern, const char *string, int flags)
 {
@@ -140,6 +143,8 @@
 static void active_file_object(struct SpaceFile *sfile);
 static int groupname_to_code(char *group);
 
+static void string_to_utf8(char *original, char *utf_8);
+
 extern void countall(void);
 
 /* local globals */
@@ -880,6 +885,8 @@
 	int boxcol=0;
 	char *s;
 
+	char utf_8[512];
+
 	boxcol= files->flags & (HILITE + ACTIVE);
 
 	if(boxcol) {
@@ -922,7 +929,9 @@
 	s = files->string;
 	if(s) {
 		glRasterPos2i(x,  y);
-		BMF_DrawString(G.font, files->relname);
+//		BMF_DrawString(G.font, files->relname);
+		string_to_utf8(files->relname, utf_8);
+		BIF_DrawString(G.font, utf_8, (U.transopts & USER_TR_MENUS));
 		
 		x += sfile->maxnamelen + 100;
 
@@ -1086,6 +1095,8 @@
 	char name[20];
 	char *menu;
 
+	char utf_8[512];
+
 	myortho2(-0.375, sa->winx-0.375, -0.375, sa->winy-0.375);
 
 	BIF_GetThemeColor3fv(TH_HEADER, col);	// basic undrawn color is border
@@ -1121,6 +1132,10 @@
 
 	uiBlockBeginAlign(block);
 	uiDefBut(block, TEX,2,"",	textrct.xmin, filebuty2, textrct.xmax-textrct.xmin-loadbutton, 21, sfile->dir, 0.0, (float)FILE_MAXFILE-1, 0, 0, "Directory, enter a directory and press enter to create it"); /* Directory input */
+
+//	string_to_utf8(sfile->dir, utf_8);
+//	uiDefBut(block, TEX,2,"",	textrct.xmin, filebuty2, textrct.xmax-textrct.xmin-loadbutton, 21, utf_8, 0.0, (float)FILE_MAXFILE-1, 0, 0, "Directory, enter a directory and press enter to create it"); /* Directory input */
+
 	if(loadbutton) {
 		uiSetCurFont(block, UI_HELV);
 		uiDefBut(block, BUT,	    5, sfile->title,	textrct.xmax-loadbutton, filebuty2, loadbutton, 21, sfile->dir, 0.0, (float)FILE_MAXFILE-1, 0, 0, "");
@@ -1129,6 +1144,10 @@
 	
 	uiBlockBeginAlign(block);
 	uiDefBut(block, TEX,1,"",	textrct.xmin, filebuty1, textrct.xmax-textrct.xmin-loadbutton, 21, sfile->file, 0.0, (float)FILE_MAXFILE-1, 0, 0, "File, increment version number with (+/-)"); /* File input */
+
+//	string_to_utf8(sfile->file, utf_8);
+//	uiDefBut(block, TEX,1,"",	textrct.xmin, filebuty1, textrct.xmax-textrct.xmin-loadbutton, 21, utf_8, 0.0, (float)FILE_MAXFILE-1, 0, 0, "File, increment version number with (+/-)"); /* File input */
+
 	if(loadbutton) {
 		uiSetCurFont(block, UI_HELV);
 		uiDefBut(block, BUT,	    6, "Cancel",	textrct.xmax-loadbutton, filebuty1, loadbutton, 21, sfile->file, 0.0, (float)FILE_MAXFILE-1, 0, 0, "");
@@ -2646,3 +2665,24 @@
 	}
 }
 
+static void string_to_utf8(char *original, char *utf_8)
+{
+	size_t inbytesleft=strlen(original);
+	size_t outbytesleft=512;
+	size_t rv=0;
+	iconv_t cd;
+	
+	cd=iconv_open("UTF-8", "gb2312");
+	if (cd == (iconv_t)(-1)) {
+		printf("iconv_open Error");
+		*utf_8='\0';
+		return ;
+	}
+	rv=iconv(cd, &original, &inbytesleft, &utf_8, &outbytesleft);
+	if (rv == (size_t) -1) {
+		printf("iconv Error\n");
+		return ;
+	}
+	*utf_8 = '\0';
+	iconv_close(cd);
+}
\ No newline at end of file
Index: source/blender/src/interface_draw.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/interface_draw.c,v
retrieving revision 1.57
diff -u -r1.57 interface_draw.c
--- source/blender/src/interface_draw.c	9 Jun 2006 13:04:21 -0000	1.57
+++ source/blender/src/interface_draw.c	19 Jun 2006 16:09:56 -0000
@@ -1568,7 +1568,8 @@
 			if(but->type==LABEL && but->min!=0.0) BIF_ThemeColor(TH_BUT_TEXT_HI);
 		
 			ui_rasterpos_safe(x, (but->y1+but->y2- 9.0)/2.0, but->aspect);
-			if(but->type==TEX || but->type==IDPOIN) transopts= 0;	// no translation, of course!
+			if(but->type==IDPOIN) transopts= 0;	// translation, of course!!!
+//			if(but->type==TEX || but->type==IDPOIN) transopts= 0;	// no translation, of course!
 			else transopts= (U.transopts & USER_TR_BUTTONS);
 			BIF_DrawString(but->font, but->drawstr+but->ofs, transopts);


More information about the Bf-committers mailing list