diff options
Diffstat (limited to 'scripts/kconfig/libcurses/pdcsetsc.c')
-rw-r--r-- | scripts/kconfig/libcurses/pdcsetsc.c | 130 |
1 files changed, 130 insertions, 0 deletions
diff --git a/scripts/kconfig/libcurses/pdcsetsc.c b/scripts/kconfig/libcurses/pdcsetsc.c new file mode 100644 index 000000000..a2d1b6dc3 --- /dev/null +++ b/scripts/kconfig/libcurses/pdcsetsc.c | |||
@@ -0,0 +1,130 @@ | |||
1 | /* PDCurses */ | ||
2 | |||
3 | #include "pdcwin.h" | ||
4 | |||
5 | /*man-start************************************************************** | ||
6 | |||
7 | pdcsetsc | ||
8 | -------- | ||
9 | |||
10 | ### Synopsis | ||
11 | |||
12 | int PDC_set_blink(bool blinkon); | ||
13 | int PDC_set_bold(bool boldon); | ||
14 | void PDC_set_title(const char *title); | ||
15 | |||
16 | ### Description | ||
17 | |||
18 | PDC_set_blink() toggles whether the A_BLINK attribute sets an actual | ||
19 | blink mode (TRUE), or sets the background color to high intensity | ||
20 | (FALSE). The default is platform-dependent (FALSE in most cases). It | ||
21 | returns OK if it could set the state to match the given parameter, | ||
22 | ERR otherwise. | ||
23 | |||
24 | PDC_set_bold() toggles whether the A_BOLD attribute selects an actual | ||
25 | bold font (TRUE), or sets the foreground color to high intensity | ||
26 | (FALSE). It returns OK if it could set the state to match the given | ||
27 | parameter, ERR otherwise. | ||
28 | |||
29 | PDC_set_title() sets the title of the window in which the curses | ||
30 | program is running. This function may not do anything on some | ||
31 | platforms. | ||
32 | |||
33 | ### Portability | ||
34 | X/Open ncurses NetBSD | ||
35 | PDC_set_blink - - - | ||
36 | PDC_set_title - - - | ||
37 | |||
38 | **man-end****************************************************************/ | ||
39 | |||
40 | int PDC_curs_set(int visibility) | ||
41 | { | ||
42 | CONSOLE_CURSOR_INFO cci; | ||
43 | int ret_vis; | ||
44 | |||
45 | PDC_LOG(("PDC_curs_set() - called: visibility=%d\n", visibility)); | ||
46 | |||
47 | ret_vis = SP->visibility; | ||
48 | |||
49 | if (GetConsoleCursorInfo(pdc_con_out, &cci) == FALSE) | ||
50 | return ERR; | ||
51 | |||
52 | switch(visibility) | ||
53 | { | ||
54 | case 0: /* invisible */ | ||
55 | cci.bVisible = FALSE; | ||
56 | break; | ||
57 | case 2: /* highly visible */ | ||
58 | cci.bVisible = TRUE; | ||
59 | cci.dwSize = 95; | ||
60 | break; | ||
61 | default: /* normal visibility */ | ||
62 | cci.bVisible = TRUE; | ||
63 | cci.dwSize = SP->orig_cursor; | ||
64 | break; | ||
65 | } | ||
66 | |||
67 | if (SetConsoleCursorInfo(pdc_con_out, &cci) == FALSE) | ||
68 | return ERR; | ||
69 | |||
70 | SP->visibility = visibility; | ||
71 | return ret_vis; | ||
72 | } | ||
73 | |||
74 | void PDC_set_title(const char *title) | ||
75 | { | ||
76 | #ifdef PDC_WIDE | ||
77 | wchar_t wtitle[512]; | ||
78 | #endif | ||
79 | PDC_LOG(("PDC_set_title() - called:<%s>\n", title)); | ||
80 | |||
81 | #ifdef PDC_WIDE | ||
82 | PDC_mbstowcs(wtitle, title, 511); | ||
83 | SetConsoleTitleW(wtitle); | ||
84 | #else | ||
85 | SetConsoleTitleA(title); | ||
86 | #endif | ||
87 | } | ||
88 | |||
89 | int PDC_set_blink(bool blinkon) | ||
90 | { | ||
91 | if (!SP) | ||
92 | return ERR; | ||
93 | |||
94 | if (SP->color_started) | ||
95 | { | ||
96 | COLORS = 16; | ||
97 | if (PDC_can_change_color()) /* is_nt */ | ||
98 | { | ||
99 | if (pdc_conemu || SetConsoleMode(pdc_con_out, 0x0004)) /* VT */ | ||
100 | COLORS = PDC_MAXCOL; | ||
101 | |||
102 | if (!pdc_conemu) | ||
103 | SetConsoleMode(pdc_con_out, 0x0010); /* LVB */ | ||
104 | } | ||
105 | } | ||
106 | |||
107 | if (blinkon) | ||
108 | { | ||
109 | if (!(SP->termattrs & A_BLINK)) | ||
110 | { | ||
111 | SP->termattrs |= A_BLINK; | ||
112 | pdc_last_blink = GetTickCount(); | ||
113 | } | ||
114 | } | ||
115 | else | ||
116 | { | ||
117 | if (SP->termattrs & A_BLINK) | ||
118 | { | ||
119 | SP->termattrs &= ~A_BLINK; | ||
120 | PDC_blink_text(); | ||
121 | } | ||
122 | } | ||
123 | |||
124 | return OK; | ||
125 | } | ||
126 | |||
127 | int PDC_set_bold(bool boldon) | ||
128 | { | ||
129 | return boldon ? ERR : OK; | ||
130 | } | ||