Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface_widgets.c
| Show First 20 Lines • Show All 1,704 Lines • ▼ Show 20 Lines | |||||
| static struct uiWidgetStateColors wcol_state_colors = { | static struct uiWidgetStateColors wcol_state_colors = { | ||||
| {115, 190, 76, 255}, | {115, 190, 76, 255}, | ||||
| {90, 166, 51, 255}, | {90, 166, 51, 255}, | ||||
| {240, 235, 100, 255}, | {240, 235, 100, 255}, | ||||
| {215, 211, 75, 255}, | {215, 211, 75, 255}, | ||||
| {180, 0, 255, 255}, | {180, 0, 255, 255}, | ||||
| {153, 0, 230, 255}, | {153, 0, 230, 255}, | ||||
| {74, 137, 137, 255}, | |||||
| {49, 112, 112, 255}, | |||||
| 0.5f, 0.0f | 0.5f, 0.0f | ||||
| }; | }; | ||||
| static struct uiWidgetColors wcol_num = { | static struct uiWidgetColors wcol_num = { | ||||
| {25, 25, 25, 255}, | {25, 25, 25, 255}, | ||||
| {180, 180, 180, 255}, | {180, 180, 180, 255}, | ||||
| {153, 153, 153, 255}, | {153, 153, 153, 255}, | ||||
| {90, 90, 90, 255}, | {90, 90, 90, 255}, | ||||
| ▲ Show 20 Lines • Show All 336 Lines • ▼ Show 20 Lines | if (state & UI_SELECT) { | ||||
| copy_v4_v4_char(wt->wcol.inner, wt->wcol.inner_sel); | copy_v4_v4_char(wt->wcol.inner, wt->wcol.inner_sel); | ||||
| if (state & UI_BUT_ANIMATED_KEY) | if (state & UI_BUT_ANIMATED_KEY) | ||||
| widget_state_blend(wt->wcol.inner, wcol_state->inner_key_sel, wcol_state->blend); | widget_state_blend(wt->wcol.inner, wcol_state->inner_key_sel, wcol_state->blend); | ||||
| else if (state & UI_BUT_ANIMATED) | else if (state & UI_BUT_ANIMATED) | ||||
| widget_state_blend(wt->wcol.inner, wcol_state->inner_anim_sel, wcol_state->blend); | widget_state_blend(wt->wcol.inner, wcol_state->inner_anim_sel, wcol_state->blend); | ||||
| else if (state & UI_BUT_DRIVEN) | else if (state & UI_BUT_DRIVEN) | ||||
| widget_state_blend(wt->wcol.inner, wcol_state->inner_driven_sel, wcol_state->blend); | widget_state_blend(wt->wcol.inner, wcol_state->inner_driven_sel, wcol_state->blend); | ||||
| else if (state & UI_BUT_OVERRIDEN) | |||||
| widget_state_blend(wt->wcol.inner, wcol_state->inner_overridden_sel, wcol_state->blend); | |||||
| copy_v3_v3_char(wt->wcol.text, wt->wcol.text_sel); | copy_v3_v3_char(wt->wcol.text, wt->wcol.text_sel); | ||||
| if (state & UI_SELECT) | if (state & UI_SELECT) | ||||
| SWAP(short, wt->wcol.shadetop, wt->wcol.shadedown); | SWAP(short, wt->wcol.shadetop, wt->wcol.shadedown); | ||||
| } | } | ||||
| else { | else { | ||||
| if (state & UI_BUT_ANIMATED_KEY) | if (state & UI_BUT_ANIMATED_KEY) | ||||
| widget_state_blend(wt->wcol.inner, wcol_state->inner_key, wcol_state->blend); | widget_state_blend(wt->wcol.inner, wcol_state->inner_key, wcol_state->blend); | ||||
| else if (state & UI_BUT_ANIMATED) | else if (state & UI_BUT_ANIMATED) | ||||
| widget_state_blend(wt->wcol.inner, wcol_state->inner_anim, wcol_state->blend); | widget_state_blend(wt->wcol.inner, wcol_state->inner_anim, wcol_state->blend); | ||||
| else if (state & UI_BUT_DRIVEN) | else if (state & UI_BUT_DRIVEN) | ||||
| widget_state_blend(wt->wcol.inner, wcol_state->inner_driven, wcol_state->blend); | widget_state_blend(wt->wcol.inner, wcol_state->inner_driven, wcol_state->blend); | ||||
| else if (state & UI_BUT_OVERRIDEN) | |||||
| widget_state_blend(wt->wcol.inner, wcol_state->inner_overridden, wcol_state->blend); | |||||
| if (state & UI_ACTIVE) { /* mouse over? */ | if (state & UI_ACTIVE) { /* mouse over? */ | ||||
| wt->wcol.inner[0] = wt->wcol.inner[0] >= 240 ? 255 : wt->wcol.inner[0] + 15; | wt->wcol.inner[0] = wt->wcol.inner[0] >= 240 ? 255 : wt->wcol.inner[0] + 15; | ||||
| wt->wcol.inner[1] = wt->wcol.inner[1] >= 240 ? 255 : wt->wcol.inner[1] + 15; | wt->wcol.inner[1] = wt->wcol.inner[1] >= 240 ? 255 : wt->wcol.inner[1] + 15; | ||||
| wt->wcol.inner[2] = wt->wcol.inner[2] >= 240 ? 255 : wt->wcol.inner[2] + 15; | wt->wcol.inner[2] = wt->wcol.inner[2] >= 240 ? 255 : wt->wcol.inner[2] + 15; | ||||
| } | } | ||||
| } | } | ||||
| Show All 29 Lines | static void widget_state_numslider(uiWidgetType *wt, int state) | ||||
| if (state & UI_SELECT) { | if (state & UI_SELECT) { | ||||
| if (state & UI_BUT_ANIMATED_KEY) | if (state & UI_BUT_ANIMATED_KEY) | ||||
| widget_state_blend(wt->wcol.item, wcol_state->inner_key_sel, blend); | widget_state_blend(wt->wcol.item, wcol_state->inner_key_sel, blend); | ||||
| else if (state & UI_BUT_ANIMATED) | else if (state & UI_BUT_ANIMATED) | ||||
| widget_state_blend(wt->wcol.item, wcol_state->inner_anim_sel, blend); | widget_state_blend(wt->wcol.item, wcol_state->inner_anim_sel, blend); | ||||
| else if (state & UI_BUT_DRIVEN) | else if (state & UI_BUT_DRIVEN) | ||||
| widget_state_blend(wt->wcol.item, wcol_state->inner_driven_sel, blend); | widget_state_blend(wt->wcol.item, wcol_state->inner_driven_sel, blend); | ||||
| else if (state & UI_BUT_OVERRIDEN) | |||||
| widget_state_blend(wt->wcol.item, wcol_state->inner_overridden_sel, blend); | |||||
| if (state & UI_SELECT) | if (state & UI_SELECT) | ||||
| SWAP(short, wt->wcol.shadetop, wt->wcol.shadedown); | SWAP(short, wt->wcol.shadetop, wt->wcol.shadedown); | ||||
| } | } | ||||
| else { | else { | ||||
| if (state & UI_BUT_ANIMATED_KEY) | if (state & UI_BUT_ANIMATED_KEY) | ||||
| widget_state_blend(wt->wcol.item, wcol_state->inner_key, blend); | widget_state_blend(wt->wcol.item, wcol_state->inner_key, blend); | ||||
| else if (state & UI_BUT_ANIMATED) | else if (state & UI_BUT_ANIMATED) | ||||
| widget_state_blend(wt->wcol.item, wcol_state->inner_anim, blend); | widget_state_blend(wt->wcol.item, wcol_state->inner_anim, blend); | ||||
| else if (state & UI_BUT_DRIVEN) | else if (state & UI_BUT_DRIVEN) | ||||
| widget_state_blend(wt->wcol.item, wcol_state->inner_driven, blend); | widget_state_blend(wt->wcol.item, wcol_state->inner_driven, blend); | ||||
| else if (state & UI_BUT_OVERRIDEN) | |||||
| widget_state_blend(wt->wcol.item, wcol_state->inner_overridden, blend); | |||||
| } | } | ||||
| } | } | ||||
| /* labels use theme colors for text */ | /* labels use theme colors for text */ | ||||
| static void widget_state_option_menu(uiWidgetType *wt, int state) | static void widget_state_option_menu(uiWidgetType *wt, int state) | ||||
| { | { | ||||
| bTheme *btheme = UI_GetTheme(); /* XXX */ | bTheme *btheme = UI_GetTheme(); /* XXX */ | ||||
| ▲ Show 20 Lines • Show All 1,010 Lines • ▼ Show 20 Lines | static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) | ||||
| widget_init(&wtb); | widget_init(&wtb); | ||||
| /* half rounded */ | /* half rounded */ | ||||
| rad = 0.25f * U.widget_unit; | rad = 0.25f * U.widget_unit; | ||||
| round_box_edges(&wtb, roundboxalign, rect, rad); | round_box_edges(&wtb, roundboxalign, rect, rad); | ||||
| ui_but_v3_get(but, col); | ui_but_v3_get(but, col); | ||||
| if (state & (UI_BUT_ANIMATED | UI_BUT_ANIMATED_KEY | UI_BUT_DRIVEN | UI_BUT_REDALERT)) { | if (state & (UI_BUT_ANIMATED | UI_BUT_ANIMATED_KEY | UI_BUT_DRIVEN | UI_BUT_OVERRIDEN | UI_BUT_REDALERT)) { | ||||
| /* draw based on state - color for keyed etc */ | /* draw based on state - color for keyed etc */ | ||||
| widgetbase_draw(&wtb, wcol); | widgetbase_draw(&wtb, wcol); | ||||
| /* inset to draw swatch color */ | /* inset to draw swatch color */ | ||||
| rect->xmin += SWATCH_KEYED_BORDER; | rect->xmin += SWATCH_KEYED_BORDER; | ||||
| rect->xmax -= SWATCH_KEYED_BORDER; | rect->xmax -= SWATCH_KEYED_BORDER; | ||||
| rect->ymin += SWATCH_KEYED_BORDER; | rect->ymin += SWATCH_KEYED_BORDER; | ||||
| rect->ymax -= SWATCH_KEYED_BORDER; | rect->ymax -= SWATCH_KEYED_BORDER; | ||||
| ▲ Show 20 Lines • Show All 1,247 Lines • Show Last 20 Lines | |||||