This is really two commits but the first one is very small and affects one
authorKent Mein <mein@cs.umn.edu>
Thu, 9 Nov 2006 15:45:19 +0000 (15:45 +0000)
committerKent Mein <mein@cs.umn.edu>
Thu, 9 Nov 2006 15:45:19 +0000 (15:45 +0000)
file I modified for the other patch.  So I'm being bad and combining them
together.

First one is added -lXi to LLIBS for solaris.  (Makes it so it compiles
again with the tablet stuff added)

Second one is the real commit its an expansion of patch #4458
This adds optional ICONV lining to support international fonts in the
file selector.  Thanks to wisit venita (dripstone) I mostly just cleaned
it up a little and made it optional via defines.

Its currently turned off for all platforms except for solaris on scons.
For scons see your config/(platform).py file look for WITH_BF_ICONV
For the Makefiles look at source/nan_definitions.mk look for WITH_ICONV
(basically you'll want to export WITH_ICONV=true and possibly set some other
stuff)

Let me know if there are any problems.

Kent
--
mein@cs.umn.edu

12 files changed:
config/darwin-config.py
config/linux2-config.py
config/linuxcross-config.py
config/openbsd3-config.py
config/sunos5-config.py
config/win32-mingw-config.py
config/win32-vc-config.py
source/blender/src/Makefile
source/blender/src/SConscript
source/blender/src/filesel.c
source/blender/src/interface_draw.c
source/nan_link.mk

index 0d4bc5c0be01b58316eb357707480f172b4883d5..08fdbb41baa4fada26c03f06d700df23b7cdad30 100644 (file)
@@ -109,6 +109,12 @@ BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
 
 WITH_BF_QUICKTIME = 'true' # -DWITH_QUICKTIME
 
+WITH_BF_ICONV = 'false'
+BF_ICONV = LIBDIR + "/iconv"
+BF_ICONV_INC = '${BF_ICONV}/include'
+BF_ICONV_LIB = 'iconv'
+BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
+
 # Mesa Libs should go here if your using them as well....
 WITH_BF_STATICOPENGL = 'true'
 BF_OPENGL_LIB = 'GL GLU'
index f7d84d228f3ecc66eebbafe38e4768a64847e3ed..c56a3d1d8f7515b1b327539b8eaeda431fbfae8b 100644 (file)
@@ -103,6 +103,12 @@ WITH_BF_QUICKTIME = 'false' # -DWITH_QUICKTIME
 BF_QUICKTIME = '/usr/local'
 BF_QUICKTIME_INC = '${BF_QUICKTIME}/include'
 
+WITH_BF_ICONV = 'false'
+BF_ICONV = LIBDIR + "/iconv"
+BF_ICONV_INC = '${BF_ICONV}/include'
+BF_ICONV_LIB = 'iconv'
+BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
+
 # enable ffmpeg  support
 WITH_BF_FFMPEG = 'false'  # -DWITH_FFMPEG
 BF_FFMPEG = '/usr'
index 2d833d2fcfc954eb8d4c60d2b3604658d3a0d3b1..468f4cfcc502385a9ea6b5b19dedc608a9ad3f35 100644 (file)
@@ -98,6 +98,12 @@ WITH_BF_QUICKTIME = 'false' # -DWITH_QUICKTIME
 BF_QUICKTIME = '/usr/local'
 BF_QUICKTIME_INC = '${BF_QUICKTIME}/include'
 
+WITH_BF_ICONV = 'false'
+BF_ICONV = LIBDIR + "/iconv"
+BF_ICONV_INC = '${BF_ICONV}/include'
+BF_ICONV_LIB = 'iconv'
+BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
+
 # Mesa Libs should go here if your using them as well....
 WITH_BF_STATICOPENGL = 'false'
 BF_OPENGL = 'C:\\MingW'
index b44e79eb2a6e437645484fae354cfbbaa48572a4..303f79c9bc8a233558dc4ade17120e93f67f0a6c 100644 (file)
@@ -103,6 +103,12 @@ BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
 
 WITH_BF_QUICKTIME = 'false' # -DWITH_QUICKTIME
 
