From 0ed095bbb17fc7852a5718a764ef6529a40a773f Mon Sep 17 00:00:00 2001 From: Rob Haarsma Date: Mon, 14 Jul 2003 13:48:44 +0000 Subject: [PATCH] Removed the old INTERNATIONAL Drawstring constructions. These are now handled through BIF_DrawString(...) in src/language.c, where it chooses between the old BMF and the new FTF DrawString. --- source/blender/src/headerbuttons.c | 72 +----- source/blender/src/interface.c | 344 ++++------------------------- source/blender/src/language.c | 64 +++++- source/blender/src/toolbox.c | 62 +----- source/blender/src/usiblender.c | 3 +- 5 files changed, 114 insertions(+), 431 deletions(-) diff --git a/source/blender/src/headerbuttons.c b/source/blender/src/headerbuttons.c index 3274d6b570c..d374d5a1bde 100644 --- a/source/blender/src/headerbuttons.c +++ b/source/blender/src/headerbuttons.c @@ -46,9 +46,9 @@ #include "MEM_guardedalloc.h" #include "BMF_Api.h" +#include "BIF_language.h" #ifdef INTERNATIONAL #include "FTF_Api.h" -#include "BIF_language.h" #endif #include "BLI_blenlib.h" @@ -3447,48 +3447,20 @@ static void info_text(int x, int y) glColor3ub(0, 0, 0); glRasterPos2i(x, y); -#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 + + BIF_DrawString(G.font, headerstr, (U.transopts & TR_MENUS), 0); glRasterPos2i(x+120, y); -#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 + + BIF_DrawString(G.font, infostr, (U.transopts & TR_MENUS), 0); } 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 + rt= BIF_GetStringWidth(G.font, str, (U.transopts & TR_BUTTONS)); - return rt; + return rt + 15; } @@ -5005,23 +4977,8 @@ 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 + BIF_DrawString(uiBlockGetCurFont(block), sfile->title, (U.transopts & TR_BUTTONS), 0); + xco+= BIF_GetStringWidth(G.font, sfile->title, (U.transopts & TR_BUTTONS)); uiDefIconButS(block, ICONTOG|BIT|0, B_SORTFILELIST, ICON_LONGDISPLAY,xco+=XIC,0,XIC,YIC, &sfile->flag, 0, 0, 0, 0, "Toggles long info"); uiDefIconButS(block, TOG|BIT|3, B_RELOADDIR, ICON_GHOST,xco+=XIC,0,XIC,YIC, &sfile->flag, 0, 0, 0, 0, "Hides dot files"); @@ -5044,16 +5001,7 @@ 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 - + BIF_DrawString(uiBlockGetCurFont(block), naam, 0, 0); } /* always do as last */ curarea->headbutlen= xco+2*XIC; diff --git a/source/blender/src/interface.c b/source/blender/src/interface.c index d2a6f9c27bb..21920d366e8 100644 --- a/source/blender/src/interface.c +++ b/source/blender/src/interface.c @@ -49,10 +49,11 @@ #include "PIL_time.h" -#include "BMF_Api.h" +#include "BMF_api.h" +#include "BIF_language.h" #ifdef INTERNATIONAL -#include "FTF_Api.h" -#endif +#include "FTF_api.h" +#endif // INTERNATIONAL #include "BLI_blenlib.h" #include "BLI_arithb.h" @@ -788,17 +789,7 @@ 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 + BIF_DrawString(but->font, but->drawstr+but->ofs, (U.transopts & TR_BUTTONS), but->flag & UI_SELECT); } /* if there's no text label, then check to see if there's an icon only and draw it */ else if( but->flag & UI_HAS_ICON ) { @@ -845,17 +836,7 @@ static void ui_draw_but_TOG3(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_DrawStringRGB(but->drawstr+but->ofs, FTF_USE_GETTEXT | FTF_INPUT_UTF8, r, g, b); - else - FTF_DrawStringRGB(but->drawstr+but->ofs, FTF_NO_TRANSCONV | FTF_INPUT_UTF8, r, g, b); - else - BMF_DrawString(but->font, but->drawstr+but->ofs); -#else - BMF_DrawString(but->font, but->drawstr+but->ofs); -#endif + BIF_DrawStringRGB(but->font, but->drawstr+but->ofs, (U.transopts & TR_BUTTONS), r, g, b); } } @@ -880,17 +861,8 @@ 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 + + t= but->aspect*BIF_GetStringWidth(but->font, but->drawstr+but->ofs, (U.transopts & TR_BUTTONS)) + 3; but->drawstr[pos]= ch; glColor3ub(255,0,0); @@ -907,17 +879,7 @@ 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 + BIF_DrawString(but->font, but->drawstr+but->ofs, (U.transopts & TR_BUTTONS), sel); } } @@ -963,50 +925,13 @@ static void ui_draw_but_BUTM(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, FTF_USE_GETTEXT | FTF_INPUT_UTF8, sel); - } - else { - FTF_DrawString(but->drawstr, FTF_NO_TRANSCONV | FTF_INPUT_UTF8, sel); - } - } - else { - BMF_DrawString(but->font, but->drawstr); - } -#else - BMF_DrawString(but->font, but->drawstr); -#endif + BIF_DrawString(but->font, but->drawstr, (U.transopts & TR_BUTTONS), sel); 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= BIF_GetStringWidth(but->font, cpoin+1, (U.transopts & TR_BUTTONS)); glRasterPos2f( but->x2 - len*but->aspect-3, (but->y1+but->y2- 9.0)/2.0); - BMF_DrawString(but->font, cpoin+1); + BIF_DrawString(but->font, cpoin+1, (U.transopts & TR_BUTTONS), but->flag & UI_ACTIVE); *cpoin= '|'; -#endif } } /* if there's no text label, then check to see if there's an icon only and draw it */ @@ -1043,21 +968,7 @@ 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 + BIF_DrawString(but->font, but->drawstr+but->ofs, (U.transopts & TR_BUTTONS), sel); } /* if there's no text label, then check to see if there's an icon only and draw it */ else if( but->flag & UI_HAS_ICON ) { @@ -1345,18 +1256,9 @@ void uiTextBoundsBlock(uiBlock *block, int addval) bt= block->buttons.first; while(bt) { if(bt->type!=SEPR) { -#ifdef INTERNATIONAL - if(G.ui_international == TRUE) - if(U.transopts & TR_BUTTONS) - j= FTF_GetStringWidth(bt->drawstr, FTF_USE_GETTEXT | FTF_INPUT_UTF8); - else - j= FTF_GetStringWidth(bt->drawstr, FTF_NO_TRANSCONV | FTF_INPUT_UTF8); - else - j= BMF_GetStringWidth(bt->font, bt->drawstr); -#else - j= BMF_GetStringWidth(bt->font, bt->drawstr); -#endif - if(j > i) i = j; + j= BIF_GetStringWidth(bt->font, bt->drawstr, (U.transopts & TR_BUTTONS)); + + if(j > i) i = j; } bt= bt->next; } @@ -1767,39 +1669,13 @@ static int ui_do_but_MENU(uiBut *but) while (rows*columnsnitems) rows++; /* size and location */ -#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); + width= 2*strlen(md->title)+BIF_GetStringWidth(block->curfont, md->title, (U.transopts & TR_MENUS)); else width= 0; -#endif + for(a=0; anitems; 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 + xmax= BIF_GetStringWidth(block->curfont, md->items[a].str, (U.transopts & TR_MENUS)); if(xmax>width) width= xmax; } @@ -2124,33 +2000,12 @@ 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]) { + + while((but->aspect*BIF_GetStringWidth(but->font, backstr+but->ofs, (U.transopts & TR_BUTTONS)) + 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; @@ -2524,39 +2379,13 @@ static int ui_do_but_ICONTEXTROW(uiBut *but) /* size and location */ /* expand menu width to fit labels */ -#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); + width= 2*strlen(md->title)+BIF_GetStringWidth(block->curfont, md->title, (U.transopts & TR_MENUS)); else width= 0; -#endif + for(a=0; anitems; 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 + xmax= BIF_GetStringWidth(block->curfont, md->items[a].str, (U.transopts & TR_MENUS)); if(xmax>width) width= xmax; } @@ -3600,17 +3429,7 @@ 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 + BIF_DrawString(but->font, but->tip, (U.transopts & TR_TOOLTIPS), 0); glFinish(); /* to show it in the frontbuffer */ return su; @@ -4093,36 +3912,13 @@ static void ui_check_but(uiBut *but) strcpy(but->drawstr, but->str); } - -#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->drawstr[0]) + but->strwidth= but->aspect*BIF_GetStringWidth(but->font, but->drawstr, (U.transopts & TR_BUTTONS)); + else + but->strwidth= 0; + + /* automatic width */ if(but->x2==0.0) { but->x2= (but->x1+but->strwidth+6); } @@ -4133,19 +3929,7 @@ 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 + but->strwidth= but->aspect*BIF_GetStringWidth(but->font, but->drawstr+but->ofs, (U.transopts & TR_BUTTONS)); else but->strwidth= 0; /* textbut exception */ @@ -4517,39 +4301,12 @@ 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; anitems; 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; anitems; 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; anitems; 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)+BIF_GetStringWidth(uiBlockGetCurFont(block), md->title, (U.transopts && TR_BUTTONS)); else width= 0; for(a=0; anitems; a++) { - xmax= BMF_GetStringWidth(uiBlockGetCurFont(block), md->items[a].str); + xmax= BIF_GetStringWidth(uiBlockGetCurFont(block), md->items[a].str, (U.transopts && TR_BUTTONS)); if(xmax>width) width= xmax; } -#endif width+= 10; @@ -4659,39 +4416,12 @@ short pupmenu_col(char *instr, int maxrow) while (rows*columnsnitems) 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; anitems; 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; anitems; 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; anitems; 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)+BIF_GetStringWidth(uiBlockGetCurFont(block), md->title, (U.transopts & TR_BUTTONS)); else width= 0; for(a=0; anitems; a++) { - xmax= BMF_GetStringWidth(uiBlockGetCurFont(block), md->items[a].str); + xmax= BIF_GetStringWidth(uiBlockGetCurFont(block), md->items[a].str, (U.transopts & TR_BUTTONS)); if(xmax>width) width= xmax; } -#endif width+= 10; if (width<50) width=50; diff --git a/source/blender/src/language.c b/source/blender/src/language.c index 245e21c7d77..a8cfb2283f3 100644 --- a/source/blender/src/language.c +++ b/source/blender/src/language.c @@ -27,9 +27,6 @@ * ***** END GPL/BL DUAL LICENSE BLOCK ***** */ -/* dynamic popup generation for languages */ - -#ifdef INTERNATIONAL #include #include @@ -50,6 +47,9 @@ #include "mydevice.h" /* REDRAWALL */ +#include "BMF_Api.h" + +#ifdef INTERNATIONAL #include "FTF_Api.h" typedef struct _LANGMenuEntry LANGMenuEntry; @@ -63,9 +63,65 @@ struct _LANGMenuEntry { }; static LANGMenuEntry *langmenu= 0; - static int tot_lang = 0; +#endif // INTERNATIONAL +int BIF_DrawString(BMF_Font* font, char *str, int translate, int col) +{ + +#ifdef INTERNATIONAL + if(G.ui_international == TRUE) + if(translate) + return FTF_DrawString(str, FTF_USE_GETTEXT | FTF_INPUT_UTF8, col); + else + return FTF_DrawString(str, FTF_NO_TRANSCONV | FTF_INPUT_UTF8, col); + else + return BMF_DrawString(font, str); +#else + return BMF_DrawString(font, str); +#endif + +} + +int BIF_DrawStringRGB(BMF_Font* font, char *str, int translate, float r, float g, float b) +{ + +#ifdef INTERNATIONAL + if(G.ui_international == TRUE) + if(translate) + return FTF_DrawStringRGB(str, FTF_USE_GETTEXT | FTF_INPUT_UTF8, r, g, b); + else + return FTF_DrawStringRGB(str, FTF_NO_TRANSCONV | FTF_INPUT_UTF8, r, g, b); + else + return BMF_DrawString(font, str); +#else + return BMF_DrawString(font, str); +#endif + +} + + +float BIF_GetStringWidth(BMF_Font* font, char *str, int translate) +{ + float rt; + +#ifdef INTERNATIONAL + if(G.ui_international == TRUE) //versionnumber + if(U.transopts & TR_BUTTONS) + rt= FTF_GetStringWidth(str, FTF_USE_GETTEXT | FTF_INPUT_UTF8); + else + rt= FTF_GetStringWidth(str, FTF_NO_TRANSCONV | FTF_INPUT_UTF8); + else + rt= BMF_GetStringWidth(font, str); +#else + rt= BMF_GetStringWidth(font, str); +#endif + + return rt; +} + + +#ifdef INTERNATIONAL char *fontsize_pup(void) { diff --git a/source/blender/src/toolbox.c b/source/blender/src/toolbox.c index 0b41ef47cc8..8b78f018570 100644 --- a/source/blender/src/toolbox.c +++ b/source/blender/src/toolbox.c @@ -52,9 +52,7 @@ #include "MEM_guardedalloc.h" #include "BMF_Api.h" -#ifdef INTERNATIONAL -#include "FTF_Api.h" -#endif +#include "BIF_language.h" #include "BLI_blenlib.h" #include "BLI_arithb.h" @@ -843,17 +841,7 @@ 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, (type==0 || type==2)?0:1); - else - FTF_DrawString(tbstr, FTF_NO_TRANSCONV | FTF_INPUT_UTF8, (type==0 || type==2)?0:1); - else - BMF_DrawString(G.font, tbstr); -#else - BMF_DrawString(G.font, tbstr); -#endif + BIF_DrawString(G.font, tbstr, (U.transopts & TR_MENUS), (type==0 || type==2)?0:1); if(keystr && keystr[0]) { if(type & 1) { @@ -862,32 +850,12 @@ void tbox_drawelem_text(x, y, type) glRecti(x2-len2-2, y1+2, x2-3, y2-2); ColorFunc(TBOXWHITE); glRasterPos2i(x2-len2, y1+tbfontyofs); -#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 + BIF_DrawString(G.font, keystr, (U.transopts & TR_MENUS), 1); } else { ColorFunc(TBOXBLACK); glRasterPos2i(x2-len2, y1+tbfontyofs); -#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 + BIF_DrawString(G.font, keystr, (U.transopts & TR_MENUS), 0); } } } @@ -1301,27 +1269,9 @@ 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++; + while( BIF_GetStringWidth(G.fonts, str+temp, (U.transopts & TR_BUTTONS))>(x2 - x1-24)) temp++; glRasterPos2i(x1+16, y2-30); - BMF_DrawString(G.fonts, str+temp); -#endif + BIF_DrawString(G.fonts, str+temp, (U.transopts & TR_BUTTONS), 0); } int do_clever_numbuts(char *name, int tot, int winevent) diff --git a/source/blender/src/usiblender.c b/source/blender/src/usiblender.c index 29f2b3d6a28..935bb2e65fa 100644 --- a/source/blender/src/usiblender.c +++ b/source/blender/src/usiblender.c @@ -51,7 +51,6 @@ #include "BMF_Api.h" #ifdef INTERNATIONAL -#include "FTF_Api.h" #include "BIF_language.h" #endif @@ -137,7 +136,7 @@ void BIF_read_file(char *name) extern short winqueue_break; /* editscreen.c */ extern char datatoc_splash_jpg[]; extern int datatoc_splash_jpg_size; - char infostring[400]; + //here? //sound_end_all_sounds();