curses 1.4.5 → 1.4.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (249) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/push_gem.yml +48 -0
  3. data/History.md +3 -0
  4. data/curses.gemspec +1 -1
  5. metadata +8 -247
  6. data/vendor/PDCurses/.gitignore +0 -47
  7. data/vendor/PDCurses/.travis.yml +0 -49
  8. data/vendor/PDCurses/CMakeLists.txt +0 -68
  9. data/vendor/PDCurses/HISTORY.md +0 -2036
  10. data/vendor/PDCurses/IMPLEMNT.md +0 -327
  11. data/vendor/PDCurses/Makefile +0 -27
  12. data/vendor/PDCurses/README.md +0 -77
  13. data/vendor/PDCurses/acs_defs.h +0 -265
  14. data/vendor/PDCurses/appveyor.yml +0 -218
  15. data/vendor/PDCurses/cmake/README.md +0 -71
  16. data/vendor/PDCurses/cmake/build_dependencies.cmake +0 -178
  17. data/vendor/PDCurses/cmake/build_options.cmake +0 -25
  18. data/vendor/PDCurses/cmake/dll_version.cmake +0 -26
  19. data/vendor/PDCurses/cmake/gen_config_header.cmake +0 -43
  20. data/vendor/PDCurses/cmake/get_version.cmake +0 -17
  21. data/vendor/PDCurses/cmake/make_uninstall.cmake +0 -19
  22. data/vendor/PDCurses/cmake/project_common.cmake +0 -121
  23. data/vendor/PDCurses/cmake/resource.in.cmake +0 -52
  24. data/vendor/PDCurses/cmake/sdl2_ttf/CMakeLists.txt +0 -83
  25. data/vendor/PDCurses/cmake/target_arch.cmake +0 -36
  26. data/vendor/PDCurses/cmake/version.in.cmake +0 -73
  27. data/vendor/PDCurses/cmake/watcom_open_dos16_toolchain.cmake +0 -96
  28. data/vendor/PDCurses/cmake/watcom_open_dos32_toolchain.cmake +0 -106
  29. data/vendor/PDCurses/cmake/watcom_open_os2v2_toolchain.cmake +0 -105
  30. data/vendor/PDCurses/curses.h +0 -1846
  31. data/vendor/PDCurses/curspriv.h +0 -134
  32. data/vendor/PDCurses/demos/README.md +0 -25
  33. data/vendor/PDCurses/demos/firework.c +0 -144
  34. data/vendor/PDCurses/demos/newtest.c +0 -581
  35. data/vendor/PDCurses/demos/ozdemo.c +0 -447
  36. data/vendor/PDCurses/demos/ptest.c +0 -283
  37. data/vendor/PDCurses/demos/rain.c +0 -157
  38. data/vendor/PDCurses/demos/testcurs.c +0 -1607
  39. data/vendor/PDCurses/demos/tui.c +0 -1048
  40. data/vendor/PDCurses/demos/tui.h +0 -65
  41. data/vendor/PDCurses/demos/tuidemo.c +0 -233
  42. data/vendor/PDCurses/demos/version.c +0 -61
  43. data/vendor/PDCurses/demos/worm.c +0 -432
  44. data/vendor/PDCurses/demos/xmas.c +0 -955
  45. data/vendor/PDCurses/dos/CMakeLists.txt +0 -47
  46. data/vendor/PDCurses/dos/Makefile +0 -105
  47. data/vendor/PDCurses/dos/Makefile.bcc +0 -83
  48. data/vendor/PDCurses/dos/Makefile.dmc +0 -257
  49. data/vendor/PDCurses/dos/Makefile.msc +0 -113
  50. data/vendor/PDCurses/dos/Makefile.wcc +0 -107
  51. data/vendor/PDCurses/dos/README.md +0 -51
  52. data/vendor/PDCurses/dos/bccdos.lrf +0 -9
  53. data/vendor/PDCurses/dos/mscdos.lrf +0 -50
  54. data/vendor/PDCurses/dos/pdcclip.c +0 -132
  55. data/vendor/PDCurses/dos/pdcdisp.c +0 -135
  56. data/vendor/PDCurses/dos/pdcdos.h +0 -194
  57. data/vendor/PDCurses/dos/pdcgetsc.c +0 -98
  58. data/vendor/PDCurses/dos/pdckbd.c +0 -513
  59. data/vendor/PDCurses/dos/pdcscrn.c +0 -785
  60. data/vendor/PDCurses/dos/pdcsetsc.c +0 -101
  61. data/vendor/PDCurses/dos/pdcutil.c +0 -212
  62. data/vendor/PDCurses/libobjs.mif +0 -26
  63. data/vendor/PDCurses/makedist.mif +0 -20
  64. data/vendor/PDCurses/man/Makefile +0 -37
  65. data/vendor/PDCurses/man/README.md +0 -21
  66. data/vendor/PDCurses/man/intro.md +0 -361
  67. data/vendor/PDCurses/man/manext.c +0 -119
  68. data/vendor/PDCurses/man/sdl.md +0 -152
  69. data/vendor/PDCurses/man/sdl2.md +0 -58
  70. data/vendor/PDCurses/man/x11.md +0 -407
  71. data/vendor/PDCurses/ncurses/CMakeLists.txt +0 -66
  72. data/vendor/PDCurses/ncurses/README.md +0 -26
  73. data/vendor/PDCurses/ncurses/makefile +0 -29
  74. data/vendor/PDCurses/os2/CMakeLists.txt +0 -41
  75. data/vendor/PDCurses/os2/Makefile +0 -132
  76. data/vendor/PDCurses/os2/Makefile.bcc +0 -90
  77. data/vendor/PDCurses/os2/Makefile.wcc +0 -43
  78. data/vendor/PDCurses/os2/README.md +0 -43
  79. data/vendor/PDCurses/os2/iccos2.lrf +0 -50
  80. data/vendor/PDCurses/os2/iccos2.mak +0 -256
  81. data/vendor/PDCurses/os2/pdcclip.c +0 -188
  82. data/vendor/PDCurses/os2/pdcdisp.c +0 -93
  83. data/vendor/PDCurses/os2/pdcgetsc.c +0 -89
  84. data/vendor/PDCurses/os2/pdckbd.c +0 -521
  85. data/vendor/PDCurses/os2/pdcos2.h +0 -55
  86. data/vendor/PDCurses/os2/pdcscrn.c +0 -449
  87. data/vendor/PDCurses/os2/pdcsetsc.c +0 -112
  88. data/vendor/PDCurses/os2/pdcutil.c +0 -52
  89. data/vendor/PDCurses/panel.h +0 -56
  90. data/vendor/PDCurses/pdcurses/README.md +0 -25
  91. data/vendor/PDCurses/pdcurses/addch.c +0 -693
  92. data/vendor/PDCurses/pdcurses/addchstr.c +0 -245
  93. data/vendor/PDCurses/pdcurses/addstr.c +0 -240
  94. data/vendor/PDCurses/pdcurses/attr.c +0 -359
  95. data/vendor/PDCurses/pdcurses/beep.c +0 -68
  96. data/vendor/PDCurses/pdcurses/bkgd.c +0 -223
  97. data/vendor/PDCurses/pdcurses/border.c +0 -411
  98. data/vendor/PDCurses/pdcurses/clear.c +0 -159
  99. data/vendor/PDCurses/pdcurses/color.c +0 -298
  100. data/vendor/PDCurses/pdcurses/debug.c +0 -109
  101. data/vendor/PDCurses/pdcurses/delch.c +0 -96
  102. data/vendor/PDCurses/pdcurses/deleteln.c +0 -211
  103. data/vendor/PDCurses/pdcurses/deprec.c +0 -27
  104. data/vendor/PDCurses/pdcurses/getch.c +0 -417
  105. data/vendor/PDCurses/pdcurses/getstr.c +0 -474
  106. data/vendor/PDCurses/pdcurses/getyx.c +0 -139
  107. data/vendor/PDCurses/pdcurses/inch.c +0 -127
  108. data/vendor/PDCurses/pdcurses/inchstr.c +0 -214
  109. data/vendor/PDCurses/pdcurses/initscr.c +0 -367
  110. data/vendor/PDCurses/pdcurses/inopts.c +0 -324
  111. data/vendor/PDCurses/pdcurses/insch.c +0 -271
  112. data/vendor/PDCurses/pdcurses/insstr.c +0 -264
  113. data/vendor/PDCurses/pdcurses/instr.c +0 -246
  114. data/vendor/PDCurses/pdcurses/kernel.c +0 -259
  115. data/vendor/PDCurses/pdcurses/keyname.c +0 -157
  116. data/vendor/PDCurses/pdcurses/mouse.c +0 -438
  117. data/vendor/PDCurses/pdcurses/move.c +0 -57
  118. data/vendor/PDCurses/pdcurses/outopts.c +0 -159
  119. data/vendor/PDCurses/pdcurses/overlay.c +0 -214
  120. data/vendor/PDCurses/pdcurses/pad.c +0 -260
  121. data/vendor/PDCurses/pdcurses/panel.c +0 -633
  122. data/vendor/PDCurses/pdcurses/printw.c +0 -126
  123. data/vendor/PDCurses/pdcurses/refresh.c +0 -279
  124. data/vendor/PDCurses/pdcurses/scanw.c +0 -578
  125. data/vendor/PDCurses/pdcurses/scr_dump.c +0 -213
  126. data/vendor/PDCurses/pdcurses/scroll.c +0 -101
  127. data/vendor/PDCurses/pdcurses/slk.c +0 -591
  128. data/vendor/PDCurses/pdcurses/termattr.c +0 -182
  129. data/vendor/PDCurses/pdcurses/terminfo.c +0 -217
  130. data/vendor/PDCurses/pdcurses/touch.c +0 -163
  131. data/vendor/PDCurses/pdcurses/util.c +0 -312
  132. data/vendor/PDCurses/pdcurses/window.c +0 -569
  133. data/vendor/PDCurses/sdl1/Makefile +0 -129
  134. data/vendor/PDCurses/sdl1/Makefile.mng +0 -110
  135. data/vendor/PDCurses/sdl1/README.md +0 -31
  136. data/vendor/PDCurses/sdl1/deffont.h +0 -385
  137. data/vendor/PDCurses/sdl1/deficon.h +0 -23
  138. data/vendor/PDCurses/sdl1/pdcclip.c +0 -131
  139. data/vendor/PDCurses/sdl1/pdcdisp.c +0 -373
  140. data/vendor/PDCurses/sdl1/pdcgetsc.c +0 -30
  141. data/vendor/PDCurses/sdl1/pdckbd.c +0 -405
  142. data/vendor/PDCurses/sdl1/pdcscrn.c +0 -414
  143. data/vendor/PDCurses/sdl1/pdcsdl.h +0 -31
  144. data/vendor/PDCurses/sdl1/pdcsetsc.c +0 -64
  145. data/vendor/PDCurses/sdl1/pdcutil.c +0 -40
  146. data/vendor/PDCurses/sdl1/sdltest.c +0 -79
  147. data/vendor/PDCurses/sdl2/CMakeLists.txt +0 -76
  148. data/vendor/PDCurses/sdl2/Makefile +0 -135
  149. data/vendor/PDCurses/sdl2/Makefile.vc +0 -164
  150. data/vendor/PDCurses/sdl2/README.md +0 -34
  151. data/vendor/PDCurses/sdl2/deffont.h +0 -385
  152. data/vendor/PDCurses/sdl2/deficon.h +0 -23
  153. data/vendor/PDCurses/sdl2/pdcclip.c +0 -93
  154. data/vendor/PDCurses/sdl2/pdcdisp.c +0 -534
  155. data/vendor/PDCurses/sdl2/pdcgetsc.c +0 -30
  156. data/vendor/PDCurses/sdl2/pdckbd.c +0 -480
  157. data/vendor/PDCurses/sdl2/pdcscrn.c +0 -443
  158. data/vendor/PDCurses/sdl2/pdcsdl.h +0 -33
  159. data/vendor/PDCurses/sdl2/pdcsetsc.c +0 -67
  160. data/vendor/PDCurses/sdl2/pdcutil.c +0 -39
  161. data/vendor/PDCurses/sdl2/sdltest.c +0 -81
  162. data/vendor/PDCurses/term.h +0 -48
  163. data/vendor/PDCurses/version.mif +0 -7
  164. data/vendor/PDCurses/vt/CMakeLists.txt +0 -28
  165. data/vendor/PDCurses/vt/Makefile +0 -135
  166. data/vendor/PDCurses/vt/Makefile.bcc +0 -111
  167. data/vendor/PDCurses/vt/Makefile.dmc +0 -258
  168. data/vendor/PDCurses/vt/Makefile.vc +0 -144
  169. data/vendor/PDCurses/vt/Makefile.wcc +0 -107
  170. data/vendor/PDCurses/vt/README.md +0 -64
  171. data/vendor/PDCurses/vt/pdcclip.c +0 -20
  172. data/vendor/PDCurses/vt/pdcdisp.c +0 -284
  173. data/vendor/PDCurses/vt/pdcgetsc.c +0 -27
  174. data/vendor/PDCurses/vt/pdckbd.c +0 -394
  175. data/vendor/PDCurses/vt/pdcscrn.c +0 -434
  176. data/vendor/PDCurses/vt/pdcsetsc.c +0 -45
  177. data/vendor/PDCurses/vt/pdcutil.c +0 -43
  178. data/vendor/PDCurses/vt/pdcvt.h +0 -16
  179. data/vendor/PDCurses/watcom.mif +0 -68
  180. data/vendor/PDCurses/wincon/CMakeLists.txt +0 -27
  181. data/vendor/PDCurses/wincon/Makefile.bcc +0 -88
  182. data/vendor/PDCurses/wincon/Makefile.dmc +0 -256
  183. data/vendor/PDCurses/wincon/Makefile.lcc +0 -273
  184. data/vendor/PDCurses/wincon/Makefile.mng +0 -176
  185. data/vendor/PDCurses/wincon/Makefile.vc +0 -144
  186. data/vendor/PDCurses/wincon/Makefile.wcc +0 -51
  187. data/vendor/PDCurses/wincon/README.md +0 -85
  188. data/vendor/PDCurses/wincon/pdcclip.c +0 -174
  189. data/vendor/PDCurses/wincon/pdcdisp.c +0 -143
  190. data/vendor/PDCurses/wincon/pdcgetsc.c +0 -55
  191. data/vendor/PDCurses/wincon/pdckbd.c +0 -786
  192. data/vendor/PDCurses/wincon/pdcscrn.c +0 -717
  193. data/vendor/PDCurses/wincon/pdcsetsc.c +0 -91
  194. data/vendor/PDCurses/wincon/pdcurses.ico +0 -0
  195. data/vendor/PDCurses/wincon/pdcurses.rc +0 -28
  196. data/vendor/PDCurses/wincon/pdcutil.c +0 -41
  197. data/vendor/PDCurses/wincon/pdcwin.h +0 -31
  198. data/vendor/PDCurses/wingui/CMakeLists.txt +0 -27
  199. data/vendor/PDCurses/wingui/Makefile.bcc +0 -85
  200. data/vendor/PDCurses/wingui/Makefile.dmc +0 -259
  201. data/vendor/PDCurses/wingui/Makefile.lcc +0 -273
  202. data/vendor/PDCurses/wingui/Makefile.mng +0 -171
  203. data/vendor/PDCurses/wingui/Makefile.vc +0 -144
  204. data/vendor/PDCurses/wingui/Makefile.wcc +0 -51
  205. data/vendor/PDCurses/wingui/README.md +0 -93
  206. data/vendor/PDCurses/wingui/pdcclip.c +0 -174
  207. data/vendor/PDCurses/wingui/pdcdisp.c +0 -718
  208. data/vendor/PDCurses/wingui/pdcgetsc.c +0 -30
  209. data/vendor/PDCurses/wingui/pdckbd.c +0 -143
  210. data/vendor/PDCurses/wingui/pdcscrn.c +0 -2797
  211. data/vendor/PDCurses/wingui/pdcsetsc.c +0 -89
  212. data/vendor/PDCurses/wingui/pdcurses.ico +0 -0
  213. data/vendor/PDCurses/wingui/pdcurses.rc +0 -28
  214. data/vendor/PDCurses/wingui/pdcutil.c +0 -61
  215. data/vendor/PDCurses/wingui/pdcwin.h +0 -122
  216. data/vendor/PDCurses/x11/Makefile.in +0 -754
  217. data/vendor/PDCurses/x11/PDCurses.spec +0 -82
  218. data/vendor/PDCurses/x11/README.md +0 -62
  219. data/vendor/PDCurses/x11/ScrollBox.c +0 -319
  220. data/vendor/PDCurses/x11/ScrollBox.h +0 -51
  221. data/vendor/PDCurses/x11/ScrollBoxP.h +0 -70
  222. data/vendor/PDCurses/x11/aclocal.m4 +0 -994
  223. data/vendor/PDCurses/x11/big_icon.xbm +0 -46
  224. data/vendor/PDCurses/x11/compose.h +0 -201
  225. data/vendor/PDCurses/x11/config.guess +0 -1500
  226. data/vendor/PDCurses/x11/config.h.in +0 -100
  227. data/vendor/PDCurses/x11/config.sub +0 -1616
  228. data/vendor/PDCurses/x11/configure +0 -6700
  229. data/vendor/PDCurses/x11/configure.ac +0 -295
  230. data/vendor/PDCurses/x11/debian/changelog +0 -6
  231. data/vendor/PDCurses/x11/debian/compat +0 -1
  232. data/vendor/PDCurses/x11/debian/control +0 -11
  233. data/vendor/PDCurses/x11/debian/copyright +0 -27
  234. data/vendor/PDCurses/x11/debian/rules +0 -98
  235. data/vendor/PDCurses/x11/install-sh +0 -253
  236. data/vendor/PDCurses/x11/little_icon.xbm +0 -14
  237. data/vendor/PDCurses/x11/ncurses_cfg.h +0 -45
  238. data/vendor/PDCurses/x11/pdcclip.c +0 -173
  239. data/vendor/PDCurses/x11/pdcdisp.c +0 -85
  240. data/vendor/PDCurses/x11/pdcgetsc.c +0 -28
  241. data/vendor/PDCurses/x11/pdckbd.c +0 -104
  242. data/vendor/PDCurses/x11/pdcscrn.c +0 -258
  243. data/vendor/PDCurses/x11/pdcsetsc.c +0 -95
  244. data/vendor/PDCurses/x11/pdcutil.c +0 -52
  245. data/vendor/PDCurses/x11/pdcx11.c +0 -316
  246. data/vendor/PDCurses/x11/pdcx11.h +0 -191
  247. data/vendor/PDCurses/x11/sb.c +0 -155
  248. data/vendor/PDCurses/x11/x11.c +0 -3686
  249. data/vendor/PDCurses/x11/xcurses-config.in +0 -81
