Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKévin Dietrich <kevin.dietrich@mailoo.org>2016-01-18 03:39:09 +0300
committerKévin Dietrich <kevin.dietrich@mailoo.org>2016-01-18 03:39:09 +0300
commitc6bc2363e5ec96d1aba36f1e7b4d321076d3f465 (patch)
treea09fa844a679328a72c3dc3e00d8a1a9bf26a6cd /source/blender/editors/interface/interface_widgets.c
parentc4c2bd1350a52e18f973bba7e52e929f94ff6496 (diff)
UI: redesign of the progress bar.
A picture is worth a thousand words: http://wiki.blender.org/index.php/ File:UI_progress_bar.png Reviewers: #user_interface, brecht, dingto Reviewed by: brecht, dingto Differential Revision: https://developer.blender.org/D1727
Diffstat (limited to 'source/blender/editors/interface/interface_widgets.c')
-rw-r--r--source/blender/editors/interface/interface_widgets.c45
1 files changed, 26 insertions, 19 deletions
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 8198f68adf1..e493fe96f9c 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -1854,7 +1854,7 @@ static struct uiWidgetColors wcol_progress = {
{0, 0, 0, 255},
{190, 190, 190, 255},
{100, 100, 100, 180},
- {68, 68, 68, 255},
+ {128, 128, 128, 255},
{0, 0, 0, 255},
{255, 255, 255, 255},
@@ -2863,30 +2863,37 @@ static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat
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;
+
+ widget_init(&wtb);
+ widget_init(&wtb_bar);
+
+ /* round corners */
float value = but->a1;
- float w, min;
-
- /* make the progress bar a proportion of the original height */
- /* hardcoded 4px high for now */
- 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);
-
+ float offs = 0.25f * BLI_rcti_size_y(&rect_prog);
+ float w = value * BLI_rcti_size_x(&rect_prog);
+
/* ensure minimium size */
- min = BLI_rcti_size_y(&rect_prog);
- w = MAX2(w, min);
-
+ w = MAX2(w, offs);
+
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 */
- rect->ymin += 6 * UI_DPI_FAC;
- rect->xmin -= 6 * UI_DPI_FAC;
+ rect->xmin += (BLI_rcti_size_x(&rect_prog) / 2);
+ 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))