[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17659] branches/blender2.5/blender/source /blender/editors/interface/interface_draw.c: * Added checkmarks to ' table buttons' as used in RNA viewer.

Matt Ebb matt at mke3.net
Mon Dec 1 07:53:00 CET 2008


Revision: 17659
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17659
Author:   broken
Date:     2008-12-01 07:53:00 +0100 (Mon, 01 Dec 2008)

Log Message:
-----------
* Added checkmarks to 'table buttons' as used in RNA viewer. Helps to distinguish them
a bit better.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/interface/interface_draw.c

Modified: branches/blender2.5/blender/source/blender/editors/interface/interface_draw.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/interface/interface_draw.c	2008-12-01 06:52:18 UTC (rev 17658)
+++ branches/blender2.5/blender/source/blender/editors/interface/interface_draw.c	2008-12-01 06:53:00 UTC (rev 17659)
@@ -678,8 +678,36 @@
 	/* end outline */
 }
 
+static void ui_checkmark_box(int colorid, float x1, float y1, float x2, float y2)
+{
+	uiSetRoundBox(15);
+	UI_ThemeColorShade(colorid, -5);
+	gl_round_box_shade(GL_POLYGON, x1+4, (y1+(y2-y1)/2)-5, x1+14, (y1+(y2-y1)/2)+4, 2, -0.04, 0.03);
+	
+	UI_ThemeColorShade(colorid, -30);
+	gl_round_box(GL_LINE_LOOP, x1+4, (y1+(y2-y1)/2)-5, x1+14, (y1+(y2-y1)/2)+4, 2);
+
+}
+static void ui_checkmark(float x1, float y1, float x2, float y2)
+{
+	glEnable( GL_LINE_SMOOTH );
+	glEnable( GL_BLEND );
+	glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
+	glLineWidth(1.5);
+	
+	glBegin( GL_LINE_STRIP );
+	glVertex2f(x1+5, (y1+(y2-y1)/2)-1);
+	glVertex2f(x1+8, (y1+(y2-y1)/2)-4);
+	glVertex2f(x1+13, (y1+(y2-y1)/2)+5);
+	glEnd();
+	
+	glLineWidth(1.0);
+	glDisable( GL_BLEND );
+	glDisable( GL_LINE_SMOOTH );	
+}
+
 /* small side double arrow for iconrow */
-static void ui_default_iconrow_arrows(float x1, float y1, float x2, float y2)
+static void ui_iconrow_arrows(float x1, float y1, float x2, float y2)
 {
 	glEnable( GL_POLYGON_SMOOTH );
 	glEnable( GL_BLEND );
@@ -702,7 +730,7 @@
 }
 
 /* side double arrow for menu */
-static void ui_default_menu_arrows(float x1, float y1, float x2, float y2)
+static void ui_menu_arrows(float x1, float y1, float x2, float y2)
 {
 	/* 'point' first, then two base vertices */
 	uiTriangleFakeAA(x2-9, (y2-(y2-y1)/2)+6,
@@ -715,7 +743,7 @@
 }
 
 /* left/right arrows for number fields */
-static void ui_default_num_arrows(float x1, float y1, float x2, float y2)
+static void ui_num_arrows(float x1, float y1, float x2, float y2)
 {
 	if( x2-x1 > 25) {	// 25 is a bit arbitrary, but small buttons cant have arrows
 
@@ -851,7 +879,7 @@
 			} else {
 				UI_ThemeColorShade(colorid, -45);
 			}
-				ui_default_iconrow_arrows(x1, y1, x2, y2);
+				ui_iconrow_arrows(x1, y1, x2, y2);
 			/* end iconrow double arrow */
 			break;
 		case MENU:
@@ -861,7 +889,7 @@
 			} else {
 				UI_ThemeColorShade(colorid, -80);
 			}
-			ui_default_menu_arrows(x1, y1, x2, y2);
+			ui_menu_arrows(x1, y1, x2, y2);
 			/* end menu double arrow */
 			break;
 	}	
