-#ifndef _NO_CURSES
+#undef _HAVE_CURSES
+
+#if _CURSES_LIB == 0
+#elif _CURSES_LIB == 1
#include <curses.h>
-#ifdef NCURSES_VERSION
+#ifndef NCURSES_VERSION
+#warning "_CURSES_LIB=1 but NCURSES_VERSION not defined; tview is NOT compiled"
+#else
+#define _HAVE_CURSES
+#endif
+#elif _CURSES_LIB == 2
+#include <xcurses.h>
+#define _HAVE_CURSES
+#else
+#warning "_CURSES_LIB is not 0, 1 or 2; tview is NOT compiled"
+#endif
+
+#ifdef _HAVE_CURSES
#include <ctype.h>
#include <assert.h>
#include <string.h>
clear();
noecho();
cbreak();
-#ifdef NCURSES_VERSION
+ tv->mrow = 24; tv->mcol = 80;
getmaxyx(stdscr, tv->mrow, tv->mcol);
-#else
- tv->mrow = 80; tv->mcol = 40;
-#endif
tv->wgoto = newwin(3, TV_MAX_GOTO + 10, 10, 5);
tv->whelp = newwin(27, 40, 5, 5);
tv->color_for = TV_COLOR_MAPQ;
tid = tv->curr_tid; pos = tv->left_pos;
while (1) {
int c = getch();
- //if(256 < c) {c = 1 + (c%256);} // Terminal was displaying ctrl-H as 263 via ssh from Mac OS X 10.5 computer
switch (c) {
case '?': tv_win_help(tv); break;
case '\033':
case 'k': ++tv->row_shift; break;
case KEY_BACKSPACE:
case '\177': pos -= tv->mcol; break;
-#ifdef KEY_RESIZE
case KEY_RESIZE: getmaxyx(stdscr, tv->mrow, tv->mcol); break;
-#endif
default: continue;
}
if (pos < 0) pos = 0;
fprintf(stderr, "[bam_tview_main] The ncurses library is unavailable; tview is not compiled.\n");
return 1;
}
-#endif
-#endif // #ifndef _NO_CURSES
+#endif // #ifdef _HAVE_CURSES