From 45ad6cd5a785733612e0b355df7426154f262308 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Fri, 3 May 2019 15:09:28 +0200 Subject: UI: Pass color id into view2d text drawing --- source/blender/editors/include/UI_view2d.h | 22 +++----- source/blender/editors/interface/view2d_draw.c | 64 +++++++++++++--------- source/blender/editors/space_action/space_action.c | 2 +- source/blender/editors/space_clip/space_clip.c | 6 +- source/blender/editors/space_graph/space_graph.c | 4 +- source/blender/editors/space_nla/space_nla.c | 2 +- .../editors/space_sequencer/sequencer_draw.c | 4 +- 7 files changed, 56 insertions(+), 48 deletions(-) diff --git a/source/blender/editors/include/UI_view2d.h b/source/blender/editors/include/UI_view2d.h index b1dfa89ae7d..064951d40ed 100644 --- a/source/blender/editors/include/UI_view2d.h +++ b/source/blender/editors/include/UI_view2d.h @@ -152,30 +152,24 @@ float UI_view2d_grid_resolution_y__values(const struct View2D *v2d); /* scale indicator text drawing */ void UI_view2d_draw_scale_y__values(const struct ARegion *ar, const struct View2D *v2d, - const struct rcti *rect); + const struct rcti *rect, + int colorid); void UI_view2d_draw_scale_y__block(const struct ARegion *ar, const struct View2D *v2d, - const struct rcti *rect); -void UI_view2d_draw_scale_x__values(const struct ARegion *ar, - const struct View2D *v2d, - const struct rcti *rect); -void UI_view2d_draw_scale_x__discrete_values(const struct ARegion *ar, - const struct View2D *v2d, - const struct rcti *rect); -void UI_view2d_draw_scale_x__discrete_time(const struct ARegion *ar, - const struct View2D *v2d, - const struct rcti *rect, - const struct Scene *scene); + const struct rcti *rect, + int colorid); void UI_view2d_draw_scale_x__discrete_frames_or_seconds(const struct ARegion *ar, const struct View2D *v2d, const struct rcti *rect, const struct Scene *scene, - bool display_seconds); + bool display_seconds, + int colorid); void UI_view2d_draw_scale_x__frames_or_seconds(const struct ARegion *ar, const struct View2D *v2d, const struct rcti *rect, const struct Scene *scene, - bool display_seconds); + bool display_seconds, + int colorid); /* scrollbar drawing */ View2DScrollers *UI_view2d_scrollers_calc(struct View2D *v2d, const struct rcti *mask_custom); diff --git a/source/blender/editors/interface/view2d_draw.c b/source/blender/editors/interface/view2d_draw.c index 91128e49a60..96ad888274f 100644 --- a/source/blender/editors/interface/view2d_draw.c +++ b/source/blender/editors/interface/view2d_draw.c @@ -258,7 +258,8 @@ static void draw_horizontal_scale_indicators(const ARegion *ar, float distance, const rcti *rect, PositionToString to_string, - void *to_string_data) + void *to_string_data, + int colorid) { GPU_matrix_push_projection(); wmOrtho2_region_pixelspace(ar); @@ -277,7 +278,7 @@ static void draw_horizontal_scale_indicators(const ARegion *ar, } const int font_id = BLF_default(); - UI_FontThemeColor(font_id, TH_TEXT); + UI_FontThemeColor(font_id, colorid); BLF_batch_draw_begin(); @@ -308,7 +309,8 @@ static void draw_vertical_scale_indicators(const ARegion *ar, float display_offset, const rcti *rect, PositionToString to_string, - void *to_string_data) + void *to_string_data, + int colorid) { GPU_matrix_push_projection(); wmOrtho2_region_pixelspace(ar); @@ -327,7 +329,7 @@ static void draw_vertical_scale_indicators(const ARegion *ar, } const int font_id = BLF_default(); - UI_FontThemeColor(font_id, TH_TEXT); + UI_FontThemeColor(font_id, colorid); BLF_enable(font_id, BLF_ROTATION); BLF_rotation(font_id, M_PI_2); @@ -463,51 +465,62 @@ void UI_view2d_draw_lines_x__frames_or_seconds(const View2D *v2d, /* Scale indicator text drawing API **************************************************/ -void UI_view2d_draw_scale_x__discrete_values(const ARegion *ar, - const View2D *v2d, - const rcti *rect) +static void UI_view2d_draw_scale_x__discrete_values(const ARegion *ar, + const View2D *v2d, + const rcti *rect, + int colorid) { float number_step = view2d_major_step_x__discrete(v2d); - draw_horizontal_scale_indicators(ar, v2d, number_step, rect, view_to_string__frame_number, NULL); + draw_horizontal_scale_indicators( + ar, v2d, number_step, rect, view_to_string__frame_number, NULL, colorid); } -void UI_view2d_draw_scale_x__discrete_time(const ARegion *ar, - const View2D *v2d, - const rcti *rect, - const Scene *scene) +static void UI_view2d_draw_scale_x__discrete_time( + const ARegion *ar, const View2D *v2d, const rcti *rect, const Scene *scene, int colorid) { float step = view2d_major_step_x__time(v2d, scene); - draw_horizontal_scale_indicators(ar, v2d, step, rect, view_to_string__time, (void *)scene); + draw_horizontal_scale_indicators( + ar, v2d, step, rect, view_to_string__time, (void *)scene, colorid); } -void UI_view2d_draw_scale_x__values(const ARegion *ar, const View2D *v2d, const rcti *rect) +static void UI_view2d_draw_scale_x__values(const ARegion *ar, + const View2D *v2d, + const rcti *rect, + int colorid) { float step = view2d_major_step_x__continuous(v2d); - draw_horizontal_scale_indicators(ar, v2d, step, rect, view_to_string__value, NULL); + draw_horizontal_scale_indicators(ar, v2d, step, rect, view_to_string__value, NULL, colorid); } -void UI_view2d_draw_scale_y__values(const ARegion *ar, const View2D *v2d, const rcti *rect) +void UI_view2d_draw_scale_y__values(const ARegion *ar, + const View2D *v2d, + const rcti *rect, + int colorid) { float step = view2d_major_step_y__continuous(v2d); - draw_vertical_scale_indicators(ar, v2d, step, 0.0f, rect, view_to_string__value, NULL); + draw_vertical_scale_indicators(ar, v2d, step, 0.0f, rect, view_to_string__value, NULL, colorid); } -void UI_view2d_draw_scale_y__block(const ARegion *ar, const View2D *v2d, const rcti *rect) +void UI_view2d_draw_scale_y__block(const ARegion *ar, + const View2D *v2d, + const rcti *rect, + int colorid) { - draw_vertical_scale_indicators(ar, v2d, 1.0f, 0.5f, rect, view_to_string__value, NULL); + draw_vertical_scale_indicators(ar, v2d, 1.0f, 0.5f, rect, view_to_string__value, NULL, colorid); } void UI_view2d_draw_scale_x__discrete_frames_or_seconds(const struct ARegion *ar, const struct View2D *v2d, const struct rcti *rect, const struct Scene *scene, - bool display_seconds) + bool display_seconds, + int colorid) { if (display_seconds) { - UI_view2d_draw_scale_x__discrete_time(ar, v2d, rect, scene); + UI_view2d_draw_scale_x__discrete_time(ar, v2d, rect, scene, colorid); } else { - UI_view2d_draw_scale_x__discrete_values(ar, v2d, rect); + UI_view2d_draw_scale_x__discrete_values(ar, v2d, rect, colorid); } } @@ -515,12 +528,13 @@ void UI_view2d_draw_scale_x__frames_or_seconds(const struct ARegion *ar, const struct View2D *v2d, const struct rcti *rect, const struct Scene *scene, - bool display_seconds) + bool display_seconds, + int colorid) { if (display_seconds) { - UI_view2d_draw_scale_x__discrete_time(ar, v2d, rect, scene); + UI_view2d_draw_scale_x__discrete_time(ar, v2d, rect, scene, colorid); } else { - UI_view2d_draw_scale_x__values(ar, v2d, rect); + UI_view2d_draw_scale_x__values(ar, v2d, rect, colorid); } } diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c index 843abbd16db..5ac6297e108 100644 --- a/source/blender/editors/space_action/space_action.c +++ b/source/blender/editors/space_action/space_action.c @@ -241,7 +241,7 @@ static void action_main_region_draw(const bContext *C, ARegion *ar) /* frame numbers */ UI_view2d_draw_scale_x__discrete_frames_or_seconds( - ar, v2d, &v2d->hor, scene, saction->flag & SACTION_DRAWTIME); + ar, v2d, &v2d->hor, scene, saction->flag & SACTION_DRAWTIME, TH_TEXT); /* draw current frame number-indicator on top of scrollers */ if ((saction->flag & SACTION_NODRAWCFRANUM) == 0) { diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c index 542f99e49ee..5364c4bc3ca 100644 --- a/source/blender/editors/space_clip/space_clip.c +++ b/source/blender/editors/space_clip/space_clip.c @@ -1048,8 +1048,8 @@ static void graph_region_draw(const bContext *C, ARegion *ar) /* scale indicators */ UI_view2d_draw_scale_x__discrete_frames_or_seconds( - ar, v2d, &v2d->hor, scene, sc->flag & SC_SHOW_SECONDS); - UI_view2d_draw_scale_y__values(ar, v2d, &v2d->vert); + ar, v2d, &v2d->hor, scene, sc->flag & SC_SHOW_SECONDS, TH_TEXT); + UI_view2d_draw_scale_y__values(ar, v2d, &v2d->vert, TH_TEXT); /* current frame indicator */ if (sc->flag & SC_SHOW_SECONDS) { @@ -1100,7 +1100,7 @@ static void dopesheet_region_draw(const bContext *C, ARegion *ar) /* frame numbers */ UI_view2d_draw_scale_x__discrete_frames_or_seconds( - ar, v2d, &v2d->hor, scene, sc->flag & SC_SHOW_SECONDS); + ar, v2d, &v2d->hor, scene, sc->flag & SC_SHOW_SECONDS, TH_TEXT); /* current frame number indicator */ UI_view2d_view_orthoSpecial(ar, v2d, 1); diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index 86d0b961a31..390ea0cf00b 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -316,8 +316,8 @@ static void graph_main_region_draw(const bContext *C, ARegion *ar) UI_view2d_scrollers_free(scrollers); /* scale numbers */ - UI_view2d_draw_scale_x__frames_or_seconds(ar, v2d, &v2d->hor, scene, display_seconds); - UI_view2d_draw_scale_y__values(ar, v2d, &v2d->vert); + UI_view2d_draw_scale_x__frames_or_seconds(ar, v2d, &v2d->hor, scene, display_seconds, TH_TEXT); + UI_view2d_draw_scale_y__values(ar, v2d, &v2d->vert, TH_TEXT); /* draw current frame number-indicator on top of scrollers */ if ((sipo->mode != SIPO_MODE_DRIVERS) && ((sipo->flag & SIPO_NODRAWCFRANUM) == 0)) { diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c index b054f550c6c..ba660945d32 100644 --- a/source/blender/editors/space_nla/space_nla.c +++ b/source/blender/editors/space_nla/space_nla.c @@ -291,7 +291,7 @@ static void nla_main_region_draw(const bContext *C, ARegion *ar) /* frame numbers */ UI_view2d_draw_scale_x__discrete_frames_or_seconds( - ar, v2d, &v2d->hor, scene, snla->flag & SNLA_DRAWTIME); + ar, v2d, &v2d->hor, scene, snla->flag & SNLA_DRAWTIME, TH_TEXT); /* draw current frame number-indicator on top of scrollers */ if ((snla->flag & SNLA_NODRAWCFRANUM) == 0) { diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 90532180392..a3b02407a9e 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -2092,8 +2092,8 @@ void draw_timeline_seq(const bContext *C, ARegion *ar) /* scale numbers */ UI_view2d_draw_scale_x__discrete_frames_or_seconds( - ar, v2d, &v2d->hor, scene, !(sseq->flag & SEQ_DRAWFRAMES)); - UI_view2d_draw_scale_y__block(ar, v2d, &v2d->vert); + ar, v2d, &v2d->hor, scene, !(sseq->flag & SEQ_DRAWFRAMES), TH_TEXT); + UI_view2d_draw_scale_y__block(ar, v2d, &v2d->vert, TH_TEXT); /* draw current frame number-indicator on top of scrollers */ if ((sseq->flag & SEQ_NO_DRAW_CFRANUM) == 0) { -- cgit v1.2.3