From 990e1d65aac6a1c4ddd488ca232edc7ead8e06d9 Mon Sep 17 00:00:00 2001 From: gonzo Date: Sat, 10 Jun 2023 14:21:46 +0200 Subject: PgUp ang PgDn scrolling --- main.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/main.c b/main.c index 58b2b4a..40ecdcb 100644 --- a/main.c +++ b/main.c @@ -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; +} -- cgit v1.2.3