diff options
Diffstat (limited to 'misc/dialog/patches/patch-af')
-rw-r--r-- | misc/dialog/patches/patch-af | 154 |
1 files changed, 150 insertions, 4 deletions
diff --git a/misc/dialog/patches/patch-af b/misc/dialog/patches/patch-af index 2e352e2028a..d842935b116 100644 --- a/misc/dialog/patches/patch-af +++ b/misc/dialog/patches/patch-af @@ -1,14 +1,15 @@ -$NetBSD: patch-af,v 1.2 1998/08/07 11:10:14 agc Exp $ +$NetBSD: patch-af,v 1.3 2000/07/28 20:30:11 jlam Exp $ ---- menubox.c.orig Fri Jan 23 17:37:12 1998 -+++ menubox.c Fri Jan 23 18:15:46 1998 +--- menubox.c.orig Thu Aug 17 22:21:00 1995 ++++ menubox.c Fri Jul 28 15:30:22 2000 @@ -53,12 +53,32 @@ dialog_menu (const char *title, const char *prompt, int height, int width, int menu_height, int item_no, const char * const * items) { - int i, x, y, cur_x, cur_y, box_x, box_y; +- int key = 0, button = 0, choice = 0, scroll = 0, max_choice; + int i, j, x, y, cur_x, cur_y, box_x, box_y; - int key = 0, button = 0, choice = 0, scroll = 0, max_choice; ++ int key = 0, button = 0, choice = 0, d_scroll = 0, max_choice; WINDOW *dialog, *menu; max_choice = MIN (menu_height, item_no); @@ -51,3 +52,148 @@ $NetBSD: patch-af,v 1.2 1998/08/07 11:10:14 agc Exp $ tag_x = (menu_width - tag_x) / 2; item_x = tag_x + item_x + 2; +@@ -146,7 +158,7 @@ + /* Check if key pressed matches first character of any + item tag in menu */ + for (i = 0; i < max_choice; i++) +- if (toupper (key) == toupper (items[(scroll + i) * 2][0])) ++ if (toupper (key) == toupper (items[(d_scroll + i) * 2][0])) + break; + + if (i < max_choice || +@@ -159,33 +171,33 @@ + i = key - M_EVENT; + else if (key == KEY_UP || key == '-') { + if (!choice) { +- if (scroll) { ++ if (d_scroll) { + + /* Scroll menu down */ + getyx (dialog, cur_y, cur_x); + if (menu_height > 1) { + /* De-highlight current first item */ +- print_item (menu, items[scroll * 2], +- items[scroll * 2 + 1], 0, FALSE); ++ print_item (menu, items[d_scroll * 2], ++ items[d_scroll * 2 + 1], 0, FALSE); + scrollok (menu, TRUE); + wscrl (menu, -1); + scrollok (menu, FALSE); + } +- scroll--; +- print_item (menu, items[scroll * 2], +- items[scroll * 2 + 1], 0, TRUE); ++ d_scroll--; ++ print_item (menu, items[d_scroll * 2], ++ items[d_scroll * 2 + 1], 0, TRUE); + wnoutrefresh (menu); + + /* print the up/down arrows */ + wmove (dialog, box_y, box_x + tag_x + 1); +- wattrset (dialog, scroll ? uarrow_attr : menubox_attr); +- waddch (dialog, scroll ? ACS_UARROW : ACS_HLINE); ++ wattrset (dialog, d_scroll ? uarrow_attr : menubox_attr); ++ waddch (dialog, d_scroll ? ACS_UARROW : ACS_HLINE); + wmove (dialog, box_y, box_x + tag_x + 2); +- waddch (dialog, scroll ? '(' : ACS_HLINE); ++ waddch (dialog, d_scroll ? '(' : ACS_HLINE); + wmove (dialog, box_y, box_x + tag_x + 3); +- waddch (dialog, scroll ? '-' : ACS_HLINE); ++ waddch (dialog, d_scroll ? '-' : ACS_HLINE); + wmove (dialog, box_y, box_x + tag_x + 4); +- waddch (dialog, scroll ? ')' : ACS_HLINE); ++ waddch (dialog, d_scroll ? ')' : ACS_HLINE); + wattrset (dialog, darrow_attr); + wmove (dialog, box_y + menu_height + 1, + box_x + tag_x + 1); +@@ -201,21 +213,21 @@ + i = choice - 1; + } else if (key == KEY_DOWN || key == '+') + if (choice == max_choice - 1) { +- if (scroll + choice < item_no - 1) { ++ if (d_scroll + choice < item_no - 1) { + /* Scroll menu up */ + getyx (dialog, cur_y, cur_x); + if (menu_height > 1) { + /* De-highlight current last item */ +- print_item (menu, items[(scroll + max_choice - 1) +- * 2], items[(scroll + max_choice - 1) ++ print_item (menu, items[(d_scroll + max_choice - 1) ++ * 2], items[(d_scroll + max_choice - 1) + * 2 + 1], max_choice - 1, FALSE); + scrollok (menu, TRUE); + scroll (menu); + scrollok (menu, FALSE); + } +- scroll++; +- print_item (menu, items[(scroll + max_choice - 1) * 2], +- items[(scroll + max_choice - 1) * 2 + 1], ++ d_scroll++; ++ print_item (menu, items[(d_scroll + max_choice - 1) * 2], ++ items[(d_scroll + max_choice - 1) * 2 + 1], + max_choice - 1, TRUE); + wnoutrefresh (menu); + +@@ -227,21 +239,21 @@ + waddstr (dialog, "(-)"); + wmove (dialog, box_y + menu_height + 1, + box_x + tag_x + 1); +- wattrset (dialog, scroll + choice < item_no - 1 ? ++ wattrset (dialog, d_scroll + choice < item_no - 1 ? + darrow_attr : menubox_border_attr); +- waddch (dialog, scroll + choice < item_no - 1 ? ++ waddch (dialog, d_scroll + choice < item_no - 1 ? + ACS_DARROW : ACS_HLINE); + wmove (dialog, box_y + menu_height + 1, + box_x + tag_x + 2); +- waddch (dialog, scroll + choice < item_no - 1 ? ++ waddch (dialog, d_scroll + choice < item_no - 1 ? + '(' : ACS_HLINE); + wmove (dialog, box_y + menu_height + 1, + box_x + tag_x + 3); +- waddch (dialog, scroll + choice < item_no - 1 ? ++ waddch (dialog, d_scroll + choice < item_no - 1 ? + '+' : ACS_HLINE); + wmove (dialog, box_y + menu_height + 1, + box_x + tag_x + 4); +- waddch (dialog, scroll + choice < item_no - 1 ? ++ waddch (dialog, d_scroll + choice < item_no - 1 ? + ')' : ACS_HLINE); + wmove (dialog, cur_y, cur_x); + wrefresh (dialog); +@@ -253,13 +265,13 @@ + if (i != choice) { + /* De-highlight current item */ + getyx (dialog, cur_y, cur_x); /* Save cursor position */ +- print_item (menu, items[(scroll + choice) * 2], +- items[(scroll + choice) * 2 + 1], choice, FALSE); ++ print_item (menu, items[(d_scroll + choice) * 2], ++ items[(d_scroll + choice) * 2 + 1], choice, FALSE); + + /* Highlight new item */ + choice = i; +- print_item (menu, items[(scroll + choice) * 2], +- items[(scroll + choice) * 2 + 1], choice, TRUE); ++ print_item (menu, items[(d_scroll + choice) * 2], ++ items[(d_scroll + choice) * 2 + 1], choice, TRUE); + wnoutrefresh (menu); + wmove (dialog, cur_y, cur_x); + wrefresh (dialog); +@@ -271,7 +283,7 @@ + case 'o': + case M_EVENT + 'O': + delwin (dialog); +- return scroll + choice; ++ return d_scroll + choice; + case 'C': + case 'c': + case M_EVENT + 'C': +@@ -297,7 +309,7 @@ + break; + case '\n': + delwin (dialog); +- return (button? -2 : (scroll + choice)); ++ return (button? -2 : (d_scroll + choice)); + case ESC: + break; + } |