#include <menu.h>
#include <signal.h>
#include <string.h>
+#include <stdarg.h>
#include "form.h"
#include "articulos.h"
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]);
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 */
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) {
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);
+}
+