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.
This commit is contained in:
Rob Haarsma 2003-05-03 12:17:11 +00:00
parent da1e6bae44
commit b43473e425
18 changed files with 1459 additions and 122 deletions

@ -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 */

@ -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 */

@ -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

@ -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);
}

@ -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);
}

@ -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

@ -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..

@ -32,7 +32,7 @@
/* TBOXX: width in pixels */ /* TBOXX: width in pixels */
#define TBOXXL 80 #define TBOXXL 80
#define TBOXXR 170 #define TBOXXR 200
#define TBOXX (TBOXXL+TBOXXR) #define TBOXX (TBOXXL+TBOXXR)
/* TBOXEL: amount of element vertically */ /* TBOXEL: amount of element vertically */
#define TBOXEL 14 #define TBOXEL 14

@ -188,6 +188,7 @@
#define B_CONSOLETOG 61 #define B_CONSOLETOG 61
#define B_DRAWINFO 62 #define B_DRAWINFO 62
#define B_REDRCURW3D 63 #define B_REDRCURW3D 63
#define B_FLIPINFOMENU 64
#define B_SHOWSPLASH 70 #define B_SHOWSPLASH 70
@ -282,6 +283,7 @@
#define B_SETFONTSIZE 313 #define B_SETFONTSIZE 313
#define B_SETENCODING 314 #define B_SETENCODING 314
#define B_SETTRANSBUTS 315 #define B_SETTRANSBUTS 315
#define B_DOLANGUIFONT 316
/* Definitions for the fileselect buttons in user prefs */ /* Definitions for the fileselect buttons in user prefs */
#define B_FONTDIRFILESEL 320 #define B_FONTDIRFILESEL 320

@ -86,6 +86,8 @@ extern UserDef U; /* from usiblender.c !!!! */
#define WHEELZOOMDIR 4 #define WHEELZOOMDIR 4
#define FILTERFILEEXTS 8 #define FILTERFILEEXTS 8
#define DRAWVIEWINFO 16 #define DRAWVIEWINFO 16
#define EVTTOCONSOLE 32 //print ghost events, here for tuhopuu compat. --phase
#define FLIPINFOMENU 64
/* transopts */ /* transopts */
@ -94,6 +96,7 @@ extern UserDef U; /* from usiblender.c !!!! */
#define TR_MENUS 4 #define TR_MENUS 4
#define TR_FILESELECT 8 #define TR_FILESELECT 8
#define TR_TEXTEDIT 16 #define TR_TEXTEDIT 16
#define TR_ALL 32
/* dupflag */ /* dupflag */

@ -7131,6 +7131,7 @@ void drawbutspace(ScrArea *sa, void *spacedata)
ob= OBACT; 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); myortho2(v2d->cur.xmin, v2d->cur.xmax, v2d->cur.ymin, v2d->cur.ymax);
glShadeModel(GL_SMOOTH); glShadeModel(GL_SMOOTH);

@ -2808,7 +2808,7 @@ void drawscreen(void)
ScrEdge *se; ScrEdge *se;
mywinset(G.curscreen->mainwin); 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 */ /* two times, because there is no 'win_swap' for this available */
glDrawBuffer(GL_FRONT); glDrawBuffer(GL_FRONT);