+WITH_BF_ICONV = 'false'
+BF_ICONV = LIBDIR + "/iconv"
+BF_ICONV_INC = '${BF_ICONV}/include'
+BF_ICONV_LIB = 'iconv'
+BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
+
 # Mesa Libs should go here if your using them as well....
 WITH_BF_STATICOPENGL = 'true'
 BF_OPENGL = '/usr/X11R6'
index de342c40158a306ea9a3db06a18d89965b2314cd..71f1e7a1b4876b47ac3f172693e84ae2d57ddd16 100644 (file)
@@ -107,6 +107,12 @@ WITH_BF_QUICKTIME = 'false' # -DWITH_QUICKTIME
 BF_QUICKTIME = '/usr/local'
 BF_QUICKTIME_INC = '${BF_QUICKTIME}/include'
 
+WITH_BF_ICONV = 'true'
+BF_ICONV = "/usr"
+BF_ICONV_INC = '${BF_ICONV}/include'
+BF_ICONV_LIB = 'iconv'
+BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
+
 # enable ffmpeg  support
 WITH_BF_FFMPEG = 'false'  # -DWITH_FFMPEG
 BF_FFMPEG = '/usr/local'
index e23e6436c5912e30ad2e3fb48709b72725a027f8..f84bf45c58562f481e7706607ae746abf2a3b916 100644 (file)
@@ -120,6 +120,12 @@ WITH_BF_QUICKTIME = 'false' # -DWITH_QUICKTIME
 BF_QUICKTIME = '/usr/local'
 BF_QUICKTIME_INC = '${BF_QUICKTIME}/include'
 
+WITH_BF_ICONV = 'false'
+BF_ICONV = LIBDIR + "/iconv"
+BF_ICONV_INC = '${BF_ICONV}/include'
+BF_ICONV_LIB = 'iconv'
+BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
+
 # Mesa Libs should go here if your using them as well....
 WITH_BF_STATICOPENGL = 'false'
 BF_OPENGL = 'C:\\MingW'
index eb0a2ca2939fee830d89dc470a68dc7f9b4690f7..9b8c446d9182d176250da06742aa3fb9755e0b9b 100644 (file)
@@ -123,6 +123,12 @@ BF_QUICKTIME_INC = '${BF_QUICKTIME}/CIncludes'
 BF_QUICKTIME_LIB = 'qtmlClient'
 BF_QUICKTIME_LIBPATH = '${BF_QUICKTIME}/Libraries'
 
+WITH_BF_ICONV = 'false'
+BF_ICONV = LIBDIR + "/iconv"
+BF_ICONV_INC = '${BF_ICONV}/include'
+BF_ICONV_LIB = 'iconv'
+BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
+
 WITH_BF_STATICOPENGL = 'false'
 BF_OPENGL_INC = '${BF_OPENGL}/include'
 BF_OPENGL_LIBINC = '${BF_OPENGL}/lib'
index fd92c412736a0186edc194659dad8444023f20e3..cb6c19548128d1a550e850c83fa3b0065ce6723b 100644 (file)
@@ -110,6 +110,11 @@ ifeq ($(WITH_QUICKTIME),true)
        CPPFLAGS += -DWITH_QUICKTIME
 endif
 
+ifeq ($(WITH_ICONV), true)
+       CPPFLAGS += -DWITH_ICONV
+       CPPFLAGS += $(NAN_ICONV_INC)
+endif
+
 ifeq ($(WITH_FFMPEG),true)
         CPPFLAGS += -DWITH_FFMPEG
         CPPFLAGS += $(NAN_FFMPEGCFLAGS)
index 37522eb171c7ad4997c9a165a7e47edcb26c5122..a90f36e1974ddf8b21d99a18cf3d5eab25240eb9 100644 (file)
@@ -35,6 +35,10 @@ if env['WITH_BF_QUICKTIME']==1:
     incs += ' ' + env['BF_QUICKTIME_INC']
     defs.append('WITH_QUICKTIME')
 
