aboutsummaryrefslogtreecommitdiff
path: root/ttt.jai
diff options
context:
space:
mode:
authordam <dam@gudinoff>2024-04-06 02:31:50 +0100
committerdam <dam@gudinoff>2024-04-06 02:31:50 +0100
commit8016c5c04e3d452dab583b2c9c2161a5a950ea65 (patch)
treefb312ad931d94bf92a8c7759058ea82207245742 /ttt.jai
parentc8fb1f06ec6f83fc71c2f68bb2fc337e971e25b9 (diff)
downloadtask-time-tracker-8016c5c04e3d452dab583b2c9c2161a5a950ea65.tar.zst
task-time-tracker-8016c5c04e3d452dab583b2c9c2161a5a950ea65.zip
Code cleanup.
Diffstat (limited to 'ttt.jai')
-rw-r--r--ttt.jai45
1 files changed, 19 insertions, 26 deletions
diff --git a/ttt.jai b/ttt.jai
index 517723d..9fa62d3 100644
--- a/ttt.jai
+++ b/ttt.jai
@@ -27,15 +27,6 @@
#import "Integer_Saturating_Arithmetic";
TUI :: #import "TUI"(COLOR_BIT_DEPTH=8);
-
-// TODO List:
-// [ ] Every time we add or remove tasks to the database, it may be reallocated, thus making the selected_task and active_task pointers invalid. Check if this is messing up the app.
-stdscr: *void; // TODO DAM
-A_BOLD: s32 = 0; // TODO DAM
-COLOR_PAIR :: (a: s32) -> s32 { return 0; } // TODO DAM
-WINDOW :: struct { } // TODO DAM
-
-
VERSION :: "2.0"; // Use only 3 chars (to fit layouts).
YEAR :: "2024";
FIRST_DAY_OF_WEEK :: 1; // (0-6, Sunday = 0).
@@ -123,35 +114,36 @@ Layouts :: enum u8 {
COMPACT;
}
-error_window : *WINDOW = null;
+// TODO NEXT Implement error window!
+
error_time_limit := Apollo_Time.{0, 0};
print_error :: (format :string, args : .. Any) {
- if stdscr == null { // || isendwin() == true { // Not in ncurses mode? TODO DAM
- print(format, ..args);
- print("\n");
- }
- else {
- CHAR_SPACE :: #char " ";
- w_size_x: int = ifx size_x > 120 then 120 else size_x - 2;
- w_size_y: int = 4;
- if (error_window == null) {
+ // if stdscr == null { // || isendwin() == true { // Not in ncurses mode? TODO DAM
+ // print(format, ..args);
+ // print("\n");
+ // }
+ // else {
+ // CHAR_SPACE :: #char " ";
+ // w_size_x: int = ifx size_x > 120 then 120 else size_x - 2;
+ // w_size_y: int = 4;
+ // if (error_window == null) {
//error_window = newwin(w_size_y, w_size_x, (size_y - w_size_y) / 2, (size_x - w_size_x) / 2); TODO DAM
//wattron(error_window, COLOR_PAIR(xx Styles.ERROR)); TODO DAM
//wborder(error_window, CHAR_SPACE, CHAR_SPACE, 0, 0, ACS_HLINE, ACS_HLINE, ACS_HLINE, ACS_HLINE); TODO DAM
//mvwprintw(error_window, 0, 1, " Error "); TODO DAM
//wmove(error_window, 1, 0); TODO DAM
- }
- else {
+ // }
+ // else {
//waddch(error_window, CHAR_SPACE); TODO DAM
- }
+ // }
//wprintw(error_window, temp_c_string(tprint(format, args))); TODO DAM
- error_time_limit = current_time_monotonic() + seconds_to_apollo(5);
- }
+ // error_time_limit = current_time_monotonic() + seconds_to_apollo(5);
+ // }
}
draw_error_window :: () {
- if (error_window == null) return;
+ // if (error_window == null) return;
// Hide error window after time-limit or if terminal is shrank.
w_size_x: s32;
@@ -162,7 +154,7 @@ draw_error_window :: () {
|| size_y - w_size_y < 2
) {
//delwin(error_window); TODO DAM
- error_window = null;
+ // error_window = null;
return;
}
@@ -1673,6 +1665,7 @@ main :: () {
//timeout(INPUT_AWAIT_INF); TODO DAM
// TODO WIP Remove `selected_task` and `active_task` and helper functions.
+ // TODO Every time we add or remove tasks to the database, it may be reallocated, thus making the selected_task and active_task pointers invalid. Check if this is messing up the app.
selected_task := get_selected_task(db);
active_task := get_active_task(db);
selected_task_row: int;