From 5fdbfbaf3af05b78ed5b7376c63f310134c24b58 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 11 Sep 2011 06:41:09 +0000 Subject: replace magic numbers for flags for uiSetRoundBox(); --- .../editors/animation/anim_channels_defines.c | 6 +- source/blender/editors/include/UI_interface.h | 19 +++++ source/blender/editors/interface/interface_draw.c | 44 +++++------ source/blender/editors/interface/interface_panel.c | 4 +- .../blender/editors/interface/interface_widgets.c | 89 ++++++++++------------ source/blender/editors/screen/area.c | 8 +- source/blender/editors/space_file/file_draw.c | 4 +- source/blender/editors/space_nla/nla_draw.c | 4 +- source/blender/editors/space_node/drawnode.c | 10 +-- source/blender/editors/space_node/node_draw.c | 10 +-- .../blender/editors/space_outliner/outliner_draw.c | 4 +- .../editors/space_sequencer/sequencer_draw.c | 2 +- source/blender/editors/space_text/text_draw.c | 2 +- source/blender/editors/space_view3d/view3d_draw.c | 4 +- source/blender/windowmanager/intern/wm_dragdrop.c | 2 +- 15 files changed, 107 insertions(+), 105 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index bdc654ff25a..276765bf96e 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -121,7 +121,7 @@ static void acf_generic_root_backdrop(bAnimContext *ac, bAnimListElem *ale, floa glColor3fv(color); /* rounded corners on LHS only - top only when expanded, but bottom too when collapsed */ - uiSetRoundBox((expanded)? (1):(1|8)); + uiSetRoundBox(expanded ? UI_CNR_TOP_LEFT : (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT)); uiDrawBox(GL_POLYGON, offset, yminc, v2d->cur.xmax+EXTRA_SCROLL_PAD, ymaxc, 8); } @@ -401,7 +401,7 @@ static void acf_summary_backdrop(bAnimContext *ac, bAnimListElem *ale, float ymi * - top and bottom * - special hack: make the top a bit higher, since we are first... */ - uiSetRoundBox((1|8)); + uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT); uiDrawBox(GL_POLYGON, 0, yminc-2, v2d->cur.xmax+EXTRA_SCROLL_PAD, ymaxc, 8); } @@ -756,7 +756,7 @@ static void acf_group_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc glColor3fv(color); /* rounded corners on LHS only - top only when expanded, but bottom too when collapsed */ - uiSetRoundBox((expanded)? (1):(1|8)); + uiSetRoundBox(expanded ? UI_CNR_TOP_LEFT : (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT)); uiDrawBox(GL_POLYGON, offset, yminc, v2d->cur.xmax+EXTRA_SCROLL_PAD, ymaxc, 8); } diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 3fe012ea73e..637940f59a6 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -653,6 +653,25 @@ void UI_exit(void); #define UI_LAYOUT_OP_SHOW_TITLE 1 #define UI_LAYOUT_OP_SHOW_EMPTY 2 +/* flags to set which corners will become rounded: + * + * 1------2 + * | | + * 8------4 */ + +enum { + UI_CNR_TOP_LEFT= 1, + UI_CNR_TOP_RIGHT= 2, + UI_CNR_BOTTOM_RIGHT= 4, + UI_CNR_BOTTOM_LEFT= 8, + /* just for convenience */ + UI_CNR_NONE= 0, + UI_CNR_ALL= (UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT) +}; + +/* not apart of the corner flags but mixed in some functions */ +#define UI_RB_ALPHA (UI_CNR_ALL + 1) + uiLayout *uiBlockLayout(uiBlock *block, int dir, int type, int x, int y, int size, int em, struct uiStyle *style); void uiBlockSetCurLayout(uiBlock *block, uiLayout *layout); void uiBlockLayoutResolve(uiBlock *block, int *x, int *y); diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 2267f04aab4..33aeb2df926 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -58,10 +58,9 @@ /* own include */ #include "interface_intern.h" -#define UI_RB_ALPHA 16 #define UI_DISABLED_ALPHA_OFFS -160 -static int roundboxtype= 15; +static int roundboxtype= UI_CNR_ALL; void uiSetRoundBox(int type) { @@ -69,13 +68,6 @@ void uiSetRoundBox(int type) * if this is undone, its not that big a deal, only makes curves edges * square for the */ roundboxtype= type; - - /* flags to set which corners will become rounded: - - 1------2 - | | - 8------4 - */ } @@ -98,7 +90,7 @@ void uiDrawBox(int mode, float minx, float miny, float maxx, float maxy, float r glBegin(mode); /* start with corner right-bottom */ - if(roundboxtype & 4) { + if(roundboxtype & UI_CNR_BOTTOM_RIGHT) { glVertex2f(maxx-rad, miny); for(a=0; a<7; a++) { glVertex2f(maxx-rad+vec[a][0], miny+vec[a][1]); @@ -108,7 +100,7 @@ void uiDrawBox(int mode, float minx, float miny, float maxx, float maxy, float r else glVertex2f(maxx, miny); /* corner right-top */ - if(roundboxtype & 2) { + if(roundboxtype & UI_CNR_TOP_RIGHT) { glVertex2f(maxx, maxy-rad); for(a=0; a<7; a++) { glVertex2f(maxx-vec[a][1], maxy-rad+vec[a][0]); @@ -118,7 +110,7 @@ void uiDrawBox(int mode, float minx, float miny, float maxx, float maxy, float r else glVertex2f(maxx, maxy); /* corner left-top */ - if(roundboxtype & 1) { + if(roundboxtype & UI_CNR_TOP_LEFT) { glVertex2f(minx+rad, maxy); for(a=0; a<7; a++) { glVertex2f(minx+rad-vec[a][0], maxy-vec[a][1]); @@ -128,7 +120,7 @@ void uiDrawBox(int mode, float minx, float miny, float maxx, float maxy, float r else glVertex2f(minx, maxy); /* corner left-bottom */ - if(roundboxtype & 8) { + if(roundboxtype & UI_CNR_BOTTOM_LEFT) { glVertex2f(minx, miny+rad); for(a=0; a<7; a++) { glVertex2f(minx+vec[a][1], miny+rad-vec[a][0]); @@ -180,7 +172,7 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl glBegin(mode); /* start with corner right-bottom */ - if(roundboxtype & 4) { + if(roundboxtype & UI_CNR_BOTTOM_RIGHT) { round_box_shade_col(coltop, coldown, 0.0); glVertex2f(maxx-rad, miny); @@ -199,7 +191,7 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl } /* corner right-top */ - if(roundboxtype & 2) { + if(roundboxtype & UI_CNR_TOP_RIGHT) { round_box_shade_col(coltop, coldown, (div-rad)*idiv); glVertex2f(maxx, maxy-rad); @@ -217,7 +209,7 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl } /* corner left-top */ - if(roundboxtype & 1) { + if(roundboxtype & UI_CNR_TOP_LEFT) { round_box_shade_col(coltop, coldown, 1.0); glVertex2f(minx+rad, maxy); @@ -236,7 +228,7 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl } /* corner left-bottom */ - if(roundboxtype & 8) { + if(roundboxtype & UI_CNR_BOTTOM_LEFT) { round_box_shade_col(coltop, coldown, rad*idiv); glVertex2f(minx, miny+rad); @@ -288,7 +280,7 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float glBegin(mode); /* start with corner right-bottom */ - if(roundboxtype & 4) { + if(roundboxtype & UI_CNR_BOTTOM_RIGHT) { round_box_shade_col(colLeft, colRight, 0.0); glVertex2f(maxx-rad, miny); @@ -306,7 +298,7 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float } /* corner right-top */ - if(roundboxtype & 2) { + if(roundboxtype & UI_CNR_TOP_RIGHT) { round_box_shade_col(colLeft, colRight, 0.0); glVertex2f(maxx, maxy-rad); @@ -324,7 +316,7 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float } /* corner left-top */ - if(roundboxtype & 1) { + if(roundboxtype & UI_CNR_TOP_LEFT) { round_box_shade_col(colLeft, colRight, (div-rad)*idiv); glVertex2f(minx+rad, maxy); @@ -342,7 +334,7 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float } /* corner left-bottom */ - if(roundboxtype & 8) { + if(roundboxtype & UI_CNR_BOTTOM_LEFT) { round_box_shade_col(colLeft, colRight, 1.0); glVertex2f(minx, miny+rad); @@ -709,7 +701,7 @@ static void draw_scope_end(rctf *rect, GLint *scissor) /* outline */ glColor4f(0.f, 0.f, 0.f, 0.5f); - uiSetRoundBox(15); + uiSetRoundBox(UI_CNR_ALL); uiDrawBox(GL_LINE_LOOP, rect->xmin-1, rect->ymin, rect->xmax+1, rect->ymax+1, 3.0f); } @@ -768,7 +760,7 @@ void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol) glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); glColor4f(0.f, 0.f, 0.f, 0.3f); - uiSetRoundBox(15); + uiSetRoundBox(UI_CNR_ALL); uiDrawBox(GL_POLYGON, rect.xmin-1, rect.ymin-1, rect.xmax+1, rect.ymax+1, 3.0f); /* need scissor test, histogram can draw outside of boundary */ @@ -837,7 +829,7 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); glColor4f(0.f, 0.f, 0.f, 0.3f); - uiSetRoundBox(15); + uiSetRoundBox(UI_CNR_ALL); uiDrawBox(GL_POLYGON, rect.xmin-1, rect.ymin-1, rect.xmax+1, rect.ymax+1, 3.0f); @@ -1048,7 +1040,7 @@ void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wco glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); glColor4f(0.f, 0.f, 0.f, 0.3f); - uiSetRoundBox(15); + uiSetRoundBox(UI_CNR_ALL); uiDrawBox(GL_POLYGON, rect.xmin-1, rect.ymin-1, rect.xmax+1, rect.ymax+1, 3.0f); /* need scissor test, hvectorscope can draw outside of boundary */ @@ -1233,7 +1225,7 @@ void ui_draw_but_NORMAL(uiBut *but, uiWidgetColors *wcol, rcti *rect) /* backdrop */ glColor3ubv((unsigned char*)wcol->inner); - uiSetRoundBox(15); + uiSetRoundBox(UI_CNR_ALL); uiDrawBox(GL_POLYGON, rect->xmin, rect->ymin, rect->xmax, rect->ymax, 5.0f); /* sphere color */ diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 3b20533dcd4..cd1d250d6a4 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -537,8 +537,8 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect) /* in some occasions, draw a border */ if(panel->flag & PNL_SELECT) { - if(panel->control & UI_PNL_SOLID) uiSetRoundBox(15); - else uiSetRoundBox(3); + if(panel->control & UI_PNL_SOLID) uiSetRoundBox(UI_CNR_ALL); + else uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT); UI_ThemeColorShade(TH_BACK, -120); uiRoundRect(0.5f + rect->xmin, 0.5f + rect->ymin, 0.5f + rect->xmax, 0.5f + headrect.ymax+1, 8); diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index d9d75c34a94..c36742f7c4d 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -90,15 +90,6 @@ typedef struct uiWidgetTrias { #define WIDGET_CURVE_RESOLU 9 #define WIDGET_SIZE_MAX (WIDGET_CURVE_RESOLU*4) -enum { - WIDGET_TOP_LEFT= 1, - WIDGET_TOP_RIGHT= 2, - WIDGET_BOTTOM_RIGHT= 4, - WIDGET_BOTTOM_LEFT= 8, - /* just for convenience */ - WIDGET_ALL_CORNERS= (WIDGET_TOP_LEFT | WIDGET_TOP_RIGHT | WIDGET_BOTTOM_RIGHT | WIDGET_BOTTOM_LEFT) -}; - typedef struct uiWidgetBase { int totvert, halfwayvert; @@ -249,7 +240,7 @@ static int round_box_shadow_edges(float (*vert)[2], rcti *rect, float rad, int r } /* start with left-top, anti clockwise */ - if(roundboxalign & WIDGET_TOP_LEFT) { + if(roundboxalign & UI_CNR_TOP_LEFT) { for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) { vert[tot][0]= minx+rad-vec[a][0]; vert[tot][1]= maxy-vec[a][1]; @@ -262,7 +253,7 @@ static int round_box_shadow_edges(float (*vert)[2], rcti *rect, float rad, int r } } - if(roundboxalign & WIDGET_BOTTOM_LEFT) { + if(roundboxalign & UI_CNR_BOTTOM_LEFT) { for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) { vert[tot][0]= minx+vec[a][1]; vert[tot][1]= miny+rad-vec[a][0]; @@ -275,7 +266,7 @@ static int round_box_shadow_edges(float (*vert)[2], rcti *rect, float rad, int r } } - if(roundboxalign & WIDGET_BOTTOM_RIGHT) { + if(roundboxalign & UI_CNR_BOTTOM_RIGHT) { for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) { vert[tot][0]= maxx-rad+vec[a][0]; vert[tot][1]= miny+vec[a][1]; @@ -288,7 +279,7 @@ static int round_box_shadow_edges(float (*vert)[2], rcti *rect, float rad, int r } } - if(roundboxalign & WIDGET_TOP_RIGHT) { + if(roundboxalign & UI_CNR_TOP_RIGHT) { for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) { vert[tot][0]= maxx-vec[a][1]; vert[tot][1]= maxy-rad+vec[a][0]; @@ -315,10 +306,10 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, fl float facxi= (maxxi!=minxi) ? 1.0f/(maxxi-minxi) : 0.0f; /* for uv, can divide by zero */ float facyi= (maxyi!=minyi) ? 1.0f/(maxyi-minyi) : 0.0f; int a, tot= 0, minsize; - const int hnum= ((roundboxalign & (WIDGET_TOP_LEFT|WIDGET_TOP_RIGHT))==(WIDGET_TOP_LEFT|WIDGET_TOP_RIGHT) || - (roundboxalign & (WIDGET_BOTTOM_RIGHT|WIDGET_BOTTOM_LEFT))==(WIDGET_BOTTOM_RIGHT|WIDGET_BOTTOM_LEFT)) ? 1 : 2; - const int vnum= ((roundboxalign & (WIDGET_TOP_LEFT|WIDGET_BOTTOM_LEFT))==(WIDGET_TOP_LEFT|WIDGET_BOTTOM_LEFT) || - (roundboxalign & (WIDGET_TOP_RIGHT|WIDGET_BOTTOM_RIGHT))==(WIDGET_TOP_RIGHT|WIDGET_BOTTOM_RIGHT)) ? 1 : 2; + const int hnum= ((roundboxalign & (UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT))==(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT) || + (roundboxalign & (UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT))==(UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT)) ? 1 : 2; + const int vnum= ((roundboxalign & (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT))==(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT) || + (roundboxalign & (UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT))==(UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT)) ? 1 : 2; minsize= MIN2((rect->xmax-rect->xmin)*hnum, (rect->ymax-rect->ymin)*vnum); @@ -337,7 +328,7 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, fl } /* corner left-bottom */ - if(roundboxalign & WIDGET_BOTTOM_LEFT) { + if(roundboxalign & UI_CNR_BOTTOM_LEFT) { for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) { wt->inner_v[tot][0]= minxi+veci[a][1]; @@ -364,7 +355,7 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, fl } /* corner right-bottom */ - if(roundboxalign & WIDGET_BOTTOM_RIGHT) { + if(roundboxalign & UI_CNR_BOTTOM_RIGHT) { for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) { wt->inner_v[tot][0]= maxxi-radi+veci[a][0]; @@ -393,7 +384,7 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, fl wt->halfwayvert= tot; /* corner right-top */ - if(roundboxalign & WIDGET_TOP_RIGHT) { + if(roundboxalign & UI_CNR_TOP_RIGHT) { for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) { wt->inner_v[tot][0]= maxxi-veci[a][1]; @@ -420,7 +411,7 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, fl } /* corner left-top */ - if(roundboxalign & WIDGET_TOP_LEFT) { + if(roundboxalign & UI_CNR_TOP_LEFT) { for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) { wt->inner_v[tot][0]= minxi+radi-veci[a][0]; @@ -1684,7 +1675,7 @@ static void widget_softshadow(rcti *rect, int roundboxalign, float radin, float rect1.ymax -= 2.0f*radout; /* inner part */ - totvert= round_box_shadow_edges(wtb.inner_v, &rect1, radin, roundboxalign & (WIDGET_BOTTOM_RIGHT | WIDGET_BOTTOM_LEFT), 0.0f); + totvert= round_box_shadow_edges(wtb.inner_v, &rect1, radin, roundboxalign & (UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT), 0.0f); /* inverse linear shadow alpha */ alpha= 0.15; @@ -1693,7 +1684,7 @@ static void widget_softshadow(rcti *rect, int roundboxalign, float radin, float glEnableClientState(GL_VERTEX_ARRAY); for(step= 1; step<=radout; step++, alpha*=alphastep) { - round_box_shadow_edges(wtb.outer_v, &rect1, radin, WIDGET_ALL_CORNERS, (float)step); + round_box_shadow_edges(wtb.outer_v, &rect1, radin, UI_CNR_ALL, (float)step); glColor4f(0.0f, 0.0f, 0.0f, alpha); @@ -1709,7 +1700,7 @@ static void widget_softshadow(rcti *rect, int roundboxalign, float radin, float static void widget_menu_back(uiWidgetColors *wcol, rcti *rect, int flag, int direction) { uiWidgetBase wtb; - int roundboxalign= WIDGET_ALL_CORNERS; + int roundboxalign= UI_CNR_ALL; widget_init(&wtb); @@ -1719,11 +1710,11 @@ static void widget_menu_back(uiWidgetColors *wcol, rcti *rect, int flag, int dir //rect->ymax += 4.0; } else if (direction == UI_DOWN) { - roundboxalign= (WIDGET_BOTTOM_RIGHT | WIDGET_BOTTOM_LEFT); + roundboxalign= (UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT); rect->ymin -= 4.0; } else if (direction == UI_TOP) { - roundboxalign= WIDGET_TOP_LEFT | WIDGET_TOP_RIGHT; + roundboxalign= UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT; rect->ymax += 4.0; } @@ -2073,7 +2064,7 @@ static void ui_draw_but_HSV_v(uiBut *but, rcti *rect) widget_init(&wtb); /* fully rounded */ - round_box_edges(&wtb, WIDGET_ALL_CORNERS, rect, rad); + round_box_edges(&wtb, UI_CNR_ALL, rect, rad); /* setup temp colors */ wcol_tmp.outline[0]= wcol_tmp.outline[1]= wcol_tmp.outline[2]= 0; @@ -2211,7 +2202,7 @@ void uiWidgetScrollDraw(uiWidgetColors *wcol, rcti *rect, rcti *slider, int stat if(horizontal) SWAP(short, wcol->shadetop, wcol->shadedown); - round_box_edges(&wtb, WIDGET_ALL_CORNERS, rect, rad); + round_box_edges(&wtb, UI_CNR_ALL, rect, rad); widgetbase_draw(&wtb, wcol); /* slider */ @@ -2239,7 +2230,7 @@ void uiWidgetScrollDraw(uiWidgetColors *wcol, rcti *rect, rcti *slider, int stat if (state & UI_SCROLL_NO_OUTLINE) SWAP(short, outline, wtb.outline); - round_box_edges(&wtb, WIDGET_ALL_CORNERS, slider, rad); + round_box_edges(&wtb, UI_CNR_ALL, slider, rad); if(state & UI_SCROLL_ARROWS) { if(wcol->item[0] > 48) wcol->item[0]-= 48; @@ -2406,7 +2397,7 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s /* left part of slider, always rounded */ rect1.xmax= rect1.xmin + ceil(offs+1.0f); - round_box_edges(&wtb1, roundboxalign & ~(WIDGET_TOP_RIGHT | WIDGET_BOTTOM_RIGHT), &rect1, offs); + round_box_edges(&wtb1, roundboxalign & ~(UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT), &rect1, offs); wtb1.outline= 0; widgetbase_draw(&wtb1, wcol); @@ -2417,7 +2408,7 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s offs*= (rect1.xmax + offs - rect->xmax)/offs; else offs= 0.0f; - round_box_edges(&wtb1, roundboxalign & ~(WIDGET_TOP_LEFT | WIDGET_BOTTOM_LEFT), &rect1, offs); + round_box_edges(&wtb1, roundboxalign & ~(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT), &rect1, offs); widgetbase_draw(&wtb1, wcol); VECCOPY(wcol->outline, outline); @@ -2499,7 +2490,7 @@ static void widget_icon_has_anim(uiBut *UNUSED(but), uiWidgetColors *wcol, rcti wtb.outline= 0; /* rounded */ - round_box_edges(&wtb, WIDGET_ALL_CORNERS, rect, 10.0f); + round_box_edges(&wtb, UI_CNR_ALL, rect, 10.0f); widgetbase_draw(&wtb, wcol); } } @@ -2562,7 +2553,7 @@ static void widget_pulldownbut(uiWidgetColors *wcol, rcti *rect, int state, int widget_init(&wtb); /* half rounded */ - round_box_edges(&wtb, WIDGET_ALL_CORNERS, rect, rad); + round_box_edges(&wtb, UI_CNR_ALL, rect, rad); widgetbase_draw(&wtb, wcol); } @@ -2589,7 +2580,7 @@ static void widget_list_itembut(uiWidgetColors *wcol, rcti *rect, int UNUSED(sta /* rounded, but no outline */ wtb.outline= 0; - round_box_edges(&wtb, WIDGET_ALL_CORNERS, rect, 4.0f); + round_box_edges(&wtb, UI_CNR_ALL, rect, 4.0f); widgetbase_draw(&wtb, wcol); } @@ -2613,7 +2604,7 @@ static void widget_optionbut(uiWidgetColors *wcol, rcti *rect, int state, int UN recttemp.ymax-= delta; /* half rounded */ - round_box_edges(&wtb, WIDGET_ALL_CORNERS, &recttemp, 4.0f); + round_box_edges(&wtb, UI_CNR_ALL, &recttemp, 4.0f); /* decoration */ if(state & UI_SELECT) { @@ -2713,12 +2704,12 @@ static void widget_draw_extra_mask(const bContext *C, uiBut *but, uiWidgetType * UI_GetThemeColor3ubv(TH_BACK, col); glColor3ubv(col); - round_box__edges(&wtb, WIDGET_ALL_CORNERS, rect, 0.0f, 4.0); + round_box__edges(&wtb, UI_CNR_ALL, rect, 0.0f, 4.0); widgetbase_outline(&wtb); } /* outline */ - round_box_edges(&wtb, WIDGET_ALL_CORNERS, rect, 5.0f); + round_box_edges(&wtb, UI_CNR_ALL, rect, 5.0f); wtb.outline= 1; wtb.inner= 0; widgetbase_draw(&wtb, &wt->wcol); @@ -2899,27 +2890,27 @@ static int widget_roundbox_set(uiBut *but, rcti *rect) switch(but->flag & UI_BUT_ALIGN) { case UI_BUT_ALIGN_TOP: - return WIDGET_BOTTOM_LEFT | WIDGET_BOTTOM_RIGHT; + return UI_CNR_BOTTOM_LEFT | UI_CNR_BOTTOM_RIGHT; case UI_BUT_ALIGN_DOWN: - return WIDGET_TOP_LEFT | WIDGET_TOP_RIGHT; + return UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT; case UI_BUT_ALIGN_LEFT: - return WIDGET_TOP_RIGHT | WIDGET_BOTTOM_RIGHT; + return UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT; case UI_BUT_ALIGN_RIGHT: - return WIDGET_TOP_LEFT | WIDGET_BOTTOM_LEFT; + return UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT; case UI_BUT_ALIGN_DOWN | UI_BUT_ALIGN_RIGHT: - return WIDGET_TOP_LEFT; + return UI_CNR_TOP_LEFT; case UI_BUT_ALIGN_DOWN | UI_BUT_ALIGN_LEFT: - return WIDGET_TOP_RIGHT; + return UI_CNR_TOP_RIGHT; case UI_BUT_ALIGN_TOP | UI_BUT_ALIGN_RIGHT: - return WIDGET_BOTTOM_LEFT; + return UI_CNR_BOTTOM_LEFT; case UI_BUT_ALIGN_TOP | UI_BUT_ALIGN_LEFT: - return WIDGET_BOTTOM_RIGHT; + return UI_CNR_BOTTOM_RIGHT; default: return 0; } } - return WIDGET_ALL_CORNERS; + return UI_CNR_ALL; } /* conversion from old to new buttons, so still messy */ @@ -3157,14 +3148,14 @@ void ui_draw_search_back(uiStyle *UNUSED(style), uiBlock *block, rcti *rect) uiWidgetType *wt= widget_type(UI_WTYPE_BOX); glEnable(GL_BLEND); - widget_softshadow(rect, WIDGET_ALL_CORNERS, 5.0f, 8.0f); + widget_softshadow(rect, UI_CNR_ALL, 5.0f, 8.0f); glDisable(GL_BLEND); wt->state(wt, 0); if(block) - wt->draw(&wt->wcol, rect, block->flag, WIDGET_ALL_CORNERS); + wt->draw(&wt->wcol, rect, block->flag, UI_CNR_ALL); else - wt->draw(&wt->wcol, rect, 0, WIDGET_ALL_CORNERS); + wt->draw(&wt->wcol, rect, 0, UI_CNR_ALL); } diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index bc97cd9d3ff..d41d3245623 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -233,28 +233,28 @@ static void region_draw_azone_tab(AZone *az) /* add code to draw region hidden as 'too small' */ switch(az->edge) { case AE_TOP_TO_BOTTOMRIGHT: - uiSetRoundBox(3 + 16); + uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT | UI_RB_ALPHA); uiDrawBoxShade(GL_POLYGON, (float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, -0.3f, 0.05f); glColor4ub(0, 0, 0, 255); uiRoundRect((float)az->x1, 0.3f+(float)az->y1, (float)az->x2, 0.3f+(float)az->y2, 4.0f); break; case AE_BOTTOM_TO_TOPLEFT: - uiSetRoundBox(12 + 16); + uiSetRoundBox(UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT | UI_RB_ALPHA); uiDrawBoxShade(GL_POLYGON, (float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, -0.3f, 0.05f); glColor4ub(0, 0, 0, 255); uiRoundRect((float)az->x1, 0.3f+(float)az->y1, (float)az->x2, 0.3f+(float)az->y2, 4.0f); break; case AE_LEFT_TO_TOPRIGHT: - uiSetRoundBox(9 + 16); + uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT | UI_RB_ALPHA); uiDrawBoxShade(GL_POLYGON, (float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, -0.3f, 0.05f); glColor4ub(0, 0, 0, 255); uiRoundRect((float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f); break; case AE_RIGHT_TO_TOPLEFT: - uiSetRoundBox(6 + 16); + uiSetRoundBox(UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT | UI_RB_ALPHA); uiDrawBoxShade(GL_POLYGON, (float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, -0.3f, 0.05f); glColor4ub(0, 0, 0, 255); diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 9fecfda7764..0080317aece 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -239,7 +239,7 @@ void file_draw_buttons(const bContext *C, ARegion *ar) static void draw_tile(int sx, int sy, int width, int height, int colorid, int shade) { UI_ThemeColorShade(colorid, shade); - uiSetRoundBox(15); + uiSetRoundBox(UI_CNR_ALL); uiRoundBox((float)sx, (float)(sy - height), (float)(sx + width), (float)sy, 5.0f); } @@ -507,7 +507,7 @@ void file_draw_list(const bContext *C, ARegion *ar) draw_tile(sx, sy-1, layout->tile_w+4, sfile->layout->tile_h+layout->tile_border_y, colorid, shade); } } - uiSetRoundBox(0); + uiSetRoundBox(UI_CNR_NONE); if ( FILE_IMGDISPLAY == params->display ) { is_icon = 0; diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index 0c9c7877ddc..6af43e7618d 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -376,7 +376,7 @@ static void nla_draw_strip (SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStr if (nonSolo == 0) { /* strip is in normal track */ glColor3fv(color); - uiSetRoundBox(15); /* all corners rounded */ + uiSetRoundBox(UI_CNR_ALL); /* all corners rounded */ uiDrawBoxShade(GL_POLYGON, strip->start, yminc, strip->end, ymaxc, 0.0, 0.5, 0.1); } @@ -811,7 +811,7 @@ static void draw_nla_channel_list_gl (bAnimContext *ac, ListBase *anim_data, Vie offset += 7 * indent; /* only on top two corners, to show that this channel sits on top of the preceding ones */ - uiSetRoundBox((1|2)); + uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT); /* draw slightly shifted up vertically to look like it has more separtion from other channels, * but we then need to slightly shorten it so that it doesn't look like it overlaps diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 897de290752..9ea1e8ee877 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -741,23 +741,23 @@ static void node_draw_group(const bContext *C, ARegion *ar, SpaceNode *snode, bN /* backdrop header */ glEnable(GL_BLEND); - uiSetRoundBox(3); + uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT); UI_ThemeColorShadeAlpha(TH_NODE_GROUP, 0, -70); uiDrawBox(GL_POLYGON, rect.xmin-node_group_frame, rect.ymax, rect.xmax+node_group_frame, rect.ymax+group_header, BASIS_RAD); /* backdrop body */ UI_ThemeColorShadeAlpha(TH_BACK, -8, -70); - uiSetRoundBox(0); + uiSetRoundBox(UI_CNR_NONE); uiDrawBox(GL_POLYGON, rect.xmin, rect.ymin, rect.xmax, rect.ymax, BASIS_RAD); /* input column */ UI_ThemeColorShadeAlpha(TH_BACK, 10, -50); - uiSetRoundBox(8); + uiSetRoundBox(UI_CNR_BOTTOM_LEFT); uiDrawBox(GL_POLYGON, rect.xmin-node_group_frame, rect.ymin, rect.xmin, rect.ymax, BASIS_RAD); /* output column */ UI_ThemeColorShadeAlpha(TH_BACK, 10, -50); - uiSetRoundBox(4); + uiSetRoundBox(UI_CNR_BOTTOM_RIGHT); uiDrawBox(GL_POLYGON, rect.xmax, rect.ymin, rect.xmax+node_group_frame, rect.ymax, BASIS_RAD); /* input column separator */ @@ -775,7 +775,7 @@ static void node_draw_group(const bContext *C, ARegion *ar, SpaceNode *snode, bN glEnd(); /* group node outline */ - uiSetRoundBox(15); + uiSetRoundBox(UI_CNR_ALL); glColor4ub(200, 200, 200, 140); glEnable( GL_LINE_SMOOTH ); uiDrawBox(GL_LINE_LOOP, rect.xmin-node_group_frame, rect.ymin, rect.xmax+node_group_frame, rect.ymax+group_header, BASIS_RAD); diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index ba1e8d3dd59..c1b114d5436 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -568,7 +568,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN return; } - uiSetRoundBox(15-4); + uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_LEFT); ui_dropshadow(rct, BASIS_RAD, snode->aspect, node->flag & SELECT); /* header */ @@ -580,7 +580,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN if(node->flag & NODE_MUTED) UI_ThemeColorBlend(color_id, TH_REDALERT, 0.5f); - uiSetRoundBox(3); + uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT); uiRoundBox(rct->xmin, rct->ymax-NODE_DY, rct->xmax, rct->ymax, BASIS_RAD); /* show/hide icons, note this sequence is copied in do_header_node() node_state.c */ @@ -648,7 +648,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN /* body */ UI_ThemeColor4(TH_NODE); glEnable(GL_BLEND); - uiSetRoundBox(8); + uiSetRoundBox(UI_CNR_BOTTOM_LEFT); uiRoundBox(rct->xmin, rct->ymin, rct->xmax, rct->ymax-NODE_DY, BASIS_RAD); glDisable(GL_BLEND); @@ -664,7 +664,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN UI_ThemeColorShadeAlpha(TH_TEXT_HI, 0, -40); else UI_ThemeColorShadeAlpha(TH_TEXT_HI, -20, -120); - uiSetRoundBox(15-4); // round all corners except lower right + uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_LEFT); // round all corners except lower right uiDrawBox(GL_LINE_LOOP, rct->xmin, rct->ymin, rct->xmax, rct->ymax, BASIS_RAD); glDisable( GL_LINE_SMOOTH ); @@ -745,7 +745,7 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b char showname[128]; /* 128 is used below */ /* shadow */ - uiSetRoundBox(15); + uiSetRoundBox(UI_CNR_ALL); ui_dropshadow(rct, hiddenrad, snode->aspect, node->flag & SELECT); /* body */ diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index e77bb979d47..357730aff39 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -1182,7 +1182,7 @@ static void outliner_draw_iconrow(bContext *C, uiBlock *block, Scene *scene, Spa if(active) { float ufac= UI_UNIT_X/20.0f; - uiSetRoundBox(15); + uiSetRoundBox(UI_CNR_ALL); glColor4ub(255, 255, 255, 100); uiRoundBox( (float)*offsx-0.5f*ufac, (float)ys-1.0f*ufac, (float)*offsx+UI_UNIT_Y-3.0f*ufac, (float)ys+UI_UNIT_Y-3.0f*ufac, UI_UNIT_Y/2.0f-2.0f*ufac); glEnable(GL_BLEND); /* roundbox disables */ @@ -1313,7 +1313,7 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene /* active circle */ if(active) { - uiSetRoundBox(15); + uiSetRoundBox(UI_CNR_ALL); uiRoundBox( (float)startx+UI_UNIT_Y-1.5f*ufac, (float)*starty+2.0f*ufac, (float)startx+2.0f*UI_UNIT_Y-4.0f*ufac, (float)*starty+UI_UNIT_Y-1.0f*ufac, UI_UNIT_Y/2.0f-2.0f*ufac); glEnable(GL_BLEND); /* roundbox disables it */ diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index df1c0fa506e..0f5398f24a7 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -914,7 +914,7 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - uiSetRoundBox(15); + uiSetRoundBox(UI_CNR_ALL); uiDrawBox(GL_LINE_LOOP, x1, y1, x2, y2, 12.0); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index 066404f23ba..3d49bc7ffa0 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -1190,7 +1190,7 @@ static void draw_textscroll(SpaceText *st, rcti *scroll, rcti *back) uiWidgetScrollDraw(&wcol, scroll, &st->txtbar, (st->flags & ST_SCROLL_SELECT)?UI_SCROLL_PRESSED:0); - uiSetRoundBox(15); + uiSetRoundBox(UI_CNR_ALL); rad= 0.4f*MIN2(st->txtscroll.xmax - st->txtscroll.xmin, st->txtscroll.ymax - st->txtscroll.ymin); UI_GetThemeColor3ubv(TH_HILITE, col); col[3]= 48; diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index dc1252b8530..ba9faf7682e 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -485,8 +485,8 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit) if(is_emphasise != prev_emphasise) { glColor3ubv(is_emphasise ? col_grid_emphasise : col_grid_light); + prev_emphasise= is_emphasise; } - prev_emphasise= is_emphasise; /* set variable axis */ vert[0][1]= vert[1][1]= @@ -1206,7 +1206,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 0.25, 0); - uiSetRoundBox(15); + uiSetRoundBox(UI_CNR_ALL); uiDrawBox(GL_LINE_LOOP, x1, y1, x2, y2, 12.0); } } diff --git a/source/blender/windowmanager/intern/wm_dragdrop.c b/source/blender/windowmanager/intern/wm_dragdrop.c index 21a725124ad..29cbeb84058 100644 --- a/source/blender/windowmanager/intern/wm_dragdrop.c +++ b/source/blender/windowmanager/intern/wm_dragdrop.c @@ -256,7 +256,7 @@ static void wm_drop_operator_draw(char *name, int x, int y) glColor4ub(0, 0, 0, 50); - uiSetRoundBox(15+16); + uiSetRoundBox(UI_CNR_ALL | UI_RB_ALPHA); uiRoundBox(x, y, x + width + 8, y + 15, 4); glColor4ub(255, 255, 255, 255); -- cgit v1.2.3