@@ -1,534 +0,0 @@
1
- /* Public Domain Curses */
2
-
3
- #include "pdcsdl.h"
4
-
5
- #include <stdlib.h>
6
- #include <stdint.h>
7
- #include <string.h>
8
-
9
- #ifdef CHTYPE_LONG
10
- # ifdef PDC_WIDE
11
- # define USE_UNICODE_ACS_CHARS 1
12
- # else
13
- # define USE_UNICODE_ACS_CHARS 0
14
- # endif
15
- # include "acs_defs.h"
16
- #endif
17
-
18
- /* see 'addch.c' for an explanation of how combining chars are handled. */
19
-
20
- #if defined( CHTYPE_LONG) && CHTYPE_LONG >= 2 && defined( PDC_WIDE)
21
- #define USING_COMBINING_CHARACTER_SCHEME
22
- #define MAX_UNICODE 0x10ffff
23
- #define DUMMY_CHAR_NEXT_TO_FULLWIDTH (MAX_UNICODE + 1)
24
- int PDC_expand_combined_characters( const cchar_t c, cchar_t *added); /* addch.c */
25
- #endif
26
-
27
- Uint32 pdc_lastupdate = 0;
28
- int PDC_really_blinking = FALSE;
29
- static bool PDC_blink_state = FALSE;
30
-
31
- #define MAXRECT 200 /* maximum number of rects to queue up before
32
- an update is forced; the number was chosen
33
- arbitrarily */
34
-
35
- static SDL_Rect uprect[MAXRECT]; /* table of rects to update */
36
- static int rectcount = 0; /* index into uprect */
37
- static SDL_Color foreground_rgb, background_rgb; /* current foreground, background */
38
-
39
- /* do the real updates on a delay */
40
-
41
- void PDC_update_rects(void)
42
- {
43
- if (rectcount)
44
- {
45
- /* if the maximum number of rects has been reached, we're
46
- probably better off doing a full screen update */
47
-
48
- if (rectcount == MAXRECT)
49
- SDL_UpdateWindowSurface(pdc_window);
50
- else
51
- SDL_UpdateWindowSurfaceRects(pdc_window, uprect, rectcount);
52
-
53
- pdc_lastupdate = SDL_GetTicks();
54
- rectcount = 0;
55
- }
56
- }
57
-
58
- /* PDC_get_rgb_values(), extract_packed_rgb(), intensified_component(), */
59
- /* intensified_color(), and dimmed_color() each exist in x11/x11.c, */
60
- /* win32a/pdcdisp.c, and sdl2/pdcdisp.c in forms slightly modified for */
61
- /* each platform. But they all look pretty much alike. */
62
-
63
- #if defined( CHTYPE_LONG) && CHTYPE_LONG >= 2
64
- /* PDCurses stores RGBs in fifteen bits, five bits each */
65
- /* for red, green, blue. A Pixel uses eight bits per */
66
- /* channel. Hence the following. */
67
- static SDL_Color extract_packed_rgb( const chtype color)
68
- {
69
- SDL_Color rval;
70
-
71
- rval.r = (Uint8)( (color << 3) & 0xf8);
72
- rval.g = (Uint8)( (color >> 2) & 0xf8);
73
- rval.b = (Uint8)( (color >> 7) & 0xf8);
74
- rval.a = (Uint8)255;
75
- return rval;
76
- }
77
- #endif
78
-
79
- /* This function 'intensifies' a color by shifting it toward white. */
80
- /* It used to average the input color with white. Then it did a */
81
- /* weighted average: 2/3 of the input color, 1/3 white, for a */
82
- /* lower "intensification" level. */
83
- /* Then Mark Hessling suggested that the output level should */
84
- /* remap zero to 85 (= 255 / 3, so one-third intensity), and input */
85
- /* of 192 or greater should be remapped to 255 (full intensity). */
86
- /* Assuming we want a linear response between zero and 192, that */
87
- /* leads to output = 85 + input * (255-85)/192. */
88
- /* This should lead to proper handling of bold text in legacy */
89
- /* apps, where "bold" means "high intensity". */
90
-
91
- static Uint8 intensified_component( Uint8 component)
92
- {
93
- if( component >= 192)
94
- component = 255;
95
- else
96
- component = 85 + component * (255 - 85) / 192;
97
- return( component);
98
- }
99
-
100
- static SDL_Color intensified_color( SDL_Color ival)
101
- {
102
- SDL_Color oval;
103
-
104
- oval.r = intensified_component( ival.r);
105
- oval.g = intensified_component( ival.g);
106
- oval.b = intensified_component( ival.b);
107
- return( oval);
108
- }
109
-
110
- /* For use in adjusting colors for A_DIMmed characters. Just */
111
- /* knocks down the intensity of R, G, and B by 1/3. */
112
-
113
- static SDL_Color dimmed_color( SDL_Color ival)
114
- {
115
- ival.r -= ival.r / 3;
116
- ival.g -= ival.g / 3;
117
- ival.b -= ival.b / 3;
118
- return( ival);
119
- }
120
-
121
- void PDC_get_rgb_values( const chtype srcp,
122
- SDL_Color *fore_rgb, SDL_Color *back_rgb)
123
- {
124
- bool reverse_colors = ((srcp & A_REVERSE) ? TRUE : FALSE);
125
- bool intensify_backgnd = FALSE;
126
-
127
- #if defined( CHTYPE_LONG) && CHTYPE_LONG >= 2
128
- if( srcp & A_RGB_COLOR)
129
- {
130
- /* Extract RGB from 30 bits of the color field */
131
- *back_rgb = extract_packed_rgb( srcp >> PDC_COLOR_SHIFT);
132
- *fore_rgb = extract_packed_rgb( srcp >> (PDC_COLOR_SHIFT + 15));
133
- }
134
- else
135
- #endif
136
- {
137
- short foreground_index, background_index;
138
-
139
- PDC_pair_content( PAIR_NUMBER( srcp), &foreground_index, &background_index);
140
- *fore_rgb = pdc_color[foreground_index];
141
- if( background_index >= 0)
142
- *back_rgb = pdc_color[background_index];
143
- }
144
-
145
- if( srcp & A_BLINK)
146
- {
147
- if( !PDC_really_blinking) /* convert 'blinking' to 'bold' */
148
- intensify_backgnd = TRUE;
149
- else if( PDC_blink_state)
150
- reverse_colors = !reverse_colors;
151
- }
152
- if( reverse_colors)
153
- {
154
- const SDL_Color temp = *fore_rgb;
155
-
156
- *fore_rgb = *back_rgb;
157
- *back_rgb = temp;
158
- }
159
-
160
- if( srcp & A_BOLD)
161
- *fore_rgb = intensified_color( *fore_rgb);
162
- if( intensify_backgnd)
163
- *back_rgb = intensified_color( *back_rgb);
164
- if( srcp & A_DIM)
165
- {
166
- *fore_rgb = dimmed_color( *fore_rgb);
167
- *back_rgb = dimmed_color( *back_rgb);
168
- }
169
- }
170
-
171
- #define same_colors( A, B) ((A).r==(B).r && (A).g==(B).g && (A).b==(B).b)
172
-
173
- /* set the font colors to match the chtype's attribute */
174
-
175
- static void _set_attr(chtype ch)
176
- {
177
- static chtype oldch = (chtype)(-1); /* current attribute */
178
- ch &= (A_COLOR|A_BOLD|A_BLINK|A_REVERSE | A_DIM | A_RGB_COLOR);
179
-
180
- if (oldch != ch)
181
- {
182
- SDL_Color fore_rgb, back_rgb;
183
-
184
- if (SP->mono)
185
- return;
186
- PDC_get_rgb_values( ch, &fore_rgb, &back_rgb);
187
-
188
- if( !same_colors( fore_rgb, foreground_rgb))
189
- {
190
- #ifndef PDC_WIDE
191
- SDL_SetPaletteColors(pdc_font->format->palette,
192
- &fore_rgb, pdc_flastc, 1);
193
- #endif
194
- foreground_rgb = fore_rgb;
195
- }
196
-
197
- if( !same_colors( back_rgb, background_rgb))
198
- {
199
- #ifndef PDC_WIDE
200
- SDL_SetPaletteColors(pdc_font->format->palette,
201
- &back_rgb, 0, 1);
202
- #endif
203
- background_rgb = back_rgb;
204
- }
205
-
206
- oldch = ch;
207
- }
208
- }
209
-
210
- #ifdef PDC_WIDE
211
- static void set_font_style( const chtype ch)
212
- {
213
- static int old_font_style = -1;
214
- int font_style = ((ch & A_BOLD) ? TTF_STYLE_BOLD : 0);
215
-
216
- if( ch & A_ITALIC)
217
- font_style |= TTF_STYLE_ITALIC;
218
- if( font_style != old_font_style)
219
- {
220
- TTF_SetFontStyle( pdc_ttffont, font_style);
221
- old_font_style = font_style;
222
- }
223
- }
224
- #endif
225
-
226
- /* draw a cursor at (y, x) */
227
-
228
- void PDC_gotoyx(int row, int col)
229
- {
230
- SDL_Rect src, dest;
231
- chtype ch;
232
- int oldrow, oldcol;
233
- const int cursor_style =
234
- (SP->visibility >> (PDC_blink_state ? 8 : 0)) & 0xff;
235
- #ifdef PDC_WIDE
236
- Uint16 chstr[2] = {0, 0};
237
- #endif
238
-
239
-
240
- PDC_LOG(("PDC_gotoyx() - called: row %d col %d from row %d col %d\n",
241
- row, col, SP->cursrow, SP->curscol));
242
-
243
- if (SP->mono)
244
- return;
245
-
246
- oldrow = SP->cursrow;
247
- oldcol = SP->curscol;
248
-
249
- /* clear the old cursor */
250
-
251
- PDC_transform_line(oldrow, oldcol, 1, curscr->_y[oldrow] + oldcol);
252
-
253
- if (!cursor_style)
254
- return;
255
-
256
- /* draw a new cursor by overprinting the existing character in
257
- reverse, either the full cell (when cursor_style == 2) or the
258
- lowest quarter of it (when cursor_style == 1) */
259
-
260
- ch = curscr->_y[row][col] ^ A_REVERSE;
261
-
262
- _set_attr(ch);
263
-
264
- #ifdef CHTYPE_LONG
265
- if (ch & A_ALTCHARSET && !(ch & 0xff80))
266
- ch = acs_map[ch & 0x7f];
267
- #endif
268
- src.h = (cursor_style == 1) ? pdc_fheight >> 2 : pdc_fheight;
269
- src.w = pdc_fwidth;
270
-
271
- dest.y = (row + 1) * pdc_fheight - src.h + pdc_yoffset;
272
- dest.x = col * pdc_fwidth + pdc_xoffset;
273
-
274
- #ifdef PDC_WIDE
275
- chstr[0] = ch & A_CHARTEXT;
276
- set_font_style( ch);
277
-
278
- pdc_font = TTF_RenderUNICODE_Solid( pdc_ttffont, chstr, foreground_rgb);
279
- if (pdc_font)
280
- {
281
- dest.h = src.h;
282
- dest.w = src.w;
283
- src.x = 0;
284
- src.y = 0;
285
- SDL_SetColorKey( pdc_font, SDL_FALSE, 0);
286
- SDL_SetPaletteColors(pdc_font->format->palette, &background_rgb, 0, 1);
287
- SDL_BlitSurface(pdc_font, &src, pdc_screen, &dest);
288
- SDL_FreeSurface(pdc_font);
289
- pdc_font = NULL;
290
- }
291
- #else
292
-
293
- src.x = (ch & 0xff) % 32 * pdc_fwidth;
294
- src.y = (ch & 0xff) / 32 * pdc_fheight + (pdc_fheight - src.h);
295
-
296
- SDL_BlitSurface(pdc_font, &src, pdc_screen, &dest);
297
- #endif
298
-
299
- if (oldrow != row || oldcol != col)
300
- {
301
- if (rectcount == MAXRECT)
302
- PDC_update_rects();
303
-
304
- uprect[rectcount++] = dest;
305
- }
306
- }
307
-
308
- /* handle the A_*LINE attributes */
309
-
310
- static void _highlight( SDL_Rect *dest, chtype ch)
311
- {
312
- SDL_Color col;
313
- Uint32 pixel_value;
314
-
315
- if (SP->mono)
316
- return;
317
-
318
- if (SP->line_color == -1)
319
- col = foreground_rgb;
320
- else
321
- col = pdc_color[SP->line_color];
322
- pixel_value = SDL_MapRGB( pdc_screen->format, col.r, col.g, col.b);
323
- if (ch & (A_UNDERLINE | A_OVERLINE | A_STRIKEOUT))
324
- {
325
- dest->h = 1;
326
-
327
- if (ch & A_OVERLINE)
328
- SDL_FillRect(pdc_screen, dest, pixel_value);
329
-
330
- if (ch & A_UNDERLINE)
331
- {
332
- dest->y += pdc_fheight - 1;
333
- SDL_FillRect(pdc_screen, dest, pixel_value);
334
- dest->y -= pdc_fheight - 1;
335
- }
336
-
337
- if (ch & A_STRIKEOUT)
338
- {
339
- dest->y += pdc_fheight / 2;
340
- SDL_FillRect(pdc_screen, dest, pixel_value);
341
- dest->y -= pdc_fheight / 2;
342
- }
343
-
344
- dest->h = pdc_fheight;
345
- }
346
-
347
- if (ch & (A_LEFTLINE|A_RIGHTLINE))
348
- {
349
-
350
- dest->w = 1;
351
-
352
- if (ch & A_LEFTLINE)
353
- SDL_FillRect(pdc_screen, dest, pixel_value);
354
-
355
- if (ch & A_RIGHTLINE)
356
- {
357
- dest->x += pdc_fwidth - 1;
358
- SDL_FillRect(pdc_screen, dest, pixel_value);
359
- dest->x -= pdc_fwidth - 1;
360
- }
361
-
362
- dest->w = pdc_fwidth;
363
- }
364
- }
365
-
366
- /* update the given physical line to look like the corresponding line in
367
- curscr */
368
-
369
- void PDC_transform_line(int lineno, int x, int len, const chtype *srcp)
370
- {
371
- SDL_Rect src, dest, lastrect;
372
- int j;
373
- #ifdef PDC_WIDE
374
- Uint16 chstr[2] = {0, 0};
375
- #endif
376
-
377
- PDC_LOG(("PDC_transform_line() - called: lineno=%d\n", lineno));
378
-
379
- if (rectcount == MAXRECT)
380
- PDC_update_rects();
381
-
382
- src.h = pdc_fheight;
383
- src.w = pdc_fwidth;
384
-
385
- dest.y = pdc_fheight * lineno + pdc_yoffset;
386
- dest.x = pdc_fwidth * x + pdc_xoffset;
387
- dest.h = pdc_fheight;
388
- dest.w = pdc_fwidth * len;
389
-
390
- /* if the previous rect was just above this one, with the same width
391
- and horizontal position, then merge the new one with it instead
392
- of adding a new entry */
393
-
394
- if (rectcount)
395
- lastrect = uprect[rectcount - 1];
396
-
397
- if (rectcount && lastrect.x == dest.x && lastrect.w == dest.w)
398
- {
399
- if (lastrect.y + lastrect.h == dest.y)
400
- uprect[rectcount - 1].h = lastrect.h + pdc_fheight;
401
- else
402
- if (lastrect.y != dest.y)
403
- uprect[rectcount++] = dest;
404
- }
405
- else
406
- uprect[rectcount++] = dest;
407
-
408
- dest.w = pdc_fwidth;
409
-
410
- #ifdef PDC_WIDE
411
- src.x = 0;
412
- src.y = 0;
413
- #endif
414
-
415
- for (j = 0; j < len; j++)
416
- {
417
- chtype ch = srcp[j];
418
- #ifdef PDC_WIDE
419
- chtype ch1;
420
- #endif
421
-
422
- _set_attr(ch);
423
-
424
- #ifdef CHTYPE_LONG
425
- if (ch & A_ALTCHARSET && !(ch & 0xff80))
426
- ch = (ch & (A_ATTRIBUTES ^ A_ALTCHARSET)) | acs_map[ch & 0x7f];
427
- #endif
428
-
429
- #ifdef PDC_WIDE
430
- ch1 = ch & A_CHARTEXT;
431
- #ifdef USING_COMBINING_CHARACTER_SCHEME
432
- /* We can't actually display combining characters in cmd.exe. So
433
- show the 'base' character and throw away the modifying marks. */
434
- if( ch1 == DUMMY_CHAR_NEXT_TO_FULLWIDTH)
435
- ch1 = ' ';
436
- else if( ch1 > MAX_UNICODE)
437
- {
438
- cchar_t added;
439
- int n_combined = 0;
440
-
441
- while( (ch1 = PDC_expand_combined_characters( ch1,
442
- &added)) > MAX_UNICODE)
443
- {
444
- n_combined++;
445
- }
446
- }
447
- #ifdef USE_FOR_SUPPLEMENTAL_MULTILINGUAL_PLANE
448
- /* At present, SDL does not (I think) support SMP Unicode */
449
- /* (Unicode past 64K). If it ever does, we'll need the */
450
- /* following breakup of SMP into Unicode surrogates (q.v.) */
451
- if( ch1 > 0xffff)
452
- {
453
- ch1 -= 0x10000;
454
- chstr[0] = (Uint16)( 0xdc00 | (ch1 & 0x3ff)); /* lower 10 bits */
455
- ch1 = (0xd800 | (ch1 >> 10)); /* upper 10 bits */
456
- }
457
- #endif
458
- #endif
459
- chstr[0] = (Uint16)ch1;
460
- set_font_style( ch);
461
- pdc_font = TTF_RenderUNICODE_Solid(pdc_ttffont, chstr,
462
- foreground_rgb);
463
-
464
- if (pdc_font)
465
- {
466
- SDL_SetColorKey( pdc_font, SDL_FALSE, 0);
467
- SDL_SetPaletteColors(pdc_font->format->palette,
468
- &background_rgb, 0, 1);
469
- SDL_BlitSurface(pdc_font, &src, pdc_screen, &dest);
470
- SDL_FreeSurface(pdc_font);
471
- pdc_font = NULL;
472
- }
473
- #else
474
- src.x = (ch & 0xff) % 32 * pdc_fwidth;
475
- src.y = (ch & 0xff) / 32 * pdc_fheight;
476
-
477
- SDL_LowerBlit(pdc_font, &src, pdc_screen, &dest);
478
- #endif
479
-
480
- if (ch & (A_UNDERLINE|A_LEFTLINE|A_RIGHTLINE|A_OVERLINE|A_STRIKEOUT))
481
- _highlight( &dest, ch);
482
-
483
- dest.x += pdc_fwidth;
484
- }
485
- }
486
-
487
-
488
- /* If PDC_really_blinking is 'true', we need to redraw all text with
489
- the A_BLINK attribute set every 500 milliseconds. (We also need to redraw
490
- it when blinking is turned off.) If the line-drawing color changes, we
491
- need to redraw all under/over/left/right-lined text, and strikeout text.
492
- This function, therefore, redraws all text of a specified attribute. */
493
-
494
- static void redraw_text_with_attribute( const chtype attribute)
495
- {
496
- int i, j, k;
497
-
498
- for( i = 0; i < SP->lines; i++)
499
- {
500
- const chtype *srcp = curscr->_y[i];
501
-
502
- for( j = 0; j < SP->cols; j++)
503
- if( srcp[j] & attribute)
504
- {
505
- k = j + 1;
506
- while( k < SP->cols && (srcp[k] & attribute))
507
- k++;
508
- PDC_transform_line( i, j, k - j, srcp + j);
509
- j = k;
510
- }
511
- }
512
- }
513
-
514
- /* Twice a second, we blink the cursor, blink text if it's "really"
515
- blinking (or draw it as 'standout' if it was previously blinking), and
516
- if the line color has changed, we redraw all the lined text. */
517
-
518
- void PDC_twice_a_second( void)
519
- {
520
- static int previously_really_blinking;
521
- static int prev_line_color = -1;
522
-
523
- PDC_blink_state = !PDC_blink_state;
524
- PDC_gotoyx(SP->cursrow, SP->curscol);
525
- if( PDC_really_blinking || previously_really_blinking)
526
- redraw_text_with_attribute( A_BLINK);
527
- previously_really_blinking = PDC_really_blinking;
528
- if( prev_line_color != SP->line_color)
529
- {
530
- redraw_text_with_attribute( A_UNDERLINE | A_OVERLINE | A_STRIKEOUT
531
- | A_LEFTLINE | A_RIGHTLINE);
532
- prev_line_color = SP->line_color;
533
- }
534
- }
@@ -1,30 +0,0 @@
1
- /* Public Domain Curses */
2
-
3
- #include "pdcsdl.h"
4
-
5
- /* get the cursor size/shape */
6
-
7
- int PDC_get_cursor_mode(void)
8
- {
9
- PDC_LOG(("PDC_get_cursor_mode() - called\n"));
10
-
11
- return 0;
12
- }
13
-
14
- /* return number of screen rows */
15
-
16
- int PDC_get_rows(void)
17
- {
18
- PDC_LOG(("PDC_get_rows() - called\n"));
19
-
20
- return pdc_sheight / pdc_fheight;
21
- }
22
-
23
- /* return width of screen/viewport */
24
-
25
- int PDC_get_columns(void)
26
- {
27
- PDC_LOG(("PDC_get_columns() - called\n"));
28
-
29
- return pdc_swidth / pdc_fwidth;
30
- }