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,633 @@
1
+ /* Public Domain Curses */
2
+
3
+ #include <curspriv.h>
4
+
5
+ /*man-start**************************************************************
6
+
7
+ panel
8
+ -----
9
+
10
+ ### Synopsis
11
+
12
+ int bottom_panel(PANEL *pan);
13
+ int del_panel(PANEL *pan);
14
+ int hide_panel(PANEL *pan);
15
+ int move_panel(PANEL *pan, int starty, int startx);
16
+ PANEL *new_panel(WINDOW *win);
17
+ PANEL *panel_above(const PANEL *pan);
18
+ PANEL *panel_below(const PANEL *pan);
19
+ int panel_hidden(const PANEL *pan);
20
+ const void *panel_userptr(const PANEL *pan);
21
+ WINDOW *panel_window(const PANEL *pan);
22
+ int replace_panel(PANEL *pan, WINDOW *win);
23
+ int set_panel_userptr(PANEL *pan, const void *uptr);
24
+ int show_panel(PANEL *pan);
25
+ int top_panel(PANEL *pan);
26
+ void update_panels(void);
27
+
28
+ ### Description
29
+
30
+ The panel library is built using the curses library, and any
31
+ program using panels routines must call one of the curses
32
+ initialization routines such as initscr(). A program using these
33
+ routines must be linked with the panels and curses libraries.
34
+ The header <panel.h> includes the header <curses.h>.
35
+
36
+ The panels package gives the applications programmer a way to
37
+ have depth relationships between curses windows; a curses window
38
+ is associated with every panel. The panels routines allow curses
39
+ windows to overlap without making visible the overlapped
40
+ portions of underlying windows. The initial curses window,
41
+ stdscr, lies beneath all panels. The set of currently visible
42
+ panels is the 'deck' of panels.
43
+
44
+ The panels package allows the applications programmer to create
45
+ panels, fetch and set their associated windows, shuffle panels
46
+ in the deck, and manipulate panels in other ways.
47
+
48
+ bottom_panel() places pan at the bottom of the deck. The size,
49
+ location and contents of the panel are unchanged.
50
+
51
+ del_panel() deletes pan, but not its associated winwow.
52
+
53
+ hide_panel() removes a panel from the deck and thus hides it
54
+ from view.
55
+
56
+ move_panel() moves the curses window associated with pan, so
57
+ that its upper lefthand corner is at the supplied coordinates.
58
+ (Do not use mvwin() on the window.)
59
+
60
+ new_panel() creates a new panel associated with win and returns
61
+ the panel pointer. The new panel is placed at the top of the
62
+ deck.
63
+
64
+ panel_above() returns a pointer to the panel in the deck above
65
+ pan, or NULL if pan is the top panel. If the value of pan passed
66
+ is NULL, this function returns a pointer to the bottom panel in
67
+ the deck.
68
+
69
+ panel_below() returns a pointer to the panel in the deck below
70
+ pan, or NULL if pan is the bottom panel. If the value of pan
71
+ passed is NULL, this function returns a pointer to the top panel
72
+ in the deck.
73
+
74
+ panel_hidden() returns OK if pan is hidden and ERR if it is not.
75
+
76
+ panel_userptr() - Each panel has a user pointer available for
77
+ maintaining relevant information. This function returns a
78
+ pointer to that information previously set up by
79
+ set_panel_userptr().
80
+
81
+ panel_window() returns a pointer to the curses window associated
82
+ with the panel.
83
+
84
+ replace_panel() replaces the current window of pan with win.
85
+
86
+ set_panel_userptr() - Each panel has a user pointer available
87
+ for maintaining relevant information. This function sets the
88
+ value of that information.
89
+
90
+ show_panel() makes a previously hidden panel visible and places
91
+ it back in the deck on top.
92
+
93
+ top_panel() places pan on the top of the deck. The size,
94
+ location and contents of the panel are unchanged.
95
+
96
+ update_panels() refreshes the virtual screen to reflect the
97
+ depth relationships between the panels in the deck. The user
98
+ must use doupdate() to refresh the physical screen.
99
+
100
+ ### Return Value
101
+
102
+ Each routine that returns a pointer to an object returns NULL if
103
+ an error occurs. Each panel routine that returns an integer,
104
+ returns OK if it executes successfully and ERR if it does not.
105
+
106
+ ### Portability
107
+ X/Open BSD SYS V
108
+ bottom_panel - - Y
109
+ del_panel - - Y
110
+ hide_panel - - Y
111
+ move_panel - - Y
112
+ new_panel - - Y
113
+ panel_above - - Y
114
+ panel_below - - Y
115
+ panel_hidden - - Y
116
+ panel_userptr - - Y
117
+ panel_window - - Y
118
+ replace_panel - - Y
119
+ set_panel_userptr - - Y
120
+ show_panel - - Y
121
+ top_panel - - Y
122
+ update_panels - - Y
123
+
124
+ Credits:
125
+ Original Author - Warren Tucker <wht@n4hgf.mt-park.ga.us>
126
+
127
+ **man-end****************************************************************/
128
+
129
+ #include <panel.h>
130
+ #include <stdlib.h>
131
+
132
+ PANEL *_bottom_panel = (PANEL *)0;
133
+ PANEL *_top_panel = (PANEL *)0;
134
+ PANEL _stdscr_pseudo_panel = { (WINDOW *)0 };
135
+
136
+ #ifdef PANEL_DEBUG
137
+
138
+ static void dPanel(char *text, PANEL *pan)
139
+ {
140
+ PDC_LOG(("%s id=%s b=%s a=%s y=%d x=%d", text, pan->user,
141
+ pan->below ? pan->below->user : "--",
142
+ pan->above ? pan->above->user : "--",
143
+ pan->wstarty, pan->wstartx));
144
+ }
145
+
146
+ static void dStack(char *fmt, int num, PANEL *pan)
147
+ {
148
+ char s80[80];
149
+
150
+ sprintf(s80, fmt, num, pan);
151
+ PDC_LOG(("%s b=%s t=%s", s80, _bottom_panel ? _bottom_panel->user : "--",
152
+ _top_panel ? _top_panel->user : "--"));
153
+
154
+ if (pan)
155
+ PDC_LOG(("pan id=%s", pan->user));
156
+
157
+ pan = _bottom_panel;
158
+
159
+ while (pan)
160
+ {
161
+ dPanel("stk", pan);
162
+ pan = pan->above;
163
+ }
164
+ }
165
+
166
+ /* debugging hook for wnoutrefresh */
167
+
168
+ static void Wnoutrefresh(PANEL *pan)
169
+ {
170
+ dPanel("wnoutrefresh", pan);
171
+ wnoutrefresh(pan->win);
172
+ }
173
+
174
+ static void Touchpan(PANEL *pan)
175
+ {
176
+ dPanel("Touchpan", pan);
177
+ touchwin(pan->win);
178
+ }
179
+
180
+ static void Touchline(PANEL *pan, int start, int count)
181
+ {
182
+ char s80[80];
183
+
184
+ sprintf(s80, "Touchline s=%d c=%d", start, count);
185
+ dPanel(s80, pan);
186
+ touchline(pan->win, start, count);
187
+ }
188
+
189
+ #else /* PANEL_DEBUG */
190
+
191
+ #define dPanel(text, pan)
192
+ #define dStack(fmt, num, pan)
193
+ #define Wnoutrefresh(pan) wnoutrefresh((pan)->win)
194
+ #define Touchpan(pan) touchwin((pan)->win)
195
+ #define Touchline(pan, start, count) touchline((pan)->win, start, count)
196
+
197
+ #endif /* PANEL_DEBUG */
198
+
199
+ static bool _panels_overlapped(PANEL *pan1, PANEL *pan2)
200
+ {
201
+ if (!pan1 || !pan2)
202
+ return FALSE;
203
+
204
+ return ((pan1->wstarty >= pan2->wstarty && pan1->wstarty < pan2->wendy)
205
+ || (pan2->wstarty >= pan1->wstarty && pan2->wstarty < pan1->wendy))
206
+ && ((pan1->wstartx >= pan2->wstartx && pan1->wstartx < pan2->wendx)
207
+ || (pan2->wstartx >= pan1->wstartx && pan2->wstartx < pan1->wendx));
208
+ }
209
+
210
+ static void _free_obscure(PANEL *pan)
211
+ {
212
+ PANELOBS *tobs = pan->obscure; /* "this" one */
213
+ PANELOBS *nobs; /* "next" one */
214
+
215
+ while (tobs)
216
+ {
217
+ nobs = tobs->above;
218
+ free((char *)tobs);
219
+ tobs = nobs;
220
+ }
221
+ pan->obscure = (PANELOBS *)0;
222
+ }
223
+
224
+ static void _override(PANEL *pan, int show)
225
+ {
226
+ int y;
227
+ PANEL *pan2;
228
+ PANELOBS *tobs = pan->obscure; /* "this" one */
229
+
230
+ if (show == 1)
231
+ Touchpan(pan);
232
+ else if (!show)
233
+ {
234
+ Touchpan(pan);
235
+ Touchpan(&_stdscr_pseudo_panel);
236
+ }
237
+ else if (show == -1)
238
+ while (tobs && (tobs->pan != pan))
239
+ tobs = tobs->above;
240
+
241
+ while (tobs)
242
+ {
243
+ if ((pan2 = tobs->pan) != pan)
244
+ for (y = pan->wstarty; y < pan->wendy; y++)
245
+ if ((y >= pan2->wstarty) && (y < pan2->wendy) &&
246
+ ((is_linetouched(pan->win, y - pan->wstarty)) ||
247
+ (is_linetouched(stdscr, y))))
248
+ Touchline(pan2, y - pan2->wstarty, 1);
249
+
250
+ tobs = tobs->above;
251
+ }
252
+ }
253
+
254
+ static void _calculate_obscure(void)
255
+ {
256
+ PANEL *pan, *pan2;
257
+ PANELOBS *tobs; /* "this" one */
258
+ PANELOBS *lobs; /* last one */
259
+
260
+ pan = _bottom_panel;
261
+
262
+ while (pan)
263
+ {
264
+ if (pan->obscure)
265
+ _free_obscure(pan);
266
+
267
+ lobs = (PANELOBS *)0;
268
+ pan2 = _bottom_panel;
269
+
270
+ while (pan2)
271
+ {
272
+ if (_panels_overlapped(pan, pan2))
273
+ {
274
+ if ((tobs = malloc(sizeof(PANELOBS))) == NULL)
275
+ return;
276
+
277
+ tobs->pan = pan2;
278
+ dPanel("obscured", pan2);
279
+ tobs->above = (PANELOBS *)0;
280
+
281
+ if (lobs)
282
+ lobs->above = tobs;
283
+ else
284
+ pan->obscure = tobs;
285
+
286
+ lobs = tobs;
287
+ }
288
+
289
+ pan2 = pan2->above;
290
+ }
291
+
292
+ _override(pan, 1);
293
+ pan = pan->above;
294
+ }
295
+ }
296
+
297
+ /* check to see if panel is in the stack */
298
+
299
+ static bool _panel_is_linked(const PANEL *pan)
300
+ {
301
+ PANEL *pan2 = _bottom_panel;
302
+
303
+ while (pan2)
304
+ {
305
+ if (pan2 == pan)
306
+ return TRUE;
307
+
308
+ pan2 = pan2->above;
309
+ }
310
+
311
+ return FALSE;
312
+ }
313
+
314
+ /* link panel into stack at top */
315
+
316
+ static void _panel_link_top(PANEL *pan)
317
+ {
318
+ #ifdef PANEL_DEBUG
319
+ dStack("<lt%d>", 1, pan);
320
+ if (_panel_is_linked(pan))
321
+ return;
322
+ #endif
323
+ pan->above = (PANEL *)0;
324
+ pan->below = (PANEL *)0;
325
+
326
+ if (_top_panel)
327
+ {
328
+ _top_panel->above = pan;
329
+ pan->below = _top_panel;
330
+ }
331
+
332
+ _top_panel = pan;
333
+
334
+ if (!_bottom_panel)
335
+ _bottom_panel = pan;
336
+
337
+ _calculate_obscure();
338
+ dStack("<lt%d>", 9, pan);
339
+ }
340
+
341
+ /* link panel into stack at bottom */
342
+
343
+ static void _panel_link_bottom(PANEL *pan)
344
+ {
345
+ #ifdef PANEL_DEBUG
346
+ dStack("<lb%d>", 1, pan);
347
+ if (_panel_is_linked(pan))
348
+ return;
349
+ #endif
350
+ pan->above = (PANEL *)0;
351
+ pan->below = (PANEL *)0;
352
+
353
+ if (_bottom_panel)
354
+ {
355
+ _bottom_panel->below = pan;
356
+ pan->above = _bottom_panel;
357
+ }
358
+
359
+ _bottom_panel = pan;
360
+
361
+ if (!_top_panel)
362
+ _top_panel = pan;
363
+
364
+ _calculate_obscure();
365
+ dStack("<lb%d>", 9, pan);
366
+ }
367
+
368
+ static void _panel_unlink(PANEL *pan)
369
+ {
370
+ PANEL *prev;
371
+ PANEL *next;
372
+
373
+ #ifdef PANEL_DEBUG
374
+ dStack("<u%d>", 1, pan);
375
+ if (!_panel_is_linked(pan))
376
+ return;
377
+ #endif
378
+ _override(pan, 0);
379
+ _free_obscure(pan);
380
+
381
+ prev = pan->below;
382
+ next = pan->above;
383
+
384
+ /* if non-zero, we will not update the list head */
385
+
386
+ if (prev)
387
+ {
388
+ prev->above = next;
389
+ if(next)
390
+ next->below = prev;
391
+ }
392
+ else if (next)
393
+ next->below = prev;
394
+
395
+ if (pan == _bottom_panel)
396
+ _bottom_panel = next;
397
+
398
+ if (pan == _top_panel)
399
+ _top_panel = prev;
400
+
401
+ _calculate_obscure();
402
+
403
+ pan->above = (PANEL *)0;
404
+ pan->below = (PANEL *)0;
405
+ dStack("<u%d>", 9, pan);
406
+
407
+ }
408
+
409
+ /************************************************************************
410
+ * The following are the public functions for the panels library. *
411
+ ************************************************************************/
412
+
413
+ int bottom_panel(PANEL *pan)
414
+ {
415
+ if (!pan)
416
+ return ERR;
417
+
418
+ if (pan == _bottom_panel)
419
+ return OK;
420
+
421
+ if (_panel_is_linked(pan))
422
+ hide_panel(pan);
423
+
424
+ _panel_link_bottom(pan);
425
+
426
+ return OK;
427
+ }
428
+
429
+ int del_panel(PANEL *pan)
430
+ {
431
+ if (pan)
432
+ {
433
+ if (_panel_is_linked(pan))
434
+ hide_panel(pan);
435
+
436
+ free((char *)pan);
437
+ return OK;
438
+ }
439
+
440
+ return ERR;
441
+ }
442
+
443
+ int hide_panel(PANEL *pan)
444
+ {
445
+ if (!pan)
446
+ return ERR;
447
+
448
+ if (!_panel_is_linked(pan))
449
+ {
450
+ pan->above = (PANEL *)0;
451
+ pan->below = (PANEL *)0;
452
+ return ERR;
453
+ }
454
+
455
+ _panel_unlink(pan);
456
+
457
+ return OK;
458
+ }
459
+
460
+ int move_panel(PANEL *pan, int starty, int startx)
461
+ {
462
+ WINDOW *win;
463
+ int maxy, maxx;
464
+
465
+ if (!pan)
466
+ return ERR;
467
+
468
+ if (_panel_is_linked(pan))
469
+ _override(pan, 0);
470
+
471
+ win = pan->win;
472
+
473
+ if (mvwin(win, starty, startx) == ERR)
474
+ return ERR;
475
+
476
+ getbegyx(win, pan->wstarty, pan->wstartx);
477
+ getmaxyx(win, maxy, maxx);
478
+ pan->wendy = pan->wstarty + maxy;
479
+ pan->wendx = pan->wstartx + maxx;
480
+
481
+ if (_panel_is_linked(pan))
482
+ _calculate_obscure();
483
+
484
+ return OK;
485
+ }
486
+
487
+ PANEL *new_panel(WINDOW *win)
488
+ {
489
+ PANEL *pan = malloc(sizeof(PANEL));
490
+
491
+ if (!_stdscr_pseudo_panel.win)
492
+ {
493
+ _stdscr_pseudo_panel.win = stdscr;
494
+ _stdscr_pseudo_panel.wstarty = 0;
495
+ _stdscr_pseudo_panel.wstartx = 0;
496
+ _stdscr_pseudo_panel.wendy = LINES;
497
+ _stdscr_pseudo_panel.wendx = COLS;
498
+ _stdscr_pseudo_panel.user = "stdscr";
499
+ _stdscr_pseudo_panel.obscure = (PANELOBS *)0;
500
+ }
501
+
502
+ if (pan)
503
+ {
504
+ int maxy, maxx;
505
+
506
+ pan->win = win;
507
+ pan->above = (PANEL *)0;
508
+ pan->below = (PANEL *)0;
509
+ getbegyx(win, pan->wstarty, pan->wstartx);
510
+ getmaxyx(win, maxy, maxx);
511
+ pan->wendy = pan->wstarty + maxy;
512
+ pan->wendx = pan->wstartx + maxx;
513
+ #ifdef PANEL_DEBUG
514
+ pan->user = "new";
515
+ #else
516
+ pan->user = (char *)0;
517
+ #endif
518
+ pan->obscure = (PANELOBS *)0;
519
+ show_panel(pan);
520
+ }
521
+
522
+ return pan;
523
+ }
524
+
525
+ PANEL *panel_above(const PANEL *pan)
526
+ {
527
+ return pan ? pan->above : _bottom_panel;
528
+ }
529
+
530
+ PANEL *panel_below(const PANEL *pan)
531
+ {
532
+ return pan ? pan->below : _top_panel;
533
+ }
534
+
535
+ int panel_hidden(const PANEL *pan)
536
+ {
537
+ if (!pan)
538
+ return ERR;
539
+
540
+ return _panel_is_linked(pan) ? ERR : OK;
541
+ }
542
+
543
+ const void *panel_userptr(const PANEL *pan)
544
+ {
545
+ return pan ? pan->user : NULL;
546
+ }
547
+
548
+ WINDOW *panel_window(const PANEL *pan)
549
+ {
550
+ PDC_LOG(("panel_window() - called\n"));
551
+
552
+ return pan->win;
553
+ }
554
+
555
+ int replace_panel(PANEL *pan, WINDOW *win)
556
+ {
557
+ int maxy, maxx;
558
+
559
+ if (!pan)
560
+ return ERR;
561
+
562
+ if (_panel_is_linked(pan))
563
+ _override(pan, 0);
564
+
565
+ pan->win = win;
566
+ getbegyx(win, pan->wstarty, pan->wstartx);
567
+ getmaxyx(win, maxy, maxx);
568
+ pan->wendy = pan->wstarty + maxy;
569
+ pan->wendx = pan->wstartx + maxx;
570
+
571
+ if (_panel_is_linked(pan))
572
+ _calculate_obscure();
573
+
574
+ return OK;
575
+ }
576
+
577
+ int set_panel_userptr(PANEL *pan, const void *uptr)
578
+ {
579
+ if (!pan)
580
+ return ERR;
581
+
582
+ pan->user = uptr;
583
+ return OK;
584
+ }
585
+
586
+ int show_panel(PANEL *pan)
587
+ {
588
+ if (!pan)
589
+ return ERR;
590
+
591
+ if (pan == _top_panel)
592
+ return OK;
593
+
594
+ if (_panel_is_linked(pan))
595
+ hide_panel(pan);
596
+
597
+ _panel_link_top(pan);
598
+
599
+ return OK;
600
+ }
601
+
602
+ int top_panel(PANEL *pan)
603
+ {
604
+ return show_panel(pan);
605
+ }
606
+
607
+ void update_panels(void)
608
+ {
609
+ PANEL *pan;
610
+
611
+ PDC_LOG(("update_panels() - called\n"));
612
+
613
+ pan = _bottom_panel;
614
+
615
+ while (pan)
616
+ {
617
+ _override(pan, -1);
618
+ pan = pan->above;
619
+ }
620
+
621
+ if (is_wintouched(stdscr))
622
+ Wnoutrefresh(&_stdscr_pseudo_panel);
623
+
624
+ pan = _bottom_panel;
625
+
626
+ while (pan)
627
+ {
628
+ if (is_wintouched(pan->win) || !pan->above)
629
+ Wnoutrefresh(pan);
630
+
631
+ pan = pan->above;
632
+ }
633
+ }