diff options
| author | gonzo <gonzo@toniatuh.com> | 2023-06-10 14:21:46 +0200 |
|---|---|---|
| committer | gonzo <gonzo@toniatuh.com> | 2023-06-10 14:21:46 +0200 |
| commit | 990e1d65aac6a1c4ddd488ca232edc7ead8e06d9 (patch) | |
| tree | 6e857d861ab350b8e28b097f7946069e3fa56f96 | |
| parent | a267566bf46ae3efaa7ae39f48eac99261d0407b (diff) | |
| download | loan_calc-990e1d65aac6a1c4ddd488ca232edc7ead8e06d9.tar.gz | |
PgUp ang PgDn scrolling
| -rw-r--r-- | main.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -11,6 +11,7 @@ _Noreturn static void finish(int sig); void display_custom_form(FORM *); void print_contract(WINDOW *w, int x, int y, contract *c); int run_sim(FORM *, char **contract_subtypes); +int min(int a, int b); int main() { int ch, i; @@ -122,6 +123,16 @@ int main() { pnoutrefresh(pad, padscroll, 0, 4, 1, HEIGHT-2, WIDTH-1); doupdate(); break; + case KEY_NPAGE: + padscroll += min(HEIGHT - 6, duration - padscroll); + pnoutrefresh(pad, padscroll, 0, 4, 1, HEIGHT-2, WIDTH-1); + doupdate(); + break; + case KEY_PPAGE: + padscroll -= min(HEIGHT - 6, padscroll); + pnoutrefresh(pad, padscroll, 0, 4, 1, HEIGHT-2, WIDTH-1); + doupdate(); + break; case 'q': display_custom_form(form); formactive = TRUE; @@ -203,3 +214,7 @@ int run_sim(FORM *form, char **contract_subtypes) { return 1; } + +int min(int a, int b) { + return (a < b) ? a : b; +} |
