[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [19280] branches/blender2.5/blender/source /blender/editors/interface: * UI tweaking

Matt Ebb matt at mke3.net
Sat Mar 14 04:24:24 CET 2009


Revision: 19280
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19280
Author:   broken
Date:     2009-03-14 04:24:23 +0100 (Sat, 14 Mar 2009)

Log Message:
-----------
* UI tweaking

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

Modified: branches/blender2.5/blender/source/blender/editors/interface/interface_draw.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/interface/interface_draw.c	2009-03-14 02:52:16 UTC (rev 19279)
+++ branches/blender2.5/blender/source/blender/editors/interface/interface_draw.c	2009-03-14 03:24:23 UTC (rev 19280)
@@ -2208,24 +2208,16 @@
 static void ui_draw_text(uiBut *but, float x, float y, int sunken)
 {
 	int alpha_offs= (but->flag & UI_BUT_DISABLED)?UI_DISABLED_ALPHA_OFFS:0;
-	int col_offs = 0;
 	int transopts;
 	int len;
+	float ypos = (sunken==BUT_TEXT_SUNKEN) ? (y-1) : y;
 	char *cpoin;
 	
-	if (sunken) {
-		y -= 1.0;
-		col_offs = 200;
+	if(but->type==LABEL && but->min!=0.0) {
+		UI_ThemeColor(TH_BUT_TEXT_HI);
 	}
-	
-	/* text color, with pulldown item exception */
-	if(but->dt==UI_EMBOSSP) {
-		if (sunken) {
-			float col[3];
-			UI_GetThemeColor3fv(TH_MENU_TEXT, col);
-			if ((col[0] + col[1] + col[2]) / 3.f < 0.5f)
-				UI_ThemeColorShadeAlpha(TH_HEADER, 20, alpha_offs);
-		} else if((but->flag & UI_ACTIVE) && but->type!=LABEL) {	// LABEL = title in pulldowns
+	else if(but->dt==UI_EMBOSSP) {
+		if((but->flag & UI_ACTIVE) && but->type!=LABEL) {	// LABEL = title in pulldowns
 			UI_ThemeColorShadeAlpha(TH_MENU_TEXT_HI, 0, alpha_offs);
 		} else {
 			UI_ThemeColorShadeAlpha(TH_MENU_TEXT, 0, alpha_offs);
@@ -2233,16 +2225,25 @@
 	}
 	else {
 		if(but->flag & UI_SELECT) {		
-			UI_ThemeColorShadeAlpha(TH_BUT_TEXT_HI, col_offs, alpha_offs);
+			UI_ThemeColorShadeAlpha(TH_BUT_TEXT_HI, 0, alpha_offs);
 		} else {
-			UI_ThemeColorShadeAlpha(TH_BUT_TEXT, col_offs, alpha_offs);
+			UI_ThemeColorShadeAlpha(TH_BUT_TEXT, 0, alpha_offs);
 		}
 	}
 	
-	/* LABEL button exception */
-	if(but->type==LABEL && but->min!=0.0) UI_ThemeColorShade(TH_BUT_TEXT_HI, col_offs);
+	if (sunken == BUT_TEXT_SUNKEN) {
+		float curcol[3];
+
+		glGetFloatv(GL_CURRENT_COLOR, curcol);		
+
+		/* only draw embossed text if the text color is darker than 0.5 mid-grey */
+		if ((curcol[0] + curcol[1] + curcol[3]) * 0.3f < 0.5f)
+			glColor4f(1.0f, 1.0f, 1.0f, 0.25f);
+		else
+			return;
+	}
 	
-	ui_rasterpos_safe(x, y, but->aspect);
+	ui_rasterpos_safe(x, ypos, but->aspect);
 	if(but->type==IDPOIN) transopts= 0;	// no translation, of course!
 	else transopts= ui_translate_buttons();
 	
@@ -2262,7 +2263,7 @@
 	/* part text right aligned */
 	if(cpoin) {
 		len= UI_GetStringWidth(but->font, cpoin+1, ui_translate_buttons());
-		ui_rasterpos_safe( but->x2 - len*but->aspect-3, y, but->aspect);
+		ui_rasterpos_safe( but->x2 - len*but->aspect-3, ypos, but->aspect);
 		UI_DrawString(but->font, cpoin+1, ui_translate_buttons());
 		*cpoin= '|';
 	}

Modified: branches/blender2.5/blender/source/blender/editors/interface/resources.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/interface/resources.c	2009-03-14 02:52:16 UTC (rev 19279)
+++ branches/blender2.5/blender/source/blender/editors/interface/resources.c	2009-03-14 03:24:23 UTC (rev 19280)
@@ -363,14 +363,14 @@
 	
 	UI_SetTheme(NULL);	// make sure the global used in this file is set
 
-	/* UI buttons (todo) */
-	SETCOL(btheme->tui.outline, 	0xA0,0xA0,0xA0, 255);
-	SETCOL(btheme->tui.neutral, 	180, 180, 180, 255);
-	SETCOL(btheme->tui.action, 		180, 180, 180, 255);
-	SETCOL(btheme->tui.setting, 	180, 180, 180, 255);
-	SETCOL(btheme->tui.setting1, 	180, 180, 180, 255);
-	SETCOL(btheme->tui.setting2, 	180, 180, 180, 255);
-	SETCOL(btheme->tui.num,		 	180, 180, 180, 255);
+	/* UI buttons */
+	SETCOL(btheme->tui.outline, 	130, 130, 130, 255);
+	SETCOL(btheme->tui.neutral, 	165, 165, 165, 255);
+	SETCOL(btheme->tui.action, 		165, 165, 165, 255);
+	SETCOL(btheme->tui.setting, 	165, 165, 165, 255);
+	SETCOL(btheme->tui.setting1, 	165, 165, 165, 255);
+	SETCOL(btheme->tui.setting2, 	165, 165, 165, 255);
+	SETCOL(btheme->tui.num,		 	165, 165, 165, 255);
 	SETCOL(btheme->tui.textfield,	143, 142, 143, 255);
 	SETCOL(btheme->tui.textfield_hi,255, 151, 26,  255);
 	SETCOL(btheme->tui.popup,		174, 174, 174, 255);
@@ -391,7 +391,7 @@
 	SETCOL(btheme->tv3d.back,       90, 90, 90, 255);
 	SETCOL(btheme->tv3d.text,       0, 0, 0, 255);
 	SETCOL(btheme->tv3d.text_hi, 255, 255, 255, 255);
-	SETCOL(btheme->tv3d.header, 195, 195, 195, 255);
+	SETCOL(btheme->tv3d.header,		185, 185, 185, 255);
 	SETCOL(btheme->tv3d.panel,      165, 165, 165, 127);
 
 	SETCOL(btheme->tv3d.shade1,  160, 160, 160, 100);
@@ -427,9 +427,9 @@
 	/* to have something initialized */
 	btheme->tbuts= btheme->tv3d;
 
-	SETCOL(btheme->tbuts.back, 	180, 180, 180, 255);
-	SETCOL(btheme->tbuts.header, 195, 195, 195, 255);
-	SETCOL(btheme->tbuts.panel,  255, 255, 255, 40);
+	SETCOL(btheme->tbuts.back, 	0x82, 0x82, 0x82, 255);
+	SETCOL(btheme->tbuts.header, 185, 185, 185, 255);
+	SETCOL(btheme->tbuts.panel, 0x82, 0x82, 0x82, 255);
 
 	/* space ipo */
 	/* to have something initialized */
@@ -437,7 +437,7 @@
 
 	SETCOL(btheme->tipo.grid, 	94, 94, 94, 255);
 	SETCOL(btheme->tipo.back, 	120, 120, 120, 255);
-	SETCOL(btheme->tipo.header, 195, 195, 195, 255);
+	SETCOL(btheme->tipo.header, 185, 185, 185, 255);
 	SETCOL(btheme->tipo.panel,  255, 255, 255, 150);
 	SETCOL(btheme->tipo.shade1,		172, 172, 172, 100);
 	SETCOL(btheme->tipo.shade2,		0x70, 0x70, 0x70, 100);
@@ -461,8 +461,8 @@
 	SETCOL(btheme->tfile.back, 	90, 90, 90, 255);
 	SETCOL(btheme->tfile.text, 	250, 250, 250, 255);
 	SETCOL(btheme->tfile.text_hi, 15, 15, 15, 255);
-	SETCOL(btheme->tfile.header, 195, 195, 195, 255);
-	SETCOL(btheme->tfile.panel, 195, 195, 195, 255);	// bookmark/ui regions
+	SETCOL(btheme->tfile.header, 185, 185, 185, 255);
+	SETCOL(btheme->tfile.panel, 180, 180, 180, 255);	// bookmark/ui regions
 	SETCOL(btheme->tfile.active, 130, 130, 130, 255); // selected files
 	SETCOL(btheme->tfile.hilite, 255, 140, 25, 255); // selected files
 	
@@ -477,7 +477,7 @@
 	SETCOL(btheme->tact.back, 	116, 116, 116, 255);
 	SETCOL(btheme->tact.text, 	0, 0, 0, 255);
 	SETCOL(btheme->tact.text_hi, 255, 255, 255, 255);
-	SETCOL(btheme->tact.header, 182, 182, 182, 255);
+	SETCOL(btheme->tact.header, 185, 185, 185, 255);
 	SETCOL(btheme->tact.grid,  94, 94, 94, 255);
 	SETCOL(btheme->tact.face,  166, 166, 166, 255);	// RVK
 	SETCOL(btheme->tact.shade1,  172, 172, 172, 255);		// sliders
@@ -496,7 +496,7 @@
 	SETCOL(btheme->tnla.back, 	116, 116, 116, 255);
 	SETCOL(btheme->tnla.text, 	0, 0, 0, 255);
 	SETCOL(btheme->tnla.text_hi, 255, 255, 255, 255);
-	SETCOL(btheme->tnla.header, 182, 182, 182, 255);
+	SETCOL(btheme->tnla.header, 185, 185, 185, 255);
 	SETCOL(btheme->tnla.grid,  94, 94, 94, 255);	
 	SETCOL(btheme->tnla.shade1,  172, 172, 172, 255);		// sliders
 	SETCOL(btheme->tnla.shade2,  84, 44, 31, 100);	// bar
@@ -533,7 +533,7 @@
 	SETCOL(btheme->timasel.active, 	195, 195, 195, 255); /* active tile */
 	SETCOL(btheme->timasel.grid,  94, 94, 94, 255); /* active file text */
 	SETCOL(btheme->timasel.back, 	110, 110, 110, 255);
-	SETCOL(btheme->timasel.header,	195, 195, 195, 255);	
+	SETCOL(btheme->timasel.header,	185, 185, 185, 255);
 	SETCOL(btheme->timasel.shade1,  94, 94, 94, 255);	/* bar */
 	SETCOL(btheme->timasel.shade2,  172, 172, 172, 255); /* sliders */
 	SETCOL(btheme->timasel.hilite,  17, 27, 60, 100);	/* selected tile */





More information about the Bf-blender-cvs mailing list