diff --git a/pdcurses/addch.c b/pdcurses/addch.c index fd4ca421..800b4958 100644 --- a/pdcurses/addch.c +++ b/pdcurses/addch.c @@ -40,7 +40,7 @@ #endif #ifdef PDCDEBUG -char *rcsid_addch = "$Id: addch.c,v 1.5 2006/01/06 10:32:16 wmcbrine Exp $"; +char *rcsid_addch = "$Id: addch.c,v 1.6 2006/01/27 15:03:37 wmcbrine Exp $"; #endif /*man-start********************************************************************* @@ -144,7 +144,7 @@ chtype ch; { PDC_LOG(("addch() - called: ch=%x\n", ch)); - return PDC_chadd( stdscr, ch, (bool)(!(SP->raw_out)), TRUE ); + return PDC_chadd(stdscr, ch, (bool)(!(SP->raw_out)), TRUE); } /***********************************************************************/ @@ -159,7 +159,7 @@ chtype ch; { PDC_LOG(("waddch() - called: win=%x ch=%x\n", win, ch)); - return PDC_chadd( win, ch, (bool)(!(SP->raw_out)), TRUE ); + return PDC_chadd(win, ch, (bool)(!(SP->raw_out)), TRUE); } /***********************************************************************/ @@ -178,7 +178,7 @@ chtype ch; if (move(y,x) == ERR) return ERR; - return PDC_chadd( stdscr, ch, (bool)(!(SP->raw_out)), TRUE ); + return PDC_chadd(stdscr, ch, (bool)(!(SP->raw_out)), TRUE); } /***********************************************************************/ @@ -199,7 +199,7 @@ chtype ch; if (wmove(win, y, x) == ERR) return ERR; - return PDC_chadd( win, ch, (bool)(!(SP->raw_out)), TRUE ); + return PDC_chadd(win, ch, (bool)(!(SP->raw_out)), TRUE); } /***********************************************************************/ @@ -213,7 +213,7 @@ chtype ch; { PDC_LOG(("echochar() - called: ch=%x\n", ch)); - if (PDC_chadd( stdscr, ch, (bool)(!(SP->raw_out)), TRUE ) == ERR) + if (PDC_chadd(stdscr, ch, (bool)(!(SP->raw_out)), TRUE) == ERR) return ERR; return refresh(); @@ -231,7 +231,7 @@ chtype ch; { PDC_LOG(("wechochar() - called: win=%x ch=%x\n", win, ch)); - if (PDC_chadd( win, ch, (bool)(!(SP->raw_out)), TRUE ) == ERR) + if (PDC_chadd(win, ch, (bool)(!(SP->raw_out)), TRUE) == ERR) return ERR; return wrefresh(win); diff --git a/pdcurses/border.c b/pdcurses/border.c index 5b032b67..449e38b0 100644 --- a/pdcurses/border.c +++ b/pdcurses/border.c @@ -40,7 +40,7 @@ #endif #ifdef PDCDEBUG -char *rcsid_border = "$Id: border.c,v 1.7 2006/01/13 01:17:59 wmcbrine Exp $"; +char *rcsid_border = "$Id: border.c,v 1.8 2006/01/27 15:03:37 wmcbrine Exp $"; #endif /*man-start********************************************************************* @@ -57,6 +57,10 @@ char *rcsid_border = "$Id: border.c,v 1.7 2006/01/13 01:17:59 wmcbrine Exp $"; int vline(chtype ch, int n); int whline(WINDOW *win, chtype ch, int n); int wvline(WINDOW *win, chtype ch, int n); + int mvhline(int y, int x, chtype ch, int n); + int mvvline(int y, int x, chtype ch, int n); + int mvwhline(WINDOW *win, int y, int x, chtype ch, int n); + int mvwvline(WINDOW *win, int y, int x, chtype ch, int n); int PDC_wunderline(WINDOW *win, int n, bool state); int PDC_wleftline(WINDOW *win, int n, bool state); int PDC_wrightline(WINDOW *win, int n, bool state); @@ -93,43 +97,29 @@ char *rcsid_border = "$Id: border.c,v 1.7 2006/01/13 01:17:59 wmcbrine Exp $"; X/Open Errors: No errors are defined for these functions. - Portability X/Open BSD SYS V PDCurses + Portability X/Open BSD SYS V Dec '88 - border - - 4.0 Y - wborder - - 4.0 Y - box Y Y Y Y - hline - - 4.0 Y - whline - - 4.0 Y - vline - - 4.0 Y - wvline - - 4.0 Y - PDC_wunderline - - - Y - PDC_wleftline - - - Y - PDC_wrightline - - - Y + border - - 4.0 + wborder - - 4.0 + box Y Y Y + hline - - 4.0 + vline - - 4.0 + whline - - 4.0 + wvline - - 4.0 + mvhline + mvvline + mvwhline + mvwvline + PDC_wunderline - - - + PDC_wleftline - - - + PDC_wrightline - - - **man-end**********************************************************************/ -/*man-start********************************************************************* - PDC_attr_passthru() - Combines chtype with current and/or background - attributes of a window - - PDCurses Description: - This is a private PDCurses function. - - Takes a single chtype 'ch' and checks if the current attribute - of window 'win', as set by wattrset(), and/or the current - background of win, as set by wbkgd(), should by combined with - it. Attributes set explicitly in ch take precedence. - - PDCurses Return Value: - Returns ch, combined (or not) with existing attributes. - - PDCurses Errors: - No errors are defined for this function. - - Portability: - PDCurses chtype PDC_attr_passthru( WINDOW *win, chtype ch ); - -**man-end**********************************************************************/ +/* PDC_attr_passthru() -- Takes a single chtype 'ch' and checks if the + current attribute of window 'win', as set by wattrset(), and/or the + current background of win, as set by wbkgd(), should by combined with + it. Attributes set explicitly in ch take precedence. */ /***********************************************************************/ #ifdef HAVE_PROTO @@ -143,15 +133,12 @@ chtype ch; { chtype attr, bktmp; - /* - * If the incoming character doesn't have its own attribute, - * then use the current attributes for the window. - * If the incoming character has attributes, but not a colour - * component, OR the attributes to the current attributes - * for the window. - * If the incoming character has a colour component, use only - * the attributes from the incoming character. - */ + /* If the incoming character doesn't have its own attribute, + then use the current attributes for the window. If the + incoming character has attributes, but not a colour + component, OR the attributes to the current attributes for + the window. If the incoming character has a colour component, + use only the attributes from the incoming character. */ if ((ch & A_ATTRIBUTES) == 0) attr = win->_attrs; @@ -161,10 +148,9 @@ chtype ch; else attr = (ch & A_ATTRIBUTES); - /* wrs (4/10/93) - * Apply the same sort of logic for the window background, in that it - * only takes precedence if other color attributes are not there. - */ + /* wrs (4/10/93) -- Apply the same sort of logic for the window + background, in that it only takes precedence if other color + attributes are not there. */ if ((attr & A_COLOR) == 0) attr = (attr | (win->_bkgd & A_ATTRIBUTES)); @@ -313,6 +299,21 @@ int n; return whline(stdscr, ch, n); } +/***********************************************************************/ +#ifdef HAVE_PROTO +int PDC_CDECL vline(chtype ch, int n) +#else +int PDC_CDECL vline(ch, n) +chtype ch; +int n; +#endif +/***********************************************************************/ +{ + PDC_LOG(("vline() - called\n")); + + return wvline(stdscr, ch, n); +} + /***********************************************************************/ #ifdef HAVE_PROTO int PDC_CDECL whline(WINDOW *win, chtype ch, int n) @@ -361,21 +362,6 @@ int n; return OK; } -/***********************************************************************/ -#ifdef HAVE_PROTO -int PDC_CDECL vline(chtype ch, int n) -#else -int PDC_CDECL vline(ch, n) -chtype ch; -int n; -#endif -/***********************************************************************/ -{ - PDC_LOG(("vline() - called\n")); - - return wvline(stdscr, ch, n); -} - /***********************************************************************/ #ifdef HAVE_PROTO int PDC_CDECL wvline(WINDOW *win, chtype ch, int n) @@ -424,18 +410,105 @@ int n; /***********************************************************************/ #ifdef HAVE_PROTO -int PDC_CDECL PDC_wunderline(WINDOW *win, int n, bool state) +int PDC_CDECL mvhline(int y, int x, chtype ch, int n) #else -int PDC_CDECL PDC_wunderline(win, n, state) +int PDC_CDECL mvhline(y, x, ch, n) +int y; +int x; +chtype ch; +int n; +#endif +/***********************************************************************/ +{ + PDC_LOG(("mvhline() - called\n")); + + if (move(y, x) == ERR) + return ERR; + + return whline(stdscr, ch, n); +} + +/***********************************************************************/ +#ifdef HAVE_PROTO +int PDC_CDECL mvvline(int y, int x, chtype ch, int n) +#else +int PDC_CDECL mvvline(y, x, ch, n) +int y; +int x; +chtype ch; +int n; +#endif +/***********************************************************************/ +{ + PDC_LOG(("mvvline() - called\n")); + + if (move(y, x) == ERR) + return ERR; + + return wvline(stdscr, ch, n); +} + +/***********************************************************************/ +#ifdef HAVE_PROTO +int PDC_CDECL mvwhline(WINDOW *win, int y, int x, chtype ch, int n) +#else +int PDC_CDECL mvwhline(win, y, x, ch, n) +WINDOW *win; +int y; +int x; +chtype ch; +int n; +#endif +/***********************************************************************/ +{ + PDC_LOG(("mvwhline() - called\n")); + + if (wmove(win, y, x) == ERR) + return ERR; + + return whline(win, ch, n); +} + +/***********************************************************************/ +#ifdef HAVE_PROTO +int PDC_CDECL mvwvline(WINDOW *win, int y, int x, chtype ch, int n) +#else +int PDC_CDECL mvwvline(win, y, x, ch, n) +WINDOW *win; +int y; +int x; +chtype ch; +int n; +#endif +/***********************************************************************/ +{ + PDC_LOG(("mvwvline() - called\n")); + + if (wmove(win, y, x) == ERR) + return ERR; + + return wvline(win, ch, n); +} + +/* PDC_lineattr() -- add the specified attribute to a line of chtypes. + Used only as the core routine for the next three functions. */ + +/***********************************************************************/ +#ifdef HAVE_PROTO +int PDC_CDECL PDC_lineattr(WINDOW *win, int n, bool state, + chtype attr) +#else +int PDC_CDECL PDC_lineattr(win, n, state, attr) WINDOW *win; int n; bool state; +chtype attr; #endif /***********************************************************************/ { int endpos; - PDC_LOG(("PDC_wunderline() - called\n")); + PDC_LOG(("PDC_lineattr() - called\n")); if (win == (WINDOW *)NULL) return ERR; @@ -448,9 +521,9 @@ bool state; for (n = win->_cury; n <= endpos; n++) { if (state) - win->_y[n][win->_curx] |= A_UNDERLINE; + win->_y[n][win->_curx] |= attr; else - win->_y[n][win->_curx] |= ~A_UNDERLINE; + win->_y[n][win->_curx] |= ~attr; if (win->_firstch[n] == _NO_CHANGE) { @@ -469,6 +542,22 @@ bool state; return OK; } +/***********************************************************************/ +#ifdef HAVE_PROTO +int PDC_CDECL PDC_wunderline(WINDOW *win, int n, bool state) +#else +int PDC_CDECL PDC_wunderline(win, n, state) +WINDOW *win; +int n; +bool state; +#endif +/***********************************************************************/ +{ + PDC_LOG(("PDC_wunderline() - called\n")); + + return PDC_lineattr(win, n, state, A_UNDERLINE); +} + /***********************************************************************/ #ifdef HAVE_PROTO int PDC_CDECL PDC_wleftline(WINDOW *win, int n, bool state) @@ -480,40 +569,9 @@ bool state; #endif /***********************************************************************/ { - int endpos; - PDC_LOG(("PDC_wleftline() - called\n")); - if (win == (WINDOW *)NULL) - return ERR ; - - if (n < 1) - return ERR; - - endpos = min(win->_cury + n - 1, win->_maxy); - - for (n = win->_cury; n <= endpos; n++) - { - if ( state ) - win->_y[n][win->_curx] |= A_LEFTLINE; - else - win->_y[n][win->_curx] |= ~A_LEFTLINE; - - if (win->_firstch[n] == _NO_CHANGE) - { - win->_firstch[n] = win->_curx; - win->_lastch[n] = win->_curx; - } - else - { - win->_firstch[n] = min(win->_firstch[n], win->_curx); - win->_lastch[n] = max(win->_lastch[n], win->_curx); - } - } - - PDC_sync(win); - - return OK; + return PDC_lineattr(win, n, state, A_LEFTLINE); } /***********************************************************************/ @@ -527,38 +585,7 @@ bool state; #endif /***********************************************************************/ { - int endpos; - PDC_LOG(("PDC_wrightline() - called\n")); - if (win == (WINDOW *)NULL) - return ERR; - - if (n < 1) - return ERR; - - endpos = min(win->_cury + n - 1, win->_maxy); - - for (n = win->_cury; n <= endpos; n++) - { - if (state) - win->_y[n][win->_curx] |= A_RIGHTLINE; - else - win->_y[n][win->_curx] |= ~A_RIGHTLINE; - - if (win->_firstch[n] == _NO_CHANGE) - { - win->_firstch[n] = win->_curx; - win->_lastch[n] = win->_curx; - } - else - { - win->_firstch[n] = min(win->_firstch[n], win->_curx); - win->_lastch[n] = max(win->_lastch[n], win->_curx); - } - } - - PDC_sync(win); - - return OK; + return PDC_lineattr(win, n, state, A_RIGHTLINE); }