diff options
Diffstat (limited to 'source/blender/editors/interface/interface_widgets.c')
-rw-r--r-- | source/blender/editors/interface/interface_widgets.c | 222 |
1 files changed, 111 insertions, 111 deletions
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index c496bae741c..97f560df7be 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -222,7 +222,7 @@ void ui_draw_anti_roundbox(int mode, float minx, float miny, float maxx, float m for (j = 0; j < WIDGET_AA_JITTER; j++) { glTranslatef(jit[j][0], jit[j][1], 0.0f); - uiDrawBox(mode, minx, miny, maxx, maxy, rad); + UI_draw_roundbox_gl_mode(mode, minx, miny, maxx, maxy, rad); glTranslatef(-jit[j][0], -jit[j][1], 0.0f); } @@ -830,7 +830,7 @@ static void widget_draw_preview(BIFIconID icon, float UNUSED(alpha), const rcti static int ui_but_draw_menu_icon(const uiBut *but) { - return (but->flag & UI_ICON_SUBMENU) && (but->dt == UI_EMBOSSP); + return (but->flag & UI_BUT_ICON_SUBMENU) && (but->dt == UI_EMBOSS_PULLDOWN); } /* icons have been standardized... and this call draws in untransformed coordinates */ @@ -841,7 +841,7 @@ static void widget_draw_icon(const uiBut *but, BIFIconID icon, float alpha, cons float xs = 0.0f, ys = 0.0f; float aspect, height; - if (but->flag & UI_ICON_PREVIEW) { + if (but->flag & UI_BUT_ICON_PREVIEW) { glEnable(GL_BLEND); widget_draw_preview(icon, alpha, rect); glDisable(GL_BLEND); @@ -849,20 +849,20 @@ static void widget_draw_icon(const uiBut *but, BIFIconID icon, float alpha, cons } /* this icon doesn't need draw... */ - if (icon == ICON_BLANK1 && (but->flag & UI_ICON_SUBMENU) == 0) return; + if (icon == ICON_BLANK1 && (but->flag & UI_BUT_ICON_SUBMENU) == 0) return; aspect = but->block->aspect / UI_DPI_FAC; height = ICON_DEFAULT_HEIGHT / aspect; /* calculate blend color */ - if (ELEM(but->type, TOG, ROW, TOGN, LISTROW)) { + if (ELEM(but->type, UI_BTYPE_TOGGLE, UI_BTYPE_ROW, UI_BTYPE_TOGGLE_N, UI_BTYPE_LISTROW)) { if (but->flag & UI_SELECT) {} else if (but->flag & UI_ACTIVE) {} else alpha = 0.5f; } /* extra feature allows more alpha blending */ - if ((but->type == LABEL) && but->a1 == 1.0f) + if ((but->type == UI_BTYPE_LABEL) && but->a1 == 1.0f) alpha *= but->a2; glEnable(GL_BLEND); @@ -872,7 +872,7 @@ static void widget_draw_icon(const uiBut *but, BIFIconID icon, float alpha, cons if (but->drawflag & UI_BUT_ICON_LEFT) { if (but->block->flag & UI_BLOCK_LOOP) { - if (ELEM(but->type, SEARCH_MENU, SEARCH_MENU_UNLINK)) + if (ELEM(but->type, UI_BTYPE_SEARCH_MENU, UI_BTYPE_SEARCH_MENU_UNLINK)) xs = rect->xmin + 4.0f * ofs; else xs = rect->xmin + ofs; @@ -973,7 +973,7 @@ static float ui_text_clip_middle_ex(uiFontStyle *fstyle, char *str, float okwidt BLI_assert(str[0]); /* need to set this first */ - uiStyleFontSet(fstyle); + UI_fontstyle_set(fstyle); if (fstyle->kerning == 1) { /* for BLF_width */ BLF_enable(fstyle->uifont_id, BLF_KERNING_DEFAULT); @@ -1071,7 +1071,7 @@ static float ui_text_clip_middle_ex(uiFontStyle *fstyle, char *str, float okwidt static void ui_text_clip_middle(uiFontStyle *fstyle, uiBut *but, const rcti *rect) { /* No margin for labels! */ - const int border = ELEM(but->type, LABEL, MENU) ? 0 : (int)(UI_TEXT_CLIP_MARGIN + 0.5f); + const int border = ELEM(but->type, UI_BTYPE_LABEL, UI_BTYPE_MENU) ? 0 : (int)(UI_TEXT_CLIP_MARGIN + 0.5f); const float okwidth = (float)max_ii(BLI_rcti_size_x(rect) - border, 0); const size_t max_len = sizeof(but->drawstr); const float minwidth = (float)(UI_DPI_ICON_SIZE) / but->block->aspect * 2.0f; @@ -1087,7 +1087,7 @@ static void ui_text_clip_middle(uiFontStyle *fstyle, uiBut *but, const rcti *rec static void ui_text_clip_middle_protect_right(uiFontStyle *fstyle, uiBut *but, const rcti *rect, const char *rsep) { /* No margin for labels! */ - const int border = ELEM(but->type, LABEL, MENU) ? 0 : (int)(UI_TEXT_CLIP_MARGIN + 0.5f); + const int border = ELEM(but->type, UI_BTYPE_LABEL, UI_BTYPE_MENU) ? 0 : (int)(UI_TEXT_CLIP_MARGIN + 0.5f); const float okwidth = (float)max_ii(BLI_rcti_size_x(rect) - border, 0); const size_t max_len = sizeof(but->drawstr); const float minwidth = (float)(UI_DPI_ICON_SIZE) / but->block->aspect * 2.0f; @@ -1107,7 +1107,7 @@ static void ui_text_clip_cursor(uiFontStyle *fstyle, uiBut *but, const rcti *rec BLI_assert(but->editstr && but->pos >= 0); /* need to set this first */ - uiStyleFontSet(fstyle); + UI_fontstyle_set(fstyle); if (fstyle->kerning == 1) /* for BLF_width */ BLF_enable(fstyle->uifont_id, BLF_KERNING_DEFAULT); @@ -1170,7 +1170,7 @@ static void ui_text_clip_right_label(uiFontStyle *fstyle, uiBut *but, const rcti const char *cpend = but->drawstr + drawstr_len; /* need to set this first */ - uiStyleFontSet(fstyle); + UI_fontstyle_set(fstyle); if (fstyle->kerning == 1) /* for BLF_width */ BLF_enable(fstyle->uifont_id, BLF_KERNING_DEFAULT); @@ -1239,7 +1239,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b const char *drawstr_right = NULL; bool use_right_only = false; - uiStyleFontSet(fstyle); + UI_fontstyle_set(fstyle); if (but->editstr || (but->drawflag & UI_BUT_TEXT_LEFT)) fstyle->align = UI_STYLE_TEXT_LEFT; @@ -1255,7 +1255,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b /* Special case: when we're entering text for multiple buttons, * don't draw the text for any of the multi-editing buttons */ if (UNLIKELY(but->flag & UI_BUT_DRAG_MULTI)) { - uiBut *but_edit = ui_get_but_drag_multi_edit(but); + uiBut *but_edit = ui_but_drag_multi_edit_get(but); if (but_edit) { drawstr = but_edit->editstr; fstyle->align = UI_STYLE_TEXT_LEFT; @@ -1334,7 +1334,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b } #ifdef USE_NUMBUTS_LR_ALIGN - if (!drawstr_right && ELEM(but->type, NUM, NUMSLI) && + if (!drawstr_right && ELEM(but->type, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER) && /* if we're editing or multi-drag (fake editing), then use left alignment */ (but->editstr == NULL) && (drawstr == but->drawstr)) { @@ -1361,7 +1361,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b /* for underline drawing */ float font_xofs, font_yofs; - uiStyleFontDrawExt(fstyle, rect, drawstr + but->ofs, + UI_fontstyle_draw_ex(fstyle, rect, drawstr + but->ofs, drawstr_left_len - but->ofs, &font_xofs, &font_yofs); if (but->menu_key != '\0') { @@ -1401,7 +1401,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b if (drawstr_right) { fstyle->align = UI_STYLE_TEXT_RIGHT; rect->xmax -= UI_TEXT_CLIP_MARGIN; - uiStyleFontDraw(fstyle, rect, drawstr_right); + UI_fontstyle_draw(fstyle, rect, drawstr_right); } } @@ -1412,10 +1412,10 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB float alpha = (float)wcol->text[3] / 255.0f; char password_str[UI_MAX_DRAW_STR]; - ui_button_text_password_hide(password_str, but, false); + ui_but_text_password_hide(password_str, but, false); /* check for button text label */ - if (but->type == MENU && (but->flag & UI_BUT_NODE_LINK)) { + if (but->type == UI_BTYPE_MENU && (but->flag & UI_BUT_NODE_LINK)) { rcti temp = *rect; temp.xmin = rect->xmax - BLI_rcti_size_y(rect) - 1; widget_draw_icon(but, ICON_LAYER_USED, alpha, &temp, false); @@ -1450,7 +1450,7 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB } /* unlink icon for this button type */ - if ((but->type == SEARCH_MENU_UNLINK) && ui_is_but_search_unlink_visible(but)) { + if ((but->type == UI_BTYPE_SEARCH_MENU_UNLINK) && ui_but_is_search_unlink_visible(but)) { rcti temp = *rect; temp.xmin = temp.xmax - (BLI_rcti_size_y(rect) * 1.08f); @@ -1467,10 +1467,10 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB but->ofs = 0; but->strwidth = 0; } - else if (ELEM(but->type, NUM, NUMSLI)) { + else if (ELEM(but->type, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER)) { ui_text_clip_right_label(fstyle, but, rect); } - else if ((but->block->flag & UI_BLOCK_LOOP) && (but->type == BUT)) { + else if ((but->block->flag & UI_BLOCK_LOOP) && (but->type == UI_BTYPE_BUT)) { /* Clip middle, but protect in all case right part containing the shortcut, if any. */ ui_text_clip_middle_protect_right(fstyle, but, rect, "|"); } @@ -1481,7 +1481,7 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB /* always draw text for textbutton cursor */ widget_draw_text(fstyle, wcol, but, rect); - ui_button_text_password_hide(password_str, but, true); + ui_but_text_password_hide(password_str, but, true); } #undef UI_TEXT_CLIP_MARGIN @@ -2053,11 +2053,11 @@ static void widget_menu_back(uiWidgetColors *wcol, rcti *rect, int flag, int dir //rect->ymin -= 4.0; //rect->ymax += 4.0; } - else if (direction == UI_DOWN) { + else if (direction == UI_DIR_DOWN) { roundboxalign = (UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT); rect->ymin -= 0.1f * U.widget_unit; } - else if (direction == UI_TOP) { + else if (direction == UI_DIR_UP) { roundboxalign = UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT; rect->ymax += 0.1f * U.widget_unit; } @@ -2142,10 +2142,10 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, const rcti * float xpos, ypos, ang = 0.0f; float rgb[3], hsvo[3], hsv[3], col[3], colcent[3]; int a; - bool color_profile = ui_color_picker_use_display_colorspace(but); + bool color_profile = ui_but_is_colorpicker_display_space(but); /* color */ - ui_get_but_vectorf(but, rgb); + ui_but_v3_get(but, rgb); /* since we use compat functions on both 'hsv' and 'hsvo', they need to be initialized */ hsvo[0] = hsv[0] = hsv_ptr[0]; @@ -2153,7 +2153,7 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, const rcti * hsvo[2] = hsv[2] = hsv_ptr[2]; if (color_profile) - ui_block_to_display_space_v3(but->block, rgb); + ui_block_cm_to_display_space_v3(but->block, rgb); ui_rgb_to_color_picker_compat_v(rgb, hsv); copy_v3_v3(hsvo, hsv); @@ -2354,7 +2354,7 @@ void ui_draw_gradient(const rcti *rect, const float hsv[3], const int type, cons } -bool ui_color_picker_use_display_colorspace(uiBut *but) +bool ui_but_is_colorpicker_display_space(uiBut *but) { bool color_profile = but->block->color_profile; @@ -2408,14 +2408,14 @@ static void ui_draw_but_HSVCUBE(uiBut *but, const rcti *rect) ColorPicker *cpicker = but->custom_data; float *hsv = cpicker->color_data; float hsv_n[3]; - bool use_display_colorspace = ui_color_picker_use_display_colorspace(but); + bool use_display_colorspace = ui_but_is_colorpicker_display_space(but); copy_v3_v3(hsv_n, hsv); - ui_get_but_vectorf(but, rgb); + ui_but_v3_get(but, rgb); if (use_display_colorspace) - ui_block_to_display_space_v3(but->block, rgb); + ui_block_cm_to_display_space_v3(but->block, rgb); rgb_to_hsv_compat_v(rgb, hsv_n); @@ -2444,10 +2444,10 @@ static void ui_draw_but_HSV_v(uiBut *but, const rcti *rect) if (but->rnaprop && RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) color_profile = false; - ui_get_but_vectorf(but, rgb); + ui_but_v3_get(but, rgb); if (color_profile) - ui_block_to_display_space_v3(but->block, rgb); + ui_block_cm_to_display_space_v3(but->block, rgb); if (but->a1 == UI_GRAD_L_ALT) rgb_to_hsl_v(rgb, hsv); @@ -2593,7 +2593,7 @@ void ui_draw_link_bezier(const rcti *rect) } /* function in use for buttons and for view2d sliders */ -void uiWidgetScrollDraw(uiWidgetColors *wcol, const rcti *rect, const rcti *slider, int state) +void UI_draw_widget_scroll(uiWidgetColors *wcol, const rcti *rect, const rcti *slider, int state) { uiWidgetBase wtb; int horizontal; @@ -2679,7 +2679,7 @@ static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat int horizontal; /* calculate slider part */ - value = ui_get_but_val(but); + value = ui_but_value_get(but); size = (but->softmax + but->a1 - but->softmin); size = max_ff(size, 2.0f); @@ -2729,7 +2729,7 @@ static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat state = UI_SCROLL_PRESSED; else state = 0; - uiWidgetScrollDraw(wcol, rect, &rect1, state); + UI_draw_widget_scroll(wcol, rect, &rect1, state); } static void widget_progressbar(uiBut *but, uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int UNUSED(roundboxalign)) @@ -2751,7 +2751,7 @@ static void widget_progressbar(uiBut *but, uiWidgetColors *wcol, rcti *rect, int rect_bar.xmax = rect_bar.xmin + w; - uiWidgetScrollDraw(wcol, &rect_prog, &rect_bar, UI_SCROLL_NO_OUTLINE); + UI_draw_widget_scroll(wcol, &rect_prog, &rect_bar, UI_SCROLL_NO_OUTLINE); /* raise text a bit */ rect->ymin += 6 * UI_DPI_FAC; @@ -2810,7 +2810,7 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s rect1 = *rect; - value = ui_get_but_val(but); + value = ui_but_value_get(but); fac = ((float)value - but->softmin) * (BLI_rcti_size_x(&rect1) - offs) / (but->softmax - but->softmin); /* left part of slider, always rounded */ @@ -2881,7 +2881,7 @@ static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat rad = 0.25f * U.widget_unit; round_box_edges(&wtb, roundboxalign, rect, rad); - ui_get_but_vectorf(but, col); + ui_but_v3_get(but, col); if (state & (UI_BUT_ANIMATED | UI_BUT_ANIMATED_KEY | UI_BUT_DRIVEN | UI_BUT_REDALERT)) { /* draw based on state - color for keyed etc */ @@ -2897,7 +2897,7 @@ static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat } if (color_profile) - ui_block_to_display_space_v3(but->block, col); + ui_block_cm_to_display_space_v3(but->block, col); rgba_float_to_uchar((unsigned char *)wcol->inner, col); @@ -2926,9 +2926,9 @@ static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat } } -static void widget_normal(uiBut *but, uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int UNUSED(roundboxalign)) +static void widget_unitvec(uiBut *but, uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int UNUSED(roundboxalign)) { - ui_draw_but_NORMAL(but, wcol, rect); + ui_draw_but_UNITVEC(but, wcol, rect); } static void widget_icon_has_anim(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) @@ -2945,7 +2945,7 @@ static void widget_icon_has_anim(uiBut *but, uiWidgetColors *wcol, rcti *rect, i round_box_edges(&wtb, UI_CNR_ALL, rect, rad); widgetbase_draw(&wtb, wcol); } - else if (but->type == NUM) { + else if (but->type == UI_BTYPE_NUM) { /* Draw number buttons still with left/right * triangles when field is not embossed */ widget_numbut_embossn(but, wcol, rect, state, roundboxalign); @@ -3278,7 +3278,7 @@ static uiWidgetType *widget_type(uiWidgetTypeEnum type) wt.wcol_theme = &btheme->tui.wcol_toggle; break; - case UI_WTYPE_OPTION: + case UI_WTYPE_CHECKBOX: wt.wcol_theme = &btheme->tui.wcol_option; wt.draw = widget_optionbut; break; @@ -3382,8 +3382,8 @@ static uiWidgetType *widget_type(uiWidgetTypeEnum type) case UI_WTYPE_RGB_PICKER: break; - case UI_WTYPE_NORMAL: - wt.custom = widget_normal; + case UI_WTYPE_UNITVEC: + wt.custom = widget_unitvec; break; case UI_WTYPE_SCROLL: @@ -3418,7 +3418,7 @@ static int widget_roundbox_set(uiBut *but, rcti *rect) int roundbox = UI_CNR_ALL; /* alignment */ - if ((but->drawflag & UI_BUT_ALIGN) && but->type != PULLDOWN) { + if ((but->drawflag & UI_BUT_ALIGN) && but->type != UI_BTYPE_PULLDOWN) { /* ui_block_position has this correction too, keep in sync */ if (but->drawflag & UI_BUT_ALIGN_TOP) @@ -3459,12 +3459,12 @@ static int widget_roundbox_set(uiBut *but, rcti *rect) /* align with open menu */ if (but->active) { - int direction = ui_button_open_menu_direction(but); + int direction = ui_but_menu_direction(but); - if (direction == UI_TOP) roundbox &= ~(UI_CNR_TOP_RIGHT | UI_CNR_TOP_LEFT); - else if (direction == UI_DOWN) roundbox &= ~(UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT); - else if (direction == UI_LEFT) roundbox &= ~(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT); - else if (direction == UI_RIGHT) roundbox &= ~(UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT); + if (direction == UI_DIR_UP) roundbox &= ~(UI_CNR_TOP_RIGHT | UI_CNR_TOP_LEFT); + else if (direction == UI_DIR_DOWN) roundbox &= ~(UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT); + else if (direction == UI_DIR_LEFT) roundbox &= ~(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT); + else if (direction == UI_DIR_RIGHT) roundbox &= ~(UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT); } return roundbox; @@ -3496,12 +3496,12 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct uiWidgetType *wt = NULL; /* handle menus separately */ - if (but->dt == UI_EMBOSSP) { + if (but->dt == UI_EMBOSS_PULLDOWN) { switch (but->type) { - case LABEL: + case UI_BTYPE_LABEL: widget_draw_text_icon(&style->widgetlabel, &tui->wcol_menu_back, but, rect); break; - case SEPRLINE: + case UI_BTYPE_SEPR_LINE: ui_draw_separator(rect, &tui->wcol_menu_item); break; default: @@ -3509,17 +3509,17 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct break; } } - else if (but->dt == UI_EMBOSSN) { + else if (but->dt == UI_EMBOSS_NONE) { /* "nothing" */ wt = widget_type(UI_WTYPE_ICON); } - else if (but->dt == UI_EMBOSSR) { + else if (but->dt == UI_EMBOSS_RADIAL) { wt = widget_type(UI_WTYPE_MENU_ITEM_RADIAL); } else { switch (but->type) { - case LABEL: + case UI_BTYPE_LABEL: if (but->block->flag & UI_BLOCK_LOOP) widget_draw_text_icon(&style->widgetlabel, &tui->wcol_menu_back, but, rect); else { @@ -3528,51 +3528,51 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct } break; - case SEPR: - case SEPRLINE: + case UI_BTYPE_SEPR: + case UI_BTYPE_SEPR_LINE: break; - case BUT: + case UI_BTYPE_BUT: wt = widget_type(UI_WTYPE_EXEC); break; - case NUM: + case UI_BTYPE_NUM: wt = widget_type(UI_WTYPE_NUMBER); break; - case NUMSLI: + case UI_BTYPE_NUM_SLIDER: wt = widget_type(UI_WTYPE_SLIDER); break; - case ROW: + case UI_BTYPE_ROW: wt = widget_type(UI_WTYPE_RADIO); break; - case LISTROW: + case UI_BTYPE_LISTROW: wt = widget_type(UI_WTYPE_LISTITEM); break; - case TEX: + case UI_BTYPE_TEXT: wt = widget_type(UI_WTYPE_NAME); break; - case SEARCH_MENU_UNLINK: - case SEARCH_MENU: + case UI_BTYPE_SEARCH_MENU_UNLINK: + case UI_BTYPE_SEARCH_MENU: wt = widget_type(UI_WTYPE_NAME); if (but->block->flag & UI_BLOCK_LOOP) wt->wcol_theme = &btheme->tui.wcol_menu_back; break; - case TOGBUT: - case TOG: - case TOGN: + case UI_BTYPE_BUT_TOGGLE: + case UI_BTYPE_TOGGLE: + case UI_BTYPE_TOGGLE_N: wt = widget_type(UI_WTYPE_TOGGLE); break; - case OPTION: - case OPTIONN: + case UI_BTYPE_CHECKBOX: + case UI_BTYPE_CHECKBOX_N: if (!(but->flag & UI_HAS_ICON)) { - wt = widget_type(UI_WTYPE_OPTION); + wt = widget_type(UI_WTYPE_CHECKBOX); but->drawflag |= UI_BUT_TEXT_LEFT; } else @@ -3584,8 +3584,8 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct break; - case MENU: - case BLOCK: + case UI_BTYPE_MENU: + case UI_BTYPE_BLOCK: if (but->flag & UI_BUT_NODE_LINK) { /* new node-link button, not active yet XXX */ wt = widget_type(UI_WTYPE_MENU_NODE_LINK); @@ -3597,7 +3597,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct * add updown arrows if there is room. */ if ((!but->str[0] && but->icon && (BLI_rcti_size_x(rect) < BLI_rcti_size_y(rect) + 2)) || /* disable for brushes also */ - (but->flag & UI_ICON_PREVIEW)) + (but->flag & UI_BUT_ICON_PREVIEW)) { /* no arrows */ wt = widget_type(UI_WTYPE_MENU_ICON_RADIO); @@ -3608,35 +3608,35 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct } break; - case PULLDOWN: + case UI_BTYPE_PULLDOWN: wt = widget_type(UI_WTYPE_PULLDOWN); break; - case BUTM: + case UI_BTYPE_BUT_MENU: wt = widget_type(UI_WTYPE_MENU_ITEM); break; - case COLOR: + case UI_BTYPE_COLOR: wt = widget_type(UI_WTYPE_SWATCH); break; - case ROUNDBOX: - case LISTBOX: + case UI_BTYPE_ROUNDBOX: + case UI_BTYPE_LISTBOX: wt = widget_type(UI_WTYPE_BOX); break; - case LINK: - case INLINK: + case UI_BTYPE_LINK: + case UI_BTYPE_INLINK: wt = widget_type(UI_WTYPE_ICON); wt->custom = widget_link; break; - case BUT_EXTRA: + case UI_BTYPE_EXTRA: widget_draw_extra_mask(C, but, widget_type(UI_WTYPE_BOX), rect); break; - case HSVCUBE: + case UI_BTYPE_HSVCUBE: if (ELEM(but->a1, UI_GRAD_V_ALT, UI_GRAD_L_ALT)) { /* vertical V slider, uses new widget draw now */ ui_draw_but_HSV_v(but, rect); } @@ -3645,56 +3645,56 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct } break; - case HSVCIRCLE: + case UI_BTYPE_HSVCIRCLE: ui_draw_but_HSVCIRCLE(but, &tui->wcol_regular, rect); break; - case BUT_COLORBAND: + case UI_BTYPE_COLORBAND: ui_draw_but_COLORBAND(but, &tui->wcol_regular, rect); break; - case BUT_NORMAL: - wt = widget_type(UI_WTYPE_NORMAL); + case UI_BTYPE_UNITVEC: + wt = widget_type(UI_WTYPE_UNITVEC); break; - case BUT_IMAGE: + case UI_BTYPE_IMAGE: ui_draw_but_IMAGE(ar, but, &tui->wcol_regular, rect); break; - case HISTOGRAM: + case UI_BTYPE_HISTOGRAM: ui_draw_but_HISTOGRAM(ar, but, &tui->wcol_regular, rect); break; - case WAVEFORM: + case UI_BTYPE_WAVEFORM: ui_draw_but_WAVEFORM(ar, but, &tui->wcol_regular, rect); break; - case VECTORSCOPE: + case UI_BTYPE_VECTORSCOPE: ui_draw_but_VECTORSCOPE(ar, but, &tui->wcol_regular, rect); break; - case BUT_CURVE: + case UI_BTYPE_CURVE: ui_draw_but_CURVE(ar, but, &tui->wcol_regular, rect); break; - case PROGRESSBAR: + case UI_BTYPE_PROGRESS_BAR: wt = widget_type(UI_WTYPE_PROGRESSBAR); fstyle = &style->widgetlabel; break; - case SCROLL: + case UI_BTYPE_SCROLL: wt = widget_type(UI_WTYPE_SCROLL); break; - case GRIP: + case UI_BTYPE_GRIP: wt = widget_type(UI_WTYPE_ICON); break; - case TRACKPREVIEW: + case UI_BTYPE_TRACK_PREVIEW: ui_draw_but_TRACKPREVIEW(ar, but, &tui->wcol_regular, rect); break; - case NODESOCKET: + case UI_BTYPE_NODE_SOCKET: ui_draw_but_NODESOCKET(ar, but, &tui->wcol_regular, rect); break; @@ -3714,13 +3714,13 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct state = but->flag; if ((but->editstr) || - (UNLIKELY(but->flag & UI_BUT_DRAG_MULTI) && ui_get_but_drag_multi_edit(but))) + (UNLIKELY(but->flag & UI_BUT_DRAG_MULTI) && ui_but_drag_multi_edit_get(but))) { state |= UI_TEXTINPUT; } if (state & (UI_BUT_DISABLED | UI_BUT_INACTIVE)) - if (but->dt != UI_EMBOSSP) + if (but->dt != UI_EMBOSS_PULLDOWN) disabled = true; if (disabled) @@ -3739,7 +3739,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct glDisable(GL_BLEND); // if (state & (UI_BUT_DISABLED | UI_BUT_INACTIVE)) -// if (but->dt != UI_EMBOSSP) +// if (but->dt != UI_EMBOSS_PULLDOWN) // widget_disabled(&disablerect); } } @@ -3758,12 +3758,12 @@ void ui_draw_menu_back(uiStyle *UNUSED(style), uiBlock *block, rcti *rect) if (block->flag & UI_BLOCK_CLIPTOP) { /* XXX no scaling for UI here yet */ glColor3ubv((unsigned char *)wt->wcol.text); - UI_DrawTriIcon(BLI_rcti_cent_x(rect), rect->ymax - 8, 't'); + UI_draw_icon_tri(BLI_rcti_cent_x(rect), rect->ymax - 8, 't'); } if (block->flag & UI_BLOCK_CLIPBOTTOM) { /* XXX no scaling for UI here yet */ glColor3ubv((unsigned char *)wt->wcol.text); - UI_DrawTriIcon(BLI_rcti_cent_x(rect), rect->ymin + 10, 'v'); + UI_draw_icon_tri(BLI_rcti_cent_x(rect), rect->ymin + 10, 'v'); } } } @@ -3937,7 +3937,7 @@ void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, const char *name, int ic wt->state(wt, state); wt->draw(&wt->wcol, rect, 0, 0); - uiStyleFontSet(fstyle); + UI_fontstyle_set(fstyle); fstyle->align = UI_STYLE_TEXT_LEFT; /* text location offset */ @@ -3951,7 +3951,7 @@ void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, const char *name, int ic *cpoin = 0; /* need to set this first */ - uiStyleFontSet(fstyle); + UI_fontstyle_set(fstyle); if (fstyle->kerning == 1) { /* for BLF_width */ BLF_enable(fstyle->uifont_id, BLF_KERNING_DEFAULT); @@ -3975,7 +3975,7 @@ void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, const char *name, int ic ui_text_clip_middle_ex(fstyle, drawstr, okwidth, minwidth, max_len, NULL); glColor4ubv((unsigned char *)wt->wcol.text); - uiStyleFontDraw(fstyle, rect, drawstr); + UI_fontstyle_draw(fstyle, rect, drawstr); } /* part text right aligned */ @@ -3983,7 +3983,7 @@ void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, const char *name, int ic if (cpoin) { fstyle->align = UI_STYLE_TEXT_RIGHT; rect->xmax = _rect.xmax - 5; - uiStyleFontDraw(fstyle, rect, cpoin + 1); + UI_fontstyle_draw(fstyle, rect, cpoin + 1); *cpoin = UI_SEP_CHAR; } } @@ -4050,6 +4050,6 @@ void ui_draw_preview_item(uiFontStyle *fstyle, rcti *rect, const char *name, int ui_text_clip_middle_ex(fstyle, drawstr, okwidth, minwidth, max_len, NULL); glColor4ubv((unsigned char *)wt->wcol.text); - uiStyleFontDraw(fstyle, &trect, drawstr); + UI_fontstyle_draw(fstyle, &trect, drawstr); } } |