diff options
| author | Paul Oliver <contact@pauloliver.dev> | 2026-05-30 23:07:06 +0200 |
|---|---|---|
| committer | Paul Oliver <contact@pauloliver.dev> | 2026-06-02 01:58:34 +0200 |
| commit | 8041d3697efb5eddef2c6e693248842ca0139590 (patch) | |
| tree | 5f85a176c0debe2dabab2b52f4b42ac309951567 /core/tui.c | |
| parent | 0df4e501aee0eeaec61217312eddddc077ca53a7 (diff) | |
adds v1 pop charts (wip)python_server_client
Diffstat (limited to 'core/tui.c')
| -rw-r--r-- | core/tui.c | 98 |
1 files changed, 0 insertions, 98 deletions
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); -} - |
