Started work on an updated UI theme
authorMatt Ebb <matt@mke3.net>
Wed, 19 Nov 2008 03:15:52 +0000 (03:15 +0000)
committerMatt Ebb <matt@mke3.net>
Wed, 19 Nov 2008 03:15:52 +0000 (03:15 +0000)
source/blender/editors/include/UI_resources.h
source/blender/editors/interface/interface_draw.c
source/blender/editors/interface/interface_regions.c
source/blender/editors/interface/resources.c

index f30e5531f4161316d5f67ccf780f7b7c8e8e813e..6d2b1147ff4824407d391b27c49489a7f70259f4 100644 (file)
@@ -531,10 +531,11 @@ enum {
 /* XXX WARNING: previous is saved in file, so do not change order! */
 
 /* theme drawtypes */
 /* XXX WARNING: previous is saved in file, so do not change order! */
 
 /* theme drawtypes */
-#define TH_MINIMAL  0
-#define TH_SHADED   1
-#define TH_ROUNDED  2
-#define TH_OLDSKOOL 3
+#define TH_MINIMAL     0
+#define TH_ROUNDSHADED 1
+#define TH_ROUNDED     2
+#define TH_OLDSKOOL    3
+#define TH_SHADED      4
 
 /* specific defines per space should have higher define values */
 
 
 /* specific defines per space should have higher define values */
 
index 49a5b8482cc23d20348ce224c5c47a99aca54209..de29421ef475884f038d7a31c57a99ac712a70da 100644 (file)
@@ -134,6 +134,182 @@ void gl_round_box(int mode, float minx, float miny, float maxx, float maxy, floa
        glEnd();
 }
 
        glEnd();
 }
 
+static void round_box_shade_col(float *col1, float *col2, float fac)
+{
+       float col[3];
+
+       col[0]= (fac*col1[0] + (1.0-fac)*col2[0]);
+       col[1]= (fac*col1[1] + (1.0-fac)*col2[1]);
+       col[2]= (fac*col1[2] + (1.0-fac)*col2[2]);
+       
+       glColor3fv(col);
+}
+
+/* linear horizontal shade within button or in outline */
+void gl_round_box_shade(int mode, float minx, float miny, float maxx, float maxy, float rad, float shadetop, float shadedown)
+{
+       float vec[7][2]= {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293},
+                         {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}};
+       float div= maxy-miny;
+       float coltop[3], coldown[3], color[4];
+       int a;
+       
+       /* mult */
+       for(a=0; a<7; a++) {
+               vec[a][0]*= rad; vec[a][1]*= rad;
+       }
+       /* get current color, needs to be outside of glBegin/End */
+       glGetFloatv(GL_CURRENT_COLOR, color);
+
+       /* 'shade' defines strength of shading */       
+       coltop[0]= color[0]+shadetop; if(coltop[0]>1.0) coltop[0]= 1.0;
+       coltop[1]= color[1]+shadetop; if(coltop[1]>1.0) coltop[1]= 1.0;
+       coltop[2]= color[2]+shadetop; if(coltop[2]>1.0) coltop[2]= 1.0;
+       coldown[0]= color[0]+shadedown; if(coldown[0]<0.0) coldown[0]= 0.0;
+       coldown[1]= color[1]+shadedown; if(coldown[1]<0.0) coldown[1]= 0.0;
+       coldown[2]= color[2]+shadedown; if(coldown[2]<0.0) coldown[2]= 0.0;
+
+       if (UI_GetThemeValue(TH_BUT_DRAWTYPE) != TH_MINIMAL) {
+               glShadeModel(GL_SMOOTH);
+               glBegin(mode);
+       }
+
+       /* start with corner right-bottom */
+       if(roundboxtype & 4) {
+               
+               round_box_shade_col(coltop, coldown, 0.0);
+               glVertex2f( maxx-rad, miny);
+               
+               for(a=0; a<7; a++) {
+                       round_box_shade_col(coltop, coldown, vec[a][1]/div);
+                       glVertex2f( maxx-rad+vec[a][0], miny+vec[a][1]);
+               }
+               
+               round_box_shade_col(coltop, coldown, rad/div);
+               glVertex2f( maxx, miny+rad);
+       }
+       else {
+               round_box_shade_col(coltop, coldown, 0.0);
+               glVertex2f( maxx, miny);
+       }
+       
+       /* corner right-top */
+       if(roundboxtype & 2) {
+               
+               round_box_shade_col(coltop, coldown, (div-rad)/div);
+               glVertex2f( maxx, maxy-rad);
+               
+               for(a=0; a<7; a++) {
+                       round_box_shade_col(coltop, coldown, (div-rad+vec[a][1])/div);
+                       glVertex2f( maxx-vec[a][1], maxy-rad+vec[a][0]);
+               }
+               round_box_shade_col(coltop, coldown, 1.0);
+               glVertex2f( maxx-rad, maxy);
+       }
+       else {
+               round_box_shade_col(coltop, coldown, 1.0);
+               glVertex2f( maxx, maxy);
+       }
+       
+       /* corner left-top */
+       if(roundboxtype & 1) {
+               
+               round_box_shade_col(coltop, coldown, 1.0);
+               glVertex2f( minx+rad, maxy);
+               
+               for(a=0; a<7; a++) {
+                       round_box_shade_col(coltop, coldown, (div-vec[a][1])/div);
+                       glVertex2f( minx+rad-vec[a][0], maxy-vec[a][1]);
+               }
+               
+               round_box_shade_col(coltop, coldown, (div-rad)/div);
+               glVertex2f( minx, maxy-rad);
+       }
+       else {
+               round_box_shade_col(coltop, coldown, 1.0);
+               glVertex2f( minx, maxy);
+       }
+       
+       /* corner left-bottom */
+       if(roundboxtype & 8) {
+               
+               round_box_shade_col(coltop, coldown, rad/div);
+               glVertex2f( minx, miny+rad);
+               
+               for(a=0; a<7; a++) {
+                       round_box_shade_col(coltop, coldown, (rad-vec[a][1])/div);
+                       glVertex2f( minx+vec[a][1], miny+rad-vec[a][0]);
+               }
+               
+               round_box_shade_col(coltop, coldown, 0.0);
+               glVertex2f( minx+rad, miny);
+       }
+       else {
+               round_box_shade_col(coltop, coldown, 0.0);
+               glVertex2f( minx, miny);
+       }
+       
+       glEnd();
+       glShadeModel(GL_FLAT);
+}
+
+/* plain fake antialiased unfilled round rectangle */
+void uiRoundRectFakeAA(float minx, float miny, float maxx, float maxy, float rad, float asp)
+{
+       float color[4];
+       float raddiff;
+       int i, passes=4;
+       
+       /* get the colour and divide up the alpha */
+       glGetFloatv(GL_CURRENT_COLOR, color);
+       color[3]= 1/(float)passes;
+       glColor4fv(color);
+       
+       /* set the 'jitter amount' */
+       raddiff = (1/(float)passes) * asp;
+       
+       glEnable( GL_BLEND );
+       
+       /* draw lots of lines on top of each other */
+       for (i=passes; i>=(-passes); i--) {
+               gl_round_box(GL_LINE_LOOP, minx, miny, maxx, maxy, rad+(i*raddiff));
+       }
+       
+       glDisable( GL_BLEND );
+}
+
+
+void uiTriangleFakeAA(float x1, float y1, float x2, float y2, float x3, float y3)
+{
+       float color[4];
+       float jitter;
+       int i, passes=4;
+       
+       /* get the colour and divide up the alpha */
+       glGetFloatv(GL_CURRENT_COLOR, color);
+       color[3]= 1/(float)passes;
+       glColor4fv(color);
+       
+       /* set the 'jitter amount' */
+       jitter = 1/(float)passes;
+       
+       glEnable( GL_BLEND );
+       
+       /* draw lots of lines on top of each other */
+       for (i=passes; i>=(-passes); i--) {
+               glBegin(GL_TRIANGLES);
+               
+               /* 'point' first, then two base vertices */
+               glVertex2f(x1+(i*jitter), y1+(i*jitter));
+               glVertex2f(x2, y2+(i*jitter));
+               glVertex2f(x3, y3+(i*jitter));
+               glEnd();
+       }
+       
+       glDisable( GL_BLEND );
+}
+
+
 /* ************** safe rasterpos for pixmap alignment with pixels ************* */
 
 void ui_rasterpos_safe(float x, float y, float aspect)
 /* ************** safe rasterpos for pixmap alignment with pixels ************* */
 
 void ui_rasterpos_safe(float x, float y, float aspect)
