Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Ebb <matt@mke3.net>2009-01-04 10:50:41 +0300
committerMatt Ebb <matt@mke3.net>2009-01-04 10:50:41 +0300
commit74f9e98c828c17910405092785633373d4ae88e8 (patch)
treeecbb6c22c0a67b36047a3b42373a40d00ec3226c /source/blender
parent0feedfe591f46667efdd0a70e3e29cd2e10927dd (diff)
* Enabled disabled drawing for 'locked' buttons
(made with uiBlockSetButLock())
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/include/UI_resources.h1
-rw-r--r--source/blender/editors/interface/interface.c6
-rw-r--r--source/blender/editors/interface/interface_draw.c17
-rw-r--r--source/blender/editors/interface/resources.c30
4 files changed, 47 insertions, 7 deletions
diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h
index 8068eea92d9..b2b1991dc8f 100644
--- a/source/blender/editors/include/UI_resources.h
+++ b/source/blender/editors/include/UI_resources.h
@@ -904,6 +904,7 @@ void UI_ThemeColorShadeAlpha(int colorid, int coloffset, int alphaoffset);
void UI_ThemeColorBlend(int colorid1, int colorid2, float fac);
// same, with shade offset
void UI_ThemeColorBlendShade(int colorid1, int colorid2, float fac, int offset);
+void UI_ThemeColorBlendShadeAlpha(int colorid1, int colorid2, float fac, int offset, int alphaoffset);
// returns one value, not scaled
float UI_GetThemeValuef(int colorid);
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 941528169c3..96becbcb4ad 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -2035,6 +2035,12 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, char *str, short
if(block->flag & UI_BLOCK_NO_HILITE)
but->flag |= UI_NO_HILITE;
+ if (but->lock) {
+ if (but->lockstr) {
+ but->flag |= UI_BUT_DISABLED;
+ }
+ }
+
return but;
}
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 7da4dcf8e21..8b07e491098 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -436,13 +436,14 @@ void uiRoundRect(float minx, float miny, float maxx, float maxy, float rad)
/* plain fake antialiased unfilled round rectangle */
void uiRoundRectFakeAA(float minx, float miny, float maxx, float maxy, float rad, float asp)
{
- float color[4];
+ float color[4], alpha;
float raddiff;
int i, passes=4;
/* get the colour and divide up the alpha */
glGetFloatv(GL_CURRENT_COLOR, color);
- color[3]= 1/(float)passes;
+ alpha = color[3];
+ color[3]= alpha/(float)passes;
glColor4fv(color);
/* set the 'jitter amount' */
@@ -456,6 +457,9 @@ void uiRoundRectFakeAA(float minx, float miny, float maxx, float maxy, float rad
}
glDisable( GL_BLEND );
+
+ color[3] = alpha;
+ glColor4fv(color);
}
/* (old, used in outliner) plain antialiased filled box */
@@ -706,6 +710,8 @@ static void ui_draw_icon(uiBut *but, BIFIconID icon, int blend)
else if(but->flag & UI_ACTIVE);
else blend= -60;
}
+ if (but->flag & UI_BUT_DISABLED) blend = -100;
+
UI_icon_draw_aspect_blended(xs, ys, icon, aspect, blend);
glDisable(GL_BLEND);
@@ -909,6 +915,7 @@ static void flat_button(float x1, float y1, float x2, float y2, float asp, int c
/* 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)
{
+ int alpha_offs= (flag & UI_BUT_DISABLED)?UI_DISABLED_ALPHA_OFFS:0;
float shadefac;
/* colour shading */
@@ -928,7 +935,7 @@ static void round_button_shaded(int type, int colorid, float asp, float x1, floa
gl_round_box_shade(GL_POLYGON, x1, y1, x2, y2, rad, shadefac, -shadefac);
/* outline */
- UI_ThemeColorBlendShade(TH_BUT_OUTLINE, TH_BACK, 0.1, -40);
+ UI_ThemeColorBlendShadeAlpha(TH_BUT_OUTLINE, TH_BACK, 0.1, -40, alpha_offs);
uiRoundRectFakeAA(x1, y1, x2, y2, rad, asp);
/* end outline */
@@ -937,6 +944,8 @@ static void round_button_shaded(int type, int colorid, float asp, float x1, floa
/* 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)
{
+ int alpha_offs= (flag & UI_BUT_DISABLED)?UI_DISABLED_ALPHA_OFFS:0;
+
/* colour shading */
if(flag & UI_SELECT) {
if (flag & UI_ACTIVE) UI_ThemeColorShade(colorid, -20);
@@ -952,7 +961,7 @@ static void round_button_flat(int colorid, float asp, float x1, float y1, float
gl_round_box(GL_POLYGON, x1, y1, x2, y2, rad);
/* outline */
- UI_ThemeColorBlendShade(TH_BUT_OUTLINE, TH_BACK, 0.1, -30);
+ UI_ThemeColorBlendShadeAlpha(TH_BUT_OUTLINE, TH_BACK, 0.1, -30, alpha_offs);
uiRoundRectFakeAA(x1, y1, x2, y2, rad, asp);
/* end outline */
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 786306cdfb9..0e742937bdc 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -838,13 +838,37 @@ void UI_ThemeColorBlendShade(int colorid1, int colorid2, float fac, int offset)
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);
+ CLAMP(r, 0, 255);
+ CLAMP(g, 0, 255);
+ CLAMP(b, 0, 255);
glColor3ub(r, g, b);
}
+// blend between to theme colors, shade it, and set it
+void UI_ThemeColorBlendShadeAlpha(int colorid1, int colorid2, float fac, int offset, int alphaoffset)
+{
+ int r, g, b, a;
+ char *cp1, *cp2;
+
+ cp1= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
+ cp2= UI_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]);
+ a= alphaoffset+floor((1.0-fac)*cp1[3] + fac*cp2[3]);
+
+ CLAMP(r, 0, 255);
+ CLAMP(g, 0, 255);
+ CLAMP(b, 0, 255);
+ CLAMP(a, 0, 255);
+
+ glColor4ub(r, g, b, a);
+}
+
+
// get individual values, not scaled
float UI_GetThemeValuef(int colorid)
{