diff options
Diffstat (limited to 'scripts/kconfig/libcurses/pdcsetsc.c')
| -rw-r--r-- | scripts/kconfig/libcurses/pdcsetsc.c | 133 |
1 files changed, 133 insertions, 0 deletions
diff --git a/scripts/kconfig/libcurses/pdcsetsc.c b/scripts/kconfig/libcurses/pdcsetsc.c new file mode 100644 index 000000000..1e9fc9b0d --- /dev/null +++ b/scripts/kconfig/libcurses/pdcsetsc.c | |||
| @@ -0,0 +1,133 @@ | |||
| 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 | |||
| 35 | Function | X/Open | ncurses | NetBSD | ||
| 36 | :---------------------|:------:|:-------:|:------: | ||
| 37 | PDC_set_blink | - | - | - | ||
| 38 | PDC_set_bold | - | - | - | ||
| 39 | PDC_set_title | - | - | - | ||
| 40 | |||
| 41 | **man-end****************************************************************/ | ||
| 42 | |||
| 43 | int PDC_curs_set(int visibility) | ||
| 44 | { | ||
| 45 | CONSOLE_CURSOR_INFO cci; | ||
| 46 | int ret_vis; | ||
| 47 | |||
| 48 | PDC_LOG(("PDC_curs_set() - called: visibility=%d\n", visibility)); | ||
| 49 | |||
| 50 | ret_vis = SP->visibility; | ||
| 51 | |||
| 52 | if (GetConsoleCursorInfo(pdc_con_out, &cci) == FALSE) | ||
| 53 | return ERR; | ||
| 54 | |||
| 55 | switch(visibility) | ||
| 56 | { | ||
| 57 | case 0: /* invisible */ | ||
| 58 | cci.bVisible = FALSE; | ||
| 59 | break; | ||
| 60 | case 2: /* highly visible */ | ||
| 61 | cci.bVisible = TRUE; | ||
| 62 | cci.dwSize = 95; | ||
| 63 | break; | ||
| 64 | default: /* normal visibility */ | ||
| 65 | cci.bVisible = TRUE; | ||
| 66 | cci.dwSize = SP->orig_cursor; | ||
| 67 | break; | ||
| 68 | } | ||
| 69 | |||
| 70 | if (SetConsoleCursorInfo(pdc_con_out, &cci) == FALSE) | ||
| 71 | return ERR; | ||
| 72 | |||
| 73 | SP->visibility = visibility; | ||
| 74 | return ret_vis; | ||
| 75 | } | ||
| 76 | |||
| 77 | void PDC_set_title(const char *title) | ||
| 78 | { | ||
| 79 | #ifdef PDC_WIDE | ||
| 80 | wchar_t wtitle[512]; | ||
| 81 | #endif | ||
| 82 | PDC_LOG(("PDC_set_title() - called:<%s>\n", title)); | ||
| 83 | |||
| 84 | #ifdef PDC_WIDE | ||
| 85 | PDC_mbstowcs(wtitle, title, 511); | ||
| 86 | SetConsoleTitleW(wtitle); | ||
| 87 | #else | ||
| 88 | SetConsoleTitleA(title); | ||
| 89 | #endif | ||
| 90 | } | ||
| 91 | |||
| 92 | int PDC_set_blink(bool blinkon) | ||
| 93 | { | ||
| 94 | if (!SP) | ||
| 95 | return ERR; | ||
| 96 | |||
| 97 | if (SP->color_started) | ||
| 98 | { | ||
| 99 | COLORS = 16; | ||
| 100 | if (PDC_can_change_color()) /* is_nt */ | ||
| 101 | { | ||
| 102 | if (pdc_conemu || SetConsoleMode(pdc_con_out, 0x0004)) /* VT */ | ||
| 103 | COLORS = PDC_MAXCOL; | ||
| 104 | |||
| 105 | if (!pdc_conemu) | ||
| 106 | SetConsoleMode(pdc_con_out, 0x0010); /* LVB */ | ||
| 107 | } | ||
| 108 | } | ||
| 109 | |||
| 110 | if (blinkon) | ||
| 111 | { | ||
| 112 | if (!(SP->termattrs & A_BLINK)) | ||
| 113 | { | ||
| 114 | SP->termattrs |= A_BLINK; | ||
| 115 | pdc_last_blink = GetTickCount(); | ||
| 116 | } | ||
| 117 | } | ||
| 118 | else | ||
| 119 | { | ||
| 120 | if (SP->termattrs & A_BLINK) | ||
| 121 | { | ||
| 122 | SP->termattrs &= ~A_BLINK; | ||
| 123 | PDC_blink_text(); | ||
| 124 | } | ||
| 125 | } | ||
| 126 | |||
| 127 | return OK; | ||
| 128 | } | ||
| 129 | |||
| 130 | int PDC_set_bold(bool boldon) | ||
| 131 | { | ||
| 132 | return boldon ? ERR : OK; | ||
| 133 | } | ||
