Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/sushi Add patches from Peter Postma in PR 24755 to ...



details:   https://anonhg.NetBSD.org/src/rev/0589be1eb2f3
branches:  trunk
changeset: 559849:0589be1eb2f3
user:      garbled <garbled%NetBSD.org@localhost>
date:      Wed Mar 24 19:10:58 2004 +0000

description:
Add patches from Peter Postma in PR 24755 to cleanup output in sushi:
        * hide the cursor everywhere except in forms (looks nicer)
        * fix repaint with lists (from TODO)
        * fix the form page (removes XXX)
        * force a pos_form_cursor() after every keypress in the forms
          to ensure that the selected field got the focus.
        * tweak the status message a bit.

diffstat:

 usr.sbin/sushi/C.msg      |   2 +-
 usr.sbin/sushi/TODO       |   1 -
 usr.sbin/sushi/scanform.c |  32 +++++++++++++++++++++++++++-----
 usr.sbin/sushi/sushi.c    |   6 +++++-
 4 files changed, 33 insertions(+), 8 deletions(-)

diffs (209 lines):

diff -r e6985bfaa0ff -r 0589be1eb2f3 usr.sbin/sushi/C.msg
--- a/usr.sbin/sushi/C.msg      Wed Mar 24 19:10:46 2004 +0000
+++ b/usr.sbin/sushi/C.msg      Wed Mar 24 19:10:58 2004 +0000
@@ -65,6 +65,6 @@
 6 Enter the field data below, and hit enter to return to the form.
 7 Data Entry: 
 8 Form Page:
-9 PGUP/PGDN to change page, UP/DOWN switch field, ENTER=Do.
+9 PGUP/PGDN to change page, UP/DOWN switch field, ENTER submit.
 10 Log ended at
 11 Script ended at
diff -r e6985bfaa0ff -r 0589be1eb2f3 usr.sbin/sushi/TODO
--- a/usr.sbin/sushi/TODO       Wed Mar 24 19:10:46 2004 +0000
+++ b/usr.sbin/sushi/TODO       Wed Mar 24 19:10:58 2004 +0000
@@ -14,6 +14,5 @@
 /etc/ftpusers
 
 BUGS:
-the f4 popup isn't repainting the screen properly
 required fields, aren't.
 All of the /etc/*.conf menus need to be updated prior to release.
diff -r e6985bfaa0ff -r 0589be1eb2f3 usr.sbin/sushi/scanform.c
--- a/usr.sbin/sushi/scanform.c Wed Mar 24 19:10:46 2004 +0000
+++ b/usr.sbin/sushi/scanform.c Wed Mar 24 19:10:58 2004 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: scanform.c,v 1.35 2004/03/22 19:03:19 jdc Exp $       */
+/*      $NetBSD: scanform.c,v 1.36 2004/03/24 19:10:58 garbled Exp $       */
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -80,7 +80,7 @@
 
        wstandout(stdscr);
        mvwaddstr(stdscr, ws.ws_row-3, 0, catgets(catalog, 4, 9,
-           "PGUP/PGDN to change page, UP/DOWN switch field, ENTER=Do."));
+           "PGUP/PGDN to change page, UP/DOWN switch field, ENTER submit."));
        wstandend(stdscr);
        snprintf(buf, sizeof(buf), "%s (%d/%d)",
            catgets(catalog, 4, 8, "Form Page:"),
@@ -481,10 +481,12 @@
                /* NOTREACHED */
                break;
        case SHOWHELP:
-               if (simple_lang_handler(path, HELPFILE, handle_help) == -2)
+               curs_set(0);
+           if (simple_lang_handler(path, HELPFILE, handle_help) == -2)
                        nohelp();
                touchwin(stdscr);
                wrefresh(stdscr);
+           curs_set(1);
                return(FALSE);
                /* NOTREACHED */
                break;
@@ -500,6 +502,7 @@
                if (field_buffer(curfield, 1) == NULL || 
                    field_buffer(curfield, 0) == NULL)
                        return(FALSE);
+           curs_set(0);
                otmp = tmp = strdup(field_buffer(curfield, 1));
                stripWhiteSpace(vBOTH, tmp);
                if (*tmp == 'm') {
@@ -545,6 +548,9 @@
                        destroyCDKScroll(plist);
                        free(otmp);
                }
+               touchwin(stdscr);
+               wrefresh(stdscr);
+               curs_set(1);
                return(FALSE);
                /* NOTREACHED */
                break;
@@ -859,6 +865,7 @@
        if (strcmp("pre", form_userptr(form)) == 0)
                return(process_preform(form, path));
 
+       curs_set(0);
        *msg = catgets(catalog, 3, 17, "Are you sure? (Y/n)");
        label = newCDKLabel(cdkscreen, CENTER, CENTER, msg, 1, TRUE, FALSE);
        activateCDKLabel(label, NULL);
@@ -866,6 +873,7 @@
        destroyCDKLabel(label);
        touchwin(stdscr);
        wrefresh(stdscr);
+       curs_set(1);
        if (key != 13 && key != 10 && key != 121 && key != 89) /* enter y Y */
                return -1;
 
@@ -1608,12 +1616,14 @@
        } else
                return;
 
