curses 1.4.4 → 1.4.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +6 -0
- data/.github/workflows/macos.yml +1 -1
- data/.github/workflows/push_gem.yml +48 -0
- data/.github/workflows/ubuntu.yml +2 -2
- data/.github/workflows/windows.yml +2 -2
- data/History.md +23 -0
- data/README.md +7 -0
- data/curses.gemspec +1 -1
- data/ext/curses/curses.c +7 -7
- data/sample/colors.rb +6 -1
- data/sample/form.rb +1 -1
- data/sample/menu.rb +2 -0
- metadata +9 -251
- data/vendor/PDCurses/.gitignore +0 -47
- data/vendor/PDCurses/.travis.yml +0 -49
- data/vendor/PDCurses/CMakeLists.txt +0 -68
- data/vendor/PDCurses/HISTORY.md +0 -2036
- data/vendor/PDCurses/IMPLEMNT.md +0 -327
- data/vendor/PDCurses/Makefile +0 -27
- data/vendor/PDCurses/README.md +0 -77
- data/vendor/PDCurses/acs_defs.h +0 -265
- data/vendor/PDCurses/appveyor.yml +0 -218
- data/vendor/PDCurses/cmake/README.md +0 -71
- data/vendor/PDCurses/cmake/build_dependencies.cmake +0 -178
- data/vendor/PDCurses/cmake/build_options.cmake +0 -25
- data/vendor/PDCurses/cmake/dll_version.cmake +0 -26
- data/vendor/PDCurses/cmake/gen_config_header.cmake +0 -43
- data/vendor/PDCurses/cmake/get_version.cmake +0 -17
- data/vendor/PDCurses/cmake/make_uninstall.cmake +0 -19
- data/vendor/PDCurses/cmake/project_common.cmake +0 -121
- data/vendor/PDCurses/cmake/resource.in.cmake +0 -52
- data/vendor/PDCurses/cmake/sdl2_ttf/CMakeLists.txt +0 -83
- data/vendor/PDCurses/cmake/target_arch.cmake +0 -36
- data/vendor/PDCurses/cmake/version.in.cmake +0 -73
- data/vendor/PDCurses/cmake/watcom_open_dos16_toolchain.cmake +0 -96
- data/vendor/PDCurses/cmake/watcom_open_dos32_toolchain.cmake +0 -106
- data/vendor/PDCurses/cmake/watcom_open_os2v2_toolchain.cmake +0 -105
- data/vendor/PDCurses/curses.h +0 -1846
- data/vendor/PDCurses/curspriv.h +0 -134
- data/vendor/PDCurses/demos/README.md +0 -25
- data/vendor/PDCurses/demos/firework.c +0 -144
- data/vendor/PDCurses/demos/newtest.c +0 -581
- data/vendor/PDCurses/demos/ozdemo.c +0 -447
- data/vendor/PDCurses/demos/ptest.c +0 -283
- data/vendor/PDCurses/demos/rain.c +0 -157
- data/vendor/PDCurses/demos/testcurs.c +0 -1607
- data/vendor/PDCurses/demos/tui.c +0 -1048
- data/vendor/PDCurses/demos/tui.h +0 -65
- data/vendor/PDCurses/demos/tuidemo.c +0 -233
- data/vendor/PDCurses/demos/version.c +0 -61
- data/vendor/PDCurses/demos/worm.c +0 -432
- data/vendor/PDCurses/demos/xmas.c +0 -955
- data/vendor/PDCurses/dos/CMakeLists.txt +0 -47
- data/vendor/PDCurses/dos/Makefile +0 -105
- data/vendor/PDCurses/dos/Makefile.bcc +0 -83
- data/vendor/PDCurses/dos/Makefile.dmc +0 -257
- data/vendor/PDCurses/dos/Makefile.msc +0 -113
- data/vendor/PDCurses/dos/Makefile.wcc +0 -107
- data/vendor/PDCurses/dos/README.md +0 -51
- data/vendor/PDCurses/dos/bccdos.lrf +0 -9
- data/vendor/PDCurses/dos/mscdos.lrf +0 -50
- data/vendor/PDCurses/dos/pdcclip.c +0 -132
- data/vendor/PDCurses/dos/pdcdisp.c +0 -135
- data/vendor/PDCurses/dos/pdcdos.h +0 -194
- data/vendor/PDCurses/dos/pdcgetsc.c +0 -98
- data/vendor/PDCurses/dos/pdckbd.c +0 -513
- data/vendor/PDCurses/dos/pdcscrn.c +0 -785
- data/vendor/PDCurses/dos/pdcsetsc.c +0 -101
- data/vendor/PDCurses/dos/pdcutil.c +0 -212
- data/vendor/PDCurses/libobjs.mif +0 -26
- data/vendor/PDCurses/makedist.mif +0 -20
- data/vendor/PDCurses/man/Makefile +0 -37
- data/vendor/PDCurses/man/README.md +0 -21
- data/vendor/PDCurses/man/intro.md +0 -361
- data/vendor/PDCurses/man/manext.c +0 -119
- data/vendor/PDCurses/man/sdl.md +0 -152
- data/vendor/PDCurses/man/sdl2.md +0 -58
- data/vendor/PDCurses/man/x11.md +0 -407
- data/vendor/PDCurses/ncurses/CMakeLists.txt +0 -66
- data/vendor/PDCurses/ncurses/README.md +0 -26
- data/vendor/PDCurses/ncurses/makefile +0 -29
- data/vendor/PDCurses/os2/CMakeLists.txt +0 -41
- data/vendor/PDCurses/os2/Makefile +0 -132
- data/vendor/PDCurses/os2/Makefile.bcc +0 -90
- data/vendor/PDCurses/os2/Makefile.wcc +0 -43
- data/vendor/PDCurses/os2/README.md +0 -43
- data/vendor/PDCurses/os2/iccos2.lrf +0 -50
- data/vendor/PDCurses/os2/iccos2.mak +0 -256
- data/vendor/PDCurses/os2/pdcclip.c +0 -188
- data/vendor/PDCurses/os2/pdcdisp.c +0 -93
- data/vendor/PDCurses/os2/pdcgetsc.c +0 -89
- data/vendor/PDCurses/os2/pdckbd.c +0 -521
- data/vendor/PDCurses/os2/pdcos2.h +0 -55
- data/vendor/PDCurses/os2/pdcscrn.c +0 -449
- data/vendor/PDCurses/os2/pdcsetsc.c +0 -112
- data/vendor/PDCurses/os2/pdcutil.c +0 -52
- data/vendor/PDCurses/panel.h +0 -56
- data/vendor/PDCurses/pdcurses/README.md +0 -25
- data/vendor/PDCurses/pdcurses/addch.c +0 -693
- data/vendor/PDCurses/pdcurses/addchstr.c +0 -245
- data/vendor/PDCurses/pdcurses/addstr.c +0 -240
- data/vendor/PDCurses/pdcurses/attr.c +0 -359
- data/vendor/PDCurses/pdcurses/beep.c +0 -68
- data/vendor/PDCurses/pdcurses/bkgd.c +0 -223
- data/vendor/PDCurses/pdcurses/border.c +0 -411
- data/vendor/PDCurses/pdcurses/clear.c +0 -159
- data/vendor/PDCurses/pdcurses/color.c +0 -298
- data/vendor/PDCurses/pdcurses/debug.c +0 -109
- data/vendor/PDCurses/pdcurses/delch.c +0 -96
- data/vendor/PDCurses/pdcurses/deleteln.c +0 -211
- data/vendor/PDCurses/pdcurses/deprec.c +0 -27
- data/vendor/PDCurses/pdcurses/getch.c +0 -417
- data/vendor/PDCurses/pdcurses/getstr.c +0 -474
- data/vendor/PDCurses/pdcurses/getyx.c +0 -139
- data/vendor/PDCurses/pdcurses/inch.c +0 -127
- data/vendor/PDCurses/pdcurses/inchstr.c +0 -214
- data/vendor/PDCurses/pdcurses/initscr.c +0 -367
- data/vendor/PDCurses/pdcurses/inopts.c +0 -324
- data/vendor/PDCurses/pdcurses/insch.c +0 -271
- data/vendor/PDCurses/pdcurses/insstr.c +0 -264
- data/vendor/PDCurses/pdcurses/instr.c +0 -246
- data/vendor/PDCurses/pdcurses/kernel.c +0 -259
- data/vendor/PDCurses/pdcurses/keyname.c +0 -157
- data/vendor/PDCurses/pdcurses/mouse.c +0 -438
- data/vendor/PDCurses/pdcurses/move.c +0 -57
- data/vendor/PDCurses/pdcurses/outopts.c +0 -159
- data/vendor/PDCurses/pdcurses/overlay.c +0 -214
- data/vendor/PDCurses/pdcurses/pad.c +0 -260
- data/vendor/PDCurses/pdcurses/panel.c +0 -633
- data/vendor/PDCurses/pdcurses/printw.c +0 -126
- data/vendor/PDCurses/pdcurses/refresh.c +0 -279
- data/vendor/PDCurses/pdcurses/scanw.c +0 -578
- data/vendor/PDCurses/pdcurses/scr_dump.c +0 -213
- data/vendor/PDCurses/pdcurses/scroll.c +0 -101
- data/vendor/PDCurses/pdcurses/slk.c +0 -591
- data/vendor/PDCurses/pdcurses/termattr.c +0 -182
- data/vendor/PDCurses/pdcurses/terminfo.c +0 -217
- data/vendor/PDCurses/pdcurses/touch.c +0 -163
- data/vendor/PDCurses/pdcurses/util.c +0 -312
- data/vendor/PDCurses/pdcurses/window.c +0 -569
- data/vendor/PDCurses/sdl1/Makefile +0 -129
- data/vendor/PDCurses/sdl1/Makefile.mng +0 -110
- data/vendor/PDCurses/sdl1/README.md +0 -31
- data/vendor/PDCurses/sdl1/deffont.h +0 -385
- data/vendor/PDCurses/sdl1/deficon.h +0 -23
- data/vendor/PDCurses/sdl1/pdcclip.c +0 -131
- data/vendor/PDCurses/sdl1/pdcdisp.c +0 -373
- data/vendor/PDCurses/sdl1/pdcgetsc.c +0 -30
- data/vendor/PDCurses/sdl1/pdckbd.c +0 -405
- data/vendor/PDCurses/sdl1/pdcscrn.c +0 -414
- data/vendor/PDCurses/sdl1/pdcsdl.h +0 -31
- data/vendor/PDCurses/sdl1/pdcsetsc.c +0 -64
- data/vendor/PDCurses/sdl1/pdcutil.c +0 -40
- data/vendor/PDCurses/sdl1/sdltest.c +0 -79
- data/vendor/PDCurses/sdl2/CMakeLists.txt +0 -76
- data/vendor/PDCurses/sdl2/Makefile +0 -135
- data/vendor/PDCurses/sdl2/Makefile.vc +0 -164
- data/vendor/PDCurses/sdl2/README.md +0 -34
- data/vendor/PDCurses/sdl2/deffont.h +0 -385
- data/vendor/PDCurses/sdl2/deficon.h +0 -23
- data/vendor/PDCurses/sdl2/pdcclip.c +0 -93
- data/vendor/PDCurses/sdl2/pdcdisp.c +0 -534
- data/vendor/PDCurses/sdl2/pdcgetsc.c +0 -30
- data/vendor/PDCurses/sdl2/pdckbd.c +0 -480
- data/vendor/PDCurses/sdl2/pdcscrn.c +0 -443
- data/vendor/PDCurses/sdl2/pdcsdl.h +0 -33
- data/vendor/PDCurses/sdl2/pdcsetsc.c +0 -67
- data/vendor/PDCurses/sdl2/pdcutil.c +0 -39
- data/vendor/PDCurses/sdl2/sdltest.c +0 -81
- data/vendor/PDCurses/term.h +0 -48
- data/vendor/PDCurses/version.mif +0 -7
- data/vendor/PDCurses/vt/CMakeLists.txt +0 -28
- data/vendor/PDCurses/vt/Makefile +0 -135
- data/vendor/PDCurses/vt/Makefile.bcc +0 -111
- data/vendor/PDCurses/vt/Makefile.dmc +0 -258
- data/vendor/PDCurses/vt/Makefile.vc +0 -144
- data/vendor/PDCurses/vt/Makefile.wcc +0 -107
- data/vendor/PDCurses/vt/README.md +0 -64
- data/vendor/PDCurses/vt/pdcclip.c +0 -20
- data/vendor/PDCurses/vt/pdcdisp.c +0 -284
- data/vendor/PDCurses/vt/pdcgetsc.c +0 -27
- data/vendor/PDCurses/vt/pdckbd.c +0 -394
- data/vendor/PDCurses/vt/pdcscrn.c +0 -434
- data/vendor/PDCurses/vt/pdcsetsc.c +0 -45
- data/vendor/PDCurses/vt/pdcutil.c +0 -43
- data/vendor/PDCurses/vt/pdcvt.h +0 -16
- data/vendor/PDCurses/watcom.mif +0 -68
- data/vendor/PDCurses/wincon/CMakeLists.txt +0 -27
- data/vendor/PDCurses/wincon/Makefile.bcc +0 -88
- data/vendor/PDCurses/wincon/Makefile.dmc +0 -256
- data/vendor/PDCurses/wincon/Makefile.lcc +0 -273
- data/vendor/PDCurses/wincon/Makefile.mng +0 -176
- data/vendor/PDCurses/wincon/Makefile.vc +0 -144
- data/vendor/PDCurses/wincon/Makefile.wcc +0 -51
- data/vendor/PDCurses/wincon/README.md +0 -85
- data/vendor/PDCurses/wincon/pdcclip.c +0 -174
- data/vendor/PDCurses/wincon/pdcdisp.c +0 -143
- data/vendor/PDCurses/wincon/pdcgetsc.c +0 -55
- data/vendor/PDCurses/wincon/pdckbd.c +0 -786
- data/vendor/PDCurses/wincon/pdcscrn.c +0 -717
- data/vendor/PDCurses/wincon/pdcsetsc.c +0 -91
- data/vendor/PDCurses/wincon/pdcurses.ico +0 -0
- data/vendor/PDCurses/wincon/pdcurses.rc +0 -28
- data/vendor/PDCurses/wincon/pdcutil.c +0 -41
- data/vendor/PDCurses/wincon/pdcwin.h +0 -31
- data/vendor/PDCurses/wingui/CMakeLists.txt +0 -27
- data/vendor/PDCurses/wingui/Makefile.bcc +0 -85
- data/vendor/PDCurses/wingui/Makefile.dmc +0 -259
- data/vendor/PDCurses/wingui/Makefile.lcc +0 -273
- data/vendor/PDCurses/wingui/Makefile.mng +0 -171
- data/vendor/PDCurses/wingui/Makefile.vc +0 -144
- data/vendor/PDCurses/wingui/Makefile.wcc +0 -51
- data/vendor/PDCurses/wingui/README.md +0 -93
- data/vendor/PDCurses/wingui/pdcclip.c +0 -174
- data/vendor/PDCurses/wingui/pdcdisp.c +0 -718
- data/vendor/PDCurses/wingui/pdcgetsc.c +0 -30
- data/vendor/PDCurses/wingui/pdckbd.c +0 -143
- data/vendor/PDCurses/wingui/pdcscrn.c +0 -2797
- data/vendor/PDCurses/wingui/pdcsetsc.c +0 -89
- data/vendor/PDCurses/wingui/pdcurses.ico +0 -0
- data/vendor/PDCurses/wingui/pdcurses.rc +0 -28
- data/vendor/PDCurses/wingui/pdcutil.c +0 -61
- data/vendor/PDCurses/wingui/pdcwin.h +0 -122
- data/vendor/PDCurses/x11/Makefile.in +0 -754
- data/vendor/PDCurses/x11/PDCurses.spec +0 -82
- data/vendor/PDCurses/x11/README.md +0 -62
- data/vendor/PDCurses/x11/ScrollBox.c +0 -319
- data/vendor/PDCurses/x11/ScrollBox.h +0 -51
- data/vendor/PDCurses/x11/ScrollBoxP.h +0 -70
- data/vendor/PDCurses/x11/aclocal.m4 +0 -994
- data/vendor/PDCurses/x11/big_icon.xbm +0 -46
- data/vendor/PDCurses/x11/compose.h +0 -201
- data/vendor/PDCurses/x11/config.guess +0 -1500
- data/vendor/PDCurses/x11/config.h.in +0 -100
- data/vendor/PDCurses/x11/config.sub +0 -1616
- data/vendor/PDCurses/x11/configure +0 -6700
- data/vendor/PDCurses/x11/configure.ac +0 -295
- data/vendor/PDCurses/x11/debian/changelog +0 -6
- data/vendor/PDCurses/x11/debian/compat +0 -1
- data/vendor/PDCurses/x11/debian/control +0 -11
- data/vendor/PDCurses/x11/debian/copyright +0 -27
- data/vendor/PDCurses/x11/debian/rules +0 -98
- data/vendor/PDCurses/x11/install-sh +0 -253
- data/vendor/PDCurses/x11/little_icon.xbm +0 -14
- data/vendor/PDCurses/x11/ncurses_cfg.h +0 -45
- data/vendor/PDCurses/x11/pdcclip.c +0 -173
- data/vendor/PDCurses/x11/pdcdisp.c +0 -85
- data/vendor/PDCurses/x11/pdcgetsc.c +0 -28
- data/vendor/PDCurses/x11/pdckbd.c +0 -104
- data/vendor/PDCurses/x11/pdcscrn.c +0 -258
- data/vendor/PDCurses/x11/pdcsetsc.c +0 -95
- data/vendor/PDCurses/x11/pdcutil.c +0 -52
- data/vendor/PDCurses/x11/pdcx11.c +0 -316
- data/vendor/PDCurses/x11/pdcx11.h +0 -191
- data/vendor/PDCurses/x11/sb.c +0 -155
- data/vendor/PDCurses/x11/x11.c +0 -3686
- data/vendor/PDCurses/x11/xcurses-config.in +0 -81
@@ -1,214 +0,0 @@
|
|
1
|
-
/* Public Domain Curses */
|
2
|
-
|
3
|
-
#include <curspriv.h>
|
4
|
-
|
5
|
-
/*man-start**************************************************************
|
6
|
-
|
7
|
-
overlay
|
8
|
-
-------
|
9
|
-
|
10
|
-
### Synopsis
|
11
|
-
|
12
|
-
int overlay(const WINDOW *src_w, WINDOW *dst_w)
|
13
|
-
int overwrite(const WINDOW *src_w, WINDOW *dst_w)
|
14
|
-
int copywin(const WINDOW *src_w, WINDOW *dst_w, int src_tr,
|
15
|
-
int src_tc, int dst_tr, int dst_tc, int dst_br,
|
16
|
-
int dst_bc, bool overlay)
|
17
|
-
|
18
|
-
### Description
|
19
|
-
|
20
|
-
overlay() and overwrite() copy all the text from src_w into
|
21
|
-
dst_w. The windows need not be the same size. Those characters
|
22
|
-
in the source window that intersect with the destination window
|
23
|
-
are copied, so that the characters appear in the same physical
|
24
|
-
position on the screen. The difference between the two functions
|
25
|
-
is that overlay() is non-destructive (blanks are not copied)
|
26
|
-
while overwrite() is destructive (blanks are copied).
|
27
|
-
|
28
|
-
copywin() is similar, but doesn't require that the two windows
|
29
|
-
overlap. The arguments src_tc and src_tr specify the top left
|
30
|
-
corner of the region to be copied. dst_tc, dst_tr, dst_br, and
|
31
|
-
dst_bc specify the region within the destination window to copy
|
32
|
-
to. The argument "overlay", if TRUE, indicates that the copy is
|
33
|
-
done non-destructively (as in overlay()); blanks in the source
|
34
|
-
window are not copied to the destination window. When overlay is
|
35
|
-
FALSE, blanks are copied.
|
36
|
-
|
37
|
-
### Return Value
|
38
|
-
|
39
|
-
All functions return OK on success and ERR on error.
|
40
|
-
|
41
|
-
### Portability
|
42
|
-
X/Open BSD SYS V
|
43
|
-
overlay Y Y Y
|
44
|
-
overwrite Y Y Y
|
45
|
-
copywin Y - 3.0
|
46
|
-
|
47
|
-
**man-end****************************************************************/
|
48
|
-
|
49
|
-
/* Thanks to Andreas Otte <venn@@uni-paderborn.de> for the
|
50
|
-
corrected overlay()/overwrite() behavior. */
|
51
|
-
|
52
|
-
static int _copy_win(const WINDOW *src_w, WINDOW *dst_w, int src_tr,
|
53
|
-
int src_tc, int src_br, int src_bc, int dst_tr,
|
54
|
-
int dst_tc, bool _overlay)
|
55
|
-
{
|
56
|
-
int col, line, y1, fc, *minchng, *maxchng;
|
57
|
-
chtype *w1ptr, *w2ptr;
|
58
|
-
|
59
|
-
int lc = 0;
|
60
|
-
int xdiff = src_bc - src_tc;
|
61
|
-
int ydiff = src_br - src_tr;
|
62
|
-
|
63
|
-
if (!src_w || !dst_w)
|
64
|
-
return ERR;
|
65
|
-
|
66
|
-
minchng = dst_w->_firstch;
|
67
|
-
maxchng = dst_w->_lastch;
|
68
|
-
|
69
|
-
for (y1 = 0; y1 < dst_tr; y1++)
|
70
|
-
{
|
71
|
-
minchng++;
|
72
|
-
maxchng++;
|
73
|
-
}
|
74
|
-
|
75
|
-
for (line = 0; line < ydiff; line++)
|
76
|
-
{
|
77
|
-
w1ptr = src_w->_y[line + src_tr] + src_tc;
|
78
|
-
w2ptr = dst_w->_y[line + dst_tr] + dst_tc;
|
79
|
-
|
80
|
-
fc = _NO_CHANGE;
|
81
|
-
|
82
|
-
for (col = 0; col < xdiff; col++)
|
83
|
-
{
|
84
|
-
if ((*w1ptr) != (*w2ptr) &&
|
85
|
-
!((*w1ptr & A_CHARTEXT) == ' ' && _overlay))
|
86
|
-
{
|
87
|
-
*w2ptr = *w1ptr;
|
88
|
-
|
89
|
-
if (fc == _NO_CHANGE)
|
90
|
-
fc = col + dst_tc;
|
91
|
-
|
92
|
-
lc = col + dst_tc;
|
93
|
-
}
|
94
|
-
|
95
|
-
w1ptr++;
|
96
|
-
w2ptr++;
|
97
|
-
}
|
98
|
-
|
99
|
-
if (*minchng == _NO_CHANGE)
|
100
|
-
{
|
101
|
-
*minchng = fc;
|
102
|
-
*maxchng = lc;
|
103
|
-
}
|
104
|
-
else if (fc != _NO_CHANGE)
|
105
|
-
{
|
106
|
-
if (fc < *minchng)
|
107
|
-
*minchng = fc;
|
108
|
-
if (lc > *maxchng)
|
109
|
-
*maxchng = lc;
|
110
|
-
}
|
111
|
-
|
112
|
-
minchng++;
|
113
|
-
maxchng++;
|
114
|
-
}
|
115
|
-
|
116
|
-
return OK;
|
117
|
-
}
|
118
|
-
|
119
|
-
int _copy_overlap(const WINDOW *src_w, WINDOW *dst_w, bool overlay)
|
120
|
-
{
|
121
|
-
int first_line, first_col, last_line, last_col;
|
122
|
-
int src_start_x, src_start_y, dst_start_x, dst_start_y;
|
123
|
-
int xdiff, ydiff;
|
124
|
-
|
125
|
-
if (!src_w || !dst_w)
|
126
|
-
return ERR;
|
127
|
-
|
128
|
-
first_col = max(dst_w->_begx, src_w->_begx);
|
129
|
-
first_line = max(dst_w->_begy, src_w->_begy);
|
130
|
-
|
131
|
-
last_col = min(src_w->_begx + src_w->_maxx, dst_w->_begx + dst_w->_maxx);
|
132
|
-
last_line = min(src_w->_begy + src_w->_maxy, dst_w->_begy + dst_w->_maxy);
|
133
|
-
|
134
|
-
/* determine the overlapping region of the two windows in real
|
135
|
-
coordinates */
|
136
|
-
|
137
|
-
/* if no overlapping region, do nothing */
|
138
|
-
|
139
|
-
if ((last_col < first_col) || (last_line < first_line))
|
140
|
-
return OK;
|
141
|
-
|
142
|
-
/* size of overlapping region */
|
143
|
-
|
144
|
-
xdiff = last_col - first_col;
|
145
|
-
ydiff = last_line - first_line;
|
146
|
-
|
147
|
-
if (src_w->_begx <= dst_w->_begx)
|
148
|
-
{
|
149
|
-
src_start_x = dst_w->_begx - src_w->_begx;
|
150
|
-
dst_start_x = 0;
|
151
|
-
}
|
152
|
-
else
|
153
|
-
{
|
154
|
-
dst_start_x = src_w->_begx - dst_w->_begx;
|
155
|
-
src_start_x = 0;
|
156
|
-
}
|
157
|
-
|
158
|
-
if (src_w->_begy <= dst_w->_begy)
|
159
|
-
{
|
160
|
-
src_start_y = dst_w->_begy - src_w->_begy;
|
161
|
-
dst_start_y = 0;
|
162
|
-
}
|
163
|
-
else
|
164
|
-
{
|
165
|
-
dst_start_y = src_w->_begy - dst_w->_begy;
|
166
|
-
src_start_y = 0;
|
167
|
-
}
|
168
|
-
|
169
|
-
return _copy_win(src_w, dst_w, src_start_y, src_start_x,
|
170
|
-
src_start_y + ydiff, src_start_x + xdiff,
|
171
|
-
dst_start_y, dst_start_x, overlay);
|
172
|
-
}
|
173
|
-
|
174
|
-
int overlay(const WINDOW *src_w, WINDOW *dst_w)
|
175
|
-
{
|
176
|
-
PDC_LOG(("overlay() - called\n"));
|
177
|
-
|
178
|
-
return _copy_overlap(src_w, dst_w, TRUE);
|
179
|
-
}
|
180
|
-
|
181
|
-
int overwrite(const WINDOW *src_w, WINDOW *dst_w)
|
182
|
-
{
|
183
|
-
PDC_LOG(("overwrite() - called\n"));
|
184
|
-
|
185
|
-
return _copy_overlap(src_w, dst_w, FALSE);
|
186
|
-
}
|
187
|
-
|
188
|
-
int copywin(const WINDOW *src_w, WINDOW *dst_w, int src_tr, int src_tc,
|
189
|
-
int dst_tr, int dst_tc, int dst_br, int dst_bc, int _overlay)
|
190
|
-
{
|
191
|
-
int src_end_x, src_end_y;
|
192
|
-
int src_rows, src_cols, dst_rows, dst_cols;
|
193
|
-
int min_rows, min_cols;
|
194
|
-
|
195
|
-
PDC_LOG(("copywin() - called\n"));
|
196
|
-
|
197
|
-
if (!src_w || !dst_w || dst_w == curscr || dst_br >= dst_w->_maxy
|
198
|
-
|| dst_bc >= dst_w->_maxx || dst_tr < 0 || dst_tc < 0)
|
199
|
-
return ERR;
|
200
|
-
|
201
|
-
src_rows = src_w->_maxy - src_tr;
|
202
|
-
src_cols = src_w->_maxx - src_tc;
|
203
|
-
dst_rows = dst_br - dst_tr + 1;
|
204
|
-
dst_cols = dst_bc - dst_tc + 1;
|
205
|
-
|
206
|
-
min_rows = min(src_rows, dst_rows);
|
207
|
-
min_cols = min(src_cols, dst_cols);
|
208
|
-
|
209
|
-
src_end_y = src_tr + min_rows;
|
210
|
-
src_end_x = src_tc + min_cols;
|
211
|
-
|
212
|
-
return _copy_win(src_w, dst_w, src_tr, src_tc, src_end_y, src_end_x,
|
213
|
-
dst_tr, dst_tc, (bool)_overlay);
|
214
|
-
}
|
@@ -1,260 +0,0 @@
|
|
1
|
-
/* Public Domain Curses */
|
2
|
-
|
3
|
-
#include <curspriv.h>
|
4
|
-
|
5
|
-
/*man-start**************************************************************
|
6
|
-
|
7
|
-
pad
|
8
|
-
---
|
9
|
-
|
10
|
-
### Synopsis
|
11
|
-
|
12
|
-
WINDOW *newpad(int nlines, int ncols);
|
13
|
-
WINDOW *subpad(WINDOW *orig, int nlines, int ncols,
|
14
|
-
int begy, int begx);
|
15
|
-
int prefresh(WINDOW *win, int py, int px, int sy1, int sx1,
|
16
|
-
int sy2, int sx2);
|
17
|
-
int pnoutrefresh(WINDOW *w, int py, int px, int sy1, int sx1,
|
18
|
-
int sy2, int sx2);
|
19
|
-
int pechochar(WINDOW *pad, chtype ch);
|
20
|
-
int pecho_wchar(WINDOW *pad, const cchar_t *wch);
|
21
|
-
|
22
|
-
### Description
|
23
|
-
|
24
|
-
A pad is a special kind of window, which is not restricted by
|
25
|
-
the screen size, and is not necessarily associated with a
|
26
|
-
particular part of the screen. You can use a pad when you need
|
27
|
-
a large window, and only a part of the window will be on the
|
28
|
-
screen at one time. Pads are not refreshed automatically (e.g.,
|
29
|
-
from scrolling or echoing of input). You can't call wrefresh()
|
30
|
-
with a pad as an argument; use prefresh() or pnoutrefresh()
|
31
|
-
instead. Note that these routines require additional parameters
|
32
|
-
to specify the part of the pad to be displayed, and the location
|
33
|
-
to use on the screen.
|
34
|
-
|
35
|
-
newpad() creates a new pad data structure.
|
36
|
-
|
37
|
-
subpad() creates a new sub-pad within a pad, at position (begy,
|
38
|
-
begx), with dimensions of nlines lines and ncols columns. This
|
39
|
-
position is relative to the pad, and not to the screen as with
|
40
|
-
subwin. Changes to either the parent pad or sub-pad will affect
|
41
|
-
both. When using sub-pads, you may need to call touchwin()
|
42
|
-
before calling prefresh().
|
43
|
-
|
44
|
-
pnoutrefresh() copies the specified pad to the virtual screen.
|
45
|
-
|
46
|
-
prefresh() calls pnoutrefresh(), followed by doupdate().
|
47
|
-
|
48
|
-
These routines are analogous to wnoutrefresh() and wrefresh().
|
49
|
-
(py, px) specifies the upper left corner of the part of the pad
|
50
|
-
to be displayed; (sy1, sx1) and (sy2, sx2) describe the screen
|
51
|
-
rectangle that will contain the selected part of the pad.
|
52
|
-
|
53
|
-
pechochar() is functionally equivalent to addch() followed by
|
54
|
-
a call to prefresh(), with the last-used coordinates and
|
55
|
-
dimensions. pecho_wchar() is the wide-character version.
|
56
|
-
|
57
|
-
### Return Value
|
58
|
-
|
59
|
-
All functions return OK on success and ERR on error.
|
60
|
-
|
61
|
-
### Portability
|
62
|
-
X/Open BSD SYS V
|
63
|
-
newpad Y - Y
|
64
|
-
subpad Y - Y
|
65
|
-
prefresh Y - Y
|
66
|
-
pnoutrefresh Y - Y
|
67
|
-
pechochar Y - 3.0
|
68
|
-
pecho_wchar Y
|
69
|
-
|
70
|
-
**man-end****************************************************************/
|
71
|
-
|
72
|
-
#include <string.h>
|
73
|
-
|
74
|
-
/* save values for pechochar() */
|
75
|
-
|
76
|
-
static int save_pminrow, save_pmincol;
|
77
|
-
static int save_sminrow, save_smincol, save_smaxrow, save_smaxcol;
|
78
|
-
|
79
|
-
WINDOW *newpad(int nlines, int ncols)
|
80
|
-
{
|
81
|
-
WINDOW *win;
|
82
|
-
|
83
|
-
PDC_LOG(("newpad() - called: lines=%d cols=%d\n", nlines, ncols));
|
84
|
-
|
85
|
-
if ( !(win = PDC_makenew(nlines, ncols, 0, 0))
|
86
|
-
|| !(win = PDC_makelines(win)) )
|
87
|
-
return (WINDOW *)NULL;
|
88
|
-
|
89
|
-
werase(win);
|
90
|
-
|
91
|
-
win->_flags = _PAD;
|
92
|
-
|
93
|
-
/* save default values in case pechochar() is the first call to
|
94
|
-
prefresh(). */
|
95
|
-
|
96
|
-
save_pminrow = 0;
|
97
|
-
save_pmincol = 0;
|
98
|
-
save_sminrow = 0;
|
99
|
-
save_smincol = 0;
|
100
|
-
save_smaxrow = min(LINES, nlines) - 1;
|
101
|
-
save_smaxcol = min(COLS, ncols) - 1;
|
102
|
-
|
103
|
-
return win;
|
104
|
-
}
|
105
|
-
|
106
|
-
WINDOW *subpad(WINDOW *orig, int nlines, int ncols, int begy, int begx)
|
107
|
-
{
|
108
|
-
WINDOW *win;
|
109
|
-
int i;
|
110
|
-
|
111
|
-
PDC_LOG(("subpad() - called: lines=%d cols=%d begy=%d begx=%d\n",
|
112
|
-
nlines, ncols, begy, begx));
|
113
|
-
|
114
|
-
if (!orig || !(orig->_flags & _PAD))
|
115
|
-
return (WINDOW *)NULL;
|
116
|
-
|
117
|
-
/* make sure window fits inside the original one */
|
118
|
-
|
119
|
-
if (begy < 0 || begx < 0 ||
|
120
|
-
(begy + nlines) > orig->_maxy ||
|
121
|
-
(begx + ncols) > orig->_maxx)
|
122
|
-
return (WINDOW *)NULL;
|
123
|
-
|
124
|
-
if (!nlines)
|
125
|
-
nlines = orig->_maxy - begy;
|
126
|
-
|
127
|
-
if (!ncols)
|
128
|
-
ncols = orig->_maxx - begx;
|
129
|
-
|
130
|
-
if ( !(win = PDC_makenew(nlines, ncols, begy, begx)) )
|
131
|
-
return (WINDOW *)NULL;
|
132
|
-
|
133
|
-
/* initialize window variables */
|
134
|
-
|
135
|
-
win->_attrs = orig->_attrs;
|
136
|
-
win->_leaveit = orig->_leaveit;
|
137
|
-
win->_scroll = orig->_scroll;
|
138
|
-
win->_nodelay = orig->_nodelay;
|
139
|
-
win->_use_keypad = orig->_use_keypad;
|
140
|
-
win->_parent = orig;
|
141
|
-
|
142
|
-
for (i = 0; i < nlines; i++)
|
143
|
-
win->_y[i] = orig->_y[begy + i] + begx;
|
144
|
-
|
145
|
-
win->_flags = _SUBPAD;
|
146
|
-
|
147
|
-
/* save default values in case pechochar() is the first call
|
148
|
-
to prefresh(). */
|
149
|
-
|
150
|
-
save_pminrow = 0;
|
151
|
-
save_pmincol = 0;
|
152
|
-
save_sminrow = 0;
|
153
|
-
save_smincol = 0;
|
154
|
-
save_smaxrow = min(LINES, nlines) - 1;
|
155
|
-
save_smaxcol = min(COLS, ncols) - 1;
|
156
|
-
|
157
|
-
return win;
|
158
|
-
}
|
159
|
-
|
160
|
-
int prefresh(WINDOW *win, int py, int px, int sy1, int sx1, int sy2, int sx2)
|
161
|
-
{
|
162
|
-
PDC_LOG(("prefresh() - called\n"));
|
163
|
-
|
164
|
-
if (pnoutrefresh(win, py, px, sy1, sx1, sy2, sx2) == ERR)
|
165
|
-
return ERR;
|
166
|
-
|
167
|
-
doupdate();
|
168
|
-
return OK;
|
169
|
-
}
|
170
|
-
|
171
|
-
int pnoutrefresh(WINDOW *w, int py, int px, int sy1, int sx1, int sy2, int sx2)
|
172
|
-
{
|
173
|
-
int num_cols;
|
174
|
-
int sline = sy1;
|
175
|
-
int pline = py;
|
176
|
-
|
177
|
-
PDC_LOG(("pnoutrefresh() - called\n"));
|
178
|
-
|
179
|
-
if (!w || !(w->_flags & (_PAD|_SUBPAD)) || (sy2 >= LINES) || (sx2 >= COLS))
|
180
|
-
return ERR;
|
181
|
-
|
182
|
-
if (py < 0)
|
183
|
-
py = 0;
|
184
|
-
if (px < 0)
|
185
|
-
px = 0;
|
186
|
-
if (sy1 < 0)
|
187
|
-
sy1 = 0;
|
188
|
-
if (sx1 < 0)
|
189
|
-
sx1 = 0;
|
190
|
-
|
191
|
-
if (sy2 < sy1 || sx2 < sx1)
|
192
|
-
return ERR;
|
193
|
-
|
194
|
-
num_cols = min((sx2 - sx1 + 1), (w->_maxx - px));
|
195
|
-
|
196
|
-
while (sline <= sy2)
|
197
|
-
{
|
198
|
-
if (pline < w->_maxy)
|
199
|
-
{
|
200
|
-
memcpy(curscr->_y[sline] + sx1, w->_y[pline] + px,
|
201
|
-
num_cols * sizeof(chtype));
|
202
|
-
|
203
|
-
if ((curscr->_firstch[sline] == _NO_CHANGE)
|
204
|
-
|| (curscr->_firstch[sline] > sx1))
|
205
|
-
curscr->_firstch[sline] = sx1;
|
206
|
-
|
207
|
-
if (sx2 > curscr->_lastch[sline])
|
208
|
-
curscr->_lastch[sline] = sx2;
|
209
|
-
|
210
|
-
w->_firstch[pline] = _NO_CHANGE; /* updated now */
|
211
|
-
w->_lastch[pline] = _NO_CHANGE; /* updated now */
|
212
|
-
}
|
213
|
-
|
214
|
-
sline++;
|
215
|
-
pline++;
|
216
|
-
}
|
217
|
-
|
218
|
-
if (w->_clear)
|
219
|
-
{
|
220
|
-
w->_clear = FALSE;
|
221
|
-
curscr->_clear = TRUE;
|
222
|
-
}
|
223
|
-
|
224
|
-
/* position the cursor to the pad's current position if possible --
|
225
|
-
is the pad current position going to end up displayed? if not,
|
226
|
-
then don't move the cursor; if so, move it to the correct place */
|
227
|
-
|
228
|
-
if (!w->_leaveit && w->_cury >= py && w->_curx >= px &&
|
229
|
-
w->_cury <= py + (sy2 - sy1) && w->_curx <= px + (sx2 - sx1))
|
230
|
-
{
|
231
|
-
curscr->_cury = (w->_cury - py) + sy1;
|
232
|
-
curscr->_curx = (w->_curx - px) + sx1;
|
233
|
-
}
|
234
|
-
|
235
|
-
return OK;
|
236
|
-
}
|
237
|
-
|
238
|
-
int pechochar(WINDOW *pad, chtype ch)
|
239
|
-
{
|
240
|
-
PDC_LOG(("pechochar() - called\n"));
|
241
|
-
|
242
|
-
if (waddch(pad, ch) == ERR)
|
243
|
-
return ERR;
|
244
|
-
|
245
|
-
return prefresh(pad, save_pminrow, save_pmincol, save_sminrow,
|
246
|
-
save_smincol, save_smaxrow, save_smaxcol);
|
247
|
-
}
|
248
|
-
|
249
|
-
#ifdef PDC_WIDE
|
250
|
-
int pecho_wchar(WINDOW *pad, const cchar_t *wch)
|
251
|
-
{
|
252
|
-
PDC_LOG(("pecho_wchar() - called\n"));
|
253
|
-
|
254
|
-
if (!wch || (waddch(pad, *wch) == ERR))
|
255
|
-
return ERR;
|
256
|
-
|
257
|
-
return prefresh(pad, save_pminrow, save_pmincol, save_sminrow,
|
258
|
-
save_smincol, save_smaxrow, save_smaxcol);
|
259
|
-
}
|
260
|
-
#endif
|