code clear, insert blf_gettext.c to blf.c

This commit is contained in:
Xiao Xiangquan 2011-08-12 13:43:21 +00:00
parent b99f7af357
commit 3a8c7be9e4
9 changed files with 20 additions and 53 deletions

@ -512,12 +512,12 @@ if env['OURPLATFORM']!='darwin':
if 'locale' in dp or 'fonts' in dp:
datafileslist.append(os.path.join(dp,f))
dir= os.path.join(*([env['BF_INSTALLDIR']] + [VERSION] + ['datafiles'] + dp.split(os.sep)[1:])) # skip bin/.blender
dir= os.path.join(*([env['BF_INSTALLDIR']] + [VERSION] + ['datafiles'] + dp.split(os.sep)[1:])) # skip bin
datafilestargetlist.append(dir + os.sep + f)
else:
dotblendlist.append(os.path.join(dp, f))
dir= os.path.join(*([env['BF_INSTALLDIR']] + [VERSION] + ['config'] + dp.split(os.sep)[1:])) # skip bin/.blender
dir= os.path.join(*([env['BF_INSTALLDIR']] + [VERSION] + ['config'] + dp.split(os.sep)[1:])) # skip bin
dottargetlist.append(dir + os.sep + f)
dotblenderinstall = []

@ -160,7 +160,8 @@ class ProjectEdit(bpy.types.Operator):
filepath = os.path.basename(bpy.data.filepath)
filepath = os.path.splitext(filepath)[0]
# filepath = bpy.path.clean_name(filepath) # fixes <memory> rubbish, needs checking
# fixes <memory> rubbish, needs checking
# filepath = bpy.path.clean_name(filepath)
if bpy.data.is_saved:
filepath = "//" + filepath

@ -34,7 +34,6 @@
#ifndef BLF_API_H
#define BLF_API_H
#include <stdlib.h>
struct rctf;
int BLF_init(int points, int dpi);

@ -40,7 +40,6 @@ set(SRC
intern/blf.c
intern/blf_dir.c
intern/blf_font.c
intern/blf_gettext.c
intern/blf_glyph.c
intern/blf_lang.c
intern/blf_util.c

@ -34,6 +34,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <libintl.h>
#include <math.h>
#include <ft2build.h>
@ -299,6 +300,13 @@ void BLF_enable(int fontid, int option)
font->flags |= option;
}
char* BLF_gettext(const char *msgid)
{
if( msgid!=NULL && strlen(msgid)>0 )
return gettext( msgid );
return "";
}
void BLF_disable(int fontid, int option)
{
FontBLF *font;

@ -1,40 +0,0 @@
/*
* $Id: blf_gettext.c 37094 2011-06-02 11:22:22Z xiaoxiangquan $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
*
* Contributor(s): Blender Foundation.
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/blenfont/intern/blf_gettext.c
* \ingroup blf
*/
#include <libintl.h>
#include <string.h>
char* BLF_gettext(const char *msgid)
{
if( msgid!=NULL && strlen(msgid)>0 )
return gettext( msgid );
return "";
}

@ -140,8 +140,11 @@ void BLF_lang_set(const char *str)
char *locreturn;
if(str==NULL)
str = lang_to_locale[U.language];
BLI_setenv("LANG", str);
BLI_setenv("LANGUAGE", str);
if( str[0]!=0 )
{
BLI_setenv("LANG", str);
BLI_setenv("LANGUAGE", str);
}
locreturn= setlocale(LC_ALL, str);
if (locreturn == NULL) {
@ -161,9 +164,6 @@ void BLF_lang_set(const char *str)
bindtextdomain(DOMAIN_NAME, global_messagepath);
/* bind_textdomain_codeset(DOMAIN_NAME, global_encoding_name); */
BLI_strncpy(global_language, str, sizeof(global_language));
// printf( "<<< %s %s %s \n", setlocale(LC_MESSAGES,NULL), getenv("LANG"), getenv("LANGUAGE") );
}
void BLF_lang_encoding(const char *str)

@ -57,7 +57,7 @@ extern int datatoc_bmonofont_ttf_size;
extern char datatoc_bmonofont_ttf[];
extern int datatoc_bunifont_ttf_size;
extern char* get_datatoc_bunifont_ttf();
extern char* get_datatoc_bunifont_ttf(void);
/* Brush icon datafiles */
/* TODO: this could be simplified by putting all

@ -381,7 +381,7 @@ static PyObject *py_blf_gettext(PyObject *UNUSED(self), PyObject *args)
{
char* msgid;
char* msgstr;
char* error_handle;
char* error_handle=NULL;
if (!PyArg_ParseTuple(args, "s:blf.gettext", &msgid))
return NULL;
@ -404,7 +404,7 @@ PyDoc_STRVAR(py_blf_fake_gettext_doc,
static PyObject *py_blf_fake_gettext(PyObject *UNUSED(self), PyObject *args)
{
char* msgid;
char* error_handle;
char* error_handle = NULL;
if (!PyArg_ParseTuple(args, "s:blf.gettext", &msgid))
return NULL;