|
C-Menu 0.2.9
A User Interface Toolkit
|
Headder for C-Menu API library, libcm.so. More...
#include "version.h"#include <argp.h>#include <signal.h>#include <stdbool.h>#include <stddef.h>#include <stdlib.h>#include <time.h>#include <wait.h>#include <wchar.h>#include <stdio.h>Go to the source code of this file.
Data Structures | |
| struct | Arg |
| struct | Argv |
| struct | Chyron |
| struct | ChyronKey |
| struct | CmField |
| struct | ColorPair |
| struct | Date |
| struct | SIO |
| The SIO structure encapsulates various aspects of the terminal's state and configuration, including color management, file pointers, and terminal device information. More... | |
| struct | String |
| struct | Time |
| struct | WCStr |
Macros | |
| #define | __atexit |
| This macro registers the end_pgm function to be called when the program exits. | |
| #define | _GNU_SOURCE |
| #define | _XOPEN_SOURCE_EXTENDED 1 |
| #define | ABS(x) |
| ABS macro for absolute value, which evaluates the expression once and returns the absolute value. | |
| #define | BG_COLOR 0 |
| #define | BO_COLOR 1 |
| #define | CHYRON_KEY_MAXLEN 64 |
| #define | CHYRON_KEYS 20 |
| #define | COLOR_LEN 8 |
| #define | Ctrl(c) |
| #define | DEFAULTSHELL "/bin/bash" |
| #define | DIV_ROUND_UP(n, d) |
| #define | F_NO_STDERR 1 |
| #define | FG_COLOR 2 |
| #define | KEY_ALTDEL 0x20e |
| #define | KEY_ALTDOWN 0x214 |
| #define | KEY_ALTEND 0x219 |
| #define | KEY_ALTF(n) |
| #define | KEY_ALTF0 0x138 |
| #define | KEY_ALTHOME 0x21e |
| #define | KEY_ALTINS 0x223 |
| #define | KEY_ALTLEFT 0x228 |
| #define | KEY_ALTPGDN 0x22d |
| #define | KEY_ALTPGUP 0x232 |
| #define | KEY_ALTRIGHT 0x237 |
| #define | KEY_ALTUP 0x23d |
| #define | LN_BG_COLOR 7 |
| #define | LN_COLOR 4 |
| #define | MAX(a, b) |
| MIN macro for compatibility with code that uses the same name, while avoiding multiple evaluations of the arguments. | |
| #define | max(a, b) |
| max macro evaluates two expressions, returning greatest result. | |
| #define | MAX_ARGS 64 |
| #define | MAX_DEPTH 3 |
| #define | MAXARGS 64 |
| #define | MAXLEN 256 |
| #define | MAXWIN 30 |
| #define | MAXWIN 30 |
| #define | MIN(x, y) |
| MAX macro for compatibility with code that uses the same name, while avoiding multiple evaluations of the arguments. | |
| #define | min(x, y) |
| min macro evaluates two expressions, returning least result | |
| #define | NCURSES_WIDECHAR 1 |
| #define | nullptr NULL |
| #define | S_QUIET 0x2000 |
| #define | S_TOLOWER(c) |
| #define | S_TOUPPER(c) |
| #define | S_WCOK 0x1000 |
| #define | SCR_COLS 1024 |
| #define | SCREEN_MAX_LINES 100 |
| #define | to_lowercase(c) |
| #define | to_uppercase(c) |
| #define | to_uppercase(c) |
| #define | XTERM_256COLOR |
Typedefs | |
| typedef unsigned char | uchar |
Functions | |
| unsigned long | a_to_ul (const char *) |
| Converts a string to an unsigned long long integer, with support for suffixes K, M, and G for kilobytes, megabytes, and gigabytes respectively. | |
| int | a_toi (char *, bool *) |
| a safer alternative to atoi() for converting ASCII strings to integers. | |
| void | abend (int, char *) |
| Abnormal program termination. | |
| bool | action_disposition (char *eitle, char *action_str) |
| Display a simple action disposition message window or print to stderr. | |
| void | activate_all_chyron_keys (Chyron *) |
| Deactivate chyron key. | |
| void | activate_chyron_key (Chyron *, uint) |
| Activate chyron key. | |
| int | answer_yn (char *, char *, char *, char *) |
| Accept a single letter answer. | |
| void | apply_gamma (RGB *) |
| Apply gamma correction to RGB color. | |
| int | assign_chyron_win (Chyron *chyron, UiSurface *s, uint w, char *) |
| int | bare_box_new (uint, uint, uint, uint, char *) |
| bool | base_name (char *, char *) |
| Returns the base name of a file specification. | |
| int | border_draw (UiSurface *sfc) |
| int | border_title (UiSurface *sfc, char *title) |
| Draw a box with a title around the specified window. | |
| int | border_ysplit (UiSurface *, uint) |
| Draw a box with a separator line around the specified window. | |
| int | border_ysplit_text (UiSurface *, char *, uint) |
| Draw a box with a separator line and text around the specified window. | |
| size_t | canonicalize_file_spec (char *) |
| Removes quotes and trims at first space. | |
| bool | capture_curses_tioctl () |
| capture_curses_tioctl() - capture curses terminal settings | |
| bool | capture_shell_tioctl () |
| capture_shell_tioctl() - capture shell terminal settings | |
| int | cf_accept (UiSurface *, uint w, char *, uint, uint, uint) |
| Accepts input for a field in a C-Menu window. | |
| void | check_panels (uint) |
| bool | chrep (char *, char, char) |
| Replaces all occurrences of old_chr in s with new_chr in place. | |
| int | cm_surface_destroy (UiSurface *sfc) |
| Destroy the most recently created surface. | |
| size_t | codepoint_to_utf8 (uint32_t codepoint, uint8_t *utf8) |
| void | compile_chyron (Chyron *) |
| construct the chyron string from the chyron structure | |
| bool | construct_file_spec (char *, char *, char *, char *, char *, uint) |
| void | deactivate_all_chyron_keys (Chyron *) |
| Deactivate all chyron keys. | |
| void | deactivate_chyron_key (Chyron *, uint) |
| Deactivate chyron key. | |
| int | destroy_argv (uint argc, char **argv) |
| Deallocates memory allocated for argument strings in argv. | |
| Chyron * | destroy_chyron (Chyron *chyron) |
| Destroy Chyron structure. | |
| void | destroy_curses () |
| Gracefully shut down NCurses and restore terminal settings. | |
| char | di_getch () |
| get single character from terminal in raw mode | |
| bool | dir_name (char *, char *) |
| Returns the directory name of a file specification. | |
| void | display_argv_error_msg (char *, char **) |
| void | display_chyron (UiSurface *, uint n, Chyron *, uint, uint) |
| Display chyron on the specified line and column of the surface. | |
| int | display_curses_keys () |
| int | display_error (char *, char *, char *, char *) |
| Display an error message window or print to stderr. | |
| int | display_ok_message (char *) |
| void | dump_opts () |
| void | dump_opts_by_use (char *, char *) |
| uint | enter_option () |
| bool | expand_tilde (char *, uint) |
| Replaces "~/" in string with the user's home directory. | |
| char * | fdname (int, char *) |
| Retrieves the file path associated with a given file descriptor. | |
| bool | file_spec_name (char *, char *) |
| extracts the file name component of a file specification | |
| bool | file_spec_path (char *, char *) |
| extracts the path component of a file specification | |
| char * | fill_field (char *, char *, char, uint) |
| int | fork_detach_execvp (char **) |
| Fork, set new session ID, close files, and execute detached command. | |
| int | fork_exec (char **) |
| Fork and exec a command. | |
| char * | format_local_timestamp (time_t, char *, size_t) |
| Formats a time_t as an ISO 8601 string in local time. | |
| String | free_string (String) |
| Free the dynamically allocated String. | |
| int | full_screen_fork_exec (char **) |
| Execute a command in full screen mode. | |
| int | full_screen_shell (char *) |
| Execute a shell command in full screen mode. | |
| bool | get_argp_doc_by_name (char *comment, const struct argp_option *, const char *) |
| Retrieves the documentation string for a given key name from an argp options array. | |
| int | get_chyron_key (Chyron *, uint) |
| Get keycode from chyron. | |
| char * | get_ip_addresses (char *, uint) |
| Retrieves the IP addresses of the local machine and formats them into a string. | |
| char * | get_local_timestamp () |
| Returns the current local time as an ISO 8601 formatted string. | |
| void | get_rfc3339_s (char *, size_t) |
| char * | get_user_str (char *, size_t) |
| Retrieves the current user's name and UID, and formats it into a string. | |
| bool | handle_signal (sig_atomic_t) |
| bool | init_clr_palette (SIO *) |
| Initialize color palette based on SIO settings. | |
| void | init_stdscr () |
| void | initialize_cells (SIO *sio) |
| Initialize local color variables and color pairs based on SIO settings. | |
| void | initialize_styles (SIO *) |
| bool | is_directory (const char *) |
| Checks if the given path is a directory. | |
| bool | is_hex_str (char *, uint) |
| Validates that a string consists of exactly len hexadecimal digits. | |
| bool | is_newer (char *, char *) |
| Checks if the file specified by "fut" is newer than the file specified by "control". | |
| bool | is_set_chyron_key (Chyron *, uint) |
| Check if function key label is set. | |
| bool | is_symlink_to_dir (const char *) |
| Checks if the given path is a symbolic link to a directory. | |
| bool | is_valid_date (uint yyyy, uint mm, uint dd) |
| Check if a given date is valid, including leap years. | |
| bool | is_valid_regex (const char *) |
| Checks if the given regular expression pattern is valid. | |
| bool | is_valid_time (uint hh, uint mm, uint ss) |
| Check if a given time is valid. | |
| char * | iso8601_time (char *, uint, time_t *, bool) |
| Formats a struct tm as an ISO 8601 string. | |
| void | left_justify (char *s) |
| Left justify string by removing leading spaces. | |
| bool | locate_file_in_path (char *, char *) |
| Locates a file in the system PATH. | |
| void | mbc_to_wc (wchar_t wc[2], const char mbc) |
| wchar_t * | mbstr_to_wcstr (const char *mb_str) |
| bool | mk_dir (char *dir) |
| If directory doesn't exist, make it. | |
| bool | mk_raw_tioctl (struct termios *) |
| mk_raw_tioctl() - set terminal to raw mode | |
| String | mk_string (size_t) |
| Create a String struct with a dynamically allocated string. | |
| Chyron * | new_chyron () |
| Create and initialize Chyron structure. | |
| bool | normalize_file_spec (char *) |
| replace backslashes with forward lashes | |
| void | numeric (char *d, char *s) |
| Extract numeric characters from source string to destination string. | |
| void | open_cmenu_log () |
| Open new C-Menu log file. | |
| bool | open_curses (SIO *) |
| int | open_log (char *) |
| bool | parse_local_timestamp (const char *, time_t *) |
| Parses an ISO 8601 timestamp string in local time and converts it to time_t. | |
| int | Perror (char *) |
| Display a simple error message window or print to stderr. | |
| char * | rep_substring (const char *, const char *, const char *) |
| Replace all occurrences of "tgt_s" in "org_s" with "rep_s". | |
| bool | restore_curses_tioctl () |
| restore_curses_tioctl() - restore curses terminal settings | |
| bool | restore_shell_tioctl () |
| restore_shell_tioctl() - restore shell terminal settings | |
| void | restore_wins () |
| uint | rgb_clr_to_cube (uint) |
| uint | rgb_to_curses_clr (RGB *) |
| uint | rgb_to_xterm256_idx (RGB *) |
| Convert RGB color to XTerm 256 color index. | |
| void | right_justify (char *, uint) |
| Right justify string by removing trailing spaces and adding leadingspaces. | |
| size_t | rtrim (char *) |
| Trims trailing spaces from string s in place. | |
| int | segmentation_fault () |
| Function to intentionally cause a segmentation fault for testing purposes. | |
| void | set_chyron_key (Chyron *, uint, char *, uint) |
| Set chyron key with default color pair (cp_nt_rev). | |
| void | set_chyron_key_cb (Chyron *, uint, char *, uint, UiCell) |
| Set chyron key with color pair (cp). | |
| bool | set_sane_tioctl (struct termios *) |
| set_sane_tioctl() - set terminal to sane settings for C-MENU | |
| int | shell (char *) |
| Execute a shell command. | |
| void | sig_dfl_mode () |
| Set signal handlers to default behavior. | |
| void | sig_prog_mode () |
| Set up signal handlers for interrupt signals. | |
| void | sig_shell_mode () |
| void | signal_handler (int) |
| Signal handler for interrupt signals. | |
| size_t | ssnprintf (char *, size_t, const char *,...) |
| ssnprintf was designed to be a safer alternative to snprintf. | |
| char * | stdio_fdnames (char *, char *) |
| char * | stdio_names (char *, char *) |
| bool | str_subc (char *, char *, char, char *, uint) |
| Replaces "ReplaceChr" in "s" with "Withstr" in "d" won't copy more than "l" bytes to "d" Replaces all occurrences of a character in a string with another string, copying the result to a destination buffer. | |
| int | str_to_args (char **, char *, uint) |
| Converts a string into an array of argument strings. | |
| bool | str_to_bool (const char *) |
| Converts String to boolean true or false. | |
| double | str_to_double (char *) |
| converts string to double | |
| bool | str_to_lower (char *) |
| Converts a string to lowercase. | |
| bool | str_to_upper (char *) |
| Converts a string to uppercase. | |
| size_t | string_cat (String *, const String *) |
| Concatenates src String to dest String, allocating additional memory for dest String if necessary. | |
| size_t | string_cpy (String *, const String *) |
| Copy src String to dest String, allocating additional memory for dest String if necessary. | |
| size_t | string_ncat (String *, const String *, size_t) |
| Concatenates up to n characters from src String to dest String, allocating additional memory for dest String if necessary. | |
| size_t | string_ncpy (String *, const String *, size_t) |
| copies up to n characters from src String to dest String, allocating additional memory for dest String if necessary | |
| size_t | strip_ansi (char *, char *) |
| Strips ANSI SGR escape sequences (ending in 'm') from string s to d. | |
| bool | strip_quotes (char *) |
| removes leading and trailing double quotes if present | |
| bool | stripz_quotes (char *) |
| removes leading and trailing double quotes if present | |
| bool | strnfill (char *, char, uint) |
| size_t | strnlf (char *, size_t) |
| terminates string with line feed | |
| size_t | strnz (char *, size_t) |
| terminates string at New Line, Carriage Return, or max_len | |
| size_t | strnz__cat (char *, const char *, size_t) |
| safer alternative to strncat | |
| size_t | strnz__cpy (char *, const char *, size_t) |
| safer alternative to strncpy | |
| char * | strnz_dup (char *, size_t) |
| Allocates memory for and duplicates string s up to length l or until line feed or carriage return. | |
| int | surface_box_win_new (uint, uint, uint, uint, char *) |
| int | surface_split_box_win_new (uint, uint, uint, uint, uint, uint, char *) |
| String | to_string (const char *) |
| String functions provide a simple string library to facilitate string manipulation in C, allowing developers to easily create, copy, concatenate, and free strings without having to manage memory manually. | |
| size_t | trim (char *) |
| Trims leading and trailing spaces from string s in place. | |
| bool | trim_ext (char *, char *) |
| trims the file extension from "filename" and copies the result to "buf" | |
| bool | trim_path (char *) |
| Trims trailing spaces and slashes from directory path in place. | |
| void | unset_chyron_key (Chyron *, uint) |
| Unset chyron key. | |
| bool | unstr_hex_clr (char *, char *) |
| Validates that a string is a hex color code in the format "#RRGGBB". | |
| void | user_end () |
| bool | verify_dir (char *, uint) |
| Verifies that the directory specified by "spec" exists and is accessible with the permissions specified by "imode". | |
| bool | verify_dir_q (char *, uint) |
| bool | verify_file (char *, uint) |
| Verifies that the file specified by "in_spec" exists and is accessible with the permissions specified by "imode". | |
| bool | verify_file_q (char *, uint) |
| bool | verify_spec_arg (char *, char *, char *, char *, uint) |
| Verify file specification argument. | |
| bool | wait_destroy (Chyron *) |
| Chyron * | wait_mk_chyron () |
| bool | waitpid_with_timeout (pid_t, uint) |
| int | wccp_to_str (wchar_t, uint8_t *) |
| int | win2_box_new (uint, uint, uint, uint, char *) |
| void | win_del () |
| void | win_init_attrs () |
| void | win_resize (uint, uint, char *) |
| void | win_Toggle_Attrs () |
| void | write_cmenu_log (char *) |
| Write message to C-Menu log file without timestamp. | |
| void | write_cmenu_log_ts (char *) |
| Write message to C-Menu log file with timestamp. | |
| void | write_log (char *) |
| RGB | xterm256_idx_to_rgb (uint) |
| Convert XTerm 256 color index to RGB. | |
| #define __atexit |
This macro registers the end_pgm function to be called when the program exits.
It checks the return value of atexit() to ensure that the registration was successful, and if not, it prints an error message and exits with a failure status. Programs using libcm should call __atexit in their main function to ensure that the end_pgm function is registered to be called on program exit. This will help ensure that the terminal is properly restored to its original state, even if the program encounters an error or is terminated unexpectedly.
Definition at line 339 of file cm.h.
| #define ABS | ( | x | ) |
ABS macro for absolute value, which evaluates the expression once and returns the absolute value.
This macro uses a compound statement to create a local scope for the temporary variable _a, which stores the value of x. This ensures that if x has side effects (such as being incremented), it will only be evaluated once when the macro is expanded. The use of typeof allows the macro to work with any data type that supports comparison with zero and negation.
Definition at line 139 of file cm.h.
| #define CHYRON_KEY_MAXLEN 64 |
| #define CHYRON_KEYS 20 |
| #define COLOR_LEN 8 |
Include Exclude
---------- ----------
LF_FIFO 1 0 00000001 7 11111110 named pipe LF_CHR 2 1 00000010 6 11111101 character device LF_DIR 4 2 00000100 5 11111011 directory LF_BLK 8 3 00001000 4 11110111 block device LF_REG 16 4 00010000 3 11101111 regular file LF_LNK 32 5 00100000 2 11011111 link LF_SOCK 64 6 01000000 1 10111111 socket LF_UNKNOWN 128 7 10000000 0 01111111 unknown length of color code strings
| #define KEY_ALTINS 0x223 |
EXTENDED NCURSES KEYS
Key code bindings are customarily defined in terminfo. xterm-256color tends to be the most complete, and indeed, it seems to work with Ghostty, Kitty, and Alacritty. If you want to use the altkey bindings, you may need to set your terminal's TERM environment variable to xterm-256color. Here's why:
Ghostty, Kitty, and Alacritty all come with their own terminfo files:
Ghostty with xterm-ghostty, Kitty with xterm-kitty, and Alacritty with alacritty
None of the three produced the correct extended altkey bindings when paired with the terminfo provided in their distribution, yet all three worked with xterm-256color.
The extended altkeys were not defined in any of the terminfo files, not even xterm-256color. Yet, xterm-256color produced consistent keycode bindings with all three emulators. The standard key bindings, ins, delete, up, down arrows, etc., were the same for all three terminfos, and all three emulators produced the correct key bindings for those keys.
The fact that xterm-256color produced consistent keycode bindings for the altkeys, while the other three terminfos did not, is likely due to the fact that xterm-256color is more widely used and has better support for extended key bindings, even if they are not explicitly defined in the terminfo file. It's possible that xterm-256color has some default behavior or fallback mechanism that allows it to recognize and produce key codes for the altkeys, while the other terminfos do not have such a mechanism in place. This could explain why xterm-256color produced consistent keycode bindings for the altkeys across all three emulators, while the other terminfos did not.
| #define MAX | ( | a, | |
| b ) |
MIN macro for compatibility with code that uses the same name, while avoiding multiple evaluations of the arguments.
/usr/include/sys/param.h contains implementations of the MIN and MAX macros, which are simple but can lead to issues with multiple evaluations of the arguments if they have side effects. These macros provides a safer alternative to param.h Here are the macros from /usr/include/sys/param.h. You may comment out the macros defined herein and use the macros in param.h if you prefer.
| #define max | ( | a, | |
| b ) |
max macro evaluates two expressions, returning greatest result.
These macros use compound statements to create local scopes for the temporary variables _x and _y, which store the values of x and y, respectively. This ensures that if x or y have side effects (such as being incremented), they will only be evaluated once when the macro is expanded. The use of typeof allows the macro to work with any data type. The line (void)(&_x == &_y) is a compile-time check to ensure that the types of the arguments are compatible. This implementation of the min and max macros provides a safer and more robust way to determine the minimum and maximum values between two expressions without risking unintended consequences from multiple evaluations.
| #define MAX_ARGS 64 |
| #define MIN | ( | x, | |
| y ) |
| #define min | ( | x, | |
| y ) |
| #define SCR_COLS 1024 |
| #define to_lowercase | ( | c | ) |
to_lowercase(c) - convert an uppercase letter to lowercase
| #define to_uppercase | ( | c | ) |
to_uppercase(c) - convert a lowercase letter to uppercase
simple macro to convert a character to uppercase
| #define to_uppercase | ( | c | ) |
to_uppercase(c) - convert a lowercase letter to uppercase
simple macro to convert a character to uppercase
| #define XTERM_256COLOR |
| enum ColorsEnum |
Used for xterm256 color conversions.
| enum F_Type |
| enum LFFlags |
Definition at line 243 of file cm.h.
| enum LFTypes |
byte 2 - bits 16-23 File types
| Enumerator | |
|---|---|
| LF_FIFO | 1 named pipe |
| LF_CHR | 2 character device |
| LF_DIR | 4 directory |
| LF_BLK | 8 block |
| LF_REG | 16 regular file |
| LF_LNK | 32 link |
| LF_SOCK | 64 socket |
| LF_UNKNOWN | 128 unknown |
|
extern |
Apply gamma correction to RGB color.
apply_gamma
| rgb | Pointer to RGB color |
This function modifies the RGB color in place. It applies gamma correction to the RGB color based on the gamma values set in the SIO struct. If the color is a shade of gray, it applies the gray gamma correction. Otherwise, it applies the individual red, green, and blue gamma corrections.
Definition at line 307 of file dwin.c.
References BLUE_GAMMA, GRAY_GAMMA, GREEN_GAMMA, and RED_GAMMA.
Referenced by ui_add_color_rgb(), ui_chg_color(), and ui_init_color_hex().
Definition at line 962 of file dwin.c.
References a_toi(), Chyron::sfc, ui_getmaxy(), Chyron::win, and Chyron::y.
Referenced by open_pick_win().
|
extern |
|
extern |
Definition at line 581 of file dwin.c.
References BOX, cell_bl, cell_br, cell_ho, cell_tl, cell_tr, cell_ve, ui_getmaxx(), ui_getmaxy(), ui_mvwadd_wchnstr(), and ui_render().
Referenced by ui_box_surface_new(), and ui_box_surface_new().
|
extern |
Accepts input for a field in a C-Menu window.
| UiSurface | *sfc The surface to accept input from |
| win | The window to accept input from |
| accept_s | The string to accept input into |
| flin | The line number of the field |
| fcol | The column number of the field |
| flen | The length of the field |
< Enter accepts the field and moves to the next field if f_erase_remainder is set, it will clear the remaining characters above and after the current cursor location
KEY_IC toggles insert mode
KEY_DC deletes character at cursor
KEY_HOME moves cursor to start of field
KEY_BACKSPACE deletes character before cursor
KEY_LEFT moves cursor left one character
KEY_RIGHT moves cursor right one character
Handles mouse events for field editing
Definition at line 41 of file cm_fields.c.
References click_x, click_y, f_erase_remainder, ui_curs_set(), ui_cursor_move(), ui_get_event(), ui_mvwaddstr(), ui_render(), ui_wclrtoeol(), and WIN.
Referenced by get_cmd_arg().
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
dump options to stdout
|
extern |
dump options to stdout
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
Initialize color palette based on SIO settings.
init_clr_palette
| sio | Pointer to SIO struct with color settings |
This function initializes the xterm256 color cube and applies any color overrides specified in the SIO struct. The color strings in the SIO struct are expected to be six-digit HTML style hex color codes (e.g., "#RRGGBB"). If a color override is specified for any of the standard colors, it is applied using the ui_add_color_hex function.
Definition at line 333 of file dwin.c.
References SIO::bblack, SIO::bblue, SIO::bcyan, SIO::bg, SIO::bgreen, SIO::black, SIO::blue, SIO::bmagenta, SIO::borange, SIO::box_bg, SIO::box_fg, SIO::brackets_bg, SIO::brackets_fg, SIO::bred, SIO::bwhite, SIO::byellow, CLR_BBLACK, CLR_BBLUE, CLR_BCYAN, CLR_BG, CLR_BGREEN, CLR_BLACK, CLR_BLUE, CLR_BMAGENTA, CLR_BORANGE, CLR_BOX_BG, CLR_BOX_FG, CLR_BRACKETS_BG, CLR_BRACKETS_FG, CLR_BRED, CLR_BWHITE, CLR_BYELLOW, CLR_CYAN, CLR_FG, CLR_FILL_CHAR_BG, CLR_FILL_CHAR_FG, CLR_GREEN, CLR_IND_BG, CLR_IND_FG, CLR_LN_BG, CLR_LN_FG, CLR_MAGENTA, CLR_NCOLORS, CLR_NT_BG, CLR_NT_FG, CLR_NT_HL_BG, CLR_NT_HL_FG, CLR_NT_HL_REV_BG, CLR_NT_HL_REV_FG, CLR_NT_REV_BG, CLR_NT_REV_FG, CLR_RED, CLR_TITLE_BG, CLR_WHITE, CLR_YELLOW, SIO::cyan, SIO::fg, SIO::fill_char_bg, SIO::fill_char_fg, SIO::green, SIO::ind_bg, SIO::ind_fg, SIO::ln_bg, SIO::ln_fg, SIO::magenta, SIO::nt_bg, SIO::nt_fg, SIO::nt_hl_bg, SIO::nt_hl_fg, SIO::nt_hl_rev_bg, SIO::nt_hl_rev_fg, SIO::nt_rev_bg, SIO::nt_rev_fg, SIO::red, SIO::title_bg, ui_chg_color(), ui_color_cnt, SIO::white, and SIO::yellow.
Referenced by initialize_cells().
|
extern |
|
extern |
Initialize local color variables and color pairs based on SIO settings.
| sio | Pointer to SIO struct with color settings |
This function initializes local color variables and color pairs based on the settings in the SIO struct. It applies gamma correction to colors and sets up cchar_t variables for use in NCurses functions. The color pair indices are stored in global variables for easy reference throughout the code when applying colors to various parts of the interface using NCurses functions that accept color pair indices.
gamma correction values
These are read from ~/.minitrc
used when initializing colors
Definition at line 177 of file dwin.c.
References BLUE_GAMMA, SIO::blue_gamma, SIO::box_bg, SIO::box_fg, SIO::brackets, SIO::brackets_bg, SIO::brackets_fg, bw_chk, bw_ran, bw_sp, cell_bl, cell_box, cell_br, cell_brktl, cell_brktr, cell_bt, cell_chk, cell_cmdln, cell_cr, cell_default, cell_fill_char, cell_ho, cell_ind, cell_ln, cell_lt, cell_nt, cell_nt_hl, cell_nt_hl_rev, cell_nt_rev, cell_ran, cell_rt, cell_sp, cell_title, cell_tl, cell_tr, cell_tt, cell_ve, CLR_BG, CLR_BLUE, CLR_BOX_BG, CLR_BOX_FG, CLR_BRACKETS_BG, CLR_BRACKETS_FG, CLR_CMDLN_BG, CLR_CMDLN_FG, CLR_FG, CLR_FILL_CHAR_BG, CLR_FILL_CHAR_FG, CLR_GREEN, CLR_IND_BG, CLR_IND_FG, CLR_LN_BG, CLR_LN_FG, CLR_NT_BG, CLR_NT_FG, CLR_NT_HL_BG, CLR_NT_HL_FG, CLR_NT_HL_REV_BG, CLR_NT_HL_REV_FG, CLR_NT_REV_BG, CLR_NT_REV_FG, CLR_RED, CLR_TITLE_BG, CLR_TITLE_FG, CLR_YELLOW, SIO::cmdln_bg, SIO::cmdln_fg, cp_blue, cp_box, cp_brackets, cp_cmdln, cp_default, cp_fill_char, cp_green, cp_ind, cp_ln, cp_nt, cp_nt_hl, cp_nt_hl_rev, cp_nt_rev, cp_red, cp_title, cp_yellow, SIO::fill_char_bg, SIO::fill_char_fg, GRAY_GAMMA, SIO::gray_gamma, GREEN_GAMMA, SIO::green_gamma, SIO::ind_bg, SIO::ind_fg, init_clr_palette(), SIO::ln_bg, SIO::ln_fg, SIO::nt_bg, SIO::nt_fg, SIO::nt_hl_bg, SIO::nt_hl_fg, SIO::nt_hl_rev_bg, SIO::nt_hl_rev_fg, SIO::nt_rev_bg, SIO::nt_rev_fg, SIO::ran_bg, SIO::ran_fg, RED_GAMMA, SIO::red_gamma, SIO::title_bg, SIO::title_fg, ui_add_pair(), and ui_cell_from_ucp().
Referenced by main(), and read_theme().
|
extern |
|
extern |
|
extern |
Definition at line 404 of file dwin.c.
Referenced by border_title(), and border_ysplit_text().
|
extern |
Create a String struct with a dynamically allocated string.
| l | length of string to create including null terminator |
The returned String struct contains a dynamically allocated string of he specified length
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
Convert RGB color to XTerm 256 color index.
rgb_to_xterm256_idx
| rgb | RGB color |
This function converts an RGB color to the nearest XTerm 256 color index. It first checks if the color is a shade of gray, and if so, it uses the gray ramp. Otherwise, it calculates the nearest color in the 6x6x6 color cube.
Definition at line 252 of file dwin.c.
|
extern |
Trims trailing spaces from string s in place.
| s | - string to trim |
Definition at line 331 of file futil.c.
Referenced by fmt_line(), and picker().
|
extern |
|
extern |
Definition at line 1082 of file futil.c.
References fdname(), ssnprintf(), strnz__cat(), and strnz__cpy().
Referenced by form_process(), init_pick(), and view_init_input().
|
extern |
Definition at line 1057 of file futil.c.
References ssnprintf(), strnz__cat(), and strnz__cpy().
Referenced by fork_exec(), and menu_cmd_processor().
|
extern |
Converts String to boolean true or false.
| s | - string to convert |
Definition at line 934 of file futil.c.
Referenced by process_config_file().
|
extern |
|
extern |
Definition at line 521 of file dwin.c.
References BOX, Perror(), sfc_ptr, ui_box_surface_new(), ui_get_screen_size(), ui_render(), ui_surface, ui_surface_addwin(), and WIN.
Referenced by action_disposition(), answer_yn(), display_error(), display_form(), menu_engine(), Perror(), and popup_ckeys().
|
extern |
Definition at line 539 of file dwin.c.
References border_ysplit(), BOX, Perror(), sfc_ptr, ui_box_surface_new(), ui_curs_set(), ui_get_screen_size(), ui_render(), ui_surface, ui_surface_addwin(), WIN, and WIN2.
Referenced by open_pick_win().
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
Convert XTerm 256 color index to RGB.
xterm256_idx_to_rgb
| idx | XTerm 256 color index |
This function converts an XTerm 256 color index to an RGB color. It first checks if the index is in the standard 16 colors, then checks if it's in the 6x6x6 color cube, and finally checks if it's in the gray ramp.
Convert XTerm 256 color index to RGB
| idx | - XTerm 256 color index |
Definition at line 274 of file dwin.c.
References STDRGB::b, STDRGB::g, STDRGB::r, and std_color.
Referenced by parse_ansi(), and parse_ansi_str().
|
extern |
Definition at line 113 of file dwin.c.
Referenced by border_draw(), and initialize_cells().
|
extern |
Definition at line 98 of file dwin.c.
Referenced by border_title(), initialize_cells(), ui_bkgd(), and ui_box_surface_new().
|
extern |
Definition at line 114 of file dwin.c.
Referenced by border_draw(), and initialize_cells().
|
extern |
Definition at line 92 of file dwin.c.
Referenced by display_form(), and initialize_cells().
|
extern |
Definition at line 93 of file dwin.c.
Referenced by display_form(), and initialize_cells().
|
extern |
Definition at line 118 of file dwin.c.
Referenced by initialize_cells().
|
extern |
Definition at line 104 of file dwin.c.
Referenced by initialize_cells(), picker(), remove_right_angle(), reverse_object(), toggle_object(), and unreverse_object().
|
extern |
Definition at line 100 of file dwin.c.
Referenced by initialize_cells().
|
extern |
Definition at line 119 of file dwin.c.
Referenced by initialize_cells().
|
extern |
Definition at line 90 of file dwin.c.
Referenced by initialize_cells().
|
extern |
Definition at line 91 of file dwin.c.
Referenced by form_display_fields(), and initialize_cells().
|
extern |
Definition at line 111 of file dwin.c.
Referenced by border_draw(), border_title(), border_ysplit(), border_ysplit_text(), and initialize_cells().
|
extern |
Definition at line 99 of file dwin.c.
Referenced by initialize_cells().
|
extern |
Definition at line 102 of file dwin.c.
Referenced by init_view_boxwin(), init_view_full_screen(), and initialize_cells().
|
extern |
Definition at line 115 of file dwin.c.
Referenced by border_title(), border_ysplit(), border_ysplit_text(), and initialize_cells().
|
extern |
Definition at line 94 of file dwin.c.
Referenced by display_pick_page(), display_prompt(), form_display_accept_field(), form_display_field(), form_display_fields(), get_cmd_arg(), init_view_boxwin(), init_view_full_screen(), initialize_cells(), menu_cmd_processor(), menu_engine(), popup_ckeys(), reverse_object(), ui_surface_addpad(), ui_surface_addwin(), and unreverse_object().
|
extern |
Definition at line 96 of file dwin.c.
Referenced by border_ysplit_text(), initialize_cells(), menu_cmd_processor(), and menu_engine().
|
extern |
Definition at line 97 of file dwin.c.
Referenced by field_editor(), form_engine(), initialize_cells(), menu_cmd_processor(), and picker().
|
extern |
Definition at line 95 of file dwin.c.
Referenced by compile_chyron(), display_prompt(), field_editor(), get_cmd_arg(), initialize_cells(), menu_cmd_processor(), picker(), popup_ckeys(), reverse_object(), search(), and set_chyron_key().
|
extern |
Definition at line 103 of file dwin.c.
Referenced by get_cmd_arg(), get_cmd_char(), initialize_cells(), and picker().
|
extern |
Definition at line 116 of file dwin.c.
Referenced by border_title(), border_ysplit(), border_ysplit_text(), and initialize_cells().
|
extern |
Definition at line 120 of file dwin.c.
Referenced by border_title(), border_ysplit_text(), deselect_object(), get_cmd_char(), initialize_cells(), picker(), remove_right_angle(), reverse_object(), toggle_object(), unreverse_object(), and view_cmd_processor().
|
extern |
Definition at line 101 of file dwin.c.
Referenced by border_title(), and initialize_cells().
|
extern |
Definition at line 109 of file dwin.c.
Referenced by border_draw(), border_title(), and initialize_cells().
|
extern |
Definition at line 110 of file dwin.c.
Referenced by border_draw(), and initialize_cells().
|
extern |
Definition at line 117 of file dwin.c.
Referenced by initialize_cells().
|
extern |
Definition at line 112 of file dwin.c.
Referenced by border_draw(), and initialize_cells().
|
extern |
the x coordinate of a mouse click
Definition at line 45 of file dwin.c.
Referenced by cf_accept(), field_editor(), form_post(), and form_process().
|
extern |
the y coordinate of a mouse click
Definition at line 44 of file dwin.c.
Referenced by cf_accept(), field_editor(), form_post(), and form_process().
|
extern |
number of colors used
|
extern |
current color index
|
extern |
number of color pairs supported by the terminal
|
extern |
current color pair index
|
extern |
Definition at line 47 of file futil.c.
Referenced by open_cmenu_log(), write_cmenu_log(), and write_cmenu_log_ts().
|
extern |
|
extern |
Color names for .minitrc overrides.
color codes for the 16 basic colors
colors_text
These names are used in .minitrc to specify color overrides The order of these names corresponds to the ColorsEnum values
Definition at line 51 of file dwin.c.
|
extern |
blue background color pair index
Definition at line 162 of file dwin.c.
Referenced by initialize_cells().
|
extern |
bold color pair index
|
extern |
|
extern |
color pair index for field brackets
Definition at line 158 of file dwin.c.
Referenced by initialize_cells().
|
extern |
command line number background color pair index
|
extern |
command line number color pair index
|
extern |
|
extern |
fill character color pair index
Definition at line 157 of file dwin.c.
Referenced by initialize_cells().
|
extern |
green background color pair index
Definition at line 160 of file dwin.c.
Referenced by initialize_cells().
|
extern |
highlight color pair index
|
extern |
|
extern |
line number background color pair index
|
extern |
line number color pair index
|
extern |
normal color pair index
Definition at line 151 of file dwin.c.
Referenced by fmt_line(), initialize_cells(), and mbstr_to_cc().
|
extern |
|
extern |
highlight reverse color pair index
Definition at line 154 of file dwin.c.
Referenced by initialize_cells().
|
extern |
|
extern |
red background color pair index
Definition at line 159 of file dwin.c.
Referenced by initialize_cells().
|
extern |
|
extern |
yellow background color pair index
Definition at line 161 of file dwin.c.
Referenced by initialize_cells().
|
extern |
Definition at line 37 of file scriou.c.
Referenced by capture_curses_tioctl(), and restore_curses_tioctl().
|
extern |
Definition at line 35 of file scriou.c.
Referenced by capture_curses_tioctl(), and restore_curses_tioctl().
|
extern |
Definition at line 36 of file scriou.c.
Referenced by capture_curses_tioctl(), and restore_curses_tioctl().
|
extern |
|
extern |
the file descriptor for debug output, for debugging purposes
|
extern |
error message string for error messages
Definition at line 142 of file dwin.c.
Referenced by action_disposition(), enter_file_spec(), form_desc_error(), form_parse_desc(), form_process(), form_read_data(), form_write(), handle_signal(), init_view_full_screen(), mk_dir(), new_init(), new_pick(), new_view(), notcurses_input(), open_cmenu_log(), parse_menu_description(), ui_add_pair(), verify_dir(), verify_file(), view_cmd_processor(), view_init_input(), and write_view_buffer().
|
extern |
error message string for error messages
Definition at line 143 of file dwin.c.
Referenced by enter_file_spec(), form_desc_error(), form_parse_desc(), form_process(), form_read_data(), form_write(), handle_signal(), mk_dir(), new_init(), new_pick(), new_view(), notcurses_input(), parse_menu_description(), ui_add_pair(), verify_dir(), verify_file(), view_cmd_processor(), view_init_input(), write_cmenu_log_ts(), and write_view_buffer().
|
extern |
error message string for error messages
Definition at line 144 of file dwin.c.
Referenced by enter_file_spec(), form_desc_error(), form_parse_desc(), form_process(), form_read_data(), form_write(), handle_signal(), mk_dir(), new_init(), new_view(), notcurses_input(), parse_menu_description(), ui_add_pair(), verify_dir(), verify_file(), view_cmd_processor(), view_init_input(), and write_view_buffer().
|
extern |
error message string for error messages
Definition at line 145 of file dwin.c.
Referenced by verify_dir(), and verify_file().
|
extern |
|
extern |
curses mode is active
Definition at line 33 of file sig.c.
Referenced by action_disposition(), answer_yn(), destroy_curses(), display_error(), handle_signal(), Perror(), ui_init(), ui_init(), and ui_shutdown().
|
extern |
a flag to indicate whether debug output should be printed, for debugging purposes
|
extern |
curses tioctl captured
Definition at line 25 of file scriou.c.
Referenced by capture_curses_tioctl(), and restore_curses_tioctl().
|
extern |
shell tioctl captured
Definition at line 24 of file scriou.c.
Referenced by capture_shell_tioctl(), and restore_shell_tioctl().
|
extern |
whether to restore the screen
|
extern |
function name for error messages
Definition at line 141 of file dwin.c.
Referenced by verify_dir(), and verify_file().
|
extern |
beginning x coordinate of the current window, which can be used to determine the position of the window on the terminal screen.
|
extern |
beginning y coordinate of the current window, which can be used to determine the position of the window on the terminal screen.
|
extern |
number of columns in the current window, which may be less than the total number of columns in the terminal if the window is resized or if multiple windows are being used.
|
extern |
action in progress, which can be used to keep track of the current state of the program and determine how to respond to user input or other events.
|
extern |
window column, which can be used to determine the current column position in the window for displaying text or other content.
|
extern |
window line, which can be used to determine the current line position in the window for displaying text or other content.
|
extern |
number of lines in the current window, which may be less than the total number of lines in the terminal if the window is resized or if multiple windows are being used.
|
extern |
number of columns in the terminal
|
extern |
number of lines in the terminal
|
extern |
Definition at line 31 of file sig.c.
Referenced by handle_signal(), notcurses_input(), and signal_handler().
|
extern |
the line number of the source file being processed, for error messages
Definition at line 139 of file dwin.c.
Referenced by verify_dir(), and verify_file().
|
extern |
the name of the source file being processed, for error messages
Definition at line 140 of file dwin.c.
Referenced by verify_dir(), and verify_file().
|
extern |
|
extern |
|
extern |
Definition at line 127 of file futil.c.
Referenced by fork_exec(), form_process(), init_pick(), menu_cmd_processor(), and view_init_input().
|
extern |
|
extern |