From 0a7e9dcdfb50fe5cbd2ce9200504b0f5a6b45360 Mon Sep 17 00:00:00 2001 From: markmental Date: Mon, 30 Mar 2026 13:07:06 -0400 Subject: [PATCH] Make channel banner a full bottom dock to better emulate a broadcast OSD --- src/theme.h | 7 +++++++ src/ui.c | 40 ++++++++++++++++++++++++++-------------- 2 files changed, 33 insertions(+), 14 deletions(-) diff --git a/src/theme.h b/src/theme.h index a37b309..92fbc48 100644 --- a/src/theme.h +++ b/src/theme.h @@ -112,6 +112,7 @@ static const SDL_Color COLOR_PILL_SHADOW = {0x00, 0x00, 0x00, 0x40}; #define GUIDE_INFO_WIDTH 390 #define GUIDE_PREVIEW_WIDTH 240 #define GUIDE_PREVIEW_HEIGHT 135 +#define GUIDE_TOP_SECTION_GAP 14 #define GUIDE_STATUS_HEIGHT 42 #define GUIDE_GRID_TOP 212 #define GUIDE_FOOTER_HEIGHT 54 @@ -119,6 +120,12 @@ static const SDL_Color COLOR_PILL_SHADOW = {0x00, 0x00, 0x00, 0x40}; #define GUIDE_X_START 258 #define GUIDE_INFO_HEIGHT 184 +#define CHANNEL_BANNER_HEIGHT 96 +#define CHANNEL_BANNER_PILL_WIDTH 280 +#define CHANNEL_BANNER_PADDING_X 18 +#define CHANNEL_BANNER_PADDING_Y 14 +#define CHANNEL_BANNER_DIVIDER_GAP 14 + #define GUIDE_THEME_COUNT 10 static const GuideTheme GUIDE_THEMES[GUIDE_THEME_COUNT] = { diff --git a/src/ui.c b/src/ui.c index cefcd5f..2480a54 100644 --- a/src/ui.c +++ b/src/ui.c @@ -664,6 +664,7 @@ static void draw_footer_legend(SDL_Renderer *renderer, blend_color(theme->footer_bottom, theme->footer_mid, 240)); draw_gloss_line(renderer, &footer, color_with_alpha(theme->gloss, 20)); stroke_rect(renderer, &footer, theme->panel_border); + draw_panel_bevel(renderer, &footer, theme->gloss); draw_pill_button(renderer, theme, &chip, theme->panel_fill, theme->panel_border); draw_text_clipped(renderer, fonts->small, "A", &footer, chip.x + 11, chip.y + 2, footer_text); @@ -706,6 +707,9 @@ static void draw_channel_status_banner(SDL_Renderer *renderer, SDL_Rect banner; SDL_Rect channel_pill; SDL_Rect info_clip; + int banner_padding_x; + int banner_padding_y; + int divider_x; SDL_Color banner_text; SDL_Color sub_text; char channel_text[96]; @@ -731,13 +735,18 @@ static void draw_channel_status_banner(SDL_Renderer *renderer, return; } - banner = (SDL_Rect){window_width / 2 - 360, window_height - 92, 720, 64}; - if (banner.x < 24) { - banner.x = 24; - banner.w = window_width - 48; - } - channel_pill = (SDL_Rect){banner.x + 10, banner.y + 10, 210, banner.h - 20}; - info_clip = (SDL_Rect){channel_pill.x + channel_pill.w + 14, banner.y + 8, banner.w - channel_pill.w - 28, banner.h - 16}; + banner_padding_x = CHANNEL_BANNER_PADDING_X; + banner_padding_y = CHANNEL_BANNER_PADDING_Y; + banner = (SDL_Rect){0, window_height - CHANNEL_BANNER_HEIGHT, window_width, CHANNEL_BANNER_HEIGHT}; + channel_pill = (SDL_Rect){banner.x + banner_padding_x, + banner.y + banner_padding_y, + CHANNEL_BANNER_PILL_WIDTH, + banner.h - (banner_padding_y * 2)}; + divider_x = channel_pill.x + channel_pill.w + CHANNEL_BANNER_DIVIDER_GAP; + info_clip = (SDL_Rect){divider_x + CHANNEL_BANNER_DIVIDER_GAP, + banner.y + banner_padding_y, + banner.w - (divider_x + CHANNEL_BANNER_DIVIDER_GAP) - banner_padding_x, + banner.h - (banner_padding_y * 2)}; banner_text = ensure_contrast(theme->ribbon_text, theme->status_mid); sub_text = ensure_contrast(theme->row_subtext, theme->status_mid); @@ -758,6 +767,7 @@ static void draw_channel_status_banner(SDL_Renderer *renderer, color_with_alpha(theme->gloss, 42), theme->panel_border); stroke_rect(renderer, &banner, theme->panel_border); + draw_panel_bevel(renderer, &banner, theme->gloss); if (numeric_input_length > 0 || numeric_input_invalid) { SDL_Color accent_fill = theme->ribbon_mid; @@ -793,23 +803,23 @@ static void draw_channel_status_banner(SDL_Renderer *renderer, set_draw_color(renderer, theme->status_divider); SDL_RenderDrawLine(renderer, - channel_pill.x + channel_pill.w + 6, - banner.y + 10, - channel_pill.x + channel_pill.w + 6, - banner.y + banner.h - 10); + divider_x, + banner.y + banner_padding_y, + divider_x, + banner.y + banner.h - banner_padding_y); draw_text_clipped(renderer, fonts->medium, program->program_title, &info_clip, info_clip.x, - banner.y + 10, + banner.y + 18, banner_text); draw_text_clipped(renderer, fonts->small, time_range, &info_clip, info_clip.x, - banner.y + 36, + banner.y + 52, sub_text); } @@ -949,11 +959,13 @@ void ui_render_guide(SDL_Renderer *renderer, int guide_x_start = (int) (GUIDE_X_START * scale_x); int sidebar_width = (int) (GUIDE_SIDEBAR_WIDTH * scale_x); int mini_status_height = (int) (26 * scale_y); + int top_section_gap = (int) (GUIDE_TOP_SECTION_GAP * scale_y); SDL_Rect full = {0, 0, window_width, window_height}; SDL_Rect info_panel = {0, 0, (int) (GUIDE_INFO_WIDTH * scale_x), (int) (GUIDE_INFO_HEIGHT * scale_y)}; SDL_Rect preview = {window_width - (int) (GUIDE_PREVIEW_WIDTH * scale_x), 0, (int) (GUIDE_PREVIEW_WIDTH * scale_x), (int) (GUIDE_PREVIEW_HEIGHT * scale_y)}; int mini_status_y = preview.y + preview.h; - int timeline_header_y = mini_status_y + mini_status_height; + int top_section_bottom = SDL_max(info_panel.y + info_panel.h, mini_status_y + mini_status_height); + int timeline_header_y = top_section_bottom + top_section_gap; int grid_y = timeline_header_y + (int) (GUIDE_STATUS_HEIGHT * scale_y); SDL_Rect mini_status_bar = {preview.x, mini_status_y, preview.w, mini_status_height}; SDL_Rect header_row = {0, timeline_header_y, window_width, (int) (GUIDE_STATUS_HEIGHT * scale_y)};