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,718 +0,0 @@
|
|
1
|
-
/* Public Domain Curses */
|
2
|
-
|
3
|
-
#include "pdcwin.h"
|
4
|
-
|
5
|
-
#include <assert.h>
|
6
|
-
#include <stdlib.h>
|
7
|
-
#include <string.h>
|
8
|
-
#include <tchar.h>
|
9
|
-
|
10
|
-
/* For this 'real Windows' version, we use all Unicode all the time,
|
11
|
-
including for ACS characters, and even when PDC_WIDE isn't #defined
|
12
|
-
(i.e., when running in 'legacy' 8-bit character mode) See 'acs_defs.h'
|
13
|
-
for details. */
|
14
|
-
|
15
|
-
#define USE_UNICODE_ACS_CHARS 1
|
16
|
-
|
17
|
-
#include "acs_defs.h"
|
18
|
-
|
19
|
-
static const unsigned short starting_ascii_to_unicode[32] = {
|
20
|
-
0,
|
21
|
-
0x263a, /* 1 smiling face */
|
22
|
-
0x263b, /* 2 smiling face inverted */
|
23
|
-
0x2665, /* 3 heart */
|
24
|
-
0x2666, /* 4 diamond */
|
25
|
-
0x2663, /* 5 club */
|
26
|
-
0x2660, /* 6 spade */
|
27
|
-
0x2024, /* 7 small bullet */
|
28
|
-
0x25d8, /* 8 inverted bullet */
|
29
|
-
0x25bc, /* 9 hollow bullet */
|
30
|
-
0x25d9, /* 10 inverted hollow bullet */
|
31
|
-
0x2642, /* 11 male/Mars symbol */
|
32
|
-
0x2640, /* 12 female/Venus symbol */
|
33
|
-
0x266a, /* 13 eighth note */
|
34
|
-
0x266c, /* 14 two sixteenth notes */
|
35
|
-
0x263c, /* 15 splat */
|
36
|
-
0x25b6, /* 16 right-pointing triangle */
|
37
|
-
0x25c0, /* 17 left-pointing triangle */
|
38
|
-
0x2195, /* 18 double up/down arrow */
|
39
|
-
0x203c, /* 19 double exclamation !! */
|
40
|
-
0x00b6, /* 20 pilcrow */
|
41
|
-
0xa7, /* 21 */
|
42
|
-
0x2582, /* 22 lower 1/3 block */
|
43
|
-
0x280d, /* 23 double up/down arrow */
|
44
|
-
0x2191, /* 24 up arrow */
|
45
|
-
0x2193, /* 25 down arrow */
|
46
|
-
0x2192, /* 26 right arrow */
|
47
|
-
0x2190, /* 27 left arrow */
|
48
|
-
0x2319, /* 28 */
|
49
|
-
0x280c, /* 29 left & right arrow */
|
50
|
-
0x25b2, /* 30 up triangle */
|
51
|
-
0x25bc}; /* 31 down triangle */
|
52
|
-
|
53
|
-
/* Cursors may be added to the 'shapes' array. A 'shapes' string
|
54
|
-
defines the cursor as one or more rectangles, separated by semicolons.
|
55
|
-
The coordinates of the upper left and lower right corners are given,
|
56
|
-
usually just as integers from zero to eight. Thus, "0488" means a
|
57
|
-
rectangle running from (0,4), middle of the left side, to (8,8),
|
58
|
-
bottom right corner: a rectangle filling the bottom half of the
|
59
|
-
character cell. "0048" would fill the left half of the cell, and
|
60
|
-
"0082;6088" would fill the top and bottom quarters of the cell.
|
61
|
-
|
62
|
-
However, a coordinate may be followed by a + or -, and then by a
|
63
|
-
single-digit offset in pixels. So "08-4" refers to a point on the
|
64
|
-
left-hand side of the character cell, four pixels from the bottom. I
|
65
|
-
admit that the cursor descriptions themselves look a little strange!
|
66
|
-
But this way of describing cursors is compact and lends itself to some
|
67
|
-
pretty simple code.
|
68
|
-
|
69
|
-
The first three lines are standard PDCurses cursors: 0=no cursor,
|
70
|
-
1=four-pixel thick line at bottom of the cell, 2="high-intensity",
|
71
|
-
i.e., a filled block. The rest are extended cursors, not currently
|
72
|
-
available in other PDCurses flavors. */
|
73
|
-
|
74
|
-
#define N_CURSORS 9
|
75
|
-
|
76
|
-
static void redraw_cursor_from_index( const HDC hdc, const int idx)
|
77
|
-
{
|
78
|
-
const char *shapes[N_CURSORS] = {
|
79
|
-
"", /* 0: invisible */
|
80
|
-
"08-488", /* 1: normal: four lines at bottom */
|
81
|
-
"0088", /* 2: full block */
|
82
|
-
"0088;0+10+18-18-1", /* 3: outlined block */
|
83
|
-
"28-368;4-10+34+18-3;2060+3", /* 4: caret */
|
84
|
-
"0488", /* 5: bottom half block */
|
85
|
-
"2266", /* 6: central block */
|
86
|
-
"0385;3053;3558", /* 7: cross */
|
87
|
-
"0088;0+10+48-18-4" }; /* 8: outlined block: heavy top/bottom*/
|
88
|
-
const char *sptr = shapes[idx];
|
89
|
-
LONG left, top;
|
90
|
-
extern int PDC_cxChar, PDC_cyChar;
|
91
|
-
|
92
|
-
left = SP->curscol * PDC_cxChar;
|
93
|
-
top = SP->cursrow * PDC_cyChar;
|
94
|
-
while( *sptr)
|
95
|
-
{
|
96
|
-
int i;
|
97
|
-
LONG coords[4];
|
98
|
-
RECT rect;
|
99
|
-
|
100
|
-
for( i = 0; i < 4; i++)
|
101
|
-
{
|
102
|
-
coords[i] = (( i & 1) ?
|
103
|
-
top + (PDC_cyChar * (*sptr - '0') + 4) / 8 :
|
104
|
-
left + (PDC_cxChar * (*sptr - '0') + 4) / 8);
|
105
|
-
sptr++;
|
106
|
-
if( *sptr == '+' || *sptr == '-')
|
107
|
-
{
|
108
|
-
if( *sptr == '+')
|
109
|
-
coords[i] += sptr[1] - '0';
|
110
|
-
else
|
111
|
-
coords[i] -= sptr[1] - '0';
|
112
|
-
sptr += 2;
|
113
|
-
}
|
114
|
-
}
|
115
|
-
rect.left = coords[0];
|
116
|
-
rect.top = coords[1];
|
117
|
-
rect.right = coords[2];
|
118
|
-
rect.bottom = coords[3];
|
119
|
-
InvertRect( hdc, &rect);
|
120
|
-
if( *sptr == ';')
|
121
|
-
sptr++;
|
122
|
-
}
|
123
|
-
}
|
124
|
-
|
125
|
-
/* PDC_current_cursor_state( ) determines which cursor, if any,
|
126
|
-
is currently shown. This may depend on the blink state. Also,
|
127
|
-
if the window currently lacks the focus, we show cursor 3 (a hollow
|
128
|
-
box) in place of any visible cursor. */
|
129
|
-
|
130
|
-
static int PDC_current_cursor_state( void)
|
131
|
-
{
|
132
|
-
extern int PDC_blink_state;
|
133
|
-
extern HWND PDC_hWnd;
|
134
|
-
const int shift_amount = (PDC_blink_state ? 0 : 8);
|
135
|
-
const int cursor_style_for_unfocussed_window =
|
136
|
-
PDC_CURSOR( PDC_CURSOR_OUTLINE, PDC_CURSOR_OUTLINE);
|
137
|
-
int cursor_style;
|
138
|
-
|
139
|
-
/* for unfocussed windows, show an hollow box: */
|
140
|
-
if( SP->visibility && (PDC_hWnd != GetForegroundWindow( )))
|
141
|
-
cursor_style = cursor_style_for_unfocussed_window;
|
142
|
-
else /* otherwise, just show the cursor "normally" */
|
143
|
-
cursor_style = SP->visibility;
|
144
|
-
return( (cursor_style >> shift_amount) & 0xff);
|
145
|
-
}
|
146
|
-
|
147
|
-
static void redraw_cursor( const HDC hdc)
|
148
|
-
{
|
149
|
-
const int cursor_style = PDC_current_cursor_state( );
|
150
|
-
|
151
|
-
if( cursor_style > 0 && cursor_style < N_CURSORS)
|
152
|
-
redraw_cursor_from_index( hdc, cursor_style);
|
153
|
-
}
|
154
|
-
|
155
|
-
/* position "hardware" cursor at (y, x). We don't have a for-real hardware */
|
156
|
-
/* cursor in this version, of course, but we can fake it. Note that much */
|
157
|
-
/* of the logic was borrowed from the SDL version. In particular, the */
|
158
|
-
/* cursor is moved by first overwriting the "original" location. */
|
159
|
-
|
160
|
-
void PDC_gotoyx(int row, int col)
|
161
|
-
{
|
162
|
-
PDC_LOG(("PDC_gotoyx() - called: row %d col %d from row %d col %d\n",
|
163
|
-
row, col, SP->cursrow, SP->curscol));
|
164
|
-
|
165
|
-
/* clear the old cursor, if it's on-screen: */
|
166
|
-
if( SP->cursrow >= 0 && SP->curscol >= 0 &&
|
167
|
-
SP->cursrow < SP->lines && SP->curscol < SP->cols)
|
168
|
-
{
|
169
|
-
const int temp_visibility = SP->visibility;
|
170
|
-
|
171
|
-
SP->visibility = 0;
|
172
|
-
PDC_transform_line( SP->cursrow, SP->curscol, 1,
|
173
|
-
curscr->_y[SP->cursrow] + SP->curscol);
|
174
|
-
SP->visibility = temp_visibility;
|
175
|
-
}
|
176
|
-
|
177
|
-
/* ...then draw the new (assuming it's actually visible). */
|
178
|
-
/* This used to require some logic. Now the redraw_cursor() */
|
179
|
-
/* function figures out what cursor should be drawn, if any. */
|
180
|
-
if( SP->visibility)
|
181
|
-
{
|
182
|
-
extern HWND PDC_hWnd;
|
183
|
-
HDC hdc = GetDC( PDC_hWnd) ;
|
184
|
-
|
185
|
-
SP->curscol = col;
|
186
|
-
SP->cursrow = row;
|
187
|
-
redraw_cursor( hdc);
|
188
|
-
ReleaseDC( PDC_hWnd, hdc) ;
|
189
|
-
}
|
190
|
-
}
|
191
|
-
|
192
|
-
int PDC_font_size = 12;
|
193
|
-
TCHAR PDC_font_name[80];
|
194
|
-
|
195
|
-
static LOGFONT PDC_get_logical_font( const int font_idx)
|
196
|
-
{
|
197
|
-
LOGFONT lf;
|
198
|
-
|
199
|
-
memset(&lf, 0, sizeof(LOGFONT)); /* Clear out structure. */
|
200
|
-
lf.lfHeight = -PDC_font_size;
|
201
|
-
#ifdef PDC_WIDE
|
202
|
-
if( !*PDC_font_name)
|
203
|
-
wcscpy( PDC_font_name, _T("Courier New"));
|
204
|
-
if( font_idx & 4)
|
205
|
-
wcscpy( lf.lfFaceName, _T("Unifont"));
|
206
|
-
else
|
207
|
-
wcscpy( lf.lfFaceName, PDC_font_name );
|
208
|
-
/* wprintf( L"New font: %s\n", PDC_font_name); */
|
209
|
-
#else
|
210
|
-
if( !*PDC_font_name)
|
211
|
-
strcpy( PDC_font_name, "Courier New");
|
212
|
-
if( font_idx & 4)
|
213
|
-
strcpy( lf.lfFaceName, "Unifont");
|
214
|
-
else
|
215
|
-
strcpy( lf.lfFaceName, PDC_font_name);
|
216
|
-
#endif
|
217
|
-
/* lf.lfPitchAndFamily = FIXED_PITCH | FF_MODERN; */
|
218
|
-
lf.lfPitchAndFamily = FF_MODERN;
|
219
|
-
lf.lfWeight = ((font_idx & 1) ? FW_EXTRABOLD : FW_NORMAL);
|
220
|
-
lf.lfItalic = ((font_idx & 2) ? TRUE : FALSE);
|
221
|
-
lf.lfCharSet = ANSI_CHARSET;
|
222
|
-
lf.lfQuality = PROOF_QUALITY;
|
223
|
-
lf.lfOutPrecision = OUT_RASTER_PRECIS;
|
224
|
-
return( lf);
|
225
|
-
}
|
226
|
-
|
227
|
-
HFONT PDC_get_font_handle( const int font_idx)
|
228
|
-
{
|
229
|
-
LOGFONT lf = PDC_get_logical_font( font_idx);
|
230
|
-
|
231
|
-
return( CreateFontIndirect( &lf));
|
232
|
-
}
|
233
|
-
|
234
|
-
int debug_printf( const char *format, ...); /* pdcscrn.c */
|
235
|
-
|
236
|
-
int PDC_choose_a_new_font( void)
|
237
|
-
{
|
238
|
-
LOGFONT lf = PDC_get_logical_font( 0);
|
239
|
-
CHOOSEFONT cf;
|
240
|
-
int rval;
|
241
|
-
extern HWND PDC_hWnd;
|
242
|
-
|
243
|
-
lf.lfHeight = -PDC_font_size;
|
244
|
-
debug_printf( "In PDC_choose_a_new_font: %d\n", lf.lfHeight);
|
245
|
-
memset( &cf, 0, sizeof( CHOOSEFONT));
|
246
|
-
cf.lStructSize = sizeof( CHOOSEFONT);
|
247
|
-
cf.Flags = CF_INITTOLOGFONTSTRUCT | CF_SCREENFONTS;
|
248
|
-
cf.hwndOwner = PDC_hWnd;
|
249
|
-
cf.lpLogFont = &lf;
|
250
|
-
cf.rgbColors = RGB( 0, 0, 0);
|
251
|
-
rval = ChooseFont( &cf);
|
252
|
-
if( rval)
|
253
|
-
#ifdef PDC_WIDE
|
254
|
-
wcscpy( PDC_font_name, lf.lfFaceName);
|
255
|
-
#else
|
256
|
-
strcpy( PDC_font_name, lf.lfFaceName);
|
257
|
-
#endif
|
258
|
-
debug_printf( "rval %d; %ld\n", rval, CommDlgExtendedError( ));
|
259
|
-
debug_printf( "output size: %d\n", lf.lfHeight);
|
260
|
-
PDC_font_size = -lf.lfHeight;
|
261
|
-
return( rval);
|
262
|
-
}
|
263
|
-
|
264
|
-
/* This function 'intensifies' a color by shifting it toward white. */
|
265
|
-
/* It used to average the input color with white. Then it did a */
|
266
|
-
/* weighted average: 2/3 of the input color, 1/3 white, for a */
|
267
|
-
/* lower "intensification" level. */
|
268
|
-
/* Then Mark Hessling suggested that the output level should */
|
269
|
-
/* remap zero to 85 (= 255 / 3, so one-third intensity), and input */
|
270
|
-
/* of 192 or greater should be remapped to 255 (full intensity). */
|
271
|
-
/* Assuming we want a linear response between zero and 192, that */
|
272
|
-
/* leads to output = 85 + input * (255-85)/192. */
|
273
|
-
/* This should lead to proper handling of bold text in legacy */
|
274
|
-
/* apps, where "bold" means "high intensity". */
|
275
|
-
|
276
|
-
static COLORREF intensified_color( COLORREF ival)
|
277
|
-
{
|
278
|
-
int rgb, i;
|
279
|
-
COLORREF oval = 0;
|
280
|
-
|
281
|
-
for( i = 0; i < 3; i++, ival >>= 8)
|
282
|
-
{
|
283
|
-
rgb = (int)( ival & 0xff);
|
284
|
-
if( rgb >= 192)
|
285
|
-
rgb = 255;
|
286
|
-
else
|
287
|
-
rgb = 85 + rgb * (255 - 85) / 192;
|
288
|
-
oval |= ((COLORREF)rgb << (i * 8));
|
289
|
-
}
|
290
|
-
return( oval);
|
291
|
-
}
|
292
|
-
|
293
|
-
/* For use in adjusting colors for A_DIMmed characters. Just */
|
294
|
-
/* knocks down the intensity of R, G, and B by 1/3. */
|
295
|
-
|
296
|
-
static COLORREF dimmed_color( COLORREF ival)
|
297
|
-
{
|
298
|
-
unsigned i;
|
299
|
-
COLORREF oval = 0;
|
300
|
-
|
301
|
-
for( i = 0; i < 3; i++, ival >>= 8)
|
302
|
-
{
|
303
|
-
unsigned rgb = (unsigned)( ival & 0xff);
|
304
|
-
|
305
|
-
rgb -= (rgb / 3);
|
306
|
-
oval |= ((COLORREF)rgb << (i * 8));
|
307
|
-
}
|
308
|
-
return( oval);
|
309
|
-
}
|
310
|
-
|
311
|
-
/* see 'addch.c' for an explanation of how combining chars are handled. */
|
312
|
-
|
313
|
-
#if defined( CHTYPE_LONG) && CHTYPE_LONG >= 2
|
314
|
-
#ifdef PDC_WIDE
|
315
|
-
#define USING_COMBINING_CHARACTER_SCHEME
|
316
|
-
int PDC_expand_combined_characters( const cchar_t c, cchar_t *added); /* addch.c */
|
317
|
-
#endif
|
318
|
-
|
319
|
-
/* PDC_get_rgb_values(), extract_packed_rgb(), intensified_component(), */
|
320
|
-
/* intensified_color(), and dimmed_color() each exist in x11/x11.c, */
|
321
|
-
/* wingui/pdcdisp.c, and sdl2/pdcdisp.c in forms slightly modified for */
|
322
|
-
/* each platform. But they all look pretty much alike. */
|
323
|
-
|
324
|
-
/* PDCurses stores RGBs in fifteen bits, five bits each */
|
325
|
-
/* for red, green, blue. A COLORREF uses eight bits per */
|
326
|
-
/* channel. Hence the following. */
|
327
|
-
static COLORREF extract_packed_rgb( const chtype color)
|
328
|
-
{
|
329
|
-
const int red = (int)( (color << 3) & 0xf8);
|
330
|
-
const int green = (int)( (color >> 2) & 0xf8);
|
331
|
-
const int blue = (int)( (color >> 7) & 0xf8);
|
332
|
-
|
333
|
-
return( RGB( red, green, blue));
|
334
|
-
}
|
335
|
-
#endif
|
336
|
-
|
337
|
-
|
338
|
-
void PDC_get_rgb_values( const chtype srcp,
|
339
|
-
COLORREF *foreground_rgb, COLORREF *background_rgb)
|
340
|
-
{
|
341
|
-
const int color = (int)(( srcp & A_COLOR) >> PDC_COLOR_SHIFT);
|
342
|
-
bool reverse_colors = ((srcp & A_REVERSE) ? TRUE : FALSE);
|
343
|
-
bool intensify_backgnd = FALSE;
|
344
|
-
|
345
|
-
#if defined( CHTYPE_LONG) && CHTYPE_LONG >= 2
|
346
|
-
if( srcp & A_RGB_COLOR)
|
347
|
-
{
|
348
|
-
/* Extract RGB from 30 bits of the color field */
|
349
|
-
*background_rgb = extract_packed_rgb( srcp >> PDC_COLOR_SHIFT);
|
350
|
-
*foreground_rgb = extract_packed_rgb( srcp >> (PDC_COLOR_SHIFT + 15));
|
351
|
-
}
|
352
|
-
else
|
353
|
-
#endif
|
354
|
-
{
|
355
|
-
extern COLORREF *pdc_rgbs;
|
356
|
-
short foreground_index, background_index;
|
357
|
-
|
358
|
-
PDC_pair_content( (short)color, &foreground_index, &background_index);
|
359
|
-
*foreground_rgb = pdc_rgbs[foreground_index];
|
360
|
-
*background_rgb = pdc_rgbs[background_index];
|
361
|
-
}
|
362
|
-
|
363
|
-
if( srcp & A_BLINK)
|
364
|
-
{
|
365
|
-
extern int PDC_really_blinking; /* see 'pdcsetsc.c' */
|
366
|
-
extern int PDC_blink_state;
|
367
|
-
|
368
|
-
if( !PDC_really_blinking) /* convert 'blinking' to 'bold' */
|
369
|
-
intensify_backgnd = TRUE;
|
370
|
-
else if( PDC_blink_state)
|
371
|
-
reverse_colors = !reverse_colors;
|
372
|
-
}
|
373
|
-
if( reverse_colors)
|
374
|
-
{
|
375
|
-
const COLORREF temp = *foreground_rgb;
|
376
|
-
|
377
|
-
*foreground_rgb = *background_rgb;
|
378
|
-
*background_rgb = temp;
|
379
|
-
}
|
380
|
-
|
381
|
-
if( srcp & A_BOLD)
|
382
|
-
*foreground_rgb = intensified_color( *foreground_rgb);
|
383
|
-
if( intensify_backgnd)
|
384
|
-
*background_rgb = intensified_color( *background_rgb);
|
385
|
-
if( srcp & A_DIM)
|
386
|
-
*foreground_rgb = dimmed_color( *foreground_rgb);
|
387
|
-
if( srcp & A_DIM)
|
388
|
-
*background_rgb = dimmed_color( *background_rgb);
|
389
|
-
}
|
390
|
-
|
391
|
-
#ifdef PDC_WIDE
|
392
|
-
const chtype MAX_UNICODE = 0x110000;
|
393
|
-
#endif
|
394
|
-
|
395
|
-
#ifdef USE_FALLBACK_FONT
|
396
|
-
GLYPHSET *PDC_unicode_range_data = NULL;
|
397
|
-
|
398
|
-
/* Note that in the following, if a character has a Unicode point
|
399
|
-
greater than 64K (i.e., it's not in the Basic Multilingual Plane),
|
400
|
-
we assume it has a glyph in the font. The problem is that, due to
|
401
|
-
the brain-dead implementation of Unicode in Windoze, we can't
|
402
|
-
actually tell if there is a glyph or not; the "range" data is 16-bit. */
|
403
|
-
|
404
|
-
static bool character_is_in_font( chtype ichar)
|
405
|
-
{
|
406
|
-
int i;
|
407
|
-
WCRANGE *wptr = PDC_unicode_range_data->ranges;
|
408
|
-
|
409
|
-
if( (ichar & A_ALTCHARSET) && (ichar & A_CHARTEXT) < 0x80)
|
410
|
-
ichar = acs_map[ichar & 0x7f];
|
411
|
-
ichar &= A_CHARTEXT;
|
412
|
-
if( ichar > MAX_UNICODE) /* assume combining chars won't be */
|
413
|
-
return( FALSE); /* supported; they rarely are */
|
414
|
-
if( ichar > 0xffff) /* see above comments */
|
415
|
-
return( TRUE);
|
416
|
-
for( i = PDC_unicode_range_data->cRanges; i; i--, wptr++)
|
417
|
-
if( wptr->wcLow > ichar)
|
418
|
-
return( FALSE);
|
419
|
-
else if( wptr->wcLow + wptr->cGlyphs > ichar)
|
420
|
-
return( TRUE);
|
421
|
-
/* Didn't find it in any range; it must not be in the font */
|
422
|
-
return( FALSE);
|
423
|
-
}
|
424
|
-
#endif /* #ifdef USE_FALLBACK_FONT */
|
425
|
-
|
426
|
-
/* update the given physical line to look like the corresponding line in
|
427
|
-
curscr.
|
428
|
-
|
429
|
-
NOTE that if x > 0, we decrement it and srcp, and increment the
|
430
|
-
length. In other words, we draw the preceding character, too. This
|
431
|
-
is done because, at certain font sizes, characters break out and
|
432
|
-
overwrite the preceding character. That results in debris left on
|
433
|
-
the screen.
|
434
|
-
|
435
|
-
The code also now increments the length only, drawing one more
|
436
|
-
character (i.e., draws the character following the "text we really
|
437
|
-
want"). Again, this helps to avoid debris left on the screen.
|
438
|
-
|
439
|
-
The 'ExtTextOut' function takes an lpDx array that specifies the exact
|
440
|
-
placement of each character relative to the previous character. This seems
|
441
|
-
to help avoid most (but not all) stray pixels from being displayed. The
|
442
|
-
problem is that, at certain font sizes, letters may be drawn that don't
|
443
|
-
fit properly in the clip rectangle; and they aren't actually clipped
|
444
|
-
correctly, despite the use of the ETO_CLIPPED flag. But things do seem
|
445
|
-
to be much better than was the case back when plain 'TextOut' was used. */
|
446
|
-
|
447
|
-
#define N_CACHED_FONTS 8
|
448
|
-
|
449
|
-
static HFONT hFonts[N_CACHED_FONTS];
|
450
|
-
|
451
|
-
#define BUFFSIZE 50
|
452
|
-
|
453
|
-
int PDC_find_ends_of_selected_text( const int line,
|
454
|
-
const RECT *rect, int *x); /* pdcscrn.c */
|
455
|
-
|
456
|
-
void PDC_transform_line_given_hdc( const HDC hdc, const int lineno,
|
457
|
-
int x, int len, const chtype *srcp)
|
458
|
-
{
|
459
|
-
HFONT hOldFont = (HFONT)0;
|
460
|
-
extern int PDC_cxChar, PDC_cyChar;
|
461
|
-
int i, curr_color = -1;
|
462
|
-
attr_t font_attrib = (attr_t)-1;
|
463
|
-
int cursor_overwritten = FALSE;
|
464
|
-
COLORREF foreground_rgb = 0;
|
465
|
-
chtype prev_ch = 0;
|
466
|
-
extern RECT PDC_mouse_rect; /* see 'pdcscrn.c' */
|
467
|
-
int selection[2];
|
468
|
-
|
469
|
-
if( !srcp) /* just freeing up fonts */
|
470
|
-
{
|
471
|
-
for( i = 0; i < N_CACHED_FONTS; i++)
|
472
|
-
if( hFonts[i])
|
473
|
-
{
|
474
|
-
DeleteObject( hFonts[i]);
|
475
|
-
hFonts[i] = NULL;
|
476
|
-
}
|
477
|
-
#ifdef USE_FALLBACK_FONT
|
478
|
-
if( PDC_unicode_range_data)
|
479
|
-
{
|
480
|
-
free( PDC_unicode_range_data);
|
481
|
-
PDC_unicode_range_data = NULL;
|
482
|
-
}
|
483
|
-
#endif
|
484
|
-
return;
|
485
|
-
}
|
486
|
-
/* Seems to me as if the input text to this function */
|
487
|
-
if( x < 0) /* should _never_ be off-screen. But it sometimes is. */
|
488
|
-
{ /* Clipping is therefore necessary. */
|
489
|
-
len += x;
|
490
|
-
srcp -= x;
|
491
|
-
x = 0;
|
492
|
-
}
|
493
|
-
len++; /* draw an extra char to avoid leaving garbage on screen */
|
494
|
-
if( len > SP->cols - x)
|
495
|
-
len = SP->cols - x;
|
496
|
-
if( lineno >= SP->lines || len <= 0 || lineno < 0)
|
497
|
-
return;
|
498
|
-
if( x) /* back up by one character to avoid */
|
499
|
-
{ /* leaving garbage on the screen */
|
500
|
-
x--;
|
501
|
-
len++;
|
502
|
-
srcp--;
|
503
|
-
}
|
504
|
-
if( lineno == SP->cursrow && SP->curscol >= x && SP->curscol < x + len)
|
505
|
-
if( PDC_current_cursor_state( ))
|
506
|
-
cursor_overwritten = TRUE;
|
507
|
-
|
508
|
-
|
509
|
-
while( len)
|
510
|
-
{
|
511
|
-
extern int PDC_really_blinking; /* see 'pdcsetsc.c' */
|
512
|
-
const attr_t attrib = (attr_t)( *srcp >> PDC_REAL_ATTR_SHIFT);
|
513
|
-
const int color = (int)(( *srcp & A_COLOR) >> PDC_COLOR_SHIFT);
|
514
|
-
attr_t new_font_attrib = (*srcp & (A_BOLD | A_ITALIC));
|
515
|
-
RECT clip_rect;
|
516
|
-
wchar_t buff[BUFFSIZE];
|
517
|
-
int lpDx[BUFFSIZE + 1];
|
518
|
-
int olen = 0;
|
519
|
-
#ifdef USE_FALLBACK_FONT
|
520
|
-
const bool in_font = character_is_in_font( *srcp);
|
521
|
-
#endif
|
522
|
-
|
523
|
-
for( i = 0; i < len && olen < BUFFSIZE - 1
|
524
|
-
#ifdef USE_FALLBACK_FONT
|
525
|
-
&& (in_font == character_is_in_font( srcp[i])
|
526
|
-
|| (srcp[i] & A_CHARTEXT) == MAX_UNICODE)
|
527
|
-
#endif
|
528
|
-
&& attrib == (attr_t)( srcp[i] >> PDC_REAL_ATTR_SHIFT); i++)
|
529
|
-
{
|
530
|
-
chtype ch = srcp[i] & A_CHARTEXT;
|
531
|
-
|
532
|
-
#if( defined( PDC_WIDE) && defined( CHTYPE_LONG))
|
533
|
-
if( ch > 0xffff && ch < MAX_UNICODE) /* use Unicode surrogates to fit */
|
534
|
-
{ /* >64K values into 16-bit wchar_t: */
|
535
|
-
ch -= 0x10000;
|
536
|
-
buff[olen] = (wchar_t)( 0xd800 | (ch >> 10));
|
537
|
-
lpDx[olen] = 0; /* ^ upper 10 bits */
|
538
|
-
olen++;
|
539
|
-
ch = (wchar_t)( 0xdc00 | (ch & 0x3ff)); /* lower 10 bits */
|
540
|
-
}
|
541
|
-
#if( CHTYPE_LONG >= 2) /* "non-standard" 64-bit chtypes; combining */
|
542
|
-
if( ch > MAX_UNICODE) /* chars & fullwidth supported */
|
543
|
-
{
|
544
|
-
cchar_t added[10], root = ch;
|
545
|
-
int n_combined = 0;
|
546
|
-
|
547
|
-
while( (root = PDC_expand_combined_characters( root,
|
548
|
-
&added[n_combined])) > MAX_UNICODE)
|
549
|
-
{
|
550
|
-
n_combined++;
|
551
|
-
}
|
552
|
-
buff[olen] = (wchar_t)root;
|
553
|
-
lpDx[olen] = 0;
|
554
|
-
olen++;
|
555
|
-
ch = (wchar_t)added[n_combined];
|
556
|
-
while( n_combined)
|
557
|
-
{
|
558
|
-
n_combined--;
|
559
|
-
buff[olen] = (wchar_t)added[n_combined];
|
560
|
-
lpDx[olen] = 0;
|
561
|
-
olen++;
|
562
|
-
}
|
563
|
-
}
|
564
|
-
#endif
|
565
|
-
#endif
|
566
|
-
if( (srcp[i] & A_ALTCHARSET) && ch < 0x80)
|
567
|
-
ch = acs_map[ch & 0x7f];
|
568
|
-
else if( ch < 32)
|
569
|
-
ch = starting_ascii_to_unicode[ch];
|
570
|
-
#ifndef PDC_WIDE /* If we're in Unicode, assume */
|
571
|
-
else if( ch <= 0xff) /* the incoming text doesn't need */
|
572
|
-
{ /* code-page translation */
|
573
|
-
char c = (char)ch;
|
574
|
-
wchar_t z;
|
575
|
-
|
576
|
-
mbtowc( &z, &c, 1);
|
577
|
-
ch = (chtype)z;
|
578
|
-
}
|
579
|
-
assert( "We should never get here");
|
580
|
-
#endif
|
581
|
-
buff[olen] = (wchar_t)ch;
|
582
|
-
lpDx[olen] = PDC_cxChar;
|
583
|
-
#ifdef PDC_WIDE
|
584
|
-
if( ch != MAX_UNICODE)
|
585
|
-
olen++;
|
586
|
-
else if( olen) /* prev char is double-width */
|
587
|
-
lpDx[olen - 1] = 2 * PDC_cxChar;
|
588
|
-
#else
|
589
|
-
olen++;
|
590
|
-
#endif
|
591
|
-
}
|
592
|
-
lpDx[olen] = PDC_cxChar;
|
593
|
-
if( color != curr_color || ((prev_ch ^ *srcp) & (A_REVERSE | A_BLINK | A_BOLD | A_DIM)))
|
594
|
-
{
|
595
|
-
COLORREF background_rgb;
|
596
|
-
|
597
|
-
PDC_get_rgb_values( *srcp, &foreground_rgb, &background_rgb);
|
598
|
-
curr_color = color;
|
599
|
-
SetTextColor( hdc, foreground_rgb);
|
600
|
-
SetBkColor( hdc, background_rgb);
|
601
|
-
}
|
602
|
-
if( !PDC_really_blinking && (*srcp & A_BLINK))
|
603
|
-
new_font_attrib &= ~A_BLINK;
|
604
|
-
#ifdef USE_FALLBACK_FONT
|
605
|
-
if( !in_font) /* flag to indicate use of */
|
606
|
-
new_font_attrib |= 1; /* fallback font */
|
607
|
-
#endif
|
608
|
-
if( new_font_attrib != font_attrib)
|
609
|
-
{
|
610
|
-
HFONT hFont;
|
611
|
-
int idx = 0;
|
612
|
-
|
613
|
-
font_attrib = new_font_attrib;
|
614
|
-
if( font_attrib & A_BOLD)
|
615
|
-
idx |= 1;
|
616
|
-
if( font_attrib & A_ITALIC)
|
617
|
-
idx |= 2;
|
618
|
-
if( font_attrib & 1) /* use Unifont or other fallback font */
|
619
|
-
idx |= 4;
|
620
|
-
if( !hFonts[idx])
|
621
|
-
hFonts[idx] = PDC_get_font_handle( idx);
|
622
|
-
hFont = SelectObject( hdc, hFonts[idx]);
|
623
|
-
if( !hOldFont)
|
624
|
-
hOldFont = hFont;
|
625
|
-
}
|
626
|
-
prev_ch = *srcp;
|
627
|
-
clip_rect.left = x * PDC_cxChar;
|
628
|
-
clip_rect.top = lineno * PDC_cyChar;
|
629
|
-
clip_rect.right = clip_rect.left + i * PDC_cxChar;
|
630
|
-
clip_rect.bottom = clip_rect.top + PDC_cyChar;
|
631
|
-
ExtTextOutW( hdc, clip_rect.left, clip_rect.top,
|
632
|
-
ETO_CLIPPED | ETO_OPAQUE, &clip_rect,
|
633
|
-
buff, olen, (olen > 1 ? lpDx : NULL));
|
634
|
-
#ifdef A_OVERLINE
|
635
|
-
if( *srcp & (A_UNDERLINE | A_RIGHTLINE | A_LEFTLINE | A_OVERLINE | A_STRIKEOUT))
|
636
|
-
#else
|
637
|
-
if( *srcp & (A_UNDERLINE | A_RIGHTLINE | A_LEFTLINE))
|
638
|
-
#endif
|
639
|
-
{
|
640
|
-
const int y1 = clip_rect.top;
|
641
|
-
const int y2 = clip_rect.bottom - 1;
|
642
|
-
const int x1 = clip_rect.left;
|
643
|
-
const int x2 = clip_rect.right;
|
644
|
-
int j;
|
645
|
-
extern COLORREF *pdc_rgbs;
|
646
|
-
const HPEN pen = CreatePen( PS_SOLID, 1, (SP->line_color == -1 ?
|
647
|
-
foreground_rgb : pdc_rgbs[SP->line_color]));
|
648
|
-
const HPEN old_pen = SelectObject( hdc, pen);
|
649
|
-
|
650
|
-
if( *srcp & A_UNDERLINE)
|
651
|
-
{
|
652
|
-
MoveToEx( hdc, x1, y2, NULL);
|
653
|
-
LineTo( hdc, x2, y2);
|
654
|
-
}
|
655
|
-
#ifdef A_OVERLINE
|
656
|
-
if( *srcp & A_OVERLINE)
|
657
|
-
{
|
658
|
-
MoveToEx( hdc, x1, y1, NULL);
|
659
|
-
LineTo( hdc, x2, y1);
|
660
|
-
}
|
661
|
-
if( *srcp & A_STRIKEOUT)
|
662
|
-
{
|
663
|
-
MoveToEx( hdc, x1, (y1 + y2) / 2, NULL);
|
664
|
-
LineTo( hdc, x2, (y1 + y2) / 2);
|
665
|
-
}
|
666
|
-
#endif
|
667
|
-
if( *srcp & A_RIGHTLINE)
|
668
|
-
for( j = 0; j < i; j++)
|
669
|
-
{
|
670
|
-
MoveToEx( hdc, x2 - j * PDC_cxChar - 1, y1, NULL);
|
671
|
-
LineTo( hdc, x2 - j * PDC_cxChar - 1, y2);
|
672
|
-
}
|
673
|
-
if( *srcp & A_LEFTLINE)
|
674
|
-
for( j = 0; j < i; j++)
|
675
|
-
{
|
676
|
-
MoveToEx( hdc, x1 + j * PDC_cxChar, y1, NULL);
|
677
|
-
LineTo( hdc, x1 + j * PDC_cxChar, y2);
|
678
|
-
}
|
679
|
-
SelectObject( hdc, old_pen);
|
680
|
-
DeleteObject( pen);
|
681
|
-
}
|
682
|
-
if( PDC_find_ends_of_selected_text( lineno, &PDC_mouse_rect, selection))
|
683
|
-
if( x <= selection[1] + 1 && x + i >= selection[0])
|
684
|
-
{
|
685
|
-
RECT rect;
|
686
|
-
|
687
|
-
rect.top = lineno * PDC_cyChar;
|
688
|
-
rect.bottom = rect.top + PDC_cyChar;
|
689
|
-
rect.right = max( x, selection[0]);
|
690
|
-
rect.left = min( x + i, selection[1] + 1);
|
691
|
-
rect.right *= PDC_cxChar;
|
692
|
-
rect.left *= PDC_cxChar;
|
693
|
-
InvertRect( hdc, &rect);
|
694
|
-
}
|
695
|
-
len -= i;
|
696
|
-
x += i;
|
697
|
-
srcp += i;
|
698
|
-
}
|
699
|
-
SelectObject( hdc, hOldFont);
|
700
|
-
/* ...did we step on the cursor? If so, redraw it: */
|
701
|
-
if( cursor_overwritten)
|
702
|
-
redraw_cursor( hdc);
|
703
|
-
}
|
704
|
-
|
705
|
-
void PDC_transform_line(int lineno, int x, int len, const chtype *srcp)
|
706
|
-
{
|
707
|
-
if( !srcp) /* just freeing up fonts */
|
708
|
-
PDC_transform_line_given_hdc( 0, 0, 0, 0, NULL);
|
709
|
-
else
|
710
|
-
{
|
711
|
-
extern HWND PDC_hWnd;
|
712
|
-
const HDC hdc = GetDC( PDC_hWnd) ;
|
713
|
-
|
714
|
-
PDC_transform_line_given_hdc( hdc, lineno, x, len, srcp);
|
715
|
-
ReleaseDC( PDC_hWnd, hdc);
|
716
|
-
}
|
717
|
-
}
|
718
|
-
|