@@ -931,33 +959,14 @@
 				/* check to see that there's room for the check mark
 				* draw a check mark, or if it's a TOG3, draw a + or - */
 				if (x2 - x1 > 20) {
-					uiSetRoundBox(15);
-					UI_ThemeColorShade(colorid, -5);
-					gl_round_box_shade(GL_POLYGON, x1+4, (y1+(y2-y1)/2)-5, x1+14, (y1+(y2-y1)/2)+4, 2, -0.04, 0.03);
+					ui_checkmark_box(colorid, x1, y1, x2, y2);
 					
-					UI_ThemeColorShade(colorid, -20);
-					gl_round_box(GL_LINE_LOOP, x1+4, (y1+(y2-y1)/2)-5, x1+14, (y1+(y2-y1)/2)+4, 2);
-					
 					/* TOG3 is handled with ui_tog3_invert() 
 						*  remember to update checkmark drawing there too*/
 					if((flag & UI_SELECT) && (type != TOG3)) {
 						UI_ThemeColorShade(colorid, -140);
-						
-						glEnable( GL_LINE_SMOOTH );
-						glEnable( GL_BLEND );
-						glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
-						glLineWidth(1.5);
-						
-						/* checkmark */
-						glBegin( GL_LINE_STRIP );
-						glVertex2f(x1+5, (y1+(y2-y1)/2)-1);
-						glVertex2f(x1+8, (y1+(y2-y1)/2)-4);
-						glVertex2f(x1+13, (y1+(y2-y1)/2)+5);
-						glEnd();
-						
-						glLineWidth(1.0);
-						glDisable( GL_BLEND );
-						glDisable( GL_LINE_SMOOTH );		
+	
+						ui_checkmark(x1, y1, x2, y2);
 					}
 					/* draw a dot: alternate, for layers etc. */
 				} else if(flag & UI_SELECT) {
@@ -994,7 +1003,7 @@
 				else UI_ThemeColorShade(colorid, -20);
 			}
 			
-			ui_default_num_arrows(x1, y1, x2, y2);
+			ui_num_arrows(x1, y1, x2, y2);
 			/* end side arrows */
 			break;
 	}	
@@ -1182,7 +1191,7 @@
 	
 		/* ICONROW DOUBLE-ARROW  */
 		M_DARK;
-		ui_default_iconrow_arrows(x1, y1, x2, y2);
+		ui_iconrow_arrows(x1, y1, x2, y2);
 		/* END ICONROW DOUBLE-ARROW */
 		break;
 	case MENU:
@@ -1197,7 +1206,7 @@
 	
 		/* MENU DOUBLE-ARROW  */
 		M_DARK;
-		ui_default_menu_arrows(x1, y1, x2, y2);
+		ui_menu_arrows(x1, y1, x2, y2);
 		/* MENU DOUBLE-ARROW */
 		break;
 	}	
@@ -1360,7 +1369,7 @@
 			else M_LGREY;
 		}
 		
-		ui_default_num_arrows(x1, y1, x2, y2);
+		ui_num_arrows(x1, y1, x2, y2);
 		/* END SIDE ARROWS */
 	}
 }
@@ -1535,7 +1544,7 @@
 	case NUMABS:
 		if(flag & UI_SELECT) UI_ThemeColorShade(colorid, -60);
 		else UI_ThemeColorShade(colorid, -30);
-		ui_default_num_arrows(x1, y1, x2, y2);
+		ui_num_arrows(x1, y1, x2, y2);
 		break;
 
 	case ICONROW: 
@@ -1545,7 +1554,7 @@
 		glRectf(x2-9, y1+asp, x2-asp, y2-asp);
 
 		UI_ThemeColorShade(colorid, -50);
-		ui_default_iconrow_arrows(x1, y1, x2, y2);
+		ui_iconrow_arrows(x1, y1, x2, y2);
 		break;
 		
 	case MENU: 
@@ -1554,7 +1563,7 @@
 		glRectf(x2-17, y1+asp, x2-asp, y2-asp);
 
 		UI_ThemeColorShade(colorid, -50);
-		ui_default_menu_arrows(x1, y1, x2, y2);
+		ui_menu_arrows(x1, y1, x2, y2);
 		break;
 	}
 	
@@ -1685,19 +1694,19 @@
 	case NUM:
 	case NUMABS:
 		UI_ThemeColorShade(colorid, curshade-60);
-		ui_default_num_arrows(x1, y1, x2, y2);
+		ui_num_arrows(x1, y1, x2, y2);
 		break;
 
 	case ICONROW: 
 	case ICONTEXTROW: 
 		UI_ThemeColorShade(colorid, curshade-60);
-		ui_default_iconrow_arrows(x1, y1, x2, y2);
+		ui_iconrow_arrows(x1, y1, x2, y2);
 		break;
 		
 	case MENU: 
 	case BLOCK: 
 		UI_ThemeColorShade(colorid, curshade-60);
-		ui_default_menu_arrows(x1, y1, x2, y2);
+		ui_menu_arrows(x1, y1, x2, y2);
 		break;
 	}
 }
@@ -1796,7 +1805,7 @@
 	case NUMABS:
 		if(flag & UI_SELECT) UI_ThemeColorShade(colorid, -60);
 		else UI_ThemeColorShade(colorid, -30);
-		ui_default_num_arrows(x1, y1, x2, y2);
+		ui_num_arrows(x1, y1, x2, y2);
 		break;
 
 	case ICONROW: 
@@ -1806,7 +1815,7 @@
 		glRectf(x2-9, y1+asp, x2-asp, y2-asp);
 
 		UI_ThemeColorShade(colorid, -50);
-		ui_default_iconrow_arrows(x1, y1, x2, y2);
+		ui_iconrow_arrows(x1, y1, x2, y2);
 		break;
 		
 	case MENU: 
@@ -1816,7 +1825,7 @@
 		glRectf(x2-17, y1+asp, x2-asp, y2-asp);
 
 		UI_ThemeColorShade(colorid, -50);
-		ui_default_menu_arrows(x1, y1, x2, y2);
+		ui_menu_arrows(x1, y1, x2, y2);
 		break;
 	}
 	
@@ -2908,9 +2917,18 @@
 	case NUMABS:
 		if(flag & UI_SELECT) UI_ThemeColorShade(colorid, -120);
 		else UI_ThemeColorShade(colorid, -90);
-		ui_default_num_arrows(x1, y1, x2, y2);
+		ui_num_arrows(x1, y1, x2, y2);
 		break;
 
+	case TOG:
+		ui_checkmark_box(colorid, x1, y1, x2, y2);
+		
+		if(flag & UI_SELECT) {
+			UI_ThemeColorShade(colorid, -140);
+			ui_checkmark(x1, y1, x2, y2);
+		}
+		break;
+		
 	case ICONROW: 
 	case ICONTEXTROW: 
 		if(flag & UI_ACTIVE) UI_ThemeColorShade(colorid, 0);
@@ -2918,7 +2936,7 @@
 		glRectf(x2-9, y1+asp, x2-asp, y2-asp);
 
 		UI_ThemeColorShade(colorid, -50);
-		ui_default_iconrow_arrows(x1, y1, x2, y2);
+		ui_iconrow_arrows(x1, y1, x2, y2);
 		break;
 		
 	case MENU: 
@@ -2928,7 +2946,7 @@
 		glRectf(x2-17, y1+asp, x2-asp, y2-asp);
 
 		UI_ThemeColorShade(colorid, -50);
-		ui_default_menu_arrows(x1, y1, x2, y2);
+		ui_menu_arrows(x1, y1, x2, y2);
 		break;
 	}
 }





More information about the Bf-blender-cvs mailing list