cleaned up language support for a release.

This commit is contained in:
2003-05-09 12:48:21 +00:00
parent 6670ad7bec
commit 1f5ba2debd
4 changed files with 43 additions and 58 deletions

View File

@@ -33,11 +33,11 @@
#ifndef BIF_LANGUAGE_H #ifndef BIF_LANGUAGE_H
#define BIF_LANGUAGE_H #define BIF_LANGUAGE_H
int readMultiLingualFiles(void); /* usiblender.c */ int read_languagefile(void); /* usiblender.c */
void languagesmenu_free(void); /* usiblender.c */ void free_languagemenu(void); /* usiblender.c */
void set_interface_font(char *str); /* headerbuttons.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 */ void lang_setlanguage(void); /* usiblender.c */
char *language_pup(void); char *language_pup(void);

View File

@@ -1516,12 +1516,11 @@ void do_global_buttons(unsigned short event)
case B_DOLANGUIFONT: /* is button from space.c *info* */ case B_DOLANGUIFONT: /* is button from space.c *info* */
if(U.transopts & TR_ALL) if(U.transopts & TR_ALL)
set_ML_interface_font(); start_interface_font();
else else
G.ui_international = FALSE; G.ui_international = FALSE;
allqueue(REDRAWALL, 0); allqueue(REDRAWALL, 0);
break; break;
#endif #endif
case B_FULL: case B_FULL:

View File

@@ -137,9 +137,7 @@ void set_interface_font(char *str) {
char di[FILE_MAXDIR]; char di[FILE_MAXDIR];
if(FTF_SetFont(str, U.fontsize)) { if(FTF_SetFont(str, U.fontsize)) {
lang_setlanguage(); lang_setlanguage();
BLI_split_dirfile(str, di, U.fontname); BLI_split_dirfile(str, di, U.fontname);
G.ui_international = TRUE; 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]; char tstr[FILE_MAXDIR+FILE_MAXFILE];
int result = 0; int result = 0;
/* dirty hack to find out if we have saved language/font settings, /* hack to find out if we have saved language/font settings.
if not, try default font --phase */ if not, set defaults and try Vera font (or else .bfont.tff) --phase */
if(U.fontsize != 0) { if(U.fontsize != 0) {
BLI_make_file_string("/", tstr, U.fontdir, U.fontname); 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); result = FTF_SetFont(tstr, U.fontsize);
} else { } else {
U.language= 0; U.language= 0;
U.fontsize= 12; U.fontsize= 11;
U.encoding= 0; U.encoding= 0;
sprintf(U.fontname, ".bfont.ttf\0"); sprintf(U.fontname, "Vera.ttf\0");
result = FTF_SetFont(U.fontname, U.fontsize); result = FTF_SetFont(U.fontname, U.fontsize);
} }
if(!result) result = FTF_SetFont(".bfont.ttf", U.fontsize); if(!result) {
// printf(" res = %d\n ", result); U.fontsize= 12;
sprintf(U.fontname, ".bfont.ttf\0");
result = FTF_SetFont(U.fontname, U.fontsize);
}
if(result) { if(result) {
lang_setlanguage(); lang_setlanguage();
G.ui_international = TRUE; G.ui_international = TRUE;
} else { } else {
printf("no way ftf\n"); printf("no font found for international support\n");
G.ui_international = FALSE; 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]; char name[FILE_MAXDIR+FILE_MAXFILE];
LinkNode *l, *lines; LinkNode *l, *lines;
@@ -276,7 +278,7 @@ int readMultiLingualFiles(void) {
} }
void languagesmenu_free(void) void free_languagemenu(void)
{ {
LANGMenuEntry *lme= langmenu; LANGMenuEntry *lme= langmenu;

View File

@@ -166,7 +166,7 @@ int BIF_read_homefile(void)
{ {
char tstr[FILE_MAXDIR+FILE_MAXFILE], scestr[FILE_MAXDIR]; char tstr[FILE_MAXDIR+FILE_MAXFILE], scestr[FILE_MAXDIR];
char *home= BLI_gethome(); char *home= BLI_gethome();
int success, result; int success;
BLI_make_file_string(G.sce, tstr, home, ".B.blend"); BLI_make_file_string(G.sce, tstr, home, ".B.blend");
strcpy(scestr, G.sce); /* temporal store */ strcpy(scestr, G.sce); /* temporal store */
@@ -183,20 +183,6 @@ int BIF_read_homefile(void)
/* disable autoplay in .B.blend... */ /* disable autoplay in .B.blend... */
G.fileflags &= ~G_FILE_AUTOPLAY; 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, "/")) { if (BLI_streq(U.tempdir, "/")) {
char *tmp= getenv("TEMP"); char *tmp= getenv("TEMP");
@@ -218,24 +204,6 @@ int BIF_read_homefile(void)
U.vrmlflag= USERDEF_VRML_LAYERS; 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(); space_set_commmandline_options();
reset_autosave(); reset_autosave();
@@ -488,20 +456,36 @@ void BIF_init(void)
init_draw_rects(); /* drawobject.c */ init_draw_rects(); /* drawobject.c */
init_gl_stuff(); /* drawview.c */ init_gl_stuff(); /* drawview.c */
#ifdef INTERNATIONAL
readMultiLingualFiles();
#endif
BIF_read_homefile(); BIF_read_homefile();
readBlog(); readBlog();
strcpy(G.lib, G.sce); 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 editNurb;
extern ListBase editelems; extern ListBase editelems;
@@ -539,7 +523,7 @@ void exit_usiblender(void)
fsmenu_free(); fsmenu_free();
#ifdef INTERNATIONAL #ifdef INTERNATIONAL
languagesmenu_free(); free_languagemenu();
#endif #endif
RE_free_render_data(); RE_free_render_data();