From 1f5ba2debd8913421ea92e06c0b2759705ffb5b7 Mon Sep 17 00:00:00 2001 From: Rob Haarsma Date: Fri, 9 May 2003 12:48:21 +0000 Subject: cleaned up language support for a release. --- source/blender/include/BIF_language.h | 6 ++-- source/blender/src/headerbuttons.c | 3 +- source/blender/src/language.c | 26 +++++++------- source/blender/src/usiblender.c | 66 +++++++++++++---------------------- 4 files changed, 43 insertions(+), 58 deletions(-) (limited to 'source') diff --git a/source/blender/include/BIF_language.h b/source/blender/include/BIF_language.h index 24edc4343e7..718795dd8d1 100644 --- a/source/blender/include/BIF_language.h +++ b/source/blender/include/BIF_language.h @@ -33,11 +33,11 @@ #ifndef BIF_LANGUAGE_H #define BIF_LANGUAGE_H -int readMultiLingualFiles(void); /* usiblender.c */ -void languagesmenu_free(void); /* usiblender.c */ +int read_languagefile(void); /* usiblender.c */ +void free_languagemenu(void); /* usiblender.c */ void set_interface_font(char *str); /* headerbuttons.c */ -void set_ML_interface_font(void); /* headerbuttons.c */ +void start_interface_font(void); /* headerbuttons.c */ void lang_setlanguage(void); /* usiblender.c */ char *language_pup(void); diff --git a/source/blender/src/headerbuttons.c b/source/blender/src/headerbuttons.c index f370a2cc834..5d209247082 100644 --- a/source/blender/src/headerbuttons.c +++ b/source/blender/src/headerbuttons.c @@ -1516,12 +1516,11 @@ void do_global_buttons(unsigned short event) case B_DOLANGUIFONT: /* is button from space.c *info* */ if(U.transopts & TR_ALL) - set_ML_interface_font(); + start_interface_font(); else G.ui_international = FALSE; allqueue(REDRAWALL, 0); break; - #endif case B_FULL: diff --git a/source/blender/src/language.c b/source/blender/src/language.c index 9bd92cc6774..89c25cbb207 100644 --- a/source/blender/src/language.c +++ b/source/blender/src/language.c @@ -137,9 +137,7 @@ void set_interface_font(char *str) { char di[FILE_MAXDIR]; if(FTF_SetFont(str, U.fontsize)) { - lang_setlanguage(); - BLI_split_dirfile(str, di, U.fontname); G.ui_international = TRUE; @@ -151,12 +149,12 @@ void set_interface_font(char *str) { } -void set_ML_interface_font(void) { +void start_interface_font(void) { char tstr[FILE_MAXDIR+FILE_MAXFILE]; int result = 0; - /* dirty hack to find out if we have saved language/font settings, - if not, try default font --phase */ + /* hack to find out if we have saved language/font settings. + if not, set defaults and try Vera font (or else .bfont.tff) --phase */ if(U.fontsize != 0) { BLI_make_file_string("/", tstr, U.fontdir, U.fontname); @@ -164,21 +162,25 @@ void set_ML_interface_font(void) { result = FTF_SetFont(tstr, U.fontsize); } else { U.language= 0; - U.fontsize= 12; + U.fontsize= 11; U.encoding= 0; - sprintf(U.fontname, ".bfont.ttf\0"); + sprintf(U.fontname, "Vera.ttf\0"); result = FTF_SetFont(U.fontname, U.fontsize); } - if(!result) result = FTF_SetFont(".bfont.ttf", U.fontsize); -// printf(" res = %d\n ", result); + if(!result) { + U.fontsize= 12; + sprintf(U.fontname, ".bfont.ttf\0"); + result = FTF_SetFont(U.fontname, U.fontsize); + } + if(result) { lang_setlanguage(); G.ui_international = TRUE; } else { - printf("no way ftf\n"); + printf("no font found for international support\n"); G.ui_international = FALSE; } @@ -243,7 +245,7 @@ void puplang_insert_entry(char *line) } -int readMultiLingualFiles(void) { +int read_languagefile(void) { char name[FILE_MAXDIR+FILE_MAXFILE]; LinkNode *l, *lines; @@ -276,7 +278,7 @@ int readMultiLingualFiles(void) { } -void languagesmenu_free(void) +void free_languagemenu(void) { LANGMenuEntry *lme= langmenu; diff --git a/source/blender/src/usiblender.c b/source/blender/src/usiblender.c index c366af6992d..de07e09b707 100644 --- a/source/blender/src/usiblender.c +++ b/source/blender/src/usiblender.c @@ -166,7 +166,7 @@ int BIF_read_homefile(void) { char tstr[FILE_MAXDIR+FILE_MAXFILE], scestr[FILE_MAXDIR]; char *home= BLI_gethome(); - int success, result; + int success; BLI_make_file_string(G.sce, tstr, home, ".B.blend"); strcpy(scestr, G.sce); /* temporal store */ @@ -183,20 +183,6 @@ int BIF_read_homefile(void) /* disable autoplay in .B.blend... */ G.fileflags &= ~G_FILE_AUTOPLAY; -#ifdef _WIN32 // FULLSCREEN - /* choose window startmode */ - switch (G.windowstate){ - case G_WINDOWSTATE_USERDEF: /* use the usersetting */ - break; - case G_WINDOWSTATE_FULLSCREEN: /* force fullscreen */ - U.uiflag |= FLIPFULLSCREEN; - break; - case G_WINDOWSTATE_BORDER: /* force with borders */ - U.uiflag &= ~FLIPFULLSCREEN; - } - mainwindow_toggle_fullscreen ((U.uiflag & FLIPFULLSCREEN)); -#endif - if (BLI_streq(U.tempdir, "/")) { char *tmp= getenv("TEMP"); @@ -218,24 +204,6 @@ int BIF_read_homefile(void) U.vrmlflag= USERDEF_VRML_LAYERS; } -#ifdef INTERNATIONAL - /* userdef multilanguage options */ - /* uncomment with versionchange to 2.27 --phase */ -/* - if (G.main->versionfile <= 226) { - U.language= 0; - U.fontsize= 12; - U.encoding= 0; - sprintf(U.fontname, ".bfont.ttf"); - } -*/ - if(U.transopts & TR_ALL) - set_ML_interface_font(); - else - G.ui_international = FALSE; - -#endif // INTERNATIONAL - space_set_commmandline_options(); reset_autosave(); @@ -488,20 +456,36 @@ void BIF_init(void) init_draw_rects(); /* drawobject.c */ init_gl_stuff(); /* drawview.c */ -#ifdef INTERNATIONAL - readMultiLingualFiles(); -#endif - BIF_read_homefile(); - readBlog(); strcpy(G.lib, G.sce); + +#ifdef INTERNATIONAL + read_languagefile(); + + if(U.transopts & TR_ALL) + start_interface_font(); + else + G.ui_international = FALSE; +#endif // INTERNATIONAL + +#ifdef _WIN32 // FULLSCREEN + /* choose window startmode */ + switch (G.windowstate){ + case G_WINDOWSTATE_USERDEF: /* use the usersetting */ + break; + case G_WINDOWSTATE_FULLSCREEN: /* force fullscreen */ + U.uiflag |= FLIPFULLSCREEN; + break; + case G_WINDOWSTATE_BORDER: /* force with borders */ + U.uiflag &= ~FLIPFULLSCREEN; + } + mainwindow_toggle_fullscreen ((U.uiflag & FLIPFULLSCREEN)); +#endif } /***/ -extern unsigned short fullscreen; -extern unsigned short borderless; extern ListBase editNurb; extern ListBase editelems; @@ -539,7 +523,7 @@ void exit_usiblender(void) fsmenu_free(); #ifdef INTERNATIONAL - languagesmenu_free(); + free_languagemenu(); #endif RE_free_render_data(); -- cgit v1.2.3