6488 - Interface - Theme controls corner style

Made some other changes too, to border redraw, and dont draw antialiased squares when the minimal themes enabled.
This commit is contained in:
Campbell Barton 2007-04-22 17:14:23 +00:00
parent d2f81fe5e9
commit 1c52e2cfa4
2 changed files with 35 additions and 12 deletions

@ -3678,6 +3678,12 @@ void drawscredge_area(ScrArea *sa)
cpack(0x0);
/* Simple hack to make sure round corners arntdrawn with the minimal theme,
* Nothing wrong with it IMHO, but just be aware its used so the following
* if's never compare true with HEADERTOP or HEADERDOWN */
if (BIF_GetThemeValue(TH_BUT_DRAWTYPE) == TH_MINIMAL)
sa->headertype = -sa->headertype;
/* right border area */
if(sa->headertype==HEADERTOP) sdrawline(x2, y1, x2, y2-SCR_ROUND+1);
else if(sa->headertype==HEADERDOWN) sdrawline(x2, y1+SCR_ROUND-1, x2, y2);
@ -3697,6 +3703,9 @@ void drawscredge_area(ScrArea *sa)
if(sa->headertype==HEADERDOWN) sdrawline(x1+SCR_ROUND-3, y1, x2-SCR_ROUND+3, y1);
else sdrawline(x1, y1, x2, y1);
/* restore real header type */
if (BIF_GetThemeValue(TH_BUT_DRAWTYPE) == TH_MINIMAL)
sa->headertype = -sa->headertype;
}
/* ********************************* */

@ -102,8 +102,14 @@ static int roundboxtype= 15;
void uiSetRoundBox(int type)
{
roundboxtype= type;
/* Not sure the roundbox function is the best place to change this
* if this is undone, its not that big a deal, only makes curves edges
* square for the */
if (BIF_GetThemeValue(TH_BUT_DRAWTYPE) == TH_MINIMAL)
roundboxtype= 0;
else
roundboxtype= type;
/* flags to set which corners will become rounded:
1------2
@ -204,8 +210,10 @@ void gl_round_box_shade(int mode, float minx, float miny, float maxx, float maxy
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;
glShadeModel(GL_SMOOTH);
glBegin(mode);
if (BIF_GetThemeValue(TH_BUT_DRAWTYPE) != TH_MINIMAL) {
glShadeModel(GL_SMOOTH);
glBegin(mode);
}
/* start with corner right-bottom */
if(roundboxtype & 4) {
@ -350,12 +358,14 @@ void uiRoundBoxEmboss(float minx, float miny, float maxx, float maxy, float rad,
//if(active)
// gl_round_box_shade(GL_POLYGON, minx, miny, maxx, maxy, rad, 0.10, -0.05);
// else
/* shading doesnt work for certain buttons yet (pulldown) need smarter buffer caching (ton) §*/
/* shading doesnt work for certain buttons yet (pulldown) need smarter buffer caching (ton) */
gl_round_box(GL_POLYGON, minx, miny, maxx, maxy, rad);
/* set antialias line */
glEnable( GL_LINE_SMOOTH );
glEnable( GL_BLEND );
if (BIF_GetThemeValue(TH_BUT_DRAWTYPE) != TH_MINIMAL) {
glEnable( GL_LINE_SMOOTH );
glEnable( GL_BLEND );
}
/* top shade */
gl_round_box_topshade(minx+1, miny+1, maxx-1, maxy-1, rad);
@ -388,8 +398,10 @@ void uiRoundRect(float minx, float miny, float maxx, float maxy, float rad)
}
/* set antialias line */
glEnable( GL_LINE_SMOOTH );
glEnable( GL_BLEND );
if (BIF_GetThemeValue(TH_BUT_DRAWTYPE) != TH_MINIMAL) {
glEnable( GL_LINE_SMOOTH );
glEnable( GL_BLEND );
}
gl_round_box(GL_LINE_LOOP, minx, miny, maxx, maxy, rad);
@ -415,9 +427,11 @@ void uiRoundBox(float minx, float miny, float maxx, float maxy, float rad)
gl_round_box(GL_POLYGON, minx, miny, maxx, maxy, rad);
/* set antialias line */
glEnable( GL_LINE_SMOOTH );
glEnable( GL_BLEND );
if (BIF_GetThemeValue(TH_BUT_DRAWTYPE) != TH_MINIMAL) {
glEnable( GL_LINE_SMOOTH );
glEnable( GL_BLEND );
}
gl_round_box(GL_LINE_LOOP, minx, miny, maxx, maxy, rad);
glDisable( GL_BLEND );