Mercurial > hg > nnchat
comparison nnchat.c @ 110:8af4072dc31a
Fix Win32/MinGW/PDcurses issues.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 24 Oct 2010 18:28:22 +0300 |
parents | 1323a7f88c21 |
children | 9db08807018f |
comparison
equal
deleted
inserted
replaced
109:1323a7f88c21 | 110:8af4072dc31a |
---|---|
173 | 173 |
174 timeStamp = time(NULL); | 174 timeStamp = time(NULL); |
175 if ((tmpTime = localtime(&timeStamp)) != NULL) { | 175 if ((tmpTime = localtime(&timeStamp)) != NULL) { |
176 strftime(tmpStr, sizeof(tmpStr), "%H:%M:%S", tmpTime); | 176 strftime(tmpStr, sizeof(tmpStr), "%H:%M:%S", tmpTime); |
177 } | 177 } |
178 | 178 |
179 #ifdef __WIN32 | |
180 /* PDCurses does not like the hack used for ncurses to get a specific | |
181 * colour background .. so we just use something else, but uglier. :| | |
182 */ | |
183 wbkgdset(statusWin, A_REVERSE | COLOR_PAIR(13)); | |
184 #else | |
179 wbkgdset(statusWin, 0x0d00); | 185 wbkgdset(statusWin, 0x0d00); |
186 #endif | |
180 werase(statusWin); | 187 werase(statusWin); |
181 | 188 |
182 wattrset(statusWin, A_BOLD); | 189 wattrset(statusWin, A_BOLD); |
183 mvwaddstr(statusWin, 0, 1, tmpStr); | 190 mvwaddstr(statusWin, 0, 1, tmpStr); |
184 | 191 |
244 s++; | 251 s++; |
245 if (*s == '½') { | 252 if (*s == '½') { |
246 waddch(win, ((unsigned char) *s) | col); | 253 waddch(win, ((unsigned char) *s) | col); |
247 s++; | 254 s++; |
248 } else { | 255 } else { |
249 while (*s && isdigit((int) *s)) { | 256 while (*s >= '0' && *s <= '9') { |
250 val *= 10; | 257 val *= 10; |
251 val += (*s - '0'); | 258 val += (*s - '0'); |
252 s++; | 259 s++; |
253 } | 260 } |
254 if (*s != '½') return -1; | 261 if (*s != '½') return -1; |
259 } else if (val < 30) { | 266 } else if (val < 30) { |
260 col = A_BOLD | COLOR_PAIR(val - 9); | 267 col = A_BOLD | COLOR_PAIR(val - 9); |
261 } | 268 } |
262 } | 269 } |
263 } else { | 270 } else { |
271 #ifdef __WIN32 | |
272 /* A little hack for win32 + PDCurses */ | |
273 if (*s != '\r') | |
274 #endif | |
264 waddch(win, ((unsigned char) *s) | col); | 275 waddch(win, ((unsigned char) *s) | col); |
265 s++; | 276 s++; |
266 } | 277 } |
267 } | 278 } |
268 return 0; | 279 return 0; |
796 keypad(stdscr, TRUE); | 807 keypad(stdscr, TRUE); |
797 noecho(); | 808 noecho(); |
798 meta(stdscr, TRUE); | 809 meta(stdscr, TRUE); |
799 timeout(SET_DELAY); | 810 timeout(SET_DELAY); |
800 curVis = curs_set(0); | 811 curVis = curs_set(0); |
812 | |
801 if (has_colors()) { | 813 if (has_colors()) { |
802 start_color(); | 814 start_color(); |
803 | 815 |
804 init_pair(1, COLOR_RED, COLOR_BLACK); | 816 init_pair(1, COLOR_RED, COLOR_BLACK); |
805 init_pair(2, COLOR_GREEN, COLOR_BLACK); | 817 init_pair(2, COLOR_GREEN, COLOR_BLACK); |
815 init_pair(12, COLOR_GREEN, COLOR_RED); | 827 init_pair(12, COLOR_GREEN, COLOR_RED); |
816 init_pair(13, COLOR_YELLOW, COLOR_RED); | 828 init_pair(13, COLOR_YELLOW, COLOR_RED); |
817 init_pair(14, COLOR_BLUE, COLOR_RED); | 829 init_pair(14, COLOR_BLUE, COLOR_RED); |
818 init_pair(15, COLOR_MAGENTA, COLOR_RED); | 830 init_pair(15, COLOR_MAGENTA, COLOR_RED); |
819 init_pair(16, COLOR_CYAN, COLOR_RED); | 831 init_pair(16, COLOR_CYAN, COLOR_RED); |
820 | |
821 } | 832 } |
822 | 833 |
823 cursesInit = TRUE; | 834 cursesInit = TRUE; |
824 | 835 |
825 if (!initializeWindows()) | 836 if (!initializeWindows()) |