Moving Language code from interface/text.c to blenfont library.
authorDiego Borghetti <bdiego@gmail.com>
Thu, 29 Jan 2009 05:19:27 +0000 (05:19 +0000)
committerDiego Borghetti <bdiego@gmail.com>
Thu, 29 Jan 2009 05:19:27 +0000 (05:19 +0000)
I go to start commit the new code here and then replace one
by one bmfont and ftfont, this do nothing right now, but it's
more easy keep the files here to work from the studio and my home.

I only update the Makefile and SConscript (but JesterKing a double
check never is bad), so please check the msvc and cmake files.

The new library is libblenfont.a

16 files changed:
source/Makefile
source/blender/Makefile
source/blender/SConscript
source/blender/blenfont/BLF_api.h [new file with mode: 0644]
source/blender/blenfont/Makefile [new file with mode: 0644]
source/blender/blenfont/SConscript [new file with mode: 0644]
source/blender/blenfont/intern/Makefile [new file with mode: 0644]
source/blender/blenfont/intern/blf_internal_types.h [new file with mode: 0644]
source/blender/blenfont/intern/blf_lang.c [new file with mode: 0644]
source/blender/editors/include/UI_text.h
source/blender/editors/interface/Makefile
source/blender/editors/interface/text.c
source/blender/windowmanager/SConscript
source/blender/windowmanager/intern/Makefile
source/blender/windowmanager/intern/wm_files.c
source/blender/windowmanager/intern/wm_init_exit.c

index 46fbffeb610e10759d52f0489407d71c711cda47..fedf438d4cc4d71a7bbd37089a48da6ee6af2440 100644 (file)
@@ -107,6 +107,7 @@ COMLIB += $(NAN_JPEG)/lib/libjpeg.a
 COMLIB += $(OCGDIR)/blender/gpu/$(DEBUG_DIR)libgpu.a
 COMLIB += $(NAN_GLEW)/lib/libglew.a
 COMLIB += $(NAN_ELBEEM)/lib/$(DEBUG_DIR)libelbeem.a
+COMLIB += $(OCGDIR)/blender/blenfont/$(DEBUG_DIR)libblenfont.a
 
 ifneq ($(NAN_NO_KETSJI),true)
     COMLIB += $(OCGDIR)/gameengine/bloutines/$(DEBUG_DIR)libbloutines.a
index 37d647788d0ee3246e635bf2ac49f64ead20812c..3b092b6f3db507ec639c2b1fa4e86ddafee848cb 100644 (file)
@@ -34,6 +34,7 @@ DIRS = windowmanager editors blenloader readblenfile
 DIRS += avi imbuf render radiosity blenlib blenkernel blenpluginapi
 DIRS += makesdna makesrna yafray
 DIRS += python nodes gpu
+DIRS += blenfont
 
 ifeq ($(WITH_FREETYPE2), true)
        DIRS += ftfont
index 93acf8a8430653b52834453b5d4a0642817ec14b..e38d593d9a8ea4c00068f6daa303cc32ad57c696 100644 (file)
@@ -17,7 +17,8 @@ SConscript(['avi/SConscript',
             'readblenfile/SConscript',
             'render/SConscript',
             'nodes/SConscript',
-            'windowmanager/SConscript'])
+            'windowmanager/SConscript',
+           'blenfont/SConscript'])
 
 
 
diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h
new file mode 100644 (file)
index 0000000..0a4ed0d
--- /dev/null
@@ -0,0 +1,52 @@
+/**
+ * $Id:
+ *
+ * ***** 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2009 Blender Foundation.
+ * All rights reserved.
+ *
+ * 
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef BLF_API_H
+#define BLF_API_H
+
+/* Read the .Blanguages file, return 1 on success or 0 if fails. */
+int BLF_lang_init(void);
+
+/* Free the memory allocate for the .Blanguages. */
+void BLF_lang_exit(void);
+
+/* Set the current Language. */
+void BLF_lang_set(int id);
+
+/* Return a string with all the Language available. */
+char *BLF_lang_pup(void);
+
+/* Return the number of invalid lines in the .Blanguages file,
+ * zero means no error found.
+ */
+int BLF_lang_error(void);
+
+/* Return the code string for the specified language code. */
+char *BLF_lang_find_code(short langid);
+
+#endif /* BLF_API_H */
diff --git a/source/blender/blenfont/Makefile b/source/blender/blenfont/Makefile
new file mode 100644 (file)
index 0000000..70dd2e5
--- /dev/null
@@ -0,0 +1,30 @@
+#
+# $Id:
+#
+# ***** 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+# The Original Code is Copyright (C) 2009 Blender Foundation
+# All rights reserved.
+#
+# Contributor(s): none yet.
+#
+# ***** END GPL LICENSE BLOCK *****
+
+SOURCEDIR = source/blender/blenfont
+DIRS = intern
+
+include nan_subdirs.mk
diff --git a/source/blender/blenfont/SConscript b/source/blender/blenfont/SConscript
new file mode 100644 (file)
index 0000000..aa48143
--- /dev/null
@@ -0,0 +1,9 @@
+#!/usr/bin/python
+import sys
+Import ('env')
+
+sources = env.Glob('intern/*.c')
+
+incs = '. intern ../blenkernel ../blenlib ../makesdna ../ftfont'
+
+env.BlenderLib ( 'bf_blenfont', sources, Split(incs), Split(defs), libtype=['core'], priority=[210] )
diff --git a/source/blender/blenfont/intern/Makefile b/source/blender/blenfont/intern/Makefile
new file mode 100644 (file)
index 0000000..94e8046
--- /dev/null
@@ -0,0 +1,42 @@
+#
+# $Id:
+#
+# ***** 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+# The Original Code is Copyright (C) 2008 Blender Foundation.
+# All rights reserved.
+#
+# Contributor(s): none yet.
+#
+# ***** END GPL LICENSE BLOCK *****
+#
+#
+
+LIBNAME = blenfont
+DIR = $(OCGDIR)/blender/blenfont
+
+include nan_compile.mk
+
+CFLAGS += $(LEVEL_1_C_WARNINGS)
+
+CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
+CPPFLAGS += -I../../makesdna
+CPPFLAGS += -I../../blenlib
+CPPFLAGS += -I../../blenkernel
+CPPFLAGS += -I../../ftfont
+
+CPPFLAGS += -I..
diff --git a/source/blender/blenfont/intern/blf_internal_types.h b/source/blender/blenfont/intern/blf_internal_types.h
new file mode 100644 (file)
index 0000000..3a8c1bc
--- /dev/null
@@ -0,0 +1,45 @@
+/**
+ * $Id$
+ *
+ * ***** 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2008 Blender Foundation.
+ * All rights reserved.
+ * 
+ * Contributor(s): Blender Foundation.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef BLF_INTERNAL_TYPES_H
+#define BLF_INTERNAL_TYPES_H
+
+typedef struct LangBLF {
+       struct LangBLF *next;
+       struct LangBLF *prev;
+
+       char *line;
+       char *language;
+       char *code;
+       int id;
+} LangBLF;
+
+#define BLF_LANG_FIND_BY_LINE 0
+#define BLF_LANG_FIND_BY_LANGUAGE 1
+#define BLF_LANG_FIND_BY_CODE 2
+
+#endif /* BLF_INTERNAL_TYPES_H */
diff --git a/source/blender/blenfont/intern/blf_lang.c b/source/blender/blenfont/intern/blf_lang.c
new file mode 100644 (file)
index 0000000..527656f
--- /dev/null
@@ -0,0 +1,242 @@
+/**
+ * $Id$
+ *
+ * ***** 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2008 Blender Foundation.
+ * All rights reserved.
+ * 
+ * Contributor(s): Blender Foundation.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "MEM_guardedalloc.h"
+
+#include "DNA_listBase.h"
+
+#include "BKE_utildefines.h"
+
+#include "BLI_blenlib.h"
+#include "BLI_linklist.h"      /* linknode */
+#include "BLI_string.h"
+
+#include "blf_internal_types.h"
+
+// XXX 2.50 Remove this later.
+#include "FTF_Api.h"
+
+static ListBase global_lang= { NULL, NULL };
+static int global_tot_lang= 0;
+static int global_err_lang= 0;
+
+int BLF_lang_error(void)
+{
+       return(global_err_lang);
+}
+
+char *BLF_lang_pup(void)
+{
+       LangBLF *lme;
+       static char string[1024];
+       static char tmp[1024];
+
+       if(global_tot_lang == 0)
+               sprintf(string, "Choose Language: %%t|Language:  English %%x0");
+       else {
+               lme= global_lang.first;
+               sprintf(string, "Choose Language: %%t");
+               while (lme) {
+                       sprintf(tmp, "|Language:  %s %%x%d", lme->language, lme->id);
+                       strcat(string, tmp);
+                       lme= lme->next;
+               }
+       }
+
+       return(string);
+}
+
+LangBLF *blf_lang_find_by_id(short langid)
+{
+       LangBLF *p;
+
+       p= global_lang.first;
+       while (p) {
+               if (p->id == langid)
+                       return(p);
+               p= p->next;
+       }
+       return(NULL);
+}
+
+char *BLF_lang_find_code(short langid)
+{
+       LangBLF *p;
+
+       p= blf_lang_find_by_id(langid);
+       if (p)
+               return(p->code);
+       return(NULL);
+}
+
+void BLF_lang_set(int id)
+{
+       LangBLF *lme;
+
+       // XXX 2.50 Remove this later, with ftfont
+       lme= blf_lang_find_by_id(id);
+       if(lme) FTF_SetLanguage(lme->code);
+       else FTF_SetLanguage("en_US");
+}
+
+static void blf_lang_split(char *line, LangBLF* lme)
+{
+       char *dpointchar= strchr(line, ':');
+
+       if (dpointchar) {
+               lme->code= BLI_strdup(dpointchar+1);
+               *(dpointchar)=0;
+               lme->language= BLI_strdup(line);
+       } else {
+               lme->code= NULL;
+               lme->language= NULL;
+               /* XXX 2.50 bad call error("Invalid language file");
+                * If we set this to NULL, the function blf_lang_new
+                * drop the line and increment the error lang value
+                * so the init code can call BLF_lang_error to get
+                * the number of invalid lines and show the error.
+                */
+       }
+}
+
+LangBLF *blf_lang_find(char *s, int find_by)
+{
+       LangBLF *p;
+
+       p= global_lang.first;
+       while (p) {
+               if (find_by == BLF_LANG_FIND_BY_LINE) {
+                       if (BLI_streq(s, p->line))
+                               return(p);
+               }
+               else if (find_by == BLF_LANG_FIND_BY_CODE) {
+                       if (BLI_streq(s, p->code))
+                               return(p);
+               }
+               else if (find_by == BLF_LANG_FIND_BY_LANGUAGE) {
+                       if (BLI_streq(s, p->language))
+                               return(p);
+               }
+               p= p->next;
+       }
+       return(NULL);
+}
+
+static void blf_lang_new(char *line)
+{
+       LangBLF *lme;
+
+       lme= blf_lang_find(line, BLF_LANG_FIND_BY_LINE);
+       if (!lme) {
+               lme= MEM_mallocN(sizeof(LangBLF), "blf_lang_new");
+               lme->next= NULL;
+               lme->prev= NULL;
+               lme->line = BLI_strdup(line);
+               blf_lang_split(line, lme);
+               
+               if (lme->code && lme->language) {
+                       lme->id = global_tot_lang;
+                       global_tot_lang++;
+                       BLI_addhead(&global_lang, lme);
+               }
+               else {
+                       global_err_lang++;
+                       MEM_freeN(lme->line);
+                       MEM_freeN(lme);
+               }
+       }
+}
+
+int BLF_lang_init(void) 
+{
+       char name[FILE_MAXDIR+FILE_MAXFILE];
+       LinkNode *l, *lines;
+       
+       /* .Blanguages, http://www.blender3d.org/cms/Installation_Policy.352.0.html*/
+#if defined (__APPLE__) || (WIN32)
+       BLI_make_file_string("/", name, BLI_gethome(), ".Blanguages");
+#else
+       BLI_make_file_string("/", name, BLI_gethome(), ".blender/.Blanguages");
+#endif
+
+       lines= BLI_read_file_as_lines(name);
+
+       if(lines == NULL) {
+               /* If not found in home, try current dir 
+                * (Resources folder of app bundle on OS X) */
+#if defined (__APPLE__)
+               char *bundlePath = BLI_getbundle();
+               strcpy(name, bundlePath);
+               strcat(name, "/Contents/Resources/.Blanguages");
+#else
+               /* Check the CWD. Takes care of the case where users
+                * unpack blender tarball; cd blender-dir; ./blender */
+               strcpy(name, ".blender/.Blanguages");
+#endif
+               lines= BLI_read_file_as_lines(name);
+
+               if(lines == NULL) {
+                       /* If not found in .blender, try current dir */
+                       strcpy(name, ".Blanguages");
+                       lines= BLI_read_file_as_lines(name);
+                       if(lines == NULL) {
+// XXX 2.50                            if(G.f & G_DEBUG)
+                               printf("File .Blanguages not found\n");
+                               return(0);
+                       }
+               }
+       }
+
+       for (l= lines; l; l= l->next) {
+               char *line= l->link;
+                       
+               if (!BLI_streq(line, "")) {
+                       blf_lang_new(line);
+               }
+       }
+
+       BLI_free_file_lines(lines);
+       return(1);
+}
+
+void BLF_lang_exit(void)
+{
+       LangBLF *p;
+
+       while (global_lang.first) {
+               p= global_lang.first;
+               BLI_remlink(&global_lang, p);
+               MEM_freeN(p->line);
+               MEM_freeN(p->language);
+               MEM_freeN(p->code);
+               MEM_freeN(p);
+       }
+}
index 03a51f5ee495c7ac4621f8c4371a27f14dc1ee1b..860fd5e15aaffdab7624f5fbe9c07532a76756e3 100644 (file)
 
 struct BMF_Font;
 
