diff options
| author | Peter Wemm <peter@FreeBSD.org> | 1999-08-30 07:58:08 +0000 |
|---|---|---|
| committer | Peter Wemm <peter@FreeBSD.org> | 1999-08-30 07:58:08 +0000 |
| commit | 99af2e21c73f07587da16d34eb6795f4a46cc5be (patch) | |
| tree | 5df591f7e443330146099aa76e2f474a81669ebf /lib/libncurses/lib_pad.c | |
| parent | 02e1576966f0a3b9300a7269c3e6894e62b1f3ba (diff) | |
Notes
Diffstat (limited to 'lib/libncurses/lib_pad.c')
| -rw-r--r-- | lib/libncurses/lib_pad.c | 143 |
1 files changed, 0 insertions, 143 deletions
diff --git a/lib/libncurses/lib_pad.c b/lib/libncurses/lib_pad.c deleted file mode 100644 index 5b4aa9926fce..000000000000 --- a/lib/libncurses/lib_pad.c +++ /dev/null @@ -1,143 +0,0 @@ -/* This work is copyrighted. See COPYRIGHT.OLD & COPYRIGHT.NEW for * -* details. If they are missing then this copy is in violation of * -* the copyright conditions. */ - -/* - * lib_pad.c - * newpad -- create a new pad - * pnoutrefresh -- refresh a pad, no update - * pechochar -- add a char to a pad and refresh - */ - -#include <stdlib.h> -#include "curses.priv.h" - -WINDOW *newpad(int l, int c) -{ -WINDOW *win; -chtype *ptr; -int i, j; - - T(("newpad(%d, %d) called", l, c)); - - if (l <= 0 || c <= 0) - return NULL; - - if ((win = makenew(l,c,0,0)) == NULL) - return NULL; - - win->_flags |= _ISPAD; - - for (i = 0; i < l; i++) { - if ((win->_line[i] = (chtype *) calloc(c, sizeof(chtype))) == NULL) { - for (j = 0; j < i; j++) - free(win->_line[j]); - - free(win->_firstchar); - free(win->_lastchar); - free(win->_line); - free(win); - - return NULL; - } - else - for (ptr = win->_line[i]; ptr < win->_line[i] + c; ) - *ptr++ = ' '; - } - - T(("newpad: returned window is %x", win)); - - return(win); -} - -int prefresh(WINDOW *win, int pminrow, int pmincol, - int sminrow, int smincol, int smaxrow, int smaxcol) -{ - T(("prefresh() called")); - if (pnoutrefresh(win, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol) != ERR) - return (doupdate()); - else - return ERR; - -} - -int pnoutrefresh(WINDOW *win, int pminrow, int pmincol, - int sminrow, int smincol, int smaxrow, int smaxcol) -{ -int i, j; -int m, n; - - T(("pnoutrefresh(%x, %d, %d, %d, %d, %d, %d) called", - win, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol)); - - if (!(win->_flags & _ISPAD)) - return ERR; - - T(("one")); - if (pminrow < 0) pminrow = 0; - if (pmincol < 0) pmincol = 0; - if (sminrow < 0) sminrow = 0; - if (smincol < 0) smincol = 0; - - T(("two")); - if (smaxrow >= LINES || smaxcol >= COLS) - return ERR; - - T(("three")); - if ((pminrow + smaxrow - sminrow > win->_maxy) || - (pmincol + smaxcol - smincol > win->_maxx)) - return ERR; - - T(("pad being refreshed")); - - for (i = pminrow, m = sminrow; i <= pminrow + smaxrow-sminrow; - i++, m++) { - for (j = pmincol, n = smincol; j <= pmincol + smaxcol-smincol; - j++, n++) { - if (win->_line[i][j] != newscr->_line[m][n]) { - newscr->_line[m][n] = win->_line[i][j]; - - if (newscr->_firstchar[m] == _NOCHANGE) - newscr->_firstchar[m] = newscr->_lastchar[m] = n; - else if (n < newscr->_firstchar[m]) - newscr->_firstchar[m] = n; - else if (n > newscr->_lastchar[m]) - newscr->_lastchar[m] = n; - } - } - } - - win->_firstchar[i] = win->_lastchar[i] = _NOCHANGE; - - win->_begx = smincol; - win->_begy = sminrow; - - if (win->_clear) { - win->_clear = FALSE; - newscr->_clear = TRUE; - } - - if (! win->_leave) { - newscr->_cury = win->_cury + win->_begy; - newscr->_curx = win->_curx + win->_begx; - } - return OK; -} - -int pechochar(WINDOW *pad, chtype ch) -{ -int x, y; - - T(("echochar(%x, %x)", pad, ch)); - - if (pad->_flags & _ISPAD) - return ERR; - - x = pad->_begx + pad->_curx; - y = pad->_begy + pad->_cury; - - waddch(curscr, ch); - doupdate(); - return OK; -} - |
