From 959eb72d8271d64a8e64bcbb08a2b1d117607e6c Mon Sep 17 00:00:00 2001 From: gonzo Date: Fri, 9 Jun 2023 22:11:18 +0200 Subject: tabify --- main.c | 94 +++++++++++++++++++++++++++++++++--------------------------------- 1 file changed, 47 insertions(+), 47 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index 64dbdda..c596fed 100644 --- a/main.c +++ b/main.c @@ -50,9 +50,9 @@ int main() { /* configure fields */ for (i = 0; fields[i]; i++) { - set_field_back(fields[i], A_UNDERLINE); /* Print a line for the option */ - field_opts_off(fields[i], O_AUTOSKIP); /* Don't go to next field when this */ - /* Field is filled up */ + set_field_back(fields[i], A_UNDERLINE); /* Print a line for the option */ + field_opts_off(fields[i], O_AUTOSKIP); /* Don't go to next field when this */ + /* Field is filled up */ } /* create form */ @@ -63,29 +63,29 @@ int main() { int formactive = TRUE; /* mainloop */ while ((ch = getch()) != KEY_EXIT) { - if (formactive) { - switch (ch) { - case KEY_DOWN: - /* Go to next field */ - form_driver(form, REQ_NEXT_FIELD); - /* Go to the end of the present buffer */ - /* Leaves nicely at the last character */ - form_driver(form, REQ_END_LINE); - break; - case KEY_UP: + if (formactive) { + switch (ch) { + case KEY_DOWN: + /* Go to next field */ + form_driver(form, REQ_NEXT_FIELD); + /* Go to the end of the present buffer */ + /* Leaves nicely at the last character */ + form_driver(form, REQ_END_LINE); + break; + case KEY_UP: form_driver(form, REQ_PREV_FIELD); form_driver(form, REQ_END_LINE); - break; - case KEY_LEFT: - form_driver(form, REQ_PREV_CHOICE); - break; - case KEY_RIGHT: - form_driver(form, REQ_NEXT_CHOICE); - break; - case KEY_BACKSPACE: - form_driver(form, REQ_DEL_PREV); - break; - case '\r': + break; + case KEY_LEFT: + form_driver(form, REQ_PREV_CHOICE); + break; + case KEY_RIGHT: + form_driver(form, REQ_NEXT_CHOICE); + break; + case KEY_BACKSPACE: + form_driver(form, REQ_DEL_PREV); + break; + case '\r': if (E_OK == form_driver(form, REQ_VALIDATION)) { unpost_form(form); formactive = FALSE; @@ -96,31 +96,31 @@ int main() { padscroll = 0; prefresh(pad, padscroll, 0, 4, 1, HEIGHT-2, WIDTH-1); } - break; - default: - /* If this is a normal character, it gets */ - /* Printed */ - form_driver(form, ch); - } - } else { - switch (ch) { - case KEY_DOWN: + break; + default: + /* If this is a normal character, it gets */ + /* Printed */ + form_driver(form, ch); + } + } else { + switch (ch) { + case KEY_DOWN: padscroll += (padscroll < duration) ? 1 : 0; pnoutrefresh(pad, padscroll, 0, 4, 1, HEIGHT-2, WIDTH-1); - doupdate(); - break; - case KEY_UP: + doupdate(); + break; + case KEY_UP: padscroll -= (padscroll > 0) ? 1 : 0; pnoutrefresh(pad, padscroll, 0, 4, 1, HEIGHT-2, WIDTH-1); - doupdate(); - break; - case 'q': + doupdate(); + break; + case 'q': display_custom_form(form); formactive = TRUE; curs_set(1); - break; - } - } + break; + } + } } delwin(pad); @@ -183,11 +183,11 @@ void run_sim(FORM *form) { mvwprintw(stdscr, 1, 2, "Reinbursement Table"); mvwprintw(stdscr, 3, 3, "%4s/%-4s | %12s | %10s | %10s | %10s\n", - "cur", "tot", - "principal", - "interest", - "part", - "annuity"); + "cur", "tot", + "principal", + "interest", + "part", + "annuity"); /* run simulation */ loan l = loan_init(MORTGAGE, n, d, r, p); -- cgit v1.2.3