From 106bb7fcadf637cec883648916cc8d19529d6199 Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Sat, 23 Nov 2024 22:33:03 +0100 Subject: ui improvements --- src/scenes/place_detail.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'src/scenes/place_detail.c') diff --git a/src/scenes/place_detail.c b/src/scenes/place_detail.c index 699fe0e..707ae0f 100644 --- a/src/scenes/place_detail.c +++ b/src/scenes/place_detail.c @@ -1070,6 +1070,7 @@ static void place_detail_draw_schedule(platform_window* window) s32 ty = TILE_Y(scheduled_time.day); bool is_dragging_current_tile = (dragging_tile && _active_schedule_selected_job_index == i); + bool is_selected = _active_schedule_selected_job_index == i; color tile_color = (_active_schedule_selected_job_index == i) ? COLOR_SCHEDULE_TILE_HOVERED : COLOR_SCHEDULE_TILE_SELECTED; // Handle dragging. @@ -1117,6 +1118,15 @@ static void place_detail_draw_schedule(platform_window* window) } } + // Highlight duration if selected. + else if (is_selected) { + draw_duration_of_scheduled_job_entry(scheduled_time, hour_w, tx, ty, timeslot_w, x, y, timeslot_h, tile_color); + } + // Highlight duration if sharing save employee. + else if (scheduled_time.assignee != 0 && scheduled_time.assignee == _active_scheduling_job.timeslots[_active_schedule_selected_job_index].assignee) { + draw_duration_of_scheduled_job_entry(scheduled_time, hour_w, tx, ty, timeslot_w, x, y, timeslot_h, tile_color); + } + // Draw tile. renderer->render_rectangle(tx, ty, timeslot_w, timeslot_h, tile_color); @@ -1153,6 +1163,10 @@ static void place_detail_draw_schedule(platform_window* window) is_inspecting_employee = true; } + if ((_active_schedule_state == SCHEDULING_JOB || _active_schedule_state == RESCHEDULING_JOB) && scheduled_time.assignee == _active_scheduling_job.timeslots[_active_schedule_selected_job_index].assignee) { + is_inspecting_employee = true; + } + color tc = COLOR_SCHEDULE_TILE_FIXED; if (is_inspecting_employee) { tc = COLOR_SCHEDULE_TILE_HIGHLIGHTED; @@ -1255,10 +1269,10 @@ static void place_detail_draw_schedule(platform_window* window) case 7: strcpy(buf, "Sun"); break; } - s32 tw = renderer->calculate_text_width(fnt, buf); + s32 tw = renderer->calculate_text_width(fnt_rd16, buf); s32 textx = x + (hour_w/2)-(tw/2); - s32 texty = row_y + (timeslot_h/2)-(fnt->px_h/2); - renderer->render_text(fnt, textx, texty, buf, COLOR_TEXT); + s32 texty = row_y + (timeslot_h/2)-(fnt_rd16->px_h/2); + renderer->render_text(fnt_rd16, textx, texty, buf, COLOR_TEXT); } } renderer->render_rectangle(x, row_y, w, 1, COLOR_SCHEDULE_BORDER); @@ -1282,10 +1296,10 @@ static void place_detail_draw_schedule(platform_window* window) char buf[20]; sprintf(buf, "%d:00", WORK_HOUR_START+((tx-1)/TIME_SLOTS_PER_HOUR)); - s32 tw = renderer->calculate_text_width(fnt, buf); + s32 tw = renderer->calculate_text_width(fnt_rd16, buf); s32 textx = row_x + (hour_w/2)-(tw/2); - s32 texty = y + (timeslot_h/2)-(fnt->px_h/2); - renderer->render_text(fnt, textx, texty, buf, COLOR_TEXT); + s32 texty = y + (timeslot_h/2)-(fnt_rd16->px_h/2); + renderer->render_text(fnt_rd16, textx, texty, buf, COLOR_TEXT); } } -- cgit v1.2.3-70-g09d2