@@ -281,11 +457,6 @@ static void ui_draw_icon(uiBut *but, BIFIconID icon, int blend)
  * One option is to hardcode to white, with alpha, however it causes a 
  * weird 'building up' efect, so it's commented out for now.
  */
  * One option is to hardcode to white, with alpha, however it causes a 
  * weird 'building up' efect, so it's commented out for now.
  */
-/*
-#define MM_WHITE_OP    glColor4ub(255, 255, 255, 60)
-#define MM_WHITE_TR    glColor4ub(255, 255, 255, 0)
- */
 
 #define MM_WHITE_OP    UI_ThemeColorShadeAlpha(TH_BACK, 55, -100)
 #define MM_WHITE_TR    UI_ThemeColorShadeAlpha(TH_BACK, 55, -255)
 
 #define MM_WHITE_OP    UI_ThemeColorShadeAlpha(TH_BACK, 55, -100)
 #define MM_WHITE_TR    UI_ThemeColorShadeAlpha(TH_BACK, 55, -255)
@@ -457,6 +628,58 @@ static void flat_button(float x1, float y1, float x2, float y2, float asp, int c
        /* END OUTER OUTLINE */
 }
 
        /* END OUTER OUTLINE */
 }
 
+/* shaded round button */
+static void round_button_shaded(int type, int colorid, float asp, float x1, float y1, float x2, float y2, int flag, int rad)
+{
+       float shadefac;
+       
+       /* colour shading */
+       if (flag & UI_SELECT) {
+               shadefac = -0.05;
+               if(flag & UI_ACTIVE) UI_ThemeColorShade(colorid, -40);
+               else UI_ThemeColorShade(colorid, -30);  
+       } else {
+               shadefac = 0.05;
+               if(flag & UI_ACTIVE) UI_ThemeColorShade(colorid, +30);
+               else UI_ThemeColorShade(colorid, +20);                  
+       }
+       /* end colour shading */
+       
+       
+       /* the shaded base */
+       gl_round_box_shade(GL_POLYGON, x1, y1, x2, y2, rad, shadefac, -shadefac);
+       
+       /* outline */
+       UI_ThemeColorBlendShade(TH_BUT_OUTLINE, TH_BACK, 0.1, -40);
+       
+       uiRoundRectFakeAA(x1, y1, x2, y2, rad, asp);
+       /* end outline */       
+}
+
+/* base round flat button */
+static void round_button_flat(int colorid, float asp, float x1, float y1, float x2, float y2, int flag, float rad)
+{      
+       /* colour shading */
+       if(flag & UI_SELECT) {
+               if (flag & UI_ACTIVE) UI_ThemeColorShade(colorid, -20);
+               else UI_ThemeColorShade(colorid, -45);  
+       }
+       else {
+               if(flag & UI_ACTIVE) UI_ThemeColorShade(colorid, 35);
+               else UI_ThemeColorShade(colorid, 25);
+       }
+       /* end colour shading */
+       
+       /* the solid base */
+       gl_round_box(GL_POLYGON, x1, y1, x2, y2, rad);
+       
+       /* outline */
+       UI_ThemeColorBlendShade(TH_BUT_OUTLINE, TH_BACK, 0.1, -30);
+       
+       uiRoundRectFakeAA(x1, y1, x2, y2, rad, asp);
+       /* end outline */
+}
+
 /* small side double arrow for iconrow */
 static void ui_default_iconrow_arrows(float x1, float y1, float x2, float y2)
 {
 /* small side double arrow for iconrow */
 static void ui_default_iconrow_arrows(float x1, float y1, float x2, float y2)
 {
@@ -483,24 +706,14 @@ static void ui_default_iconrow_arrows(float x1, float y1, float x2, float y2)
 /* side double arrow for menu */
 static void ui_default_menu_arrows(float x1, float y1, float x2, float y2)
 {
 /* side double arrow for menu */
 static void ui_default_menu_arrows(float x1, float y1, float x2, float y2)
 {
-       glEnable( GL_POLYGON_SMOOTH );
-       glEnable( GL_BLEND );
-       
-       glShadeModel(GL_FLAT);
-       glBegin(GL_TRIANGLES);
-       glVertex2f((short)x2-4,(short)(y2-(y2-y1)/2)+1);
-       glVertex2f((short)x2-12,(short)(y2-(y2-y1)/2)+1);
-       glVertex2f((short)x2-8,(short)(y2-(y2-y1)/2)+4);
-       glEnd();
-               
-       glBegin(GL_TRIANGLES);
-       glVertex2f((short)x2-4,(short)(y2-(y2-y1)/2) -1);
-       glVertex2f((short)x2-12,(short)(y2-(y2-y1)/2) -1);
-       glVertex2f((short)x2-8,(short)(y2-(y2-y1)/2) -4);
-       glEnd();
-       
-       glDisable( GL_BLEND );
-       glDisable( GL_POLYGON_SMOOTH );
+       /* 'point' first, then two base vertices */
+       uiTriangleFakeAA(x2-9, (y2-(y2-y1)/2)+6,
+                                       x2-6, (y2-(y2-y1)/2)+2,
+                                       x2-11, (y2-(y2-y1)/2)+2);
+       
+       uiTriangleFakeAA(x2-8, (y2-(y2-y1)/2)-6,
+                                       x2-6, (y2-(y2-y1)/2)-2,
+                                       x2-11, (y2-(y2-y1)/2)-2);
 }
 
 /* left/right arrows for number fields */
 }
 
 /* left/right arrows for number fields */
@@ -508,59 +721,312 @@ static void ui_default_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
 
 {
        if( x2-x1 > 25) {       // 25 is a bit arbitrary, but small buttons cant have arrows
 
-               glEnable( GL_POLYGON_SMOOTH );
-               glEnable( GL_BLEND );
-               
-               glShadeModel(GL_FLAT);
-               glBegin(GL_TRIANGLES);
-               
-               glVertex2f((short)x1+5,(short)(y2-(y2-y1)/2));
-               glVertex2f((short)x1+10,(short)(y2-(y2-y1)/2)+4);
-               glVertex2f((short)x1+10,(short)(y2-(y2-y1)/2)-4);
-               glEnd();
+               /* 'point' first, then two base vertices */
+               uiTriangleFakeAA(x1+4, y2-(y2-y1)/2,
+                                               x1+9, y2-(y2-y1)/2+3,
+                                               x1+9, y2-(y2-y1)/2-3);
 
 
-               /* right */
-               glShadeModel(GL_FLAT);
-               glBegin(GL_TRIANGLES);
-
-               glVertex2f((short)x2-5,(short)(y2-(y2-y1)/2));
-               glVertex2f((short)x2-10,(short)(y2-(y2-y1)/2)-4);
-               glVertex2f((short)x2-10,(short)(y2-(y2-y1)/2)+4);
-               glEnd();
-               
-               glDisable( GL_BLEND );
-               glDisable( GL_POLYGON_SMOOTH );
+               uiTriangleFakeAA(x2-4, y2-(y2-y1)/2,
+                                               x2-9, y2-(y2-y1)/2+3,
+                                               x2-9, y2-(y2-y1)/2-3);
        }
 }
 
        }
 }
 