@ -46,6 +46,10 @@
#include "MEM_guardedalloc.h" #include "MEM_guardedalloc.h"
#include "BMF_Api.h" #include "BMF_Api.h"
#ifdef INTERNATIONAL
#include "FTF_Api.h"
#include "BIF_language.h"
#endif
#include "BLI_blenlib.h" #include "BLI_blenlib.h"
#include "BLI_arithb.h" #include "BLI_arithb.h"
@ -1372,6 +1376,7 @@ void do_global_buttons(unsigned short event)
case B_RESETAUTOSAVE: case B_RESETAUTOSAVE:
reset_autosave(); reset_autosave();
allqueue(REDRAWINFO, 0);
break; break;
case B_SOUNDTOGGLE: case B_SOUNDTOGGLE:
SYS_WriteCommandLineInt(SYS_GetSystem(), "noaudio", (U.gameflags & USERDEF_DISABLE_SOUND)); SYS_WriteCommandLineInt(SYS_GetSystem(), "noaudio", (U.gameflags & USERDEF_DISABLE_SOUND));
@ -1398,6 +1403,10 @@ void do_global_buttons(unsigned short event)
allqueue(REDRAWVIEW3D, 0); allqueue(REDRAWVIEW3D, 0);
break; break;
case B_FLIPINFOMENU: /* is button uit space.c *info* */
scrarea_queue_headredraw(curarea);
break;
/* Fileselect windows for user preferences file paths */ /* Fileselect windows for user preferences file paths */
case B_FONTDIRFILESEL: /* is button from space.c *info* */ case B_FONTDIRFILESEL: /* is button from space.c *info* */
@ -1499,10 +1508,14 @@ void do_global_buttons(unsigned short event)
allqueue(REDRAWALL, 0); allqueue(REDRAWALL, 0);
break; break;
case B_SETENCODING: /* is button from space.c *info* */ case B_DOLANGUIFONT: /* is button from space.c *info* */
lang_setencoding(); if(U.transopts & TR_ALL)
set_ML_interface_font();
else
G.ui_international = FALSE;
allqueue(REDRAWALL, 0); allqueue(REDRAWALL, 0);
break; break;
#endif #endif
case B_FULL: case B_FULL:
@ -2643,8 +2656,6 @@ static uiBlock *info_filemenu(void *arg_unused)
static void do_info_editmenu(void *arg, int event) static void do_info_editmenu(void *arg, int event)
{ {
int oldqual;
switch(event) { switch(event) {
case 0: case 0:
@ -3288,12 +3299,12 @@ static void info_text(int x, int y)
} }
if (g_progress_bar) { 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 fac1 = 0.5 * g_done; // do some rainbow colours on progress
fac2 = 1.0; fac2 = 1.0;
fac3 = 0.9; fac3 = 0.9;
} else { } else {
hsize = 124; hsize = 142;
/* promise! Never change these lines again! (zr & ton did!) */ /* promise! Never change these lines again! (zr & ton did!) */
fac1= fabs(hashvectf[ 2*G.version+4]); fac1= fabs(hashvectf[ 2*G.version+4]);
fac2= 0.5+0.1*hashvectf[ G.version+3]; 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); glColor3ub(0, 0, 0);
glRasterPos2i(x, y); 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); 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) void info_buttons(void)
{ {
uiBlock *block; uiBlock *block;
short xco= 32; short xco= 32;
char naam[20]; char naam[20];
int xmax;
sprintf(naam, "header %d", curarea->headwin); sprintf(naam, "header %d", curarea->headwin);
block= uiNewBlock(&curarea->uiblocks, naam, UI_EMBOSSM, UI_HELV, curarea->headwin); block= uiNewBlock(&curarea->uiblocks, naam, UI_EMBOSSM, UI_HELV, curarea->headwin);
uiBlockSetCol(block, BUTGREY); uiBlockSetCol(block, BUTGREY);
uiDefBlockBut(block, info_filemenu, NULL, "File", xco, 3, 40, 15, ""); if(U.uiflag & FLIPINFOMENU) {
xco+= 40; uiDefIconButS(block, TOG|BIT|6, B_FLIPINFOMENU, ICON_RIGHTARROW,
uiDefBlockBut(block, info_editmenu, NULL, "Edit", xco, 3, 40, 15, ""); xco,2,XIC,YIC-2,
xco+= 40; &(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, ""); xmax= GetButStringLength("Edit");
xco+= 40; uiDefBlockBut(block, info_editmenu, NULL, "Edit", xco, 3, xmax, 15, "");
xco+= xmax;
uiDefBlockBut(block, info_viewmenu, NULL, "View", xco, 3, 40, 15, ""); xmax= GetButStringLength("Add");
xco+= 40; uiDefBlockBut(block, info_addmenu, NULL, "Add", xco, 3, xmax, 15, "");
xco+= xmax;
uiDefBlockBut(block, info_gamemenu, NULL, "Game", xco, 3, 40, 15, ""); xmax= GetButStringLength("View");
xco+= 40; 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 #ifndef EXPERIMENTAL_MENUS
/* In the Maarten's new menu structure proposal, the tools menu moved to the file menu */ // 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; xmax= GetButStringLength("Tools");
#endif /* EXPERIMENTAL_MENUS */ uiDefBlockBut(block, info_toolsmenu, NULL, "Tools", xco, 3, xmax, 15, "");
xco+= xmax;
#endif // EXPERIMENTAL_MENUS
}
/* pack icon indicates a packed file */ /* 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, ""); uiDefIconBut(block, BUT, B_SHOWSPLASH, ICON_BLENDER, xco+1, 0,XIC,YIC, 0, 0, 0, 0, 0, "");
uiBlockSetEmboss(block, UI_EMBOSSX); uiBlockSetEmboss(block, UI_EMBOSSX);
/*
uiBlockSetEmboss(block, UI_EMBOSSN); uiBlockSetEmboss(block, UI_EMBOSSN);
uiDefIconBut(block, LABEL, 0, ICON_PUBLISHER, xco+125, 0,XIC,YIC, 0, 0, 0, 0, 0, ""); uiDefIconBut(block, LABEL, 0, ICON_PUBLISHER, xco+125, 0,XIC,YIC, 0, 0, 0, 0, 0, "");
uiBlockSetEmboss(block, UI_EMBOSSX); uiBlockSetEmboss(block, UI_EMBOSSX);
*/
/* always do as last */ /* always do as last */
curarea->headbutlen= xco+2*XIC; curarea->headbutlen= xco+2*XIC;
@ -4773,9 +4846,24 @@ void file_buttons(void)
cpack(0x0); cpack(0x0);
glRasterPos2i(xco+=XIC+10, 5); 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); BMF_DrawString(uiBlockGetCurFont(block), sfile->title);
xco+= BMF_GetStringWidth(G.font, 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, 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"); 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); cpack(0x0);
glRasterPos2i(xco, 5); 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); BMF_DrawString(uiBlockGetCurFont(block), naam);
#endif
} }
/* always do as last */ /* always do as last */
curarea->headbutlen= xco+2*XIC; curarea->headbutlen= xco+2*XIC;

