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>2003-10-15 17:47:15 +0400
committerMatt Ebb <matt@mke3.net>2003-10-15 17:47:15 +0400
commitc2c7bb6648e3727fa24ac58d540c5bd146d02c4f (patch)
tree46d2aacfb28269c99a782bf2d35801927f831235 /source/blender/src/interface.c
parent3bf09a5447b755bbb5e2a71ca108f2f16625ce7a (diff)
- Modified drawing of ICONROW controls to be clearer,
more consistent and logical. (ICONROWs haven't scrolled left/right in years! More detailed tweaking of headerbuttons positions can come when more menus are finished - added text labels to the drawtype menu in 3d view header
Diffstat (limited to 'source/blender/src/interface.c')
-rw-r--r--source/blender/src/interface.c345
1 files changed, 248 insertions, 97 deletions
diff --git a/source/blender/src/interface.c b/source/blender/src/interface.c
index 3c8729fd2d7..2977d702156 100644
--- a/source/blender/src/interface.c
+++ b/source/blender/src/interface.c
@@ -429,31 +429,26 @@ static void ui_draw_icon(uiBut *but, BIFIconID icon)
{
float xs=0, ys=0;
- /* check for aligned icons (in case of IconTextBut) */
- if (but->type == ICONTEXTROW) {
- xs= (but->x1+but->x2- BIF_get_icon_width(icon))/2.0;
- ys= (but->y1+but->y2- BIF_get_icon_height(icon))/2.0;
- }
- else {
- if(but->flag & UI_ICON_LEFT) {
- if (but->type==BUTM) {
- xs= but->x1+1.0;
- }
- else {
- xs= but->x1+6.0;
- }
- ys= (but->y1+but->y2- BIF_get_icon_height(icon))/2.0;
+ if(but->flag & UI_ICON_LEFT) {
+ if (but->type==BUTM) {
+ xs= but->x1+1.0;
}
- if(but->flag & UI_ICON_RIGHT) {
- xs= but->x2-17.0;
- ys= (but->y1+but->y2- BIF_get_icon_height(icon))/2.0;
+ else if ((but->type==ICONROW) || (but->type==ICONTEXTROW)) {
+ xs= but->x1+4.0;
}
- if (!((but->flag & UI_ICON_RIGHT) || (but->flag & UI_ICON_LEFT))) {
- xs= (but->x1+but->x2- BIF_get_icon_width(icon))/2.0;
- ys= (but->y1+but->y2- BIF_get_icon_height(icon))/2.0;
+ else {
+ xs= but->x1+6.0;
}
+ ys= (but->y1+but->y2- BIF_get_icon_height(icon))/2.0;
+ }
+ if(but->flag & UI_ICON_RIGHT) {
+ xs= but->x2-17.0;
+ ys= (but->y1+but->y2- BIF_get_icon_height(icon))/2.0;
+ }
+ if (!((but->flag & UI_ICON_RIGHT) || (but->flag & UI_ICON_LEFT))) {
+ xs= (but->x1+but->x2- BIF_get_icon_width(icon))/2.0;
+ ys= (but->y1+but->y2- BIF_get_icon_height(icon))/2.0;
}
- /* END check for aligned icons (in case of IconTextBut) */
glRasterPos2f(xs, ys);
@@ -922,8 +917,8 @@ static void ui_emboss_MENU(BIFColorID bc, float asp, float x1, float y1, float x
if(flag & UI_SELECT) {
- if(flag & UI_ACTIVE) BIF_set_color(bc, COLORSHADE_MEDIUM);
- else BIF_set_color(bc, COLORSHADE_LGREY);
+ if(flag & UI_ACTIVE) BIF_set_color(bc, COLORSHADE_LGREY);
+ else BIF_set_color(bc, COLORSHADE_GREY);
}
else {
if(flag & UI_ACTIVE) BIF_set_color(bc, COLORSHADE_LIGHT);
@@ -934,8 +929,8 @@ static void ui_emboss_MENU(BIFColorID bc, float asp, float x1, float y1, float x
glVertex2f(x2,y1);
if(flag & UI_SELECT) {
- if(flag & UI_ACTIVE) BIF_set_color(bc, COLORSHADE_LGREY);
- else BIF_set_color(bc, COLORSHADE_GREY);
+ if(flag & UI_ACTIVE) BIF_set_color(bc, COLORSHADE_GREY);
+ else BIF_set_color(bc, COLORSHADE_DARK);
}
else {
if(flag & UI_ACTIVE) BIF_set_color(bc, COLORSHADE_WHITE);
@@ -951,8 +946,8 @@ static void ui_emboss_MENU(BIFColorID bc, float asp, float x1, float y1, float x
glBegin(GL_QUADS);
if(flag & UI_SELECT) {
- if(flag & UI_ACTIVE) BIF_set_color(bc, COLORSHADE_LGREY);
- else BIF_set_color(bc, COLORSHADE_GREY);
+ if(flag & UI_ACTIVE) BIF_set_color(bc, COLORSHADE_GREY);
+ else BIF_set_color(bc, COLORSHADE_DARK);
}
else {
if(flag & UI_ACTIVE) BIF_set_color(bc, COLORSHADE_WHITE);
@@ -1107,6 +1102,209 @@ static void ui_emboss_MENU(BIFColorID bc, float asp, float x1, float y1, float x
}
+static void ui_emboss_ICONROW(BIFColorID bc, float asp, float x1, float y1, float x2, float y2, int flag)
+{
+
+ float asp1;
+
+ asp1= asp;
+
+ /*x1+= asp1;*/
+ x2-= asp1;
+ /*y1+= asp1;*/
+ y2-= asp1;
+
+ /* SHADED BUTTON */
+ glShadeModel(GL_SMOOTH);
+ glBegin(GL_QUADS);
+
+
+ if(flag & UI_SELECT) {
+ if(flag & UI_ACTIVE) BIF_set_color(bc, COLORSHADE_MEDIUM);
+ else BIF_set_color(bc, COLORSHADE_LGREY);
+ }
+ else {
+ if(flag & UI_ACTIVE) BIF_set_color(bc, COLORSHADE_LIGHT);
+ else BIF_set_color(bc, COLORSHADE_HILITE);
+ }
+
+ glVertex2f(x1,y1);
+ glVertex2f(x2,y1);
+
+ if(flag & UI_SELECT) {
+ if(flag & UI_ACTIVE) BIF_set_color(bc, COLORSHADE_LGREY);
+ else BIF_set_color(bc, COLORSHADE_GREY);
+ }
+ else {
+ if(flag & UI_ACTIVE) BIF_set_color(bc, COLORSHADE_WHITE);
+ BIF_set_color(bc, COLORSHADE_LIGHT);
+ }
+
+ glVertex2f(x2,(y2-(y2-y1)/3));
+ glVertex2f(x1,(y2-(y2-y1)/3));
+ glEnd();
+
+
+ glShadeModel(GL_FLAT);
+ glBegin(GL_QUADS);
+
+ if(flag & UI_SELECT) {
+ if(flag & UI_ACTIVE) BIF_set_color(bc, COLORSHADE_LGREY);
+ else BIF_set_color(bc, COLORSHADE_GREY);
+ }
+ else {
+ if(flag & UI_ACTIVE) BIF_set_color(bc, COLORSHADE_WHITE);
+ BIF_set_color(bc, COLORSHADE_LIGHT);
+ }
+
+ glVertex2f(x1,(y2-(y2-y1)/3));
+ glVertex2f(x2,(y2-(y2-y1)/3));
+ glVertex2f(x2,y2);
+ glVertex2f(x1,y2);
+
+ glEnd();
+ /* END SHADED BUTTON */
+
+ /* OUTER SUNKEN EFFECT */
+ /* left */
+ glShadeModel(GL_SMOOTH);
+ glBegin(GL_LINES);
+ BIF_set_color(BUTGREY, COLORSHADE_WHITE);
+ glVertex2f(x1-1,y1);
+ BIF_set_color(BUTGREY, COLORSHADE_LIGHT);
+ glVertex2f(x1-1,y2);
+ glEnd();
+
+ /* right */
+ glShadeModel(GL_SMOOTH);
+ glBegin(GL_LINES);
+ BIF_set_color(BUTGREY, COLORSHADE_WHITE);
+ glVertex2f(x2+1,y1);
+ BIF_set_color(BUTGREY, COLORSHADE_LIGHT);
+ glVertex2f(x2+1,y2);
+ glEnd();
+
+ /* bottom */
+ BIF_set_color(BUTGREY, COLORSHADE_WHITE);
+ fdrawline(x1, y1-1, x2, y1-1);
+ /* END OUTER SUNKEN EFFECT */
+
+ /* INNER OUTLINE */
+ glShadeModel(GL_FLAT);
+
+ /* top */
+ if(flag & UI_SELECT) {
+ if(flag & UI_ACTIVE) BIF_set_color(bc, COLORSHADE_GREY);
+ else BIF_set_color(bc, COLORSHADE_GREY);
+ }
+ else {
+ if(flag & UI_ACTIVE) BIF_set_color(bc, COLORSHADE_WHITE);
+ BIF_set_color(bc, COLORSHADE_WHITE);
+ }
+
+ fdrawline(x1, (y2-1), x2, y2-1);
+
+ /* bottom */
+
+ if(flag & UI_SELECT) {
+ if(flag & UI_ACTIVE) BIF_set_color(bc, COLORSHADE_LGREY);
+ else BIF_set_color(bc, COLORSHADE_LGREY);
+ }
+ else {
+ if(flag & UI_ACTIVE) BIF_set_color(bc, COLORSHADE_LMEDIUM);
+ BIF_set_color(bc, COLORSHADE_LMEDIUM);
+ }
+ fdrawline(x1, (y1+1), x2, y1+1);
+
+ /* left */
+ if(!(flag & UI_SELECT)) {
+
+ glShadeModel(GL_SMOOTH);
+ glBegin(GL_LINES);
+ BIF_set_color(bc, COLORSHADE_WHITE);
+ glVertex2f(x1+1,y1+2);
+ BIF_set_color(bc, COLORSHADE_LGREY);
+ glVertex2f(x1+1,y2);
+ glEnd();
+
+ }
+
+ /* right */
+ if(!(flag & UI_SELECT)) {
+
+ glShadeModel(GL_SMOOTH);
+ glBegin(GL_LINES);
+ BIF_set_color(bc, COLORSHADE_LGREY);
+ glVertex2f(x2-1,y1+2);
+ BIF_set_color(bc, COLORSHADE_WHITE);
+ glVertex2f(x2-1,y2);
+ glEnd();
+
+ }
+ /* END INNER OUTLINE */
+
+ /* OUTER OUTLINE */
+ glShadeModel(GL_FLAT);
+
+ /* underneath semi-fake-AA */
+ BIF_set_color(BUTGREY, COLORSHADE_GREY);
+ fdrawline(x1, y2, x2, y2);
+ BIF_set_color(BUTGREY, COLORSHADE_MEDIUM);
+ fdrawline(x1, y1, x2, y1);
+
+ /* top */
+ BIF_set_color(BUTGREY, COLORSHADE_DARK);
+ fdrawline(x1+1, y2, x2, y2);
+
+ /* left */
+ fdrawline(x1, y1+1, x1, y2);
+
+ /* right */
+ fdrawline(x2, y1+1, x2, y2);
+
+ /* bottom */
+ BIF_set_color(BUTGREY, COLORSHADE_DARK);
+ fdrawline(x1+1, y1, x2, y1);
+ /* END OUTER OUTLINE */
+
+ /* DARKENED AREA */
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_BLEND);
+
+ glColor4ub(0, 0, 0, 30);
+ glRectf(x2-9, y1, x2, y2);
+
+ glDisable(GL_BLEND);
+ /* END DARKENED AREA */
+
+ /* MENU DOUBLE-ARROW */
+
+ /* set antialias line */
+ BIF_set_color(bc, COLORSHADE_DARK);
+
+ glEnable( GL_POLYGON_SMOOTH );
+ glEnable( GL_BLEND );
+ glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
+
+ glShadeModel(GL_FLAT);
+ glBegin(GL_TRIANGLES);
+ glVertex2f((short)x2-2,(short)(y2-(y2-y1)/2)+1);
+ glVertex2f((short)x2-6,(short)(y2-(y2-y1)/2)+1);
+ glVertex2f((short)x2-4,(short)(y2-(y2-y1)/2)+4);
+ glEnd();
+
+ glBegin(GL_TRIANGLES);
+ glVertex2f((short)x2-2,(short)(y2-(y2-y1)/2) -1);
+ glVertex2f((short)x2-6,(short)(y2-(y2-y1)/2) -1);
+ glVertex2f((short)x2-4,(short)(y2-(y2-y1)/2) -4);
+ glEnd();
+
+ glDisable( GL_BLEND );
+ glDisable( GL_POLYGON_SMOOTH );
+ /* MENU DOUBLE-ARROW */
+
+}
+
static void ui_emboss_TABL(BIFColorID bc, float asp, float x1, float y1, float x2, float y2, int flag)
{
@@ -1516,6 +1714,16 @@ static void ui_draw_but_BUT(uiBut *but)
{
float x=0.0;
+ /* check for button text label */
+ if (but->type == ICONTEXTROW) {
+ but->embossfunc = ui_emboss_ICONROW;
+ but->flag |= UI_ICON_LEFT;
+ ui_draw_icon(but, (BIFIconID) (but->icon+but->iconadd));
+ } else if (but->type == ICONROW) {
+ but->flag |= UI_ICON_LEFT;
+ but->embossfunc = ui_emboss_ICONROW;
+ }
+
but->embossfunc(but->col, but->aspect, but->x1, but->y1, but->x2, but->y2, but->flag);
if(but->embossfunc==ui_emboss_TABL) {
@@ -1752,6 +1960,10 @@ static void ui_draw_but_BUTM(uiBut *but)
char *cpoin;
int sel;
+ if (but->type == MENU) {
+ but->embossfunc = ui_emboss_MENU;
+ }
+
but->embossfunc(but->col, but->aspect, but->x1, but->y1, but->x2, but->y2, but->flag);
/* check for button text label */
@@ -1886,89 +2098,28 @@ static void ui_draw_but(uiBut *but)
case ICONTOG:
case KEYEVT:
case IDPOIN:
+ case ICONROW:
+ case ICONTEXTROW:
ui_draw_but_BUT(but);
break;
+
case NUM:
ui_draw_but_NUM(but);
break;
+
case TEX:
ui_draw_but_TEX(but);
break;
-
+
case BUTM:
case BLOCK:
ui_draw_but_BUTM(but);
break;
-
- case ICONROW:
- ui_draw_but_BUT(but);
-
- /* draw arriws, icon is standard RGB */
- a= (but->y1+but->y2)/2;
-
- glColor3ub(0,0,0);
- sdrawline((short)(but->x1-1), (short)(a-2), (short)(but->x1-1), (short)(a+2));
- sdrawline((short)(but->x1-2), (short)(a-1), (short)(but->x1-2), (short)(a+1));
- sdrawline((short)(but->x1-3), a, (short)(but->x1-3), a);
- glColor3ub(255,255,255);
- sdrawline((short)(but->x1-3), (short)(a-1), (short)(but->x1-1), (short)(a-3));
-
- glColor3ub(0,0,0);
- sdrawline((short)(but->x2+1), (short)(a-2), (short)(but->x2+1), (short)(a+2));
- sdrawline((short)(but->x2+2), (short)(a-1), (short)(but->x2+2), (short)(a+1));
- sdrawline((short)(but->x2+3), a, (short)(but->x2+3), a);
- glColor3ub(255,255,255);
- sdrawline((short)(but->x2+3), (short)(a-1), (short)(but->x2+1), (short)(a-3));
-
- break;
-
- case ICONTEXTROW:
- ui_draw_but_BUT(but);
-
- /* teken pijltjes, icon is standaard RGB */
- a= (but->y1+but->y2)/2;
-
- glColor3ub(0,0,0);
- sdrawline((short)(but->x1-1), (short)(a-2), (short)(but->x1-1), (short)(a+2));
- sdrawline((short)(but->x1-2), (short)(a-1), (short)(but->x1-2), (short)(a+1));
- sdrawline((short)(but->x1-3), a, (short)(but->x1-3), a);
- glColor3ub(255,255,255);
- sdrawline((short)(but->x1-3), (short)(a-1), (short)(but->x1-1), (short)(a-3));
-
- glColor3ub(0,0,0);
- sdrawline((short)(but->x2+1), (short)(a-2), (short)(but->x2+1), (short)(a+2));
- sdrawline((short)(but->x2+2), (short)(a-1), (short)(but->x2+2), (short)(a+1));
- sdrawline((short)(but->x2+3), a, (short)(but->x2+3), a);
- glColor3ub(255,255,255);
- sdrawline((short)(but->x2+3), (short)(a-1), (short)(but->x2+1), (short)(a-3));
-
- break;
-
- case MENU:
+ case MENU:
ui_draw_but_MENU(but);
-
- /* when sufficient space: darw symbols
- if(but->strwidth+10 < but->x2-but->x1) {
-
-
-
-
-
- int h;
-
- h= but->y2- but->y1;
- x1= but->x2-0.66*h; x2= x1+.33*h;
- y1= but->y1+.42*h; y2= y1+.16*h;
-
- glColor3ub(0,0,0);
- glRecti(x1, y1, x2, y2);
- glColor3ub(255,255,255);
- glRecti(x1-1, y1+1, x2-1, y2+1);
-
- }*/
break;
-
+
case NUMSLI:
case HSVSLI:
@@ -2244,10 +2395,10 @@ void uiRoundBoxEmboss(float minx, float miny, float maxx, float maxy, float rad)
glDisable( GL_BLEND );
glDisable( GL_LINE_SMOOTH );
-
}
+
/* plain antialiased unfilled rectangle */
void uiRoundRect(float minx, float miny, float maxx, float maxy, float rad)
{
@@ -3688,7 +3839,7 @@ static int ui_do_but_ICONTEXTROW(uiBut *but)
ypos +=3;
}
else {
- uiDefIconTextBut(block, BUTM|but->pointype, but->retval, (short)(md->items[a].retval-but->min), md->items[a].str, 0, ypos,(short)width, 19, but->poin, (float) md->items[a].retval, 0.0, 0, 0, "");
+ uiDefIconTextBut(block, BUTM|but->pointype, but->retval, (short)((but->icon)+(md->items[a].retval-but->min)), md->items[a].str, 0, ypos,(short)width, 19, but->poin, (float) md->items[a].retval, 0.0, 0, 0, "");
ypos += 20;
}
}