* UI tweaking
authorMatt Ebb <matt@mke3.net>
Sat, 14 Mar 2009 03:24:23 +0000 (03:24 +0000)
committerMatt Ebb <matt@mke3.net>
Sat, 14 Mar 2009 03:24:23 +0000 (03:24 +0000)
source/blender/editors/interface/interface_draw.c
source/blender/editors/interface/resources.c

index f93c4aa759a859a984b1174e7a419d66a17ddf05..18d7e0f06cf6feba1d961c652940f9010719253b 100644 (file)
@@ -2208,24 +2208,16 @@ static void ui_draw_pulldown_round(int type, int colorid, float asp, float x1, f
 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 @@ static void ui_draw_text(uiBut *but, float x, float y, int sunken)
        }
        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 @@ static void ui_draw_text(uiBut *but, float x, float y, int sunken)
        /* 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= '|';
        }
index 472f0dc261c4f0ed5952b0238e80c3a41d2cce05..c1beb4b1c58c1aacd89957d55b60309b49967aac 100644 (file)
@@ -363,14 +363,14 @@ void ui_theme_init_userdef(void)
        
        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 @@ void ui_theme_init_userdef(void)
        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 @@ void ui_theme_init_userdef(void)
        /* 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 @@ void ui_theme_init_userdef(void)
 
        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 @@ void ui_theme_init_userdef(void)
        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 @@ void ui_theme_init_userdef(void)
        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 @@ void ui_theme_init_userdef(void)
        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 @@ void ui_theme_init_userdef(void)
        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 */