diff options
-rwxr-xr-x | po/update_mo.py | 3 | ||||
-rwxr-xr-x | po/update_po.py | 3 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_userpref.py | 7 | ||||
-rw-r--r-- | source/blender/blenfont/BLF_api.h | 2 | ||||
-rw-r--r-- | source/blender/blenfont/intern/blf.c | 3 | ||||
-rw-r--r-- | source/blender/blenfont/intern/blf_lang.c | 51 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_style.c | 33 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_userdef_types.h | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_userdef.c | 48 | ||||
-rw-r--r-- | source/blender/windowmanager/WM_api.h | 3 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_files.c | 19 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_init_exit.c | 17 |
12 files changed, 109 insertions, 81 deletions
diff --git a/po/update_mo.py b/po/update_mo.py index 840d2ff0fea..e361f70d963 100755 --- a/po/update_mo.py +++ b/po/update_mo.py @@ -29,7 +29,8 @@ LANGS = ( "sr", "sv", "uk", - "zh_CN" + "zh_CN", + "zh_TW" ) #-o %s.new.po diff --git a/po/update_po.py b/po/update_po.py index 640b3a5f2d2..c01c4bdc32d 100755 --- a/po/update_po.py +++ b/po/update_po.py @@ -28,7 +28,8 @@ LANGS = ( "sr", "sv", "uk", - "zh_CN" + "zh_CN", + "zh_TW" ) #-o %s.new.po for lang in LANGS: diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index 5f47ca7bc87..900d38d1693 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -481,14 +481,13 @@ class USERPREF_PT_system(bpy.types.Panel): opengl_lamp_buttons(column, lamp) column.separator() - column.separator() - column.separator() column.label(text=_("Color Picker Type:")) column.row().prop(system, "color_picker_type", text="") - column.separator() - column.separator() + column.label(text=_("Select Language:")) + column.row().prop(system, "language", text="") + column.separator() column.prop(system, "use_weight_color_range", text=_("Custom Weight Paint Range")) diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h index 88c29d43d25..837ca814fbf 100644 --- a/source/blender/blenfont/BLF_api.h +++ b/source/blender/blenfont/BLF_api.h @@ -218,8 +218,6 @@ void BLF_dir_free(char **dirs, int count); extern int blf_mono_font; extern int blf_mono_font_render; // dont mess drawing with render threads. -// XXX, me, too -extern int blf_unifont; #define _(msgid) BLF_gettext(msgid) #define N_(msgid) msgid diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c index 87d380c1b2a..c0e62b1c0c7 100644 --- a/source/blender/blenfont/intern/blf.c +++ b/source/blender/blenfont/intern/blf.c @@ -75,9 +75,6 @@ static int global_font_dpi= 72; int blf_mono_font= -1; int blf_mono_font_render= -1; -// XXX, should these be made into global_font_'s too? -int blf_unifont= -1; - static FontBLF *BLF_get(int fontid) { if (fontid >= 0 && fontid < BLF_MAX_FONT) diff --git a/source/blender/blenfont/intern/blf_lang.c b/source/blender/blenfont/intern/blf_lang.c index 6ea9a259286..c40c98a3699 100644 --- a/source/blender/blenfont/intern/blf_lang.c +++ b/source/blender/blenfont/intern/blf_lang.c @@ -41,6 +41,7 @@ #include <locale.h> #include "libintl.h" +#include "DNA_userdef_types.h" #include "DNA_listBase.h" #include "DNA_vec_types.h" @@ -65,6 +66,40 @@ static char global_messagepath[1024]; static char global_language[32]; static char global_encoding_name[32]; +/* map from the rna_userdef.c:rna_def_userdef_system(BlenderRNA *brna):language_items */ +static char locale_default[] = ""; +static char locale_english[] = "en_US"; +static char locale_japanese[] = "ja_JP"; +static char locale_sim_chinese[] = "zh_CN"; +static char locale_tra_chinese[] = "zh_TW"; + +static char *lang_to_locale[] = { + locale_default, + locale_english, /* us english is the default language of blender */ + locale_japanese, + locale_default, + locale_default, + locale_default, + locale_default, + locale_default, + locale_default, + locale_default, + locale_default, + locale_default, + locale_default, + locale_sim_chinese, + locale_tra_chinese, + locale_default, + locale_default, + locale_default, + locale_default, + locale_default, + locale_default, + locale_default, + locale_default, + locale_default, + locale_default, +}; void BLF_lang_init(void) { @@ -82,16 +117,16 @@ void BLF_lang_init(void) /* XXX WARNING!!! IN osx somehow the previous function call jumps in this one??? (ton, ppc) */ void BLF_lang_set(const char *str) { + char *locreturn; if(str==NULL) { - return; + if( U.language==1 ) + return; + str = lang_to_locale[U.language]; } - else { - #if defined (_WIN32) || defined(__APPLE__) BLI_setenv("LANG", str); - BLI_strncpy(global_language, BLI_getenv("LANG"), sizeof(global_language)); #else - char *locreturn= setlocale(LC_ALL, str); + locreturn= setlocale(LC_ALL, str); if (locreturn == NULL) { char *lang= BLI_sprintfN("%s.UTF-8", str); @@ -102,13 +137,15 @@ void BLF_lang_set(const char *str) MEM_freeN(lang); } - BLI_strncpy(global_language, locreturn, sizeof(global_language)); + setlocale(LC_NUMERIC, "C"); #endif textdomain(DOMAIN_NAME); bindtextdomain(DOMAIN_NAME, global_messagepath); /* bind_textdomain_codeset(DOMAIN_NAME, global_encoding_name); */ - } + BLI_strncpy(global_language, str, sizeof(global_language)); + + } void BLF_lang_encoding(const char *str) diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c index 8aab414a803..dec4afa7894 100644 --- a/source/blender/editors/interface/interface_style.c +++ b/source/blender/editors/interface/interface_style.c @@ -76,7 +76,7 @@ /* ********************************************** */ -static uiStyle *ui_style_new(ListBase *styles, const char *name, short fontid) +static uiStyle *ui_style_new(ListBase *styles, const char *name, short uifont_id) { uiStyle *style= MEM_callocN(sizeof(uiStyle), "new style"); @@ -85,7 +85,7 @@ static uiStyle *ui_style_new(ListBase *styles, const char *name, short fontid) style->panelzoom= 1.0; /* unused */ - style->paneltitle.uifont_id= fontid; + style->paneltitle.uifont_id= uifont_id; style->paneltitle.points= 12; style->paneltitle.kerning= 1; style->paneltitle.shadow= 1; @@ -94,7 +94,7 @@ static uiStyle *ui_style_new(ListBase *styles, const char *name, short fontid) style->paneltitle.shadowalpha= 0.15f; style->paneltitle.shadowcolor= 1.0f; - style->grouplabel.uifont_id= fontid; + style->grouplabel.uifont_id= uifont_id; style->grouplabel.points= 12; style->grouplabel.kerning= 1; style->grouplabel.shadow= 3; @@ -102,7 +102,7 @@ static uiStyle *ui_style_new(ListBase *styles, const char *name, short fontid) style->grouplabel.shady= -1; style->grouplabel.shadowalpha= 0.25f; - style->widgetlabel.uifont_id= fontid; + style->widgetlabel.uifont_id= uifont_id; style->widgetlabel.points= 11; style->widgetlabel.kerning= 1; style->widgetlabel.shadow= 3; @@ -111,7 +111,7 @@ static uiStyle *ui_style_new(ListBase *styles, const char *name, short fontid) style->widgetlabel.shadowalpha= 0.15f; style->widgetlabel.shadowcolor= 1.0f; - style->widget.uifont_id= fontid; + style->widget.uifont_id= uifont_id; style->widget.points= 11; style->widget.kerning= 1; style->widget.shadowalpha= 0.25f; @@ -254,8 +254,10 @@ void uiStyleFontDrawRotated(uiFontStyle *fs, rcti *rect, const char *str) uiStyle* UI_GetStyle(void) { - uiStyle *style = BLI_findstring( &U.uistyles, U.myuistyle, sizeof(style)*2 ); - return (style != NULL) ? style : U.uifonts.first; + uiStyle *style = NULL; + /* offset is two struct uiStyle pointers */ + /* style = BLI_findstring( &U.uistyles, "Unifont Style", sizeof(style)*2 ) */; + return (style != NULL) ? style : U.uistyles.first; } /* temporarily, does widget font */ @@ -319,7 +321,7 @@ void uiStyleInit(void) for(font= U.uifonts.first; font; font= font->next) { if(font->uifont_id==UIFONT_DEFAULT) { - font->blf_id= BLF_load_mem("default", (unsigned char*)datatoc_bfont_ttf, datatoc_bfont_ttf_size); + font->blf_id= BLF_load_mem_unique("default", (unsigned char *)get_datatoc_bunifont_ttf(), datatoc_bunifont_ttf_size); } else { font->blf_id= BLF_load(font->filename); @@ -357,21 +359,6 @@ void uiStyleInit(void) blf_mono_font_render= BLF_load_mem_unique("monospace", (unsigned char *)datatoc_bmonofont_ttf, datatoc_bmonofont_ttf_size); BLF_size(blf_mono_font_render, 12, 72); - - /* offset is two struct uiStyle pointers */ - if( BLI_findstring( &U.uistyles, "Unifont Style", sizeof(style)*2 )==NULL ) - { - if( blf_unifont == -1 ) - blf_unifont= BLF_load_mem_unique("unifont", (unsigned char *)get_datatoc_bunifont_ttf(), datatoc_bunifont_ttf_size); - if( blf_unifont != -1 ) - { - BLF_size(blf_unifont, 12, 72); - ui_style_new(&U.uistyles, "Unifont Style", blf_unifont ); - } - } - /* init style setting */ - if( U.myuistyle[0]==0 ) - strcpy( U.myuistyle, "Unifont Style" ); } void uiStyleFontSet(uiFontStyle *fs) diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 7fd58ffaeec..ae57cf3f80b 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -344,7 +344,6 @@ typedef struct UserDef { struct ListBase keymaps; struct ListBase addons; char keyconfigstr[64]; - char myuistyle[24]; short undosteps; short undomemory; diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index f6ed440a10c..5a29b4a8211 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -2436,29 +2436,31 @@ static void rna_def_userdef_system(BlenderRNA *brna) /* hardcoded here, could become dynamic somehow */ static EnumPropertyItem language_items[] = { - {0, "ENGLISH", 0, "English", ""}, - {1, "JAPANESE", 0, "Japanese", ""}, - {2, "DUTCH", 0, "Dutch", ""}, - {3, "ITALIAN", 0, "Italian", ""}, - {4, "GERMAN", 0, "German", ""}, - {5, "FINNISH", 0, "Finnish", ""}, - {6, "SWEDISH", 0, "Swedish", ""}, - {7, "FRENCH", 0, "French", ""}, - {8, "SPANISH", 0, "Spanish", ""}, - {9, "CATALAN", 0, "Catalan", ""}, - {10, "CZECH", 0, "Czech", ""}, - {11, "BRAZILIAN_PORTUGUESE", 0, "Brazilian Portuguese", ""}, - {12, "SIMPLIFIED_CHINESE", 0, "Simplified Chinese", ""}, - {13, "RUSSIAN", 0, "Russian", ""}, - {14, "CROATIAN", 0, "Croatian", ""}, - {15, "SERBIAN", 0, "Serbian", ""}, - {16, "UKRAINIAN", 0, "Ukrainian", ""}, - {17, "POLISH", 0, "Polish", ""}, - {18, "ROMANIAN", 0, "Romanian", ""}, - {19, "ARABIC", 0, "Arabic", ""}, - {20, "BULGARIAN", 0, "Bulgarian", ""}, - {21, "GREEK", 0, "Greek", ""}, - {22, "KOREAN", 0, "Korean", ""}, + {0, "DEFAULT", 0, N_("Default"), ""}, + {1, "ENGLISH", 0, "English (English)", ""}, + {2, "JAPANESE", 0, "Japanese (日本語)", ""}, + {3, "DUTCH", 0, "Dutch (Nederlandse taal)", ""}, + {4, "ITALIAN", 0, "Italian (Italian)", ""}, + {5, "GERMAN", 0, "German (German)", ""}, + {6, "FINNISH", 0, "Finnish (Finnish)", ""}, + {7, "SWEDISH", 0, "Swedish (Swedish)", ""}, + {8, "FRENCH", 0, "French (French)", ""}, + {9, "SPANISH", 0, "Spanish (Spanish)", ""}, + {10, "CATALAN", 0, "Catalan (Catalan)", ""}, + {11, "CZECH", 0, "Czech (Czech)", ""}, + {12, "BRAZILIAN_PORTUGUESE", 0, "Brazilian Portuguese (Brazilian Portuguese)", ""}, + {13, "SIMPLIFIED_CHINESE", 0, "Simplified Chinese (简体中文)", ""}, + {14, "TRADITIONAL_CHINESE", 0, "Traditional Chinese (繁體中文)", ""}, + {15, "RUSSIAN", 0, "Russian (Russian)", ""}, + {16, "CROATIAN", 0, "Croatian (Croatian)", ""}, + {17, "SERBIAN", 0, "Serbian (Serbian)", ""}, + {18, "UKRAINIAN", 0, "Ukrainian (Ukrainian)", ""}, + {19, "POLISH", 0, "Polish (Polish)", ""}, + {20, "ROMANIAN", 0, "Romanian (Român)", ""}, + {21, "ARABIC", 0, "Arabic (العربية)", ""}, + {22, "BULGARIAN", 0, "Bulgarian (Bulgarian)", ""}, + {23, "GREEK", 0, "Greek (Greek)", ""}, + {24, "KOREAN", 0, "Korean (한국 언어)", ""}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "UserPreferencesSystem", NULL); diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 67294a8eb53..98ffaac004e 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -93,7 +93,8 @@ void WM_window_open_temp (struct bContext *C, struct rcti *position, int type); /* files */ int WM_read_homefile_exec(struct bContext *C, struct wmOperator *op); -int WM_read_homefile (struct bContext *C, struct ReportList *reports, short from_memory); +int WM_read_homefile (struct bContext *C, struct ReportList *reports, short from_memory, ListBase *wmbase); +int WM_read_homefile_proc(struct bContext *C, ListBase *wmbase); int WM_write_homefile (struct bContext *C, struct wmOperator *op); void WM_read_file (struct bContext *C, const char *filepath, struct ReportList *reports); int WM_write_file (struct bContext *C, const char *target, int fileflags, struct ReportList *reports, int copy); diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index df00c2b83cb..d69aa8c1c4c 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -444,9 +444,8 @@ void WM_read_file(bContext *C, const char *filepath, ReportList *reports) /* called on startup, (context entirely filled with NULLs) */ /* or called for 'New File' */ /* op can be NULL */ -int WM_read_homefile(bContext *C, ReportList *reports, short from_memory) +int WM_read_homefile(bContext *C, ReportList *reports, short from_memory, ListBase *wmbase) { - ListBase wmbase; char tstr[FILE_MAXDIR+FILE_MAXFILE]; int success= 0; @@ -468,7 +467,7 @@ int WM_read_homefile(bContext *C, ReportList *reports, short from_memory) G.fileflags &= ~G_FILE_NO_UI; /* put aside screens to match with persistant windows later */ - wm_window_match_init(C, &wmbase); + wm_window_match_init(C, wmbase); if (!from_memory && BLI_exists(tstr)) { success = (BKE_read_file(C, tstr, NULL) != BKE_READ_FILE_FAIL); @@ -480,7 +479,7 @@ int WM_read_homefile(bContext *C, ReportList *reports, short from_memory) } if(success==0) { success = BKE_read_file_from_memory(C, datatoc_startup_blend, datatoc_startup_blend_size, NULL); - if (wmbase.first == NULL) wm_clear_default_size(C); + if (wmbase->first == NULL) wm_clear_default_size(C); #ifdef WITH_PYTHON_SECURITY /* not default */ /* use alternative setting for security nuts @@ -488,7 +487,12 @@ int WM_read_homefile(bContext *C, ReportList *reports, short from_memory) U.flag |= USER_SCRIPT_AUTOEXEC_DISABLE; #endif } - + return TRUE; +} + +/* split from the old WM_read_homefile */ +int WM_read_homefile_proc(bContext *C, ListBase *wmbase) +{ /* prevent buggy files that had G_FILE_RELATIVE_REMAP written out by mistake. Screws up autosaves otherwise * can remove this eventually, only in a 2.53 and older, now its not written */ G.fileflags &= ~G_FILE_RELATIVE_REMAP; @@ -497,7 +501,7 @@ int WM_read_homefile(bContext *C, ReportList *reports, short from_memory) wm_init_userdef(C); /* match the read WM with current WM */ - wm_window_match_do(C, &wmbase); + wm_window_match_do(C, wmbase); WM_check(C); /* opens window(s), checks keymaps */ G.main->name[0]= '\0'; @@ -542,8 +546,9 @@ int WM_read_homefile(bContext *C, ReportList *reports, short from_memory) int WM_read_homefile_exec(bContext *C, wmOperator *op) { + ListBase wmbase; int from_memory= strcmp(op->type->idname, "WM_OT_read_factory_settings") == 0; - return WM_read_homefile(C, op->reports, from_memory) ? OPERATOR_FINISHED : OPERATOR_CANCELLED; + return WM_read_homefile(C, op->reports, from_memory, &wmbase) && WM_read_homefile_proc(C, &wmbase) ? OPERATOR_FINISHED : OPERATOR_CANCELLED; } void WM_read_history(void) diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index dfa3a0f80f1..26d1b4454bd 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -122,6 +122,7 @@ int wm_start_with_console = 0; /* only called once, for startup */ void WM_init(bContext *C, int argc, const char **argv) { + ListBase wmbase; if (!G.background) { wm_ghost_init(C); /* note: it assigns C to ghost! */ wm_init_cursor_data(); @@ -131,24 +132,24 @@ void WM_init(bContext *C, int argc, const char **argv) BLF_lang_init(); // use default settings BLF_lang_encoding(""); - BLF_lang_set(""); + /* get the default database, plus a wm */ + WM_read_homefile(C, NULL, G.factory_startup, &wmbase); + BLF_lang_set(NULL); RNA_types_init_gettext(); wm_operatortype_init(); - + set_free_windowmanager_cb(wm_close_and_free); /* library.c */ set_blender_test_break_cb(wm_window_testbreak); /* blender.c */ DAG_editors_update_cb(ED_render_id_flush_update); /* depsgraph.c */ - + ED_spacetypes_init(); /* editors/space_api/spacetype.c */ - - ED_file_init(); /* for fsmenu */ - ED_init_node_butfuncs(); - /* get the default database, plus a wm */ - WM_read_homefile(C, NULL, G.factory_startup); + ED_file_init(); /* for fsmenu */ + ED_init_node_butfuncs(); + WM_read_homefile_proc(C, &wmbase); /* note: there is a bug where python needs initializing before loading the * startup.blend because it may contain PyDrivers. It also needs to be after * initializing space types and other internal data. |