diff options
author | Ton Roosendaal <ton@blender.org> | 2009-04-06 19:44:30 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2009-04-06 19:44:30 +0400 |
commit | 88ab62c03189a04f6a74b040ad269e5a901c4af1 (patch) | |
tree | e3b61d086d93e181215773869ce4246e22d76894 /source/blender | |
parent | 6e91947cda7252e2799e8b73b851f4cf0f0339ed (diff) |
2.5
- fixed pixel offset error for listview (outliner)
- removed a lot of old drawing code
- put back special widgets Normal, Curve, Colorband
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/interface/interface.c | 61 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_draw.c | 1896 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_intern.h | 8 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_widgets.c | 14 | ||||
-rw-r--r-- | source/blender/editors/interface/view2d.c | 5 |
5 files changed, 72 insertions, 1912 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 6f20d695e86..6a763ce64be 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -944,65 +944,6 @@ void uiBlockClearButLock(uiBlock *block) /* *************************************************************** */ -/* XXX 2.50 no button editing */ - -#if 0 -static void setup_file(uiBlock *block) -{ - uiBut *but; - FILE *fp; - - fp= fopen("butsetup","w"); - if(fp==NULL); - else { - but= block->buttons.first; - while(but) { - ui_check_but(but); - fprintf(fp,"%d,%d,%d,%d %s %s\n", (int)but->x1, (int)but->y1, (int)( but->x2-but->x1), (int)(but->y2-but->y1), but->str, but->tip); - but= but->next; - } - fclose(fp); - } -} - - -static void edit_but(uiBlock *block, uiBut *but, uiEvent *uevent) -{ - short dx, dy, mval[2], mvalo[2], didit=0; - - getmouseco_sc(mvalo); - while(TRUE) { - if( !(get_mbut() & L_MOUSE) ) break; - - getmouseco_sc(mval); - dx= (mval[0]-mvalo[0]); - dy= (mval[1]-mvalo[1]); - - if(dx!=0 || dy!=0) { - mvalo[0]= mval[0]; - mvalo[1]= mval[1]; - - cpack(0xc0c0c0); - glRectf(but->x1-2, but->y1-2, but->x2+2, but->y2+2); - - if((uevent->qual & LR_SHIFTKEY)==0) { - but->x1 += dx; - but->y1 += dy; - } - but->x2 += dx; - but->y2 += dy; - - ui_draw_but(ar, but); - ui_block_flush_back(but->block); - didit= 1; - - } - /* idle for this poor code */ - else PIL_sleep_ms(30); - } - if(didit) setup_file(block); -} -#endif /* XXX 2.50 no links supported yet */ #if 0 @@ -2430,8 +2371,6 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, char *str, short but->func_arg1= block->func_arg1; but->func_arg2= block->func_arg2; - ui_set_embossfunc(but, block->dt); - but->pos= -1; /* cursor invisible */ if(ELEM(but->type, NUM, NUMABS)) { /* add a space to name */ diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 5b2c47c0123..e623a906f16 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -156,55 +156,9 @@ static void round_box_shade_col(float *col1, float *col2, float fac) glColor3fv(col); } -/* only for headers */ -static void gl_round_box_topshade(float minx, float miny, float maxx, float maxy, float rad) -{ - 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}}; - char col[7]= {140, 165, 195, 210, 230, 245, 255}; - int a; - char alpha=255; - - if(roundboxtype & UI_RB_ALPHA) alpha= 128; - - /* mult */ - for(a=0; a<7; a++) { - vec[a][0]*= rad; vec[a][1]*= rad; - } - - /* shades from grey->white->grey */ - glBegin(GL_LINE_STRIP); - - if(roundboxtype & 3) { - /* corner right-top */ - glColor4ub(140, 140, 140, alpha); - glVertex2f( maxx, maxy-rad); - for(a=0; a<7; a++) { - glColor4ub(col[a], col[a], col[a], alpha); - glVertex2f( maxx-vec[a][1], maxy-rad+vec[a][0]); - } - glColor4ub(225, 225, 225, alpha); - glVertex2f( maxx-rad, maxy); - - - /* corner left-top */ - glVertex2f( minx+rad, maxy); - for(a=0; a<7; a++) { - glColor4ub(col[6-a], col[6-a], col[6-a], alpha); - glVertex2f( minx+rad-vec[a][0], maxy-vec[a][1]); - } - glVertex2f( minx, maxy-rad); - } - else { - glColor4ub(225, 225, 225, alpha); - glVertex2f( minx, maxy); - glVertex2f( maxx, maxy); - } - - glEnd(); -} /* linear horizontal shade within button or in outline */ +/* view2d scrollers use it */ 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}, @@ -313,6 +267,7 @@ void gl_round_box_shade(int mode, float minx, float miny, float maxx, float maxy } /* linear vertical shade within button or in outline */ +/* view2d scrollers use it */ void gl_round_box_vertical_shade(int mode, float minx, float miny, float maxx, float maxy, float rad, float shadeLeft, float shadeRight) { float vec[7][2]= {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293}, @@ -497,81 +452,6 @@ void uiRoundBox(float minx, float miny, float maxx, float maxy, float rad) glDisable( GL_LINE_SMOOTH ); } -void uiTriangleFakeAA(float x1, float y1, float x2, float y2, float x3, float y3, float asp) -{ - float color[4], alpha; - float jitter; - int i, passes=4; - - /* get the colour and divide up the alpha */ - glGetFloatv(GL_CURRENT_COLOR, color); - alpha = color[3]; - color[3]= alpha/(float)passes; - glColor4fv(color); - - /* set the 'jitter amount' */ - jitter = 0.65/(float)passes * asp; - - 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, y1+(i*jitter)); - glVertex2f(x2, y2+(i*jitter)); - glVertex2f(x3, y3+(i*jitter)); - glEnd(); - } - - glDisable( GL_BLEND ); - - color[3] = alpha; - glColor4fv(color); -} - -/* for headers and floating panels */ -void uiRoundBoxEmboss(float minx, float miny, float maxx, float maxy, float rad, int active) -{ - float color[4]; - - if(roundboxtype & UI_RB_ALPHA) { - glGetFloatv(GL_CURRENT_COLOR, color); - color[3]= 0.5; - glColor4fv(color); - glEnable( GL_BLEND ); - } - - /* solid part */ - //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) */ - gl_round_box(GL_POLYGON, minx, miny, maxx, maxy, rad); - - /* set antialias line */ - if (UI_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); - - /* total outline */ - if(roundboxtype & UI_RB_ALPHA) glColor4ub(0,0,0, 128); else glColor4ub(0,0,0, 200); - gl_round_box(GL_LINE_LOOP, minx, miny, maxx, maxy, rad); - - glDisable( GL_LINE_SMOOTH ); - - /* bottom shade for header down */ - if((roundboxtype & 12)==12) { - glColor4ub(0,0,0, 80); - fdrawline(minx+rad-1.0, miny+1.0, maxx-rad+1.0, miny+1.0); - } - glDisable( GL_BLEND ); -} /* ************** safe rasterpos for pixmap alignment with pixels ************* */ @@ -604,6 +484,8 @@ void ui_rasterpos_safe(float x, float y, float aspect) /* ************** generic embossed rect, for window sliders etc ************* */ + +/* text_draw.c uses this */ void uiEmboss(float x1, float y1, float x2, float y2, int sel) { @@ -696,1510 +578,8 @@ void ui_draw_icon(uiBut *but, BIFIconID icon, int blend) } -/* ************** DEFAULT THEME, SHADED BUTTONS ************* */ - - -#define M_WHITE UI_ThemeColorShade(colorid, 80) - -#define M_ACT_LIGHT UI_ThemeColorShade(colorid, 55) -#define M_LIGHT UI_ThemeColorShade(colorid, 45) -#define M_HILITE UI_ThemeColorShade(colorid, 25) -#define M_LMEDIUM UI_ThemeColorShade(colorid, 10) -#define M_MEDIUM UI_ThemeColor(colorid) -#define M_LGREY UI_ThemeColorShade(colorid, -20) -#define M_GREY UI_ThemeColorShade(colorid, -45) -#define M_DARK UI_ThemeColorShade(colorid, -80) - -#define M_NUMTEXT UI_ThemeColorShade(colorid, 25) -#define M_NUMTEXT_ACT_LIGHT UI_ThemeColorShade(colorid, 35) - -#define MM_WHITE UI_ThemeColorShade(TH_BUT_NEUTRAL, 120) - -/* Used for the subtle sunken effect around buttons. - * 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 UI_ThemeColorShadeAlpha(TH_BACK, 55, -100) -#define MM_WHITE_TR UI_ThemeColorShadeAlpha(TH_BACK, 55, -255) - -#define MM_LIGHT UI_ThemeColorShade(TH_BUT_OUTLINE, 45) -#define MM_MEDIUM UI_ThemeColor(TH_BUT_OUTLINE) -#define MM_GREY UI_ThemeColorShade(TH_BUT_OUTLINE, -45) -#define MM_DARK UI_ThemeColorShade(TH_BUT_OUTLINE, -80) - -/* base shaded button */ -static void shaded_button(float x1, float y1, float x2, float y2, float asp, int colorid, int flag, int mid) -{ - /* 'mid' arg determines whether the button is in the middle of - * an alignment group or not. 0 = not middle, 1 = is in the middle. - * Done to allow cleaner drawing - */ - - /* *** SHADED BUTTON BASE *** */ - glShadeModel(GL_SMOOTH); - glBegin(GL_QUADS); - - if(flag & UI_SELECT) { - if(flag & UI_ACTIVE) M_MEDIUM; - else M_LGREY; - } else { - if(flag & UI_ACTIVE) M_LIGHT; - else M_HILITE; - } - - glVertex2f(x1,y1); - glVertex2f(x2,y1); - - if(flag & UI_SELECT) { - if(flag & UI_ACTIVE) M_LGREY; - else M_GREY; - } else { - if(flag & UI_ACTIVE) M_ACT_LIGHT; - else M_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) M_LGREY; - else M_GREY; - } else { - if(flag & UI_ACTIVE) M_ACT_LIGHT; - else M_LIGHT; - } - - glVertex2f(x1,(y2-(y2-y1)/3)); - glVertex2f(x2,(y2-(y2-y1)/3)); - glVertex2f(x2,y2); - glVertex2f(x1,y2); - - glEnd(); - /* *** END SHADED BUTTON BASE *** */ - - /* *** INNER OUTLINE *** */ - /* left */ - if(!(flag & UI_SELECT)) { - glShadeModel(GL_SMOOTH); - glBegin(GL_LINES); - M_MEDIUM; - glVertex2f(x1+1,y1+2); - M_WHITE; - glVertex2f(x1+1,y2); - glEnd(); - } - - /* right */ - if(!(flag & UI_SELECT)) { - glShadeModel(GL_SMOOTH); - glBegin(GL_LINES); - M_MEDIUM; - glVertex2f(x2-1,y1+2); - M_WHITE; - glVertex2f(x2-1,y2); - glEnd(); - } - - glShadeModel(GL_FLAT); - - /* top */ - if(flag & UI_SELECT) { - if(flag & UI_ACTIVE) M_LGREY; - else M_GREY; - } else { - if(flag & UI_ACTIVE) M_WHITE; - else M_WHITE; - } - - fdrawline(x1, (y2-1), x2, (y2-1)); - - /* bottom */ - if(flag & UI_SELECT) { - if(flag & UI_ACTIVE) M_MEDIUM; - else M_LGREY; - } else { - if(flag & UI_ACTIVE) M_LMEDIUM; - else M_MEDIUM; - } - fdrawline(x1, (y1+1), x2, (y1+1)); - /* *** END INNER OUTLINE *** */ - - /* *** OUTER OUTLINE *** */ - if (mid) { - // we draw full outline, its not AA, and it works better button mouse-over hilite - MM_DARK; - - // left right - fdrawline(x1, y1, x1, y2); - fdrawline(x2, y1, x2, y2); - - // top down - fdrawline(x1, y2, x2, y2); - fdrawline(x1, y1, x2, y1); - } else { - MM_DARK; - gl_round_box(GL_LINE_LOOP, x1, y1, x2, y2, 1.5); - } - /* END OUTER OUTLINE */ -} - -/* base flat button */ -static void flat_button(float x1, float y1, float x2, float y2, float asp, int colorid, int flag, int mid) -{ - /* 'mid' arg determines whether the button is in the middle of - * an alignment group or not. 0 = not middle, 1 = is in the middle. - * Done to allow cleaner drawing - */ - - /* *** FLAT TEXT/NUM FIELD *** */ - glShadeModel(GL_FLAT); - if(flag & UI_SELECT) { - if(flag & UI_ACTIVE) M_LGREY; - else M_GREY; - } - else { - if(flag & UI_ACTIVE) M_NUMTEXT_ACT_LIGHT; - else M_NUMTEXT; - } - - glRectf(x1, y1, x2, y2); - /* *** END FLAT TEXT/NUM FIELD *** */ - - /* *** OUTER OUTLINE *** */ - if (mid) { - // we draw full outline, its not AA, and it works better button mouse-over hilite - MM_DARK; - - // left right - fdrawline(x1, y1, x1, y2); - fdrawline(x2, y1, x2, y2); - - // top down - fdrawline(x1, y2, x2, y2); - fdrawline(x1, y1, x2, y1); - } else { - MM_DARK; - gl_round_box(GL_LINE_LOOP, x1, y1, x2, y2, 1.5); - } - /* 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) -{ - int alpha_offs= (flag & UI_BUT_DISABLED)?UI_DISABLED_ALPHA_OFFS:0; - float shadefac; - - /* emboss */ - glColor4f(1.0f, 1.0f, 1.0f, 0.08f); - uiRoundRectFakeAA(x1+1, y1-1, x2, y2-1, rad, asp); - - /* 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_ThemeColorBlendShadeAlpha(TH_BUT_OUTLINE, TH_BACK, 0.1, -40, alpha_offs); - - 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) -{ - int alpha_offs= (flag & UI_BUT_DISABLED)?UI_DISABLED_ALPHA_OFFS:0; - - /* emboss */ - //glColor4f(1.0f, 1.0f, 1.0f, 0.08f); - //uiRoundRectFakeAA(x1+1, y1-1, x2, y2-1, rad, asp); - - /* colour shading */ - if(flag & UI_SELECT) { - if (flag & UI_ACTIVE) UI_ThemeColorShade(colorid, -30); - else UI_ThemeColorShade(colorid, -45); - } - else { - if(flag & UI_ACTIVE) UI_ThemeColorShade(colorid, 35); - else UI_ThemeColorShade(colorid, 25); - } - - /* the solid base */ - gl_round_box(GL_POLYGON, x1, y1, x2, y2, rad); - - /* outline */ - UI_ThemeColorBlendShadeAlpha(TH_BUT_OUTLINE, TH_BACK, 0.1, -30, alpha_offs); - uiRoundRectFakeAA(x1, y1, x2, y2, rad, asp); -} - -static void ui_checkmark_box(int colorid, float x1, float y1, float x2, float y2) -{ - 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, -30); - gl_round_box(GL_LINE_LOOP, x1+4, (y1+(y2-y1)/2)-5, x1+14, (y1+(y2-y1)/2)+4, 2); - -} -static void ui_checkmark(float x1, float y1, float x2, float y2) -{ - glEnable( GL_LINE_SMOOTH ); - glEnable( GL_BLEND ); - glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); - glLineWidth(1.5); - - 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 ); -} - -static void ui_draw_toggle_checkbox(int flag, int type, int colorid, float x1, float y1, float x2, float y2) -{ - 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) { - ui_checkmark_box(colorid, x1, y1, x2, y2); - - /* TOG3 is handled with ui_tog3_invert() - * remember to update checkmark drawing there too*/ - if((flag & UI_SELECT) && (type != TOG3)) { - UI_ThemeColorShade(colorid, -140); - - ui_checkmark(x1, y1, x2, y2); - } - /* 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(); - } - } -} - - -/* small side double arrow for iconrow */ -static void ui_iconrow_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-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 ); -} - -/* side double arrow for menu */ -static void ui_menu_arrows(float x1, float y1, float x2, float y2, float asp) -{ - /* 'point' first, then two base vertices */ - uiTriangleFakeAA(x2-9, (y2-(y2-y1)/2)+6, - x2-6, (y2-(y2-y1)/2)+2, - x2-12, (y2-(y2-y1)/2)+2, asp); - - uiTriangleFakeAA(x2-9, (y2-(y2-y1)/2)-6, - x2-6, (y2-(y2-y1)/2)-2, - x2-12, (y2-(y2-y1)/2)-2, asp); -} - -/* left/right arrows for number fields */ -static void ui_num_arrows(float x1, float y1, float x2, float y2, float asp) -{ - if( x2-x1 > 25) { // 25 is a bit arbitrary, but small buttons cant have arrows - - /* '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, asp); - - uiTriangleFakeAA(x2-4, y2-(y2-y1)/2, - x2-9, y2-(y2-y1)/2+3, - x2-9, y2-(y2-y1)/2-3, asp); - } -} - - -/* changing black/white for TOG3 buts */ -static void ui_tog3_invert(float x1, float y1, float x2, float y2, int seltype) -{ - - if (seltype == 0) { - UI_ThemeColorShade(TH_BUT_SETTING, -120); - - glEnable( GL_LINE_SMOOTH ); - glEnable( GL_BLEND ); - glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); - glLineWidth(1.0); - - 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)); - - glLineWidth(1.0); - glDisable( GL_BLEND ); - glDisable( GL_LINE_SMOOTH ); - } else { - /* horiz line */ - UI_ThemeColorShade(TH_BUT_SETTING, -120); - - glEnable( GL_LINE_SMOOTH ); - glEnable( GL_BLEND ); - glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); - glLineWidth(1.0); - - fdrawline(x1+6, (y1+(y2-y1)/2), x1+14, (y1+(y2-y1)/2)); - - glLineWidth(1.0); - glDisable( GL_BLEND ); - glDisable( GL_LINE_SMOOTH ); - - } -} - -/* 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 alpha_offs= (flag & UI_BUT_DISABLED)?UI_DISABLED_ALPHA_OFFS: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); - 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_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_ThemeColorShadeAlpha(colorid, -80, alpha_offs); - } else { - UI_ThemeColorShadeAlpha(colorid, -45, alpha_offs); - } - ui_iconrow_arrows(x1, y1, x2, y2); - /* end iconrow double arrow */ - break; - case MENU: - /* menu double arrow */ - if(flag & UI_SELECT) { - UI_ThemeColorShadeAlpha(colorid, -110, alpha_offs); - } else { - UI_ThemeColorShadeAlpha(colorid, -80, alpha_offs); - } - ui_menu_arrows(x1, y1, x2, y2, asp); - /* 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; - int align= (flag & UI_BUT_ALIGN); - int alpha_offs= (flag & UI_BUT_DISABLED)?UI_DISABLED_ALPHA_OFFS:0; - - /* rounded corners */ - if (type == TEX) maxrad = 5.0; - else maxrad= 10.0; - - 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: - ui_draw_toggle_checkbox(flag, type, colorid, x1, y1, x2, y2); - break; - case NUM: - /* side arrows */ - if(flag & UI_SELECT) { - if(flag & UI_ACTIVE) UI_ThemeColorShadeAlpha(colorid, -70, alpha_offs); - else UI_ThemeColorShadeAlpha(colorid, -70, alpha_offs); - } else { - if(flag & UI_ACTIVE) UI_ThemeColorShadeAlpha(colorid, -40, alpha_offs); - else UI_ThemeColorShadeAlpha(colorid, -20, alpha_offs); - } - - ui_num_arrows(x1, y1, x2, y2, asp); - /* 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) -{ - int align= (flag & UI_BUT_ALIGN); - int alpha_offs= (flag & UI_BUT_DISABLED)?UI_DISABLED_ALPHA_OFFS:0; - - if(align) { - - /* *** BOTTOM OUTER SUNKEN EFFECT *** */ - if (!((align == UI_BUT_ALIGN_DOWN) || - (align == (UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_RIGHT)) || - (align == (UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_LEFT)))) { - glEnable(GL_BLEND); - MM_WHITE_OP; - fdrawline(x1, y1-1, x2, y1-1); - glDisable(GL_BLEND); - } - /* *** END BOTTOM OUTER SUNKEN EFFECT *** */ - - switch(align) { - case UI_BUT_ALIGN_TOP: - uiSetRoundBox(12); - - /* last arg in shaded_button() determines whether the button is in the middle of - * an alignment group or not. 0 = not middle, 1 = is in the middle. - * Done to allow cleaner drawing - */ - - shaded_button(x1, y1, x2, y2, asp, colorid, flag, 0); - break; - case UI_BUT_ALIGN_DOWN: - uiSetRoundBox(3); - shaded_button(x1, y1, x2, y2, asp, colorid, flag, 0); - break; - case UI_BUT_ALIGN_LEFT: - - /* RIGHT OUTER SUNKEN EFFECT */ - glEnable(GL_BLEND); - glShadeModel(GL_SMOOTH); - glBegin(GL_LINES); - MM_WHITE_OP; - glVertex2f(x2+1,y1); - MM_WHITE_TR; - glVertex2f(x2+1,y2); - glEnd(); - glDisable(GL_BLEND); - - uiSetRoundBox(6); - shaded_button(x1, y1, x2, y2, asp, colorid, flag, 0); - break; - case UI_BUT_ALIGN_RIGHT: - - /* LEFT OUTER SUNKEN EFFECT */ - glEnable(GL_BLEND); - glShadeModel(GL_SMOOTH); - glBegin(GL_LINES); - MM_WHITE_OP; - glVertex2f(x1-1,y1); - MM_WHITE_TR; - glVertex2f(x1-1,y2); - glEnd(); - glDisable(GL_BLEND); - - uiSetRoundBox(9); - shaded_button(x1, y1, x2, y2, asp, colorid, flag, 0); - break; - - case UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_RIGHT: - uiSetRoundBox(1); - shaded_button(x1, y1, x2, y2, asp, colorid, flag, 0); - break; - case UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_LEFT: - uiSetRoundBox(2); - shaded_button(x1, y1, x2, y2, asp, colorid, flag, 0); - break; - case UI_BUT_ALIGN_TOP|UI_BUT_ALIGN_RIGHT: - - /* LEFT OUTER SUNKEN EFFECT */ - glEnable(GL_BLEND); - glShadeModel(GL_SMOOTH); - glBegin(GL_LINES); - MM_WHITE_OP; - glVertex2f(x1-1,y1); - MM_WHITE_TR; - glVertex2f(x1-1,y2); - glEnd(); - glDisable(GL_BLEND); - - uiSetRoundBox(8); - shaded_button(x1, y1, x2, y2, asp, colorid, flag, 0); - break; - case UI_BUT_ALIGN_TOP|UI_BUT_ALIGN_LEFT: - - /* RIGHT OUTER SUNKEN EFFECT */ - glEnable(GL_BLEND); - glShadeModel(GL_SMOOTH); - glBegin(GL_LINES); - MM_WHITE_OP; - glVertex2f(x2+1,y1); - MM_WHITE_TR; - glVertex2f(x2+1,y2); - glEnd(); - glDisable(GL_BLEND); - - uiSetRoundBox(4); - shaded_button(x1, y1, x2, y2, asp, colorid, flag, 0); - break; - - default: - shaded_button(x1, y1, x2, y2, asp, colorid, flag, 1); - break; - } - } - else { - glEnable(GL_BLEND); - glShadeModel(GL_SMOOTH); - - /* BOTTOM OUTER SUNKEN EFFECT */ - MM_WHITE_OP; - fdrawline(x1, y1-1, x2, y1-1); - - /* LEFT OUTER SUNKEN EFFECT */ - glBegin(GL_LINES); - MM_WHITE_OP; - glVertex2f(x1-1,y1); - MM_WHITE_TR; - glVertex2f(x1-1,y2); - glEnd(); - - /* RIGHT OUTER SUNKEN EFFECT */ - glBegin(GL_LINES); - MM_WHITE_OP; - glVertex2f(x2+1,y1); - MM_WHITE_TR; - glVertex2f(x2+1,y2); - glEnd(); - - glDisable(GL_BLEND); - - uiSetRoundBox(15); - shaded_button(x1, y1, x2, y2, asp, colorid, flag, 0); - } - - /* *** EXTRA DRAWING FOR SPECIFIC CONTROL TYPES *** */ - switch(type) { - case ICONROW: - case ICONTEXTROW: - /* DARKENED AREA */ - glEnable(GL_BLEND); - - glColor4ub(0, 0, 0, 30); - glRectf(x2-9, y1, x2, y2); - - glDisable(GL_BLEND); - /* END DARKENED AREA */ - - /* ICONROW DOUBLE-ARROW */ - UI_ThemeColorShadeAlpha(colorid, -80, alpha_offs); - ui_iconrow_arrows(x1, y1, x2, y2); - /* END ICONROW DOUBLE-ARROW */ - break; - case MENU: - /* DARKENED AREA */ - glEnable(GL_BLEND); - - glColor4ub(0, 0, 0, 30); - glRectf(x2-18, y1, x2, y2); - - glDisable(GL_BLEND); - /* END DARKENED AREA */ - - /* MENU DOUBLE-ARROW */ - UI_ThemeColorShadeAlpha(colorid, -80, alpha_offs); - ui_menu_arrows(x1, y1, x2, y2, asp); - /* MENU DOUBLE-ARROW */ - break; - } -} - -/* number/text field drawing code */ -static void ui_default_flat(int type, int colorid, float asp, float x1, float y1, float x2, float y2, int flag) -{ - int align= (flag & UI_BUT_ALIGN); - int alpha_offs= (flag & UI_BUT_DISABLED)?UI_DISABLED_ALPHA_OFFS:0; - - if(align) { - - /* *** BOTTOM OUTER SUNKEN EFFECT *** */ - if (!((align == UI_BUT_ALIGN_DOWN) || - (align == (UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_RIGHT)) || - (align == (UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_LEFT)))) { - glEnable(GL_BLEND); - MM_WHITE_OP; - fdrawline(x1, y1-1, x2, y1-1); - glDisable(GL_BLEND); - } - /* *** END BOTTOM OUTER SUNKEN EFFECT *** */ - - switch(align) { - case UI_BUT_ALIGN_TOP: - uiSetRoundBox(12); - - /* last arg in shaded_button() determines whether the button is in the middle of - * an alignment group or not. 0 = not middle, 1 = is in the middle. - * Done to allow cleaner drawing - */ - - flat_button(x1, y1, x2, y2, asp, colorid, flag, 0); - break; - case UI_BUT_ALIGN_DOWN: - uiSetRoundBox(3); - flat_button(x1, y1, x2, y2, asp, colorid, flag, 0); - break; - case UI_BUT_ALIGN_LEFT: - - /* RIGHT OUTER SUNKEN EFFECT */ - glEnable(GL_BLEND); - glShadeModel(GL_SMOOTH); - glBegin(GL_LINES); - MM_WHITE_OP; - glVertex2f(x2+1,y1); - MM_WHITE_TR; - glVertex2f(x2+1,y2); - glEnd(); - glDisable(GL_BLEND); - - uiSetRoundBox(6); - flat_button(x1, y1, x2, y2, asp, colorid, flag, 0); - break; - case UI_BUT_ALIGN_RIGHT: - - /* LEFT OUTER SUNKEN EFFECT */ - glEnable(GL_BLEND); - glShadeModel(GL_SMOOTH); - glBegin(GL_LINES); - MM_WHITE_OP; - glVertex2f(x1-1,y1); - MM_WHITE_TR; - glVertex2f(x1-1,y2); - glEnd(); - glDisable(GL_BLEND); - - uiSetRoundBox(9); - flat_button(x1, y1, x2, y2, asp, colorid, flag, 0); - break; - - case UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_RIGHT: - uiSetRoundBox(1); - flat_button(x1, y1, x2, y2, asp, colorid, flag, 0); - break; - case UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_LEFT: - uiSetRoundBox(2); - flat_button(x1, y1, x2, y2, asp, colorid, flag, 0); - break; - case UI_BUT_ALIGN_TOP|UI_BUT_ALIGN_RIGHT: - - /* LEFT OUTER SUNKEN EFFECT */ - glEnable(GL_BLEND); - glShadeModel(GL_SMOOTH); - glBegin(GL_LINES); - MM_WHITE_OP; - glVertex2f(x1-1,y1); - MM_WHITE_TR; - glVertex2f(x1-1,y2); - glEnd(); - glDisable(GL_BLEND); - - uiSetRoundBox(8); - flat_button(x1, y1, x2, y2, asp, colorid, flag, 0); - break; - case UI_BUT_ALIGN_TOP|UI_BUT_ALIGN_LEFT: - - /* RIGHT OUTER SUNKEN EFFECT */ - glEnable(GL_BLEND); - glShadeModel(GL_SMOOTH); - glBegin(GL_LINES); - MM_WHITE_OP; - glVertex2f(x2+1,y1); - MM_WHITE_TR; - glVertex2f(x2+1,y2); - glEnd(); - glDisable(GL_BLEND); - - uiSetRoundBox(4); - flat_button(x1, y1, x2, y2, asp, colorid, flag, 0); - break; - - default: - flat_button(x1, y1, x2, y2, asp, colorid, flag, 1); - break; - } - } - else { - - glEnable(GL_BLEND); - glShadeModel(GL_SMOOTH); - - /* BOTTOM OUTER SUNKEN EFFECT */ - MM_WHITE_OP; - fdrawline(x1, y1-1, x2, y1-1); - - /* LEFT OUTER SUNKEN EFFECT */ - glBegin(GL_LINES); - MM_WHITE_OP; - glVertex2f(x1-1,y1); - MM_WHITE_TR; - glVertex2f(x1-1,y2); - glEnd(); - - /* RIGHT OUTER SUNKEN EFFECT */ - glBegin(GL_LINES); - MM_WHITE_OP; - glVertex2f(x2+1,y1); - MM_WHITE_TR; - glVertex2f(x2+1,y2); - glEnd(); - - glDisable(GL_BLEND); - - uiSetRoundBox(15); - flat_button(x1, y1, x2, y2, asp, colorid, flag, 0); - } - - /* *** EXTRA DRAWING FOR SPECIFIC CONTROL TYPES *** */ - switch(type) { - case NUM: - case NUMABS: - /* SIDE ARROWS */ - /* left */ - if(flag & UI_SELECT) { - if(flag & UI_ACTIVE) UI_ThemeColorShadeAlpha(colorid, -80, alpha_offs); - else UI_ThemeColorShadeAlpha(colorid, -80, alpha_offs); - } else { - if(flag & UI_ACTIVE) UI_ThemeColorShadeAlpha(colorid, -45, alpha_offs); - else UI_ThemeColorShadeAlpha(colorid, -20, alpha_offs); - } - - ui_num_arrows(x1, y1, x2, y2, asp); - /* END SIDE ARROWS */ - } -} - -/* default theme callback */ -static void ui_draw_default(int type, int colorid, float aspect, float x1, float y1, float x2, float y2, int flag) -{ - - switch(type) { - case TEX: - case IDPOIN: - case NUM: - case NUMABS: - ui_default_flat(type, colorid, aspect, x1, y1, x2, y2, flag); - break; - case ICONROW: - case ICONTEXTROW: - case MENU: - default: - ui_default_button(type, colorid, aspect, x1, y1, x2, y2, flag); - } - -} - - -/* *************** OLDSKOOL THEME ***************** */ - -static void ui_draw_outlineX(float x1, float y1, float x2, float y2, float asp1) -{ - float vec[2]; - - glBegin(GL_LINE_LOOP); - vec[0]= x1+asp1; vec[1]= y1-asp1; - glVertex2fv(vec); - vec[0]= x2-asp1; - glVertex2fv(vec); - vec[0]= x2+asp1; vec[1]= y1+asp1; - glVertex2fv(vec); - vec[1]= y2-asp1; - glVertex2fv(vec); - vec[0]= x2-asp1; vec[1]= y2+asp1; - glVertex2fv(vec); - vec[0]= x1+asp1; - glVertex2fv(vec); - vec[0]= x1-asp1; vec[1]= y2-asp1; - glVertex2fv(vec); - vec[1]= y1+asp1; - glVertex2fv(vec); - glEnd(); - -} - - -static void ui_draw_oldskool(int type, int colorid, float asp, float x1, float y1, float x2, float y2, int flag) -{ - int alpha_offs= (flag & UI_BUT_DISABLED)?UI_DISABLED_ALPHA_OFFS:0; - /* paper */ - if(flag & UI_SELECT) { - if(flag & UI_ACTIVE) UI_ThemeColorShade(colorid, -40); - else UI_ThemeColorShade(colorid, -30); - } - else { - if(flag & UI_ACTIVE) UI_ThemeColorShade(colorid, +30); - else UI_ThemeColorShade(colorid, +20); - } - - glRectf(x1+1, y1+1, x2-1, y2-1); - - x1+= asp; - x2-= asp; - y1+= asp; - y2-= asp; - - /* below */ - if(flag & UI_SELECT) UI_ThemeColorShade(colorid, 0); - else UI_ThemeColorShade(colorid, -30); - fdrawline(x1, y1, x2, y1); - - /* right */ - fdrawline(x2, y1, x2, y2); - - /* top */ - if(flag & UI_SELECT) UI_ThemeColorShade(colorid, -30); - else UI_ThemeColorShade(colorid, 0); - fdrawline(x1, y2, x2, y2); - - /* left */ - fdrawline(x1, y1, x1, y2); - - /* outline */ - glColor3ub(0,0,0); - ui_draw_outlineX(x1, y1, x2, y2, asp); - - - /* special type decorations */ - switch(type) { - case NUM: - case NUMABS: - if(flag & UI_SELECT) UI_ThemeColorShadeAlpha(colorid, -60, alpha_offs); - else UI_ThemeColorShadeAlpha(colorid, -30, alpha_offs); - ui_num_arrows(x1, y1, x2, y2, asp); - break; - - case ICONROW: - case ICONTEXTROW: - if(flag & UI_ACTIVE) UI_ThemeColorShadeAlpha(colorid, 0, alpha_offs); - else UI_ThemeColorShadeAlpha(colorid, -10, alpha_offs); - glRectf(x2-9, y1+asp, x2-asp, y2-asp); - - UI_ThemeColorShadeAlpha(colorid, -50, alpha_offs); - ui_iconrow_arrows(x1, y1, x2, y2); - break; - - case MENU: - if(flag & UI_ACTIVE) UI_ThemeColorShadeAlpha(colorid, 0, alpha_offs); - else UI_ThemeColorShadeAlpha(colorid, -10, alpha_offs); - glRectf(x2-17, y1+asp, x2-asp, y2-asp); - - UI_ThemeColorShadeAlpha(colorid, -50, alpha_offs); - ui_menu_arrows(x1, y1, x2, y2, asp); - break; - } - -} - -static void ui_draw_round(int type, int colorid, float asp, float x1, float y1, float x2, float y2, int flag) -{ - float rad, maxrad=7.0; - int align= (flag & UI_BUT_ALIGN), curshade; - int alpha_offs= (flag & UI_BUT_DISABLED)?UI_DISABLED_ALPHA_OFFS:0; - - /* 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 */ - - /* paper */ - if(flag & UI_SELECT) { - if(flag & UI_ACTIVE) curshade= -40; - else curshade= -30; - } - else { - if(flag & UI_ACTIVE) curshade= 30; - else curshade= +20; - } - - UI_ThemeColorShade(colorid, curshade); - - /* 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); - - /* special type decorations */ - switch(type) { - case TOG: - case TOGN: - case TOG3: - ui_draw_toggle_checkbox(flag, type, colorid, x1, y1, x2, y2); - break; - case NUM: - case NUMABS: - UI_ThemeColorShadeAlpha(colorid, curshade-60, alpha_offs); - ui_num_arrows(x1, y1, x2, y2, asp); - break; - - case ICONROW: - case ICONTEXTROW: - UI_ThemeColorShadeAlpha(colorid, curshade-60, alpha_offs); - ui_iconrow_arrows(x1, y1, x2, y2); - break; - - case MENU: - case BLOCK: - UI_ThemeColorShadeAlpha(colorid, curshade-60, alpha_offs); - ui_menu_arrows(x1, y1, x2, y2, asp); - break; - } -} - -/* *************** MINIMAL THEME ***************** */ - -// theme can define an embosfunc and sliderfunc, text+icon drawing is standard, no theme. - - - -/* super minimal button as used in logic menu */ -static void ui_draw_minimal(int type, int colorid, float asp, float x1, float y1, float x2, float y2, int flag) -{ - int alpha_offs= (flag & UI_BUT_DISABLED)?UI_DISABLED_ALPHA_OFFS:0; - - /* too much space between buttons */ - - if (type==TEX || type==IDPOIN) { - x1+= asp; - x2-= (asp*2); - //y1+= asp; - y2-= asp; - } else { - /* Less space between buttons looks nicer */ - y2-= asp; - x2-= asp; - } - - /* paper */ - if(flag & UI_SELECT) { - if(flag & UI_ACTIVE) UI_ThemeColorShade(colorid, -40); - else UI_ThemeColorShade(colorid, -30); - } - else { - if(flag & UI_ACTIVE) UI_ThemeColorShade(colorid, +20); - else UI_ThemeColorShade(colorid, +10); - } - - glRectf(x1, y1, x2, y2); - - if (type==TEX || type==IDPOIN) { - UI_ThemeColorShade(colorid, -60); - - /* top */ - fdrawline(x1, y2, x2, y2); - /* left */ - fdrawline(x1, y1, x1, y2); - - - /* text underline, some */ - UI_ThemeColorShade(colorid, +50); - glEnable(GL_LINE_STIPPLE); - glLineStipple(1, 0x8888); - fdrawline(x1+(asp*2), y1+(asp*3), x2-(asp*2), y1+(asp*3)); - glDisable(GL_LINE_STIPPLE); - - - UI_ThemeColorShade(colorid, +60); - /* below */ - fdrawline(x1, y1, x2, y1); - /* right */ - fdrawline(x2, y1, x2, y2); - - } else { - if(flag & UI_SELECT) { - UI_ThemeColorShade(colorid, -60); - - /* top */ - fdrawline(x1, y2, x2, y2); - /* left */ - fdrawline(x1, y1, x1, y2); - UI_ThemeColorShade(colorid, +40); - - /* below */ - fdrawline(x1, y1, x2, y1); - /* right */ - fdrawline(x2, y1, x2, y2); - } - else { - UI_ThemeColorShade(colorid, +40); - - /* top */ - fdrawline(x1, y2, x2, y2); - /* left */ - fdrawline(x1, y1, x1, y2); - - UI_ThemeColorShade(colorid, -60); - /* below */ - fdrawline(x1, y1, x2, y1); - /* right */ - fdrawline(x2, y1, x2, y2); - } - } - - /* special type decorations */ - switch(type) { - case NUM: - case NUMABS: - if(flag & UI_SELECT) UI_ThemeColorShadeAlpha(colorid, -60, alpha_offs); - else UI_ThemeColorShadeAlpha(colorid, -30, alpha_offs); - ui_num_arrows(x1, y1, x2, y2, asp); - break; - - case ICONROW: - case ICONTEXTROW: - if(flag & UI_ACTIVE) UI_ThemeColorShadeAlpha(colorid, 0, alpha_offs); - else UI_ThemeColorShadeAlpha(colorid, -10, alpha_offs); - glRectf(x2-9, y1+asp, x2-asp, y2-asp); - - UI_ThemeColorShadeAlpha(colorid, -50, alpha_offs); - ui_iconrow_arrows(x1, y1, x2, y2); - break; - - case MENU: - case BLOCK: - if(flag & UI_ACTIVE) UI_ThemeColorShadeAlpha(colorid, 0, alpha_offs); - else UI_ThemeColorShadeAlpha(colorid, -10, alpha_offs); - glRectf(x2-17, y1+asp, x2-asp, y2-asp); - - UI_ThemeColorShadeAlpha(colorid, -50, alpha_offs); - ui_menu_arrows(x1, y1, x2, y2, asp); - break; - } - - -} - - -/* fac is the slider handle position between x1 and x2 */ -static void ui_draw_slider(int colorid, float fac, float aspect, float x1, float y1, float x2, float y2, int flag) -{ - int alpha_offs= (flag & UI_BUT_DISABLED)?UI_DISABLED_ALPHA_OFFS:0; - float maxrad= 10.0; - float rad; - int origround, round = uiGetRoundBox(); - - rad= (y2-y1)/2.0; - if (rad>(x2-x1)/2) rad = (x2-x1)/2; - if (rad > maxrad) rad = maxrad; - - if(flag & UI_ACTIVE) UI_ThemeColorShade(colorid, -75); - else UI_ThemeColorShade(colorid, -45); - - origround = round; - round &= ~(2|4); - uiSetRoundBox(round); - - if (fac < rad) { - /* if slider end is in the left end cap */ - float ofsy; - float start_rad; - - start_rad = fac; - ofsy = (origround!=0) ? ((rad - fac) * 0.5) : 0.f; /* shrink in Y if rounded but */ - - gl_round_box(GL_POLYGON, x1, y1+ofsy, x1+fac, y2-ofsy, start_rad); - - } else if ( (fac >= rad) && (x1+fac < x2 - rad) ) { - /* if the slider is in the middle */ - - gl_round_box(GL_POLYGON, x1, y1, x1+fac, y2, rad); - - } else if (x1+fac >= x2-rad) { - /* if the slider is in the right end cap */ - float extx, ofsy; - float end_rad; - - /* draw the full slider area at 100% */ - uiSetRoundBox(origround); - gl_round_box(GL_POLYGON, x1, y1, x2, y2, rad); - - /* don't draw anything else if the slider is completely full */ - if (x2 - (x1+fac) < 0.05f) - return; - - /* tricky to trim off right end curve by drawing over it */ - extx = ((x1 + fac) - (x2 - rad)) * aspect; /* width of extension bit */ - end_rad = rad - extx - 1.0; - ofsy = (origround!=0) ? (extx * 0.4) : 0.f; /* shrink in Y if rounded but */ - - if (end_rad > 1.0) { - - if(flag & UI_SELECT) UI_ThemeColorShade(colorid, -20); - else UI_ThemeColorShade(colorid, -0); - - round = origround; - round &= ~(1|8); - uiSetRoundBox(round); - gl_round_box(GL_POLYGON, x1+fac-1.0, y1+ofsy, x2-1.0, y2-ofsy, end_rad); - } - - /* trace over outline again, to cover up inaccuracies */ - UI_ThemeColorBlendShadeAlpha(TH_BUT_OUTLINE, TH_BACK, 0.1, -30, alpha_offs); - uiSetRoundBox(origround); - uiRoundRectFakeAA(x1, y1, x2, y2, rad, aspect); - } - - - -} - -/* ************** STANDARD MENU DRAWING FUNCTION ************* */ - - -static void ui_shadowbox(float minx, float miny, float maxx, float maxy, float shadsize, unsigned char alpha) -{ - glEnable(GL_BLEND); - glShadeModel(GL_SMOOTH); - - /* right quad */ - glBegin(GL_POLYGON); - glColor4ub(0, 0, 0, alpha); - glVertex2f(maxx, miny); - glVertex2f(maxx, maxy-0.3*shadsize); - glColor4ub(0, 0, 0, 0); - glVertex2f(maxx+shadsize, maxy-0.75*shadsize); - glVertex2f(maxx+shadsize, miny); - glEnd(); - - /* corner shape */ - glBegin(GL_POLYGON); - glColor4ub(0, 0, 0, alpha); - glVertex2f(maxx, miny); - glColor4ub(0, 0, 0, 0); - glVertex2f(maxx+shadsize, miny); - glVertex2f(maxx+0.7*shadsize, miny-0.7*shadsize); - glVertex2f(maxx, miny-shadsize); - glEnd(); - - /* bottom quad */ - glBegin(GL_POLYGON); - glColor4ub(0, 0, 0, alpha); - glVertex2f(minx+0.3*shadsize, miny); - glVertex2f(maxx, miny); - glColor4ub(0, 0, 0, 0); - glVertex2f(maxx, miny-shadsize); - glVertex2f(minx+0.5*shadsize, miny-shadsize); - glEnd(); - - glDisable(GL_BLEND); - glShadeModel(GL_FLAT); -} - -void uiDrawBoxShadow(unsigned char alpha, float minx, float miny, float maxx, float maxy) -{ - /* accumulated outline boxes to make shade not linear, is more pleasant */ - ui_shadowbox(minx, miny, maxx, maxy, 11.0, (20*alpha)>>8); - ui_shadowbox(minx, miny, maxx, maxy, 7.0, (40*alpha)>>8); - ui_shadowbox(minx, miny, maxx, maxy, 5.0, (80*alpha)>>8); - -} - -// background for pulldowns, pullups, and other drawing temporal menus.... -// has to be made themable still (now only color) - -void uiDrawMenuBox(float minx, float miny, float maxx, float maxy, short flag, short direction) -{ - char col[4]; - int rounded = ELEM(UI_GetThemeValue(TH_BUT_DRAWTYPE), TH_ROUNDED, TH_ROUNDSHADED); - - UI_GetThemeColor4ubv(TH_MENU_BACK, col); - - if (rounded) { - if (flag & UI_BLOCK_POPUP) { - uiSetRoundBox(15); - miny -= 4.0; - maxy += 4.0; - } - else if (direction == UI_DOWN) { - uiSetRoundBox(12); - miny -= 4.0; - } else if (direction == UI_TOP) { - uiSetRoundBox(3); - maxy += 4.0; - } else { - uiSetRoundBox(0); - } - } - - if( (flag & UI_BLOCK_NOSHADOW)==0) { - /* accumulated outline boxes to make shade not linear, is more pleasant */ - ui_shadowbox(minx, miny, maxx, maxy, 11.0, (20*col[3])>>8); - ui_shadowbox(minx, miny, maxx, maxy, 7.0, (40*col[3])>>8); - ui_shadowbox(minx, miny, maxx, maxy, 5.0, (80*col[3])>>8); - } - glEnable(GL_BLEND); - glColor4ubv((GLubyte *)col); - - if (rounded) { - gl_round_box(GL_POLYGON, minx, miny, maxx, maxy, 4.0); - } else { - glRectf(minx, miny, maxx, maxy); - } - glDisable(GL_BLEND); -} - -/* pulldown menu item */ -static void ui_draw_pulldown_item(int type, int colorid, float asp, float x1, float y1, float x2, float y2, int flag) -{ - char col[4]; - - UI_GetThemeColor4ubv(TH_MENU_BACK, col); - if(col[3]!=255) { - glEnable(GL_BLEND); - } - - if((flag & UI_ACTIVE) && type!=LABEL) { - UI_ThemeColor4(TH_MENU_HILITE); - glRectf(x1, y1, x2, y2); - - - } else { - UI_ThemeColor4(colorid); // is set at TH_MENU_ITEM when pulldown opened. - glRectf(x1, y1, x2, y2); - } - - glDisable(GL_BLEND); -} - -/* pulldown menu calling button */ -static void ui_draw_pulldown_round(int type, int colorid, float asp, float x1, float y1, float x2, float y2, int flag) -{ - - if(flag & UI_ACTIVE) { - UI_ThemeColor(TH_MENU_HILITE); - - uiSetRoundBox(15); - gl_round_box(GL_POLYGON, x1, y1+3, x2, y2-3, 7.0); - - glEnable( GL_LINE_SMOOTH ); - glEnable( GL_BLEND ); - gl_round_box(GL_LINE_LOOP, x1, y1+3, x2, y2-3, 7.0); - glDisable( GL_LINE_SMOOTH ); - glDisable( GL_BLEND ); - - } else { - UI_ThemeColor(colorid); // is set at TH_MENU_ITEM when pulldown opened. - glRectf(x1-1, y1+2, x2+1, y2-2); - } - -} - /* ************** TEXT AND ICON DRAWING FUNCTIONS ************* */ #define BUT_TEXT_NORMAL 0 @@ -2373,7 +753,7 @@ void ui_draw_text_icon(uiBut *but) if( BTST( sp[1], but->bitnr )) tog3= 1; } - ui_tog3_invert(but->x1,but->y1,but->x2,but->y2, tog3); +// ui_tog3_invert(but->x1,but->y1,but->x2,but->y2, tog3); if (tog3) glColor3ub(255, 255, 0); } @@ -2393,42 +773,11 @@ void ui_draw_text_icon(uiBut *but) } } -static void ui_draw_but_COL(uiBut *but) -{ - float col[3]; - char colr, colg, colb; - - ui_get_but_vectorf(but, col); - - colr= floor(255.0*col[0]+0.5); - colg= floor(255.0*col[1]+0.5); - colb= floor(255.0*col[2]+0.5); - - /* exception... hrms, but can't simply use the emboss callback for this now. */ - /* this button type needs review, and nice integration with rest of API here */ - /* XXX 2.50 bad U global access */ - if(but->embossfunc == ui_draw_round) { - char *cp= UI_ThemeGetColorPtr(U.themes.first, 0, TH_CUSTOM); - cp[0]= colr; cp[1]= colg; cp[2]= colb; - but->flag &= ~UI_SELECT; - but->embossfunc(but->type, TH_CUSTOM, but->aspect, but->x1, but->y1, but->x2, but->y2, but->flag); - } - else - { - - glColor3ub(colr, colg, colb); - glRectf((but->x1), (but->y1), (but->x2), (but->y2)); - glColor3ub(0, 0, 0); - fdrawbox((but->x1), (but->y1), (but->x2), (but->y2)); - } -} - - +#if 0 #ifdef INTERNATIONAL static void ui_draw_but_CHARTAB(uiBut *but) { /* XXX 2.50 bad global access */ -#if 0 /* Some local variables */ float sx, sy, ex, ey; float width, height; @@ -2607,12 +956,12 @@ static void ui_draw_but_CHARTAB(uiBut *but) { uiSetCurFont(but->block, UI_HELV); } -#endif } #endif // INTERNATIONAL +#endif -static void ui_draw_but_COLORBAND(uiBut *but) +void ui_draw_but_COLORBAND(uiBut *but) { ColorBand *coba; CBData *cbd; @@ -2739,7 +1088,7 @@ static void ui_draw_but_COLORBAND(uiBut *but) glEnd(); } -static void ui_draw_but_NORMAL(uiBut *but) +void ui_draw_but_NORMAL(uiBut *but) { static GLuint displist=0; int a, old[8]; @@ -2841,7 +1190,7 @@ static void ui_draw_but_curve_grid(uiBut *but, float zoomx, float zoomy, float o } -static void ui_draw_but_CURVE(ARegion *ar, uiBut *but) +void ui_draw_but_CURVE(ARegion *ar, uiBut *but) { CurveMapping *cumap; CurveMap *cuma; @@ -2992,15 +1341,8 @@ static void ui_draw_but_CURVE(ARegion *ar, uiBut *but) fdrawbox(but->x1, but->y1, but->x2, but->y2); } -static void ui_draw_sepr(uiBut *but) -{ - float y = but->y1 + (but->y2 - but->y1)*0.5; - - UI_ThemeColorBlend(TH_MENU_TEXT, TH_MENU_BACK, 0.85); - fdrawline(but->x1, y, but->x2, y); -} -static void ui_draw_roundbox(uiBut *but) +void ui_draw_roundbox(uiBut *but) { glEnable(GL_BLEND); @@ -3012,194 +1354,58 @@ static void ui_draw_roundbox(uiBut *but) glDisable(GL_BLEND); } +/* ****************************************************** */ -/* nothing! */ -static void ui_draw_nothing(int type, int colorid, float asp, float x1, float y1, float x2, float y2, int flag) -{ -} -/* minimal drawing for table items */ -static void ui_draw_table(int type, int colorid, float asp, float x1, float y1, float x2, float y2, int flag) +static void ui_shadowbox(float minx, float miny, float maxx, float maxy, float shadsize, unsigned char alpha) { - int background= 1; - int alpha_offs= (flag & UI_BUT_DISABLED)?UI_DISABLED_ALPHA_OFFS:0; - - /* paper */ - if(flag & UI_SELECT) { - if(flag & UI_ACTIVE) glColor4f(0, 0, 0, 0.2f); - else glColor4f(0, 0, 0, 0.1f); - } - else { - if(flag & UI_ACTIVE) glColor4f(1.0f, 1.0f, 1.0f, 0.2f); - else background= 0; - } + glEnable(GL_BLEND); + glShadeModel(GL_SMOOTH); - if(background) { - glEnable(GL_BLEND); - glRectf(x1, y1, x2, y2); - glDisable(GL_BLEND); - } + /* right quad */ + glBegin(GL_POLYGON); + glColor4ub(0, 0, 0, alpha); + glVertex2f(maxx, miny); + glVertex2f(maxx, maxy-0.3*shadsize); + glColor4ub(0, 0, 0, 0); + glVertex2f(maxx+shadsize, maxy-0.75*shadsize); + glVertex2f(maxx+shadsize, miny); + glEnd(); - /* special type decorations */ - switch(type) { - case NUM: - case NUMABS: - if(flag & UI_SELECT) UI_ThemeColorShadeAlpha(colorid, -120, alpha_offs); - else UI_ThemeColorShadeAlpha(colorid, -90, alpha_offs); - ui_num_arrows(x1, y1, x2, y2, asp); - break; - - case TOG: - ui_checkmark_box(colorid, x1, y1, x2, y2); - - if(flag & UI_SELECT) { - UI_ThemeColorShadeAlpha(colorid, -140, alpha_offs); - ui_checkmark(x1, y1, x2, y2); - } - break; - - case ICONROW: - case ICONTEXTROW: - UI_ThemeColorShadeAlpha(colorid, -120, alpha_offs); - ui_iconrow_arrows(x1, y1, x2, y2); - break; - - case MENU: - case BLOCK: - UI_ThemeColorShadeAlpha(colorid, -120, alpha_offs); - ui_menu_arrows(x1, y1, x2, y2, asp); - break; - } -} - -/* ************** EXTERN, called from interface.c ************* */ -/* ************** MAIN CALLBACK FUNCTION ************* */ - -void ui_set_embossfunc(uiBut *but, int drawtype) -{ - // this aded for evaluating textcolor for example - but->dt= drawtype; - - // not really part of standard minimal themes, just make sure it is set - but->sliderfunc= ui_draw_slider; - - // standard builtin first: - if(but->type==LABEL || but->type==ROUNDBOX) but->embossfunc= ui_draw_nothing; - else if(ELEM(but->type, PULLDOWN, HMENU) && !(but->block->flag & UI_BLOCK_LOOP)) - but->embossfunc= ui_draw_pulldown_round; - else if(drawtype==UI_EMBOSSM) but->embossfunc= ui_draw_minimal; - else if(drawtype==UI_EMBOSSN) but->embossfunc= ui_draw_nothing; - else if(drawtype==UI_EMBOSSP) but->embossfunc= ui_draw_pulldown_item; - else if(drawtype==UI_EMBOSSR) but->embossfunc= ui_draw_round; - else if(drawtype==UI_EMBOSST) but->embossfunc= ui_draw_table; - else { - int theme= UI_GetThemeValue(TH_BUT_DRAWTYPE); - - switch(theme) { - - case TH_SHADED: - but->embossfunc= ui_draw_default; - break; - case TH_ROUNDED: - but->embossfunc= ui_draw_round; - break; - case TH_OLDSKOOL: - but->embossfunc= ui_draw_oldskool; - break; - case TH_MINIMAL: - but->embossfunc= ui_draw_minimal; - break; - case TH_ROUNDSHADED: - default: - but->embossfunc= ui_draw_roundshaded; - // but->sliderfunc= ui_default_slider; - break; - } - } + /* corner shape */ + glBegin(GL_POLYGON); + glColor4ub(0, 0, 0, alpha); + glVertex2f(maxx, miny); + glColor4ub(0, 0, 0, 0); + glVertex2f(maxx+shadsize, miny); + glVertex2f(maxx+0.7*shadsize, miny-0.7*shadsize); + glVertex2f(maxx, miny-shadsize); + glEnd(); + + /* bottom quad */ + glBegin(GL_POLYGON); + glColor4ub(0, 0, 0, alpha); + glVertex2f(minx+0.3*shadsize, miny); + glVertex2f(maxx, miny); + glColor4ub(0, 0, 0, 0); + glVertex2f(maxx, miny-shadsize); + glVertex2f(minx+0.5*shadsize, miny-shadsize); + glEnd(); - // note: if you want aligning, adapt the call uiBlockEndAlign in interface.c + glDisable(GL_BLEND); + glShadeModel(GL_FLAT); } -void ui_draw_but(ARegion *ar, uiBut *but) +void uiDrawBoxShadow(unsigned char alpha, float minx, float miny, float maxx, float maxy) { - double value; - float x1, x2, y1, y2, fac; - int type; - - if(but==NULL) return; - - if(1) {//but->block->flag & UI_BLOCK_2_50) { - extern void ui_draw_but_new(ARegion *ar, uiBut *but); // XXX - - ui_draw_but_new(ar, but); - return; - } - - switch (but->type) { - - case NUMSLI: - case HSVSLI: - type= (but->editstr)? TEX: but->type; - but->embossfunc(type, but->themecol, but->aspect, but->x1, but->y1, but->x2, but->y2, but->flag); - - x1= but->x1; - x2= but->x2; - y1= but->y1; - y2= but->y2; - - value= ui_get_but_val(but); - fac= (value-but->softmin)*(x2-x1)/(but->softmax - but->softmin); - - but->sliderfunc(but->themecol, fac, but->aspect, x1, y1, x2, y2, but->flag); - ui_draw_text_icon(but); - break; - - case SEPR: - ui_draw_sepr(but); - break; - - case COL: - ui_draw_but_COL(but); // black box with color - break; - - case HSVCUBE: - //ui_draw_but_HSVCUBE(but); // box for colorpicker, three types - break; - -#ifdef INTERNATIONAL - case CHARTAB: - value= ui_get_but_val(but); - ui_draw_but_CHARTAB(but); - break; -#endif - - case LINK: - case INLINK: - ui_draw_icon(but, but->icon, 0); - break; - - case ROUNDBOX: - ui_draw_roundbox(but); - break; - - case BUT_COLORBAND: - ui_draw_but_COLORBAND(but); - break; - case BUT_NORMAL: - ui_draw_but_NORMAL(but); - break; - case BUT_CURVE: - ui_draw_but_CURVE(ar, but); - break; - - default: - type= (but->editstr)? TEX: but->type; - but->embossfunc(type, but->themecol, but->aspect, but->x1, but->y1, but->x2, but->y2, but->flag); - ui_draw_text_icon(but); + /* accumulated outline boxes to make shade not linear, is more pleasant */ + ui_shadowbox(minx, miny, maxx, maxy, 11.0, (20*alpha)>>8); + ui_shadowbox(minx, miny, maxx, maxy, 7.0, (40*alpha)>>8); + ui_shadowbox(minx, miny, maxx, maxy, 5.0, (80*alpha)>>8); - } } + void ui_dropshadow(rctf *rct, float radius, float aspect, int select) { float rad; diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index ff185e9997c..ff9e099e676 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -329,8 +329,6 @@ extern int ui_handler_panel_region(struct bContext *C, struct wmEvent *event); extern void ui_draw_panel(struct ARegion *ar, uiBlock *block); /* interface_draw.c */ -extern void ui_set_embossfunc(uiBut *but, int drawtype); -extern void ui_draw_but(ARegion *ar, uiBut *but); extern void ui_rasterpos_safe(float x, float y, float aspect); extern void ui_draw_tria_icon(float x, float y, float aspect, char dir); extern void ui_draw_anti_x(float x1, float y1, float x2, float y2); @@ -343,12 +341,18 @@ extern void gl_round_box_vertical_shade(int mode, float minx, float miny, float void ui_draw_icon(uiBut *but, BIFIconID icon, int blend); void ui_draw_text(uiBut *but, float x, float y, int sunken); +void ui_draw_but_COLORBAND(uiBut *but); +void ui_draw_but_NORMAL(uiBut *but); +void ui_draw_but_CURVE(ARegion *ar, uiBut *but); + + /* interface_handlers.c */ extern void ui_button_active_cancel(const struct bContext *C, uiBut *but); /* interface_widgets.c */ void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y3); void ui_draw_menu_back(uiBlock *block); +extern void ui_draw_but(ARegion *ar, uiBut *but); /* interface_anim.c */ void ui_but_anim_flag(uiBut *but, float cfra); diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 783cc0468ae..c9b6fe9794c 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -1628,7 +1628,7 @@ static int widget_roundbox_set(uiBut *but, rcti *rect) } /* conversion from old to new buttons, so still messy */ -void ui_draw_but_new(ARegion *ar, uiBut *but) +void ui_draw_but(ARegion *ar, uiBut *but) { uiWidgetType *wt= NULL; rcti rect; @@ -1716,8 +1716,18 @@ void ui_draw_but_new(ARegion *ar, uiBut *but) wt= widget_type(UI_WTYPE_SWATCH); break; + // XXX four old button types case HSVCUBE: - ui_draw_but_HSVCUBE(but); // XXX old + ui_draw_but_HSVCUBE(but); + break; + case BUT_COLORBAND: + ui_draw_but_COLORBAND(but); + break; + case BUT_NORMAL: + ui_draw_but_NORMAL(but); + break; + case BUT_CURVE: + ui_draw_but_CURVE(ar, but); break; default: diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index 95be465bd65..98aa16c84e4 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -879,8 +879,9 @@ void UI_view2d_view_orthoSpecial(const bContext *C, View2D *v2d, short xaxis) /* pixel offsets (-0.375f) are needed to get 1:1 correspondance with pixels for smooth UI drawing, * but only applied where requsted */ - xofs= (v2d->flag & V2D_PIXELOFS_X) ? 0.375f : 0.0f; - yofs= (v2d->flag & V2D_PIXELOFS_Y) ? 0.375f : 0.0f; + /* XXX temp (ton) */ + xofs= 0.0f; // (v2d->flag & V2D_PIXELOFS_X) ? 0.375f : 0.0f; + yofs= 0.0f; // (v2d->flag & V2D_PIXELOFS_Y) ? 0.375f : 0.0f; /* apply mask-based adjustments to cur rect (due to scrollers), to eliminate scaling artifacts */ view2d_map_cur_using_mask(v2d, &curmasked); |