diff options
Diffstat (limited to 'source/blender')
5 files changed, 27 insertions, 27 deletions
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 53bfc94dfdd..0c37d35a93b 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -170,12 +170,16 @@ enum { UI_BUT_VEC_SIZE_LOCK = (1 << 22), /* used to flag if color hsv-circle should keep luminance */ UI_BUT_COLOR_CUBIC = (1 << 23), /* cubic saturation for the color wheel */ + UI_BUT_LIST_ITEM = (1 << 24), /* This but is "inside" a list item (currently used to change theme colors). */ }; #define UI_PANEL_WIDTH 340 #define UI_COMPACT_PANEL_WIDTH 160 /* but->drawflag - these flags should only affect how the button is drawn. */ +/* Note: currently, these flags _are not passed_ to the widget's state() or draw() functions + * (except for the 'align' ones)! + */ enum { /* draw enum-like up/down arrows for button */ UI_BUT_DRAW_ENUM_ARROWS = (1 << 0), @@ -263,7 +267,6 @@ typedef enum { PROGRESSBAR = (51 << 9), SEARCH_MENU_UNLINK = (52 << 9), NODESOCKET = (53 << 9), - LISTLABEL = (54 << 9), } eButType; #define BUTTYPE (63 << 9) diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 33a054318b6..db53809c7c4 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -301,7 +301,7 @@ void ui_pan_to_scroll(const wmEvent *event, int *type, int *val) static bool ui_but_editable(uiBut *but) { - return ELEM6(but->type, LABEL, LISTLABEL, SEPR, ROUNDBOX, LISTBOX, PROGRESSBAR); + return ELEM5(but->type, LABEL, SEPR, ROUNDBOX, LISTBOX, PROGRESSBAR); } static uiBut *ui_but_prev(uiBut *but) @@ -2097,7 +2097,7 @@ static void ui_textedit_next_but(uiBlock *block, uiBut *actbut, uiHandleButtonDa uiBut *but; /* label and roundbox can overlap real buttons (backdrops...) */ - if (ELEM5(actbut->type, LABEL, LISTLABEL, SEPR, ROUNDBOX, LISTBOX)) + if (ELEM4(actbut->type, LABEL, SEPR, ROUNDBOX, LISTBOX)) return; for (but = actbut->next; but; but = but->next) { @@ -2125,7 +2125,7 @@ static void ui_textedit_prev_but(uiBlock *block, uiBut *actbut, uiHandleButtonDa uiBut *but; /* label and roundbox can overlap real buttons (backdrops...) */ - if (ELEM5(actbut->type, LABEL, LISTLABEL, SEPR, ROUNDBOX, LISTBOX)) + if (ELEM4(actbut->type, LABEL, SEPR, ROUNDBOX, LISTBOX)) return; for (but = actbut->prev; but; but = but->prev) { @@ -5675,7 +5675,6 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent * break; case ROUNDBOX: case LABEL: - case LISTLABEL: case ROW: case LISTROW: case BUT_IMAGE: @@ -5888,7 +5887,7 @@ static bool ui_mouse_inside_button(ARegion *ar, uiBut *but, int x, int y) bool ui_is_but_interactive(uiBut *but) { /* note, LABEL is included for highlights, this allows drags */ - if (ELEM(but->type, LABEL, LISTLABEL) && but->dragpoin == NULL) + if ((but->type == LABEL) && but->dragpoin == NULL) return false; if (ELEM3(but->type, ROUNDBOX, SEPR, LISTBOX)) return false; @@ -7444,7 +7443,7 @@ static int ui_handle_menu_event(bContext *C, const wmEvent *event, uiPopupBlockH for (but = block->buttons.first; but; but = but->next) { int doit = FALSE; - if (but->type != LABEL && but->type != LISTLABEL && but->type != SEPR) + if (!ELEM(but->type, LABEL, SEPR)) count++; /* exception for rna layer buts */ diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 30a0eb424e0..30d8535e471 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -95,7 +95,6 @@ typedef enum { UI_WTYPE_SCROLL, UI_WTYPE_LISTITEM, UI_WTYPE_PROGRESSBAR, - UI_WTYPE_LISTLABEL, } uiWidgetTypeEnum; /* menu scrolling */ diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 4517c098202..e3686b7560c 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -1687,7 +1687,7 @@ static uiBut *uiItemL_(uiLayout *layout, const char *name, int icon) /* Mark as a label inside a listbox. */ if (block->flag & UI_BLOCK_LIST_ITEM) { - but->type = LISTLABEL; + but->flag |= UI_BUT_LIST_ITEM; } return but; @@ -2457,7 +2457,7 @@ void ui_layout_list_set_labels_active(uiLayout *layout) if (bitem->item.type != ITEM_BUTTON) { ui_layout_list_set_labels_active((uiLayout *)(&bitem->item)); } - else if (bitem->but->type == LISTLABEL) { + else if (bitem->but->flag & UI_BUT_LIST_ITEM) { uiButSetFlag(bitem->but, UI_SELECT); } } diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 76be6ff1c84..3058888c012 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -882,7 +882,7 @@ static void widget_draw_icon(uiBut *but, BIFIconID icon, float alpha, const rcti } /* extra feature allows more alpha blending */ - if (ELEM(but->type, LABEL, LISTLABEL) && but->a1 == 1.0f) + if ((but->type == LABEL) && but->a1 == 1.0f) alpha *= but->a2; glEnable(GL_BLEND); @@ -2866,12 +2866,21 @@ static void widget_optionbut(uiWidgetColors *wcol, rcti *rect, int state, int UN /* labels use Editor theme colors for text */ static void widget_state_label(uiWidgetType *wt, int state) { - /* call this for option button */ - widget_state(wt, state); - if (state & UI_SELECT) - UI_GetThemeColor3ubv(TH_TEXT_HI, (unsigned char *)wt->wcol.text); - else - UI_GetThemeColor3ubv(TH_TEXT, (unsigned char *)wt->wcol.text); + if (state & UI_BUT_LIST_ITEM) { + /* Override default label theme's colors. */ + bTheme *btheme = UI_GetTheme(); + wt->wcol_theme = &btheme->tui.wcol_list_item; + /* call this for option button */ + widget_state(wt, state); + } + else { + /* call this for option button */ + widget_state(wt, state); + if (state & UI_SELECT) + UI_GetThemeColor3ubv(TH_TEXT_HI, (unsigned char *)wt->wcol.text); + else + UI_GetThemeColor3ubv(TH_TEXT, (unsigned char *)wt->wcol.text); + } } static void widget_radiobut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign) @@ -2991,11 +3000,6 @@ static uiWidgetType *widget_type(uiWidgetTypeEnum type) case UI_WTYPE_REGULAR: break; - case UI_WTYPE_LISTLABEL: - wt.wcol_theme = &btheme->tui.wcol_list_item; - wt.draw = NULL; - /* Can't use usual label code. */ - break; case UI_WTYPE_LABEL: wt.draw = NULL; wt.state = widget_state_label; @@ -3245,11 +3249,6 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct fstyle = &style->widgetlabel; } break; - - case LISTLABEL: - wt = widget_type(UI_WTYPE_LISTLABEL); - fstyle = &style->widgetlabel; - break; case SEPR: break; |