X-Git-Url: https://git.llucax.com/z.facultad/75.06/emufs.git/blobdiff_plain/f1276ee6db18ea8d953d8b90907aceb3e2cc1166..f68323b8913e191679584b23568aa162760bbd64:/emufs_gui/gui.c diff --git a/emufs_gui/gui.c b/emufs_gui/gui.c index 27aab8f..4d21e61 100644 --- a/emufs_gui/gui.c +++ b/emufs_gui/gui.c @@ -4,11 +4,13 @@ #include #include #include +#include #include "form.h" #include "articulos.h" #include "facturas.h" #include "emufs.h" +#include "registros.h" #define CTRLD 4 @@ -16,10 +18,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 +60,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 +69,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) { @@ -76,7 +85,14 @@ int main(int argc, char *argv[]) menu_articulos(); break; // case 1: - // case 2: + case 2: + dialog = derwin(stdscr, LINES-4, COLS-2, 2, 1); + ver_registros(dialog, COLS-2, LINES-4); + werase(dialog); + wrefresh(dialog); + delwin(dialog); + refresh(); + break; // case 3: case 6: fin = 1; @@ -279,3 +295,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); +} +