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:
@@ -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);
|
||||
|
@@ -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);
|
||||
|
@@ -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;
|
||||
|
@@ -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 (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;
|
||||
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;
|
||||
|
@@ -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);
|
||||
|
@@ -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) */
|
||||
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 */
|
||||
|
||||
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, "");
|
||||
&(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",
|
||||
(xpos+edgespace),y1,medprefbut,buth,
|
||||
0, 0, 0, 0, 0, "Select a new font for the interface");
|
||||
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);
|
||||
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)");
|
||||
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");
|
||||
/*
|
||||
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+(2.1*medprefbut)+(2*midspace)),y3label,medprefbut,buth,
|
||||
0, 0, 0, 0, 0, "");
|
||||
*/
|
||||
|
||||
uiDefBut(block, LABEL,0,"Translate:",
|
||||
(xpos+edgespace+(3*medprefbut)+(2*midspace)),y3label,medprefbut,buth,
|
||||
0, 0, 0, 0, 0, "");
|
||||
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|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|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|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|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, 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, 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)
|
||||
|
@@ -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)
|
||||
|
@@ -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();
|
||||
|
Reference in New Issue
Block a user