aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordam <dam@gudinoff>2024-05-05 15:55:30 +0100
committerdam <dam@gudinoff>2024-05-05 15:55:30 +0100
commitb32a697e1898a37497cfc504a2746dcf1f0710da (patch)
tree323200ad27b36cb80a7697f5bedf31464e0d171b
parent3ae6ce04674daaef4f3bf69adbfe4333402cb423 (diff)
downloadtask-time-tracker-b32a697e1898a37497cfc504a2746dcf1f0710da.tar.zst
task-time-tracker-b32a697e1898a37497cfc504a2746dcf1f0710da.zip
Finished first version of TUI.
-rw-r--r--modules/TUI/module.jai5
-rw-r--r--ttt.jai13
2 files changed, 11 insertions, 7 deletions
diff --git a/modules/TUI/module.jai b/modules/TUI/module.jai
index 27c2fcc..e25672f 100644
--- a/modules/TUI/module.jai
+++ b/modules/TUI/module.jai
@@ -22,7 +22,7 @@
#load "palette_8b.jai";
case 24;
#load "palette_24b.jai";
- _;
+ case;
assert(false, "Invalid COLOR_MODE_BITS. Valid values are 4, 8, or 24 (default).");
}
@@ -165,7 +165,6 @@ Style :: struct {
background = Palette.BLACK;
foreground = Palette.WHITE;
- // TODO Make this work... and now that is implemented... test it.
use_default_background_color := false;
use_default_foreground_color := false;
@@ -216,7 +215,7 @@ set_style :: (style: Style) {
clear_style :: () {
write_string(#run sprint(Commands.SetGraphicsRendition, "0"));
- // TODO Maybe reset context.terminal_style?
+ context.terminal_style = .{ };
}
using_style :: (style: Style) #expand {
diff --git a/ttt.jai b/ttt.jai
index 929a736..3f7ac59 100644
--- a/ttt.jai
+++ b/ttt.jai
@@ -86,6 +86,7 @@ pos_y : int;
style_default := TUI.Style.{
background = TUI.Palette.BLACK,
foreground = TUI.Palette.WHITE,
+ // use_default_background_color = true, TODO
};
style_selected := TUI.Style.{
@@ -97,12 +98,14 @@ style_selected_inverted := TUI.Style.{
background = TUI.Palette.BLACK,
foreground = TUI.Palette.CYAN,
bold = true,
+ // use_default_background_color = true, TODO
};
style_active := TUI.Style.{
background = TUI.Palette.BLACK,
foreground = TUI.Palette.BLUE,
bold = true,
+ // use_default_background_color = true, TODO
};
style_active_selected := TUI.Style.{
@@ -115,6 +118,7 @@ style_error := TUI.Style.{
background = TUI.Palette.BLACK,
foreground = TUI.Palette.RED,
bold = true,
+ // use_default_background_color = true, TODO
};
Layouts :: enum u8 {
@@ -1009,6 +1013,9 @@ draw_tui :: (db: *Database, layout: *Layout) {
else if (task == active_task) {
TUI.set_style(style_active);
}
+ else {
+ TUI.set_style(style_default);
+ }
// Task title.
x += 1;
@@ -1043,10 +1050,8 @@ draw_tui :: (db: *Database, layout: *Layout) {
// Task total.
x += 1;
print_time(y, x, total_time, layout.columns[L_TOTAL_IDX].width);
-
- // Reset theme.
- TUI.clear_style();
}
+ TUI.set_style(style_default);
///////////////////////////////////////////////////////////////////////////
@@ -1099,7 +1104,7 @@ free_memory :: () {
free(app_directory);
free(db_file_path);
free(ar_file_path);
- //reset_temporary_storage();
+ // reset_temporary_storage(); // TODO Not needed... I guess.
}
read_input_string :: (x: int, y: int, input_limit: int, padding: int = 0) -> value: string, success: bool {