|
C-Menu 0.2.9
A User Interface Toolkit
|
Window support for C-Menu - EXPERIMENTAL. More...
#include <cm.h>#include <errno.h>#include <math.h>#include <stdbool.h>#include <stdlib.h>#include <string.h>#include <termios.h>#include <unistd.h>#include <wait.h>#include <wchar.h>Go to the source code of this file.
Macros | |
| #define | NC true |
Functions | |
| bool | open_curses (SIO *sio) |
| Initialize NCurses and color settings. | |
| void | destroy_curses () |
| Gracefully shut down NCurses and restore terminal settings. | |
| int | win_new (int wlines, int wcols, int wbegy, int wbegx, char *wtitle, int flag) |
| Create a new window with optional box and title. | |
| void | win_redraw (WINDOW *win) |
| Redraw the specified window. | |
| void | win_resize (int wlines, int wcols, char *title) |
| Resize the current window and its box, and update the title. | |
| WINDOW * | win_del () |
| Delete the current window and its associated box window. | |
| void | restore_wins () |
| Restore all windows after a screen resize. | |
| void | cbox (WINDOW *box) |
| Draw a box around the specified window. | |
| void | win_init_attrs () |
| Initialize window attributes. | |
| int | Perror (char *emsg_str) |
| Display a simple error message window or print to stderr. | |
| void | mvwaddstr_fill (WINDOW *w, int y, int x, char *s, int l) |
| For lines shorter than their display area, fill the rest with spaces. | |
| void | abend (int ec, char *s) |
| Abnormal program termination. | |
| int | nf_error (int ec, char *s) |
| Display error message and wait for key press. | |
| void | list_colors () |
| list colors to stderr | |
| int | clr_name_to_idx (char *s) |
| Get color index from color name. | |
| void | init_hex_clr (int idx, char *s) |
| Initialize extended ncurses color from HTML style hex string. | |
| int | rgb_clr_to_cube (int) |
| RGB | hex_clr_str_to_rgb (char *s) |
| Convert six-digit HTML style hex color code to RGB struct. | |
| RGB | xterm256_idx_to_rgb (int idx) |
| Convert XTerm 256 color index to RGB color. | |
| int | rgb_to_curses_clr (RGB *rgb) |
| Get color index for RGB color. | |
| int | rgb_to_xterm256_idx (RGB *rgb) |
| Convert RGB color to XTerm 256 color index. | |
| void | apply_gamma (RGB *rgb) |
| Apply gamma correction to RGB color. | |
| Chyron * | new_chyron () |
| Create and initialize Chyron structure. | |
| void | set_chyron_key (Chyron *, int, char *, int) |
| void | set_chyron_key_cp (Chyron *chyron, int k, char *s, int kc, int cp) |
| Set chyron key. | |
| bool | is_set_chyron_key (Chyron *chyron, int k) |
| Check if function key label is set. | |
| void | unset_chyron_key (Chyron *chyron, int k) |
| Unset chyron key. | |
| void | compile_chyron (Chyron *chyron) |
| construct the chyron string from the chyron structure | |
| int | get_chyron_key (Chyron *chyron, int x) |
| Get keycode from chyron. | |
| Chyron * | destroy_chyron (Chyron *chyron) |
| Destroy Chyron structure. | |
| int | mb_to_cc (cchar_t *cmplx_buf, char *str, attr_t attr, int cpx, int *pos, int maxlen) |
| Convert multibyte string to complex character array. | |
| Chyron * | wait_mk_chyron () |
| Create a Chyron struct for the waiting message. | |
| WINDOW * | wait_mk_win (Chyron *chyron, char *title) |
| Display a popup waiting message. | |
| int | wait_continue (WINDOW *wait_win, Chyron *chyron, int remaining) |
| Update the waiting message with remaining time and check for user input. | |
| bool | wait_destroy (Chyron *chyron) |
| Destroy the waiting message window and chyron. | |
| int | xwgetch (WINDOW *win, Chyron *chyron, int n) |
| Wrapper for wgetch that handles signals, mouse events, checks for clicks on the chyron line, and accepts a sinigle character answer. | |
| bool | init_clr_palette (SIO *sio) |
| Initialize color palette based on SIO settings. | |
| cchar_t | mkccc (int cp) |
| Create a cchar_t with the specified color pair index. | |
| void | display_chyron (WINDOW *win, Chyron *chyron, int line, int col) |
| cchar_t * | mk_cmplx_buf (const char *s) |
| Create complex character buffer from multibyte string. | |
| int | get_clr_pair (int fg, int bg) |
| Get color pair index for foreground and background colors. | |
| int | answer_yn (char *em0, char *em1, char *em2, char *em3) |
| Accept a single letter answer. | |
| int | display_error (char *em0, char *em1, char *em2, char *em3) |
| Display an error message window or print to stderr. | |
| bool | action_disposition (char *title, char *action_str) |
| bool | waitpid_with_timeout (pid_t pid, int timeout) |
Variables | |
| int | click_y |
| int | click_x |
| SCREEN * | screen |
| SIO * | sio |
| RGB | StdColors [16] |
| char const | colors_text [][10] |
| const wchar_t | bw_ho = BW_HO |
| const wchar_t | bw_ve = BW_VE |
| const wchar_t | bw_tl = BW_RTL |
| const wchar_t | bw_tr = BW_RTR |
| const wchar_t | bw_bl = BW_RBL |
| const wchar_t | bw_br = BW_RBR |
| const wchar_t | bw_lt = BW_LT |
| const wchar_t | bw_rt = BW_RT |
| const wchar_t | bw_sp = BW_SP |
| double | GRAY_GAMMA |
| double | RED_GAMMA |
| double | GREEN_GAMMA |
| double | BLUE_GAMMA |
| WINDOW * | win |
| WINDOW * | win_win [MAXWIN] |
| WINDOW * | win_box [MAXWIN] |
| int | exit_code |
| unsigned int | cmd_key |
| bool | f_sigwench = false |
| int | win_attr |
| int | box_attr |
| int | win_ptr |
| int | m_lines |
| int | m_cols |
| int | m_begy = -1 |
| int | m_begx = -1 |
| int | mouse_support |
| int | stdin_fd |
| int | stdout_fd |
| int | src_line |
| char * | src_name |
| char | fn [MAXLEN] |
| char | em0 [MAXLEN] |
| char | em1 [MAXLEN] |
| char | em2 [MAXLEN] |
| char | em3 [MAXLEN] |
| int | cp_norm |
| int | cp_win |
| int | cp_box |
| int | cp_reverse |
| int | cp_reverse_highlight |
| int | cp_ln |
| int | clr_cnt = 0 |
| int | clr_pair_idx = 1 |
| int | clr_pair_cnt = 1 |
| cchar_t | CCC_NORM |
| cchar_t | CCC_WIN |
| cchar_t | CCC_BG |
| cchar_t | CCC_BOX |
| cchar_t | CCC_REVERSE |
| cchar_t | CCC_REVERSE_HIGHLIGHT |
| cchar_t | CCC_LN |
| int | tty_fd |
| int | pipe_in |
| int | pipe_out |
| FILE * | ncurses_fp |
Window support for C-Menu - EXPERIMENTAL.
Definition in file dwin.c.
| bool action_disposition | ( | char * | title, |
| char * | action_str ) |
Definition at line 1224 of file dwin.c.
References cmd_key, compile_chyron(), destroy_chyron(), display_chyron(), em0, f_curses_open, Chyron::l, new_chyron(), Perror(), set_chyron_key(), ssnprintf(), win_del(), win_new(), win_ptr, win_win, and xwgetch().
| void display_chyron | ( | WINDOW * | win, |
| Chyron * | chyron, | ||
| int | line, | ||
| int | col ) |
Definition at line 297 of file dwin.c.
References Chyron::cmplx_buf.
Referenced by action_disposition(), answer_yn(), display_error(), display_page(), field_editor(), form_display_fields(), form_post(), form_process(), Perror(), wait_continue(), and wait_mk_win().
| int rgb_clr_to_cube | ( | int | ) |
| void set_chyron_key | ( | Chyron * | chyron, |
| int | k, | ||
| char * | s, | ||
| int | kc ) |
Definition at line 245 of file dwin.c.
References ChyronKey::cp, cp_reverse, Chyron::key, ChyronKey::keycode, ssnprintf(), and ChyronKey::text.
Referenced by action_disposition(), answer_yn(), display_error(), form_display_fields(), form_post(), form_process(), Perror(), pick_engine(), and wait_mk_chyron().
| bool waitpid_with_timeout | ( | pid_t | pid, |
| int | timeout ) |
Definition at line 1431 of file dwin.c.
References cmd_key, em0, Perror(), ssnprintf(), wait_continue(), wait_destroy(), wait_mk_chyron(), and wait_mk_win().
Referenced by form_process(), init_pick(), and view_init_input().
| double BLUE_GAMMA |
Gamma correction value for blue colors. Set in .minitrc
Definition at line 110 of file dwin.c.
Referenced by apply_gamma(), and open_curses().
| const wchar_t bw_bl = BW_RBL |
| const wchar_t bw_br = BW_RBR |
| const wchar_t bw_ho = BW_HO |
| const wchar_t bw_lt = BW_LT |
| const wchar_t bw_rt = BW_RT |
| const wchar_t bw_sp = BW_SP |
| const wchar_t bw_tl = BW_RTL |
| const wchar_t bw_tr = BW_RTR |
| const wchar_t bw_ve = BW_VE |
| cchar_t CCC_BOX |
box color pair complex character
Definition at line 148 of file dwin.c.
Referenced by open_curses(), win_new(), and win_resize().
| cchar_t CCC_LN |
Definition at line 151 of file dwin.c.
Referenced by init_view_boxwin(), init_view_full_screen(), and open_curses().
| cchar_t CCC_NORM |
normal color pair complex character
Definition at line 145 of file dwin.c.
Referenced by open_curses(), and win_del().
| cchar_t CCC_REVERSE |
reverse color pair complex character
Definition at line 149 of file dwin.c.
Referenced by open_curses().
| cchar_t CCC_REVERSE_HIGHLIGHT |
Definition at line 150 of file dwin.c.
Referenced by open_curses().
| cchar_t CCC_WIN |
window color pair complex character
Definition at line 146 of file dwin.c.
Referenced by init_view_boxwin(), init_view_full_screen(), open_curses(), win_new(), and win_resize().
| int click_x |
the x coordinate of a mouse click
Definition at line 45 of file dwin.c.
Referenced by field_editor(), form_post(), form_process(), menu_cmd_processor(), picker(), and xwgetch().
| int click_y |
the y coordinate of a mouse click
Definition at line 44 of file dwin.c.
Referenced by field_editor(), form_post(), form_process(), menu_cmd_processor(), picker(), and xwgetch().
| int clr_cnt = 0 |
number of colors used
Definition at line 142 of file dwin.c.
Referenced by init_clr_palette(), and rgb_to_curses_clr().
| int clr_pair_cnt = 1 |
number of color pairs supported by the terminal
Definition at line 144 of file dwin.c.
Referenced by get_clr_pair().
| int clr_pair_idx = 1 |
| unsigned int cmd_key |
the command key for the current command, for error messages and other output
Definition at line 117 of file dwin.c.
Referenced by action_disposition(), answer_yn(), display_error(), field_navigator(), form_read_data(), init_pick(), view_init_input(), wait_continue(), and waitpid_with_timeout().
| char const colors_text[][10] |
colors_text
Definition at line 91 of file dwin.c.
Referenced by clr_name_to_idx(), and list_colors().
| int cp_box |
| int cp_ln |
| int cp_norm |
| int cp_reverse |
reverse color pair index
Definition at line 139 of file dwin.c.
Referenced by compile_chyron(), field_editor(), open_curses(), and set_chyron_key().
| int cp_reverse_highlight |
reverse highlight color pair index
Definition at line 140 of file dwin.c.
Referenced by field_editor(), form_process(), and open_curses().
| int cp_win |
window color pair index
Definition at line 137 of file dwin.c.
Referenced by fmt_line(), mk_cmplx_buf(), open_curses(), and search().
| char em0[MAXLEN] |
error message string for error messages
Definition at line 132 of file dwin.c.
Referenced by action_disposition(), enter_file_spec(), form_desc_error(), form_parse_desc(), form_process(), form_read_data(), form_write(), get_clr_pair(), handle_signal(), init_view_boxwin(), init_view_full_screen(), lf_find(), mk_dir(), new_init(), new_pick(), new_view(), parse_menu_description(), popup_ckeys(), verify_dir(), verify_file(), view_cmd_processor(), view_init_input(), waitpid_with_timeout(), write_view_buffer(), and xwgetch().
| char em1[MAXLEN] |
error message string for error messages
Definition at line 133 of file dwin.c.
Referenced by enter_file_spec(), form_desc_error(), form_parse_desc(), form_process(), form_read_data(), form_write(), get_clr_pair(), handle_signal(), init_view_boxwin(), init_view_full_screen(), lf_find(), mk_dir(), new_init(), new_pick(), new_view(), parse_menu_description(), popup_ckeys(), verify_dir(), verify_file(), view_cmd_processor(), view_init_input(), write_view_buffer(), and xwgetch().
| char em2[MAXLEN] |
error message string for error messages
Definition at line 134 of file dwin.c.
Referenced by enter_file_spec(), form_desc_error(), form_parse_desc(), form_process(), form_read_data(), form_write(), get_clr_pair(), handle_signal(), init_view_boxwin(), init_view_full_screen(), lf_find(), mk_dir(), new_init(), new_view(), parse_menu_description(), popup_ckeys(), verify_dir(), verify_file(), view_cmd_processor(), view_init_input(), write_view_buffer(), and xwgetch().
| char em3[MAXLEN] |
error message string for error messages
Definition at line 135 of file dwin.c.
Referenced by verify_dir(), and verify_file().
| int exit_code |
| char fn[MAXLEN] |
function name for error messages
Definition at line 131 of file dwin.c.
Referenced by verify_dir(), and verify_file().
| double GRAY_GAMMA |
Gamma correction value for gray colors. Set in .minitrc
Definition at line 104 of file dwin.c.
Referenced by apply_gamma(), and open_curses().
| double GREEN_GAMMA |
Gamma correction value for green colors. Set in .minitrc
Definition at line 108 of file dwin.c.
Referenced by apply_gamma(), and open_curses().
| FILE* ncurses_fp |
Definition at line 154 of file dwin.c.
Referenced by destroy_curses(), and open_curses().
| double RED_GAMMA |
Gamma correction value for red colors. Set in .minitrc
Definition at line 106 of file dwin.c.
Referenced by apply_gamma(), and open_curses().
| SCREEN* screen |
Definition at line 75 of file dwin.c.
Referenced by destroy_curses(), and open_curses().
| SIO* sio |
| int src_line |
the line number of the source file being processed, for error messages
Definition at line 129 of file dwin.c.
Referenced by verify_dir(), and verify_file().
| char* src_name |
the name of the source file being processed, for error messages
Definition at line 130 of file dwin.c.
Referenced by verify_dir(), and verify_file().
| RGB StdColors[16] |
StdColors
Definition at line 82 of file dwin.c.
Referenced by init_hex_clr(), and xterm256_idx_to_rgb().
| WINDOW* win |
| int win_attr |
| WINDOW* win_box[MAXWIN] |
array of pointers to box windows, indexed by window ID
Definition at line 115 of file dwin.c.
Referenced by destroy_curses(), form_display_screen(), menu_engine(), open_pick_win(), popup_ckeys(), restore_wins(), win_del(), win_new(), and win_resize().
| int win_ptr |
Pointer to the current window pair, box and window, which can be used to keep track of the currently active window and its associated box.
Definition at line 121 of file dwin.c.
Referenced by action_disposition(), answer_yn(), destroy_curses(), display_error(), form_display_screen(), menu_engine(), open_curses(), open_pick_win(), Perror(), popup_ckeys(), restore_wins(), wait_mk_win(), win_del(), win_new(), and win_resize().
| WINDOW* win_win[MAXWIN] |
array of pointers to windows, indexed by window ID
Definition at line 114 of file dwin.c.
Referenced by action_disposition(), answer_yn(), destroy_curses(), display_error(), form_display_screen(), menu_engine(), open_pick_win(), Perror(), popup_ckeys(), restore_wins(), wait_mk_win(), win_del(), win_new(), and win_resize().