-int  read_languagefile(void);          /* usiblender.c */
-void free_languagemenu(void);          /* usiblender.c */
-
 void set_interface_font(char *str); /* headerbuttons.c */
 void start_interface_font(void);       /* headerbuttons.c */
-void lang_setlanguage(void);           /* usiblender.c */
 
-char *language_pup(void);
 char *fontsize_pup(void);
 
 int UI_DrawString(struct BMF_Font* font, char *str, int translate);
@@ -53,15 +48,6 @@ void UI_RasterPos(float x, float y);
 void UI_SetScale(float aspect);
 void ui_text_init_userdef(void);
 
-struct LANGMenuEntry {
-       struct LANGMenuEntry *next;
-       char *line;
-       char *language;
-       char *code;
-       int id;
-};
-
-struct LANGMenuEntry *find_language(short langid);
 
 #endif /* UI_TEXT_H */
 
index fe223fabf2aab094aa90f163d0e7230cd2c40d2b..fa9550041c57b24e58dec8065baff7630d709b2e 100644 (file)
@@ -49,6 +49,7 @@ CPPFLAGS += -I../../makesdna
 CPPFLAGS += -I../../makesrna
 CPPFLAGS += -I../../imbuf
 CPPFLAGS += -I../../ftfont
+CPPFLAGS += -I../../blenfont
 
 # own include 
 
