X-Git-Url: https://git.llucax.com/z.facultad/75.06/emufs.git/blobdiff_plain/f1276ee6db18ea8d953d8b90907aceb3e2cc1166..64651dbe1cda5fa52479608384aec8d35414e90f:/emufs_gui/gui.c?ds=inline diff --git a/emufs_gui/gui.c b/emufs_gui/gui.c index 27aab8f..7a32c5a 100644 --- a/emufs_gui/gui.c +++ b/emufs_gui/gui.c @@ -4,6 +4,7 @@ #include #include #include +#include #include "form.h" #include "articulos.h" @@ -16,10 +17,14 @@ static void finish(int sig); int main_menu(); void menu_articulos(); +/* cuadro de msg. w y h son de la ventana padre */ +WINDOW *msg_box(WINDOW *win, int w, int h, const char *format, ...); +void msg_box_free(WINDOW *padre, WINDOW *win); int main(int argc, char *argv[]) { int c, fin=0; + WINDOW *dialog; /* art_cargar(argv[1]); @@ -54,12 +59,6 @@ int main(int argc, char *argv[]) return 1; } - if (argc == 2) { - art_cargar(argv[1]); - fact_cargar(argv[1]); - } else - art_cargar(NULL); - /* Ventana, caracter para linea vertical, caracter para linea horizontal*/ box(stdscr, ACS_VLINE, ACS_HLINE); /* Ventana, Y, X, Texto */ @@ -69,6 +68,15 @@ int main(int argc, char *argv[]) attroff(COLOR_PAIR(2)); wrefresh(stdscr); + dialog = msg_box(stdscr, COLS, LINES, "Generando archivos ..."); + if (argc == 2) { + art_cargar(argv[1]); + fact_cargar(argv[1]); + } else + art_cargar(NULL); + + msg_box_free(stdscr, dialog); + /* CICLO PRINCIPAL DE LA APLICACION */ while ((c = main_menu()) != -1) { switch (c) { @@ -279,3 +287,32 @@ static void finish(int sig) exit(0); } +WINDOW *msg_box(WINDOW *win, int w, int h, const char *format, ...) +{ + va_list ap; + char txt[255]; + int mw, mh; + WINDOW *dialog; + va_start(ap, format); + vsprintf(txt, format, ap); + va_end(ap); + + mw = strlen(txt)+2; + mh = 3; + dialog = derwin(win, mh, mw, h/2-mh/2, w/2-mw/2); + box(dialog, 0 ,0); + mvwaddstr(dialog, 1, 1, txt); + wrefresh(dialog); + curs_set(0); + return dialog; +} + +void msg_box_free(WINDOW *padre, WINDOW *win) +{ + werase(win); + wrefresh(win); + delwin(win); + curs_set(1); + wrefresh(padre); +} +