diff options
Diffstat (limited to 'source/blender')
49 files changed, 331 insertions, 139 deletions
diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h index 57f8c83eda6..e305345d6bc 100644 --- a/source/blender/blenfont/BLF_api.h +++ b/source/blender/blenfont/BLF_api.h @@ -41,6 +41,8 @@ void BLF_exit(void); void BLF_cache_clear(void); +char* BLF_gettext(const char *msgid); + int BLF_load(const char *name); int BLF_load_mem(const char *name, unsigned char *mem, int mem_size); @@ -186,6 +188,8 @@ void BLF_lang_init(void); /* Set the current locale. */ void BLF_lang_set(const char *); +/* Get the current locale. */ +char* BLF_lang_get(void); /* Set the current encoding name. */ void BLF_lang_encoding_name(const char *str); @@ -216,4 +220,9 @@ 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; +extern int blf_unifont_render; // dont mess drawing with render threads. +#define _(msgid) BLF_gettext(msgid) + #endif /* BLF_API_H */ diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c index c0e62b1c0c7..b5ad6ab8ae9 100644 --- a/source/blender/blenfont/intern/blf.c +++ b/source/blender/blenfont/intern/blf.c @@ -37,6 +37,7 @@ #include <math.h> #include <ft2build.h> +#include <libintl.h> #include FT_FREETYPE_H #include FT_GLYPH_H @@ -75,6 +76,10 @@ 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; +int blf_unifont_render= -1; + static FontBLF *BLF_get(int fontid) { if (fontid >= 0 && fontid < BLF_MAX_FONT) @@ -120,6 +125,11 @@ void BLF_cache_clear(void) } } +char* BLF_gettext(const char *msgid) +{ + return gettext( msgid ); +} + static int blf_search(const char *name) { FontBLF *font; diff --git a/source/blender/blenfont/intern/blf_lang.c b/source/blender/blenfont/intern/blf_lang.c index e7f9d1746ad..6a3e5b1f2ef 100644 --- a/source/blender/blenfont/intern/blf_lang.c +++ b/source/blender/blenfont/intern/blf_lang.c @@ -89,6 +89,7 @@ void BLF_lang_set(const char *str) #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); if (locreturn == NULL) { @@ -101,14 +102,12 @@ 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)); - } } @@ -118,6 +117,11 @@ void BLF_lang_encoding(const char *str) /* bind_textdomain_codeset(DOMAIN_NAME, encoding_name); */ } +char* BLF_lang_get(void) +{ + return global_language; +} + #else /* ! INTERNATIONAL */ void BLF_lang_init(void) @@ -137,4 +141,9 @@ void BLF_lang_set(const char *str) return; } +char* BLF_lang_get(void) +{ + return ""; +} + #endif /* INTERNATIONAL */ diff --git a/source/blender/blenlib/BLI_fileops.h b/source/blender/blenlib/BLI_fileops.h index 59c01348c07..27b1a67b32c 100644 --- a/source/blender/blenlib/BLI_fileops.h +++ b/source/blender/blenlib/BLI_fileops.h @@ -53,6 +53,7 @@ int BLI_exists(const char *file); int BLI_copy_fileops(const char *file, const char *to); int BLI_rename(const char *from, const char *to); int BLI_gzip(const char *from, const char *to); +int BLI_ungzip_to_mem(const char *from_file, char *to_mem, const int size); int BLI_delete(const char *file, int dir, int recursive); int BLI_move(const char *file, const char *to); int BLI_touch(const char *file); diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h index 81fc8a50db6..3b27e4dafa0 100644 --- a/source/blender/blenlib/BLI_path_util.h +++ b/source/blender/blenlib/BLI_path_util.h @@ -98,6 +98,7 @@ char *BLI_get_folder_version(const int id, const int ver, const int do_check); #endif void BLI_setenv(const char *env, const char *val); +char *BLI_getenv(const char *env); void BLI_setenv_if_new(const char *env, const char* val); void BLI_make_file_string(const char *relabase, char *string, const char *dir, const char *file); diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c index 2e0f4b483b1..b72f31dd128 100644 --- a/source/blender/blenlib/intern/fileops.c +++ b/source/blender/blenlib/intern/fileops.c @@ -102,6 +102,24 @@ int BLI_gzip(const char *from, const char *to) { return rval; } +/* gzip the file in from_file and write it to memery to_mem, at most size bytes. + return the unziped size + */ +int BLI_ungzip_to_mem(const char *from_file, char *to_mem, const int size) +{ + gzFile gzfile; + int readsize; + + gzfile = gzopen( from_file, "rb" ); + readsize = gzread( gzfile, to_mem, size); + + if (readsize < 0) + readsize = EOF; + + return readsize; +} + + /* return 1 when file can be written */ int BLI_is_writable(const char *filename) { diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index af87707fb90..9d99c0aec3c 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -1205,6 +1205,10 @@ void BLI_setenv(const char *env, const char*val) #endif } +char *BLI_getenv(const char *env) +{ + return getenv(env); +} /** Only set an env var if already not there. diff --git a/source/blender/editors/animation/CMakeLists.txt b/source/blender/editors/animation/CMakeLists.txt index a3c1d035d9b..51387b8b3f3 100644 --- a/source/blender/editors/animation/CMakeLists.txt +++ b/source/blender/editors/animation/CMakeLists.txt @@ -21,6 +21,7 @@ set(INC ../include + ../../blenfont ../../blenkernel ../../blenloader ../../blenlib diff --git a/source/blender/editors/animation/SConscript b/source/blender/editors/animation/SConscript index 96b05b8bccc..61cf0890bc7 100644 --- a/source/blender/editors/animation/SConscript +++ b/source/blender/editors/animation/SConscript @@ -3,7 +3,7 @@ Import ('env') sources = env.Glob('*.c') -incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../makesrna ../../imbuf' +incs = '../include ../../blenfont ../../blenlib ../../blenkernel ../../makesdna ../../makesrna ../../imbuf' incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include ../../blenloader' env.BlenderLib ( 'bf_editors_animation', sources, Split(incs), [], libtype=['core'], priority=[125] ) diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index c6e55427034..bd92d334720 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -717,7 +717,7 @@ static void ed_marker_move_apply(wmOperator *op) } /* only for modal */ -static int ed_marker_move_cancel(bContext *C, wmOperator *op) +static void ed_marker_move_cancel(bContext *C, wmOperator *op) { RNA_int_set(op->ptr, "frames", 0); ed_marker_move_apply(op); @@ -725,8 +725,6 @@ static int ed_marker_move_cancel(bContext *C, wmOperator *op) WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL); WM_event_add_notifier(C, NC_ANIMATION|ND_MARKERS, NULL); - - return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/armature/CMakeLists.txt b/source/blender/editors/armature/CMakeLists.txt index 2db6e278460..0b675ffb4d9 100644 --- a/source/blender/editors/armature/CMakeLists.txt +++ b/source/blender/editors/armature/CMakeLists.txt @@ -21,6 +21,7 @@ set(INC ../include + ../../blenfont ../../blenkernel ../../blenloader ../../blenlib diff --git a/source/blender/editors/armature/SConscript b/source/blender/editors/armature/SConscript index beabd912a20..d790a392407 100644 --- a/source/blender/editors/armature/SConscript +++ b/source/blender/editors/armature/SConscript @@ -3,7 +3,7 @@ Import ('env') sources = env.Glob('*.c') -incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf ../../blenloader' +incs = '../include ../../blenfont ../../blenlib ../../blenkernel ../../makesdna ../../imbuf ../../blenloader' incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include' incs += ' ../../gpu ../../makesrna #/intern/opennl/extern' diff --git a/source/blender/editors/curve/CMakeLists.txt b/source/blender/editors/curve/CMakeLists.txt index dfc7e336e84..bc3d167c17e 100644 --- a/source/blender/editors/curve/CMakeLists.txt +++ b/source/blender/editors/curve/CMakeLists.txt @@ -21,6 +21,7 @@ set(INC ../include + ../../blenfont ../../blenkernel ../../blenloader ../../blenlib diff --git a/source/blender/editors/curve/SConscript b/source/blender/editors/curve/SConscript index efb56ce5466..c23773f7fb0 100644 --- a/source/blender/editors/curve/SConscript +++ b/source/blender/editors/curve/SConscript @@ -3,7 +3,7 @@ Import ('env') sources = env.Glob('*.c') -incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf' +incs = '../include ../../blenfont ../../blenlib ../../blenkernel ../../makesdna ../../imbuf' incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include' incs += ' ../../gpu ../../blenloader' incs += ' ../../makesrna ../../render/extern/include #/intern/elbeem/extern' diff --git a/source/blender/editors/datafiles/CMakeLists.txt b/source/blender/editors/datafiles/CMakeLists.txt index ae86905a91d..feac4301c4a 100644 --- a/source/blender/editors/datafiles/CMakeLists.txt +++ b/source/blender/editors/datafiles/CMakeLists.txt @@ -20,7 +20,8 @@ # ***** END GPL LICENSE BLOCK ***** set(INC - + ../../blenlib + ../../../../intern/guardedalloc ) set(INC_SYS @@ -31,6 +32,7 @@ set(SRC Bfont.c bfont.ttf.c bmonofont.ttf.c + bunifont.ttf.c startup.blend.c preview.blend.c ) diff --git a/source/blender/editors/datafiles/bunifont.ttf.c b/source/blender/editors/datafiles/bunifont.ttf.c new file mode 100755 index 00000000000..d07a2ec7f98 --- /dev/null +++ b/source/blender/editors/datafiles/bunifont.ttf.c @@ -0,0 +1,40 @@ +/** \file blender/editors/datafiles/bunifont.ttf.c + * \ingroup eddatafiles + */ +/* DataToC output of file <bfont_ttf> */ + +#include <zlib.h> +#include <stdio.h> +#include "BLI_path_util.h" +#include "BLI_string.h" +#include "BLI_fileops.h" +#include "BLI_memarena.h" +#include "MEM_guardedalloc.h" + +const int datatoc_bunifont_ttf_size = 16179552; +static char* datatoc_bunifont_ttf = 0; + +static char unifont_path[1024]; +const char unifont_filename[]="unifont.ttf.gz"; + +char *get_datatoc_bunifont_ttf(void) +{ + if( datatoc_bunifont_ttf==NULL ) + { + char *fontpath = BLI_get_folder(BLENDER_DATAFILES, "fonts"); + BLI_snprintf( unifont_path, sizeof(unifont_path), "%s/%s", fontpath, unifont_filename ); + + if( BLI_exists(unifont_path) ) + { + datatoc_bunifont_ttf = (char*)MEM_mallocN( datatoc_bunifont_ttf_size, "get_datatoc_bunifont_ttf" ); + BLI_ungzip_to_mem( unifont_path, datatoc_bunifont_ttf, datatoc_bunifont_ttf_size ); + } + } + return datatoc_bunifont_ttf; +} + +void free_datatoc_bunifont_ttf(void) +{ + if( datatoc_bunifont_ttf!=NULL ) + MEM_freeN( datatoc_bunifont_ttf ); +} diff --git a/source/blender/editors/include/ED_datafiles.h b/source/blender/editors/include/ED_datafiles.h index ee29df3fffb..6831f80092c 100644 --- a/source/blender/editors/include/ED_datafiles.h +++ b/source/blender/editors/include/ED_datafiles.h @@ -56,6 +56,9 @@ extern char datatoc_bfont_ttf[]; extern int datatoc_bmonofont_ttf_size; extern char datatoc_bmonofont_ttf[]; +extern int datatoc_bunifont_ttf_size; +extern char* get_datatoc_bunifont_ttf(); + /* Brush icon datafiles */ /* TODO: this could be simplified by putting all the brush icons in one file */ diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c index 2e4106b3c04..9ebf7c9cd4f 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) +static uiStyle *ui_style_new(ListBase *styles, const char *name, short fontid) { uiStyle *style= MEM_callocN(sizeof(uiStyle), "new style"); @@ -85,7 +85,7 @@ static uiStyle *ui_style_new(ListBase *styles, const char *name) style->panelzoom= 1.0; - style->paneltitle.uifont_id= UIFONT_DEFAULT; + style->paneltitle.uifont_id= fontid; 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) style->paneltitle.shadowalpha= 0.15f; style->paneltitle.shadowcolor= 1.0f; - style->grouplabel.uifont_id= UIFONT_DEFAULT; + style->grouplabel.uifont_id= fontid; 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) style->grouplabel.shady= -1; style->grouplabel.shadowalpha= 0.25f; - style->widgetlabel.uifont_id= UIFONT_DEFAULT; + style->widgetlabel.uifont_id= fontid; 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) style->widgetlabel.shadowalpha= 0.15f; style->widgetlabel.shadowcolor= 1.0f; - style->widget.uifont_id= UIFONT_DEFAULT; + style->widget.uifont_id= fontid; style->widget.points= 11; style->widget.kerning= 1; style->widget.shadowalpha= 0.25f; @@ -295,6 +295,7 @@ void uiStyleInit(void) { uiFont *font= U.uifonts.first; uiStyle *style= U.uistyles.first; + char *lang_set= BLF_lang_get(); /* recover from uninitialized dpi */ if(U.dpi == 0) @@ -335,11 +336,7 @@ void uiStyleInit(void) BLF_size(font->blf_id, 14, U.dpi); } } - - if(style==NULL) { - ui_style_new(&U.uistyles, "Default Style"); - } - + // XXX, this should be moved into a style, but for now best only load the monospaced font once. if (blf_mono_font == -1) blf_mono_font= BLF_load_mem_unique("monospace", (unsigned char *)datatoc_bmonofont_ttf, datatoc_bmonofont_ttf_size); @@ -351,6 +348,46 @@ 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); + + /* XXX Maybe it's bad to do this */ + if(style==NULL) { + if( strcmp(lang_set,"hr.UTF-8")==0 + || strcmp(lang_set,"ar.UTF-8")==0 + || strcmp(lang_set,"bg.UTF-8")==0 + || strcmp(lang_set,"ca.UTF-8")==0 + || strcmp(lang_set,"cs.UTF-8")==0 + || strcmp(lang_set,"de.UTF-8")==0 + || strcmp(lang_set,"el.UTF-8")==0 + || strcmp(lang_set,"es.UTF-8")==0 + || strcmp(lang_set,"fi.UTF-8")==0 + || strcmp(lang_set,"fr.UTF-8")==0 + || strcmp(lang_set,"it.UTF-8")==0 + || strcmp(lang_set,"ja.UTF-8")==0 + || strcmp(lang_set,"ko.UTF-8")==0 + || strcmp(lang_set,"pl.UTF-8")==0 + || strcmp(lang_set,"ro.UTF-8")==0 + || strcmp(lang_set,"ru.UTF-8")==0 + || strcmp(lang_set,"sr.UTF-8")==0 + || strcmp(lang_set,"sv.UTF-8")==0 + || strcmp(lang_set,"uk.UTF-8")==0 + || strcmp(lang_set,"zh_CN.UTF-8")==0 + ) + { + // load unifont only when need. It takes 15MB memories + // get_datatoc_bunifont_ttf() may return null, BLF_load_mem_unique() will handle it + 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 ); + } + else + ui_style_new(&U.uistyles, "Default Style", UIFONT_DEFAULT ); + } + else + ui_style_new(&U.uistyles, "Default Style", UIFONT_DEFAULT ); + } } void uiStyleFontSet(uiFontStyle *fs) diff --git a/source/blender/editors/mesh/CMakeLists.txt b/source/blender/editors/mesh/CMakeLists.txt index bd8789b9eef..1b08f9cff5c 100644 --- a/source/blender/editors/mesh/CMakeLists.txt +++ b/source/blender/editors/mesh/CMakeLists.txt @@ -21,6 +21,7 @@ set(INC ../include + ../../blenfont ../../blenkernel ../../blenloader ../../blenlib diff --git a/source/blender/editors/mesh/SConscript b/source/blender/editors/mesh/SConscript index 34936c025bc..c1b37ec53cd 100644 --- a/source/blender/editors/mesh/SConscript +++ b/source/blender/editors/mesh/SConscript @@ -3,7 +3,7 @@ Import ('env') sources = env.Glob('*.c') -incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf' +incs = '../include ../../blenfont ../../blenlib ../../blenkernel ../../makesdna ../../imbuf' incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include' incs += ' ../../gpu ../../blenloader' incs += ' ../../makesrna ../../render/extern/include #/intern/elbeem/extern' diff --git a/source/blender/editors/object/CMakeLists.txt b/source/blender/editors/object/CMakeLists.txt index 4d50b78b7a1..dae83ad61b5 100644 --- a/source/blender/editors/object/CMakeLists.txt +++ b/source/blender/editors/object/CMakeLists.txt @@ -21,6 +21,7 @@ set(INC ../include + ../../blenfont ../../blenkernel ../../blenloader ../../blenlib diff --git a/source/blender/editors/object/SConscript b/source/blender/editors/object/SConscript index 660643fbb0f..9460530d5aa 100644 --- a/source/blender/editors/object/SConscript +++ b/source/blender/editors/object/SConscript @@ -3,7 +3,7 @@ Import ('env') sources = env.Glob('*.c') -incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf' +incs = '../include ../../blenfont ../../blenlib ../../blenkernel ../../makesdna ../../imbuf' incs += ' ../../windowmanager #/intern/guardedalloc ../../blenloader' incs += ' ../../makesrna ../../python ../../ikplugin' incs += ' ../../render/extern/include ../../gpu' # for object_bake.c diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index c5236a38970..e5bd247a22c 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -1382,7 +1382,7 @@ static int convert_exec(bContext *C, wmOperator *op) void OBJECT_OT_convert(wmOperatorType *ot) { /* identifiers */ - ot->name= "Convert to"; + ot->name= "Convert"; ot->description = "Convert selected objects to another type"; ot->idname= "OBJECT_OT_convert"; diff --git a/source/blender/editors/physics/CMakeLists.txt b/source/blender/editors/physics/CMakeLists.txt index 1badccffe3b..2aa05427223 100644 --- a/source/blender/editors/physics/CMakeLists.txt +++ b/source/blender/editors/physics/CMakeLists.txt @@ -21,6 +21,7 @@ set(INC ../include + ../../blenfont ../../blenkernel ../../blenloader ../../blenlib diff --git a/source/blender/editors/physics/SConscript b/source/blender/editors/physics/SConscript index 274819c918c..e5f5e6d1b09 100644 --- a/source/blender/editors/physics/SConscript +++ b/source/blender/editors/physics/SConscript @@ -3,7 +3,7 @@ Import ('env') sources = env.Glob('*.c') -incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf' +incs = '../include ../../blenfont ../../blenlib ../../blenkernel ../../makesdna ../../imbuf' incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include' incs += ' ../../gpu ../../blenloader' incs += ' ../../makesrna ../../render/extern/include #/intern/elbeem/extern' diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 4d531e78ec0..a1ba861f477 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -43,6 +43,8 @@ #include "BLI_rand.h" #include "BLI_utildefines.h" +#include "BLF_api.h" + #include "BKE_context.h" #include "BKE_global.h" #include "BKE_screen.h" @@ -1227,8 +1229,7 @@ int ED_area_header_switchbutton(const bContext *C, uiBlock *block, int yco) but= uiDefIconTextButC(block, ICONTEXTROW, 0, ICON_VIEW3D, editortype_pup(), xco, yco, UI_UNIT_X+10, UI_UNIT_Y, &(sa->butspacetype), 1.0, SPACEICONMAX, 0, 0, - "Displays current editor type. " - "Click for menu of available types"); + _("Displays current editor type. Click for menu of available types")); uiButSetFunc(but, spacefunc, NULL, NULL); return xco + UI_UNIT_X + 14; diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 68326edfb11..af4bce5ceda 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -40,6 +40,8 @@ #include "BLI_dlrbTree.h" #include "BLI_utildefines.h" +#include "BLF_api.h" + #include "DNA_armature_types.h" #include "DNA_lattice_types.h" #include "DNA_object_types.h" @@ -3141,7 +3143,7 @@ static void SCREEN_OT_userpref_show(struct wmOperatorType *ot) { /* identifiers */ ot->name= "Show/Hide User Preferences"; - ot->description= "Show/hide user preferences"; + ot->description= _("Show/hide user preferences"); ot->idname= "SCREEN_OT_userpref_show"; /* api callbacks */ diff --git a/source/blender/editors/sculpt_paint/CMakeLists.txt b/source/blender/editors/sculpt_paint/CMakeLists.txt index 6ecbc9c5eec..6d82dff4283 100644 --- a/source/blender/editors/sculpt_paint/CMakeLists.txt +++ b/source/blender/editors/sculpt_paint/CMakeLists.txt @@ -21,6 +21,7 @@ set(INC ../include + ../../blenfont ../../blenkernel ../../blenloader ../../imbuf diff --git a/source/blender/editors/sculpt_paint/SConscript b/source/blender/editors/sculpt_paint/SConscript index 90b56ded2cd..f6b206d4555 100644 --- a/source/blender/editors/sculpt_paint/SConscript +++ b/source/blender/editors/sculpt_paint/SConscript @@ -5,7 +5,7 @@ sources = env.Glob('*.c') defs = [] -incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf' +incs = '../include ../../blenfont ../../blenlib ../../blenkernel ../../makesdna ../../imbuf' incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include' incs += ' ../../render/extern/include' incs += ' ../../gpu ../../makesrna ../../blenloader' diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c index 09f5c32bea0..b3d690373f8 100644 --- a/source/blender/editors/sculpt_paint/paint_utils.c +++ b/source/blender/editors/sculpt_paint/paint_utils.c @@ -15,6 +15,8 @@ #include "BLI_math.h" #include "BLI_utildefines.h" +#include "BLF_api.h" + #include "BKE_brush.h" #include "BKE_context.h" #include "BKE_DerivedMesh.h" @@ -322,8 +324,8 @@ static int paint_select_linked_pick_invoke(bContext *C, wmOperator *op, wmEvent void PAINT_OT_face_select_linked_pick(wmOperatorType *ot) { - ot->name= "Select Linked Pick"; - ot->description= "Select linked faces"; + ot->name= _("Select Linked Pick"); + ot->description= _("Select linked faces"); ot->idname= "PAINT_OT_face_select_linked_pick"; ot->invoke= paint_select_linked_pick_invoke; @@ -331,7 +333,7 @@ void PAINT_OT_face_select_linked_pick(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; - RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend the existing selection"); + RNA_def_boolean(ot->srna, "extend", 0, _("Extend"), _("Extend the existing selection")); } @@ -390,8 +392,8 @@ static int face_select_hide_exec(bContext *C, wmOperator *op) void PAINT_OT_face_select_hide(wmOperatorType *ot) { - ot->name= "Face Select Hide"; - ot->description= "Hide selected faces"; + ot->name= _("Face Select Hide"); + ot->description= _("Hide selected faces"); ot->idname= "PAINT_OT_face_select_hide"; ot->exec= face_select_hide_exec; @@ -399,7 +401,7 @@ void PAINT_OT_face_select_hide(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; - RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected rather than selected objects."); + RNA_def_boolean(ot->srna, "unselected", 0, _("Unselected"), _("Hide unselected rather than selected objects.")); } static int face_select_reveal_exec(bContext *C, wmOperator *UNUSED(op)) @@ -412,8 +414,8 @@ static int face_select_reveal_exec(bContext *C, wmOperator *UNUSED(op)) void PAINT_OT_face_select_reveal(wmOperatorType *ot) { - ot->name= "Face Select Reveal"; - ot->description= "Reveal hidden faces"; + ot->name= _("Face Select Reveal"); + ot->description= _("Reveal hidden faces"); ot->idname= "PAINT_OT_face_select_reveal"; ot->exec= face_select_reveal_exec; @@ -421,5 +423,5 @@ void PAINT_OT_face_select_reveal(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; - RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected rather than selected objects."); + RNA_def_boolean(ot->srna, "unselected", 0, _("Unselected"), _("Hide unselected rather than selected objects.")); } diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index a6fee359197..d07b57cd758 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -224,9 +224,9 @@ void file_draw_buttons(const bContext *C, ARegion *ar) uiDefButO(block, BUT, "FILE_OT_execute", WM_OP_EXEC_REGION_WIN, params->title, max_x - loadbutton, line1_y, loadbutton, btn_h, params->title); - uiDefButO(block, BUT, "FILE_OT_cancel", WM_OP_EXEC_REGION_WIN, "Cancel", + uiDefButO(block, BUT, "FILE_OT_cancel", WM_OP_EXEC_REGION_WIN, _("Cancel"), max_x - loadbutton, line2_y, loadbutton, btn_h, - "Cancel"); + _("Cancel")); } uiEndBlock(C, block); diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index a5d516a1417..265e80b42ad 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -44,6 +44,8 @@ #include "BLI_winstuff.h" #endif +#include "BLF_api.h" + #include "ED_screen.h" #include "ED_fileselect.h" @@ -459,7 +461,7 @@ void FILE_OT_bookmark_add(wmOperatorType *ot) { /* identifiers */ ot->name= "Add Bookmark"; - ot->description= "Add a bookmark for the selected/active directory"; + ot->description= _("Add a bookmark for the selected/active directory"); ot->idname= "FILE_OT_bookmark_add"; /* api callbacks */ @@ -1050,8 +1052,8 @@ int file_directory_new_exec(bContext *C, wmOperator *op) void FILE_OT_directory_new(struct wmOperatorType *ot) { /* identifiers */ - ot->name= "Create New Directory"; - ot->description= "Create a new directory"; + ot->name= _("Create New Directory"); + ot->description= _("Create a new directory"); ot->idname= "FILE_OT_directory_new"; /* api callbacks */ @@ -1148,8 +1150,8 @@ int file_filename_exec(bContext *C, wmOperator *UNUSED(unused)) void FILE_OT_directory(struct wmOperatorType *ot) { /* identifiers */ - ot->name= "Enter Directory Name"; - ot->description= "Enter a directory name"; + ot->name= _("Enter Directory Name"); + ot->description= _("Enter a directory name"); ot->idname= "FILE_OT_directory"; /* api callbacks */ @@ -1161,8 +1163,8 @@ void FILE_OT_directory(struct wmOperatorType *ot) void FILE_OT_refresh(struct wmOperatorType *ot) { /* identifiers */ - ot->name= "Refresh Filelist"; - ot->description= "Refresh the file list"; + ot->name= _("Refresh Filelist"); + ot->description= _("Refresh the file list"); ot->idname= "FILE_OT_refresh"; /* api callbacks */ diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c index 959b1ddf1b5..f3c38836058 100644 --- a/source/blender/editors/space_file/file_panels.c +++ b/source/blender/editors/space_file/file_panels.c @@ -37,6 +37,8 @@ #include "BLI_blenlib.h" #include "BLI_utildefines.h" +#include "BLF_api.h" + #include "DNA_screen_types.h" #include "DNA_space_types.h" #include "DNA_userdef_types.h" @@ -144,7 +146,7 @@ static void file_panel_bookmarks(const bContext *C, Panel *pa) if(sfile) { row= uiLayoutRow(pa->layout, 0); - uiItemO(row, "Add", ICON_ZOOMIN, "file.bookmark_add"); + uiItemO(row, _("Add"), ICON_ZOOMIN, "file.bookmark_add"); uiItemL(row, NULL, ICON_NONE); file_panel_category(C, pa, FS_CATEGORY_BOOKMARKS, &sfile->bookmarknr, ICON_BOOKMARKS, 1, 0); @@ -205,25 +207,25 @@ void file_panels_register(ARegionType *art) pt= MEM_callocN(sizeof(PanelType), "spacetype file system directories"); strcpy(pt->idname, "FILE_PT_system"); - strcpy(pt->label, "System"); + strcpy(pt->label, _("System")); pt->draw= file_panel_system; BLI_addtail(&art->paneltypes, pt); pt= MEM_callocN(sizeof(PanelType), "spacetype file bookmarks"); strcpy(pt->idname, "FILE_PT_bookmarks"); - strcpy(pt->label, "Bookmarks"); + strcpy(pt->label, _("Bookmarks")); pt->draw= file_panel_bookmarks; BLI_addtail(&art->paneltypes, pt); pt= MEM_callocN(sizeof(PanelType), "spacetype file recent directories"); strcpy(pt->idname, "FILE_PT_recent"); - strcpy(pt->label, "Recent"); + strcpy(pt->label, _("Recent")); pt->draw= file_panel_recent; BLI_addtail(&art->paneltypes, pt); pt= MEM_callocN(sizeof(PanelType), "spacetype file operator properties"); strcpy(pt->idname, "FILE_PT_operator"); - strcpy(pt->label, "Operator"); + strcpy(pt->label, _("Operator")); pt->poll= file_panel_operator_poll; pt->draw_header= file_panel_operator_header; pt->draw= file_panel_operator; diff --git a/source/blender/editors/space_graph/CMakeLists.txt b/source/blender/editors/space_graph/CMakeLists.txt index f5548097db2..774d3794154 100644 --- a/source/blender/editors/space_graph/CMakeLists.txt +++ b/source/blender/editors/space_graph/CMakeLists.txt @@ -21,6 +21,7 @@ set(INC ../include + ../../blenfont ../../blenkernel ../../blenloader ../../blenlib diff --git a/source/blender/editors/space_graph/SConscript b/source/blender/editors/space_graph/SConscript index 75d0927192b..fe8846d2c30 100644 --- a/source/blender/editors/space_graph/SConscript +++ b/source/blender/editors/space_graph/SConscript @@ -3,7 +3,7 @@ Import ('env') sources = env.Glob('*.c') -incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../makesrna ../../imbuf' +incs = '../include ../../blenfont ../../blenlib ../../blenkernel ../../makesdna ../../makesrna ../../imbuf' incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include' incs += ' #/intern/audaspace/intern ../../blenloader' diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c index d58fb7b11f0..0fb17498443 100644 --- a/source/blender/editors/space_info/info_ops.c +++ b/source/blender/editors/space_info/info_ops.c @@ -45,6 +45,8 @@ #include "BLI_bpath.h" #include "BLI_utildefines.h" +#include "BLF_api.h" + #include "BKE_context.h" #include "BKE_global.h" #include "BKE_image.h" @@ -211,7 +213,7 @@ static int make_paths_relative_exec(bContext *C, wmOperator *op) void FILE_OT_make_paths_relative(wmOperatorType *ot) { /* identifiers */ - ot->name= "Make All Paths Relative"; + ot->name= _("Make All Paths Relative"); ot->idname= "FILE_OT_make_paths_relative"; /* api callbacks */ @@ -243,7 +245,7 @@ static int make_paths_absolute_exec(bContext *C, wmOperator *op) void FILE_OT_make_paths_absolute(wmOperatorType *ot) { /* identifiers */ - ot->name= "Make All Paths Absolute"; + ot->name= _("Make All Paths Absolute"); ot->idname= "FILE_OT_make_paths_absolute"; /* api callbacks */ @@ -266,7 +268,7 @@ static int report_missing_files_exec(bContext *UNUSED(C), wmOperator *op) void FILE_OT_report_missing_files(wmOperatorType *ot) { /* identifiers */ - ot->name= "Report Missing Files"; + ot->name= _("Report Missing Files"); ot->idname= "FILE_OT_report_missing_files"; /* api callbacks */ @@ -299,7 +301,7 @@ static int find_missing_files_invoke(bContext *C, wmOperator *op, wmEvent *UNUSE void FILE_OT_find_missing_files(wmOperatorType *ot) { /* identifiers */ - ot->name= "Find Missing Files"; + ot->name= _("Find Missing Files"); ot->idname= "FILE_OT_find_missing_files"; /* api callbacks */ diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c index bd2e8077eab..beb9f7dc589 100644 --- a/source/blender/editors/space_info/space_info.c +++ b/source/blender/editors/space_info/space_info.c @@ -41,6 +41,8 @@ #include "BLI_rand.h" #include "BLI_utildefines.h" +#include "BLF_api.h" + #include "BKE_context.h" #include "BKE_global.h" #include "BKE_screen.h" @@ -278,7 +280,7 @@ static void recent_files_menu_draw(const bContext *UNUSED(C), Menu *menu) uiItemStringO(layout, BLI_path_basename(recent->filepath), ICON_FILE_BLEND, "WM_OT_open_mainfile", "filepath", recent->filepath); } } else { - uiItemL(layout, "No Recent Files", ICON_NONE); + uiItemL(layout, _("No Recent Files"), ICON_NONE); } } @@ -288,7 +290,7 @@ static void recent_files_menu_register(void) mt= MEM_callocN(sizeof(MenuType), "spacetype info menu recent files"); strcpy(mt->idname, "INFO_MT_file_open_recent"); - strcpy(mt->label, "Open Recent..."); + strcpy(mt->label, _("Open Recent...")); mt->draw= recent_files_menu_draw; WM_menutype_add(mt); } diff --git a/source/blender/editors/space_logic/CMakeLists.txt b/source/blender/editors/space_logic/CMakeLists.txt index cd24cb5e5d0..39b44f88203 100644 --- a/source/blender/editors/space_logic/CMakeLists.txt +++ b/source/blender/editors/space_logic/CMakeLists.txt @@ -21,6 +21,7 @@ set(INC ../include + ../../blenfont ../../blenkernel ../../blenloader ../../blenlib diff --git a/source/blender/editors/space_logic/SConscript b/source/blender/editors/space_logic/SConscript index 6beb3ecb48f..fb2504ab974 100644 --- a/source/blender/editors/space_logic/SConscript +++ b/source/blender/editors/space_logic/SConscript @@ -3,7 +3,7 @@ Import ('env') sources = env.Glob('*.c') -incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf' +incs = '../include ../../blenfont ../../blenlib ../../blenkernel ../../makesdna ../../imbuf' incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include' incs += ' ../../makesrna ../interface ../../blenloader' diff --git a/source/blender/editors/space_sequencer/CMakeLists.txt b/source/blender/editors/space_sequencer/CMakeLists.txt index d5f36719471..702b8d17efd 100644 --- a/source/blender/editors/space_sequencer/CMakeLists.txt +++ b/source/blender/editors/space_sequencer/CMakeLists.txt @@ -21,6 +21,7 @@ set(INC ../include + ../../blenfont ../../blenkernel ../../blenloader ../../blenlib diff --git a/source/blender/editors/space_sequencer/SConscript b/source/blender/editors/space_sequencer/SConscript index 65bbf900556..53248fa001f 100644 --- a/source/blender/editors/space_sequencer/SConscript +++ b/source/blender/editors/space_sequencer/SConscript @@ -3,7 +3,7 @@ Import ('env') sources = env.Glob('*.c') -incs = '../include ../../blenlib ../../blenkernel ../../blenfont ../../makesdna ../../imbuf' +incs = '../include ../../blenfont ../../blenlib ../../blenkernel ../../blenfont ../../makesdna ../../imbuf' incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include' incs += ' ../../makesrna ../../blenloader' incs += ' #/intern/audaspace/intern' diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 9ff73767b4c..016aacecb4b 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -2289,7 +2289,7 @@ void VIEW3D_OT_zoom_camera_1_to_1(wmOperatorType *ot) } /* ********************* Changing view operator ****************** */ - +/* XXX add _() to strings */ static EnumPropertyItem prop_view_items[] = { {RV3D_VIEW_FRONT, "FRONT", 0, "Front", "View From the Front"}, {RV3D_VIEW_BACK, "BACK", 0, "Back", "View From the Back"}, @@ -2513,6 +2513,7 @@ void VIEW3D_OT_viewnumpad(wmOperatorType *ot) RNA_def_boolean(ot->srna, "align_active", 0, "Align Active", "Align to the active objects axis"); } +/* XXX add _() for strings */ static EnumPropertyItem prop_view_orbit_items[] = { {V3D_VIEW_STEPLEFT, "ORBITLEFT", 0, "Orbit Left", "Orbit the view around to the Left"}, {V3D_VIEW_STEPRIGHT, "ORBITRIGHT", 0, "Orbit Right", "Orbit the view around to the Right"}, @@ -2580,6 +2581,7 @@ void VIEW3D_OT_view_orbit(wmOperatorType *ot) RNA_def_enum(ot->srna, "type", prop_view_orbit_items, 0, "Orbit", "Direction of View Orbit"); } +/* XXX add _() for strings */ static EnumPropertyItem prop_view_pan_items[] = { {V3D_VIEW_PANLEFT, "PANLEFT", 0, "Pan Left", "Pan the view to the Left"}, {V3D_VIEW_PANRIGHT, "PANRIGHT", 0, "Pan Right", "Pan the view to the Right"}, diff --git a/source/blender/editors/transform/CMakeLists.txt b/source/blender/editors/transform/CMakeLists.txt index 8eb8d538396..3d9c238470e 100644 --- a/source/blender/editors/transform/CMakeLists.txt +++ b/source/blender/editors/transform/CMakeLists.txt @@ -21,6 +21,7 @@ set(INC ../include + ../../blenfont ../../blenkernel ../../blenloader ../../blenlib diff --git a/source/blender/editors/uvedit/CMakeLists.txt b/source/blender/editors/uvedit/CMakeLists.txt index 11e1703d84c..d25ee20e5b5 100644 --- a/source/blender/editors/uvedit/CMakeLists.txt +++ b/source/blender/editors/uvedit/CMakeLists.txt @@ -21,6 +21,7 @@ set(INC ../include + ../../blenfont ../../blenkernel ../../blenloader ../../blenlib diff --git a/source/blender/editors/uvedit/SConscript b/source/blender/editors/uvedit/SConscript index 2523de005d0..695aa217b5e 100644 --- a/source/blender/editors/uvedit/SConscript +++ b/source/blender/editors/uvedit/SConscript @@ -3,7 +3,7 @@ Import ('env') sources = env.Glob('*.c') -incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf' +incs = '../include ../../blenfont ../../blenlib ../../blenkernel ../../makesdna ../../imbuf' incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include' incs += ' ../../makesrna #/intern/opennl/extern ../../gpu ../../blenloader' diff --git a/source/blender/python/generic/blf_py_api.c b/source/blender/python/generic/blf_py_api.c index 3cf0b0f1f27..f7b49ad28dc 100644 --- a/source/blender/python/generic/blf_py_api.c +++ b/source/blender/python/generic/blf_py_api.c @@ -367,6 +367,30 @@ static PyObject *py_blf_load(PyObject *UNUSED(self), PyObject *args) return PyLong_FromLong(BLF_load(filename)); } +PyDoc_STRVAR(py_blf_gettext_doc, +".. function:: gettext(msgid)\n" +"\n" +" Get a msg in local language.\n" +"\n" +" :arg msgid: the source string.\n" +" :type msgid: string\n" +" :return: the localized string.\n" +" :rtype: string\n" +); +static PyObject *py_blf_gettext(PyObject *UNUSED(self), PyObject *args) +{ + char* msgid; + char* msgstr; + char* error_handle; + + if (!PyArg_ParseTuple(args, "s:blf.gettext", &msgid)) + return NULL; + + msgstr = BLF_gettext( msgid ); + + return PyUnicode_DecodeUTF8( msgstr, strlen(msgstr), error_handle ); +} + /*----------------------------MODULE INIT-------------------------*/ static PyMethodDef BLF_methods[] = { {"aspect", (PyCFunction) py_blf_aspect, METH_VARARGS, py_blf_aspect_doc}, @@ -382,6 +406,7 @@ static PyMethodDef BLF_methods[] = { {"shadow_offset", (PyCFunction) py_blf_shadow_offset, METH_VARARGS, py_blf_shadow_offset_doc}, {"size", (PyCFunction) py_blf_size, METH_VARARGS, py_blf_size_doc}, {"load", (PyCFunction) py_blf_load, METH_VARARGS, py_blf_load_doc}, + {"gettext", (PyCFunction) py_blf_gettext, METH_VARARGS, py_blf_gettext_doc}, {NULL, NULL, 0, NULL} }; diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index c088d0d2d43..1ac31a1786e 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -58,6 +58,8 @@ #include "BLI_linklist.h" #include "BLI_utildefines.h" +#include "BLF_api.h" + #include "DNA_anim_types.h" #include "DNA_ipo_types.h" // XXX old animation system #include "DNA_object_types.h" diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index 2e4148ca51d..583518a4eac 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -126,6 +126,12 @@ void WM_init(bContext *C, int argc, const char **argv) wm_init_cursor_data(); } GHOST_CreateSystemPaths(); + BLF_init(11, U.dpi); /* Please update source/gamengine/GamePlayer/GPG_ghost.cpp if you change this */ + BLF_lang_init(); + // use default settings + BLF_lang_encoding(""); + BLF_lang_set(""); + wm_operatortype_init(); set_free_windowmanager_cb(wm_close_and_free); /* library.c */ @@ -136,9 +142,7 @@ void WM_init(bContext *C, int argc, const char **argv) ED_file_init(); /* for fsmenu */ ED_init_node_butfuncs(); - - BLF_init(11, U.dpi); /* Please update source/gamengine/GamePlayer/GPG_ghost.cpp if you change this */ - BLF_lang_init(); + /* get the default database, plus a wm */ WM_read_homefile(C, NULL, G.factory_startup); @@ -337,6 +341,7 @@ extern void free_anim_copybuf(void); extern void free_anim_drivers_copybuf(void); extern void free_fmodifiers_copybuf(void); extern void free_posebuf(void); +extern void free_datatoc_bunifont_ttf(void); /* called in creator.c even... tsk, split this! */ void WM_exit(bContext *C) @@ -375,7 +380,7 @@ void WM_exit(bContext *C) BIF_freeTemplates(C); free_ttfont(); /* bke_font.h */ - + free_datatoc_bunifont_ttf(); /* bunifont.ttf.c */ free_openrecent(); BKE_freecubetable(); diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 06d049d2cb5..f8bf4ed57bf 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -77,6 +77,7 @@ #include "BIF_gl.h" #include "BIF_glutil.h" /* for paint cursor */ +#include "BLF_api.h" #include "IMB_imbuf_types.h" @@ -346,7 +347,7 @@ wmOperatorType *WM_operatortype_append_macro(const char *idname, const char *nam ot->poll= NULL; if(!ot->description) - ot->description= "(undocumented operator)"; + ot->description= _("(undocumented operator)"); RNA_def_struct_ui_text(ot->srna, ot->name, ot->description); // XXX All ops should have a description but for now allow them not to. RNA_def_struct_identifier(ot->srna, ot->idname); @@ -371,7 +372,7 @@ void WM_operatortype_append_macro_ptr(void (*opfunc)(wmOperatorType*, void*), vo ot->poll= NULL; if(!ot->description) - ot->description= "(undocumented operator)"; + ot->description= _("(undocumented operator)"); opfunc(ot, userdata); @@ -766,7 +767,7 @@ int WM_operator_confirm_message(bContext *C, wmOperator *op, const char *message else properties= NULL; - pup= uiPupMenuBegin(C, "OK?", ICON_QUESTION); + pup= uiPupMenuBegin(C, _("OK?"), ICON_QUESTION); layout= uiPupMenuLayout(pup); uiItemFullO(layout, op->type->idname, message, ICON_NONE, properties, WM_OP_EXEC_REGION_WIN, 0); uiPupMenuEnd(C, pup); @@ -799,47 +800,47 @@ void WM_operator_properties_filesel(wmOperatorType *ot, int filter, short type, if(flag & WM_FILESEL_FILEPATH) - RNA_def_string_file_path(ot->srna, "filepath", "", FILE_MAX, "File Path", "Path to file"); + RNA_def_string_file_path(ot->srna, "filepath", "", FILE_MAX, _("File Path"), _("Path to file")); if(flag & WM_FILESEL_DIRECTORY) - RNA_def_string_dir_path(ot->srna, "directory", "", FILE_MAX, "Directory", "Directory of the file"); + RNA_def_string_dir_path(ot->srna, "directory", "", FILE_MAX, _("Directory"), _("Directory of the file")); if(flag & WM_FILESEL_FILENAME) - RNA_def_string_file_name(ot->srna, "filename", "", FILE_MAX, "File Name", "Name of the file"); + RNA_def_string_file_name(ot->srna, "filename", "", FILE_MAX, _("File Name"), _("Name of the file")); if (action == FILE_SAVE) { - prop= RNA_def_boolean(ot->srna, "check_existing", 1, "Check Existing", "Check and warn on overwriting existing files"); + prop= RNA_def_boolean(ot->srna, "check_existing", 1, _("Check Existing"), _("Check and warn on overwriting existing files")); RNA_def_property_flag(prop, PROP_HIDDEN); } - prop= RNA_def_boolean(ot->srna, "filter_blender", (filter & BLENDERFILE), "Filter .blend files", ""); + prop= RNA_def_boolean(ot->srna, "filter_blender", (filter & BLENDERFILE), _("Filter .blend files"), ""); RNA_def_property_flag(prop, PROP_HIDDEN); - prop= RNA_def_boolean(ot->srna, "filter_image", (filter & IMAGEFILE), "Filter image files", ""); + prop= RNA_def_boolean(ot->srna, "filter_image", (filter & IMAGEFILE), _("Filter image files"), ""); RNA_def_property_flag(prop, PROP_HIDDEN); - prop= RNA_def_boolean(ot->srna, "filter_movie", (filter & MOVIEFILE), "Filter movie files", ""); + prop= RNA_def_boolean(ot->srna, "filter_movie", (filter & MOVIEFILE), _("Filter movie files"), ""); RNA_def_property_flag(prop, PROP_HIDDEN); - prop= RNA_def_boolean(ot->srna, "filter_python", (filter & PYSCRIPTFILE), "Filter python files", ""); + prop= RNA_def_boolean(ot->srna, "filter_python", (filter & PYSCRIPTFILE), _("Filter python files"), ""); RNA_def_property_flag(prop, PROP_HIDDEN); - prop= RNA_def_boolean(ot->srna, "filter_font", (filter & FTFONTFILE), "Filter font files", ""); + prop= RNA_def_boolean(ot->srna, "filter_font", (filter & FTFONTFILE), _("Filter font files"), ""); RNA_def_property_flag(prop, PROP_HIDDEN); - prop= RNA_def_boolean(ot->srna, "filter_sound", (filter & SOUNDFILE), "Filter sound files", ""); + prop= RNA_def_boolean(ot->srna, "filter_sound", (filter & SOUNDFILE), _("Filter sound files"), ""); RNA_def_property_flag(prop, PROP_HIDDEN); - prop= RNA_def_boolean(ot->srna, "filter_text", (filter & TEXTFILE), "Filter text files", ""); + prop= RNA_def_boolean(ot->srna, "filter_text", (filter & TEXTFILE), _("Filter text files"), ""); RNA_def_property_flag(prop, PROP_HIDDEN); - prop= RNA_def_boolean(ot->srna, "filter_btx", (filter & BTXFILE), "Filter btx files", ""); + prop= RNA_def_boolean(ot->srna, "filter_btx", (filter & BTXFILE), _("Filter btx files"), ""); RNA_def_property_flag(prop, PROP_HIDDEN); - prop= RNA_def_boolean(ot->srna, "filter_collada", (filter & COLLADAFILE), "Filter COLLADA files", ""); + prop= RNA_def_boolean(ot->srna, "filter_collada", (filter & COLLADAFILE), _("Filter COLLADA files"), ""); RNA_def_property_flag(prop, PROP_HIDDEN); - prop= RNA_def_boolean(ot->srna, "filter_folder", (filter & FOLDERFILE), "Filter folders", ""); + prop= RNA_def_boolean(ot->srna, "filter_folder", (filter & FOLDERFILE), _("Filter folders"), ""); RNA_def_property_flag(prop, PROP_HIDDEN); prop= RNA_def_int(ot->srna, "filemode", type, FILE_LOADLIB, FILE_SPECIAL, - "File Browser Mode", "The setting for the file browser mode to load a .blend file, a library or a special file", + _("File Browser Mode"), _("The setting for the file browser mode to load a .blend file, a library or a special file"), FILE_LOADLIB, FILE_SPECIAL); RNA_def_property_flag(prop, PROP_HIDDEN); if(flag & WM_FILESEL_RELPATH) - RNA_def_boolean(ot->srna, "relative_path", (U.flag & USER_RELPATHS) ? 1:0, "Relative Path", "Select the file relative to the blend file"); + RNA_def_boolean(ot->srna, "relative_path", (U.flag & USER_RELPATHS) ? 1:0, _("Relative Path"), _("Select the file relative to the blend file")); } void WM_operator_properties_select_all(wmOperatorType *ot) { @@ -851,30 +852,30 @@ void WM_operator_properties_select_all(wmOperatorType *ot) { {0, NULL, 0, NULL, NULL} }; - RNA_def_enum(ot->srna, "action", select_all_actions, SEL_TOGGLE, "Action", "Selection action to execute"); + RNA_def_enum(ot->srna, "action", select_all_actions, SEL_TOGGLE, _("Action"), _("Selection action to execute")); } void WM_operator_properties_gesture_border(wmOperatorType *ot, int extend) { - RNA_def_int(ot->srna, "gesture_mode", 0, INT_MIN, INT_MAX, "Gesture Mode", "", INT_MIN, INT_MAX); - RNA_def_int(ot->srna, "xmin", 0, INT_MIN, INT_MAX, "X Min", "", INT_MIN, INT_MAX); - RNA_def_int(ot->srna, "xmax", 0, INT_MIN, INT_MAX, "X Max", "", INT_MIN, INT_MAX); - RNA_def_int(ot->srna, "ymin", 0, INT_MIN, INT_MAX, "Y Min", "", INT_MIN, INT_MAX); - RNA_def_int(ot->srna, "ymax", 0, INT_MIN, INT_MAX, "Y Max", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "gesture_mode", 0, INT_MIN, INT_MAX, _("Gesture Mode"), "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "xmin", 0, INT_MIN, INT_MAX, _("X Min"), "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "xmax", 0, INT_MIN, INT_MAX, _("X Max"), "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "ymin", 0, INT_MIN, INT_MAX, _("Y Min"), "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "ymax", 0, INT_MIN, INT_MAX, _("Y Max"), "", INT_MIN, INT_MAX); if(extend) - RNA_def_boolean(ot->srna, "extend", 1, "Extend", "Extend selection instead of deselecting everything first"); + RNA_def_boolean(ot->srna, "extend", 1, _("Extend"), _("Extend selection instead of deselecting everything first")); } void WM_operator_properties_gesture_straightline(wmOperatorType *ot, int cursor) { - RNA_def_int(ot->srna, "xstart", 0, INT_MIN, INT_MAX, "X Start", "", INT_MIN, INT_MAX); - RNA_def_int(ot->srna, "xend", 0, INT_MIN, INT_MAX, "X End", "", INT_MIN, INT_MAX); - RNA_def_int(ot->srna, "ystart", 0, INT_MIN, INT_MAX, "Y Start", "", INT_MIN, INT_MAX); - RNA_def_int(ot->srna, "yend", 0, INT_MIN, INT_MAX, "Y End", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "xstart", 0, INT_MIN, INT_MAX, _("X Start"), "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "xend", 0, INT_MIN, INT_MAX, _("X End"), "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "ystart", 0, INT_MIN, INT_MAX, _("Y Start"), "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "yend", 0, INT_MIN, INT_MAX, _("Y End"), "", INT_MIN, INT_MAX); if(cursor) - RNA_def_int(ot->srna, "cursor", cursor, 0, INT_MAX, "Cursor", "Mouse cursor style to use during the modal operator", 0, INT_MAX); + RNA_def_int(ot->srna, "cursor", cursor, 0, INT_MAX, _("Cursor"), _("Mouse cursor style to use during the modal operator"), 0, INT_MAX); } @@ -990,7 +991,7 @@ static uiBlock *wm_block_create_dialog(bContext *C, ARegion *ar, void *userData) col= uiLayoutColumn(layout, FALSE); col_block= uiLayoutGetBlock(col); /* Create OK button, the callback of which will execute op */ - btn= uiDefBut(col_block, BUT, 0, "OK", 0, -30, 0, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); + btn= uiDefBut(col_block, BUT, 0, _("OK"), 0, -30, 0, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); uiButSetFunc(btn, dialog_exec_cb, op, col_block); } @@ -1103,13 +1104,13 @@ static void WM_OT_debug_menu(wmOperatorType *ot) { ot->name= "Debug Menu"; ot->idname= "WM_OT_debug_menu"; - ot->description= "Open a popup to set the debug level"; + ot->description= _("Open a popup to set the debug level"); ot->invoke= wm_debug_menu_invoke; ot->exec= wm_debug_menu_exec; ot->poll= WM_operator_winactive; - RNA_def_int(ot->srna, "debug_value", 0, -10000, 10000, "Debug Value", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "debug_value", 0, -10000, 10000, _("Debug Value"), "", INT_MIN, INT_MAX); } @@ -1217,19 +1218,19 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar split = uiLayoutSplit(layout, 0, 0); col = uiLayoutColumn(split, 0); - uiItemL(col, "Links", ICON_NONE); - uiItemStringO(col, "Donations", ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/blenderorg/blender-foundation/donation-payment/"); - uiItemStringO(col, "Release Log", ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/release-logs/blender-257/"); - uiItemStringO(col, "Manual", ICON_URL, "WM_OT_url_open", "url", "http://wiki.blender.org/index.php/Doc:2.5/Manual"); - uiItemStringO(col, "Blender Website", ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/"); - uiItemStringO(col, "User Community", ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/community/user-community/"); // + uiItemL(col, _("Links"), ICON_NONE); + uiItemStringO(col, _("Donations"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/blenderorg/blender-foundation/donation-payment/"); + uiItemStringO(col, _("Release Log"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/release-logs/blender-257/"); + uiItemStringO(col, _("Manual"), ICON_URL, "WM_OT_url_open", "url", "http://wiki.blender.org/index.php/Doc:2.5/Manual"); + uiItemStringO(col, _("Blender Website"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/"); + uiItemStringO(col, _("User Community"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/community/user-community/"); // if(strcmp(STRINGIFY(BLENDER_VERSION_CYCLE), "release")==0) { BLI_snprintf(url, sizeof(url), "http://www.blender.org/documentation/blender_python_api_%d_%d" STRINGIFY(BLENDER_VERSION_CHAR) "_release", BLENDER_VERSION/100, BLENDER_VERSION%100); } else { BLI_snprintf(url, sizeof(url), "http://www.blender.org/documentation/blender_python_api_%d_%d_%d", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION); } - uiItemStringO(col, "Python API Reference", ICON_URL, "WM_OT_url_open", "url", url); + uiItemStringO(col, _("Python API Reference"), ICON_URL, "WM_OT_url_open", "url", url); uiItemL(col, "", ICON_NONE); col = uiLayoutColumn(split, 0); @@ -1239,7 +1240,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar uiItemS(col); } - uiItemL(col, "Recent", ICON_NONE); + uiItemL(col, _("Recent"), ICON_NONE); for(recent = G.recent_files.first, i=0; (i<5) && (recent); recent = recent->next, i++) { uiItemStringO(col, BLI_path_basename(recent->filepath), ICON_FILE_BLEND, "WM_OT_open_mainfile", "filepath", recent->filepath); } @@ -1422,9 +1423,9 @@ static int wm_operator_winactive_normal(bContext *C) static void WM_OT_window_duplicate(wmOperatorType *ot) { - ot->name= "Duplicate Window"; + ot->name= _("Duplicate Window"); ot->idname= "WM_OT_window_duplicate"; - ot->description="Duplicate the current Blender window"; + ot->description=_("Duplicate the current Blender window"); ot->exec= wm_window_duplicate_exec; ot->poll= wm_operator_winactive_normal; @@ -1432,9 +1433,9 @@ static void WM_OT_window_duplicate(wmOperatorType *ot) static void WM_OT_save_homefile(wmOperatorType *ot) { - ot->name= "Save User Settings"; + ot->name= _("Save User Settings"); ot->idname= "WM_OT_save_homefile"; - ot->description="Make the current file the default .blend file"; + ot->description=_("Make the current file the default .blend file"); ot->invoke= WM_operator_confirm; ot->exec= WM_write_homefile; @@ -1443,9 +1444,9 @@ static void WM_OT_save_homefile(wmOperatorType *ot) static void WM_OT_read_homefile(wmOperatorType *ot) { - ot->name= "Reload Start-Up File"; + ot->name= _("Reload Start-Up File"); ot->idname= "WM_OT_read_homefile"; - ot->description="Open the default file (doesn't save the current file)"; + ot->description=_("Open the default file (doesn't save the current file)"); ot->invoke= WM_operator_confirm; ot->exec= WM_read_homefile_exec; @@ -1454,9 +1455,9 @@ static void WM_OT_read_homefile(wmOperatorType *ot) static void WM_OT_read_factory_settings(wmOperatorType *ot) { - ot->name= "Load Factory Settings"; + ot->name= _("Load Factory Settings"); ot->idname= "WM_OT_read_factory_settings"; - ot->description="Load default file and user preferences"; + ot->description=_("Load default file and user preferences"); ot->invoke= WM_operator_confirm; ot->exec= WM_read_homefile_exec; @@ -1539,7 +1540,7 @@ static void WM_OT_open_mainfile(wmOperatorType *ot) { ot->name= "Open Blender File"; ot->idname= "WM_OT_open_mainfile"; - ot->description="Open a Blender file"; + ot->description=_("Open a Blender file"); ot->invoke= wm_open_mainfile_invoke; ot->exec= wm_open_mainfile_exec; @@ -1705,9 +1706,9 @@ static int wm_link_append_exec(bContext *C, wmOperator *op) static void WM_OT_link_append(wmOperatorType *ot) { - ot->name= "Link/Append from Library"; + ot->name= _("Link/Append from Library"); ot->idname= "WM_OT_link_append"; - ot->description= "Link or Append from a Library .blend file"; + ot->description= _("Link or Append from a Library .blend file"); ot->invoke= wm_link_append_invoke; ot->exec= wm_link_append_exec; @@ -1717,10 +1718,10 @@ static void WM_OT_link_append(wmOperatorType *ot) WM_operator_properties_filesel(ot, FOLDERFILE|BLENDERFILE, FILE_LOADLIB, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_DIRECTORY|WM_FILESEL_FILENAME| WM_FILESEL_RELPATH); - RNA_def_boolean(ot->srna, "link", 1, "Link", "Link the objects or datablocks rather than appending"); - RNA_def_boolean(ot->srna, "autoselect", 1, "Select", "Select the linked objects"); - RNA_def_boolean(ot->srna, "active_layer", 1, "Active Layer", "Put the linked objects on the active layer"); - RNA_def_boolean(ot->srna, "instance_groups", 1, "Instance Groups", "Create instances for each group as a DupliGroup"); + RNA_def_boolean(ot->srna, "link", 1, _("Link"), _("Link the objects or datablocks rather than appending")); + RNA_def_boolean(ot->srna, "autoselect", 1, _("Select"), _("Select the linked objects")); + RNA_def_boolean(ot->srna, "active_layer", 1, _("Active Layer"), _("Put the linked objects on the active layer")); + RNA_def_boolean(ot->srna, "instance_groups", 1, _("Instance Groups"), _("Create instances for each group as a DupliGroup")); RNA_def_collection_runtime(ot->srna, "files", &RNA_OperatorFileListElement, "Files", ""); } @@ -1747,9 +1748,9 @@ static int wm_recover_last_session_exec(bContext *C, wmOperator *op) static void WM_OT_recover_last_session(wmOperatorType *ot) { - ot->name= "Recover Last Session"; + ot->name= _("Recover Last Session"); ot->idname= "WM_OT_recover_last_session"; - ot->description="Open the last closed file (\"quit.blend\")"; + ot->description=_("Open the last closed file (\"quit.blend\")"); ot->exec= wm_recover_last_session_exec; ot->poll= WM_operator_winactive; @@ -1792,7 +1793,7 @@ static void WM_OT_recover_auto_save(wmOperatorType *ot) { ot->name= "Recover Auto Save"; ot->idname= "WM_OT_recover_auto_save"; - ot->description="Open an automatically saved file to recover it"; + ot->description=_("Open an automatically saved file to recover it"); ot->exec= wm_recover_auto_save_exec; ot->invoke= wm_recover_auto_save_invoke; @@ -1809,9 +1810,9 @@ static void untitled(char *name) char *c= BLI_last_slash(name); if(c) - strcpy(&c[1], "untitled.blend"); + strcpy(&c[1], _("untitled.blend")); else - strcpy(name, "untitled.blend"); + strcpy(name, _("untitled.blend")); } } @@ -1896,9 +1897,9 @@ static int blend_save_check(bContext *UNUSED(C), wmOperator *op) static void WM_OT_save_as_mainfile(wmOperatorType *ot) { - ot->name= "Save As Blender File"; + ot->name= _("Save As Blender File"); ot->idname= "WM_OT_save_as_mainfile"; - ot->description="Save the current file in the desired location"; + ot->description=_("Save the current file in the desired location"); ot->invoke= wm_save_as_mainfile_invoke; ot->exec= wm_save_as_mainfile_exec; @@ -1906,9 +1907,9 @@ static void WM_OT_save_as_mainfile(wmOperatorType *ot) /* ommit window poll so this can work in background mode */ WM_operator_properties_filesel(ot, FOLDERFILE|BLENDERFILE, FILE_BLENDER, FILE_SAVE, WM_FILESEL_FILEPATH); - RNA_def_boolean(ot->srna, "compress", 0, "Compress", "Write compressed .blend file"); - RNA_def_boolean(ot->srna, "relative_remap", 1, "Remap Relative", "Remap relative paths when saving in a different directory"); - RNA_def_boolean(ot->srna, "copy", 0, "Save Copy", "Save a copy of the actual working state but does not make saved file active."); + RNA_def_boolean(ot->srna, "compress", 0, _("Compress"), _("Write compressed .blend file")); + RNA_def_boolean(ot->srna, "relative_remap", 1, _("Remap Relative"), _("Remap relative paths when saving in a different directory")); + RNA_def_boolean(ot->srna, "copy", 0, _("Save Copy"), _("Save a copy of the actual working state but does not make saved file active.")); } /* *************** save file directly ******** */ @@ -1957,7 +1958,7 @@ static void WM_OT_save_mainfile(wmOperatorType *ot) { ot->name= "Save Blender File"; ot->idname= "WM_OT_save_mainfile"; - ot->description="Save the current Blender file"; + ot->description=_("Save the current Blender file"); ot->invoke= wm_save_mainfile_invoke; ot->exec= wm_save_as_mainfile_exec; @@ -2075,7 +2076,7 @@ static void WM_OT_quit_blender(wmOperatorType *ot) { ot->name= "Quit Blender"; ot->idname= "WM_OT_quit_blender"; - ot->description= "Quit Blender"; + ot->description= _("Quit Blender"); ot->invoke= WM_operator_confirm; ot->exec= wm_exit_blender_op; @@ -2096,7 +2097,7 @@ static void WM_OT_console_toggle(wmOperatorType *ot) { ot->name= "Toggle System Console"; ot->idname= "WM_OT_console_toggle"; - ot->description= "Toggle System Console"; + ot->description= _("Toggle System Console"); ot->exec= wm_console_toggle_op; ot->poll= WM_operator_winactive; @@ -3211,7 +3212,7 @@ static int radial_control_modal(bContext *C, wmOperator *op, wmEvent *event) static void WM_OT_radial_control(wmOperatorType *ot) { - ot->name= "Radial Control"; + ot->name= _("Radial Control"); ot->idname= "WM_OT_radial_control"; ot->invoke= radial_control_invoke; @@ -3360,7 +3361,7 @@ static void WM_OT_redraw_timer(wmOperatorType *ot) ot->poll= WM_operator_winactive; ot->prop= RNA_def_enum(ot->srna, "type", redraw_timer_type_items, 0, "Type", ""); - RNA_def_int(ot->srna, "iterations", 10, 1,INT_MAX, "Iterations", "Number of times to redraw", 1,1000); + RNA_def_int(ot->srna, "iterations", 10, 1,INT_MAX, _("Iterations"), _("Number of times to redraw"), 1,1000); } @@ -3376,7 +3377,7 @@ static void WM_OT_memory_statistics(wmOperatorType *ot) { ot->name= "Memory Statistics"; ot->idname= "WM_OT_memory_statistics"; - ot->description= "Print memory statistics to the console"; + ot->description= _("Print memory statistics to the console"); ot->exec= memory_statistics_exec; } |