diff --git a/source/blender/include/BIF_resources.h b/source/blender/include/BIF_resources.h index cc3f751bcbc..f4257c829a7 100644 --- a/source/blender/include/BIF_resources.h +++ b/source/blender/include/BIF_resources.h @@ -332,6 +332,8 @@ void BIF_ThemeColorShadeAlpha(int colorid, int coloffset, int alphaoffset); // sets color, which is blend between two theme colors void BIF_ThemeColorBlend(int colorid1, int colorid2, float fac); +// same, with shade offset +void BIF_ThemeColorBlendShade(int colorid1, int colorid2, float fac, int offset); // returns one value, not scaled float BIF_GetThemeValuef(int colorid); diff --git a/source/blender/src/header_view3d.c b/source/blender/src/header_view3d.c index 91530da7041..239edeeb5d3 100644 --- a/source/blender/src/header_view3d.c +++ b/source/blender/src/header_view3d.c @@ -3091,11 +3091,21 @@ void view3d_buttons(void) /* LAYERS */ if(G.vd->localview==0) { - for(a=0; a<10; a++) { - uiDefButI(block, TOG|BIT|(a+10), B_LAY+10+a, "",(short)(xco+a*(XIC/2)), 0, XIC/2, (YIC)/2, &(G.vd->lay), 0, 0, 0, 0, "Toggles Layer visibility"); + uiBlockBeginAlign(block); + for(a=0; a<5; a++) uiDefButI(block, TOG|BIT|a, B_LAY+a, "", (short)(xco+a*(XIC/2)), (short)(YIC/2),(short)(XIC/2),(short)(YIC/2), &(G.vd->lay), 0, 0, 0, 0, "Toggles Layer visibility"); - if(a==4) xco+= 5; - } + for(a=0; a<5; a++) + uiDefButI(block, TOG|BIT|(a+10), B_LAY+10+a, "",(short)(xco+a*(XIC/2)), 0, XIC/2, (YIC)/2, &(G.vd->lay), 0, 0, 0, 0, "Toggles Layer visibility"); + + xco+= 5; + uiBlockBeginAlign(block); + for(a=5; a<10; a++) + uiDefButI(block, TOG|BIT|a, B_LAY+a, "", (short)(xco+a*(XIC/2)), (short)(YIC/2),(short)(XIC/2),(short)(YIC/2), &(G.vd->lay), 0, 0, 0, 0, "Toggles Layer visibility"); + for(a=5; a<10; a++) + uiDefButI(block, TOG|BIT|(a+10), B_LAY+10+a, "",(short)(xco+a*(XIC/2)), 0, XIC/2, (YIC)/2, &(G.vd->lay), 0, 0, 0, 0, "Toggles Layer visibility"); + + uiBlockEndAlign(block); + xco+= (a-2)*(XIC/2)+3; /* LOCK */ diff --git a/source/blender/src/interface_draw.c b/source/blender/src/interface_draw.c index 762df51f37c..8f635185c51 100644 --- a/source/blender/src/interface_draw.c +++ b/source/blender/src/interface_draw.c @@ -1246,7 +1246,8 @@ static void round_button(float x1, float y1, float x2, float y2, float asp, int gl_round_box(x1, y1, x2, y2, rad); glEnd(); - BIF_ThemeColorShade(colorid, -70); + BIF_ThemeColorBlendShade(colorid, TH_BACK, 0.5, -70); + //BIF_ThemeColorShade(colorid, -70); glBegin(GL_LINE_LOOP); gl_round_box(x1, y1, x2, y2, rad); @@ -1260,7 +1261,8 @@ static void round_button_mid(float x1, float y1, float x2, float y2, float asp, { glRectf(x1, y1, x2, y2); - BIF_ThemeColorShade(colorid, -70); + //BIF_ThemeColorShade(colorid, -70); + BIF_ThemeColorBlendShade(colorid, TH_BACK, 0.5, -70); // we draw full outline, its not AA, and it works better button mouse-over hilite // left right diff --git a/source/blender/src/resources.c b/source/blender/src/resources.c index 433827da01e..4d833d02f9b 100644 --- a/source/blender/src/resources.c +++ b/source/blender/src/resources.c @@ -772,6 +772,27 @@ void BIF_ThemeColorBlend(int colorid1, int colorid2, float fac) glColor3ub(r, g, b); } +// blend between to theme colors, shade it, and set it +void BIF_ThemeColorBlendShade(int colorid1, int colorid2, float fac, int offset) +{ + int r, g, b; + char *cp1, *cp2; + + cp1= BIF_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1); + cp2= BIF_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2); + + if(fac<0.0) fac=0.0; else if(fac>1.0) fac= 1.0; + r= offset+floor((1.0-fac)*cp1[0] + fac*cp2[0]); + g= offset+floor((1.0-fac)*cp1[1] + fac*cp2[1]); + b= offset+floor((1.0-fac)*cp1[2] + fac*cp2[2]); + + r= r<0?0:(r>255?255:r); + g= g<0?0:(g>255?255:g); + b= b<0?0:(b>255?255:b); + + glColor3ub(r, g, b); +} + // get individual values, not scaled float BIF_GetThemeValuef(int colorid) diff --git a/source/blender/src/space.c b/source/blender/src/space.c index 79ebe98903c..29da5bead05 100644 --- a/source/blender/src/space.c +++ b/source/blender/src/space.c @@ -1832,26 +1832,31 @@ void info_user_themebuts(uiBlock *block, short y1, short y2, short y3) uiDefButC(block, NUMSLI, B_UPDATE_THEME,"Vertex size ", 465,y3,200,20, col, 1.0, 10.0, 0, 0, ""); } else if(th_curcol==TH_BUT_DRAWTYPE) { + uiBlockBeginAlign(block); uiDefButC(block, ROW, B_UPDATE_THEME, "Minimal", 465,y3,100,20, col, 2.0, 0.0, 0, 0, ""); uiDefButC(block, ROW, B_UPDATE_THEME, "Shaded", 565,y3,100,20, col, 2.0, 1.0, 0, 0, ""); uiDefButC(block, ROW, B_UPDATE_THEME, "Rounded", 465,y2,100,20, col, 2.0, 2.0, 0, 0, ""); uiDefButC(block, ROW, B_UPDATE_THEME, "OldSkool", 565,y2,100,20, col, 2.0, 3.0, 0, 0, ""); - + uiBlockEndAlign(block); } else { - uiDefButC(block, NUMSLI, B_UPDATE_THEME,"R ", 465,y3,200,20, col, 0.0, 255.0, B_THEMECOL, 0, ""); - uiDefButC(block, NUMSLI, B_UPDATE_THEME,"G ", 465,y2,200,20, col+1, 0.0, 255.0, B_THEMECOL, 0, ""); - uiDefButC(block, NUMSLI, B_UPDATE_THEME,"B ", 465,y1,200,20, col+2, 0.0, 255.0, B_THEMECOL, 0, ""); - - uiDefButC(block, COL, B_THEMECOL, "", 675,y1,50,y3-y1+20, col, 0, 0, 0, 0, ""); + uiBlockBeginAlign(block); if ELEM3(th_curcol, TH_PANEL, TH_FACE, TH_FACE_SELECT) { uiDefButC(block, NUMSLI, B_UPDATE_THEME,"A ", 465,y3+25,200,20, col+3, 0.0, 255.0, B_THEMECOL, 0, ""); } - + uiDefButC(block, NUMSLI, B_UPDATE_THEME,"R ", 465,y3,200,20, col, 0.0, 255.0, B_THEMECOL, 0, ""); + uiDefButC(block, NUMSLI, B_UPDATE_THEME,"G ", 465,y2,200,20, col+1, 0.0, 255.0, B_THEMECOL, 0, ""); + uiDefButC(block, NUMSLI, B_UPDATE_THEME,"B ", 465,y1,200,20, col+2, 0.0, 255.0, B_THEMECOL, 0, ""); + uiBlockEndAlign(block); + + uiDefButC(block, COL, B_THEMECOL, "", 675,y1,50,y3-y1+20, col, 0, 0, 0, 0, ""); + /* copy paste */ + uiBlockBeginAlign(block); uiDefBut(block, BUT, B_THEME_COPY, "Copy Color", 755,y2,120,20, NULL, 0, 0, 0, 0, "Stores current color in buffer"); uiDefBut(block, BUT, B_THEME_PASTE, "Paste Color", 755,y1,120,20, NULL, 0, 0, 0, 0, "Pastes buffer color"); - + uiBlockEndAlign(block); + uiDefButC(block, COL, 0, "", 885,y1,50,y2-y1+20, th_curcol_arr, 0, 0, 0, 0, ""); } @@ -1913,7 +1918,8 @@ void drawinfospace(ScrArea *sa, void *spacedata) /* set the colour to blue and draw the main 'tab' controls */ uiBlockSetCol(block, TH_BUT_SETTING1); - + uiBlockBeginAlign(block); + uiDefButI(block, ROW,B_USERPREF,"View & Controls", xpos,ypostab,(short)dx,buth, &U.userpref,1.0,0.0, 0, 0,""); @@ -1943,7 +1949,7 @@ void drawinfospace(ScrArea *sa, void *spacedata) &U.userpref,1.0,5.0, 0, 0,""); uiBlockSetCol(block, TH_AUTO); - + uiBlockEndAlign(block); /* end 'tab' controls */ /* line 2: left x co-ord, top y co-ord, width, height */ @@ -1956,7 +1962,7 @@ void drawinfospace(ScrArea *sa, void *spacedata) uiDefBut(block, LABEL,0,"Display:", xpos,y3label,medprefbut,buth, 0, 0, 0, 0, 0, ""); - + uiDefButS(block, TOG|BIT|11, 0, "ToolTips", (xpos+edgespace),y2,smallprefbut,buth, &(U.flag), 0, 0, 0, 0,