From c4cf066956da0754d3383e60a6ff9f4e7abc9bca Mon Sep 17 00:00:00 2001 From: Ludovic Pouzenc Date: Sun, 13 Mar 2011 21:43:30 +0000 Subject: Début du codage de la partie ncurses. Suppression des printf de debug qui pollue l'écran. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///var/svn/2011-ddhardrescue/trunk@13 d3078510-dda0-49f1-841c-895ef4b7ec81 --- src/utils.c | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) (limited to 'src/utils.c') diff --git a/src/utils.c b/src/utils.c index a19b021..e4fdbc0 100755 --- a/src/utils.c +++ b/src/utils.c @@ -1,4 +1,6 @@ #include +#include + #include "utils.h" int parseArgs(int argc, char **argv, struct progArgs *args) { @@ -22,3 +24,74 @@ void usage(char *progname) { \t\n\ ", 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