+
 /* changing black/white for TOG3 buts */
 static void ui_tog3_invert(float x1, float y1, float x2, float y2, int seltype)
 {
 /* changing black/white for TOG3 buts */
 static void ui_tog3_invert(float x1, float y1, float x2, float y2, int seltype)
 {
-       short alpha = 30;
-       
+
        if (seltype == 0) {
        if (seltype == 0) {
-               glEnable(GL_BLEND);
+               UI_ThemeColorShade(TH_BUT_SETTING, -120); 
                
                
-               glColor4ub(0, 0, 0, alpha);
-               glRectf(x2-6, y1, x2, (y1+(y2-y1)/2));
+               glEnable( GL_LINE_SMOOTH );
+               glEnable( GL_BLEND );
+               glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
+               glLineWidth(1.0);
                
                
-               glColor4ub(255, 255, 255, alpha);
-               glRectf(x2-6, (y1+(y2-y1)/2), x2, y2);
+               fdrawline(x1+10, (y1+(y2-y1)/2+4), x1+10, (y1+(y2-y1)/2)-4);
+               fdrawline(x1+6, (y1+(y2-y1)/2), x1+14, (y1+(y2-y1)/2));
                
                
-               glDisable(GL_BLEND);
+               glLineWidth(1.0);
+               glDisable( GL_BLEND );
+               glDisable( GL_LINE_SMOOTH );
        } else {
        } else {
-               glEnable(GL_BLEND);
+               /* horiz line */
+               UI_ThemeColorShade(TH_BUT_SETTING, -120);
                
                
-               glColor4ub(255, 255, 255, alpha);
-               glRectf(x2-6, y1, x2, (y1+(y2-y1)/2));
+               glEnable( GL_LINE_SMOOTH );
+               glEnable( GL_BLEND );
+               glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
+               glLineWidth(1.0);
                
                
-               glColor4ub(0, 0, 0, alpha);
-               glRectf(x2-6, (y1+(y2-y1)/2), x2, y2);
+               fdrawline(x1+6, (y1+(y2-y1)/2), x1+14, (y1+(y2-y1)/2));
+               
+               glLineWidth(1.0);
+               glDisable( GL_BLEND );
+               glDisable( GL_LINE_SMOOTH );
                
                
-               glDisable(GL_BLEND);
        }
 }
 
        }
 }
 
