From 8041d3697efb5eddef2c6e693248842ca0139590 Mon Sep 17 00:00:00 2001 From: Paul Oliver Date: Sat, 30 May 2026 23:07:06 +0200 Subject: adds v1 pop charts (wip) --- core/tui.c | 98 -------------------------------------------------------------- 1 file changed, 98 deletions(-) delete mode 100644 core/tui.c (limited to 'core/tui.c') diff --git a/core/tui.c b/core/tui.c deleted file mode 100644 index 4fc2ce4..0000000 --- a/core/tui.c +++ /dev/null @@ -1,98 +0,0 @@ -#define PANE_WIDTH 27 -#define PANE_AND_MARGIN_WIDTH (PANE_WIDTH + 2) - -enum { - PAIR_NORMAL = 0, -}; - -char *g_line_buff; - -void tui_line_buff_free(void) { - if (g_line_buff) { - free(g_line_buff); - } - - g_line_buff = NULL; -} - -void tui_line_buff_resize(void) { - tui_line_buff_free(); - - g_line_buff = calloc(COLS + 1, sizeof(char)); -} - -void tui_line(bool clear, int line, int color, int attr, const char *format, ...) { - assert(line >= 0); - assert(format); - - if (line >= LINES) { - return; - } - - if (clear) { - move(line, 0); - clrtoeol(); - } - - va_list args; - - attron(COLOR_PAIR(color) | attr); - va_start(args, format); - - vsnprintf(g_line_buff, COLS, format, args); - mvprintw(line, 1, "%s", g_line_buff); - - va_end(args); - attroff(COLOR_PAIR(color) | attr); -} - -void tui_clear_line(int l) { - tui_line(true, l, PAIR_NORMAL, A_NORMAL, ""); -} - -void tui_field(int line, int col, int color, int attr, const char *format, ...) { - assert(line >= 0); - assert(col >= 0); - assert(format); - - if (line >= LINES || col >= COLS) { - return; - } - - va_list args; - - attron(COLOR_PAIR(color) | attr); - va_start(args, format); - - vsnprintf(g_line_buff, COLS - col, format, args); - mvprintw(line, col, "%s", g_line_buff); - - va_end(args); - attroff(COLOR_PAIR(color) | attr); -} - -void tui_str_field(int l, const char *label, const char *value) { - assert(label); - assert(strlen(label) <= 4); - assert(value); - tui_line(false, l, PAIR_NORMAL, A_NORMAL, "%-4s : %18s", label, value); -} - -void tui_ulx_field(int l, const char *label, uint64_t value) { - assert(label); - assert(strlen(label) <= 4); - tui_line(false, l, PAIR_NORMAL, A_NORMAL, "%-4s : %#18lx", label, value); -} - -void tui_uld_field(int l, const char *label, uint64_t value) { - assert(label); - assert(strlen(label) <= 4); - tui_line(false, l, PAIR_NORMAL, A_NORMAL, "%-4s : %#18ld", label, value); -} - -void tui_float_field(int l, const char *label, float value) { - assert(label); - assert(strlen(label) <= 4); - tui_line(false, l, PAIR_NORMAL, A_NORMAL, "%-4s : %18.1f", label, value); -} - -- cgit v1.3