diff options
author | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2011-02-24 23:32:40 +0000 |
---|---|---|
committer | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2011-02-24 23:32:40 +0000 |
commit | a5f35dfa2aac7c1040022d0cfb475c9b1fdcf32e (patch) | |
tree | fa6f5cf4dfb2f344dc94d45359c1c634c08aca29 /src/essais | |
parent | ebc3e0991986c8cf300312fff557b9670835cdb4 (diff) | |
download | 2011-ddhardrescue-a5f35dfa2aac7c1040022d0cfb475c9b1fdcf32e.tar.gz 2011-ddhardrescue-a5f35dfa2aac7c1040022d0cfb475c9b1fdcf32e.tar.bz2 2011-ddhardrescue-a5f35dfa2aac7c1040022d0cfb475c9b1fdcf32e.zip |
Ajout d'une todo list, svn ingore de a.out, et dossier essai avec des tentatives ncurses
git-svn-id: file:///var/svn/2011-ddhardrescue/trunk@5 d3078510-dda0-49f1-841c-895ef4b7ec81
Diffstat (limited to 'src/essais')
-rwxr-xr-x | src/essais/compil.sh | 1 | ||||
-rw-r--r-- | src/essais/test.c | 73 |
2 files changed, 74 insertions, 0 deletions
diff --git a/src/essais/compil.sh b/src/essais/compil.sh new file mode 100755 index 0000000..0b2eda7 --- /dev/null +++ b/src/essais/compil.sh @@ -0,0 +1 @@ +gcc -Wall -lncurses test.c diff --git a/src/essais/test.c b/src/essais/test.c new file mode 100644 index 0000000..5e3a185 --- /dev/null +++ b/src/essais/test.c @@ -0,0 +1,73 @@ +#include <ncurses.h> + + +WINDOW *create_newwin(int height, int width, int starty, int startx) +{ WINDOW *local_win; + + local_win = newwin(height, width, starty, startx); + box(local_win, 0 , 0); /* 0, 0 gives default characters + * for the vertical and horizontal + * lines */ + wrefresh(local_win); /* Show that box */ + + return local_win; +} + +int main() { + +/* + A_NORMAL Normal display (no highlight) + A_STANDOUT Best highlighting mode of the terminal. + A_UNDERLINE Underlining + A_REVERSE Reverse video + A_BLINK Blinking + A_DIM Half bright + A_BOLD Extra bright or bold + A_PROTECT Protected mode + A_INVIS Invisible or blank mode + A_ALTCHARSET Alternate character set + A_CHARTEXT Bit-mask to extract a character + COLOR_PAIR(n) Color-pair number n +*/ + int end, ch; + int row,col; + char msg[256]; + WINDOW *w1; + + initscr(); + getmaxyx(stdscr,row,col); + raw(); + keypad(stdscr, TRUE); + noecho(); + + mvprintw(row-2,0,"This screen has %d rows and %d columns\n",row,col); + move(0,0); + + +//http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/windows.html + w1 = create_newwin(row/2, col/2, row/4, col/4); + + while (!end) { + ch=getch(); + switch(ch) { + case KEY_F(2): + attrset(A_NORMAL); + printw("F2 key\n"); + break; + case 'q': + end=1; + break; + case 'b': + mvwchgat(w1,1,0,-1, A_REVERSE, 0, NULL); + break; + default: + sprintf(msg, "%c key\n", ch); + wattrset(w1,A_BOLD | A_UNDERLINE); + wprintw(w1, msg); + } + refresh(); + } + endwin(); + + return 0; +} |