diff -rubB dialog-0.9b-20030820.orig/dialog.c dialog-0.9b-20030820/dialog.c --- dialog-0.9b-20030820.orig/dialog.c 2003-08-11 00:36:04 +0300 +++ dialog-0.9b-20030820/dialog.c 2003-09-01 13:56:02 +0300 @@ -153,7 +153,7 @@ { "form", o_form, 2, "
..." }, { "fselect", o_fselect, 2, " " }, { "fullbutton", o_fullbutton, 1, NULL }, - { "gauge", o_gauge, 2, " []" }, + { "gauge", o_gauge, 2, " [] [] []" }, { "guage", o_gauge, 2, NULL }, { "help", o_help, 4, "" }, { "help-button", o_help_button, 1, "" }, @@ -601,7 +601,9 @@ av[1], numeric_arg(av, 2), numeric_arg(av, 3), - optional_num(av, 4, 0)); + optional_num(av, 4, 0), + optional_num(av, 5, 0), + optional_num(av, 6, 0)); } #endif @@ -650,7 +652,7 @@ {o_form, 13, 0, j_form}, #endif #ifdef HAVE_GAUGE - {o_gauge, 4, 5, j_gauge}, + {o_gauge, 4, 7, j_gauge}, #endif #ifdef HAVE_TAILBOX {o_tailbox, 4, 4, j_tailbox}, diff -rubB dialog-0.9b-20030820.orig/dialog.h dialog-0.9b-20030820/dialog.h --- dialog-0.9b-20030820.orig/dialog.h 2003-08-20 22:32:17 +0300 +++ dialog-0.9b-20030820/dialog.h 2003-09-01 13:56:02 +0300 @@ -378,7 +378,7 @@ int dialog_inputbox (const char *title, const char *cprompt, int height, int width, const char *init, const int password); int dialog_gauge (const char *title, const char *cprompt, int height, int width, - int percent); + int percent, int lines, int percent2); int dialog_tailbox (const char *title, const char *file, int height, int width, int bg_task); int dialog_fselect (const char *title, const char *path, int height, int width); int dialog_calendar (const char *title, const char *subtitle, int height, int width, int day, int month, int year); diff -rubB dialog-0.9b-20030820.orig/guage.c dialog-0.9b-20030820/guage.c --- dialog-0.9b-20030820.orig/guage.c 2003-07-25 01:22:17 +0300 +++ dialog-0.9b-20030820/guage.c 2003-09-01 13:57:58 +0300 @@ -66,17 +66,25 @@ const char *prompt, int height, int width, - int percent) + int percent, + int lines, + int percent2) { int i, x, y; char buf[MY_LEN]; char prompt_buf[MY_LEN]; + char flag = 0; WINDOW *dialog; auto_size(title, prompt, &height, &width, MIN_HIGH, MIN_WIDE); print_size(height, width); ctl_size(height, width); + /* fix height if we need 2 gauge lines */ + if (lines != 0) { + height += 3; + } + /* center dialog box on screen */ x = box_x_ordinate(width); y = box_y_ordinate(height); @@ -85,6 +93,7 @@ curs_set(0); do { + if (percent > 100) percent = 100; (void) werase(dialog); draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); @@ -117,6 +126,31 @@ (void) wrefresh(dialog); + // Drow second line (if available) + if (lines != 0) { + if (percent2 > 100) percent2 = 100; + wattrset(dialog, dialog_attr); + print_autowrap(dialog, prompt, height, width - 2); + + draw_box(dialog, height-7, 3, 3, width - 6, dialog_attr, border_attr); + + (void) wmove(dialog, height - 6, 4); + wattrset(dialog, title_attr); + + for (i = 0; i < (width - 8); i++) (void) waddch(dialog, ' '); + + wattrset(dialog, title_attr); + (void) wmove(dialog, height - 6, (width / 2) - 2); + (void) wprintw(dialog, "%3d%%", percent2); + + x = (percent2 * (width - 8)) / 100; + wattrset(dialog, A_REVERSE); + (void) wmove(dialog, height - 6, 4); + for (i = 0; i < x; i++) (void) waddch(dialog, winch(dialog)); + (void) wrefresh(dialog); + } //End second line + + if (read_data(buf, pipe_fp) == 0) break; if (isMarker(buf)) { @@ -128,20 +162,21 @@ if (read_data(buf, pipe_fp) == 0) break; prompt_buf[0] = '\0'; - if (decode_percent(buf)) + if (decode_percent(buf)) { percent = atoi(buf); - else - strcpy(prompt_buf, buf); + if (lines != 0) { + if (read_data(buf, pipe_fp) == 0) break; + if (decode_percent(buf)) percent2 = atoi(buf); + } + } else strcpy(prompt_buf, buf); /* Rest is message text */ - while (read_data(buf, pipe_fp) != 0 - && !isMarker(buf)) { - if (strlen(prompt_buf) + strlen(buf) < sizeof(prompt_buf) - 1) { + while ((read_data(buf, pipe_fp) != 0) && !isMarker(buf)) { + if (strlen(prompt_buf) + strlen(buf) < sizeof(prompt_buf) - 1) strcat(prompt_buf, buf); } - } prompt = prompt_buf; - } else if (decode_percent(buf)) { + } else if (decode_percent(buf) && (lines == 0)) { percent = atoi(buf); } } while (1);