diff options
Diffstat (limited to 'src/LYCurses.h')
-rw-r--r-- | src/LYCurses.h | 85 |
1 files changed, 58 insertions, 27 deletions
diff --git a/src/LYCurses.h b/src/LYCurses.h index 88b5786c..7dc13067 100644 --- a/src/LYCurses.h +++ b/src/LYCurses.h @@ -180,6 +180,21 @@ typedef struct { #define USE_MOUSE 1 #endif +/* + * If we have pads, use them to implement left/right scrolling. + */ +#if defined(HAVE_NEWPAD) && defined(HAVE_PNOUTREFRESH) +#define USE_CURSES_PADS 1 +#endif + +/* + * ncurses 1.9.9e won't work for pads, but 4.2 does (1.9.9g doesn't have a + * convenient ifdef, though it would work). + */ +#if defined(NCURSES_VERSION) && !defined(NCURSES_VERSION_MAJOR) +#undef USE_CURSES_PADS +#endif + #endif /* USE_SLANG */ #ifdef USE_SLANG @@ -240,26 +255,41 @@ extern WINDOW *LYstartPopup PARAMS((int top_y, int left_x, int height, int width #undef HAVE_KEYPAD /* avoid confusion with bogus 'keypad()' */ #endif -extern int LYlines; /* replaces LINES */ -extern int LYcols; /* replaces COLS */ +extern int LYlines; /* replaces LINES */ +extern int LYcols; /* replaces COLS */ + +#ifdef USE_CURSES_PADS +extern WINDOW *LYwin; +extern int LYshiftWin; +extern int LYlineWrap; +#else +#define LYwin stdscr +#endif #if defined(USE_COLOR_TABLE) || defined(USE_SLANG) extern int Current_Attr; extern int Masked_Attr; #endif -extern void start_curses NOPARAMS; -extern void stop_curses NOPARAMS; extern BOOLEAN setup PARAMS((char *terminal)); +extern int LYscreenHeight NOPARAMS; +extern int LYscreenWidth NOPARAMS; +extern void LYclear NOPARAMS; +extern void LYclrtoeol NOPARAMS; +extern void LYerase NOPARAMS; +extern void LYmove PARAMS((int y, int x)); extern void LYnoVideo PARAMS((int mask)); +extern void LYpaddstr PARAMS((WINDOW *w, int width, CONST char *s)); +extern void LYrefresh NOPARAMS; extern void LYstartTargetEmphasis NOPARAMS; extern void LYstopTargetEmphasis NOPARAMS; extern void LYtouchline PARAMS((int row)); extern void LYwaddnstr PARAMS((WINDOW *w, CONST char *s, size_t len)); -extern void LYpaddstr PARAMS((WINDOW *w, int width, CONST char *s)); +extern void start_curses NOPARAMS; +extern void stop_curses NOPARAMS; -#define LYaddstr(s) LYwaddnstr(stdscr, s, strlen(s)) -#define LYaddnstr(s,len) LYwaddnstr(stdscr, s, len) +#define LYaddstr(s) LYwaddnstr(LYwin, s, strlen(s)) +#define LYaddnstr(s,len) LYwaddnstr(LYwin, s, len) #define LYwaddstr(w,s) LYwaddnstr(w, s, strlen(s)) #ifdef VMS @@ -344,7 +374,7 @@ extern void LY_SLerase NOPARAMS; #define scrollok(a,b) SLsmg_Newline_Moves = ((b) ? 1 : -1) #endif -#define addch(ch) SLsmg_write_char(ch) +#define LYaddch(ch) SLsmg_write_char(ch) #define addch_raw(ch) do { \ SLsmg_Char_Type buf; \ buf = (ch) | (Current_Attr << 4); \ @@ -367,7 +397,7 @@ extern void LY_SLrefresh NOPARAMS; #ifdef VMS extern void VTHome NOPARAMS; -#define endwin() clear(),refresh(),SLsmg_reset_smg(),VTHome() +#define endwin() LYclear(),refresh(),SLsmg_reset_smg(),VTHome() #else #define endwin SLsmg_reset_smg(),SLang_reset_tty #endif /* VMS */ @@ -395,10 +425,9 @@ extern void VTHome NOPARAMS; #define stop_underline() clrattr(_UNDERLINE) #endif /* UNDERLINE_LINKS */ #define start_reverse() setattr(_REVERSE) -#define wstart_reverse(a) wsetattr(a, _REVERSE) -#define wstop_underline(a) wclrattr(a, _UNDERLINE) +#define wstart_reverse(w) wsetattr(w, _REVERSE) #define stop_reverse() clrattr(_REVERSE) -#define wstop_reverse(a) wclrattr(a, _REVERSE) +#define wstop_reverse(w) wclrattr(w, _REVERSE) #else /* Not VMS: */ @@ -420,10 +449,10 @@ extern int lynx_chg_color PARAMS((int, int, int)); #undef standend #define standend() lynx_standout(FALSE) #else -#define LYaddAttr attron -#define LYaddWAttr wattron -#define LYsubAttr attroff -#define LYsubWAttr wattroff +#define LYaddAttr(attr) LYaddWAttr(LYwin,attr) +#define LYaddWAttr(win,attr) wattron(win,attr) +#define LYsubAttr(attr) LYsubWAttr(LYwin,attr) +#define LYsubWAttr(win,attr) wattroff(win,attr) #endif #ifdef UNDERLINE_LINKS @@ -448,15 +477,15 @@ extern int lynx_chg_color PARAMS((int, int, int)); #endif /* UNDERLINE_LINKS */ #if defined(SNAKE) && defined(HP_TERMINAL) -#define start_reverse() LYaddWAttr(stdscr, A_DIM) -#define wstart_reverse(a) LYaddWAttr(a, A_DIM) -#define stop_reverse() LYsubWAttr(stdscr, A_DIM) -#define wstop_reverse(a) LYsubWAttr(a, A_DIM) +#define start_reverse() LYaddWAttr(LYwin, A_DIM) +#define wstart_reverse(w) LYaddWAttr(w, A_DIM) +#define stop_reverse() LYsubWAttr(LYwin, A_DIM) +#define wstop_reverse(w) LYsubWAttr(w, A_DIM) #else #define start_reverse() LYaddAttr(A_REVERSE) -#define wstart_reverse(a) LYaddWAttr(a, A_REVERSE) +#define wstart_reverse(w) LYaddWAttr(w, A_REVERSE) #define stop_reverse() LYsubAttr(A_REVERSE) -#define wstop_reverse(a) LYsubWAttr(a, A_REVERSE) +#define wstop_reverse(w) LYsubWAttr(w, A_REVERSE) #endif /* SNAKE && HP_TERMINAL */ #endif /* VMS */ @@ -487,7 +516,9 @@ FANCY_CURSES. Check your config.log to see why the FANCY_CURSES test failed. #endif /* FANCY_CURSES */ -#define addch_raw(ch) addch(ch) +#define LYaddch(ch) waddch(LYwin, ch) + +#define addch_raw(ch) LYaddch(ch) #endif /* USE_SLANG */ @@ -495,9 +526,9 @@ FANCY_CURSES. Check your config.log to see why the FANCY_CURSES test failed. #define LYGetYX(y, x) y = SLsmg_get_row(), x = SLsmg_get_column() #else #ifdef getyx -#define LYGetYX(y, x) getyx(stdscr, y, x) +#define LYGetYX(y, x) getyx(LYwin, y, x) #else -#define LYGetYX(y, x) y = stdscr->_cury, x = stdscr->_curx +#define LYGetYX(y, x) y = LYwin->_cury, x = LYwin->_curx #endif /* getyx */ #endif /* USE_SLANG */ @@ -554,9 +585,9 @@ extern void lynx_stop_all_colors NOPARAMS; * Adjust our "hidden" cursor position accordingly. */ #if defined(FANCY_CURSES) || defined(USE_SLANG) -#define LYHideCursor() move((LYlines - 1), (LYcols - 1)) +#define LYHideCursor() LYmove((LYlines - 1), (LYcols - 1)) #else -#define LYHideCursor() move((LYlines - 1), (LYcols - 2)) +#define LYHideCursor() LYmove((LYlines - 1), (LYcols - 2)) #endif extern void LYstowCursor PARAMS((WINDOW * win, int row, int col)); |