Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface_widgets.c
| Show First 20 Lines • Show All 1,848 Lines • ▼ Show 20 Lines | static struct uiWidgetColors wcol_scroll = { | ||||
| 1, | 1, | ||||
| 5, -5 | 5, -5 | ||||
| }; | }; | ||||
| static struct uiWidgetColors wcol_progress = { | static struct uiWidgetColors wcol_progress = { | ||||
| {0, 0, 0, 255}, | {0, 0, 0, 255}, | ||||
| {190, 190, 190, 255}, | {190, 190, 190, 255}, | ||||
| {100, 100, 100, 180}, | {100, 100, 100, 180}, | ||||
| {68, 68, 68, 255}, | {128, 128, 128, 255}, | ||||
brecht: This theme color change will not affect existing user preferences.
We should version patch… | |||||
| {0, 0, 0, 255}, | {0, 0, 0, 255}, | ||||
| {255, 255, 255, 255}, | {255, 255, 255, 255}, | ||||
| 0, | 0, | ||||
| 0, 0 | 0, 0 | ||||
| }; | }; | ||||
| ▲ Show 20 Lines • Show All 992 Lines • ▼ Show 20 Lines | static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int UNUSED(roundboxalign)) | ||||
| if (state & UI_SELECT) | if (state & UI_SELECT) | ||||
| state = UI_SCROLL_PRESSED; | state = UI_SCROLL_PRESSED; | ||||
| else | else | ||||
| state = 0; | state = 0; | ||||
| UI_draw_widget_scroll(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)) | static void widget_progressbar(uiBut *but, uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign) | ||||
| { | { | ||||
| uiWidgetBase wtb, wtb_bar; | |||||
| rcti rect_prog = *rect, rect_bar = *rect; | rcti rect_prog = *rect, rect_bar = *rect; | ||||
| float value = but->a1; | |||||
| float w, min; | |||||
| /* make the progress bar a proportion of the original height */ | widget_init(&wtb); | ||||
| /* hardcoded 4px high for now */ | widget_init(&wtb_bar); | ||||
| rect_prog.ymax = rect_prog.ymin + 4 * UI_DPI_FAC; | |||||
| rect_bar.ymax = rect_bar.ymin + 4 * UI_DPI_FAC; | |||||
| w = value * BLI_rcti_size_x(&rect_prog); | /* round corners */ | ||||
| float value = but->a1; | |||||
| float offs = 0.25f * BLI_rcti_size_y(&rect_prog); | |||||
| float w = value * BLI_rcti_size_x(&rect_prog); | |||||
| /* ensure minimium size */ | /* ensure minimium size */ | ||||
| min = BLI_rcti_size_y(&rect_prog); | w = MAX2(w, offs); | ||||
| w = MAX2(w, min); | |||||
| rect_bar.xmax = rect_bar.xmin + w; | rect_bar.xmax = rect_bar.xmin + w; | ||||
| UI_draw_widget_scroll(wcol, &rect_prog, &rect_bar, UI_SCROLL_NO_OUTLINE); | round_box_edges(&wtb, roundboxalign, &rect_prog, offs); | ||||
| round_box_edges(&wtb_bar, roundboxalign, &rect_bar, offs); | |||||
| wtb.draw_outline = true; | |||||
| widgetbase_draw(&wtb, wcol); | |||||
| /* "slider" bar color */ | |||||
| copy_v3_v3_char(wcol->inner, wcol->item); | |||||
| widgetbase_draw(&wtb_bar, wcol); | |||||
| /* raise text a bit */ | /* raise text a bit */ | ||||
| rect->ymin += 6 * UI_DPI_FAC; | rect->xmin += (BLI_rcti_size_x(&rect_prog) / 2); | ||||
| rect->xmin -= 6 * UI_DPI_FAC; | rect->xmax += (BLI_rcti_size_x(&rect_prog) / 2); | ||||
| } | } | ||||
| static void widget_link(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect, int UNUSED(state), int UNUSED(roundboxalign)) | static void widget_link(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect, int UNUSED(state), int UNUSED(roundboxalign)) | ||||
| { | { | ||||
| if (but->flag & UI_SELECT) { | if (but->flag & UI_SELECT) { | ||||
| rcti rectlink; | rcti rectlink; | ||||
| ▲ Show 20 Lines • Show All 1,258 Lines • Show Last 20 Lines | |||||
This theme color change will not affect existing user preferences.
We should version patch this in init_userdef_do_versions().