[Bf-committers] Test of new tooltip appearance
Kenneth Styrberg
bf-committers@blender.org
Sun, 23 May 2004 23:22:00 +0200
While waiting for feedback on my previous post. I went ahead and rewrote
the code for international fonts as well.
I might be doing something nobody want to have, but I feel it's an
improvemnt of the tooltip appearance.
Comments?
//styken
/cvsroot/bf-blender/blender/source/blender/src/interface.c
~ Line: 2834
static uiSaveUnder *ui_draw_but_tip(uiBut *but)
{
uiSaveUnder *su;
float x1, x2, y1, y2;
short mouse[2];
int xmin = 0,xmax = 0,ymin = 0,ymax = 0; //for BMF_GetBoundingBox(...)
uiGetMouse(mywinget(), mouse);
#ifdef INTERNATIONAL
if(G.ui_international == TRUE) {
float llx,lly,llz,urx,ury,urz; //for FTF_GetBoundingBox()
x1 = mouse[0] + 1;
y1 = mouse[1];
if(U.transopts & USER_TR_TOOLTIPS) {
FTF_GetBoundingBox(but->tip, &llx,&lly,&llz,&urx,&ury,&urz,
FTF_USE_GETTEXT | FTF_INPUT_UTF8);
} else {
FTF_GetBoundingBox(but->tip, &llx,&lly,&llz,&urx,&ury,&urz,
FTF_NO_TRANSCONV | FTF_INPUT_UTF8);
}
/* for pulldown menus it doesnt work */
if(mywinget()==G.curscreen->mainwin);
else {
ui_graphics_to_window(mywinget(), &x1, &y1);
y1 -= 34;
y2 = y1 + (ury - lly) + 5;
if(U.transopts & USER_TR_TOOLTIPS) {
x2 = 4 + x1 + FTF_GetStringWidth(but->tip,
FTF_USE_GETTEXT | FTF_INPUT_UTF8);
} else {
x2 = 4 + x1 + FTF_GetStringWidth(but->tip,
FTF_NO_TRANSCONV | FTF_INPUT_UTF8);
}
}
} else {
BMF_GetBoundingBox(UIfont[0].medium, &xmin, &ymin, &xmax, &ymax);
x1 = mouse[0] + 1;
y1 = mouse[1];
/* for pulldown menus it doesnt work */
if(mywinget()==G.curscreen->mainwin);
else {
ui_graphics_to_window(mywinget(), &x1, &y1);
y1 -= 34;
x2 = 4 + x1 + BMF_GetStringWidth(UIfont[0].medium, but->tip);
y2 = y1 + (ymax - ymin) + 2;
}
}
#else
x1= (but->x1+but->x2)/2; x2= 10+x1+
but->aspect*BMF_GetStringWidth(but->font, but->tip);
y1= but->y1-35; y2= but->y1-10;
#endif
if(x2 > G.curscreen->sizex) {
x1 -= x2-G.curscreen->sizex;
x2= G.curscreen->sizex;
}
if(y1 < 0) {
y1 += 35;
y2 += 35;
}
su= ui_bgnpupdraw((int)(x1-1), (int)(y1-2), (int)(x2+4),
(int)(y2+4), 0);
glColor3ub(0,0,0);
glRectf(x1-1, y1-1, x2+1, y2+1);
glColor3ub(0xFF, 0xFF, 0xDD);
glRectf(x1, y1, x2, y2);
glColor3ub(0,0,0);
glRasterPos2f(x1+3, y1+4);
BIF_DrawString(UIfont[0].medium, but->tip, (U.transopts &
USER_TR_TOOLTIPS));
glFinish(); /* to show it in the frontbuffer */
return su;
}