@ -50,6 +50,9 @@
#include "PIL_time.h" #include "PIL_time.h"
#include "BMF_Api.h" #include "BMF_Api.h"
#ifdef INTERNATIONAL
#include "FTF_Api.h"
#endif
#include "BLI_blenlib.h" #include "BLI_blenlib.h"
#include "BLI_arithb.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); 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); 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( BTST( sp[1], but->bitnr )) ok= 1;
} }
if (ok) {
glColor3ub(255, 255, 0);
} else {
glColor3ub(255, 255, 255);
}
} else {
glColor3ub(0, 0, 0);
}
if(but->flag & UI_TEXT_LEFT) x= but->x1+4.0; if(but->flag & UI_TEXT_LEFT) x= but->x1+4.0;
else x= (but->x1+but->x2-but->strwidth+1)/2.0; else x= (but->x1+but->x2-but->strwidth+1)/2.0;
glRasterPos2f( x, (but->y1+but->y2- 9.0)/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); 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) { if(pos >= but->ofs) {
ch= but->drawstr[pos]; ch= but->drawstr[pos];
but->drawstr[pos]= 0; 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; t= but->aspect*BMF_GetStringWidth(but->font, but->drawstr+but->ofs) + 3;
#endif
but->drawstr[pos]= ch; but->drawstr[pos]= ch;
glColor3ub(255,0,0); 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); 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); BMF_DrawString(but->font, but->drawstr+but->ofs);
#endif
} }
} }
static void ui_draw_but_BUTM(uiBut *but) static void ui_draw_but_BUTM(uiBut *but)
{ {
float x; float x;
short len; short len, opt;
char *cpoin; char *cpoin;
but->embossfunc(but->col, but->aspect, but->x1, but->y1, but->x2, but->y2, but->flag); 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(cpoin) *cpoin= 0;
if(but->embossfunc==ui_emboss_P) { if(but->embossfunc==ui_emboss_P) {
if(but->flag & UI_ACTIVE) glColor3ub(255,255,255); if(but->flag & UI_ACTIVE) { opt = 1; glColor3ub(255,255,255); }
else glColor3ub(0,0,0); else { opt = 0; glColor3ub(0,0,0); }
} else { } else {
glColor3ub(0,0,0); opt = 0;glColor3ub(0,0,0);
} }
x= but->x1+4.0; x= but->x1+4.0;
glRasterPos2f( x, (but->y1+but->y2- 9.0)/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, 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); BMF_DrawString(but->font, but->drawstr);
#endif
if(cpoin) { 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); len= BMF_GetStringWidth(but->font, cpoin+1);
glRasterPos2f( but->x2 - len*but->aspect-3, (but->y1+but->y2- 9.0)/2.0); glRasterPos2f( but->x2 - len*but->aspect-3, (but->y1+but->y2- 9.0)/2.0);
BMF_DrawString(but->font, cpoin+1); BMF_DrawString(but->font, cpoin+1);
*cpoin= '|'; *cpoin= '|';
#endif
} }
} }
} }
@ -825,7 +931,17 @@ static void ui_draw_but_LABEL(uiBut *but)
glRasterPos2f( x, (but->y1+but->y2- 9.0)/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, 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); 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++; while (rows*columns<md->nitems) rows++;
/* size and location */ /* size and location */
if(md->title) width= 2*strlen(md->title)+BMF_GetStringWidth(block->curfont, md->title); #ifdef INTERNATIONAL
else width= 0; 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++) { 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); xmax= BMF_GetStringWidth(block->curfont, md->items[a].str);
#endif
if(xmax>width) width= xmax; if(xmax>width) width= xmax;
} }
@ -1796,11 +1941,33 @@ static int ui_do_but_TEX(uiBut *but)
/* calculate cursor pos with current mousecoords */ /* calculate cursor pos with current mousecoords */
BLI_strncpy(backstr, but->drawstr, UI_MAX_DRAW_STR); BLI_strncpy(backstr, but->drawstr, UI_MAX_DRAW_STR);
but->pos= strlen(backstr)-but->ofs; 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]) { while((but->aspect*BMF_GetStringWidth(but->font, backstr+but->ofs) + but->x1) > mval[0]) {
if (but->pos <= 0) break; if (but->pos <= 0) break;
but->pos--; but->pos--;
backstr[but->pos+but->ofs] = 0; backstr[but->pos+but->ofs] = 0;
} }
#endif
but->pos -= strlen(but->str); but->pos -= strlen(but->str);
but->pos += but->ofs; 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_MOUSE_OVER) {
if( (but->flag & UI_ACTIVE)==0) { if( (but->flag & UI_ACTIVE)==0) {
but->flag |= UI_ACTIVE; but->flag |= UI_ACTIVE;
ui_draw_but(but); if(but->type != LABEL) ui_draw_but(but);
} }
} }
/* hilite case 2 */ /* hilite case 2 */
if(but->flag & UI_ACTIVE) { if(but->flag & UI_ACTIVE) {
if( (but->flag & UI_MOUSE_OVER)==0) { if( (but->flag & UI_MOUSE_OVER)==0) {
but->flag &= ~UI_ACTIVE; but->flag &= ~UI_ACTIVE;
ui_draw_but(but); if(but->type != LABEL) ui_draw_but(but);
} }
if(but->flag & UI_ACTIVE) active= 1; if(but->flag & UI_ACTIVE) active= 1;
} }
@ -3074,8 +3241,29 @@ static uiSaveUnder *ui_draw_but_tip(uiBut *but)
uiSaveUnder *su; uiSaveUnder *su;
float x1, x2, y1, y2; float x1, x2, y1, y2;
x1= (but->x1+but->x2)/2; x2= 10+x1+ but->aspect*BMF_GetStringWidth(but->font, but->tip); #ifdef INTERNATIONAL
y1= but->y1-19; y2= but->y1-2; 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 */ /* for pulldown menus it doesnt work */
if(mywinget()==G.curscreen->mainwin); if(mywinget()==G.curscreen->mainwin);
@ -3111,7 +3299,17 @@ static uiSaveUnder *ui_draw_but_tip(uiBut *but)
glColor3ub(0,0,0); glColor3ub(0,0,0);
glRasterPos2f( x1+3, y1+4); 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); BMF_DrawString(but->font, but->tip);
#endif
glFinish(); /* for geforce, to show it in the frontbuffer */ glFinish(); /* for geforce, to show it in the frontbuffer */
return su; 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); #ifdef INTERNATIONAL
else but->strwidth= 0; 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 */ /* automatic width */
if(but->x2==0.0) { if(but->x2==0.0) {
@ -3571,7 +3795,19 @@ static void ui_check_but(uiBut *but)
but->ofs++; but->ofs++;
if(but->drawstr[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); but->strwidth= but->aspect*BMF_GetStringWidth(but->font, but->drawstr+but->ofs);
#endif
else but->strwidth= 0; else but->strwidth= 0;
/* textbut exception */ /* textbut exception */
@ -3902,12 +4138,40 @@ short pupmenu(char *instr)
md= decompose_menu_string(instr); md= decompose_menu_string(instr);
/* size and location, title slightly bigger for bold */ /* 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); if(md->title) width= 2*strlen(md->title)+BMF_GetStringWidth(uiBlockGetCurFont(block), md->title);
else width= 0; else width= 0;
for(a=0; a<md->nitems; a++) { for(a=0; a<md->nitems; a++) {
xmax= BMF_GetStringWidth(uiBlockGetCurFont(block), md->items[a].str); xmax= BMF_GetStringWidth(uiBlockGetCurFont(block), md->items[a].str);
if(xmax>width) width= xmax; if(xmax>width) width= xmax;
} }
#endif
width+= 10; width+= 10;
height= boxh*md->nitems; height= boxh*md->nitems;
@ -4019,12 +4283,39 @@ short pupmenu_col(char *instr, int maxrow)
while (rows*columns<md->nitems) rows++; while (rows*columns<md->nitems) rows++;
/* size and location */ /* 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); if(md->title) width= 2*strlen(md->title)+BMF_GetStringWidth(uiBlockGetCurFont(block), md->title);
else width= 0; else width= 0;
for(a=0; a<md->nitems; a++) { 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; if(xmax>width) width= xmax;
} }
#endif
width+= 10; width+= 10;
if (width<50) width=50; if (width<50) width=50;

@ -97,7 +97,7 @@ void mywindow_init_mainwin(Window *win, int orx, int ory, int sizex, int sizey)
mainwindow.ymax= ory+sizey-1; mainwindow.ymax= ory+sizey-1;
mainwindow.qevents= NULL; 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(); glLoadIdentity();
glGetFloatv(GL_PROJECTION_MATRIX, (float *)mainwindow.winmat); glGetFloatv(GL_PROJECTION_MATRIX, (float *)mainwindow.winmat);

@ -46,6 +46,10 @@
#include "MEM_guardedalloc.h" #include "MEM_guardedalloc.h"
#ifdef INTERNATIONAL
#include "BIF_language.h"
#endif
#include "IMB_imbuf_types.h" #include "IMB_imbuf_types.h"
#include "IMB_imbuf.h" #include "IMB_imbuf.h"
@ -1310,22 +1314,22 @@ void drawinfospace(void)
dx= (1280-90)/6; /* spacing for use in equally dividing 'tab' row */ dx= (1280-90)/6; /* spacing for use in equally dividing 'tab' row */
xpos = 45; /* left padding */ xpos = 45; /* left padding */
ypos = 72; /* bottom padding for buttons */ ypos = 50; /* bottom padding for buttons */
ypostab = 18; /* bottom padding for 'tab' row */ ypostab = 10; /* bottom padding for 'tab' row */
buth = 20; /* standard button height */ buth = 20; /* standard button height */
smallprefbut = 94; /* standard size for small preferences button */ smallprefbut = 94; /* standard size for small preferences button */
medprefbut = 193; /* standard size for medium preferences button */ medprefbut = 193; /* standard size for medium preferences button */
largeprefbut = 292; /* standard size for large preferences button */ largeprefbut = 292; /* standard size for large preferences button */
smfileselbut = buth; /* standard size for fileselect button (square) */ 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 */
edgespace = 3; /* space from edge of end 'tab' to edge of end button */ rspace = 3; /* default space between rows */
midspace = 5; /* horizontal space between buttons */
rspace = 4; /* default space between rows */
y1 = ypos; /* bottom padding of 1st (bottom) button row */ y1 = ypos; /* bottom padding of 1st (bottom) button row */
y2 = ypos+buth+rspace; /* bottom padding of 2nd 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,""); &U.userpref,1.0,3.0, 0, 0,"");
uiDefButI(block, ROW,B_USERPREF,"System & OpenGL", 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,""); &U.userpref,1.0,4.0, 0, 0,"");
uiDefButI(block, ROW,B_USERPREF,"File Paths", 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,""); &U.userpref,1.0,5.0, 0, 0,"");
uiBlockSetEmboss(block, UI_EMBOSSX); uiBlockSetEmboss(block, UI_EMBOSSX);
@ -1551,55 +1555,62 @@ void drawinfospace(void)
sprintf(curfont, "Interface Font: "); sprintf(curfont, "Interface Font: ");
strcat(curfont,U.fontname); strcat(curfont,U.fontname);
uiDefBut(block, LABEL,0,curfont, uiDefButS(block, TOG|BIT|5, B_DOLANGUIFONT, "International",
xpos,y2,medprefbut,buth, xpos,y2,medprefbut,buth,
0, 0, 0, 0, 0, ""); &(U.transopts), 0, 0, 0, 0, "Activate international interface");
uiBlockSetCol(block, BUTSALMON); if(U.transopts & TR_ALL) {
uiDefBut(block, LABEL,0,curfont,
(xpos+edgespace+medprefbut+midspace),y2,medprefbut,buth,
0, 0, 0, 0, 0, "");
uiDefBut(block, BUT, B_LOADUIFONT, "Select Font", uiBlockSetCol(block, BUTSALMON);
(xpos+edgespace),y1,medprefbut,buth, //(xpos+edgespace)
0, 0, 0, 0, 0, "Select a new font for the interface"); 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); uiBlockSetCol(block, BUTGREY);
uiDefButI(block, MENU|INT, B_SETFONTSIZE, fontsize_pup(), uiDefButI(block, MENU|INT, B_SETFONTSIZE, fontsize_pup(),
(xpos+edgespace+medprefbut+midspace),y2,medprefbut,buth, (xpos+edgespace+medprefbut+midspace),y1,medprefbut,buth,
&U.fontsize, 0, 0, 0, 0, "Current interface font size (points)"); &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, uiDefButS(block, MENU|SHO, B_SETENCODING, encoding_pup(),
&U.encoding, 0, 0, 0, 0, "Current interface font encoding"); (xpos+edgespace+medprefbut+midspace),y1,medprefbut,buth,
&U.encoding, 0, 0, 0, 0, "Current interface font encoding");
uiDefBut(block, LABEL,0,"Translate:",
(xpos+edgespace+(2.1*medprefbut)+(2*midspace)),y3label,medprefbut,buth,
0, 0, 0, 0, 0, "");
*/
uiDefBut(block, LABEL,0,"Translate:", uiDefButS(block, TOG|BIT|0, B_SETTRANSBUTS, "Tooltips",
(xpos+edgespace+(3*medprefbut)+(2*midspace)),y3label,medprefbut,buth, (xpos+edgespace+(2.2*medprefbut)+(3*midspace)),y1,smallprefbut,buth,
0, 0, 0, 0, 0, ""); &(U.transopts), 0, 0, 0, 0, "Translate tooltips");
uiDefButS(block, TOG|BIT|0, B_SETTRANSBUTS, "Tooltips", uiDefButS(block, TOG|BIT|1, B_SETTRANSBUTS, "Buttons",
(xpos+edgespace+(3*medprefbut)+(3*midspace)),y2,smallprefbut,buth, (xpos+edgespace+(2.2*medprefbut)+(4*midspace)+smallprefbut),y1,smallprefbut,buth,
&(U.transopts), 0, 0, 0, 0, "Translate tooltips"); &(U.transopts), 0, 0, 0, 0, "Translate button labels");
uiDefButS(block, TOG|BIT|1, B_SETTRANSBUTS, "Buttons", uiDefButS(block, TOG|BIT|2, B_SETTRANSBUTS, "Toolbox",
(xpos+edgespace+(3*medprefbut)+(4*midspace)+smallprefbut),y2,smallprefbut,buth, (xpos+edgespace+(2.2*medprefbut)+(5*midspace)+(2*smallprefbut)),y1,smallprefbut,buth,
&(U.transopts), 0, 0, 0, 0, "Translate button labels"); &(U.transopts), 0, 0, 0, 0, "Translate toolbox menu");
uiDefButS(block, TOG|BIT|2, B_SETTRANSBUTS, "Toolbox", uiDefButS(block, MENU|SHO, B_SETLANGUAGE, language_pup(),
(xpos+edgespace+(3*medprefbut)+(5*midspace)+(2*smallprefbut)),y2,smallprefbut,buth, (xpos+edgespace+(2.2*medprefbut)+(3*midspace)),y2,medprefbut+(0.5*medprefbut)+3,buth,
&(U.transopts), 0, 0, 0, 0, "Translate toolbox menu"); &U.language, 0, 0, 0, 0, "Select interface language");
uiDefButS(block, MENU|SHO, B_SETLANGUAGE, language_pup(), /* uiDefButS(block, TOG|BIT|3, B_SETTRANSBUTS, "FTF All windows",
(xpos+edgespace+(3*medprefbut)+(3*midspace)),y1,medprefbut,buth, (xpos+edgespace+(4*medprefbut)+(4*midspace)),y1,medprefbut,buth,
&U.language, 0, 0, 0, 0, "Select interface language"); &(U.transopts), 0, 0, 0, 0,
"Use FTF drawing for fileselect and textwindow "
/* uiDefButS(block, TOG|BIT|3, B_SETTRANSBUTS, "FTF All windows", "(under construction)");
(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 */ /* end of INTERNATIONAL */
#endif #endif
@ -1612,26 +1623,26 @@ void drawinfospace(void)
&(U.flag), 0, 0, 0, 0, &(U.flag), 0, 0, 0, 0,
"Enables automatic saving of temporary files"); "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", uiBlockSetCol(block, BUTGREY);
(xpos+edgespace),y1,medprefbut,buth,
0, 0, 0, 0, 0,"Opens the most recently saved temporary file");
uiBlockSetCol(block, BUTGREY);
uiDefButI(block, NUM, B_RESETAUTOSAVE, "Minutes:", uiDefButI(block, NUM, B_RESETAUTOSAVE, "Minutes:",
(xpos+edgespace+medprefbut+midspace),y2,medprefbut,buth, (xpos+edgespace+medprefbut+midspace),y2,medprefbut,buth,
&(U.savetime), 1.0, 60.0, 0, 0, &(U.savetime), 1.0, 60.0, 0, 0,
"The time (in minutes) to wait between automatic temporary saves"); "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");
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 */ } else if (U.userpref == 4) { /* system & opengl */
@ -1782,7 +1793,7 @@ static void changebutspace(ScrArea *sa, void *spacedata)
if(G.v2d==0) return; if(G.v2d==0) return;
test_view2d(G.v2d, curarea->winx, curarea->winy); 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) void winqreadbutspace(ScrArea *sa, void *spacedata, BWinEvent *evt)

@ -52,6 +52,9 @@
#include "MEM_guardedalloc.h" #include "MEM_guardedalloc.h"
#include "BMF_Api.h" #include "BMF_Api.h"
#ifdef INTERNATIONAL
#include "FTF_Api.h"
#endif
#include "BLI_blenlib.h" #include "BLI_blenlib.h"
#include "BLI_arithb.h" #include "BLI_arithb.h"
@ -60,6 +63,7 @@
#include "DNA_image_types.h" #include "DNA_image_types.h"
#include "DNA_object_types.h" #include "DNA_object_types.h"
#include "DNA_screen_types.h" #include "DNA_screen_types.h"
#include "DNA_userdef_types.h"
#include "DNA_view3d_types.h" #include "DNA_view3d_types.h"
#include "BKE_plugin_types.h" #include "BKE_plugin_types.h"
@ -498,7 +502,7 @@ void bgnpupdraw(int startx, int starty, int endx, int endy)
oldcursor= get_cursor(); oldcursor= get_cursor();
set_cursor(CURSOR_STD); set_cursor(CURSOR_STD);
tbfontyofs= (TBOXH-11)/2 +2; /* for toolbox */ tbfontyofs= (TBOXH-11)/2 +1; /* ypos text in toolbox */
} }
void endpupdraw(void) void endpupdraw(void)
@ -804,7 +808,6 @@ void tbox_drawelem_text(x, y, type)
tbox_setinfo(x, y); tbox_setinfo(x, y);
if(tbstr && tbstr[0]) { if(tbstr && tbstr[0]) {
len1= 5+BMF_GetStringWidth(G.font, tbstr); 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; if(keystr) len2= 5+BMF_GetStringWidth(G.font, keystr); else len2= 0;
while(len1>0 && (len1+len2+5>x2-x1) ) { while(len1>0 && (len1+len2+5>x2-x1) ) {
@ -813,9 +816,18 @@ void tbox_drawelem_text(x, y, type)
} }
glRasterPos2i(x1+5, y1+tbfontyofs); 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); BMF_DrawString(G.font, tbstr);
#endif
// if(tbstr1 && tbstr1[0]) {
if(keystr && keystr[0]) { if(keystr && keystr[0]) {
if(type & 1) { if(type & 1) {
ColorFunc(TBOXBLACK); ColorFunc(TBOXBLACK);
@ -823,14 +835,32 @@ void tbox_drawelem_text(x, y, type)
glRecti(x2-len2-2, y1+2, x2-3, y2-2); glRecti(x2-len2-2, y1+2, x2-3, y2-2);
ColorFunc(TBOXWHITE); ColorFunc(TBOXWHITE);
glRasterPos2i(x2-len2, y1+tbfontyofs); glRasterPos2i(x2-len2, y1+tbfontyofs);
// BMF_DrawString(G.font, tbstr1); #ifdef INTERNATIONAL
BMF_DrawString(G.font, keystr); 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 { else {
ColorFunc(TBOXBLACK); ColorFunc(TBOXBLACK);
glRasterPos2i(x2-len2, y1+tbfontyofs); glRasterPos2i(x2-len2, y1+tbfontyofs);
// BMF_DrawString(G.font, tbstr1); #ifdef INTERNATIONAL
BMF_DrawString(G.font, keystr); 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); cpack(0x0);
temp= 0; 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++; while( BMF_GetStringWidth(G.fonts, str+temp)>(x2 - x1-24)) temp++;
glRasterPos2i(x1+16, y2-30); glRasterPos2i(x1+16, y2-30);
BMF_DrawString(G.fonts, str+temp); BMF_DrawString(G.fonts, str+temp);
#endif
} }
int do_clever_numbuts(char *name, int tot, int winevent) int do_clever_numbuts(char *name, int tot, int winevent)

@ -52,6 +52,10 @@
#include "MEM_guardedalloc.h" #include "MEM_guardedalloc.h"
#include "BMF_Api.h" #include "BMF_Api.h"
#ifdef INTERNATIONAL
#include "FTF_Api.h"
#include "BIF_language.h"
#endif
#include "BLI_blenlib.h" #include "BLI_blenlib.h"
#include "BLI_arithb.h" #include "BLI_arithb.h"
@ -161,7 +165,7 @@ int BIF_read_homefile(void)
{ {
char tstr[FILE_MAXDIR+FILE_MAXFILE], scestr[FILE_MAXDIR]; char tstr[FILE_MAXDIR+FILE_MAXFILE], scestr[FILE_MAXDIR];
char *home= BLI_gethome(); char *home= BLI_gethome();
int success; int success, result;
BLI_make_file_string(G.sce, tstr, home, ".B.blend"); BLI_make_file_string(G.sce, tstr, home, ".B.blend");
strcpy(scestr, G.sce); /* temporal store */ strcpy(scestr, G.sce); /* temporal store */
@ -199,6 +203,32 @@ int BIF_read_homefile(void)
U.vrmlflag= USERDEF_VRML_LAYERS; 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(); space_set_commmandline_options();
reset_autosave(); reset_autosave();
@ -451,6 +481,10 @@ void BIF_init(void)
init_draw_rects(); /* drawobject.c */ init_draw_rects(); /* drawobject.c */
init_gl_stuff(); /* drawview.c */ init_gl_stuff(); /* drawview.c */
#ifdef INTERNATIONAL
readMultiLingualFiles();
#endif
BIF_read_homefile(); BIF_read_homefile();
readBlog(); readBlog();
@ -497,6 +531,9 @@ void exit_usiblender(void)
freeNurblist(&editNurb); freeNurblist(&editNurb);
fsmenu_free(); fsmenu_free();
#ifdef INTERNATIONAL
languagesmenu_free();
#endif
RE_free_render_data(); RE_free_render_data();
RE_free_filt_mask(); RE_free_filt_mask();