From e992322eb25f6677ba0b5a555b56eecbd3f2c3c2 Mon Sep 17 00:00:00 2001 From: zenith Date: Tue, 17 Feb 2026 10:34:36 -0500 Subject: [PATCH] Fix tabs dividing by 4, add HELP and info text below fragmentation --- .gitignore | 3 ++- tnc_ui.hh | 64 ++++++++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 57 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 0e7ba31..5df9537 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -miniaudio.o \ No newline at end of file +miniaudio.o +modem73 \ No newline at end of file diff --git a/tnc_ui.hh b/tnc_ui.hh index 52065bf..f932aef 100644 --- a/tnc_ui.hh +++ b/tnc_ui.hh @@ -1028,15 +1028,17 @@ private: if (event.bstate & BUTTON1_CLICKED || event.bstate & BUTTON1_PRESSED) { // Tab clicks if (event.y == 2) { - int tab_width = (cols - 4) / 4; + int tab_width = (cols - 4) / 5; if (event.x >= 2 && event.x < 2 + tab_width) { current_tab_ = 0; } else if (event.x >= 2 + tab_width && event.x < 2 + tab_width * 2) { current_tab_ = 1; } else if (event.x >= 2 + tab_width * 2 && event.x < 2 + tab_width * 3) { current_tab_ = 2; - } else if (event.x >= 2 + tab_width * 3) { + } else if (event.x >= 2 + tab_width * 3 && event.x < 2 + tab_width * 4) { current_tab_ = 3; + } else if (event.x >= 2 + tab_width * 4) { + current_tab_ = 4; } } @@ -2267,6 +2269,14 @@ private: } row++; + dy = visible_y(row); + if (dy >= 0) { + attron(A_DIM); + mvaddstr(dy, c1, "Both sides must have frag enabled"); + attroff(A_DIM); + } + row++; + dy = visible_y(row); if (dy >= 0) draw_toggle_field(dy, c1, c2, "Enabled", FIELD_FRAGMENTATION, state_.fragmentation_enabled); row += 2; @@ -3239,18 +3249,16 @@ private: } void draw_help(int rows, int cols) { - int help_w = 40; - int help_h = 7; + int help_w = 48; + int help_h = 19; int start_x = (cols - help_w) / 2; int start_y = (rows - help_h) / 2; - attron(COLOR_PAIR(4)); for (int y = start_y; y < start_y + help_h && y < rows; y++) { mvhline(y, start_x, ' ', help_w); } - mvhline(start_y, start_x, ACS_HLINE, help_w); mvhline(start_y + help_h - 1, start_x, ACS_HLINE, help_w); mvvline(start_y, start_x, ACS_VLINE, help_h); @@ -3260,15 +3268,53 @@ private: mvaddch(start_y + help_h - 1, start_x, ACS_LLCORNER); mvaddch(start_y + help_h - 1, start_x + help_w - 1, ACS_LRCORNER); - attron(A_BOLD); mvaddstr(start_y, start_x + 3, " MODEM73 HELP "); attroff(A_BOLD); attroff(COLOR_PAIR(4)); - mvaddstr(start_y + 2, start_x + (help_w - 11) / 2, "---"); + int y = start_y + 2; + int lx = start_x + 2; + int rx = start_x + 22; + + attron(A_BOLD); + mvaddstr(y, lx, "Navigation"); + attroff(A_BOLD); + y++; + mvaddstr(y, lx, "Tab / Shift-Tab"); + mvaddstr(y, rx, "Switch tabs"); + y++; + mvaddstr(y, lx, "Up / Down"); + mvaddstr(y, rx, "Navigate fields"); + y++; + mvaddstr(y, lx, "Left / Right"); + mvaddstr(y, rx, "Adjust values"); + y++; + mvaddstr(y, lx, "Enter"); + mvaddstr(y, rx, "Edit / activate"); + y += 2; + + attron(A_BOLD); + mvaddstr(y, lx, "Config"); + attroff(A_BOLD); + y++; + mvaddstr(y, lx, "s"); + mvaddstr(y, rx, "Save preset"); + y++; + mvaddstr(y, lx, "x"); + mvaddstr(y, rx, "Delete preset"); + y += 2; + + attron(A_BOLD); + mvaddstr(y, lx, "General"); + attroff(A_BOLD); + y++; + mvaddstr(y, lx, "F1"); + mvaddstr(y, rx, "Toggle this help"); + y++; + mvaddstr(y, lx, "Q"); + mvaddstr(y, rx, "Quit"); - attron(A_DIM); mvaddstr(start_y + help_h - 2, start_x + (help_w - 24) / 2, "Press any key to close"); attroff(A_DIM);