diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-09-20 11:39:25 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-09-20 11:39:25 +0400 |
commit | 6d125e159d2c391fd92d20bd29bc5c8c33b7dcc2 (patch) | |
tree | 408d10d9a473158cf49812a0a229cb51e18ba7b7 | |
parent | 0e421f429ab9c6a6d041c7feb52e84826abe6c65 (diff) |
i18n: code clean-up
- Move all translation-related declarations to BLF_translation.h
- Reverted some changes to match trunk svn rev40365
37 files changed, 36 insertions, 105 deletions
diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h index b7131800097..1bb61d02b78 100644 --- a/source/blender/blenfont/BLF_api.h +++ b/source/blender/blenfont/BLF_api.h @@ -34,7 +34,6 @@ #ifndef BLF_API_H #define BLF_API_H -#include <stdlib.h> struct rctf; int BLF_init(int points, int dpi); @@ -42,8 +41,6 @@ void BLF_exit(void); void BLF_cache_clear(void); -const 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); @@ -181,20 +178,6 @@ void BLF_buffer_col(int fontid, float r, float g, float b, float a); */ void BLF_draw_buffer(int fontid, const char *str); -/* - * Search the path directory to the locale files, this try all - * the case for Linux, Win and Mac. - */ -void BLF_lang_init(void); - -/* Set the current locale. */ -void BLF_lang_set(const char *); - -/* Set the current encoding name. */ -void BLF_lang_encoding_name(const char *str); - -void BLF_lang_encoding(const char *str); - /* Add a path to the font dir paths. */ void BLF_dir_add(const char *path); @@ -219,7 +202,4 @@ 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. -#define _(msgid) BLF_gettext(msgid) -#define N_(msgid) msgid - #endif /* BLF_API_H */ diff --git a/source/blender/blenfont/CMakeLists.txt b/source/blender/blenfont/CMakeLists.txt index 82099d4f125..b87a3b88f07 100644 --- a/source/blender/blenfont/CMakeLists.txt +++ b/source/blender/blenfont/CMakeLists.txt @@ -42,9 +42,11 @@ set(SRC intern/blf_font.c intern/blf_glyph.c intern/blf_lang.c + intern/blf_translation.c intern/blf_util.c BLF_api.h + BLF_translation.h intern/blf_internal.h intern/blf_internal_types.h ) @@ -56,9 +58,5 @@ if(WITH_INTERNATIONAL) add_definitions(-DINTERNATIONAL) endif() -if(WIN32 AND NOT UNIX) - add_definitions(-DUSE_GETTEXT_DLL) -endif() - blender_add_lib(bf_blenfont "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/blenfont/SConscript b/source/blender/blenfont/SConscript index 2763bea0da0..45a55793856 100644 --- a/source/blender/blenfont/SConscript +++ b/source/blender/blenfont/SConscript @@ -13,7 +13,6 @@ defs = [] if sys.platform == 'win32' or env['OURPLATFORM'] == 'linuxcross': defs.append('_WIN32') - defs.append('USE_GETTEXT_DLL') if env['WITH_BF_INTERNATIONAL']: defs.append('INTERNATIONAL') diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c index 9a1c87ea3de..cccecd00bf7 100644 --- a/source/blender/blenfont/intern/blf.c +++ b/source/blender/blenfont/intern/blf.c @@ -34,11 +34,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> - -#ifdef INTERNATIONAL -#include <libintl.h> -#endif - #include <math.h> #include <ft2build.h> @@ -304,17 +299,6 @@ void BLF_enable(int fontid, int option) } } -const char* BLF_gettext(const char *msgid) -{ -#ifdef INTERNATIONAL - if( msgid[0] ) - return gettext( msgid ); - return ""; -#else - return msgid; -#endif -} - void BLF_disable(int fontid, int option) { FontBLF *font= BLF_get(fontid); diff --git a/source/blender/blenkernel/BKE_font.h b/source/blender/blenkernel/BKE_font.h index 3f89f5e8448..2195b370a5f 100644 --- a/source/blender/blenkernel/BKE_font.h +++ b/source/blender/blenkernel/BKE_font.h @@ -89,10 +89,6 @@ void wcs2utf8s(char *dst, const wchar_t *src); size_t wcsleninu8(wchar_t *src); size_t utf8towchar(wchar_t *w, const char *c); -#ifdef INTERNATIONAL -unsigned char *BKE_font_get_unifont(int *unifont_size); -#endif - #ifdef __cplusplus } #endif diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index 5de78bd7a6b..09b38195ef3 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -361,10 +361,6 @@ if(WITH_GAMEENGINE) ) endif() -if(WITH_INTERNATIONAL) - add_definitions(-DINTERNATIONAL) -endif() - if(MSVC) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX") endif() diff --git a/source/blender/blenkernel/SConscript b/source/blender/blenkernel/SConscript index 3935f01e46e..56de8afc0da 100644 --- a/source/blender/blenkernel/SConscript +++ b/source/blender/blenkernel/SConscript @@ -97,9 +97,6 @@ if env['WITH_BF_GAMEENGINE']: else: sources.remove('intern' + os.sep + 'navmesh_conversion.cpp') -if env['WITH_BF_INTERNATIONAL']: - defs.append('INTERNATIONAL') - if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): incs += ' ' + env['BF_PTHREADS_INC'] diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index b5770d6a57c..6898615c753 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -255,29 +255,6 @@ static PackedFile *get_builtin_packedfile(void) } } -#ifdef INTERNATIONAL -const char unifont_filename[]="droidsans.ttf.gz"; -static unsigned char *unifont_ttf= NULL; -static int unifont_size= 0; - -unsigned char *BKE_font_get_unifont(int *unifont_size_r) -{ - if(unifont_ttf==NULL) { - char *fontpath = BLI_get_folder(BLENDER_DATAFILES, "fonts"); - char unifont_path[1024]; - - BLI_snprintf(unifont_path, sizeof(unifont_path), "%s/%s", fontpath, unifont_filename); - - unifont_ttf= BLI_ungzip_to_mem(unifont_path, &unifont_size); - } - - *unifont_size_r= unifont_size; - - return unifont_ttf; -} - -#endif - void free_ttfont(void) { struct TmpFont *tf; @@ -288,11 +265,6 @@ void free_ttfont(void) tf->vfont= NULL; } BLI_freelistN(&ttfdata); - -#ifdef INTERNATIONAL - if(unifont_ttf) - MEM_freeN(unifont_ttf); -#endif } struct TmpFont *vfont_find_tmpfont(VFont *vfont) diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c index 5acd63f836d..8a7d837d2a8 100644 --- a/source/blender/editors/armature/poselib.c +++ b/source/blender/editors/armature/poselib.c @@ -43,7 +43,7 @@ #include "BLI_dlrbTree.h" #include "BLI_utildefines.h" -#include "BLF_api.h" +#include "BLF_translation.h" #include "DNA_anim_types.h" #include "DNA_armature_types.h" diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index a49de18002a..a850fa993f0 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -55,6 +55,7 @@ #include "BIF_gl.h" #include "BLF_api.h" +#include "BLF_translation.h" #include "UI_interface.h" diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 3e4f34aff0e..3c02f7d4bd2 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -43,7 +43,7 @@ #include "BLI_string.h" #include "BLI_utildefines.h" -#include "BLF_api.h" +#include "BLF_translation.h" #include "BKE_context.h" #include "BKE_global.h" @@ -2808,7 +2808,7 @@ void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op,in empty= uiDefAutoButsRNA(layout, &ptr, check_prop, label_align) == 0; if(empty && (flag & UI_LAYOUT_OP_SHOW_EMPTY)) { - uiItemL(layout, _("No Properties"), ICON_NONE); + uiItemL(layout, UI_translate_do_iface(N_("No Properties")), ICON_NONE); } } diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index d6ea5c926db..ec7456eebdc 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -53,8 +53,6 @@ #include "BIF_gl.h" #include "BIF_glutil.h" -#include "BLF_api.h" - #include "WM_api.h" #include "WM_types.h" diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index fb63af5823f..4221f7c30ff 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -62,6 +62,7 @@ #include "UI_view2d.h" #include "BLF_api.h" +#include "BLF_translation.h" #include "ED_screen.h" diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c index d242da8e480..5ea20b33b3a 100644 --- a/source/blender/editors/interface/interface_style.c +++ b/source/blender/editors/interface/interface_style.c @@ -44,10 +44,10 @@ #include "BLI_string.h" #include "BKE_global.h" -#include "BKE_font.h" #include "BLF_api.h" +#include "BLF_translation.h" #include "UI_interface.h" @@ -324,7 +324,7 @@ void uiStyleInit(void) if(font->uifont_id==UIFONT_DEFAULT) { #ifdef INTERNATIONAL int unifont_size; - unsigned char *unifont_ttf= BKE_font_get_unifont(&unifont_size); + unsigned char *unifont_ttf= BLF_get_unifont(&unifont_size); if(unifont_ttf) font->blf_id= BLF_load_mem_unique("default", unifont_ttf, unifont_size); diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 7335d13079a..095c90797f1 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -68,6 +68,7 @@ #include "interface_intern.h" #include "BLF_api.h" +#include "BLF_translation.h" void UI_template_fix_linking(void) { diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c index 54aef0729a8..a49060eaca2 100644 --- a/source/blender/editors/interface/interface_utils.c +++ b/source/blender/editors/interface/interface_utils.c @@ -37,7 +37,7 @@ #include "BLI_utildefines.h" -#include "BLF_api.h" +#include "BLF_translation.h" #include "BKE_context.h" diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index d9a5e92a72c..45829646145 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -1018,6 +1018,7 @@ static void ui_text_label_rightclip(uiFontStyle *fstyle, uiBut *but, rcti *rect) static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *but, rcti *rect) { +// int transopts; char *cpoin = NULL; /* for underline drawing */ @@ -1087,6 +1088,10 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b if (fstyle->kerning == 1) BLF_disable(fstyle->uifont_id, BLF_KERNING_DEFAULT); + // ui_rasterpos_safe(x, y, but->aspect); +// if(but->type==IDPOIN) transopts= 0; // no translation, of course! +// else transopts= ui_translate_buttons(); + /* cut string in 2 parts - only for menu entries */ if((but->block->flag & UI_BLOCK_LOOP)) { if(ELEM5(but->type, SLI, NUM, TEX, NUMSLI, NUMABS)==0) { diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index c7e7cc35c8e..8951df9221e 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -43,7 +43,7 @@ #include "BLI_rand.h" #include "BLI_utildefines.h" -#include "BLF_api.h" +#include "BLF_translation.h" #include "BKE_context.h" #include "BKE_global.h" diff --git a/source/blender/editors/space_buttons/buttons_header.c b/source/blender/editors/space_buttons/buttons_header.c index 0f4467975d1..b18b5373240 100644 --- a/source/blender/editors/space_buttons/buttons_header.c +++ b/source/blender/editors/space_buttons/buttons_header.c @@ -37,7 +37,7 @@ #include "BLI_blenlib.h" #include "BLI_utildefines.h" -#include "BLF_api.h" +#include "BLF_translation.h" #include "BKE_context.h" diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 2d00a08662a..b2b734159ff 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -50,6 +50,7 @@ #include "BKE_main.h" #include "BLF_api.h" +#include "BLF_translation.h" #include "IMB_imbuf_types.h" diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c index 0741152f0ab..37dce293d77 100644 --- a/source/blender/editors/space_file/file_panels.c +++ b/source/blender/editors/space_file/file_panels.c @@ -37,7 +37,7 @@ #include "BLI_blenlib.h" #include "BLI_utildefines.h" -#include "BLF_api.h" +#include "BLF_translation.h" #include "DNA_screen_types.h" #include "DNA_space_types.h" diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index 766ff3d118c..28fd1cd3304 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -46,7 +46,7 @@ #include "BLI_rand.h" #include "BLI_utildefines.h" -#include "BLF_api.h" +#include "BLF_translation.h" #include "BKE_context.h" #include "BKE_depsgraph.h" diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c index 404d7d241f1..75e13b24ede 100644 --- a/source/blender/editors/space_info/space_info.c +++ b/source/blender/editors/space_info/space_info.c @@ -41,7 +41,7 @@ #include "BLI_rand.h" #include "BLI_utildefines.h" -#include "BLF_api.h" +#include "BLF_translation.h" #include "BKE_context.h" #include "BKE_global.h" diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c index 55eff4defe3..5e1f2745559 100644 --- a/source/blender/editors/space_nla/nla_buttons.c +++ b/source/blender/editors/space_nla/nla_buttons.c @@ -45,7 +45,7 @@ #include "BLI_editVert.h" #include "BLI_rand.h" -#include "BLF_api.h" +#include "BLF_translation.h" #include "BKE_nla.h" #include "BKE_context.h" diff --git a/source/blender/editors/space_node/node_header.c b/source/blender/editors/space_node/node_header.c index f4713ecaf13..996e05afdef 100644 --- a/source/blender/editors/space_node/node_header.c +++ b/source/blender/editors/space_node/node_header.c @@ -44,7 +44,7 @@ #include "BLI_blenlib.h" #include "BLI_utildefines.h" -#include "BLF_api.h" +#include "BLF_translation.h" #include "BKE_context.h" #include "BKE_global.h" diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index 6dd4103dc6d..22146a22b9b 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -47,7 +47,7 @@ #include "BLI_editVert.h" #include "BLI_utildefines.h" -#include "BLF_api.h" +#include "BLF_translation.h" #include "BKE_context.h" #include "BKE_depsgraph.h" diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c index ad338cef207..ddea89e1cdb 100644 --- a/source/blender/editors/space_view3d/view3d_toolbar.c +++ b/source/blender/editors/space_view3d/view3d_toolbar.c @@ -48,7 +48,7 @@ #include "BLI_utildefines.h" #include "BLI_ghash.h" -#include "BLF_api.h" +#include "BLF_translation.h" #include "BKE_context.h" #include "BKE_idprop.h" diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 3daede5f785..3ee4c30192e 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -50,7 +50,7 @@ #include "BLI_editVert.h" #include "BLI_utildefines.h" -#include "BLF_api.h" +#include "BLF_translation.h" //#include "BIF_editmesh.h" //#include "BIF_interface.h" diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 691e3aa6e20..26bae68d5a4 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -587,9 +587,6 @@ extern StructRNA RNA_WorldTextureSlot; extern StructRNA RNA_XnorController; extern StructRNA RNA_XorController; -/* make every name and description field surrounded by gettext */ -EnumPropertyItem* RNA_enum_items_gettexted(EnumPropertyItem *item); - /* Pointer * * These functions will fill in RNA pointers, this can be done in three ways: diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index e3dc2779e9d..b7709416a75 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -44,6 +44,7 @@ #include "BLI_ghash.h" #include "BLF_api.h" +#include "BLF_translation.h" #include "BKE_animsys.h" #include "BKE_context.h" diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index de1445a2b29..b9a53acd6f4 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -44,7 +44,7 @@ #include "WM_types.h" #include "BLI_utildefines.h" -#include "BLF_api.h" +#include "BLF_translation.h" #include "BKE_sound.h" diff --git a/source/blender/python/generic/blf_py_api.c b/source/blender/python/generic/blf_py_api.c index 4b14ddc303c..2b1cbaf7af5 100644 --- a/source/blender/python/generic/blf_py_api.c +++ b/source/blender/python/generic/blf_py_api.c @@ -31,6 +31,7 @@ #include "blf_py_api.h" #include "../../blenfont/BLF_api.h" +#include "../../blenfont/BLF_translation.h" #include "BLI_utildefines.h" diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 0fef66d48c7..f862af6173a 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -59,7 +59,7 @@ #include "BLI_utildefines.h" #include "BLI_callbacks.h" -#include "BLF_api.h" +#include "BLF_translation.h" #include "DNA_anim_types.h" #include "DNA_ipo_types.h" // XXX old animation system diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index 32f7e404a0a..f114b19debb 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -99,6 +99,7 @@ #include "UI_interface.h" #include "BLF_api.h" +#include "BLF_translation.h" #include "GPU_buffers.h" #include "GPU_extensions.h" @@ -400,6 +401,7 @@ void WM_exit(bContext *C) free_posebuf(); BLF_exit(); + BLF_free_unifont(); ANIM_keyingset_infos_exit(); diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index ff4aeef9339..320dc2ecdda 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -49,7 +49,7 @@ #include "DNA_userdef_types.h" #include "DNA_windowmanager_types.h" -#include "BLF_api.h" +#include "BLF_translation.h" #include "PIL_time.h" diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 073b5824ae1..d9ca275c819 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -48,7 +48,7 @@ #include "BLI_blenlib.h" #include "BLI_utildefines.h" -#include "BLF_api.h" +#include "BLF_translation.h" #include "BKE_blender.h" #include "BKE_context.h" diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index 6312fea7698..0b16e8887ee 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -997,6 +997,7 @@ int main(int argc, char** argv) // Cleanup RNA_exit(); BLF_exit(); + BLF_free_unifont(); IMB_exit(); free_nodesystem(); |