summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgonzo <gonzo@toniatuh.com>2023-06-09 22:11:18 +0200
committergonzo <gonzo@toniatuh.com>2023-06-09 22:11:18 +0200
commit959eb72d8271d64a8e64bcbb08a2b1d117607e6c (patch)
treee65f64a5b04ecb395dec7d7172186afc4dbc33ce
parent8816d7cff991b7bbf46fc12dff48fc4f81123a08 (diff)
downloadloan_calc-959eb72d8271d64a8e64bcbb08a2b1d117607e6c.tar.gz
tabify
-rw-r--r--main.c94
1 files changed, 47 insertions, 47 deletions
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);