Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Haarsma <phaseIV@zonnet.nl>2003-05-03 16:17:11 +0400
committerRob Haarsma <phaseIV@zonnet.nl>2003-05-03 16:17:11 +0400
commitb43473e4257c6ce958c7811b7e44cb085a4f3b07 (patch)
treeb183d7b446b699649e3c09aa65c399910fbbc212
parentda1e6bae44de43df974524ae47ac46e3f1e2fa39 (diff)
Multilingual interface support added.
All modifications are behind compileflag INTERNATIONAL, and affect these two directories; source/blender/src and source/blender/ftfont. Thanks to philipp, a new utf8towchar() function is added to Shizu's work, which fixes the international support for OSX. It also makes the iconv library obsolete. This means all translation files (blender.mo) need to be 'recoded' to UTF-8, and language support in the fileselect window and the text editor is not possible. Iconv might be added in the future to enable these features.
-rw-r--r--source/blender/ftfont/FTF_Api.h158
-rw-r--r--source/blender/ftfont/FTF_Settings.h47
-rw-r--r--source/blender/ftfont/Makefile37
-rw-r--r--source/blender/ftfont/intern/FTF_Api.cpp152
-rw-r--r--source/blender/ftfont/intern/FTF_TTFont.cpp284
-rw-r--r--source/blender/ftfont/intern/FTF_TTFont.h109
-rw-r--r--source/blender/ftfont/intern/Makefile59
-rw-r--r--source/blender/include/BIF_toolbox.h2
-rw-r--r--source/blender/include/blendef.h2
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h3
-rw-r--r--source/blender/src/buttons.c1
-rw-r--r--source/blender/src/editscreen.c2
-rw-r--r--source/blender/src/headerbuttons.c146
-rw-r--r--source/blender/src/interface.c323
-rw-r--r--source/blender/src/mywindow.c2
-rw-r--r--source/blender/src/space.c141
-rw-r--r--source/blender/src/toolbox.c62
-rw-r--r--source/blender/src/usiblender.c39
18 files changed, 1453 insertions, 116 deletions
diff --git a/source/blender/ftfont/FTF_Api.h b/source/blender/ftfont/FTF_Api.h
new file mode 100644
index 00000000000..4fa97f0acba
--- /dev/null
+++ b/source/blender/ftfont/FTF_Api.h
@@ -0,0 +1,158 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef _FTF_API_H
+#define _FTF_API_H
+
+#define FTF_EXPORT
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h>
+#include "FTF_Settings.h"
+
+/**
+ * Set Font Size
+ * @param int size
+ */
+FTF_EXPORT void FTF_SetSize(int size);
+
+/**
+ * Get Font Size
+ * @return Font size
+ */
+FTF_EXPORT int FTF_GetSize(void);
+
+/**
+ * Ascender
+ * @return Ascend size
+ */
+FTF_EXPORT int FTF_Ascender(void);
+
+/**
+ * Descender
+ * @return Descend size
+ */
+FTF_EXPORT int FTF_Descender(void);
+
+/**
+ * String Translation and Code Conversion
+ * @param str source string
+ * @param ustr distnation string
+ * @param flag mode flag
+ */
+FTF_EXPORT void FTF_TransConvString(char* str, char* ustr, unsigned int flag);
+
+/**
+ * Draw a character at the current raster position.
+ * @param c the character to draw
+ * @param mode flag to forward to FTF_TransConvString()
+ * @return Width drawing
+ */
+//FTF_EXPORT float FTF_DrawCharacter(char c, unsigned int flag);
+
+/**
+ * Draws a string at the current raster postion.
+ * @param str The string to draw
+ * @param mode flag to forward to FTF_TransConvString()
+ * @return Width drawing
+ */
+FTF_EXPORT float FTF_DrawString(char* str, unsigned int flag, int select);
+
+/**
+ * Draws a string at the current raster postion with rgb coloring.
+ * @param str The string to draw
+ * @param rgb Floats to manipulate the the glyph pixmap coloring.
+ * @param mode flag to forward to FTF_TransConvString()
+ * @return Width drawing
+ */
+FTF_EXPORT float FTF_DrawStringRGB(char* str, unsigned int flag, float r, float g, float b);
+
+/**
+ * Get a character width
+ * @param mode flag to forward to FTF_TransConvString()
+ */
+FTF_EXPORT float FTF_GetCharacterWidth(char c, unsigned int flag);
+
+
+/**
+ * Get a string width
+ * @param mode flag to forward to FTF_TransConvString()
+ */
+FTF_EXPORT float FTF_GetStringWidth(char* str, unsigned int flag);
+
+/**
+ * Get Bounding Box
+ * @param llx
+ * @param lly
+ * @param llz
+ * @param urx
+ * @param ury
+ * @param urz
+ * @param mode flag to forward to FTF_TransConvString()
+ * not test yet.
+ */
+FTF_EXPORT void FTF_GetBoundingBox(char* str, float*llx, float *lly, float *llz, float *urx, float *ury, float *urz, unsigned int flag);
+
+/**
+ * Following stuff added by phase
+ */
+
+/**
+ * SetFont
+ * @param str
+ * @param size
+ */
+FTF_EXPORT int FTF_SetFont(char* str, int size);
+
+/**
+ * SetLanguage
+ * @param str
+ * not test yet.
+ */
+FTF_EXPORT void FTF_SetLanguage(char* str);
+
+/**
+ * SetLanguage
+ * @param str
+ * not tested yet.
+ */
+FTF_EXPORT void FTF_SetEncoding(char* str);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __FTF_API_H */
+
diff --git a/source/blender/ftfont/FTF_Settings.h b/source/blender/ftfont/FTF_Settings.h
new file mode 100644
index 00000000000..d9263baf5a2
--- /dev/null
+++ b/source/blender/ftfont/FTF_Settings.h
@@ -0,0 +1,47 @@
+/**
+ * $Id$
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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.
+ *
+ * Copyright (C) 2002 Blender Foundation. All Rights Reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+/**
+
+ * $Id$
+ * Copyright (C) 2001 NaN Technologies B.V.
+ * Allows you to determine which fonts to include in the library.
+ */
+
+#ifndef __FTF_SETTINGS_H
+#define __FTF_SETTINGS_H
+
+#define FTF_BIT(num) ((unsigned int)1 << (num))
+#define FTF_NO_TRANSCONV 0
+#define FTF_INPUT_SYSTEM_ENCODING FTF_BIT(1)
+#define FTF_USE_GETTEXT FTF_BIT(2)
+#define FTF_INPUT_UTF8 FTF_BIT(3)
+
+#endif /* __FTF_SETTINGS_H */
diff --git a/source/blender/ftfont/Makefile b/source/blender/ftfont/Makefile
new file mode 100644
index 00000000000..1717fa34853
--- /dev/null
+++ b/source/blender/ftfont/Makefile
@@ -0,0 +1,37 @@
+#
+# $Id$
+#
+# ***** BEGIN GPL/BL DUAL 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. The Blender
+# Foundation also sells licenses for use in proprietary software under
+# the Blender License. See http://www.blender.org/BL/ for information
+# about this.
+#
+# 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) 2001-2002 by NaN Holding BV.
+# All rights reserved.
+#
+# The Original Code is: all of this file.
+#
+# Contributor(s): none yet.
+#
+# ***** END GPL/BL DUAL LICENSE BLOCK *****
+#
+# Bounces make to subdirectories.
+
+SOURCEDIR = source/blender/ftfont
+DIRS = intern
+
+include nan_subdirs.mk
diff --git a/source/blender/ftfont/intern/FTF_Api.cpp b/source/blender/ftfont/intern/FTF_Api.cpp
new file mode 100644
index 00000000000..ac158ae191f
--- /dev/null
+++ b/source/blender/ftfont/intern/FTF_Api.cpp
@@ -0,0 +1,152 @@
+/**
+ * $Id$
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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.
+ *
+ * Copyright (C) 2002 Blender Foundation. All Rights Reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+/**
+
+ * $Id$
+ * Copyright (C) 2001 NaN Technologies B.V.
+ *
+ * Implementation of the API of FTGL library.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "../FTF_Api.h"
+#include "FTF_TTFont.h"
+
+#define FTF_EXPORT
+
+static FTF_TTFont ttfont;
+
+
+FTF_EXPORT void FTF_SetSize(int size)
+{
+ ttfont.SetSize(size);
+}
+
+FTF_EXPORT int FTF_GetSize(void)
+{
+ return ttfont.GetSize();
+}
+
+
+FTF_EXPORT int FTF_Ascender(void)
+{
+ return ttfont.Ascender();
+}
+
+FTF_EXPORT int FTF_Descender(void)
+{
+ return ttfont.Descender();
+}
+
+
+FTF_EXPORT void FTF_TransConvString(char* str, char* ustr, unsigned int flag)
+{
+ ttfont.TransConvString(str, ustr, flag);
+}
+
+/*
+FTF_EXPORT float FTF_DrawCharacter(char c, unsigned int flag)
+{
+ char str[2] = {c, '\0'};
+ return FTF_DrawString(str, flag);
+}
+*/
+
+
+FTF_EXPORT float FTF_DrawString(char* str, unsigned int flag, int select)
+{
+ return ttfont.DrawString(str, flag, select);
+}
+
+
+FTF_EXPORT float FTF_DrawStringRGB(char* str, unsigned int flag, float r, float g, float b)
+{
+ return ttfont.DrawStringRGB(str, flag, r, g, b);
+}
+
+
+/**
+ * not implemente yet.
+ */
+FTF_EXPORT float FTF_GetCharacterWidth(char c, unsigned int flag)
+{
+ char str[2] = {c, '\0'};
+ return FTF_GetStringWidth(str, flag);
+}
+
+
+/**
+ * not implemente yet.
+ */
+FTF_EXPORT float FTF_GetStringWidth(char* str, unsigned int flag)
+{
+ return ttfont.GetStringWidth(str, flag);
+}
+
+
+/**
+ * not implemente yet.
+ * ## This return string box!! ##
+ */
+FTF_EXPORT void FTF_GetBoundingBox(char* str, float *llx, float *lly, float *llz, float *urx, float *ury, float *urz, unsigned int flag)
+{
+ ttfont.GetBoundingBox(str, llx, lly, llz, urx, ury, urz, flag);
+}
+
+/**
+ * added by phase
+ *
+ */
+FTF_EXPORT int FTF_SetFont(char* str, int size)
+{
+ return ttfont.SetFont(str, size);
+}
+
+/**
+ * added by phase
+ *
+ */
+FTF_EXPORT void FTF_SetLanguage(char* str)
+{
+ ttfont.SetLanguage(str);
+}
+
+/**
+ * added by phase
+ *
+ */
+FTF_EXPORT void FTF_SetEncoding(char* str)
+{
+ ttfont.SetEncoding(str);
+}
diff --git a/source/blender/ftfont/intern/FTF_TTFont.cpp b/source/blender/ftfont/intern/FTF_TTFont.cpp
new file mode 100644
index 00000000000..761f301b448
--- /dev/null
+++ b/source/blender/ftfont/intern/FTF_TTFont.cpp
@@ -0,0 +1,284 @@
+/**
+ * $Id$
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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.
+ *
+ * Copyright (C) 2002 Blender Foundation. All Rights Reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+/**
+
+ * $Id$
+ * Copyright (C) 2001 NaN Technologies B.V.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <locale.h>
+#include "libintl.h"
+#include "../FTF_Settings.h"
+
+#include "FTF_TTFont.h"
+
+#define DOMAIN_NAME "blender"
+#define MESSAGE_FILE "message"
+
+#define SYSTEM_ENCODING_DEFAULT "UTF-8"
+#define FONT_SIZE_DEFAULT 12
+//#define FONT_PATH_DEFAULT ".bfont.ttf"
+
+#define FTF_MAX_STR_SIZE 256
+
+
+int utf8towchar(wchar_t *w, char *c)
+{
+ int len=0;
+ if(w==NULL || c==NULL) return(0);
+ //printf("%s\n",c);
+ while(*c)
+ {
+ //Converts Unicode to wchar:
+
+ if(*c & 0x80)
+ {
+ if(*c & 0x40)
+ {
+ if(*c & 0x20)
+ {
+ if(*c & 0x10)
+ {
+ *w=(c[0] & 0x0f)<<18 | (c[1]&0x1f)<<12 | (c[2]&0x3f)<<6 | (c[3]&0x7f);
+ c++;
+ }
+ else
+ *w=(c[0] & 0x1f)<<12 | (c[1]&0x3f)<<6 | (c[2]&0x7f);
+ c++;
+ }
+ else
+ *w=(c[0] &0x3f)<<6 | c[1]&0x7f;
+ c++;
+ }
+ else
+ *w=(c[0] & 0x7f);
+ }
+ else
+ *w=(c[0] & 0x7f);
+
+ c++;
+ w++;
+ len++;
+ }
+ return len;
+}
+
+
+FTF_TTFont::FTF_TTFont(void)
+{
+ font=NULL;
+ font_size=FONT_SIZE_DEFAULT;
+ strcpy(encoding_name, SYSTEM_ENCODING_DEFAULT);
+}
+
+
+FTF_TTFont::~FTF_TTFont(void)
+{
+ if (font) delete font;
+}
+
+
+int FTF_TTFont::SetFont(char* str, int size)
+{
+ int err = 0;
+ bool success = 0;
+
+ delete font;
+
+ font = new FTGLPixmapFont(str);
+ err = font->Error();
+
+ if(err) {
+// printf("Failed to open font %s\n", str);
+ return 0;
+ } else {
+ success = font->FaceSize(size);
+ if(!success) return 0;
+
+ success = font->CharMap(ft_encoding_unicode);
+ if(!success) return 0;
+
+ return 1;
+ }
+}
+
+
+void FTF_TTFont::SetLanguage(char* str)
+{
+#if defined (_WIN32) || defined(__APPLE__)
+ char envstr[12];
+
+ sprintf(envstr, "LANG=%s", str);
+ envstr[strlen(envstr)]='\0';
+#ifdef _WIN32
+ gettext_putenv(envstr);
+#else
+ putenv(envstr);
+ setlocale(LC_ALL, str);
+#endif
+#else
+ char *locreturn;
+
+ locreturn = setlocale(LC_ALL, str);
+ if (locreturn == NULL) {
+ printf("could not change language to %s\n", str);
+ }
+
+ setlocale(LC_NUMERIC, "C");
+#endif
+
+ bindtextdomain(DOMAIN_NAME, MESSAGE_FILE);
+ textdomain(DOMAIN_NAME);
+
+ strcpy(language, str);
+}
+
+
+void FTF_TTFont::SetEncoding(char* str)
+{
+ strcpy(encoding_name, str);
+}
+
+
+void FTF_TTFont::SetSize(int size)
+{
+ font->FaceSize(size);
+ font_size = size;
+}
+
+int FTF_TTFont::GetSize(void)
+{
+ return font_size;
+}
+
+int FTF_TTFont::Ascender(void)
+{
+ return font->Ascender();
+}
+
+int FTF_TTFont::Descender(void)
+{
+ return font->Descender();
+}
+
+
+int FTF_TTFont::TransConvString(char* str, char* ustr, unsigned int flag)
+{
+ return 0;
+}
+
+
+float FTF_TTFont::DrawString(char* str, unsigned int flag, int select)
+{
+ char ustr[FTF_MAX_STR_SIZE*2]={0};
+ wchar_t wstr[255]={'\0'};
+ int len=0;
+
+ if (FTF_USE_GETTEXT & flag)
+ len=utf8towchar(wstr,gettext(str));
+ else
+ len=utf8towchar(wstr,str);
+
+ if(!select) {
+ glPixelTransferf(GL_RED_SCALE, 0.0);
+ glPixelTransferf(GL_GREEN_SCALE, 0.0);
+ glPixelTransferf(GL_BLUE_SCALE, 0.0);
+ }
+
+ font->Render(wstr);
+
+ if(!select) {
+ glPixelTransferf(GL_RED_SCALE, 1.0);
+ glPixelTransferf(GL_GREEN_SCALE, 1.0);
+ glPixelTransferf(GL_BLUE_SCALE, 1.0);
+ }
+
+ return font->Advance(wstr);
+}
+
+
+float FTF_TTFont::DrawStringRGB(char* str, unsigned int flag, float r, float g, float b)
+{
+ char ustr[FTF_MAX_STR_SIZE*2]={0};
+ wchar_t wstr[255]={'\0'};
+ int len=0;
+
+ if (FTF_USE_GETTEXT & flag)
+ len=utf8towchar(wstr,gettext(str));
+ else
+ len=utf8towchar(wstr,str);
+
+ glPixelTransferf(GL_RED_SCALE, r);
+ glPixelTransferf(GL_GREEN_SCALE, g);
+ glPixelTransferf(GL_BLUE_SCALE, b);
+
+ font->Render(wstr);
+
+ glPixelTransferf(GL_RED_SCALE, 1.0);
+ glPixelTransferf(GL_GREEN_SCALE, 1.0);
+ glPixelTransferf(GL_BLUE_SCALE, 1.0);
+
+ return font->Advance(wstr);
+}
+
+
+float FTF_TTFont::GetStringWidth(char* str, unsigned int flag)
+{
+ char ustr[FTF_MAX_STR_SIZE*2]={0};
+ wchar_t wstr[255]={'\0'};
+ int len=0;
+
+ if (FTF_USE_GETTEXT & flag)
+ len=utf8towchar(wstr,gettext(str));
+ else
+ len=utf8towchar(wstr,str);
+
+ return font->Advance(wstr);
+}
+
+
+void FTF_TTFont::GetBoundingBox(char* str, float *llx, float *lly, float *llz, float *urx, float *ury, float *urz, unsigned int flag)
+{
+ char ustr[FTF_MAX_STR_SIZE*2]={0};
+ wchar_t wstr[255]={'\0'};
+ int len=0;
+
+ if (FTF_USE_GETTEXT & flag)
+ len=utf8towchar(wstr,gettext(str));
+ else
+ len=utf8towchar(wstr,str);
+
+ font->BBox(wstr, *llx, *lly, *llz, *urx, *ury, *urz);
+}
+
diff --git a/source/blender/ftfont/intern/FTF_TTFont.h b/source/blender/ftfont/intern/FTF_TTFont.h
new file mode 100644
index 00000000000..c42685c2221
--- /dev/null
+++ b/source/blender/ftfont/intern/FTF_TTFont.h
@@ -0,0 +1,109 @@
+/**
+ * $Id$
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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.
+ *
+ * Copyright (C) 2002 Blender Foundation. All Rights Reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+/**
+
+ * $Id$
+ * Copyright (C) 2001 NaN Technologies B.V.
+ */
+
+#ifndef __FTF_TRUETYPE_FONT_H
+#define __FTF_TRUETYPE_FONT_H
+
+#include "FTGLPixmapFont.h"
+#include <stdio.h>
+//#include <iconv.h>
+
+
+/**
+ * Base class for Using FTGL, iconv and gettext Library.
+ */
+class FTF_TTFont
+{
+public:
+ /**
+ * Default constructor.
+ */
+ FTF_TTFont(void);
+
+ /**
+ * Destructor.
+ */
+ virtual ~FTF_TTFont(void);
+
+
+ void SetSize(int size);
+ int GetSize(void);
+
+ int Ascender(void);
+ int Descender(void);
+
+ int TransConvString(char* str, char* ustr, unsigned int flag);
+
+ /**
+ * Draws a string at the current raster position.
+ * @param str The string to draw.
+ * @param flag Whether use gettext and UTF8 or system encoding.
+ */
+ float DrawString(char* str, unsigned int flag, int select);
+// float DrawString(char* str, unsigned char r, unsigned char g, unsigned char b, unsigned int flag);
+ float DrawStringRGB(char* str, unsigned int flag, float r, float g, float b);
+
+ float GetStringWidth(char* str, unsigned int flag);
+
+ void GetBoundingBox(char* str, float *llx, float *lly, float *llz, float *urx, float *ury, float *urz, unsigned int flag);
+
+ /**
+ * added by phase
+ * functions to communicate with the preference menu
+ */
+ int SetFont(char* str, int size);
+
+ void SetLanguage(char* str);
+
+ void SetEncoding(char* str);
+
+protected:
+ char language[32];
+ char encoding_name[32];
+ char font_name[128];
+ int font_size;
+
+ /** FTGL's */
+ FTFont* font;
+
+ /** from system encoding in .locale to UNICODE */
+// iconv_t cd;
+
+ /** from UTF-8 to UNICODE */
+// iconv_t ucd;
+};
+
+#endif // __FTF_TRUETYPE_FONT_H
diff --git a/source/blender/ftfont/intern/Makefile b/source/blender/ftfont/intern/Makefile
new file mode 100644
index 00000000000..16e0b76c5e7
--- /dev/null
+++ b/source/blender/ftfont/intern/Makefile
@@ -0,0 +1,59 @@
+#
+# $Id$
+#
+# ***** BEGIN GPL/BL DUAL 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. The Blender
+# Foundation also sells licenses for use in proprietary software under
+# the Blender License. See http://www.blender.org/BL/ for information
+# about this.
+#
+# 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) 2001-2002 by NaN Holding BV.
+# All rights reserved.
+#
+# The Original Code is: all of this file.
+#
+# Contributor(s): none yet.
+#
+# ***** END GPL/BL DUAL LICENSE BLOCK *****
+#
+#
+
+LIBNAME = ftfont
+DIR = $(OCGDIR)/blender/ftfont
+
+include nan_compile.mk
+
+ifeq ($(OS),$(findstring $(OS), "beos darwin freebsd linux openbsd solaris windows"))
+ CFLAGS += -funsigned-char
+endif
+
+CFLAGS += $(LEVEL_1_C_WARNINGS)
+
+#CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
+#CPPFLAGS += -I../../makesdna
+CPPFLAGS += -I$(NAN_FTGL)/include
+ifeq ($(OS), windows)
+ CPPFLAGS += -I$(NAN_ICONV)/include
+ CPPFLAGS += -I$(NAN_GETTEXT)/include
+ CPPFLAGS += -I$(NAN_FREETYPE)/include
+ ifeq ($(FREE_WINDOWS), true)
+ CPPFLAGS += -I$(NAN_FREETYPE)/include/freetype2
+ CPPFLAGS += -DUSE_GETTEXT_DLL
+ endif
+else
+ CPPFLAGS += -I$(NAN_FREETYPE)/include/freetype2
+endif
+CPPFLAGS += -I..
diff --git a/source/blender/include/BIF_toolbox.h b/source/blender/include/BIF_toolbox.h
index d5a18f62426..7807aa3f7b0 100644
--- a/source/blender/include/BIF_toolbox.h
+++ b/source/blender/include/BIF_toolbox.h
@@ -32,7 +32,7 @@
/* TBOXX: width in pixels */
#define TBOXXL 80
-#define TBOXXR 170
+#define TBOXXR 200
#define TBOXX (TBOXXL+TBOXXR)
/* TBOXEL: amount of element vertically */
#define TBOXEL 14
diff --git a/source/blender/include/blendef.h b/source/blender/include/blendef.h
index 54bc187afb2..66dd7e1b8bf 100644
--- a/source/blender/include/blendef.h
+++ b/source/blender/include/blendef.h
@@ -188,6 +188,7 @@
#define B_CONSOLETOG 61
#define B_DRAWINFO 62
#define B_REDRCURW3D 63
+#define B_FLIPINFOMENU 64
#define B_SHOWSPLASH 70
@@ -282,6 +283,7 @@
#define B_SETFONTSIZE 313
#define B_SETENCODING 314
#define B_SETTRANSBUTS 315
+#define B_DOLANGUIFONT 316
/* Definitions for the fileselect buttons in user prefs */
#define B_FONTDIRFILESEL 320
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index b74cebbc9fb..7fac5a7dd68 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -86,6 +86,8 @@ extern UserDef U; /* from usiblender.c !!!! */
#define WHEELZOOMDIR 4
#define FILTERFILEEXTS 8
#define DRAWVIEWINFO 16
+#define EVTTOCONSOLE 32 //print ghost events, here for tuhopuu compat. --phase
+#define FLIPINFOMENU 64
/* transopts */
@@ -94,6 +96,7 @@ extern UserDef U; /* from usiblender.c !!!! */
#define TR_MENUS 4
#define TR_FILESELECT 8
#define TR_TEXTEDIT 16
+#define TR_ALL 32
/* dupflag */
diff --git a/source/blender/src/buttons.c b/source/blender/src/buttons.c
index 9bd15aa3493..d37824af943 100644
--- a/source/blender/src/buttons.c
+++ b/source/blender/src/buttons.c
@@ -7131,6 +7131,7 @@ void drawbutspace(ScrArea *sa, void *spacedata)
ob= OBACT;
+// myortho2(v2d->cur.xmin, v2d->cur.xmax, v2d->cur.ymin-0.6, v2d->cur.ymax+0.6);
myortho2(v2d->cur.xmin, v2d->cur.xmax, v2d->cur.ymin, v2d->cur.ymax);
glShadeModel(GL_SMOOTH);
diff --git a/source/blender/src/editscreen.c b/source/blender/src/editscreen.c
index 58680e10f68..7bcd5772400 100644
--- a/source/blender/src/editscreen.c
+++ b/source/blender/src/editscreen.c
@@ -2808,7 +2808,7 @@ void drawscreen(void)
ScrEdge *se;
mywinset(G.curscreen->mainwin);
- myortho2(-0.5, (float)G.curscreen->sizex-0.5, -0.5, (float)G.curscreen->sizey-0.5);
+ myortho2(-0.5, (float)G.curscreen->sizex-0.5, -0.6, (float)G.curscreen->sizey-0.6);
/* two times, because there is no 'win_swap' for this available */
glDrawBuffer(GL_FRONT);
diff --git a/source/blender/src/headerbuttons.c b/source/blender/src/headerbuttons.c
index 8c3d168351a..17174f4f58b 100644
--- a/source/blender/src/headerbuttons.c
+++ b/source/blender/src/headerbuttons.c
@@ -46,6 +46,10 @@
#include "MEM_guardedalloc.h"
#include "BMF_Api.h"
+#ifdef INTERNATIONAL
+#include "FTF_Api.h"
+#include "BIF_language.h"
+#endif
#include "BLI_blenlib.h"
#include "BLI_arithb.h"
@@ -1372,6 +1376,7 @@ void do_global_buttons(unsigned short event)
case B_RESETAUTOSAVE:
reset_autosave();
+ allqueue(REDRAWINFO, 0);
break;
case B_SOUNDTOGGLE:
SYS_WriteCommandLineInt(SYS_GetSystem(), "noaudio", (U.gameflags & USERDEF_DISABLE_SOUND));
@@ -1398,6 +1403,10 @@ void do_global_buttons(unsigned short event)
allqueue(REDRAWVIEW3D, 0);
break;
+ case B_FLIPINFOMENU: /* is button uit space.c *info* */
+ scrarea_queue_headredraw(curarea);
+ break;
+
/* Fileselect windows for user preferences file paths */
case B_FONTDIRFILESEL: /* is button from space.c *info* */
@@ -1499,10 +1508,14 @@ void do_global_buttons(unsigned short event)
allqueue(REDRAWALL, 0);
break;
- case B_SETENCODING: /* is button from space.c *info* */
- lang_setencoding();
+ case B_DOLANGUIFONT: /* is button from space.c *info* */
+ if(U.transopts & TR_ALL)
+ set_ML_interface_font();
+ else
+ G.ui_international = FALSE;
allqueue(REDRAWALL, 0);
break;
+
#endif
case B_FULL:
@@ -2643,8 +2656,6 @@ static uiBlock *info_filemenu(void *arg_unused)
static void do_info_editmenu(void *arg, int event)
{
- int oldqual;
-
switch(event) {
case 0:
@@ -3288,12 +3299,12 @@ static void info_text(int x, int y)
}
if (g_progress_bar) {
- hsize = 4 + (120.0 * g_done);
+ hsize = 4 + (138.0 * g_done);
fac1 = 0.5 * g_done; // do some rainbow colours on progress
fac2 = 1.0;
fac3 = 0.9;
} else {
- hsize = 124;
+ hsize = 142;
/* promise! Never change these lines again! (zr & ton did!) */
fac1= fabs(hashvectf[ 2*G.version+4]);
fac2= 0.5+0.1*hashvectf[ G.version+3];
@@ -3314,41 +3325,102 @@ static void info_text(int x, int y)
glColor3ub(0, 0, 0);
glRasterPos2i(x, y);
- BMF_DrawString(G.fonts, headerstr);
+#ifdef INTERNATIONAL
+ if(G.ui_international == TRUE) //infoheader text
+ if(U.transopts & TR_MENUS)
+ FTF_DrawString(headerstr, FTF_USE_GETTEXT | FTF_INPUT_UTF8, 0);
+ else
+ FTF_DrawString(headerstr, FTF_NO_TRANSCONV | FTF_INPUT_UTF8, 0);
+ else
+ BMF_DrawString(G.font, headerstr);
+#else
+ BMF_DrawString(G.font, headerstr);
+#endif
glRasterPos2i(x+120, y);
- BMF_DrawString(G.fonts, infostr);
+#ifdef INTERNATIONAL
+ if(G.ui_international == TRUE) //versionnumber
+ if(U.transopts & TR_MENUS)
+ FTF_DrawString(infostr, FTF_USE_GETTEXT | FTF_INPUT_UTF8, 0);
+ else
+ FTF_DrawString(infostr, FTF_NO_TRANSCONV | FTF_INPUT_UTF8, 0);
+ else
+ BMF_DrawString(G.font, infostr);
+#else
+ BMF_DrawString(G.font, infostr);
+#endif
+}
+
+static int GetButStringLength(char *str) {
+ int rt;
+
+#ifdef INTERNATIONAL
+ if(G.ui_international == TRUE) //versionnumber
+ if(U.transopts & TR_BUTTONS)
+ rt= FTF_GetStringWidth(str, FTF_USE_GETTEXT | FTF_INPUT_UTF8) + 15;
+ else
+ rt= FTF_GetStringWidth(str, FTF_NO_TRANSCONV | FTF_INPUT_UTF8) + 15;
+ else
+ rt= BMF_GetStringWidth(G.font, str) + 15;
+#else
+ rt= BMF_GetStringWidth(G.font, str) + 15;
+#endif
+
+ return rt;
}
+
void info_buttons(void)
{
uiBlock *block;
short xco= 32;
char naam[20];
+ int xmax;
sprintf(naam, "header %d", curarea->headwin);
block= uiNewBlock(&curarea->uiblocks, naam, UI_EMBOSSM, UI_HELV, curarea->headwin);
uiBlockSetCol(block, BUTGREY);
- uiDefBlockBut(block, info_filemenu, NULL, "File", xco, 3, 40, 15, "");
- xco+= 40;
- uiDefBlockBut(block, info_editmenu, NULL, "Edit", xco, 3, 40, 15, "");
- xco+= 40;
+ if(U.uiflag & FLIPINFOMENU) {
+ uiDefIconButS(block, TOG|BIT|6, B_FLIPINFOMENU, ICON_RIGHTARROW,
+ xco,2,XIC,YIC-2,
+ &(U.uiflag), 0, 0, 0, 0, "View pulldown menus");/* dir */
+ } else {
+ uiDefIconButS(block, TOG|BIT|6, B_FLIPINFOMENU, ICON_DOWNARROW_HLT,
+ xco,2,XIC,YIC-2,
+ &(U.uiflag), 0, 0, 0, 0, "Hide pulldown menus");/* dir */
+ }
+ xco+=XIC;
+ if(U.uiflag & FLIPINFOMENU) {
+ } else {
+ xmax= GetButStringLength("File");
+ uiDefBlockBut(block, info_filemenu, NULL, "File", xco, 3, xmax, 15, "");
+ xco+= xmax;
- uiDefBlockBut(block, info_addmenu, NULL, "Add", xco, 3, 40, 15, "");
- xco+= 40;
+ xmax= GetButStringLength("Edit");
+ uiDefBlockBut(block, info_editmenu, NULL, "Edit", xco, 3, xmax, 15, "");
+ xco+= xmax;
- uiDefBlockBut(block, info_viewmenu, NULL, "View", xco, 3, 40, 15, "");
- xco+= 40;
+ xmax= GetButStringLength("Add");
+ uiDefBlockBut(block, info_addmenu, NULL, "Add", xco, 3, xmax, 15, "");
+ xco+= xmax;
- uiDefBlockBut(block, info_gamemenu, NULL, "Game", xco, 3, 40, 15, "");
- xco+= 40;
+ xmax= GetButStringLength("View");
+ uiDefBlockBut(block, info_viewmenu, NULL, "View", xco, 3, xmax, 15, "");
+ xco+= xmax;
+ xmax= GetButStringLength("Game");
+ uiDefBlockBut(block, info_gamemenu, NULL, "Game", xco, 3, xmax, 15, "");
+ xco+= xmax;
#ifndef EXPERIMENTAL_MENUS
- /* In the Maarten's new menu structure proposal, the tools menu moved to the file menu */
- uiDefBlockBut(block, info_toolsmenu, NULL, "Tools", xco, 3, 40, 15, "");
- xco+= 40;
-#endif /* EXPERIMENTAL_MENUS */
+ // In the Maarten's new menu structure proposal, the tools menu moved to the file menu
+
+ xmax= GetButStringLength("Tools");
+ uiDefBlockBut(block, info_toolsmenu, NULL, "Tools", xco, 3, xmax, 15, "");
+ xco+= xmax;
+#endif // EXPERIMENTAL_MENUS
+
+ }
/* pack icon indicates a packed file */
@@ -3381,10 +3453,11 @@ void info_buttons(void)
uiDefIconBut(block, BUT, B_SHOWSPLASH, ICON_BLENDER, xco+1, 0,XIC,YIC, 0, 0, 0, 0, 0, "");
uiBlockSetEmboss(block, UI_EMBOSSX);
+/*
uiBlockSetEmboss(block, UI_EMBOSSN);
uiDefIconBut(block, LABEL, 0, ICON_PUBLISHER, xco+125, 0,XIC,YIC, 0, 0, 0, 0, 0, "");
uiBlockSetEmboss(block, UI_EMBOSSX);
-
+*/
/* always do as last */
curarea->headbutlen= xco+2*XIC;
@@ -4773,9 +4846,24 @@ void file_buttons(void)
cpack(0x0);
glRasterPos2i(xco+=XIC+10, 5);
+
+#ifdef INTERNATIONAL
+ if(G.ui_international == TRUE) {
+ if(U.transopts & TR_BUTTONS) {
+ FTF_DrawString(sfile->title, FTF_USE_GETTEXT | FTF_INPUT_UTF8, 0);
+ xco+= FTF_GetStringWidth(sfile->title, FTF_USE_GETTEXT | FTF_INPUT_UTF8);
+ } else {
+ FTF_DrawString(sfile->title, FTF_NO_TRANSCONV | FTF_INPUT_UTF8, 0);
+ xco+= FTF_GetStringWidth(sfile->title, FTF_NO_TRANSCONV | FTF_INPUT_UTF8);
+ }
+ } else {
+ BMF_DrawString(uiBlockGetCurFont(block), sfile->title);
+ xco+= BMF_GetStringWidth(G.font, sfile->title);
+ }
+#else
BMF_DrawString(uiBlockGetCurFont(block), sfile->title);
-
xco+= BMF_GetStringWidth(G.font, sfile->title);
+#endif
uiDefIconButS(block, ICONTOG|BIT|0, B_SORTFILELIST, ICON_LONGDISPLAY,xco+=XIC,0,XIC,YIC, &sfile->flag, 0, 0, 0, 0, "Toggle long info");
uiDefIconButS(block, TOG|BIT|3, B_RELOADDIR, ICON_GHOST,xco+=XIC,0,XIC,YIC, &sfile->flag, 0, 0, 0, 0, "Hide dot files");
@@ -4797,7 +4885,17 @@ void file_buttons(void)
cpack(0x0);
glRasterPos2i(xco, 5);
+
+#ifdef INTERNATIONAL
+ if(G.ui_international == TRUE) {
+ FTF_DrawString(naam, FTF_NO_TRANSCONV | FTF_INPUT_UTF8, 0);
+ } else {
+ BMF_DrawString(uiBlockGetCurFont(block), naam);
+ }
+#else
BMF_DrawString(uiBlockGetCurFont(block), naam);
+#endif
+
}
/* always do as last */
curarea->headbutlen= xco+2*XIC;
diff --git a/source/blender/src/interface.c b/source/blender/src/interface.c
index 349cfcebfd4..759dcea6e20 100644
--- a/source/blender/src/interface.c
+++ b/source/blender/src/interface.c
@@ -50,6 +50,9 @@
#include "PIL_time.h"
#include "BMF_Api.h"
+#ifdef INTERNATIONAL
+#include "FTF_Api.h"
+#endif
#include "BLI_blenlib.h"
#include "BLI_arithb.h"
@@ -682,7 +685,17 @@ static void ui_draw_but_BUT(uiBut *but)
glRasterPos2f( x, (but->y1+but->y2- 9.0)/2.0);
+#ifdef INTERNATIONAL
+ if(G.ui_international == TRUE)
+ if(U.transopts & TR_BUTTONS) // BUTTON TEXTS
+ FTF_DrawString(but->drawstr+but->ofs, FTF_USE_GETTEXT | FTF_INPUT_UTF8, but->flag & UI_SELECT);
+ else
+ FTF_DrawString(but->drawstr+but->ofs, FTF_NO_TRANSCONV | FTF_INPUT_UTF8, but->flag & UI_SELECT);
+ else
+ BMF_DrawString(but->font, but->drawstr+but->ofs);
+#else
BMF_DrawString(but->font, but->drawstr+but->ofs);
+#endif
}
}
@@ -707,21 +720,60 @@ static void ui_draw_but_TOG3(uiBut *but)
if( BTST( sp[1], but->bitnr )) ok= 1;
}
+ if(but->flag & UI_TEXT_LEFT) x= but->x1+4.0;
+ else x= (but->x1+but->x2-but->strwidth+1)/2.0;
+
+ glRasterPos2f( x, (but->y1+but->y2- 9.0)/2.0);
+
+// silly structure for colored texts
if (ok) {
glColor3ub(255, 255, 0);
+
+#ifdef INTERNATIONAL
+ if(G.ui_international == TRUE)
+ if(U.transopts & TR_BUTTONS) // BUTTON TEXTS
+ FTF_DrawStringRGB(but->drawstr+but->ofs, FTF_USE_GETTEXT | FTF_INPUT_UTF8, 1.0, 1.0, 0.0);
+ else
+ FTF_DrawStringRGB(but->drawstr+but->ofs, FTF_NO_TRANSCONV | FTF_INPUT_UTF8, 1.0, 1.0, 0.0);
+ else
+ BMF_DrawString(but->font, but->drawstr+but->ofs);
+#else
+ BMF_DrawString(but->font, but->drawstr+but->ofs);
+#endif
} else {
glColor3ub(255, 255, 255);
+
+#ifdef INTERNATIONAL
+ if(G.ui_international == TRUE)
+ if(U.transopts & TR_BUTTONS) // BUTTON TEXTS
+ FTF_DrawString(but->drawstr+but->ofs, FTF_USE_GETTEXT | FTF_INPUT_UTF8, but->flag & UI_SELECT);
+ else
+ FTF_DrawString(but->drawstr+but->ofs, FTF_NO_TRANSCONV | FTF_INPUT_UTF8, but->flag & UI_SELECT);
+ else
+ BMF_DrawString(but->font, but->drawstr+but->ofs);
+#else
+ BMF_DrawString(but->font, but->drawstr+but->ofs);
+#endif
}
} else {
glColor3ub(0, 0, 0);
- }
-
+
if(but->flag & UI_TEXT_LEFT) x= but->x1+4.0;
else x= (but->x1+but->x2-but->strwidth+1)/2.0;
glRasterPos2f( x, (but->y1+but->y2- 9.0)/2.0);
-
+#ifdef INTERNATIONAL
+ if(G.ui_international == TRUE)
+ if(U.transopts & TR_BUTTONS) // BUTTON TEXTS
+ FTF_DrawString(but->drawstr+but->ofs, FTF_USE_GETTEXT | FTF_INPUT_UTF8, but->flag & UI_SELECT);
+ else
+ FTF_DrawString(but->drawstr+but->ofs, FTF_NO_TRANSCONV | FTF_INPUT_UTF8, but->flag & UI_SELECT);
+ else
+ BMF_DrawString(but->font, but->drawstr+but->ofs);
+#else
BMF_DrawString(but->font, but->drawstr+but->ofs);
+#endif
+ }
}
}
@@ -746,7 +798,17 @@ static void ui_draw_but_TEX(uiBut *but)
if(pos >= but->ofs) {
ch= but->drawstr[pos];
but->drawstr[pos]= 0;
+#ifdef INTERNATIONAL
+ if(G.ui_international == TRUE)
+ if(U.transopts & TR_BUTTONS) // BUTTON TEXTS
+ t= but->aspect*FTF_GetStringWidth(but->drawstr+but->ofs, FTF_USE_GETTEXT | FTF_INPUT_UTF8) + 3;
+ else
+ t= but->aspect*FTF_GetStringWidth(but->drawstr+but->ofs, FTF_NO_TRANSCONV | FTF_INPUT_UTF8) + 3;
+ else
+ t= but->aspect*BMF_GetStringWidth(but->font, but->drawstr+but->ofs) + 3;
+#else
t= but->aspect*BMF_GetStringWidth(but->font, but->drawstr+but->ofs) + 3;
+#endif
but->drawstr[pos]= ch;
glColor3ub(255,0,0);
@@ -763,14 +825,24 @@ static void ui_draw_but_TEX(uiBut *but)
glRasterPos2f( x, (but->y1+but->y2- 9.0)/2.0);
+#ifdef INTERNATIONAL
+ if(G.ui_international == TRUE)
+ if(U.transopts & TR_BUTTONS) // BUTTON TEXTS
+ FTF_DrawString(but->drawstr+but->ofs, FTF_USE_GETTEXT | FTF_INPUT_UTF8, sel);
+ else
+ FTF_DrawString(but->drawstr+but->ofs, FTF_NO_TRANSCONV | FTF_INPUT_UTF8, sel);
+ else
+ BMF_DrawString(but->font, but->drawstr+but->ofs);
+#else
BMF_DrawString(but->font, but->drawstr+but->ofs);
+#endif
}
}
static void ui_draw_but_BUTM(uiBut *but)
{
float x;
- short len;
+ short len, opt;
char *cpoin;
but->embossfunc(but->col, but->aspect, but->x1, but->y1, but->x2, but->y2, but->flag);
@@ -784,22 +856,56 @@ static void ui_draw_but_BUTM(uiBut *but)
if(cpoin) *cpoin= 0;
if(but->embossfunc==ui_emboss_P) {
- if(but->flag & UI_ACTIVE) glColor3ub(255,255,255);
- else glColor3ub(0,0,0);
+ if(but->flag & UI_ACTIVE) { opt = 1; glColor3ub(255,255,255); }
+ else { opt = 0; glColor3ub(0,0,0); }
} else {
- glColor3ub(0,0,0);
+ opt = 0;glColor3ub(0,0,0);
}
x= but->x1+4.0;
glRasterPos2f( x, (but->y1+but->y2- 9.0)/2.0);
+
+#ifdef INTERNATIONAL
+ if(G.ui_international == TRUE)
+ if(U.transopts & TR_BUTTONS) // BUTTON TEXTS
+ FTF_DrawString(but->drawstr, FTF_USE_GETTEXT | FTF_INPUT_UTF8, opt);
+ else
+ FTF_DrawString(but->drawstr, FTF_NO_TRANSCONV | FTF_INPUT_UTF8, opt);
+ else
+ BMF_DrawString(but->font, but->drawstr);
+#else
BMF_DrawString(but->font, but->drawstr);
+#endif
if(cpoin) {
+
+#ifdef INTERNATIONAL
+ if(G.ui_international == TRUE) {
+ if(U.transopts & TR_BUTTONS) { // BUTTON TEXTS
+ len= FTF_GetStringWidth(cpoin+1, FTF_USE_GETTEXT | FTF_INPUT_UTF8);
+ glRasterPos2f( but->x2 - len*but->aspect-3, (but->y1+but->y2- 9.0)/2.0);
+ FTF_DrawString(cpoin+1, FTF_USE_GETTEXT | FTF_INPUT_UTF8, but->flag & UI_ACTIVE);
+ *cpoin= '|';
+ } else {
+ len= FTF_GetStringWidth(cpoin+1, FTF_NO_TRANSCONV | FTF_INPUT_UTF8);
+ glRasterPos2f( but->x2 - len*but->aspect-3, (but->y1+but->y2- 9.0)/2.0);
+ FTF_DrawString(cpoin+1, FTF_NO_TRANSCONV | FTF_INPUT_UTF8, but->flag & UI_ACTIVE);
+ *cpoin= '|';
+ }
+ } else {
+ len= BMF_GetStringWidth(but->font, cpoin+1);
+ glRasterPos2f( but->x2 - len*but->aspect-3, (but->y1+but->y2- 9.0)/2.0);
+ BMF_DrawString(but->font, cpoin+1);
+ *cpoin= '|';
+ }
+#else
len= BMF_GetStringWidth(but->font, cpoin+1);
glRasterPos2f( but->x2 - len*but->aspect-3, (but->y1+but->y2- 9.0)/2.0);
BMF_DrawString(but->font, cpoin+1);
*cpoin= '|';
+#endif
+
}
}
}
@@ -825,7 +931,17 @@ static void ui_draw_but_LABEL(uiBut *but)
glRasterPos2f( x, (but->y1+but->y2- 9.0)/2.0);
+#ifdef INTERNATIONAL
+ if(G.ui_international == TRUE)
+ if(U.transopts & TR_BUTTONS) // BUTTON TEXTS
+ FTF_DrawString(but->drawstr+but->ofs, FTF_USE_GETTEXT | FTF_INPUT_UTF8, sel);
+ else
+ FTF_DrawString(but->drawstr+but->ofs, FTF_NO_TRANSCONV | FTF_INPUT_UTF8, sel);
+ else
+ BMF_DrawString(but->font, but->drawstr+but->ofs);
+#else
BMF_DrawString(but->font, but->drawstr+but->ofs);
+#endif
}
}
@@ -1467,10 +1583,39 @@ static int ui_do_but_MENU(uiBut *but)
while (rows*columns<md->nitems) rows++;
/* size and location */
- if(md->title) width= 2*strlen(md->title)+BMF_GetStringWidth(block->curfont, md->title);
- else width= 0;
+#ifdef INTERNATIONAL
+ if(G.ui_international == TRUE) {
+ if(md->title)
+ if(U.transopts & TR_MENUS)
+ width= 2*strlen(md->title)+FTF_GetStringWidth(md->title, FTF_USE_GETTEXT | FTF_INPUT_UTF8);
+ else
+ width= 2*strlen(md->title)+FTF_GetStringWidth(md->title, FTF_NO_TRANSCONV | FTF_INPUT_UTF8);
+ else
+ width= 0;
+ } else {
+ if(md->title)
+ width= 2*strlen(md->title)+BMF_GetStringWidth(block->curfont, md->title);
+ else
+ width= 0;
+ }
+#else
+ if(md->title)
+ width= 2*strlen(md->title)+BMF_GetStringWidth(block->curfont, md->title);
+ else
+ width= 0;
+#endif
for(a=0; a<md->nitems; a++) {
+#ifdef INTERNATIONAL
+ if(G.ui_international == TRUE)
+ if(U.transopts & TR_MENUS)
+ xmax= FTF_GetStringWidth(md->items[a].str, FTF_USE_GETTEXT | FTF_INPUT_UTF8);
+ else
+ xmax= FTF_GetStringWidth(md->items[a].str, FTF_NO_TRANSCONV | FTF_INPUT_UTF8);
+ else
+ xmax= BMF_GetStringWidth(block->curfont, md->items[a].str);
+#else
xmax= BMF_GetStringWidth(block->curfont, md->items[a].str);
+#endif
if(xmax>width) width= xmax;
}
@@ -1796,11 +1941,33 @@ static int ui_do_but_TEX(uiBut *but)
/* calculate cursor pos with current mousecoords */
BLI_strncpy(backstr, but->drawstr, UI_MAX_DRAW_STR);
but->pos= strlen(backstr)-but->ofs;
+#ifdef INTERNATIONAL
+ if(G.ui_international == TRUE)
+ if(U.transopts & TR_BUTTONS)
+ while((but->aspect*FTF_GetStringWidth(backstr+but->ofs, FTF_USE_GETTEXT | FTF_INPUT_UTF8) + but->x1) > mval[0]) {
+ if (but->pos <= 0) break;
+ but->pos--;
+ backstr[but->pos+but->ofs] = 0;
+ }
+ else
+ while((but->aspect*FTF_GetStringWidth(backstr+but->ofs, FTF_NO_TRANSCONV | FTF_INPUT_UTF8) + but->x1) > mval[0]) {
+ if (but->pos <= 0) break;
+ but->pos--;
+ backstr[but->pos+but->ofs] = 0;
+ }
+ else
+ while((but->aspect*BMF_GetStringWidth(but->font, backstr+but->ofs) + but->x1) > mval[0]) {
+ if (but->pos <= 0) break;
+ but->pos--;
+ backstr[but->pos+but->ofs] = 0;
+ }
+#else
while((but->aspect*BMF_GetStringWidth(but->font, backstr+but->ofs) + but->x1) > mval[0]) {
if (but->pos <= 0) break;
but->pos--;
backstr[but->pos+but->ofs] = 0;
}
+#endif
but->pos -= strlen(but->str);
but->pos += but->ofs;
@@ -2987,14 +3154,14 @@ static int ui_do_block(uiBlock *block, uiEvent *uevent)
if(but->flag & UI_MOUSE_OVER) {
if( (but->flag & UI_ACTIVE)==0) {
but->flag |= UI_ACTIVE;
- ui_draw_but(but);
+ if(but->type != LABEL) ui_draw_but(but);
}
}
/* hilite case 2 */
if(but->flag & UI_ACTIVE) {
if( (but->flag & UI_MOUSE_OVER)==0) {
but->flag &= ~UI_ACTIVE;
- ui_draw_but(but);
+ if(but->type != LABEL) ui_draw_but(but);
}
if(but->flag & UI_ACTIVE) active= 1;
}
@@ -3074,8 +3241,29 @@ static uiSaveUnder *ui_draw_but_tip(uiBut *but)
uiSaveUnder *su;
float x1, x2, y1, y2;
- x1= (but->x1+but->x2)/2; x2= 10+x1+ but->aspect*BMF_GetStringWidth(but->font, but->tip);
- y1= but->y1-19; y2= but->y1-2;
+#ifdef INTERNATIONAL
+ if(G.ui_international == TRUE) {
+ float llx,lly,llz,urx,ury,urz; //for FTF_GetBoundingBox()
+
+ if(U.transopts & TR_TOOLTIPS) {
+ FTF_GetBoundingBox(but->tip, &llx,&lly,&llz,&urx,&ury,&urz, FTF_USE_GETTEXT | FTF_INPUT_UTF8);
+
+ x1= (but->x1+but->x2)/2; x2= 10+x1+ but->aspect*FTF_GetStringWidth(but->tip, FTF_USE_GETTEXT | FTF_INPUT_UTF8); //BMF_GetStringWidth(but->font, but->tip);
+ y1= but->y1-(ury+FTF_GetSize()); y2= but->y1;
+ } else {
+ FTF_GetBoundingBox(but->tip, &llx,&lly,&llz,&urx,&ury,&urz, FTF_NO_TRANSCONV | FTF_INPUT_UTF8);
+
+ x1= (but->x1+but->x2)/2; x2= 10+x1+ but->aspect*FTF_GetStringWidth(but->tip, FTF_NO_TRANSCONV | FTF_INPUT_UTF8); //BMF_GetStringWidth(but->font, but->tip);
+ y1= but->y1-(ury+FTF_GetSize()); y2= but->y1;
+ }
+ } else {
+ x1= (but->x1+but->x2)/2; x2= 10+x1+ but->aspect*BMF_GetStringWidth(but->font, but->tip);
+ y1= but->y1-19; y2= but->y1-2;
+ }
+#else
+ x1= (but->x1+but->x2)/2; x2= 10+x1+ but->aspect*BMF_GetStringWidth(but->font, but->tip);
+ y1= but->y1-19; y2= but->y1-2;
+#endif
/* for pulldown menus it doesnt work */
if(mywinget()==G.curscreen->mainwin);
@@ -3111,7 +3299,17 @@ static uiSaveUnder *ui_draw_but_tip(uiBut *but)
glColor3ub(0,0,0);
glRasterPos2f( x1+3, y1+4);
+#ifdef INTERNATIONAL
+ if(G.ui_international == TRUE)
+ if(U.transopts & TR_TOOLTIPS)
+ FTF_DrawString(but->tip, FTF_USE_GETTEXT | FTF_INPUT_UTF8, 0);
+ else
+ FTF_DrawString(but->tip, FTF_NO_TRANSCONV | FTF_INPUT_UTF8, 0);
+ else
+ BMF_DrawString(but->font, but->tip);
+#else
BMF_DrawString(but->font, but->tip);
+#endif
glFinish(); /* for geforce, to show it in the frontbuffer */
return su;
@@ -3557,8 +3755,34 @@ static void ui_check_but(uiBut *but)
}
- if(but->drawstr[0]) but->strwidth= but->aspect*BMF_GetStringWidth(but->font, but->drawstr);
- else but->strwidth= 0;
+#ifdef INTERNATIONAL
+ if(G.ui_international == TRUE) {
+ if(U.transopts & TR_BUTTONS) {
+ if(but->drawstr[0]) {
+ but->strwidth= but->aspect*FTF_GetStringWidth(but->drawstr, FTF_USE_GETTEXT | FTF_INPUT_UTF8);
+ } else {
+ but->strwidth= 0;
+ }
+ } else {
+ if(but->drawstr[0]) {
+ but->strwidth= but->aspect*FTF_GetStringWidth(but->drawstr, FTF_NO_TRANSCONV | FTF_INPUT_UTF8);
+ } else {
+ but->strwidth= 0;
+ }
+ }
+ } else {
+ if(but->drawstr[0]) {
+ but->strwidth= but->aspect*BMF_GetStringWidth(but->font, but->drawstr);
+ } else {
+ but->strwidth= 0;
+ }
+ }
+#else
+ if(but->drawstr[0])
+ but->strwidth= but->aspect*BMF_GetStringWidth(but->font, but->drawstr);
+ else
+ but->strwidth= 0;
+#endif
/* automatic width */
if(but->x2==0.0) {
@@ -3571,7 +3795,19 @@ static void ui_check_but(uiBut *but)
but->ofs++;
if(but->drawstr[but->ofs])
+#ifdef INTERNATIONAL
+ if(G.ui_international == TRUE) {
+ if(U.transopts & TR_BUTTONS) {
+ but->strwidth= but->aspect*FTF_GetStringWidth(but->drawstr+but->ofs, FTF_USE_GETTEXT | FTF_INPUT_UTF8);
+ } else {
+ but->strwidth= but->aspect*FTF_GetStringWidth(but->drawstr+but->ofs, FTF_NO_TRANSCONV | FTF_INPUT_UTF8);
+ }
+ } else {
+ but->strwidth= but->aspect*BMF_GetStringWidth(but->font, but->drawstr+but->ofs);
+ }
+#else
but->strwidth= but->aspect*BMF_GetStringWidth(but->font, but->drawstr+but->ofs);
+#endif
else but->strwidth= 0;
/* textbut exception */
@@ -3902,12 +4138,40 @@ short pupmenu(char *instr)
md= decompose_menu_string(instr);
/* size and location, title slightly bigger for bold */
+#ifdef INTERNATIONAL
+ if(G.ui_international == TRUE) {
+ if(U.transopts && TR_BUTTONS) {
+ if(md->title) width= 2*strlen(md->title)+FTF_GetStringWidth(md->title, FTF_USE_GETTEXT | FTF_INPUT_UTF8);
+ else width= 0;
+ for(a=0; a<md->nitems; a++) {
+ xmax= FTF_GetStringWidth( md->items[a].str, FTF_USE_GETTEXT | FTF_INPUT_UTF8);
+ if(xmax>width) width= xmax;
+ }
+ } else {
+ if(md->title) width= 2*strlen(md->title)+FTF_GetStringWidth(md->title, FTF_NO_TRANSCONV | FTF_INPUT_UTF8);
+ else width= 0;
+ for(a=0; a<md->nitems; a++) {
+ xmax= FTF_GetStringWidth( md->items[a].str, FTF_NO_TRANSCONV | FTF_INPUT_UTF8);
+ if(xmax>width) width= xmax;
+ }
+ }
+ } else {
+ if(md->title) width= 2*strlen(md->title)+BMF_GetStringWidth(uiBlockGetCurFont(block), md->title);
+ else width= 0;
+ for(a=0; a<md->nitems; a++) {
+ xmax= BMF_GetStringWidth(uiBlockGetCurFont(block), md->items[a].str);
+ if(xmax>width) width= xmax;
+ }
+ }
+#else
if(md->title) width= 2*strlen(md->title)+BMF_GetStringWidth(uiBlockGetCurFont(block), md->title);
else width= 0;
for(a=0; a<md->nitems; a++) {
xmax= BMF_GetStringWidth(uiBlockGetCurFont(block), md->items[a].str);
if(xmax>width) width= xmax;
}
+#endif
+
width+= 10;
height= boxh*md->nitems;
@@ -4019,12 +4283,39 @@ short pupmenu_col(char *instr, int maxrow)
while (rows*columns<md->nitems) rows++;
/* size and location */
+#ifdef INTERNATIONAL
+ if(G.ui_international == TRUE) {
+ if(U.transopts & TR_BUTTONS) {
+ if(md->title) width= 2*strlen(md->title)+FTF_GetStringWidth(md->title, FTF_USE_GETTEXT | FTF_INPUT_UTF8);
+ else width= 0;
+ for(a=0; a<md->nitems; a++) {
+ xmax= FTF_GetStringWidth( md->items[a].str, FTF_USE_GETTEXT | FTF_INPUT_UTF8);
+ if(xmax>width) width= xmax;
+ }
+ } else {
+ if(md->title) width= 2*strlen(md->title)+FTF_GetStringWidth(md->title, FTF_NO_TRANSCONV | FTF_INPUT_UTF8);
+ else width= 0;
+ for(a=0; a<md->nitems; a++) {
+ xmax= FTF_GetStringWidth( md->items[a].str, FTF_NO_TRANSCONV | FTF_INPUT_UTF8);
+ if(xmax>width) width= xmax;
+ }
+ }
+ } else {
+ if(md->title) width= 2*strlen(md->title)+BMF_GetStringWidth(uiBlockGetCurFont(block), md->title);
+ else width= 0;
+ for(a=0; a<md->nitems; a++) {
+ xmax= BMF_GetStringWidth(uiBlockGetCurFont(block), md->items[a].str);
+ if(xmax>width) width= xmax;
+ }
+ }
+#else
if(md->title) width= 2*strlen(md->title)+BMF_GetStringWidth(uiBlockGetCurFont(block), md->title);
else width= 0;
for(a=0; a<md->nitems; a++) {
- xmax= BMF_GetStringWidth(uiBlockGetCurFont(uiBlockGetCurFont(block)), md->items[a].str);
+ xmax= BMF_GetStringWidth(uiBlockGetCurFont(block), md->items[a].str);
if(xmax>width) width= xmax;
}
+#endif
width+= 10;
if (width<50) width=50;
diff --git a/source/blender/src/mywindow.c b/source/blender/src/mywindow.c
index 7f3e2af70b4..f7208ceda2f 100644
--- a/source/blender/src/mywindow.c
+++ b/source/blender/src/mywindow.c
@@ -97,7 +97,7 @@ void mywindow_init_mainwin(Window *win, int orx, int ory, int sizex, int sizey)
mainwindow.ymax= ory+sizey-1;
mainwindow.qevents= NULL;
- myortho2(-0.5, (float)sizex-0.5, -0.5, (float)sizey-0.5);
+ myortho2(-0.5, (float)sizex-0.5, -0.6, (float)sizey-0.6);
glLoadIdentity();
glGetFloatv(GL_PROJECTION_MATRIX, (float *)mainwindow.winmat);
diff --git a/source/blender/src/space.c b/source/blender/src/space.c
index 5f7c1b52cc9..4288c6a1075 100644
--- a/source/blender/src/space.c
+++ b/source/blender/src/space.c
@@ -46,6 +46,10 @@
#include "MEM_guardedalloc.h"
+#ifdef INTERNATIONAL
+#include "BIF_language.h"
+#endif
+
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
@@ -1310,22 +1314,22 @@ void drawinfospace(void)
dx= (1280-90)/6; /* spacing for use in equally dividing 'tab' row */
- xpos = 45; /* left padding */
- ypos = 72; /* bottom padding for buttons */
- ypostab = 18; /* bottom padding for 'tab' row */
+ xpos = 45; /* left padding */
+ ypos = 50; /* bottom padding for buttons */
+ ypostab = 10; /* bottom padding for 'tab' row */
buth = 20; /* standard button height */
- smallprefbut = 94; /* standard size for small preferences button */
- medprefbut = 193; /* standard size for medium preferences button */
- largeprefbut = 292; /* standard size for large preferences button */
- smfileselbut = buth; /* standard size for fileselect button (square) */
-
- edgespace = 3; /* space from edge of end 'tab' to edge of end button */
- midspace = 5; /* horizontal space between buttons */
+ smallprefbut = 94; /* standard size for small preferences button */
+ medprefbut = 193; /* standard size for medium preferences button */
+ largeprefbut = 292; /* standard size for large preferences button */
+ smfileselbut = buth; /* standard size for fileselect button (square) */
+
+ edgespace = 3; /* space from edge of end 'tab' to edge of end button */
+ midspace = 5; /* horizontal space between buttons */
- rspace = 4; /* default space between rows */
+ rspace = 3; /* default space between rows */
y1 = ypos; /* bottom padding of 1st (bottom) button row */
y2 = ypos+buth+rspace; /* bottom padding of 2nd button row */
@@ -1358,11 +1362,11 @@ void drawinfospace(void)
&U.userpref,1.0,3.0, 0, 0,"");
uiDefButI(block, ROW,B_USERPREF,"System & OpenGL",
- (short)(xpos+4*dx),ypostab,(short)dx,buth,
+ (short)(xpos+5*dx),ypostab,(short)dx,buth,
&U.userpref,1.0,4.0, 0, 0,"");
uiDefButI(block, ROW,B_USERPREF,"File Paths",
- (short)(xpos+5*dx),ypostab,(short)dx,buth,
+ (short)(xpos+4*dx),ypostab,(short)dx,buth,
&U.userpref,1.0,5.0, 0, 0,"");
uiBlockSetEmboss(block, UI_EMBOSSX);
@@ -1551,55 +1555,62 @@ void drawinfospace(void)
sprintf(curfont, "Interface Font: ");
strcat(curfont,U.fontname);
- uiDefBut(block, LABEL,0,curfont,
+ uiDefButS(block, TOG|BIT|5, B_DOLANGUIFONT, "International",
xpos,y2,medprefbut,buth,
- 0, 0, 0, 0, 0, "");
-
- uiBlockSetCol(block, BUTSALMON);
+ &(U.transopts), 0, 0, 0, 0, "Activate international interface");
- uiDefBut(block, BUT, B_LOADUIFONT, "Select Font",
- (xpos+edgespace),y1,medprefbut,buth,
- 0, 0, 0, 0, 0, "Select a new font for the interface");
+ if(U.transopts & TR_ALL) {
+ uiDefBut(block, LABEL,0,curfont,
+ (xpos+edgespace+medprefbut+midspace),y2,medprefbut,buth,
+ 0, 0, 0, 0, 0, "");
- uiBlockSetCol(block, BUTGREY);
+ uiBlockSetCol(block, BUTSALMON);
+ //(xpos+edgespace)
+ uiDefBut(block, BUT, B_LOADUIFONT, "Select Font",
+ xpos,y1,medprefbut,buth,
+ 0, 0, 0, 0, 0, "Select a new font for the interface");
+ uiBlockSetCol(block, BUTGREY);
- uiDefButI(block, MENU|INT, B_SETFONTSIZE, fontsize_pup(),
- (xpos+edgespace+medprefbut+midspace),y2,medprefbut,buth,
- &U.fontsize, 0, 0, 0, 0, "Current interface font size (points)");
- uiDefButS(block, MENU|SHO, B_SETENCODING, encoding_pup(),
- (xpos+edgespace+medprefbut+midspace),y1,medprefbut,buth,
- &U.encoding, 0, 0, 0, 0, "Current interface font encoding");
+ uiDefButI(block, MENU|INT, B_SETFONTSIZE, fontsize_pup(),
+ (xpos+edgespace+medprefbut+midspace),y1,medprefbut,buth,
+ &U.fontsize, 0, 0, 0, 0, "Current interface font size (points)");
+ /*
+ uiDefButS(block, MENU|SHO, B_SETENCODING, encoding_pup(),
+ (xpos+edgespace+medprefbut+midspace),y1,medprefbut,buth,
+ &U.encoding, 0, 0, 0, 0, "Current interface font encoding");
- uiDefBut(block, LABEL,0,"Translate:",
- (xpos+edgespace+(3*medprefbut)+(2*midspace)),y3label,medprefbut,buth,
- 0, 0, 0, 0, 0, "");
+ uiDefBut(block, LABEL,0,"Translate:",
+ (xpos+edgespace+(2.1*medprefbut)+(2*midspace)),y3label,medprefbut,buth,
+ 0, 0, 0, 0, 0, "");
+ */
- uiDefButS(block, TOG|BIT|0, B_SETTRANSBUTS, "Tooltips",
- (xpos+edgespace+(3*medprefbut)+(3*midspace)),y2,smallprefbut,buth,
- &(U.transopts), 0, 0, 0, 0, "Translate tooltips");
+ uiDefButS(block, TOG|BIT|0, B_SETTRANSBUTS, "Tooltips",
+ (xpos+edgespace+(2.2*medprefbut)+(3*midspace)),y1,smallprefbut,buth,
+ &(U.transopts), 0, 0, 0, 0, "Translate tooltips");
- uiDefButS(block, TOG|BIT|1, B_SETTRANSBUTS, "Buttons",
- (xpos+edgespace+(3*medprefbut)+(4*midspace)+smallprefbut),y2,smallprefbut,buth,
- &(U.transopts), 0, 0, 0, 0, "Translate button labels");
+ uiDefButS(block, TOG|BIT|1, B_SETTRANSBUTS, "Buttons",
+ (xpos+edgespace+(2.2*medprefbut)+(4*midspace)+smallprefbut),y1,smallprefbut,buth,
+ &(U.transopts), 0, 0, 0, 0, "Translate button labels");
- uiDefButS(block, TOG|BIT|2, B_SETTRANSBUTS, "Toolbox",
- (xpos+edgespace+(3*medprefbut)+(5*midspace)+(2*smallprefbut)),y2,smallprefbut,buth,
- &(U.transopts), 0, 0, 0, 0, "Translate toolbox menu");
+ uiDefButS(block, TOG|BIT|2, B_SETTRANSBUTS, "Toolbox",
+ (xpos+edgespace+(2.2*medprefbut)+(5*midspace)+(2*smallprefbut)),y1,smallprefbut,buth,
+ &(U.transopts), 0, 0, 0, 0, "Translate toolbox menu");
- uiDefButS(block, MENU|SHO, B_SETLANGUAGE, language_pup(),
- (xpos+edgespace+(3*medprefbut)+(3*midspace)),y1,medprefbut,buth,
- &U.language, 0, 0, 0, 0, "Select interface language");
-
- /* uiDefButS(block, TOG|BIT|3, B_SETTRANSBUTS, "FTF All windows",
- (xpos+edgespace+(4*medprefbut)+(4*midspace)),y1,medprefbut,buth,
- &(U.transopts), 0, 0, 0, 0,
- "Use FTF drawing for fileselect and textwindow "
- "(under construction)");
- */
+ uiDefButS(block, MENU|SHO, B_SETLANGUAGE, language_pup(),
+ (xpos+edgespace+(2.2*medprefbut)+(3*midspace)),y2,medprefbut+(0.5*medprefbut)+3,buth,
+ &U.language, 0, 0, 0, 0, "Select interface language");
+
+ /* uiDefButS(block, TOG|BIT|3, B_SETTRANSBUTS, "FTF All windows",
+ (xpos+edgespace+(4*medprefbut)+(4*midspace)),y1,medprefbut,buth,
+ &(U.transopts), 0, 0, 0, 0,
+ "Use FTF drawing for fileselect and textwindow "
+ "(under construction)");
+ */
+ }
/* end of INTERNATIONAL */
#endif
@@ -1612,26 +1623,26 @@ void drawinfospace(void)
&(U.flag), 0, 0, 0, 0,
"Enables automatic saving of temporary files");
+ if(U.flag & AUTOSAVE) {
+ uiBlockSetCol(block, BUTSALMON);
- uiBlockSetCol(block, BUTSALMON);
+ uiDefBut(block, BUT, B_LOADTEMP, "Open Recent",
+ (xpos+edgespace),y1,medprefbut,buth,
+ 0, 0, 0, 0, 0,"Opens the most recently saved temporary file");
- uiDefBut(block, BUT, B_LOADTEMP, "Open Recent",
- (xpos+edgespace),y1,medprefbut,buth,
- 0, 0, 0, 0, 0,"Opens the most recently saved temporary file");
-
- uiBlockSetCol(block, BUTGREY);
+ uiBlockSetCol(block, BUTGREY);
- uiDefButI(block, NUM, B_RESETAUTOSAVE, "Minutes:",
- (xpos+edgespace+medprefbut+midspace),y2,medprefbut,buth,
- &(U.savetime), 1.0, 60.0, 0, 0,
- "The time (in minutes) to wait between automatic temporary saves");
-
- uiDefButS(block, NUM, 0, "Versions:",
- (xpos+edgespace+medprefbut+midspace),y1,medprefbut,buth,
- &U.versions, 0.0, 32.0, 0, 0,
- "The number of old versions to maintain when saving");
+ uiDefButI(block, NUM, B_RESETAUTOSAVE, "Minutes:",
+ (xpos+edgespace+medprefbut+midspace),y2,medprefbut,buth,
+ &(U.savetime), 1.0, 60.0, 0, 0,
+ "The time (in minutes) to wait between automatic temporary saves");
+ uiDefButS(block, NUM, 0, "Versions:",
+ (xpos+edgespace+medprefbut+midspace),y1,medprefbut,buth,
+ &U.versions, 0.0, 32.0, 0, 0,
+ "The number of old versions to maintain when saving");
+ }
} else if (U.userpref == 4) { /* system & opengl */
@@ -1782,7 +1793,7 @@ static void changebutspace(ScrArea *sa, void *spacedata)
if(G.v2d==0) return;
test_view2d(G.v2d, curarea->winx, curarea->winy);
- myortho2(G.v2d->cur.xmin, G.v2d->cur.xmax, G.v2d->cur.ymin, G.v2d->cur.ymax);
+ myortho2(G.v2d->cur.xmin, G.v2d->cur.xmax, G.v2d->cur.ymin-0.6, G.v2d->cur.ymax+0.6);
}
void winqreadbutspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
diff --git a/source/blender/src/toolbox.c b/source/blender/src/toolbox.c
index 6fe628c0ad8..448a6bb2501 100644
--- a/source/blender/src/toolbox.c
+++ b/source/blender/src/toolbox.c
@@ -52,6 +52,9 @@
#include "MEM_guardedalloc.h"
#include "BMF_Api.h"
+#ifdef INTERNATIONAL
+#include "FTF_Api.h"
+#endif
#include "BLI_blenlib.h"
#include "BLI_arithb.h"
@@ -60,6 +63,7 @@
#include "DNA_image_types.h"
#include "DNA_object_types.h"
#include "DNA_screen_types.h"
+#include "DNA_userdef_types.h"
#include "DNA_view3d_types.h"
#include "BKE_plugin_types.h"
@@ -498,7 +502,7 @@ void bgnpupdraw(int startx, int starty, int endx, int endy)
oldcursor= get_cursor();
set_cursor(CURSOR_STD);
- tbfontyofs= (TBOXH-11)/2 +2; /* for toolbox */
+ tbfontyofs= (TBOXH-11)/2 +1; /* ypos text in toolbox */
}
void endpupdraw(void)
@@ -804,7 +808,6 @@ void tbox_drawelem_text(x, y, type)
tbox_setinfo(x, y);
if(tbstr && tbstr[0]) {
len1= 5+BMF_GetStringWidth(G.font, tbstr);
-// if(tbstr1) len2= 5+BMF_GetStringWidth(G.font, tbstr1); else len2= 0;
if(keystr) len2= 5+BMF_GetStringWidth(G.font, keystr); else len2= 0;
while(len1>0 && (len1+len2+5>x2-x1) ) {
@@ -813,9 +816,18 @@ void tbox_drawelem_text(x, y, type)
}
glRasterPos2i(x1+5, y1+tbfontyofs);
+#ifdef INTERNATIONAL
+ if(G.ui_international == TRUE)
+ if(U.transopts & TR_MENUS)
+ FTF_DrawString(tbstr, FTF_USE_GETTEXT | FTF_INPUT_UTF8, 0);
+ else
+ FTF_DrawString(tbstr, FTF_NO_TRANSCONV | FTF_INPUT_UTF8, 0);
+ else
+ BMF_DrawString(G.font, tbstr);
+#else
BMF_DrawString(G.font, tbstr);
+#endif
-// if(tbstr1 && tbstr1[0]) {
if(keystr && keystr[0]) {
if(type & 1) {
ColorFunc(TBOXBLACK);
@@ -823,14 +835,32 @@ void tbox_drawelem_text(x, y, type)
glRecti(x2-len2-2, y1+2, x2-3, y2-2);
ColorFunc(TBOXWHITE);
glRasterPos2i(x2-len2, y1+tbfontyofs);
-// BMF_DrawString(G.font, tbstr1);
- BMF_DrawString(G.font, keystr);
+#ifdef INTERNATIONAL
+ if(G.ui_international == TRUE) //toolbox hotkeys
+ if(U.transopts & TR_MENUS)
+ FTF_DrawString(keystr, FTF_USE_GETTEXT | FTF_INPUT_UTF8, 1);
+ else
+ FTF_DrawString(keystr, FTF_NO_TRANSCONV | FTF_INPUT_UTF8, 1);
+ else
+ BMF_DrawString(G.font, keystr);
+#else
+ BMF_DrawString(G.font, keystr);
+#endif
}
else {
ColorFunc(TBOXBLACK);
glRasterPos2i(x2-len2, y1+tbfontyofs);
-// BMF_DrawString(G.font, tbstr1);
- BMF_DrawString(G.font, keystr);
+#ifdef INTERNATIONAL
+ if(G.ui_international == TRUE) //toolbox hotkeys
+ if(U.transopts & TR_MENUS)
+ FTF_DrawString(keystr, FTF_USE_GETTEXT | FTF_INPUT_UTF8, 0);
+ else
+ FTF_DrawString(keystr, FTF_NO_TRANSCONV | FTF_INPUT_UTF8, 0);
+ else
+ BMF_DrawString(G.font, keystr);
+#else
+ BMF_DrawString(G.font, keystr);
+#endif
}
}
}
@@ -1244,9 +1274,27 @@ void draw_numbuts_tip(char *str, int x1, int y1, int x2, int y2)
cpack(0x0);
temp= 0;
+#ifdef INTERNATIONAL
+ if(G.ui_international == TRUE) {
+ if(U.transopts & TR_BUTTONS) {
+ while( FTF_GetStringWidth(str+temp, FTF_USE_GETTEXT | FTF_INPUT_UTF8)>(x2 - x1-24)) temp++;
+ glRasterPos2i(x1+16, y2-30);
+ FTF_DrawString(str+temp, FTF_USE_GETTEXT | FTF_INPUT_UTF8, 0);
+ } else {
+ while( FTF_GetStringWidth(str+temp, FTF_NO_TRANSCONV | FTF_INPUT_UTF8)>(x2 - x1-24)) temp++;
+ glRasterPos2i(x1+16, y2-30);
+ FTF_DrawString(str+temp, FTF_NO_TRANSCONV | FTF_INPUT_UTF8, 0);
+ }
+ } else {
+ while( BMF_GetStringWidth(G.fonts, str+temp)>(x2 - x1-24)) temp++;
+ glRasterPos2i(x1+16, y2-30);
+ BMF_DrawString(G.fonts, str+temp);
+ }
+#else
while( BMF_GetStringWidth(G.fonts, str+temp)>(x2 - x1-24)) temp++;
glRasterPos2i(x1+16, y2-30);
BMF_DrawString(G.fonts, str+temp);
+#endif
}
int do_clever_numbuts(char *name, int tot, int winevent)
diff --git a/source/blender/src/usiblender.c b/source/blender/src/usiblender.c
index 5a9d0797715..53b50d20029 100644
--- a/source/blender/src/usiblender.c
+++ b/source/blender/src/usiblender.c
@@ -52,6 +52,10 @@
#include "MEM_guardedalloc.h"
#include "BMF_Api.h"
+#ifdef INTERNATIONAL
+#include "FTF_Api.h"
+#include "BIF_language.h"
+#endif
#include "BLI_blenlib.h"
#include "BLI_arithb.h"
@@ -161,7 +165,7 @@ int BIF_read_homefile(void)
{
char tstr[FILE_MAXDIR+FILE_MAXFILE], scestr[FILE_MAXDIR];
char *home= BLI_gethome();
- int success;
+ int success, result;
BLI_make_file_string(G.sce, tstr, home, ".B.blend");
strcpy(scestr, G.sce); /* temporal store */
@@ -199,6 +203,32 @@ int BIF_read_homefile(void)
U.vrmlflag= USERDEF_VRML_LAYERS;
}
+#ifdef INTERNATIONAL
+ /* userdef multilanguage options */
+ /* uncomment with versionchange to 2.27 --phase */
+/*
+ if (G.main->versionfile <= 226) {
+ U.language= 0;
+ U.fontsize= 12;
+ U.encoding= 0;
+ sprintf(U.fontname, ".bfont.ttf");
+ if( FTF_SetFont(".bfont.ttf", 12) ) {
+ FTF_SetLanguage("en");
+ FTF_SetEncoding("ASCII");
+ G.ui_international = TRUE;
+ } else {
+ G.ui_international = FALSE;
+ }
+ }
+*/
+
+ if(U.transopts & TR_ALL)
+ set_ML_interface_font();
+ else
+ G.ui_international = FALSE;
+
+#endif // INTERNATIONAL
+
space_set_commmandline_options();
reset_autosave();
@@ -451,6 +481,10 @@ void BIF_init(void)
init_draw_rects(); /* drawobject.c */
init_gl_stuff(); /* drawview.c */
+#ifdef INTERNATIONAL
+ readMultiLingualFiles();
+#endif
+
BIF_read_homefile();
readBlog();
@@ -497,6 +531,9 @@ void exit_usiblender(void)
freeNurblist(&editNurb);
fsmenu_free();
+#ifdef INTERNATIONAL
+ languagesmenu_free();
+#endif
RE_free_render_data();
RE_free_filt_mask();