+/* roundshaded button/popup menu/iconrow drawing code */
+static void ui_roundshaded_button(int type, int colorid, float asp, float x1, float y1, float x2, float y2, int flag)
+{
+       float rad, maxrad;
+       int align= (flag & UI_BUT_ALIGN);
+       int round_align_fix= 0;
+       
+       /* rounded corners */
+       if (ELEM4(type, MENU, ROW, ICONROW, ICONTEXTROW)) maxrad = 5.0;
+       else maxrad= 10.0;
+       
+       rad= (y2-y1)/2.0;
+       if (rad>(x2-x1)/2) rad = (x2-x1)/2;
+       if (rad > maxrad) rad = maxrad;
+
+       /* end rounded corners */
+       
+       /* alignment */
+       if(align) {
+               switch(align) {
+                       case UI_BUT_ALIGN_TOP:
+                               uiSetRoundBox(12);
+                               round_align_fix= 4;
+                               break;
+                       case UI_BUT_ALIGN_DOWN:
+                               uiSetRoundBox(3);
+                               round_align_fix= 2;
+                               break;
+                       case UI_BUT_ALIGN_LEFT:
+                               uiSetRoundBox(6);
+                               round_align_fix= 6;
+                               break;
+                       case UI_BUT_ALIGN_RIGHT:
+                               uiSetRoundBox(9);
+                               round_align_fix= 9;
+                               break;
+                               
+                       case UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_RIGHT:
+                               uiSetRoundBox(1);
+                               round_align_fix= 0;
+                               break;
+                       case UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_LEFT:
+                               uiSetRoundBox(2);
+                               round_align_fix= 2;
+                               break;
+                       case UI_BUT_ALIGN_TOP|UI_BUT_ALIGN_RIGHT:
+                               uiSetRoundBox(8);
+                               round_align_fix= 0;
+                               break;
+                       case UI_BUT_ALIGN_TOP|UI_BUT_ALIGN_LEFT:
+                               uiSetRoundBox(4);
+                               round_align_fix= 4;
+                               break;
+                               
+                       default:
+                               uiSetRoundBox(0);
+                               round_align_fix= 0;
+                               break;
+               }
+       } 
+       else {
+               uiSetRoundBox(15);
+               if (x2 - x1 > 19) {
+                       round_align_fix= 6;
+               } else {
+                       round_align_fix= 15;
+               }
+       }
+       /* end alignment */
+       
+       
+       /* draw the base button */
+       round_button_shaded(type, colorid, asp, x1, y1, x2, y2, flag, rad);
+       
+       /* *** EXTRA DRAWING FOR SPECIFIC CONTROL TYPES *** */
+       switch(type) {
+               case ICONROW:
+               case ICONTEXTROW:                       
+                       /* iconrow double arrow  */
+                       if(flag & UI_SELECT) {
+                               UI_ThemeColorShade(colorid, -80);
+                       } else {
+                               UI_ThemeColorShade(colorid, -45);
+                       }
+                               ui_default_iconrow_arrows(x1, y1, x2, y2);
+                       /* end iconrow double arrow */
+                       break;
+               case MENU:
+                       /* menu double arrow  */
+                       if(flag & UI_SELECT) {
+                               UI_ThemeColorShade(colorid, -110);
+                       } else {
+                               UI_ThemeColorShade(colorid, -80);
+                       }
+                       ui_default_menu_arrows(x1, y1, x2, y2);
+                       /* end menu double arrow */
+                       break;
+       }       
+}
+
+static void ui_roundshaded_flat(int type, int colorid, float asp, float x1, float y1, float x2, float y2, int flag)
+{
+       float rad, maxrad=10.0;
+       int align= (flag & UI_BUT_ALIGN);
+       
+       /* rounded corners */
+       rad= (y2-y1)/2.0;
+       if (rad>(x2-x1)/2) rad = (x2-x1)/2;
+       if (maxrad) {
+               if (rad > maxrad) rad = maxrad;
+       }
+       /* end rounded corners */
+       
+       /* alignment */
+       if(align) {
+               switch(align) {
+                       case UI_BUT_ALIGN_TOP:
+                               uiSetRoundBox(12);
+                               break;
+                       case UI_BUT_ALIGN_DOWN:
+                               uiSetRoundBox(3);
+                               break;
+                       case UI_BUT_ALIGN_LEFT:
+                               uiSetRoundBox(6);
+                               break;
+                       case UI_BUT_ALIGN_RIGHT:
+                               uiSetRoundBox(9);
+                               break;
+                               
+                       case UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_RIGHT:
+                               uiSetRoundBox(1);
+                               break;
+                       case UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_LEFT:
+                               uiSetRoundBox(2);
+                               break;
+                       case UI_BUT_ALIGN_TOP|UI_BUT_ALIGN_RIGHT:
+                               uiSetRoundBox(8);
+                               break;
+                       case UI_BUT_ALIGN_TOP|UI_BUT_ALIGN_LEFT:
+                               uiSetRoundBox(4);
+                               break;
+                               
+                       default:
+                               uiSetRoundBox(0);
+                               break;
+               }
+       } 
+       else {
+               uiSetRoundBox(15);
+       }
+       /* end alignment */
+       
+       /* draw the base button */
+       round_button_flat(colorid, asp, x1, y1, x2, y2, flag, rad);
+       
+       /* *** EXTRA DRAWING FOR SPECIFIC CONTROL TYPES *** */
+       switch(type) {
+               case TOG:
+               case TOGN:
+               case TOG3:
+                       if (!(flag & UI_HAS_ICON)) {
+                               /* 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_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 );            
+                                       }
+                                       /* draw a dot: alternate, for layers etc. */
+                               } else if(flag & UI_SELECT) {
+                                       uiSetRoundBox(15);
+                                       UI_ThemeColorShade(colorid, -60);
+                                       
+                                       glPushMatrix();
+                                       glTranslatef((x1+(x2-x1)/2), (y1+(y2-y1)/2), 0.0);
+                                       
+                                       /* circle */
+                                       glutil_draw_filled_arc(0.0, M_PI*2.0, 2, 16);
+                                       
+                                       glEnable( GL_LINE_SMOOTH );
+                                       glEnable( GL_BLEND );
+                                       glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
+                                       
+                                       /* smooth outline */
+                                       glutil_draw_lined_arc(0.0, M_PI*2.0, 2, 16);
+                                       
+                                       glDisable( GL_BLEND );
+                                       glDisable( GL_LINE_SMOOTH );
+                                       
+                                       glPopMatrix();
+                               }
+                       }
+                       break;
+               case NUM:
+                       /* side arrows */
+                       if(flag & UI_SELECT) {
+                               if(flag & UI_ACTIVE) UI_ThemeColorShade(colorid, -70);
+                               else UI_ThemeColorShade(colorid, -70);
+                       } else {
+                               if(flag & UI_ACTIVE) UI_ThemeColorShade(colorid, -40);
+                               else UI_ThemeColorShade(colorid, -20);
+                       }
+                       
+                       ui_default_num_arrows(x1, y1, x2, y2);
+                       /* end side arrows */
+                       break;
+       }       
+}
+
+/* roundshaded theme callback */
+static void ui_draw_roundshaded(int type, int colorid, float aspect, float x1, float y1, float x2, float y2, int flag)
+{
+       
+       switch(type) {
+               case TOG:
+               case TOGN:
+               case TOG3:
+               case SLI:
+               case NUMSLI:
+               case HSVSLI:
+               case TEX:
+               case IDPOIN:
+               case NUM:
+                       ui_roundshaded_flat(type, colorid, aspect, x1, y1, x2, y2, flag);
+                       break;
+               case ICONROW: 
+               case ICONTEXTROW: 
+               case MENU: 
+               default: 
+                       ui_roundshaded_button(type, colorid, aspect, x1, y1, x2, y2, flag);
+       }
+       
+}
+
 /* button/popup menu/iconrow drawing code */
 static void ui_default_button(int type, int colorid, float asp, float x1, float y1, float x2, float y2, int flag)
 {
 /* button/popup menu/iconrow drawing code */
 static void ui_default_button(int type, int colorid, float asp, float x1, float y1, float x2, float y2, int flag)
 {
@@ -1509,7 +1975,6 @@ static void ui_draw_pulldown_round(int type, int colorid, float asp, float x1, f
        
 }
 
        
 }
 
-
 /* ************** TEXT AND ICON DRAWING FUNCTIONS ************* */
 
 
 /* ************** TEXT AND ICON DRAWING FUNCTIONS ************* */
 
 
@@ -1608,8 +2073,12 @@ static void ui_draw_text_icon(uiBut *but)
                        else
 #endif
                        {
                        else
 #endif
                        {
-                               if(but->editstr || (but->flag & UI_TEXT_LEFT)) x= but->x1+4.0;
-                               else x= (but->x1+but->x2-but->strwidth+1)/2.0;
+                               if(but->editstr || (but->flag & UI_TEXT_LEFT))
+                                       x= but->x1+4.0;
+                               else if ELEM3(but->type, TOG, TOGN, TOG3)
+                                       x= but->x1+18.0;        /* offset for checkmark */
+                               else
+                                       x= (but->x1+but->x2-but->strwidth+1)/2.0;
                        }
                        
                        /* tog3 button exception; draws with glColor! */
                        }
                        
                        /* tog3 button exception; draws with glColor! */
@@ -2490,6 +2959,9 @@ void ui_set_embossfunc(uiBut *but, int drawtype)
                
                switch(theme) {
                
                
                switch(theme) {
                
+               case TH_SHADED:
+                       but->embossfunc= ui_draw_default;
+                       break;
                case TH_ROUNDED:
                        but->embossfunc= ui_draw_round;
                        break;
                case TH_ROUNDED:
                        but->embossfunc= ui_draw_round;
                        break;
@@ -2499,9 +2971,9 @@ void ui_set_embossfunc(uiBut *but, int drawtype)
                case TH_MINIMAL:
                        but->embossfunc= ui_draw_minimal;
                        break;
                case TH_MINIMAL:
                        but->embossfunc= ui_draw_minimal;
                        break;
-               case TH_SHADED:
+               case TH_ROUNDSHADED:
                default:
                default:
-                       but->embossfunc= ui_draw_default;
+                       but->embossfunc= ui_draw_roundshaded;
                        but->sliderfunc= ui_default_slider;
                        break;
                }
                        but->sliderfunc= ui_default_slider;
                        break;
                }
index 5bbc5923c7d0a72fa3fdf23b33259ccc0c079736..d2611823df7f6b3c2bfe9a0f65b9fbc5dae5d6d8 100644 (file)
@@ -1740,18 +1740,18 @@ void uiTestRegion(const bContext *C)
        uiDefButS(block, MENU, 31416, "Gather Method%t|Raytrace %x0|Approximate %x1",
                13+50+5+80+5, 3, 100, 20, &testchoice, 0, 0, 0, 0, "Method for occlusion gathering");
        uiDefButBitS(block, TOG, 1, 31417, "Pixel Cache",
        uiDefButS(block, MENU, 31416, "Gather Method%t|Raytrace %x0|Approximate %x1",
                13+50+5+80+5, 3, 100, 20, &testchoice, 0, 0, 0, 0, "Method for occlusion gathering");
        uiDefButBitS(block, TOG, 1, 31417, "Pixel Cache",
-               13+50+5+80+5+100+5, 3, 80, 20, &testtog, 0, 0, 0, 0, "Cache AO results in pixels and interpolate over neighbouring pixels for speedup.");
+               13+50+5+80+5+100+5, 3, 100, 20, &testtog, 0, 0, 0, 0, "Cache AO results in pixels and interpolate over neighbouring pixels for speedup.");
 
        uiDefBut(block, TEX, 31418, "Text: ",
 
        uiDefBut(block, TEX, 31418, "Text: ",
-               13+50+5+80+5+100+5+80+5, 3, 200, 20, testtext, 0, sizeof(testtext), 0, 0, "User defined text");
+               13+50+5+80+5+100+5+100+5, 3, 200, 20, testtext, 0, sizeof(testtext), 0, 0, "User defined text");
 
        uiDefButF(block, NUMSLI, 31419, "Slider: ",
 
        uiDefButF(block, NUMSLI, 31419, "Slider: ",
-               13+50+5+80+5+100+5+80+5+200+5, 3, 150, 20, &testnumf, 0.0, 10.0, 0, 0, "Some tooltip.");
+               13+50+5+80+5+100+5+100+5+200+5, 3, 150, 20, &testnumf, 0.0, 10.0, 0, 0, "Some tooltip.");
        uiDefButF(block, NUM, 31419, "N: ",
        uiDefButF(block, NUM, 31419, "N: ",
-               13+50+5+80+5+100+5+80+5+200+5+150+5, 3, 100, 20, &testnumf, 0.0, 10.0, 0, 0, "Some tooltip.");
+               13+50+5+80+5+100+5+100+5+200+5+150+5, 3, 100, 20, &testnumf, 0.0, 10.0, 0, 0, "Some tooltip.");
 
     uiDefButF(block, COL, 3142, "",
 
     uiDefButF(block, COL, 3142, "",
-               13+50+5+80+5+100+5+80+5+200+5+150+5+100+5, 3, 100, 20, testcol, 0, 0, 0, 0 /*B_BANDCOL*/, "");
+               13+50+5+80+5+100+5+100+5+200+5+150+5+100+5, 3, 100, 20, testcol, 0, 0, 0, 0 /*B_BANDCOL*/, "");
 
 #if 0
        if(!cumap) {
 
 #if 0
        if(!cumap) {
index bfb2d39fbb5fc22c4f824f563dd658cbed65bf2e..a5fe8055c61ca82d5f46bb241b0160d6d2258bbf 100644 (file)
@@ -348,15 +348,15 @@ void ui_theme_init_userdef(void)
 
        /* UI buttons (todo) */
        SETCOL(btheme->tui.outline,     0xA0,0xA0,0xA0, 255);
 
        /* UI buttons (todo) */
        SETCOL(btheme->tui.outline,     0xA0,0xA0,0xA0, 255);
-       SETCOL(btheme->tui.neutral,     0xA0,0xA0,0xA0, 255);
-       SETCOL(btheme->tui.action,              0xAD,0xA0,0x93, 255);
-       SETCOL(btheme->tui.setting,     0x8A,0x9E,0xA1, 255);
-       SETCOL(btheme->tui.setting1,    0xA1,0xA1,0xAE, 255);
-       SETCOL(btheme->tui.setting2,    0xA1,0x99,0xA7, 255);
-       SETCOL(btheme->tui.num,                 0x90,0x90,0x90, 255);
-       SETCOL(btheme->tui.textfield,   0x90,0x90,0x90, 255);
-       SETCOL(btheme->tui.textfield_hi,0xc6,0x77,0x77, 255);
-       SETCOL(btheme->tui.popup,               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,                 143, 143, 143, 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);
        
        SETCOL(btheme->tui.text,                0,0,0, 255);
        SETCOL(btheme->tui.text_hi,     255, 255, 255, 255);
        
        SETCOL(btheme->tui.text,                0,0,0, 255);
        SETCOL(btheme->tui.text_hi,     255, 255, 255, 255);
@@ -366,7 +366,7 @@ void ui_theme_init_userdef(void)
        SETCOL(btheme->tui.menu_hilite, 0x7F,0x7F,0x7F, 255);
        SETCOL(btheme->tui.menu_text,   0, 0, 0, 255);
        SETCOL(btheme->tui.menu_text_hi, 255, 255, 255, 255);
        SETCOL(btheme->tui.menu_hilite, 0x7F,0x7F,0x7F, 255);
        SETCOL(btheme->tui.menu_text,   0, 0, 0, 255);
        SETCOL(btheme->tui.menu_text_hi, 255, 255, 255, 255);
-       btheme->tui.but_drawtype= TH_SHADED;
+       btheme->tui.but_drawtype= TH_ROUNDSHADED;
        
        BLI_strncpy(btheme->tui.iconfile, "", sizeof(btheme->tui.iconfile));
        
        
        BLI_strncpy(btheme->tui.iconfile, "", sizeof(btheme->tui.iconfile));