curses 1.2.6 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (253) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +19 -0
  3. data/.github/workflows/ubuntu.yml +26 -0
  4. data/.github/workflows/windows.yml +28 -0
  5. data/.gitmodules +1 -1
  6. data/.travis.yml +6 -3
  7. data/History.md +40 -0
  8. data/README.md +4 -1
  9. data/Rakefile +0 -83
  10. data/curses.gemspec +2 -3
  11. data/ext/curses/curses.c +1271 -151
  12. data/ext/curses/extconf.rb +140 -17
  13. data/lib/curses.rb +5 -12
  14. data/sample/form.rb +52 -0
  15. data/sample/menu.rb +1 -1
  16. data/vendor/PDCurses/.gitignore +47 -0
  17. data/vendor/PDCurses/.travis.yml +49 -0
  18. data/vendor/PDCurses/CMakeLists.txt +68 -0
  19. data/vendor/PDCurses/HISTORY.md +2036 -0
  20. data/vendor/PDCurses/IMPLEMNT.md +327 -0
  21. data/vendor/PDCurses/README.md +77 -0
  22. data/vendor/PDCurses/acs_defs.h +265 -0
  23. data/vendor/PDCurses/appveyor.yml +218 -0
  24. data/vendor/PDCurses/cmake/README.md +71 -0
  25. data/vendor/PDCurses/cmake/build_dependencies.cmake +178 -0
  26. data/vendor/PDCurses/cmake/build_options.cmake +25 -0
  27. data/vendor/PDCurses/cmake/dll_version.cmake +26 -0
  28. data/vendor/PDCurses/cmake/gen_config_header.cmake +43 -0
  29. data/vendor/PDCurses/cmake/get_version.cmake +17 -0
  30. data/vendor/PDCurses/cmake/make_uninstall.cmake +19 -0
  31. data/vendor/PDCurses/cmake/project_common.cmake +121 -0
  32. data/vendor/PDCurses/cmake/resource.in.cmake +52 -0
  33. data/vendor/PDCurses/cmake/sdl2_ttf/CMakeLists.txt +83 -0
  34. data/vendor/PDCurses/cmake/target_arch.cmake +36 -0
  35. data/vendor/PDCurses/cmake/version.in.cmake +73 -0
  36. data/vendor/PDCurses/cmake/watcom_open_dos16_toolchain.cmake +96 -0
  37. data/vendor/PDCurses/cmake/watcom_open_dos32_toolchain.cmake +106 -0
  38. data/vendor/PDCurses/cmake/watcom_open_os2v2_toolchain.cmake +105 -0
  39. data/vendor/PDCurses/curses.h +1846 -0
  40. data/vendor/PDCurses/curspriv.h +134 -0
  41. data/vendor/PDCurses/demos/README.md +25 -0
  42. data/vendor/PDCurses/demos/firework.c +144 -0
  43. data/vendor/PDCurses/demos/newtest.c +581 -0
  44. data/vendor/PDCurses/demos/ozdemo.c +447 -0
  45. data/vendor/PDCurses/demos/ptest.c +283 -0
  46. data/vendor/PDCurses/demos/rain.c +157 -0
  47. data/vendor/PDCurses/demos/testcurs.c +1607 -0
  48. data/vendor/PDCurses/demos/tui.c +1048 -0
  49. data/vendor/PDCurses/demos/tui.h +65 -0
  50. data/vendor/PDCurses/demos/tuidemo.c +233 -0
  51. data/vendor/PDCurses/demos/version.c +61 -0
  52. data/vendor/PDCurses/demos/worm.c +432 -0
  53. data/vendor/PDCurses/demos/xmas.c +955 -0
  54. data/vendor/PDCurses/dos/CMakeLists.txt +47 -0
  55. data/vendor/PDCurses/dos/Makefile.bcc +83 -0
  56. data/vendor/PDCurses/dos/Makefile.dmc +257 -0
  57. data/vendor/PDCurses/dos/Makefile.msc +113 -0
  58. data/vendor/PDCurses/dos/Makefile.wcc +107 -0
  59. data/vendor/PDCurses/dos/README.md +51 -0
  60. data/vendor/PDCurses/dos/bccdos.lrf +9 -0
  61. data/vendor/PDCurses/dos/mscdos.lrf +50 -0
  62. data/vendor/PDCurses/dos/pdcclip.c +132 -0
  63. data/vendor/PDCurses/dos/pdcdisp.c +135 -0
  64. data/vendor/PDCurses/dos/pdcdos.h +194 -0
  65. data/vendor/PDCurses/dos/pdcgetsc.c +98 -0
  66. data/vendor/PDCurses/dos/pdckbd.c +513 -0
  67. data/vendor/PDCurses/dos/pdcscrn.c +785 -0
  68. data/vendor/PDCurses/dos/pdcsetsc.c +101 -0
  69. data/vendor/PDCurses/dos/pdcutil.c +212 -0
  70. data/vendor/PDCurses/libobjs.mif +26 -0
  71. data/vendor/PDCurses/makedist.mif +20 -0
  72. data/vendor/PDCurses/man/README.md +21 -0
  73. data/vendor/PDCurses/man/intro.md +361 -0
  74. data/vendor/PDCurses/man/manext.c +119 -0
  75. data/vendor/PDCurses/man/sdl.md +152 -0
  76. data/vendor/PDCurses/man/sdl2.md +58 -0
  77. data/vendor/PDCurses/man/x11.md +407 -0
  78. data/vendor/PDCurses/ncurses/CMakeLists.txt +66 -0
  79. data/vendor/PDCurses/ncurses/README.md +26 -0
  80. data/vendor/PDCurses/ncurses/makefile +29 -0
  81. data/vendor/PDCurses/os2/CMakeLists.txt +41 -0
  82. data/vendor/PDCurses/os2/Makefile.bcc +90 -0
  83. data/vendor/PDCurses/os2/Makefile.wcc +43 -0
  84. data/vendor/PDCurses/os2/README.md +43 -0
  85. data/vendor/PDCurses/os2/iccos2.lrf +50 -0
  86. data/vendor/PDCurses/os2/iccos2.mak +256 -0
  87. data/vendor/PDCurses/os2/pdcclip.c +188 -0
  88. data/vendor/PDCurses/os2/pdcdisp.c +93 -0
  89. data/vendor/PDCurses/os2/pdcgetsc.c +89 -0
  90. data/vendor/PDCurses/os2/pdckbd.c +521 -0
  91. data/vendor/PDCurses/os2/pdcos2.h +55 -0
  92. data/vendor/PDCurses/os2/pdcscrn.c +449 -0
  93. data/vendor/PDCurses/os2/pdcsetsc.c +112 -0
  94. data/vendor/PDCurses/os2/pdcutil.c +52 -0
  95. data/vendor/PDCurses/panel.h +56 -0
  96. data/vendor/PDCurses/pdcurses/README.md +25 -0
  97. data/vendor/PDCurses/pdcurses/addch.c +693 -0
  98. data/vendor/PDCurses/pdcurses/addchstr.c +245 -0
  99. data/vendor/PDCurses/pdcurses/addstr.c +240 -0
  100. data/vendor/PDCurses/pdcurses/attr.c +359 -0
  101. data/vendor/PDCurses/pdcurses/beep.c +68 -0
  102. data/vendor/PDCurses/pdcurses/bkgd.c +223 -0
  103. data/vendor/PDCurses/pdcurses/border.c +411 -0
  104. data/vendor/PDCurses/pdcurses/clear.c +159 -0
  105. data/vendor/PDCurses/pdcurses/color.c +298 -0
  106. data/vendor/PDCurses/pdcurses/debug.c +109 -0
  107. data/vendor/PDCurses/pdcurses/delch.c +96 -0
  108. data/vendor/PDCurses/pdcurses/deleteln.c +211 -0
  109. data/vendor/PDCurses/pdcurses/deprec.c +27 -0
  110. data/vendor/PDCurses/pdcurses/getch.c +417 -0
  111. data/vendor/PDCurses/pdcurses/getstr.c +474 -0
  112. data/vendor/PDCurses/pdcurses/getyx.c +139 -0
  113. data/vendor/PDCurses/pdcurses/inch.c +127 -0
  114. data/vendor/PDCurses/pdcurses/inchstr.c +214 -0
  115. data/vendor/PDCurses/pdcurses/initscr.c +367 -0
  116. data/vendor/PDCurses/pdcurses/inopts.c +324 -0
  117. data/vendor/PDCurses/pdcurses/insch.c +271 -0
  118. data/vendor/PDCurses/pdcurses/insstr.c +264 -0
  119. data/vendor/PDCurses/pdcurses/instr.c +246 -0
  120. data/vendor/PDCurses/pdcurses/kernel.c +259 -0
  121. data/vendor/PDCurses/pdcurses/keyname.c +157 -0
  122. data/vendor/PDCurses/pdcurses/mouse.c +438 -0
  123. data/vendor/PDCurses/pdcurses/move.c +57 -0
  124. data/vendor/PDCurses/pdcurses/outopts.c +159 -0
  125. data/vendor/PDCurses/pdcurses/overlay.c +214 -0
  126. data/vendor/PDCurses/pdcurses/pad.c +260 -0
  127. data/vendor/PDCurses/pdcurses/panel.c +633 -0
  128. data/vendor/PDCurses/pdcurses/printw.c +126 -0
  129. data/vendor/PDCurses/pdcurses/refresh.c +279 -0
  130. data/vendor/PDCurses/pdcurses/scanw.c +578 -0
  131. data/vendor/PDCurses/pdcurses/scr_dump.c +213 -0
  132. data/vendor/PDCurses/pdcurses/scroll.c +101 -0
  133. data/vendor/PDCurses/pdcurses/slk.c +591 -0
  134. data/vendor/PDCurses/pdcurses/termattr.c +182 -0
  135. data/vendor/PDCurses/pdcurses/terminfo.c +217 -0
  136. data/vendor/PDCurses/pdcurses/touch.c +163 -0
  137. data/vendor/PDCurses/pdcurses/util.c +312 -0
  138. data/vendor/PDCurses/pdcurses/window.c +569 -0
  139. data/vendor/PDCurses/sdl1/Makefile.mng +110 -0
  140. data/vendor/PDCurses/sdl1/README.md +31 -0
  141. data/vendor/PDCurses/sdl1/deffont.h +385 -0
  142. data/vendor/PDCurses/sdl1/deficon.h +23 -0
  143. data/vendor/PDCurses/sdl1/pdcclip.c +131 -0
  144. data/vendor/PDCurses/sdl1/pdcdisp.c +373 -0
  145. data/vendor/PDCurses/sdl1/pdcgetsc.c +30 -0
  146. data/vendor/PDCurses/sdl1/pdckbd.c +405 -0
  147. data/vendor/PDCurses/sdl1/pdcscrn.c +414 -0
  148. data/vendor/PDCurses/sdl1/pdcsdl.h +31 -0
  149. data/vendor/PDCurses/sdl1/pdcsetsc.c +64 -0
  150. data/vendor/PDCurses/sdl1/pdcutil.c +40 -0
  151. data/vendor/PDCurses/sdl1/sdltest.c +79 -0
  152. data/vendor/PDCurses/sdl2/CMakeLists.txt +76 -0
  153. data/vendor/PDCurses/sdl2/Makefile.vc +164 -0
  154. data/vendor/PDCurses/sdl2/README.md +34 -0
  155. data/vendor/PDCurses/sdl2/deffont.h +385 -0
  156. data/vendor/PDCurses/sdl2/deficon.h +23 -0
  157. data/vendor/PDCurses/sdl2/pdcclip.c +93 -0
  158. data/vendor/PDCurses/sdl2/pdcdisp.c +534 -0
  159. data/vendor/PDCurses/sdl2/pdcgetsc.c +30 -0
  160. data/vendor/PDCurses/sdl2/pdckbd.c +480 -0
  161. data/vendor/PDCurses/sdl2/pdcscrn.c +443 -0
  162. data/vendor/PDCurses/sdl2/pdcsdl.h +33 -0
  163. data/vendor/PDCurses/sdl2/pdcsetsc.c +67 -0
  164. data/vendor/PDCurses/sdl2/pdcutil.c +39 -0
  165. data/vendor/PDCurses/sdl2/sdltest.c +81 -0
  166. data/vendor/PDCurses/term.h +48 -0
  167. data/vendor/PDCurses/version.mif +7 -0
  168. data/vendor/PDCurses/vt/CMakeLists.txt +28 -0
  169. data/vendor/PDCurses/vt/Makefile.bcc +111 -0
  170. data/vendor/PDCurses/vt/Makefile.dmc +258 -0
  171. data/vendor/PDCurses/vt/Makefile.vc +144 -0
  172. data/vendor/PDCurses/vt/Makefile.wcc +107 -0
  173. data/vendor/PDCurses/vt/README.md +64 -0
  174. data/vendor/PDCurses/vt/pdcclip.c +20 -0
  175. data/vendor/PDCurses/vt/pdcdisp.c +284 -0
  176. data/vendor/PDCurses/vt/pdcgetsc.c +27 -0
  177. data/vendor/PDCurses/vt/pdckbd.c +394 -0
  178. data/vendor/PDCurses/vt/pdcscrn.c +434 -0
  179. data/vendor/PDCurses/vt/pdcsetsc.c +45 -0
  180. data/vendor/PDCurses/vt/pdcutil.c +43 -0
  181. data/vendor/PDCurses/vt/pdcvt.h +16 -0
  182. data/vendor/PDCurses/watcom.mif +68 -0
  183. data/vendor/PDCurses/wincon/CMakeLists.txt +27 -0
  184. data/vendor/PDCurses/wincon/Makefile.bcc +88 -0
  185. data/vendor/PDCurses/wincon/Makefile.dmc +256 -0
  186. data/vendor/PDCurses/wincon/Makefile.lcc +273 -0
  187. data/vendor/PDCurses/wincon/Makefile.mng +176 -0
  188. data/vendor/PDCurses/wincon/Makefile.vc +144 -0
  189. data/vendor/PDCurses/wincon/Makefile.wcc +51 -0
  190. data/vendor/PDCurses/wincon/README.md +85 -0
  191. data/vendor/PDCurses/wincon/pdcclip.c +174 -0
  192. data/vendor/PDCurses/wincon/pdcdisp.c +143 -0
  193. data/vendor/PDCurses/wincon/pdcgetsc.c +55 -0
  194. data/vendor/PDCurses/wincon/pdckbd.c +786 -0
  195. data/vendor/PDCurses/wincon/pdcscrn.c +717 -0
  196. data/vendor/PDCurses/wincon/pdcsetsc.c +91 -0
  197. data/vendor/PDCurses/wincon/pdcurses.ico +0 -0
  198. data/vendor/PDCurses/wincon/pdcurses.rc +28 -0
  199. data/vendor/PDCurses/wincon/pdcutil.c +41 -0
  200. data/vendor/PDCurses/wincon/pdcwin.h +31 -0
  201. data/vendor/PDCurses/wingui/CMakeLists.txt +27 -0
  202. data/vendor/PDCurses/wingui/Makefile.bcc +85 -0
  203. data/vendor/PDCurses/wingui/Makefile.dmc +259 -0
  204. data/vendor/PDCurses/wingui/Makefile.lcc +273 -0
  205. data/vendor/PDCurses/wingui/Makefile.mng +171 -0
  206. data/vendor/PDCurses/wingui/Makefile.vc +144 -0
  207. data/vendor/PDCurses/wingui/Makefile.wcc +51 -0
  208. data/vendor/PDCurses/wingui/README.md +93 -0
  209. data/vendor/PDCurses/wingui/pdcclip.c +174 -0
  210. data/vendor/PDCurses/wingui/pdcdisp.c +718 -0
  211. data/vendor/PDCurses/wingui/pdcgetsc.c +30 -0
  212. data/vendor/PDCurses/wingui/pdckbd.c +143 -0
  213. data/vendor/PDCurses/wingui/pdcscrn.c +2797 -0
  214. data/vendor/PDCurses/wingui/pdcsetsc.c +89 -0
  215. data/vendor/PDCurses/wingui/pdcurses.ico +0 -0
  216. data/vendor/PDCurses/wingui/pdcurses.rc +28 -0
  217. data/vendor/PDCurses/wingui/pdcutil.c +61 -0
  218. data/vendor/PDCurses/wingui/pdcwin.h +122 -0
  219. data/vendor/PDCurses/x11/Makefile.in +754 -0
  220. data/vendor/PDCurses/x11/PDCurses.spec +82 -0
  221. data/vendor/PDCurses/x11/README.md +62 -0
  222. data/vendor/PDCurses/x11/ScrollBox.c +319 -0
  223. data/vendor/PDCurses/x11/ScrollBox.h +51 -0
  224. data/vendor/PDCurses/x11/ScrollBoxP.h +70 -0
  225. data/vendor/PDCurses/x11/aclocal.m4 +994 -0
  226. data/vendor/PDCurses/x11/big_icon.xbm +46 -0
  227. data/vendor/PDCurses/x11/compose.h +201 -0
  228. data/vendor/PDCurses/x11/config.guess +1500 -0
  229. data/vendor/PDCurses/x11/config.h.in +100 -0
  230. data/vendor/PDCurses/x11/config.sub +1616 -0
  231. data/vendor/PDCurses/x11/configure +6700 -0
  232. data/vendor/PDCurses/x11/configure.ac +295 -0
  233. data/vendor/PDCurses/x11/debian/changelog +6 -0
  234. data/vendor/PDCurses/x11/debian/compat +1 -0
  235. data/vendor/PDCurses/x11/debian/control +11 -0
  236. data/vendor/PDCurses/x11/debian/copyright +27 -0
  237. data/vendor/PDCurses/x11/debian/rules +98 -0
  238. data/vendor/PDCurses/x11/install-sh +253 -0
  239. data/vendor/PDCurses/x11/little_icon.xbm +14 -0
  240. data/vendor/PDCurses/x11/ncurses_cfg.h +45 -0
  241. data/vendor/PDCurses/x11/pdcclip.c +173 -0
  242. data/vendor/PDCurses/x11/pdcdisp.c +85 -0
  243. data/vendor/PDCurses/x11/pdcgetsc.c +28 -0
  244. data/vendor/PDCurses/x11/pdckbd.c +104 -0
  245. data/vendor/PDCurses/x11/pdcscrn.c +258 -0
  246. data/vendor/PDCurses/x11/pdcsetsc.c +95 -0
  247. data/vendor/PDCurses/x11/pdcutil.c +52 -0
  248. data/vendor/PDCurses/x11/pdcx11.c +316 -0
  249. data/vendor/PDCurses/x11/pdcx11.h +191 -0
  250. data/vendor/PDCurses/x11/sb.c +155 -0
  251. data/vendor/PDCurses/x11/x11.c +3686 -0
  252. data/vendor/PDCurses/x11/xcurses-config.in +81 -0
  253. metadata +255 -21
