[Bf-committers] Test of new tooltip appearance

Kenneth Styrberg bf-committers@blender.org
Thu, 03 Jun 2004 23:19:21 +0200


This is a multi-part message in MIME format.
--------------010801000801060107030806
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Ok, here is a new diff. I checked what mouse coordinate function the 
space menu used and switched to the same.

//styken



--------------010801000801060107030806
Content-Type: text/plain;
 name="tooltip.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="tooltip.diff"

Index: interface.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/interface.c,v
retrieving revision 1.118
diff -u -r1.118 interface.c
--- interface.c	17 May 2004 14:36:13 -0000	1.118
+++ interface.c	3 Jun 2004 21:25:18 -0000
@@ -2835,81 +2835,93 @@
 {
 	uiSaveUnder *su;
 	float x1, x2, y1, y2;
+	short mouse[2];
+	int xmin = 0,xmax = 0,ymin = 0,ymax = 0;  //for BMF_GetBoundingBox(...)
+
+	getmouseco_sc(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);
-
-			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())-16; y2= but->y1-8;
-		} else {
+		}
+		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) {
+			/* Set x2 and y2 for code safe matters */
+			x2 = x1;
+			y2 = y1;
+		}
+		else {
+	
+			y1 -= 34;
+			y2 = y1 + (ury - lly) + 5;
 
-			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())-16; y2= but->y1-8;
+			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 {
-  		x1= (but->x1+but->x2)/2; x2= 10+x1+ but->aspect*BMF_GetStringWidth(but->font, but->tip);
-  		y1= but->y1-35; y2= but->y1-6;
+	}
+	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) {
+			/* Set x2 and y2 for code safe matters */
+			x2 = x1;
+			y2 = y1;
+		}
+		else {
+			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;
+
+	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
 
-	/* for pulldown menus it doesnt work */
-	if(mywinget()==G.curscreen->mainwin);
-	else {
-		ui_graphics_to_window(mywinget(), &x1, &y1);
-		ui_graphics_to_window(mywinget(), &x2, &y2);
-	}
-	
 	if(x2 > G.curscreen->sizex) {
 		x1 -= x2-G.curscreen->sizex;
 		x2= G.curscreen->sizex;
 	}
 	if(y1 < 0) {
-		y1 += 36;
-		y2 += 36;
+		y1 += 35;
+		y2 += 35;
 	}
 
-	// adjust tooltip heights
-	if(mywinget()==G.curscreen->mainwin)
-		y2 -= G.ui_international ? 4:1;		//tip is from pulldownmenu
-	else if(curarea->win != mywinget())
-		y2 -= G.ui_international ? 5:1;		//tip is from a windowheader
-//	else y2 += 1;							//tip is from button area
-
 	su= ui_bgnpupdraw((int)(x1-1), (int)(y1-2), (int)(x2+4), (int)(y2+4), 0);
 
-	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-	glEnable(GL_BLEND);
-
-	glColor4ub(0, 0, 0, 20);
-	
-	glBegin(GL_POLYGON);
-	gl_round_box(x1+3, y1-1, x2+1, y2-2, 2.0);
-	gl_round_box(x1+3, y1-2, x2+2, y2-2, 3.0);
-	
-	glColor4ub(0, 0, 0, 8);
-	
-	gl_round_box(x1+3, y1-3, x2+3, y2-3, 4.0);
-	gl_round_box(x1+3, y1-4, x2+4, y2-3, 5.0);
-	glEnd();
+	glColor3ub(0,0,0);
+	glRectf(x1-1, y1-1, x2+1, y2+1);
 
-	glDisable(GL_BLEND);
-	
 	glColor3ub(0xFF, 0xFF, 0xDD);
 	glRectf(x1, y1, x2, y2);
-	
+
 	glColor3ub(0,0,0);
-	glRasterPos2f( x1+3, y1+5);
-	BIF_DrawString(but->font, but->tip, (U.transopts & USER_TR_TOOLTIPS));
-	
+	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;
 }

--------------010801000801060107030806--