diff options
author | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2011-05-14 19:36:36 +0000 |
---|---|---|
committer | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2011-05-14 19:36:36 +0000 |
commit | b7fc5e62feba5edb3f67844c87fc8072930ea34b (patch) | |
tree | f61007b7b08fd62a024ef7ec486eb6f23c6ea1dd | |
parent | c4cf066956da0754d3383e60a6ff9f4e7abc9bca (diff) | |
download | 2011-ddhardrescue-b7fc5e62feba5edb3f67844c87fc8072930ea34b.tar.gz 2011-ddhardrescue-b7fc5e62feba5edb3f67844c87fc8072930ea34b.tar.bz2 2011-ddhardrescue-b7fc5e62feba5edb3f67844c87fc8072930ea34b.zip |
Ajout cursesUninit et debug problème makeWindow (erreur logique pointeurs, changement prototype fonction)
git-svn-id: file:///var/svn/2011-ddhardrescue/trunk@14 d3078510-dda0-49f1-841c-895ef4b7ec81
-rwxr-xr-x | inc/utils.h | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | src/utils.c | 30 |
2 files changed, 20 insertions, 11 deletions
diff --git a/inc/utils.h b/inc/utils.h index 0149aaf..8492179 100755 --- a/inc/utils.h +++ b/inc/utils.h @@ -12,5 +12,6 @@ struct progArgs { int parseArgs(int argc, char **argv, struct progArgs *args); void usage(char *progname); int cursesInit(WINDOW *wins[], PANEL *panels[], int count); +void cursesUnInit(WINDOW *wins[], PANEL *panels[], int count); #endif /*UTILS_H*/ diff --git a/src/utils.c b/src/utils.c index e4fdbc0..86917ae 100755..100644 --- a/src/utils.c +++ b/src/utils.c @@ -48,14 +48,13 @@ void print_in_middle(WINDOW *win, int starty, int startx, int width, char *strin refresh(); } - -void makeWin(WINDOW *win, PANEL *panel, int h, int w, int y, int x, char title[]) { +void makeWin(WINDOW **win, PANEL **panel, int h, int w, int y, int x, char title[]) { int i; - win = newwin(h, w, y, x); - mvwprintw(win, 0, 0, "%s", title); - mvwchgat(win, 0, 0, -1, A_BOLD, 2, NULL); - for(i=1;i<h;i++) mvwchgat(win, i, 0, -1, A_STANDOUT, 1, NULL); - panel = new_panel(win); + *win = newwin(h, w, y, x); + mvwprintw(*win, 0, 0, "%s", title); + mvwchgat(*win, 0, 0, -1, A_BOLD, 2, NULL); + for(i=1;i<h;i++) mvwchgat(*win, i, 0, -1, A_STANDOUT, 1, NULL); + *panel = new_panel(*win); } @@ -66,8 +65,8 @@ int cursesInit(WINDOW *wins[], PANEL *panels[], int count) { initscr(); start_color(); raw(); - noecho(); keypad(stdscr, TRUE); + noecho(); /* Initialize all the colors */ init_pair(1, COLOR_WHITE, COLOR_BLACK); @@ -79,9 +78,9 @@ int cursesInit(WINDOW *wins[], PANEL *panels[], int count) { getmaxyx(stdscr, screenH, screenW); if ( screenH < 8 || screenW < 40 ) return 1; - makeWin(wins[0], panels[0], 3 , screenW, 0 , 0, "Menu"); - makeWin(wins[1], panels[1], screenH-6 , screenW, 3 , 0, "Main Win"); - makeWin(wins[2], panels[2], 2 , screenW, screenH-3 , 0, "Commands"); + makeWin(wins+0, panels+0, 3 , screenW, 0 , 0, "Menu"); + makeWin(wins+1, panels+1, screenH-6 , screenW, 3 , 0, "Main Win"); + makeWin(wins+2, panels+2, 2 , screenW, screenH-3 , 0, "Commands"); /* Set up the user pointers to the next panel set_panel_userptr(panels[0], panels[1]); @@ -95,3 +94,12 @@ int cursesInit(WINDOW *wins[], PANEL *panels[], int count) { return 0; } +void cursesUnInit(WINDOW *wins[], PANEL *panels[], int count) { + int i; + + for (i=0;i<count;i++) { + del_panel(panels[i]); + delwin(wins[i]); + } + endwin(); +} |