@@ -0,0 +1,57 @@
1
+ /* Public Domain Curses */
2
+
3
+ #include <curspriv.h>
4
+
5
+ /*man-start**************************************************************
6
+
7
+ move
8
+ ----
9
+
10
+ ### Synopsis
11
+
12
+ int move(int y, int x);
13
+ int wmove(WINDOW *win, int y, int x);
14
+
15
+ ### Description
16
+
17
+ The cursor associated with the window is moved to the given
18
+ location. This does not move the physical cursor of the
19
+ terminal until refresh() is called. The position specified is
20
+ relative to the upper left corner of the window, which is (0,0).
21
+
22
+ ### Return Value
23
+
24
+ All functions return OK on success and ERR on error.
25
+
26
+ ### Portability
27
+ X/Open BSD SYS V
28
+ move Y Y Y
29
+ wmove Y Y Y
30
+
31
+ **man-end****************************************************************/
32
+
33
+ int move(int y, int x)
34
+ {
35
+ PDC_LOG(("move() - called: y=%d x=%d\n", y, x));
36
+
37
+ if (!stdscr || x < 0 || y < 0 || x >= stdscr->_maxx || y >= stdscr->_maxy)
38
+ return ERR;
39
+
40
+ stdscr->_curx = x;
41
+ stdscr->_cury = y;
42
+
43
+ return OK;
44
+ }
45
+
46
+ int wmove(WINDOW *win, int y, int x)
47
+ {
48
+ PDC_LOG(("wmove() - called: y=%d x=%d\n", y, x));
49
+
50
+ if (!win || x < 0 || y < 0 || x >= win->_maxx || y >= win->_maxy)
51
+ return ERR;
52
+
53
+ win->_curx = x;
54
+ win->_cury = y;
55
+
56
+ return OK;
57
+ }
@@ -0,0 +1,159 @@
1
+ /* Public Domain Curses */
2
+
3
+ #include <curspriv.h>
4
+
5
+ /*man-start**************************************************************
6
+
7
+ outopts
8
+ -------
9
+
10
+ ### Synopsis
11
+
12
+ int clearok(WINDOW *win, bool bf);
13
+ int idlok(WINDOW *win, bool bf);
14
+ void idcok(WINDOW *win, bool bf);
15
+ void immedok(WINDOW *win, bool bf);
16
+ int leaveok(WINDOW *win, bool bf);
17
+ int setscrreg(int top, int bot);
18
+ int wsetscrreg(WINDOW *win, int top, int bot);
19
+ int scrollok(WINDOW *win, bool bf);
20
+
21
+ int raw_output(bool bf);
22
+
23
+ ### Description
24
+
25
+ With clearok(), if bf is TRUE, the next call to wrefresh() with
26
+ this window will clear the screen completely and redraw the
27
+ entire screen.
28
+
29
+ immedok(), called with a second argument of TRUE, causes an
30
+ automatic wrefresh() every time a change is made to the
31
+ specified window.
32
+
33
+ Normally, the hardware cursor is left at the location of the
34
+ window being refreshed. leaveok() allows the cursor to be
35
+ left wherever the update happens to leave it. It's useful
36
+ for applications where the cursor is not used, since it reduces
37
+ the need for cursor motions. If possible, the cursor is made
38
+ invisible when this option is enabled.
39
+
40
+ wsetscrreg() sets a scrolling region in a window; "top" and
41
+ "bot" are the line numbers for the top and bottom margins. If
42
+ this option and scrollok() are enabled, any attempt to move off
43
+ the bottom margin will cause all lines in the scrolling region
44
+ to scroll up one line. setscrreg() is the stdscr version.
45
+
46
+ idlok() and idcok() do nothing in PDCurses, but are provided for
47
+ compatibility with other curses implementations.
48
+
49
+ raw_output() enables the output of raw characters using the
50
+ standard *add* and *ins* curses functions (that is, it disables
51
+ translation of control characters).
52
+
53
+ ### Return Value
54
+
55
+ All functions return OK on success and ERR on error.
56
+
57
+ ### Portability
58
+ X/Open BSD SYS V
59
+ clearok Y Y Y
60
+ idlok Y Y Y
61
+ idcok Y - 4.0
62
+ immedok Y - 4.0
63
+ leaveok Y Y Y
64
+ setscrreg Y Y Y
65
+ wsetscrreg Y Y Y
66
+ scrollok Y Y Y
67
+ raw_output - - -
68
+
69
+ **man-end****************************************************************/
70
+
71
+ int clearok(WINDOW *win, bool bf)
72
+ {
73
+ PDC_LOG(("clearok() - called\n"));
74
+
75
+ if (!win)
76
+ return ERR;
77
+
78
+ win->_clear = bf;
79
+
80
+ return OK;
81
+ }
82
+
83
+ int idlok(WINDOW *win, bool bf)
84
+ {
85
+ PDC_LOG(("idlok() - called\n"));
86
+
87
+ return OK;
88
+ }
89
+
90
+ void idcok(WINDOW *win, bool bf)
91
+ {
92
+ PDC_LOG(("idcok() - called\n"));
93
+ }
94
+
95
+ void immedok(WINDOW *win, bool bf)
96
+ {
97
+ PDC_LOG(("immedok() - called\n"));
98
+
99
+ if (win)
100
+ win->_immed = bf;
101
+ }
102
+
103
+ int leaveok(WINDOW *win, bool bf)
104
+ {
105
+ PDC_LOG(("leaveok() - called\n"));
106
+
107
+ if (!win)
108
+ return ERR;
109
+
110
+ win->_leaveit = bf;
111
+
112
+ curs_set(!bf);
113
+
114
+ return OK;
115
+ }
116
+
117
+ int setscrreg(int top, int bottom)
118
+ {
119
+ PDC_LOG(("setscrreg() - called: top %d bottom %d\n", top, bottom));
120
+
121
+ return wsetscrreg(stdscr, top, bottom);
122
+ }
123
+
124
+ int wsetscrreg(WINDOW *win, int top, int bottom)
125
+ {
126
+ PDC_LOG(("wsetscrreg() - called: top %d bottom %d\n", top, bottom));
127
+
128
+ if (win && 0 <= top && top <= win->_cury &&
129
+ win->_cury <= bottom && bottom < win->_maxy)
130
+ {
131
+ win->_tmarg = top;
132
+ win->_bmarg = bottom;
133
+
134
+ return OK;
135
+ }
136
+ else
137
+ return ERR;
138
+ }
139
+
140
+ int scrollok(WINDOW *win, bool bf)
141
+ {
142
+ PDC_LOG(("scrollok() - called\n"));
143
+
144
+ if (!win)
145
+ return ERR;
146
+
147
+ win->_scroll = bf;
148
+
149
+ return OK;
150
+ }
151
+
152
+ int raw_output(bool bf)
153
+ {
154
+ PDC_LOG(("raw_output() - called\n"));
155
+
156
+ SP->raw_out = bf;
157
+
158
+ return OK;
159
+ }
@@ -0,0 +1,214 @@
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
+ }
@@ -0,0 +1,260 @@
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