+       curs_set(0);
        label = newCDKLabel(cdkscreen, CENTER, CENTER, msg, lines, TRUE, FALSE);
        activateCDKLabel(label, NULL);
        waitCDKLabel(label, 0);
        destroyCDKLabel(label);
        touchwin(stdscr);
        wrefresh(stdscr);
+       curs_set(1);
 }
 
 int
@@ -1639,6 +1649,7 @@
                bailout("malloc: %s", strerror(errno));
        fflush(NULL);
 
+       curs_set(0);
        /* generate a label to let the user know we are thinking */
        msg[0] = catgets(catalog, 4, 2, "Generating form data, please wait");
        label = newCDKLabel(cdkscreen, CENTER, CENTER, msg, 1, TRUE, FALSE);
@@ -1667,11 +1678,15 @@
        wrefresh(stdscr);
        wrefresh(boxwin);
        form_status(menuform);
+       curs_set(1);
        while (!done) {
+               pos_form_cursor(menuform);
+               wrefresh(formwin);
                switch (form_driver(menuform, c = get_request(formwin))) {
                case E_OK:
                        if (c == REQ_NEXT_PAGE || c == REQ_PREV_PAGE ||
-                           c == REQ_FIRST_PAGE || c == REQ_LAST_PAGE)
+                           c == REQ_FIRST_PAGE || c == REQ_LAST_PAGE ||
+                               c == REQ_NEXT_FIELD || c == REQ_PREV_FIELD)
                                form_status(menuform);
                        break;
                case E_UNKNOWN_COMMAND:
@@ -1684,6 +1699,7 @@
                        break;
                }
        }
+       curs_set(0);
        fc = field_count(menuform);
        f = form_fields(menuform);
        unpost_form(menuform);
@@ -1740,6 +1756,7 @@
                bailout("malloc: %s", strerror(errno));
        fflush(NULL);
 
+       curs_set(0);
        /* generate a label to let the user know we are thinking */
        msg[0] = catgets(catalog, 4, 2, "Generating form data, please wait");
        label = newCDKLabel(cdkscreen, CENTER, CENTER, msg, 1, TRUE, FALSE);
@@ -1765,11 +1782,15 @@
        post_form(menuform);
        wrefresh(stdscr);
        form_status(menuform);
+       curs_set(1);
        while (!done) {
+               pos_form_cursor(menuform);
+               wrefresh(formwin);
                switch (form_driver(menuform, c = get_request(formwin))) {
                case E_OK:
                        if (c == REQ_NEXT_PAGE || c == REQ_PREV_PAGE ||
-                           c == REQ_FIRST_PAGE || c == REQ_LAST_PAGE)
+                           c == REQ_FIRST_PAGE || c == REQ_LAST_PAGE ||
+                               c == REQ_NEXT_FIELD || c == REQ_PREV_FIELD)
                                form_status(menuform);
                        break;
                case E_UNKNOWN_COMMAND:
@@ -1782,6 +1803,7 @@
                        break;
                }
        }
+       curs_set(0);
        fc = field_count(menuform);
        f = form_fields(menuform);
        unpost_form(menuform);
diff -r e6985bfaa0ff -r 0589be1eb2f3 usr.sbin/sushi/sushi.c
--- a/usr.sbin/sushi/sushi.c    Wed Mar 24 19:10:46 2004 +0000
+++ b/usr.sbin/sushi/sushi.c    Wed Mar 24 19:10:58 2004 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: sushi.c,v 1.17 2004/03/09 20:16:16 garbled Exp $       */
+/*      $NetBSD: sushi.c,v 1.18 2004/03/24 19:10:58 garbled Exp $       */
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -98,6 +98,7 @@
        use_default_colors();
 
        initCDKColor();
+       curs_set(0);
        raw();
 
        tree_init();
@@ -124,6 +125,7 @@
 
        destroyCDKScreen(cdkscreen);
        endCDK();
+       curs_set(1);
        endwin();
 #ifdef DEBUG
        tree_printtree(cqMenuHeadp);
@@ -340,6 +342,7 @@
        if (items == 0) {
                destroyCDKScreen(cdkscreen);
                endCDK();
+               curs_set(1);
                endwin();
                (void)fprintf(stderr, "%s\n", catgets(catalog, 1, 19,
                    "No menu hierarchy found"));
@@ -384,6 +387,7 @@
 
        destroyCDKScreen(cdkscreen);
        endCDK();
+       curs_set(1);
        fprintf(stderr, "%s: ", getprogname());
        if (fmt != NULL)
                vfprintf(stderr, fmt, ap);



Home | Main Index | Thread Index | Old Index