From 85b74d68b3c89fac4597ba0518aabe10ff8ad43b Mon Sep 17 00:00:00 2001 From: jlam Date: Fri, 28 Jul 2000 20:30:08 +0000 Subject: Make use of new USE_CURSES functionality. --- misc/dialog/Makefile | 13 ++-- misc/dialog/files/patch-sum | 14 ++-- misc/dialog/patches/patch-aa | 20 +++-- misc/dialog/patches/patch-ab | 179 +++++++++++++++++++++++++++++++++++++++++-- misc/dialog/patches/patch-ac | 8 +- misc/dialog/patches/patch-ae | 77 +++++++++++++++++-- misc/dialog/patches/patch-af | 154 ++++++++++++++++++++++++++++++++++++- misc/dialog/patches/patch-ah | 61 ++++++++++++++- 8 files changed, 484 insertions(+), 42 deletions(-) (limited to 'misc/dialog') diff --git a/misc/dialog/Makefile b/misc/dialog/Makefile index 2f79daf23cb..ad1a6591ef9 100644 --- a/misc/dialog/Makefile +++ b/misc/dialog/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.5 2000/01/15 18:46:30 jlam Exp $ +# $NetBSD: Makefile,v 1.6 2000/07/28 20:30:08 jlam Exp $ # DISTNAME= dialog-0.6z @@ -7,10 +7,9 @@ MASTER_SITES= ${MASTER_SITE_SUNSITE:=utils/shell/} MAINTAINER= jlam@netbsd.org -DEPENDS+= ncurses>=4.2:../../devel/ncurses - -NO_CONFIGURE= yes -USE_GMAKE= yes +NO_CONFIGURE= # defined +USE_GMAKE= # defined +USE_CURSES= # defined post-install: ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/dialog @@ -23,3 +22,7 @@ post-install: .endfor .include "../../mk/bsd.pkg.mk" + +.if defined(NEED_NCURSES) && ${NEED_NCURSES} == "YES" +MAKE_ENV+= HAVE_TRUE_NCURSES=true +.endif diff --git a/misc/dialog/files/patch-sum b/misc/dialog/files/patch-sum index 72ffc9648c6..5ee1c265152 100644 --- a/misc/dialog/files/patch-sum +++ b/misc/dialog/files/patch-sum @@ -1,13 +1,13 @@ -$NetBSD: patch-sum,v 1.2 2000/01/04 17:19:09 bouyer Exp $ +$NetBSD: patch-sum,v 1.3 2000/07/28 20:30:11 jlam Exp $ -MD5 (patch-aa) = 930f24cc3c933b9e6a988d9d1f6bd9d3 -MD5 (patch-ab) = a060eb804e27c093f01ba1f3b3d4a37d -MD5 (patch-ac) = ca248e0907ac1fff30b1d8b1efe13fd3 +MD5 (patch-aa) = 2c2993275644c1d8d2f9c17728390772 +MD5 (patch-ab) = a6e4b6347dd3c99599e4ac105fe18c0c +MD5 (patch-ac) = 021f89a83b9b9bfe9f3eda9642692a34 MD5 (patch-ad) = f300af373e3eaa1bf725482ee4aee725 -MD5 (patch-ae) = 7292f5a5ba47ef3d2dfae96191f93252 -MD5 (patch-af) = 2dc3b5970913a732eb8bf1b15662935d +MD5 (patch-ae) = 92565660ae9f15aa02c55d36a77ef035 +MD5 (patch-af) = 8977954a03cef19d316549f581b031ca MD5 (patch-ag) = 3e2db5d0d16bfe6655d6a5037fc1d9e2 -MD5 (patch-ah) = c0fc78c04dd86eda76515913eeb2101b +MD5 (patch-ah) = aee45aae596bf0ad870d5cf561f42fbb MD5 (patch-ai) = acf7bbd5ff4e5aedf5d66e80cef94e2d MD5 (patch-aj) = 01c3e7c1c3fe02ac601ec78e863f3359 MD5 (patch-ak) = a6f665307aa3984c1d87e7d182d511a4 diff --git a/misc/dialog/patches/patch-aa b/misc/dialog/patches/patch-aa index e32f57a577f..2608a3eafcb 100644 --- a/misc/dialog/patches/patch-aa +++ b/misc/dialog/patches/patch-aa @@ -1,7 +1,7 @@ -$NetBSD: patch-aa,v 1.5 1999/07/06 08:04:15 jlam Exp $ +$NetBSD: patch-aa,v 1.6 2000/07/28 20:30:11 jlam Exp $ --- Makefile.orig Thu Jan 9 01:19:34 1997 -+++ Makefile Fri Jul 2 08:27:09 1999 ++++ Makefile Fri Jul 28 15:30:22 2000 @@ -17,8 +17,8 @@ # can be disabled to make dialog a bit smaller (could be done for more things) HAVE_GUAGE=true @@ -22,16 +22,22 @@ $NetBSD: patch-aa,v 1.5 1999/07/06 08:04:15 jlam Exp $ LDLIBS = -ldialog OBJS = checklist.o inputbox.o menubox.o msgbox.o \ -@@ -42,7 +42,7 @@ +@@ -42,8 +42,13 @@ OBJS+=mouse.o endif ifeq ($(HAVE_NCURSES), true) -CFLAGS+=-DHAVE_NCURSES -I/usr/include/ncurses -+CFLAGS+=-DHAVE_NCURSES -I${LOCALBASE}/include ++CFLAGS+=-DHAVE_NCURSES ++endif ++ifeq ($(HAVE_TRUE_NCURSES), true) ++CFLAGS+=-DHAVE_TRUE_NCURSES -I${LOCALBASE}/include LDLIBS+=-lncurses ++else ++LDLIBS+=-lcurses endif ifeq ($(HAVE_RC_FILE), true) -@@ -59,7 +59,7 @@ + CFLAGS+=-DHAVE_RC_FILE +@@ -59,7 +64,7 @@ all: libdialog.a dialog libdialog.a: $(OBJS) @@ -40,7 +46,7 @@ $NetBSD: patch-aa,v 1.5 1999/07/06 08:04:15 jlam Exp $ dialog: dialog.o -@@ -70,7 +70,7 @@ +@@ -70,7 +75,7 @@ include .depend install: dialog libdialog.a @@ -49,7 +55,7 @@ $NetBSD: patch-aa,v 1.5 1999/07/06 08:04:15 jlam Exp $ cp dialog.man dialog.1 ifeq ($(HAVE_RC_FILE),false) mv dialog.1 dialog.in -@@ -82,7 +82,7 @@ +@@ -82,7 +87,7 @@ endif mv dialog.1 dialog.in sed -e "/COMMENTSTART/,/COMMENTEND/d" dialog.in >dialog.1 diff --git a/misc/dialog/patches/patch-ab b/misc/dialog/patches/patch-ab index ec3b2bdb191..687a222b808 100644 --- a/misc/dialog/patches/patch-ab +++ b/misc/dialog/patches/patch-ab @@ -1,16 +1,18 @@ -$NetBSD: patch-ab,v 1.2 1998/08/07 11:10:13 agc Exp $ +$NetBSD: patch-ab,v 1.3 2000/07/28 20:30:11 jlam Exp $ ---- checklist.c.orig Fri Jan 23 17:37:12 1998 -+++ checklist.c Fri Jan 23 18:15:04 1998 -@@ -64,7 +64,7 @@ +--- checklist.c.orig Thu Aug 17 19:36:06 1995 ++++ checklist.c Fri Jul 28 15:30:22 2000 +@@ -64,8 +64,8 @@ int list_height, int item_no, const char * const * items, int flag, int separate_output) { - int i, x, y, cur_x, cur_y, box_x, box_y; +- int key = 0, button = 0, choice = 0, scroll = 0, max_choice, *status; + int i, j, x, y, cur_x, cur_y, box_x, box_y; - int key = 0, button = 0, choice = 0, scroll = 0, max_choice, *status; ++ int key = 0, button = 0, choice = 0, d_scroll = 0, max_choice, *status; WINDOW *dialog, *list; + checkflag = flag; @@ -83,6 +83,26 @@ max_choice = MIN (list_height, item_no); @@ -53,3 +55,170 @@ $NetBSD: patch-ab,v 1.2 1998/08/07 11:10:13 agc Exp $ check_x = (list_width - check_x) / 2; item_x = check_x + item_x + 6; +@@ -171,7 +183,7 @@ + any item tag in list */ + for (i = 0; i < max_choice; i++) + if (toupper (key) == +- toupper (items[(scroll + i) * 3][0])) ++ toupper (items[(d_scroll + i) * 3][0])) + break; + + if (i < max_choice || +@@ -183,35 +195,35 @@ + i = key - '1'; + else if (key == KEY_UP || key == '-') { + if (!choice) { +- if (!scroll) ++ if (!d_scroll) + continue; + /* Scroll list down */ + getyx (dialog, cur_y, cur_x); + if (list_height > 1) { + /* De-highlight current first item */ +- print_item (list, items[scroll * 3], +- items[scroll * 3 + 1], status[scroll], ++ print_item (list, items[d_scroll * 3], ++ items[d_scroll * 3 + 1], status[d_scroll], + 0, FALSE); + scrollok (list, TRUE); + wscrl (list, -1); + scrollok (list, FALSE); + } +- scroll--; +- print_item (list, items[scroll * 3], +- items[scroll * 3 + 1], +- status[scroll], 0, TRUE); ++ d_scroll--; ++ print_item (list, items[d_scroll * 3], ++ items[d_scroll * 3 + 1], ++ status[d_scroll], 0, TRUE); + wnoutrefresh (list); + + /* print the up/down arrows */ + wmove (dialog, box_y, box_x + check_x + 5); +- 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 + check_x + 6); +- waddch (dialog, scroll ? '(' : ACS_HLINE); ++ waddch (dialog, d_scroll ? '(' : ACS_HLINE); + wmove (dialog, box_y, box_x + check_x + 7); +- waddch (dialog, scroll ? '-' : ACS_HLINE); ++ waddch (dialog, d_scroll ? '-' : ACS_HLINE); + wmove (dialog, box_y, box_x + check_x + 8); +- waddch (dialog, scroll ? ')' : ACS_HLINE); ++ waddch (dialog, d_scroll ? ')' : ACS_HLINE); + wattrset (dialog, darrow_attr); + wmove (dialog, box_y + list_height + 1, + box_x + check_x + 5); +@@ -232,24 +244,24 @@ + 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) + continue; + /* Scroll list up */ + getyx (dialog, cur_y, cur_x); + if (list_height > 1) { + /* De-highlight current last item before scrolling up */ +- print_item (list, items[(scroll + max_choice - 1) * 3], +- items[(scroll + max_choice - 1) * 3 + 1], +- status[scroll + max_choice - 1], ++ print_item (list, items[(d_scroll + max_choice - 1) * 3], ++ items[(d_scroll + max_choice - 1) * 3 + 1], ++ status[d_scroll + max_choice - 1], + max_choice - 1, FALSE); + scrollok (list, TRUE); + scroll (list); + scrollok (list, FALSE); + } +- scroll++; +- print_item (list, items[(scroll + max_choice - 1) * 3], +- items[(scroll + max_choice - 1) * 3 + 1], +- status[scroll + max_choice - 1], ++ d_scroll++; ++ print_item (list, items[(d_scroll + max_choice - 1) * 3], ++ items[(d_scroll + max_choice - 1) * 3 + 1], ++ status[d_scroll + max_choice - 1], + max_choice - 1, TRUE); + wnoutrefresh (list); + +@@ -261,21 +273,21 @@ + waddstr (dialog, "(-)"); + wmove (dialog, box_y + list_height + 1, + box_x + check_x + 5); +- 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 + list_height + 1, + box_x + check_x + 6); +- waddch (dialog, scroll + choice < item_no - 1 ? ++ waddch (dialog, d_scroll + choice < item_no - 1 ? + '(' : ACS_HLINE); + wmove (dialog, box_y + list_height + 1, + box_x + check_x + 7); +- waddch (dialog, scroll + choice < item_no - 1 ? ++ waddch (dialog, d_scroll + choice < item_no - 1 ? + '+' : ACS_HLINE); + wmove (dialog, box_y + list_height + 1, + box_x + check_x + 8); +- 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); +@@ -284,21 +296,21 @@ + i = choice + 1; + } else if (key == ' ') { /* Toggle item status */ + if (flag == FLAG_CHECK) { +- status[scroll + choice] = !status[scroll + choice]; ++ status[d_scroll + choice] = !status[d_scroll + choice]; + getyx (dialog, cur_y, cur_x); + wmove (list, choice, check_x); + wattrset (list, check_selected_attr); +- wprintw (list, "[%c]", status[scroll + choice] ? 'X' : ' '); ++ wprintw (list, "[%c]", status[d_scroll + choice] ? 'X' : ' '); + } else { +- if (!status[scroll + choice]) { ++ if (!status[d_scroll + choice]) { + for (i = 0; i < item_no; i++) + status[i] = 0; +- status[scroll + choice] = 1; ++ status[d_scroll + choice] = 1; + getyx (dialog, cur_y, cur_x); + for (i = 0; i < max_choice; i++) +- print_item (list, items[(scroll + i) * 3], +- items[(scroll + i) * 3 + 1], +- status[scroll + i], i, i == choice); ++ print_item (list, items[(d_scroll + i) * 3], ++ items[(d_scroll + i) * 3 + 1], ++ status[d_scroll + i], i, i == choice); + } + } + wnoutrefresh (list); +@@ -309,14 +321,14 @@ + if (i != choice) { + /* De-highlight current item */ + getyx (dialog, cur_y, cur_x); +- print_item (list, items[(scroll + choice) * 3], +- items[(scroll + choice) * 3 + 1], +- status[scroll + choice], choice, FALSE); ++ print_item (list, items[(d_scroll + choice) * 3], ++ items[(d_scroll + choice) * 3 + 1], ++ status[d_scroll + choice], choice, FALSE); + /* Highlight new item */ + choice = i; +- print_item (list, items[(scroll + choice) * 3], +- items[(scroll + choice) * 3 + 1], +- status[scroll + choice], choice, TRUE); ++ print_item (list, items[(d_scroll + choice) * 3], ++ items[(d_scroll + choice) * 3 + 1], ++ status[d_scroll + choice], choice, TRUE); + wnoutrefresh (list); + wmove (dialog, cur_y, cur_x); + wrefresh (dialog); diff --git a/misc/dialog/patches/patch-ac b/misc/dialog/patches/patch-ac index e4a0f02191c..de3b4893e1a 100644 --- a/misc/dialog/patches/patch-ac +++ b/misc/dialog/patches/patch-ac @@ -1,12 +1,12 @@ -$NetBSD: patch-ac,v 1.4 2000/01/04 17:19:11 bouyer Exp $ +$NetBSD: patch-ac,v 1.5 2000/07/28 20:30:11 jlam Exp $ ---- dialog.h.orig Fri Jan 23 17:37:12 1998 -+++ dialog.h Fri Jan 23 18:14:38 1998 +--- dialog.h.orig Fri Aug 18 07:35:06 1995 ++++ dialog.h Fri Jul 28 15:30:22 2000 @@ -28,8 +28,12 @@ #ifdef ultrix #include #else -+#if defined(HAVE_NCURSES) ++#if defined(HAVE_TRUE_NCURSES) +#include +#else #include diff --git a/misc/dialog/patches/patch-ae b/misc/dialog/patches/patch-ae index e5d116ffffc..19a8f8ab9a8 100644 --- a/misc/dialog/patches/patch-ae +++ b/misc/dialog/patches/patch-ae @@ -1,17 +1,18 @@ -$NetBSD: patch-ae,v 1.2 1998/08/07 11:10:14 agc Exp $ +$NetBSD: patch-ae,v 1.3 2000/07/28 20:30:11 jlam Exp $ ---- inputbox.c.orig Fri Jan 23 17:37:12 1998 -+++ inputbox.c Fri Jan 23 18:15:24 1998 -@@ -29,10 +29,20 @@ +--- inputbox.c.orig Fri Aug 18 07:39:51 1995 ++++ inputbox.c Fri Jul 28 15:30:22 2000 +@@ -29,11 +29,21 @@ dialog_inputbox (const char *title, const char *prompt, int height, int width, const char *init) { - int i, x, y, box_y, box_x, box_width; +- int input_x = 0, scroll = 0, key = 0, button = -1; + int i, j, x, y, box_y, box_x, box_width; - int input_x = 0, scroll = 0, key = 0, button = -1; ++ int input_x = 0, d_scroll = 0, key = 0, button = -1; unsigned char *instr = dialog_input_result; WINDOW *dialog; -+ + + /* Choose useful default height and width if they are negative */ + if (height < 0) + height = strheight(prompt) + 4 + 2; @@ -21,6 +22,68 @@ $NetBSD: patch-ae,v 1.2 1998/08/07 11:10:14 agc Exp $ + width = MAX (i, j) + 4; + } + width = MAX (width, MIN_DIALOG_WIDTH); - ++ /* center dialog box on screen */ x = (COLS - width) / 2; + y = (LINES - height) / 2; +@@ -91,10 +101,10 @@ + strcpy (instr, init); + input_x = strlen (instr); + if (input_x >= box_width) { +- scroll = input_x - box_width + 1; ++ d_scroll = input_x - box_width + 1; + input_x = box_width - 1; + for (i = 0; i < box_width - 1; i++) +- waddch (dialog, instr[scroll + i]); ++ waddch (dialog, instr[d_scroll + i]); + } else + waddstr (dialog, instr); + wmove (dialog, box_y, box_x + input_x); +@@ -118,19 +128,19 @@ + continue; + case KEY_BACKSPACE: + case 127: +- if (input_x || scroll) { ++ if (input_x || d_scroll) { + wattrset (dialog, inputbox_attr); + if (!input_x) { +- scroll = scroll < box_width - 1 ? +- 0 : scroll - (box_width - 1); ++ d_scroll = d_scroll < box_width - 1 ? ++ 0 : d_scroll - (box_width - 1); + wmove (dialog, box_y, box_x); + for (i = 0; i < box_width; i++) +- waddch (dialog, instr[scroll + input_x + i] ? +- instr[scroll + input_x + i] : ' '); +- input_x = strlen (instr) - scroll; ++ waddch (dialog, instr[d_scroll + input_x + i] ? ++ instr[d_scroll + input_x + i] : ' '); ++ input_x = strlen (instr) - d_scroll; + } else + input_x--; +- instr[scroll + input_x] = '\0'; ++ instr[d_scroll + input_x] = '\0'; + wmove (dialog, box_y, input_x + box_x); + waddch (dialog, ' '); + wmove (dialog, box_y, input_x + box_x); +@@ -139,15 +149,15 @@ + continue; + default: + if (key < 0x100 && isprint (key)) { +- if (scroll + input_x < MAX_LEN) { ++ if (d_scroll + input_x < MAX_LEN) { + wattrset (dialog, inputbox_attr); +- instr[scroll + input_x] = key; +- instr[scroll + input_x + 1] = '\0'; ++ instr[d_scroll + input_x] = key; ++ instr[d_scroll + input_x + 1] = '\0'; + if (input_x == box_width - 1) { +- scroll++; ++ d_scroll++; + wmove (dialog, box_y, box_x); + for (i = 0; i < box_width - 1; i++) +- waddch (dialog, instr[scroll + i]); ++ waddch (dialog, instr[d_scroll + i]); + } else { + wmove (dialog, box_y, input_x++ + box_x); + waddch (dialog, key); 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; + } diff --git a/misc/dialog/patches/patch-ah b/misc/dialog/patches/patch-ah index feeed9434e7..b0a7cbd0d06 100644 --- a/misc/dialog/patches/patch-ah +++ b/misc/dialog/patches/patch-ah @@ -1,7 +1,7 @@ -$NetBSD: patch-ah,v 1.2 1998/08/07 11:10:15 agc Exp $ +$NetBSD: patch-ah,v 1.3 2000/07/28 20:30:11 jlam Exp $ ---- textbox.c.orig Fri Jan 23 17:37:13 1998 -+++ textbox.c Fri Jan 23 17:37:12 1998 +--- textbox.c.orig Thu Aug 17 19:07:40 1995 ++++ textbox.c Fri Jul 28 15:30:22 2000 @@ -45,6 +45,11 @@ char search_term[MAX_LEN + 1], *tempptr, *found; WINDOW *dialog, *text; @@ -14,3 +14,58 @@ $NetBSD: patch-ah,v 1.2 1998/08/07 11:10:15 agc Exp $ search_term[0] = '\0'; /* no search term entered yet */ /* Open input file for reading */ +@@ -634,7 +639,7 @@ + static int + get_search_term (WINDOW * win, char *search_term, int height, int width) + { +- int i, x, y, input_x = 0, scroll = 0, key = 0; ++ int i, x, y, input_x = 0, d_scroll = 0, key = 0; + int box_height = 3, box_width = 30; + + x = (width - box_width) / 2; +@@ -663,18 +668,18 @@ + break; + case KEY_BACKSPACE: + case 127: +- if (input_x || scroll) { ++ if (input_x || d_scroll) { + if (!input_x) { +- scroll = scroll < box_width - 1 ? +- 0 : scroll - (box_width - 1); ++ d_scroll = d_scroll < box_width - 1 ? ++ 0 : d_scroll - (box_width - 1); + wmove (win, y + 1, x + 1); + for (i = 0; i < box_width; i++) +- waddch (win, search_term[scroll + input_x + i] ? +- search_term[scroll + input_x + i] : ' '); +- input_x = strlen (search_term) - scroll; ++ waddch (win, search_term[d_scroll + input_x + i] ? ++ search_term[d_scroll + input_x + i] : ' '); ++ input_x = strlen (search_term) - d_scroll; + } else + input_x--; +- search_term[scroll + input_x] = '\0'; ++ search_term[d_scroll + input_x] = '\0'; + wmove (win, y + 1, input_x + x + 1); + waddch (win, ' '); + wmove (win, y + 1, input_x + x + 1); +@@ -685,14 +690,14 @@ + break; + default: + if (isprint (key)) +- if (scroll + input_x < MAX_LEN) { +- search_term[scroll + input_x] = key; +- search_term[scroll + input_x + 1] = '\0'; ++ if (d_scroll + input_x < MAX_LEN) { ++ search_term[d_scroll + input_x] = key; ++ search_term[d_scroll + input_x + 1] = '\0'; + if (input_x == box_width - 1) { +- scroll++; ++ d_scroll++; + wmove (win, y + 1, x + 1); + for (i = 0; i < box_width - 1; i++) +- waddch (win, search_term[scroll + i]); ++ waddch (win, search_term[d_scroll + i]); + } else { + wmove (win, y + 1, input_x++ + x + 1); + waddch (win, key); -- cgit v1.2.3