Cleaner status bar layout
This commit is contained in:
parent
0608d50684
commit
150359e8a0
4 changed files with 30 additions and 25 deletions
BIN
src/app.o
BIN
src/app.o
Binary file not shown.
BIN
src/main.o
BIN
src/main.o
Binary file not shown.
55
src/ui.c
55
src/ui.c
|
|
@ -467,14 +467,13 @@ static void draw_timeline_header_cached(SDL_Renderer *renderer,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void draw_status_bar(SDL_Renderer *renderer,
|
static void draw_mini_status_bar(SDL_Renderer *renderer,
|
||||||
TTF_Font *font,
|
TTF_Font *font,
|
||||||
const GuideTheme *theme,
|
const GuideTheme *theme,
|
||||||
const Channel *selected_channel,
|
const Channel *selected_channel,
|
||||||
const SDL_Rect *rect,
|
const SDL_Rect *rect,
|
||||||
time_t now_wall) {
|
time_t now_wall) {
|
||||||
char clock_text[32];
|
char status_text[256];
|
||||||
char channel_text[160];
|
|
||||||
SDL_Color text_color;
|
SDL_Color text_color;
|
||||||
|
|
||||||
if (!rect) {
|
if (!rect) {
|
||||||
|
|
@ -483,22 +482,24 @@ static void draw_status_bar(SDL_Renderer *renderer,
|
||||||
|
|
||||||
text_color = readable_text_color(theme->status_mid);
|
text_color = readable_text_color(theme->status_mid);
|
||||||
|
|
||||||
draw_beveled_bar(renderer,
|
fill_three_stop_gradient(renderer,
|
||||||
rect,
|
rect,
|
||||||
blend_color(theme->status_top, theme->status_mid, 220),
|
blend_color(theme->status_top, theme->status_mid, 220),
|
||||||
theme->status_mid,
|
theme->status_mid,
|
||||||
blend_color(theme->status_bottom, theme->status_mid, 220),
|
blend_color(theme->status_bottom, theme->status_mid, 220));
|
||||||
color_with_alpha(theme->gloss, 36),
|
stroke_rect(renderer, rect, theme->panel_border);
|
||||||
theme->panel_border);
|
|
||||||
format_time_compact(clock_text, sizeof(clock_text), now_wall);
|
|
||||||
draw_text_clipped(renderer, font, clock_text, rect, rect->x + 12, rect->y + 10, text_color);
|
|
||||||
set_draw_color(renderer, theme->status_divider);
|
|
||||||
SDL_RenderDrawLine(renderer, rect->x + rect->w / 2, rect->y + 8, rect->x + rect->w / 2, rect->y + rect->h - 8);
|
|
||||||
|
|
||||||
if (selected_channel) {
|
if (selected_channel) {
|
||||||
snprintf(channel_text, sizeof(channel_text), "%s %d", selected_channel->name, selected_channel->number);
|
char clock_text[32];
|
||||||
draw_text_clipped(renderer, font, channel_text, rect, rect->x + rect->w - 260, rect->y + 10, text_color);
|
format_time_compact(clock_text, sizeof(clock_text), now_wall);
|
||||||
|
snprintf(status_text, sizeof(status_text), "Time %s | Channel %s %d", clock_text, selected_channel->name, selected_channel->number);
|
||||||
|
} else {
|
||||||
|
char clock_text[32];
|
||||||
|
format_time_compact(clock_text, sizeof(clock_text), now_wall);
|
||||||
|
snprintf(status_text, sizeof(status_text), "Time %s", clock_text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
draw_text_clipped(renderer, font, status_text, rect, rect->x + 10, rect->y + 4, text_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void draw_info_panel(SDL_Renderer *renderer,
|
static void draw_info_panel(SDL_Renderer *renderer,
|
||||||
|
|
@ -847,12 +848,16 @@ void ui_render_guide(SDL_Renderer *renderer,
|
||||||
double scale_y = (double) window_height / WINDOW_HEIGHT;
|
double scale_y = (double) window_height / WINDOW_HEIGHT;
|
||||||
int guide_x_start = (int) (GUIDE_X_START * scale_x);
|
int guide_x_start = (int) (GUIDE_X_START * scale_x);
|
||||||
int sidebar_width = (int) (GUIDE_SIDEBAR_WIDTH * scale_x);
|
int sidebar_width = (int) (GUIDE_SIDEBAR_WIDTH * scale_x);
|
||||||
|
int mini_status_height = (int) (26 * scale_y);
|
||||||
SDL_Rect full = {0, 0, window_width, window_height};
|
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 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)};
|
SDL_Rect preview = {window_width - (int) (GUIDE_PREVIEW_WIDTH * scale_x), 0, (int) (GUIDE_PREVIEW_WIDTH * scale_x), (int) (GUIDE_PREVIEW_HEIGHT * scale_y)};
|
||||||
SDL_Rect status_bar = {info_panel.w, 0, window_width - info_panel.w, (int) (GUIDE_STATUS_HEIGHT * scale_y)};
|
int mini_status_y = preview.y + preview.h;
|
||||||
SDL_Rect header_row = {0, (int) ((GUIDE_GRID_TOP - GUIDE_STATUS_HEIGHT) * scale_y), window_width, (int) (GUIDE_STATUS_HEIGHT * scale_y)};
|
int timeline_header_y = mini_status_y + mini_status_height;
|
||||||
SDL_Rect grid = {0, (int) (GUIDE_GRID_TOP * scale_y), window_width, window_height - (int) (GUIDE_GRID_TOP * scale_y) - (int) (GUIDE_FOOTER_HEIGHT * scale_y)};
|
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)};
|
||||||
|
SDL_Rect grid = {0, grid_y, window_width, window_height - grid_y - (int) (GUIDE_FOOTER_HEIGHT * scale_y)};
|
||||||
int row_height = grid.h / GUIDE_VISIBLE_ROWS;
|
int row_height = grid.h / GUIDE_VISIBLE_ROWS;
|
||||||
int timeline_w = window_width - guide_x_start - (int) (20 * scale_x);
|
int timeline_w = window_width - guide_x_start - (int) (20 * scale_x);
|
||||||
int start_index = active_channel - 2;
|
int start_index = active_channel - 2;
|
||||||
|
|
@ -877,7 +882,7 @@ void ui_render_guide(SDL_Renderer *renderer,
|
||||||
draw_panel_shadow(renderer, &preview);
|
draw_panel_shadow(renderer, &preview);
|
||||||
fill_rect(renderer, &preview, COLOR_BLACK);
|
fill_rect(renderer, &preview, COLOR_BLACK);
|
||||||
draw_video(renderer, video_texture, texture_width, texture_height, preview);
|
draw_video(renderer, video_texture, texture_width, texture_height, preview);
|
||||||
draw_status_bar(renderer, fonts->medium, theme, selected_channel, &status_bar, now_wall);
|
draw_mini_status_bar(renderer, fonts->small, theme, selected_channel, &mini_status_bar, now_wall);
|
||||||
|
|
||||||
if (cache->timeline_label_slot != guide_view_start_time / 60 || cache->timeline_theme != theme) {
|
if (cache->timeline_label_slot != guide_view_start_time / 60 || cache->timeline_theme != theme) {
|
||||||
char label[32];
|
char label[32];
|
||||||
|
|
|
||||||
BIN
src/ui.o
BIN
src/ui.o
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue