diff options
Diffstat (limited to 'ttt.jai')
| -rw-r--r-- | ttt.jai | 28 |
1 files changed, 9 insertions, 19 deletions
@@ -943,16 +943,6 @@ draw_user_interface :: (db: *Database, layout: *Layout, redraw_all: bool = true) builder := String_Builder.{ allocator = temporary_allocator }; TUI.using_builder_as_output(*builder); - adjust_first_day_of_week := int.[ - (0 + FIRST_DAY_OF_WEEK) % NUM_WEEK_DAYS, - (1 + FIRST_DAY_OF_WEEK) % NUM_WEEK_DAYS, - (2 + FIRST_DAY_OF_WEEK) % NUM_WEEK_DAYS, - (3 + FIRST_DAY_OF_WEEK) % NUM_WEEK_DAYS, - (4 + FIRST_DAY_OF_WEEK) % NUM_WEEK_DAYS, - (5 + FIRST_DAY_OF_WEEK) % NUM_WEEK_DAYS, - (6 + FIRST_DAY_OF_WEEK) % NUM_WEEK_DAYS, - ]; - // Get context information. active_task := get_active_task(db); selected_task := get_selected_task(db); @@ -1052,20 +1042,20 @@ draw_user_interface :: (db: *Database, layout: *Layout, redraw_all: bool = true) // Headers : days for 0..NUM_WEEK_DAYS-1 { - idx := adjust_first_day_of_week[it]; + day_idx := get_day_index_from_layout_index(it); x += 1; // Apply theme. - if (idx == now_week_day && active_task != null) { + if (day_idx == now_week_day && active_task != null) { TUI.set_style(style_active); } - else if (idx == now_week_day) { + else if (day_idx == now_week_day) { TUI.set_style(style_selected_inverted); } else { TUI.set_style(style_default); } - col = *layout.columns[L_DAYS_IDX + idx]; + col = *layout.columns[L_DAYS_IDX + day_idx]; TUI.set_cursor_position(x + col.alignment_offset, y); TUI.tui_write_string(col.header); // TODO append(*builder, col.header); x += col.width; @@ -1162,22 +1152,22 @@ draw_user_interface :: (db: *Database, layout: *Layout, redraw_all: bool = true) x = 1 + 1 + layout.columns[L_TITLE_IDX].width; total_time = 0; for 0..NUM_WEEK_DAYS-1 { - idx := adjust_first_day_of_week[it]; - daily_total := db.total_times[idx]; + day_idx := get_day_index_from_layout_index(it); + daily_total := db.total_times[day_idx]; x += 1; // Apply theme. - if (idx == now_week_day && active_task != null) { + if (day_idx == now_week_day && active_task != null) { TUI.set_style(style_active); } - else if (idx == now_week_day) { + else if (day_idx == now_week_day) { TUI.set_style(style_selected_inverted); } else { TUI.set_style(style_default); } - column_width = layout.columns[L_DAYS_IDX + idx].width; + column_width = layout.columns[L_DAYS_IDX + day_idx].width; total_time = add(total_time, daily_total); print_time(y, x, daily_total, column_width); x += column_width; |
