diff options
author | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2011-08-15 16:26:07 +0000 |
---|---|---|
committer | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2011-08-15 16:26:07 +0000 |
commit | e9ef70cefa571bb1ada1ec515a433ed9a643a171 (patch) | |
tree | 332b03015a7dec775e06d6443d48a20da49e6b5a /src/utils.c | |
parent | 4ecf840e1ce10fe7a45ae69b5c54b1bba5ed5707 (diff) | |
download | 2011-ddhardrescue-e9ef70cefa571bb1ada1ec515a433ed9a643a171.tar.gz 2011-ddhardrescue-e9ef70cefa571bb1ada1ec515a433ed9a643a171.tar.bz2 2011-ddhardrescue-e9ef70cefa571bb1ada1ec515a433ed9a643a171.zip |
Refactoring : Tout ce qui "ncurses" a été dégagé dans un "module" séparé. Le ddhardrescue.c est tout propre maintenant.
git-svn-id: file:///var/svn/2011-ddhardrescue/trunk@21 d3078510-dda0-49f1-841c-895ef4b7ec81
Diffstat (limited to 'src/utils.c')
-rw-r--r-- | src/utils.c | 78 |
1 files changed, 0 insertions, 78 deletions
diff --git a/src/utils.c b/src/utils.c index 86917ae..7305b22 100644 --- a/src/utils.c +++ b/src/utils.c @@ -25,81 +25,3 @@ void usage(char *progname) { ", progname); } -void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color) -{ int length, x, y; - float temp; - - if(win == NULL) - win = stdscr; - getyx(win, y, x); - if(startx != 0) - x = startx; - if(starty != 0) - y = starty; - if(width == 0) - width = 80; - - length = strlen(string); - temp = (width - length)/ 2; - x = startx + (int)temp; - wattron(win, color); - mvwprintw(win, y, x, "%s", string); - wattroff(win, color); - refresh(); -} - -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); -} - - -int cursesInit(WINDOW *wins[], PANEL *panels[], int count) { - int screenH, screenW; - - /* Initialize curses */ - initscr(); - start_color(); - raw(); - keypad(stdscr, TRUE); - noecho(); - - /* Initialize all the colors */ - init_pair(1, COLOR_WHITE, COLOR_BLACK); - init_pair(2, COLOR_WHITE, COLOR_BLUE); - init_pair(3, COLOR_BLUE, COLOR_BLACK); - init_pair(4, COLOR_CYAN, COLOR_BLACK); - - /* Initialize windows and panels */ - 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"); - - /* Set up the user pointers to the next panel - set_panel_userptr(panels[0], panels[1]); - set_panel_userptr(panels[1], panels[2]); - set_panel_userptr(panels[2], panels[0]); - */ - - /* Update the stacking order. 2nd panel will be on top */ - update_panels(); - - 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(); -} |