+if env['WITH_BF_ICONV'] == 1:
+    incs += ' ' + env['BF_ICONV_INC']
+    defs.append('WITH_ICONV')
+
 if env['WITH_BF_FFMPEG'] == 1:
     defs.append('WITH_FFMPEG')
     incs += ' ' + env['BF_FFMPEG_INC']
index 86e8cdfdc81f5bb3ae49c2a8f9392075f5b43504..cba0ceb68180cd95fd60ccf910b13aeb5e850db8 100644 (file)
@@ -92,6 +92,7 @@
 #include "BIF_space.h"
 #include "BIF_screen.h"
 #include "BIF_resources.h"
+#include "BIF_language.h"
 
 #include "BLO_readfile.h"
 
 
 #include "BIF_fsmenu.h"  /* include ourselves */
 
+#if defined WITH_ICONV
+       #include "iconv.h"
+#endif
+
 #if defined WIN32 || defined __BeOS
 int fnmatch(const char *pattern, const char *string, int flags)
 {
@@ -139,6 +144,7 @@ static void library_to_filelist(SpaceFile *sfile);
 static void filesel_select_objects(struct SpaceFile *sfile);
 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);
 
@@ -881,6 +887,7 @@ static void print_line(SpaceFile *sfile, struct direntry *files, int x, int y)
 {
        int boxcol=0;
        char *s;
+       char utf_8[512];
 
        boxcol= files->flags & (HILITE + ACTIVE);
 
@@ -924,7 +931,12 @@ static void print_line(SpaceFile *sfile, struct direntry *files, int x, int y)
        s = files->string;
        if(s) {
                glRasterPos2i(x,  y);
+#ifdef WITH_ICONV
+               string_to_utf8(files->relname, utf_8);
+               BIF_DrawString(G.font, utf_8, (U.transopts & USER_TR_MENUS));
+#else
                BMF_DrawString(G.font, files->relname);
+#endif
                
                x += sfile->maxnamelen + 100;
 
@@ -1087,6 +1099,7 @@ void drawfilespace(ScrArea *sa, void *spacedata)
        short mval[2];
        char name[20];
        char *menu;
+       char utf_8[512];
 
        myortho2(-0.375, sa->winx-0.375, -0.375, sa->winy-0.375);
 
@@ -1158,6 +1171,29 @@ void drawfilespace(ScrArea *sa, void *spacedata)
        sa->win_swap= WIN_BACK_OK;
 }
 
+#ifdef WITH_ICONV
+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);
+}
+#endif
+
 static void do_filescroll(SpaceFile *sfile)
 {
        short mval[2], oldy, yo;
index 84336b2d293201354694f9c60f1d75c8b8b13900..58ca38ec30cdec51630495e3ae6c6db135c1d0ba 100644 (file)
@@ -1565,7 +1565,7 @@ static void ui_draw_text_icon(uiBut *but)
                        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;     // no translation, of course!
                        else transopts= (U.transopts & USER_TR_BUTTONS);
                        BIF_DrawString(but->font, but->drawstr+but->ofs, transopts);
 
index 9b21ebfe2db93e4d0c389ff7a590caeabc385014..e6824643a0431c5c8d538780d025736dd0682c59 100644 (file)
@@ -118,7 +118,7 @@ ifeq ($(OS),openbsd)
 endif
 
 ifeq ($(OS),solaris)
-    LLIBS = -lGLU -lGL -lXmu -lXext -lX11 -lc -lm -ldl -lsocket -lnsl
+    LLIBS = -lGLU -lGL -lXmu -lXext -lXi -lX11 -lc -lm -ldl -lsocket -lnsl
     DYNLDFLAGS = -shared $(LDFLAGS)
 endif
 
@@ -155,6 +155,10 @@ ifneq ($(OS), irix)
    LLIBS += $(NAN_SDLLIBS)
 endif
 
+ifeq ($(WITH_ICONV),true)
+   LLIBS += $(NAN_ICONV_LIBS)
+endif
+
 ifeq ($(WITH_FFMPEG),true)
    LLIBS += $(NAN_FFMPEGLIBS)
 endif