index edca092f42b706e2eb4ad88c0924feabce277e95..8d4a3e4fb29370e1aa5e6365748589bc8585ea8f 100644 (file)
@@ -43,6 +43,7 @@
 
 #include "BIF_gl.h"
 #include "UI_text.h"
+#include "BLF_api.h"
 
 #include "ED_datafiles.h"
 
@@ -77,11 +78,7 @@ void string_to_utf8(char *original, char *utf_8, char *code)
 
 #ifdef INTERNATIONAL
 #include "FTF_Api.h"
-
-static struct LANGMenuEntry *langmenu= 0;
-static int tot_lang = 0;
-
-#endif // INTERNATIONAL
+#endif
 
 void UI_RasterPos(float x, float y)
 {
@@ -118,14 +115,13 @@ int UI_DrawString(BMF_Font* font, char *str, int translate)
 #ifdef WITH_ICONV
                        if(translate & CONVERT_TO_UTF8) {
                                char utf_8[512];
+                               char *code;
 
-                               struct LANGMenuEntry *lme;
-                               lme = find_language(U.language);
-
-                               if (lme !=NULL) {
-                                       if (!strcmp(lme->code, "ja_JP"))
+                               code= BLF_lang_find_code(U.language);
+                               if (lme) {
+                                       if (!strcmp(code, "ja_JP"))
                                                string_to_utf8(str, utf_8, "Shift_JIS");        /* Japanese */
-                                       else if (!strcmp(lme->code, "zh_CN"))
+                                       else if (!strcmp(code, "zh_CN"))
                                                string_to_utf8(str, utf_8, "GB2312");           /* Chinese */
                                }
        
@@ -204,50 +200,6 @@ char *fontsize_pup(void)
        return (string);
 }
 
-
-char *language_pup(void)
-{
-       struct LANGMenuEntry *lme = langmenu;
-       static char string[1024];
-       static char tmp[1024];
-
-       if(tot_lang == 0)
-               sprintf(string, "Choose Language: %%t|Language:  English %%x0");
-       else {
-               sprintf(string, "Choose Language: %%t");
-               while(lme) {
-                       sprintf(tmp, "|Language:  %s %%x%d", lme->language, lme->id);
-                       strcat(string, tmp);
-                       lme= lme->next;
-               }
-       }
-
-       return string;
-}
-
-struct LANGMenuEntry *find_language(short langid)
-{
-       struct LANGMenuEntry *lme = langmenu;
-
-       while(lme) {
-               if(lme->id == langid)
-                       return lme;
-
-               lme=lme->next;
-       }
-       return NULL;
-}
-
-
-void lang_setlanguage(void) 
-{
-       struct LANGMenuEntry *lme;
-
-       lme = find_language(U.language);
-       if(lme) FTF_SetLanguage(lme->code);
-       else FTF_SetLanguage("en_US");
-}
-
 /* called from fileselector */
 void set_interface_font(char *str) 
 {
@@ -255,7 +207,7 @@ void set_interface_font(char *str)
        /* this test needed because fileselect callback can happen after disable AA fonts */
        if(U.transopts & USER_DOTRANSLATE) {
                if(FTF_SetFont((unsigned char*)str, 0, U.fontsize)) {
-                       lang_setlanguage();
+                       BLF_lang_set(U.language);
                        
                        if(strlen(str) < FILE_MAXDIR) strcpy(U.fontname, str);
                        G.ui_international = TRUE;
@@ -297,8 +249,7 @@ void start_interface_font(void)
        }
 
        if(result) {
-               lang_setlanguage();
-
+               BLF_lang_set(U.language);
                G.ui_international = TRUE;
        } 
        else {
@@ -311,132 +262,5 @@ void start_interface_font(void)
        /* XXX 2.50 bad call allqueue(REDRAWALL, 0); */
 }
 
-static char *first_dpointchar(char *string) 
-{
-       char *dpointchar;
-       
-       dpointchar= strchr(string, ':');        
-
-       return dpointchar;
-}
-
-
-static void splitlangline(char *line, struct LANGMenuEntry *lme)
-{
-       char *dpointchar= first_dpointchar(line);
-
-       if (dpointchar) {
-               lme->code= BLI_strdup(dpointchar+1);
-               *(dpointchar)=0;
-               lme->language= BLI_strdup(line);
-       } else {
-               /* XXX 2.50 bad call error("Invalid language file"); */
-       }
-}
-
-
-static void puplang_insert_entry(char *line)
-{
-       struct LANGMenuEntry *lme, *prev;
-       int sorted = 0;
-
-       prev= NULL;
-       lme= langmenu;
-
-       for (; lme; prev= lme, lme= lme->next) {
-               if (lme->line) {
-                       if (BLI_streq(line, lme->line)) {
-                               return;
-                       } else if (sorted && strcmp(line, lme->line)<0) {
-                               break;
-                       }
-               }
-       }
-       
-       lme= MEM_mallocN(sizeof(*lme), "lme");
-       lme->line = BLI_strdup(line);
-       splitlangline(line, lme);
-       lme->id = tot_lang;
-       tot_lang++;
-
-       if (prev) {
-               lme->next= prev->next;
-               prev->next= lme;
-       } else {
-               lme->next= langmenu;
-               langmenu= lme;
-       }
-}
-
-
-int read_languagefile(void) 
-{
-       char name[FILE_MAXDIR+FILE_MAXFILE];
-       LinkNode *l, *lines;
-       
-       /* .Blanguages, http://www.blender3d.org/cms/Installation_Policy.352.0.html*/
-#if defined (__APPLE__) || (WIN32)
-       BLI_make_file_string("/", name, BLI_gethome(), ".Blanguages");
-#else
-       BLI_make_file_string("/", name, BLI_gethome(), ".blender/.Blanguages");
-#endif
-
-       lines= BLI_read_file_as_lines(name);
-
-       if(lines == NULL) {
-               /* If not found in home, try current dir 
-                * (Resources folder of app bundle on OS X) */
-#if defined (__APPLE__)
-               char *bundlePath = BLI_getbundle();
-               strcpy(name, bundlePath);
-               strcat(name, "/Contents/Resources/.Blanguages");
-#else
-               /* Check the CWD. Takes care of the case where users
-                * unpack blender tarball; cd blender-dir; ./blender */
-               strcpy(name, ".blender/.Blanguages");
-#endif
-               lines= BLI_read_file_as_lines(name);
-
-               if(lines == NULL) {
-                       /* If not found in .blender, try current dir */
-                       strcpy(name, ".Blanguages");
-                       lines= BLI_read_file_as_lines(name);
-                       if(lines == NULL) {
-                               if(G.f & G_DEBUG) printf("File .Blanguages not found\n");
-                               return 0;
-                       }
-               }
-       }
-
-       for (l= lines; l; l= l->next) {
-               char *line= l->link;
-                       
-               if (!BLI_streq(line, "")) {
-                       puplang_insert_entry(line);
-               }
-       }
-
-       BLI_free_file_lines(lines);
-
-       return 1;
-}
-
-
-void free_languagemenu(void)
-{
-       struct LANGMenuEntry *lme= langmenu;
-
-       while (lme) {
-               struct LANGMenuEntry *n= lme->next;
-
-               if (lme->line) MEM_freeN(lme->line);
-               if (lme->language) MEM_freeN(lme->language);
-               if (lme->code) MEM_freeN(lme->code);
-               MEM_freeN(lme);
-
-               lme= n;
-       }
-}
-
 #endif /* INTERNATIONAL */
 
index a160d13a64f2be908614a9988b9938a5b1fadb12..862235d7b4b02ef957bbcfb6cd3804af936e3f5c 100644 (file)
@@ -9,7 +9,7 @@ sources = env.Glob('intern/*.c')
 incs = '. ../editors/include ../python ../makesdna ../blenlib ../blenkernel'
 incs += ' ../nodes ../imbuf ../blenloader ../render/extern/include'
 incs += ' ../ftfont ../radiosity/extern/include ../../kernel/gen_system'
-incs += ' ../makesrna ../gpu'
+incs += ' ../makesrna ../gpu ../blenfont'
 
 incs += ' #/intern/guardedalloc #/intern/memutil #/intern/ghost #/intern/bmfont'
 incs += ' #/intern/elbeem #/extern/glew/include'
index b5b04b11be74829f92dfca5688e6945f6c7e19ca..0bf161e3250b8826820c8f0ba399afab716c6020 100644 (file)
@@ -62,6 +62,7 @@ CPPFLAGS += -I../../render/extern/include
 CPPFLAGS += -I../../ftfont
 CPPFLAGS += -I../../radiosity/extern/include
 CPPFLAGS += -I../../../kernel/gen_system
+CPPFLAGS += -I../../blenfont
 
 # path to the guarded memory allocator
 CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
index d013ab4228d2c2eb00f7d4b0d27e437b9c32f916..86e0bc6474cfbe90d624e378444eea4c3418e511 100644 (file)
@@ -81,6 +81,7 @@
 #include "GHOST_C-api.h"
 
 #include "UI_interface.h"
+#include "BLF_api.h"
 
 // XXX #include "BPY_extern.h"
 
@@ -583,9 +584,7 @@ int WM_read_homefile(bContext *C, int from_memory)
        G.fileflags &= ~G_FILE_AUTOPLAY;        /*  disable autoplay in .B.blend... */
 //     mainwindow_set_filename_to_title("");   // empty string re-initializes title to "Blender"
 
-#ifdef INTERNATIONAL
-// XXX read_languagefile();
-#endif
+       BLF_lang_init();
        
 //     refresh_interface_font();
        
index 65acef765b04e7e7563a6b0f45837c60727f3220..654555f65e9552a863f7e59307dd09aea9ff0158 100644 (file)
@@ -89,6 +89,7 @@
 #include "ED_util.h"
 
 #include "UI_interface.h"
+#include "BLF_api.h"
 
 #include "GPU_extensions.h"
 #include "GPU_draw.h"
@@ -223,10 +224,7 @@ void WM_exit(bContext *C)
        
 //     fsmenu_free();
        
-#ifdef INTERNATIONAL
-//     free_languagemenu();
-#endif
-       
+       BLF_lang_exit();
        RE_FreeAllRender();
        
 //     free_txt_data();