C-Menu 0.2.9
A User Interface Toolkit
Loading...
Searching...
No Matches
ui_backend.h File Reference

Backend API for terminal UI library. More...

#include <fcntl.h>
#include <poll.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <time.h>
#include <unistd.h>
#include <wchar.h>
Include dependency graph for ui_backend.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

union  border_wide
struct  ext_fd_reg_t
struct  GCluster
struct  RGB
struct  SIO
struct  STDRGB
struct  ui_context_t
struct  UiCaps
struct  UiCchar64
struct  UiCell
union  UiChannels
struct  UiConfig
struct  UiEvent
struct  UiLogContext
struct  UiMultiMedia
struct  UiRect
struct  UiRuntime
struct  UiSurface
struct  UiSurfaceMeta

Macros

#define _GNU_SOURCE
#define _XOPEN_SOURCE_EXTENDED   1
#define ALLWINS   (uint)1000
#define ANSI_RESET   "\033[0m"
#define AS_ENUM(NAME)
#define AS_ENUM(NAME)
#define AS_ENUM(NAME)
#define AS_ENUM(NAME)
#define AS_ENUM(NAME)
#define AS_STRINGS(NAME)
#define ATTR_FORMAT(archetype, fmt_idx, first_arg)
#define BG_COLOR   0
#define BO_COLOR   1
#define BORDER_STYLE(X)
#define bw_bl   bw.bl
#define bw_br   bw.br
#define bw_bt   bw.bt
#define bw_cr   bw.cr
#define bw_ho   bw.ho
#define bw_lt   bw.lt
#define bw_rt   bw.rt
#define bw_tl   bw.tl
#define bw_tr   bw.tr
#define bw_tt   bw.tt
#define bw_ve   bw.ve
#define CCHARW_MAX   5
#define CELL_CHAR_INITIALIZER(c)
#define CELL_INITIALIZER(c, s, chan)
#define CHYRON_KEY_MAXLEN   64
#define CHYRON_KEYS   20
#define COLOR_LEN   8
#define ERR   -1
#define FG_COLOR   2
#define FILE_TYPE_LIST(X)
#define KEY_ALTDEL   0x20e
#define KEY_ALTDOWN   0x214
#define KEY_ALTEND   0x219
#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 LOG_LEVEL_LIST(X)
#define MAX_EXT_FDS   8
#define MAX_LOG_REC_LEN   4096
#define MAX_LOG_SIZE   (10 * 1024 * 1024)
#define MAXLEN   256
#define MOUSE_ACTION(X)
#define SFC_MAX   30
#define SUB_SURFACE_LIST(X)
#define UI_COLORS   512
#define UI_PAIRS   512
#define UI_SFC_MAX   30
#define XTERM_256COLOR   1

Typedefs

typedef uint16_t attr_t
typedef union border_wide BorderWide
typedef struct ncinput NcInput
typedef struct ncplane NcPlane
typedef struct ncplane_options NcPlaneOptions
typedef struct ncvisual NcVisual
typedef struct notcurses NotCurses
typedef struct notcurses_options NotCursesOptions
typedef struct SIO SIO
typedef nccell UiCell
typedef union UiChannels UiChannels
typedef struct UiColor UiColor
typedef uint UiColorIdx
typedef uint32_t UiKey
typedef struct UiMB UiMB
typedef struct UiPair UiPair
typedef uint16_t UiPairIdx
typedef struct UiRuntime UiRuntime
typedef struct UiSplitSurface UiSplitSurface
typedef uint16_t UiStyle
typedef struct UiSurface UiSurface

Enumerations

enum  ColorsEnum {
  CLR_BLACK , CLR_RED , CLR_GREEN , CLR_YELLOW ,
  CLR_BLUE , CLR_MAGENTA , CLR_CYAN , CLR_WHITE ,
  CLR_BBLACK , CLR_BRED , CLR_BGREEN , CLR_BYELLOW ,
  CLR_BBLUE , CLR_BMAGENTA , CLR_BCYAN , CLR_BWHITE ,
  CLR_BORANGE , CLR_FG , CLR_BG , CLR_BOX_FG ,
  CLR_BOX_BG , CLR_IND_FG , CLR_IND_BG , CLR_BRACKETS_FG ,
  CLR_BRACKETS_BG , CLR_FILL_CHAR_FG , CLR_FILL_CHAR_BG , CLR_LN_FG ,
  CLR_LN_BG , CLR_CMDLN_FG , CLR_CMDLN_BG , CLR_NT_FG ,
  CLR_NT_BG , CLR_NT_REV_FG , CLR_NT_REV_BG , CLR_NT_HL_FG ,
  CLR_NT_HL_BG , CLR_NT_HL_REV_FG , CLR_NT_HL_REV_BG , CLR_TITLE_FG ,
  CLR_TITLE_BG , CLR_NCOLORS
}
enum  FileType { FT_MAX }
enum  ss_t { SUB_SFC_MAX }
enum  UiBackend { UI_BACKEND_NCURSES = 0 , UI_BACKEND_NOTCURSES }
enum  UiBorderStyle { BORDER_MAX }
enum  UiLogLevel { LOG_LEVEL_COUNT }
enum  UiMouseAction { MOUSE_ACTION_MAX }

Functions

int ui_bkgd (UiSurface *s, ss_t w, const UiCell *cell)
 Set the background of a specific window within a UiSurface.
int ui_bkgdset (UiSurface *s, ss_t w, const UiCell *cell)
 Set the background for new content to be written to a specific window within a UiSurface.
int ui_bkgrnd (UiSurface *s, ss_t w, const UiCell *cell)
 Set the background of a specific window within a UiSurface.
int ui_bkgrndset (UiSurface *s, ss_t w, const UiCell *cell)
 Set the background for new content to be written to a specific window within a UiSurface.
int ui_border_draw (UiSurface *sfc, ss_t w)
int ui_border_title (UiSurface *sfc, ss_t w, const char *title)
 Draw a box with a title around the specified window.
int ui_border_ysplit (UiSurface *sfc, ss_t w, uint y)
 Draw a box with a separator line around the specified window.
int ui_border_ysplit_text (UiSurface *sfc, char *text, uint separator_line)
 Draw a box with a separator line and text around the specified window.
int ui_clear ()
 Clear the entire screen.
int ui_cm_surface_destroy (UiSurface *sfc)
 Destroy the most recently created surface.
int ui_curs_set (int visibility)
 Set the visibility of the cursor.
int ui_cursor_enable (UiSurface *s, ss_t w, bool visible)
 Enable or disable the cursor for a UiSurface.
int ui_cursor_enable_yx (UiSurface *s, ss_t w, uint y, uint x, bool visible)
 Enable or disable the cursor at a specific position within a UiSurface.
int ui_cursor_move (UiSurface *s, ss_t w, uint y, uint x)
 Move the cursor to a specified position within a UiSurface.
int ui_doupdate ()
 Refresh the display by updating the screen.
int ui_draw_ch (UiSurface *s, ss_t w, const char c)
 Draw a character in a surface window.
int ui_draw_ch_yx (UiSurface *s, ss_t w, uint y, uint x, const char c)
 Draw a character at a specific position in a surface window.
int ui_draw_hline (UiSurface *s, ss_t w, uint y, uint x, uint len, const UiStyle *style)
int ui_draw_text (UiSurface *s, ss_t w, uint y, uint x, const char *text)
 on specified window, move to y, x, add string
int ui_draw_text_fill (UiSurface *s, ss_t w, uint y, uint x, const char *text, int m)
 Draw a text string at a specific position in a surface window, filling the remaining space with spaces if the string is shorter than n.
int ui_draw_text_n (UiSurface *s, ss_t w, uint y, uint x, const char *text, int m)
 Draw a text string at a specific position in a surface window.
void ui_endwin ()
 End the UI application, cleaning up resources and shutting down the UI runtime.
int ui_erase ()
 Erase the entire screen.
UiBackend ui_get_backend ()
 Get the UI backend type.
void ui_get_caps (UiCaps *caps)
 Get the UI backend capabilities.
int ui_get_event_no_mouse (UiSurface *surface, ss_t w, UiEvent *ev)
 Wait for an input event on target (or stdscr if NULL) without mouse support.
void ui_get_screen_size (uint *lines, uint *cols)
 Get the current screen size (number of lines and columns).
int ui_getch ()
 Wait for a single input character from the NotCurses context.
int ui_getmaxx (UiSurface *s, ss_t w)
 Get the maximum number of columns of a UiSurface.
int ui_getmaxy (UiSurface *s, ss_t w)
 Get the maximum number of lines (rows) of a UiSurface.
void ui_getmaxyx (UiSurface *s, ss_t w, uint *lines, uint *cols)
 Get the maximum dimensions of a UiSurface.
void ui_getyx (UiSurface *s, ss_t w, uint *lines, uint *cols)
 Get the current cursor position within a window of a UI surface.
int ui_idcok (UiSurface *s, ss_t w, bool enable)
 Enable or disable the use of the insert/delete character capabilities for a UiSurface.
int ui_idlok (UiSurface *s, ss_t w, bool enable)
 Enable or disable the use of the insert/delete line capabilities for a UiSurface.
int ui_immedok (UiSurface *s, ss_t w, bool enable)
UiRuntime * ui_init (const UiConfig *config, SIO *sio)
 Initialize the UI runtime with the given configuration and SIO.
void ui_initialize_sio (SIO *sio)
int ui_keypad (UiSurface *s, ss_t w, bool enable)
 Enable or disable the keypad for a UiSurface.
int ui_mice_enable (int mask)
 Enable or disable mouse support.
int ui_mousemask (int mask)
 Enable or disable mouse support.
int ui_plane_cpy (NcPlane *dst, NcPlane *src, int dst_y, int dst_x, int src_y, int src_x, int ylen, int xlen)
int ui_prefresh (UiSurface *s, ss_t w, int pminrow, int pmincol, int sminrow, int smincol, int smaxrow, int smaxcol)
void ui_render ()
 Render the UI by updating panels and refreshing the display.
void ui_restore_wins ()
 Restore the state of all windows in the UI. This function refreshes the standard screen and all surface windows, ensuring that their contents are displayed correctly.
int ui_resume ()
 Resume the UI, restoring the previous program state and updating the display.
int ui_scrollok (UiSurface *s, ss_t w, bool enable)
 Enable or disable scrolling for a UiSurface.
int ui_setscrreg (UiSurface *s, ss_t w, uint top, uint bottom)
 Set the scrolling region for a UiSurface.
void ui_shutdown ()
 Shutdown the UI runtime, cleaning up resources and freeing memory.
const char * ui_sub_surface_str (ss_t w)
int ui_surface_addpad (UiSurface *s, ss_t w, ss_t view_win, uint lines, uint cols, uint y, uint x, bool hidden)
 Add a new pad to the specified UiSurface.
int ui_surface_addwin (UiSurface *s, ss_t w, ss_t p, uint lines, uint cols, uint y, uint x)
 Add a new window to the specified UiSurface.
UiSurface * ui_surface_box (UiSurface *parent, ss_t p, uint lines, uint cols, uint y, uint x, const char *title)
 Create a new UI surface with a border box and optional title.
void ui_surface_destroy (UiSurface *s)
 Destroy a UiSurface, cleaning up its windows and panels.
int ui_surface_hide (UiSurface *s, ss_t w)
 Hide a UiSurface, making it invisible on the screen.
int ui_surface_move (UiSurface *s, ss_t w, uint y, uint x)
 Move a UiSurface to a new position on the screen.
UiSurface * ui_surface_new (ss_t w, UiSurface *parent, ss_t p, uint lines, uint cols, uint y, uint x)
 Create a new UI surface with the specified parameters.
int ui_surface_resize (UiSurface *s, ss_t w, uint lines, uint cols)
 Resize a UiSurface to new dimensions.
int ui_surface_show (UiSurface *s, ss_t w)
 Show a UiSurface, making it visible on the screen.
int ui_suspend ()
 Suspend the UI, saving the current program state and ending the window session.
int ui_top_surface (UiSurface *s, ss_t w)
 Hide a UiSurface, making it invisible on the screen.
int ui_tracked_sfc_box (uint wlines, uint wcols, uint wbegy, uint wbegx, const char *wtitle)
 Create a new surface with a box window.
int ui_tracked_sfc_split_box (uint wlines, uint wcols, uint split_y, uint split_x, uint wbegy, uint wbegx, const char *wtitle)
 Create a new surface with a split box window.
void ui_update_panels ()
 Update the panels in the UI.
int ui_wclear (UiSurface *s, ss_t w)
 Clear the contents of a UiSurface or all surfaces.
int ui_wclrtobot (UiSurface *s, ss_t w)
 Set the style of a surface window.
int ui_wclrtoeol (UiSurface *s, ss_t w)
 Clear to the end of the line in a surface window.
int ui_werase (UiSurface *s, ss_t w)
 Erase the contents of a UiSurface or all surfaces.
int ui_whide (UiSurface *s, ss_t w)
int ui_wmove (UiSurface *s, ss_t w, uint y, uint x)
 Move the cursor to a specified position within a UiSurface.
int ui_wnoutrefresh (UiSurface *s, ss_t w)
 Refresh a specific window within a UiSurface.
int ui_wresize (UiSurface *s, ss_t w, uint lines, uint cols)
int ui_wscrl (UiSurface *s, ss_t w, int rows)
 Scroll the contents of a UiSurface by a specified number of lines.
int ui_wshow (UiSurface *s, ss_t w)

Variables

const wchar_t * border_double
const wchar_t * border_heavy
const wchar_t * border_none
const wchar_t * border_rounded
const wchar_t * border_single
BorderWide bw
const wchar_t * bw_chk
const wchar_t * bw_da
const wchar_t * bw_h09
const wchar_t * bw_la
const wchar_t * bw_lan
const wchar_t * bw_ra
const wchar_t * bw_ran
const wchar_t * bw_rbl
const wchar_t * bw_rbr
const wchar_t * bw_rtl
const wchar_t * bw_rtr
const wchar_t * bw_sp
const wchar_t * bw_ua
UiCell cell_bl
UiCell cell_black_bg
UiCell cell_blue_bg
UiCell cell_box
UiCell cell_br
UiCell cell_brktl
UiCell cell_brktr
UiCell cell_bs
UiCell cell_bt
UiCell cell_chk
UiCell cell_cmdln
UiCell cell_cr
UiCell cell_cyan_bg
UiCell cell_default
UiCell cell_fill_char
UiCell cell_green_bg
UiCell cell_ho
UiCell cell_ind
UiCell cell_ln
UiCell cell_ls
UiCell cell_lt
UiCell cell_magenta_bg
UiCell cell_nt
UiCell cell_nt_hl
UiCell cell_nt_hl_rev
UiCell cell_nt_rev
UiCell cell_ran
UiCell cell_red_bg
UiCell cell_rs
UiCell cell_rt
UiCell cell_sp
UiCell cell_title
UiCell cell_tl
UiCell cell_tr
UiCell cell_ts
UiCell cell_tt
UiCell cell_ve
UiCell cell_white_bg
UiCell cell_yellow_bg
int click_x
int click_y
uint clr_cnt
uint clr_idx
uint clr_pair_cnt
uint clr_pair_idx
char const colors_text [][10]
 Color names for .minitrc overrides.
uint COLS
ushort cp_black
ushort cp_blue
ushort cp_bold
ushort cp_box
ushort cp_brackets
ushort cp_cmdln_bg
ushort cp_cmdln_fg
ushort cp_cyan
ushort cp_default
ushort cp_fill_char
ushort cp_green
ushort cp_highlight
ushort cp_ind
ushort cp_ln_bg
ushort cp_ln_fg
ushort cp_magenta
ushort cp_nt
ushort cp_nt_hl
ushort cp_nt_hl_rev
ushort cp_nt_rev
ushort cp_red
ushort cp_title
ushort cp_white
ushort cp_yellow
char em0 [MAXLEN]
char em1 [MAXLEN]
char em2 [MAXLEN]
char em3 [MAXLEN]
bool f_ncurses_open
bool f_notcurses_open
uint LINES
int sfc_ptr = -1
NcPlane * stdplane
UiSurface * stdsfc
ui_context_t ui_ctx
UiLogContext ui_log_ctx
int win_ptr

Detailed Description

Backend API for terminal UI library.

Definition in file ui_backend.h.

Macro Definition Documentation

◆ _GNU_SOURCE

#define _GNU_SOURCE

Definition at line 13 of file ui_backend.h.

◆ _XOPEN_SOURCE_EXTENDED

#define _XOPEN_SOURCE_EXTENDED   1

Definition at line 12 of file ui_backend.h.

◆ ALLWINS

#define ALLWINS   (uint)1000

Definition at line 63 of file ui_backend.h.

◆ ANSI_RESET

#define ANSI_RESET   "\033[0m"

Definition at line 218 of file ui_backend.h.

◆ AS_ENUM [1/5]

#define AS_ENUM ( NAME)
Value:
NAME,

Definition at line 83 of file ui_backend.h.

◆ AS_ENUM [2/5]

#define AS_ENUM ( NAME)
Value:
NAME,

Definition at line 83 of file ui_backend.h.

◆ AS_ENUM [3/5]

#define AS_ENUM ( NAME)
Value:
NAME,

Definition at line 83 of file ui_backend.h.

◆ AS_ENUM [4/5]

#define AS_ENUM ( NAME)
Value:
NAME,

Definition at line 83 of file ui_backend.h.

◆ AS_ENUM [5/5]

#define AS_ENUM ( NAME)
Value:
NAME,

Definition at line 83 of file ui_backend.h.

◆ AS_STRINGS

#define AS_STRINGS ( NAME)
Value:
#NAME,

Definition at line 88 of file ui_backend.h.

◆ ATTR_FORMAT

#define ATTR_FORMAT ( archetype,
fmt_idx,
first_arg )
Value:
/* Unsupported compiler, strip attribute */

Definition at line 49 of file ui_backend.h.

◆ BG_COLOR

#define BG_COLOR   0

default background color

Definition at line 546 of file ui_backend.h.

◆ BO_COLOR

#define BO_COLOR   1

default bold foreground color

Definition at line 547 of file ui_backend.h.

◆ BORDER_STYLE

#define BORDER_STYLE ( X)
Value:
X(UI_BORDER_NONE) \
X(UI_BORDER_SINGLE) \
X(UI_BORDER_DOUBLE) \
X(UI_BORDER_ROUNDED) \
X(UI_BORDER_HEAVY)

Definition at line 197 of file ui_backend.h.

197#define BORDER_STYLE(X) \
198 X(UI_BORDER_NONE) \
199 X(UI_BORDER_SINGLE) \
200 X(UI_BORDER_DOUBLE) \
201 X(UI_BORDER_ROUNDED) \
202 X(UI_BORDER_HEAVY)

◆ bw_bl

#define bw_bl   bw.bl

Definition at line 636 of file ui_backend.h.

◆ bw_br

#define bw_br   bw.br

Definition at line 637 of file ui_backend.h.

◆ bw_bt

#define bw_bt   bw.bt

Definition at line 632 of file ui_backend.h.

◆ bw_cr

#define bw_cr   bw.cr

Definition at line 633 of file ui_backend.h.

◆ bw_ho

#define bw_ho   bw.ho

Definition at line 627 of file ui_backend.h.

◆ bw_lt

#define bw_lt   bw.lt

Definition at line 629 of file ui_backend.h.

◆ bw_rt

#define bw_rt   bw.rt

Definition at line 630 of file ui_backend.h.

◆ bw_tl

#define bw_tl   bw.tl

Definition at line 634 of file ui_backend.h.

◆ bw_tr

#define bw_tr   bw.tr

Definition at line 635 of file ui_backend.h.

◆ bw_tt

#define bw_tt   bw.tt

Definition at line 631 of file ui_backend.h.

◆ bw_ve

#define bw_ve   bw.ve

Definition at line 628 of file ui_backend.h.

◆ CCHARW_MAX

#define CCHARW_MAX   5

Definition at line 60 of file ui_backend.h.

◆ CELL_CHAR_INITIALIZER

#define CELL_CHAR_INITIALIZER ( c)
Value:
{ \
.gcluster = (c), \
.gcluster_backstop = 0, \
.stylemask = 0, \
.channels = 0, \
}

Definition at line 469 of file ui_backend.h.

469#define CELL_CHAR_INITIALIZER(c) { \
470 .gcluster = (c), \
471 .gcluster_backstop = 0, \
472 .stylemask = 0, \
473 .channels = 0, \
474}

◆ CELL_INITIALIZER

#define CELL_INITIALIZER ( c,
s,
chan )
Value:
{ \
.gcluster = (c), \
.gcluster_backstop = 0, \
.stylemask = (s), \
.channels = (chan), \
}

Definition at line 475 of file ui_backend.h.

475#define CELL_INITIALIZER(c, s, chan) { \
476 .gcluster = (c), \
477 .gcluster_backstop = 0, \
478 .stylemask = (s), \
479 .channels = (chan), \
480}

◆ CHYRON_KEY_MAXLEN

#define CHYRON_KEY_MAXLEN   64

maximum length of the command text

Definition at line 91 of file ui_backend.h.

◆ CHYRON_KEYS

#define CHYRON_KEYS   20

maximum number of key bindings for the chyron

Definition at line 92 of file ui_backend.h.

◆ COLOR_LEN

#define COLOR_LEN   8

length of color code strings

Definition at line 544 of file ui_backend.h.

◆ ERR

#define ERR   -1

Definition at line 468 of file ui_backend.h.

◆ FG_COLOR

#define FG_COLOR   2

default foreground color

Definition at line 545 of file ui_backend.h.

◆ FILE_TYPE_LIST

#define FILE_TYPE_LIST ( X)
Value:
X(FT_TEXT) \
X(FT_IMAGE) \
X(FT_VIDEO) \
X(FT_AUDIO) \
X(FT_BINARY_GARBAGE) \
X(FT_EMPTY) \
X(FT_UNREADABLE)

Definition at line 111 of file ui_backend.h.

111#define FILE_TYPE_LIST(X) \
112 X(FT_TEXT) \
113 X(FT_IMAGE) \
114 X(FT_VIDEO) \
115 X(FT_AUDIO) \
116 X(FT_BINARY_GARBAGE) \
117 X(FT_EMPTY) \
118 X(FT_UNREADABLE)

◆ KEY_ALTDEL

#define KEY_ALTDEL   0x20e

Definition at line 699 of file ui_backend.h.

◆ KEY_ALTDOWN

#define KEY_ALTDOWN   0x214

Definition at line 704 of file ui_backend.h.

◆ KEY_ALTEND

#define KEY_ALTEND   0x219

Definition at line 700 of file ui_backend.h.

◆ KEY_ALTHOME

#define KEY_ALTHOME   0x21e

Definition at line 697 of file ui_backend.h.

◆ KEY_ALTINS

#define KEY_ALTINS   0x223

Definition at line 696 of file ui_backend.h.

◆ KEY_ALTLEFT

#define KEY_ALTLEFT   0x228

Definition at line 703 of file ui_backend.h.

◆ KEY_ALTPGDN

#define KEY_ALTPGDN   0x22d

Definition at line 701 of file ui_backend.h.

◆ KEY_ALTPGUP

#define KEY_ALTPGUP   0x232

Definition at line 698 of file ui_backend.h.

◆ KEY_ALTRIGHT

#define KEY_ALTRIGHT   0x237

Definition at line 705 of file ui_backend.h.

◆ KEY_ALTUP

#define KEY_ALTUP   0x23d

Definition at line 702 of file ui_backend.h.

◆ LN_BG_COLOR

#define LN_BG_COLOR   7

default line number background

Definition at line 549 of file ui_backend.h.

◆ LN_COLOR

#define LN_COLOR   4

default line number color

Definition at line 548 of file ui_backend.h.

◆ LOG_LEVEL_LIST

#define LOG_LEVEL_LIST ( X)
Value:
X(FATAL) \
X(ERROR) \
X(WARN) \
X(INFO) \
X(VERBOSE) \
X(DEBUG) \
X(SILENT)

Definition at line 221 of file ui_backend.h.

221#define LOG_LEVEL_LIST(X) \
222 X(FATAL) \
223 X(ERROR) \
224 X(WARN) \
225 X(INFO) \
226 X(VERBOSE) \
227 X(DEBUG) \
228 X(SILENT)

◆ MAX_EXT_FDS

#define MAX_EXT_FDS   8

Definition at line 157 of file ui_backend.h.

◆ MAX_LOG_REC_LEN

#define MAX_LOG_REC_LEN   4096

Definition at line 220 of file ui_backend.h.

◆ MAX_LOG_SIZE

#define MAX_LOG_SIZE   (10 * 1024 * 1024)

Definition at line 219 of file ui_backend.h.

◆ MAXLEN

#define MAXLEN   256

Definition at line 66 of file ui_backend.h.

◆ MOUSE_ACTION

#define MOUSE_ACTION ( X)
Value:
X(UI_MOUSE_NONE) \
X(UI_MOUSE_PRESS) \
X(UI_MOUSE_RELEASE) \
X(UI_MOUSE_DRAG) \
X(UI_MOUSE_SCROLL_UP) \
X(UI_MOUSE_SCROLL_DOWN)

Definition at line 94 of file ui_backend.h.

94#define MOUSE_ACTION(X) \
95 X(UI_MOUSE_NONE) \
96 X(UI_MOUSE_PRESS) \
97 X(UI_MOUSE_RELEASE) \
98 X(UI_MOUSE_DRAG) \
99 X(UI_MOUSE_SCROLL_UP) \
100 X(UI_MOUSE_SCROLL_DOWN)

◆ SFC_MAX

#define SFC_MAX   30

Definition at line 65 of file ui_backend.h.

◆ SUB_SURFACE_LIST

#define SUB_SURFACE_LIST ( X)
Value:
X(BOX) \
X(WIN) \
X(WIN2) \
X(LNNO) \
X(CMDLN) \
X(PAD) \
X(VIEWPORT) \
X(WIN3)

Definition at line 74 of file ui_backend.h.

74#define SUB_SURFACE_LIST(X) \
75 X(BOX) \
76 X(WIN) \
77 X(WIN2) \
78 X(LNNO) \
79 X(CMDLN) \
80 X(PAD) \
81 X(VIEWPORT) \
82 X(WIN3)

◆ UI_COLORS

#define UI_COLORS   512

Definition at line 61 of file ui_backend.h.

◆ UI_PAIRS

#define UI_PAIRS   512

Definition at line 62 of file ui_backend.h.

◆ UI_SFC_MAX

#define UI_SFC_MAX   30

Definition at line 64 of file ui_backend.h.

◆ XTERM_256COLOR

#define XTERM_256COLOR   1

Definition at line 694 of file ui_backend.h.

Typedef Documentation

◆ attr_t

typedef uint16_t attr_t

Definition at line 458 of file ui_backend.h.

◆ BorderWide

typedef union border_wide BorderWide

◆ NcInput

typedef struct ncinput NcInput

Definition at line 187 of file ui_backend.h.

◆ NcPlane

typedef struct ncplane NcPlane

Definition at line 189 of file ui_backend.h.

◆ NcPlaneOptions

typedef struct ncplane_options NcPlaneOptions

Definition at line 463 of file ui_backend.h.

◆ NcVisual

typedef struct ncvisual NcVisual

Definition at line 188 of file ui_backend.h.

◆ NotCurses

typedef struct notcurses NotCurses

Definition at line 461 of file ui_backend.h.

◆ NotCursesOptions

typedef struct notcurses_options NotCursesOptions

Definition at line 462 of file ui_backend.h.

◆ SIO

typedef struct SIO SIO

Definition at line 179 of file ui_backend.h.

◆ UiCell

typedef nccell UiCell

Definition at line 459 of file ui_backend.h.

◆ UiChannels

typedef union UiChannels UiChannels

Definition at line 182 of file ui_backend.h.

◆ UiColor

typedef struct UiColor UiColor

Definition at line 465 of file ui_backend.h.

◆ UiColorIdx

typedef uint UiColorIdx

Definition at line 186 of file ui_backend.h.

◆ UiKey

typedef uint32_t UiKey

Definition at line 107 of file ui_backend.h.

◆ UiMB

typedef struct UiMB UiMB

Definition at line 183 of file ui_backend.h.

◆ UiPair

typedef struct UiPair UiPair

Definition at line 464 of file ui_backend.h.

◆ UiPairIdx

typedef uint16_t UiPairIdx

Definition at line 185 of file ui_backend.h.

◆ UiRuntime

typedef struct UiRuntime UiRuntime

Definition at line 178 of file ui_backend.h.

◆ UiSplitSurface

Definition at line 181 of file ui_backend.h.

◆ UiStyle

typedef uint16_t UiStyle

Definition at line 184 of file ui_backend.h.

◆ UiSurface

typedef struct UiSurface UiSurface

Definition at line 180 of file ui_backend.h.

Enumeration Type Documentation

◆ ColorsEnum

enum ColorsEnum
Enumerator
CLR_BLACK 
CLR_RED 
CLR_GREEN 
CLR_YELLOW 
CLR_BLUE 
CLR_MAGENTA 
CLR_CYAN 
CLR_WHITE 
CLR_BBLACK 
CLR_BRED 
CLR_BGREEN 
CLR_BYELLOW 
CLR_BBLUE 
CLR_BMAGENTA 
CLR_BCYAN 
CLR_BWHITE 
CLR_BORANGE 
CLR_FG 
CLR_BG 
CLR_BOX_FG 
CLR_BOX_BG 
CLR_IND_FG 
CLR_IND_BG 
CLR_BRACKETS_FG 
CLR_BRACKETS_BG 
CLR_FILL_CHAR_FG 
CLR_FILL_CHAR_BG 
CLR_LN_FG 
CLR_LN_BG 
CLR_CMDLN_FG 
CLR_CMDLN_BG 
CLR_NT_FG 
CLR_NT_BG 
CLR_NT_REV_FG 
CLR_NT_REV_BG 
CLR_NT_HL_FG 
CLR_NT_HL_BG 
CLR_NT_HL_REV_FG 
CLR_NT_HL_REV_BG 
CLR_TITLE_FG 
CLR_TITLE_BG 
CLR_NCOLORS 

Definition at line 551 of file ui_backend.h.

551 {
552 CLR_BLACK,
553 CLR_RED,
554 CLR_GREEN,
556 CLR_BLUE,
558 CLR_CYAN,
559 CLR_WHITE,
561 CLR_BRED,
564 CLR_BBLUE,
566 CLR_BCYAN,
569 CLR_FG,
570 CLR_BG,
579 CLR_LN_FG,
580 CLR_LN_BG,
583 CLR_NT_FG,
584 CLR_NT_BG,
594} ColorsEnum;
ColorsEnum
Definition ui_backend.h:551
@ CLR_CMDLN_BG
Definition ui_backend.h:582
@ CLR_FILL_CHAR_BG
Definition ui_backend.h:578
@ CLR_BOX_BG
Definition ui_backend.h:572
@ CLR_FILL_CHAR_FG
Definition ui_backend.h:577
@ CLR_FG
Definition ui_backend.h:569
@ CLR_RED
Definition ui_backend.h:553
@ CLR_NT_FG
Definition ui_backend.h:583
@ CLR_BRACKETS_FG
Definition ui_backend.h:575
@ CLR_YELLOW
Definition ui_backend.h:555
@ CLR_IND_FG
Definition ui_backend.h:573
@ CLR_BCYAN
Definition ui_backend.h:566
@ CLR_TITLE_FG
Definition ui_backend.h:591
@ CLR_WHITE
Definition ui_backend.h:559
@ CLR_MAGENTA
Definition ui_backend.h:557
@ CLR_BRACKETS_BG
Definition ui_backend.h:576
@ CLR_NT_REV_BG
Definition ui_backend.h:586
@ CLR_BLACK
Definition ui_backend.h:552
@ CLR_BWHITE
Definition ui_backend.h:567
@ CLR_LN_BG
Definition ui_backend.h:580
@ CLR_NT_HL_REV_BG
Definition ui_backend.h:590
@ CLR_BBLACK
Definition ui_backend.h:560
@ CLR_LN_FG
Definition ui_backend.h:579
@ CLR_NT_HL_FG
Definition ui_backend.h:587
@ CLR_BBLUE
Definition ui_backend.h:564
@ CLR_BGREEN
Definition ui_backend.h:562
@ CLR_BYELLOW
Definition ui_backend.h:563
@ CLR_BMAGENTA
Definition ui_backend.h:565
@ CLR_BORANGE
Definition ui_backend.h:568
@ CLR_NT_HL_BG
Definition ui_backend.h:588
@ CLR_NT_HL_REV_FG
Definition ui_backend.h:589
@ CLR_BG
Definition ui_backend.h:570
@ CLR_BOX_FG
Definition ui_backend.h:571
@ CLR_NT_BG
Definition ui_backend.h:584
@ CLR_TITLE_BG
Definition ui_backend.h:592
@ CLR_BRED
Definition ui_backend.h:561
@ CLR_NCOLORS
Definition ui_backend.h:593
@ CLR_BLUE
Definition ui_backend.h:556
@ CLR_IND_BG
Definition ui_backend.h:574
@ CLR_GREEN
Definition ui_backend.h:554
@ CLR_CMDLN_FG
Definition ui_backend.h:581
@ CLR_NT_REV_FG
Definition ui_backend.h:585
@ CLR_CYAN
Definition ui_backend.h:558

◆ FileType

enum FileType
Enumerator
FT_MAX 

Definition at line 120 of file ui_backend.h.

120 {
122 FT_MAX
123} FileType;
FileType
Definition ui_backend.h:120
@ FT_MAX
Definition ui_backend.h:122
#define FILE_TYPE_LIST(X)
Definition ui_backend.h:111
#define AS_ENUM(NAME)
Definition lf.h:88

◆ ss_t

enum ss_t
Enumerator
SUB_SFC_MAX 

Definition at line 84 of file ui_backend.h.

84 {
87} ss_t;
#define SUB_SURFACE_LIST(X)
Definition ui_backend.h:74
ss_t
Definition ui_backend.h:84
@ SUB_SFC_MAX
Definition ui_backend.h:86

◆ UiBackend

enum UiBackend
Enumerator
UI_BACKEND_NCURSES 

NCurses / NCursesW backend

UI_BACKEND_NOTCURSES 

NotCurses backend

Definition at line 492 of file ui_backend.h.

492 {
495} UiBackend;
UiBackend
Definition ui_backend.h:492
@ UI_BACKEND_NCURSES
Definition ui_backend.h:493
@ UI_BACKEND_NOTCURSES
Definition ui_backend.h:494

◆ UiBorderStyle

Enumerator
BORDER_MAX 

Definition at line 204 of file ui_backend.h.

204 {
#define BORDER_STYLE(X)
Definition ui_backend.h:197
UiBorderStyle
Definition ui_backend.h:204
@ BORDER_MAX
Definition ui_backend.h:206

◆ UiLogLevel

enum UiLogLevel
Enumerator
LOG_LEVEL_COUNT 

Definition at line 230 of file ui_backend.h.

230 {
233} UiLogLevel;
UiLogLevel
Definition ui_backend.h:230
@ LOG_LEVEL_COUNT
Definition ui_backend.h:232
#define LOG_LEVEL_LIST(X)
Definition ui_backend.h:221

◆ UiMouseAction

Enumerator
MOUSE_ACTION_MAX 

Definition at line 102 of file ui_backend.h.

102 {
#define MOUSE_ACTION(X)
Definition ui_backend.h:94
UiMouseAction
Definition ui_backend.h:102
@ MOUSE_ACTION_MAX
Definition ui_backend.h:104

Function Documentation

◆ ui_bkgd()

int ui_bkgd ( UiSurface * s,
ss_t w,
const UiCell * cell )

Set the background of a specific window within a UiSurface.

Set the background cell for the specified window within a UI surface.

Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface for which to set the background.
cellPointer to a UiCell structure representing the desired background attributes.
Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
cellPointer to the UiCell representing the background cell.
Returns
0 on success, -1 on failure.

This function sets the background cell for the specified window within a UI surface. It updates the styles and channels of the ncplane associated with the window and stores the background cell in the metadata. If the surface is not initialized, it returns -1.

Set the background of a specific window within a UiSurface.

Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
cellPointer to the UiCell representing the background cell.
Returns
0 on success, -1 on failure.

This function sets the background cell for the specified window within a UI surface. It updates the styles and channels of the ncplane associated with the window and stores the background cell in the metadata. If the surface is not initialized, it returns -1.

Definition at line 974 of file ui_ncurses.c.

974 {
975 if (!s)
976 return -1;
977 wbkgrnd(s->mwin[w], cell);
978 return 0;
979}

Referenced by init_view_boxwin(), init_view_full_screen(), ui_perror(), and ui_tracked_sfc_split_box().

Here is the caller graph for this function:

◆ ui_bkgdset()

int ui_bkgdset ( UiSurface * s,
ss_t w,
const UiCell * cell )

Set the background for new content to be written to a specific window within a UiSurface.

Set the background cell for the specified window within a UI surface without changing the base character.

Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface for which to set the background for new content.
cellPointer to a UiCell structure representing the desired background attributes for new content.
Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
cellPointer to the UiCell representing the background cell.
Returns
0 on success, -1 on failure.

This function sets the background cell for the specified window within a UI surface without changing the base character. It updates the styles and channels of the ncplane associated with the window and stores the background cell in the metadata. If the surface is not initialized, it returns -1.

Set the background for new content to be written to a specific window within a UiSurface.

Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
cellPointer to the UiCell representing the background cell.
Returns
0 on success, -1 on failure.

This function sets the background cell for the specified window within a UI surface without changing the base character. It updates the styles and channels of the ncplane associated with the window and stores the background cell in the metadata. If the surface is not initialized, it returns -1.

Definition at line 988 of file ui_ncurses.c.

988 {
989 if (!s)
990 return -1;
991 wbkgrndset(s->mwin[w], cell);
992 return 0;
993}

Referenced by display_pick_page(), display_prompt(), get_cmd_arg(), init_view_boxwin(), init_view_full_screen(), menu_cmd_processor(), menu_engine(), popup_ckeys(), reverse_object(), ui_border_title(), ui_border_ysplit_text(), and unreverse_object().

Here is the caller graph for this function:

◆ ui_bkgrnd()

int ui_bkgrnd ( UiSurface * s,
ss_t w,
const UiCell * cell )

Set the background of a specific window within a UiSurface.

Set the background cell for the specified window within a UI surface without changing the base character.

Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface for which to set the background.
cellPointer to a UiCell structure representing the desired background attributes.
Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
cellPointer to the UiCell representing the background cell.
Returns
0 on success, -1 on failure.

This function sets the background cell for the specified window within a UI surface without changing the base character. It updates the styles and channels of the ncplane associated with the window and stores the background cell in the metadata. If the surface is not initialized, it returns -1.

Set the background of a specific window within a UiSurface.

Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
cellPointer to the UiCell representing the background cell.
Returns
0 on success, -1 on failure.

This function sets the background cell for the specified window within a UI surface without changing the base character. It updates the styles and channels of the ncplane associated with the window and stores the background cell in the metadata. If the surface is not initialized, it returns -1.

Definition at line 1002 of file ui_ncurses.c.

1002 {
1003 if (!s->mwin[w])
1004 return -1;
1005 wbkgrnd(s->mwin[w], cell);
1006 return 0;
1007}

◆ ui_bkgrndset()

int ui_bkgrndset ( UiSurface * s,
ss_t w,
const UiCell * cell )

Set the background for new content to be written to a specific window within a UiSurface.

Set the background cell for the specified window within a UI surface without changing the base character.

Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface for which to set the background for new content.
cellPointer to a UiCell structure representing the desired background attributes for new content.
Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
cellPointer to the UiCell representing the background cell.
Returns
0 on success, -1 on failure.

This function sets the background cell for the specified window within a UI surface without changing the base character. It updates the styles and channels of the ncplane associated with the window and stores the background cell in the metadata. If the surface is not initialized, it returns -1.

Set the background for new content to be written to a specific window within a UiSurface.

Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
cellPointer to the UiCell representing the background cell.
Returns
0 on success, -1 on failure.

This function sets the background cell for the specified window within a UI surface without changing the base character. It updates the styles and channels of the ncplane associated with the window and stores the background cell in the metadata. If the surface is not initialized, it returns -1.

Definition at line 1016 of file ui_ncurses.c.

1016 {
1017 if (!s->mwin[w])
1018 return -1;
1019 wbkgrndset(s->mwin[w], cell);
1020 return 0;
1021}

◆ ui_border_draw()

int ui_border_draw ( UiSurface * sfc,
ss_t w )

Definition at line 523 of file ui_common.c.

523 {
524 uint maxy = ui_getmaxy(sfc, w);
525 uint maxx = ui_getmaxx(sfc, w);
526 uint y = 0;
527 uint x = 0;
528 ui_mvwadd_wchnstr(sfc, w, y, x++, &cell_tl, 1);
529 for (x = 1; x < maxx - 1; x++)
530 ui_mvwadd_wchnstr(sfc, w, y, x, &cell_ho, 1);
531 ui_mvwadd_wchnstr(sfc, w, y, maxx - 1, &cell_tr, 1);
532 for (y = 1; y < maxy - 1; y++) {
533 ui_mvwadd_wchnstr(sfc, w, y, 0, &cell_ve, 1);
534 ui_mvwadd_wchnstr(sfc, w, y, maxx - 1, &cell_ve, 1);
535 }
536 ui_mvwadd_wchnstr(sfc, w, y, 0, &cell_bl, 1);
537 for (x = 1; x < maxx - 1; x++)
538 ui_mvwadd_wchnstr(sfc, w, y, x, &cell_ho, 1);
539 ui_mvwadd_wchnstr(sfc, w, y, maxx - 1, &cell_br, 1);
540#ifdef DEBUG_IMMED_UI
541 ui_render();
542#endif
543 return 0;
544}
void ui_render()
Render the UI by updating panels and refreshing the display.
Definition ui_ncurses.c:931
int ui_getmaxy(UiSurface *s, ss_t w)
Get the maximum number of lines (rows) of a UiSurface.
Definition ui_ncurses.c:733
int ui_getmaxx(UiSurface *s, ss_t w)
Get the maximum number of columns of a UiSurface.
Definition ui_ncurses.c:744
UiCell cell_ve
Definition ui_common.c:141
UiCell cell_tr
Definition ui_common.c:139
UiCell cell_br
Definition ui_common.c:143
UiCell cell_tl
Definition ui_common.c:138
UiCell cell_ho
Definition ui_common.c:140
UiCell cell_bl
Definition ui_common.c:142
int ui_mvwadd_wchnstr(UiSurface *s, ss_t w, uint y, uint x, const UiCell *cmplx_buf, uint n)
Draw a complex character string at a specific position in a surface window, with a maximum length.

References cell_bl, cell_br, cell_ho, cell_tl, cell_tr, cell_ve, ui_getmaxx(), ui_getmaxy(), and ui_mvwadd_wchnstr().

Referenced by ui_surface_box(), and ui_surface_box().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ui_border_title()

int ui_border_title ( UiSurface * sfc,
ss_t w,
const char * title )

Draw a box with a title around the specified window.

border_title

Parameters
boxPointer to the window to draw the box around
titleTitle text to display at the top of the box

This function draws a box around the specified window, similar to border_draw(), but it also includes a title at the top of the box. The title is displayed in the center of the top edge of the box, and the horizontal line is drawn on either side of the title. Use this function when you want to visually label a window with a title.

Definition at line 621 of file ui_common.c.

621 {
622 if (!title || !*title)
623 return 0;
624 uint y = 0;
625 uint x = 0;
626 uint l;
627 uint maxx = ui_getmaxx(sfc, w);
628 ui_mvwadd_wchnstr(sfc, w, y, x++, &cell_tl, 1);
629 ui_mvwadd_wchnstr(sfc, w, y, x++, &cell_rt, 1);
630 ui_mvwadd_wchnstr(sfc, w, y, x++, &cell_sp, 1);
631 wchar_t *title_wc;
632 title_wc = ui_mbstr_to_wcstr(title);
633 l = wcswidth(title_wc, wcslen(title_wc));
634 l = min(l, maxx - 7);
635 ui_bkgdset(sfc, w, &cell_title);
636 ui_mvwaddnwstr(sfc, w, y, x, title_wc, l);
637 ui_bkgdset(sfc, w, &cell_box);
638 x += l;
639 free(title_wc);
640 ui_mvwadd_wchnstr(sfc, w, y, x++, &cell_sp, 1);
641 ui_mvwadd_wchnstr(sfc, w, y, x++, &cell_lt, 1);
642 while (x < maxx - 1) {
643 ui_mvwadd_wchnstr(sfc, w, y, x++, &cell_ho, 1);
644 }
645#ifdef DEBUG_IMMED_UI
646 ui_render();
647#endif
648 return 0;
649}
int ui_bkgdset(UiSurface *s, ss_t w, const UiCell *cell)
Set the background for new content to be written to a specific window within a UiSurface.
Definition ui_ncurses.c:988
UiCell cell_sp
Definition ui_common.c:149
wchar_t * ui_mbstr_to_wcstr(const char *mb_str)
Convert a multibyte string to a wide character string.
Definition ui_common.c:364
UiCell cell_lt
Definition ui_common.c:144
UiCell cell_title
Definition ui_common.c:130
UiCell cell_box
Definition ui_common.c:127
UiCell cell_rt
Definition ui_common.c:145
int ui_mvwaddnwstr(UiSurface *s, ss_t w, uint y, uint x, const wchar_t *wstr, int m)
Draw a wide-character string at a specific position in a surface window, with a maximum length.
#define min(x, y)
Definition lf.h:158

References cell_box, cell_ho, cell_lt, cell_rt, cell_sp, cell_title, cell_tl, ui_bkgdset(), ui_getmaxx(), ui_mbstr_to_wcstr(), ui_mvwadd_wchnstr(), and ui_mvwaddnwstr().

Referenced by new_view_file(), ui_surface_box(), ui_surface_box(), view_boxwin_resize(), and view_file().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ui_border_ysplit()

int ui_border_ysplit ( UiSurface * sfc,
ss_t w,
uint y )

Draw a box with a separator line around the specified window.

ui_border-ysplit

Parameters
boxPointer to the window to draw the box around
yLine number where the separator line should be drawn

This function draws a box around the specified window, similar to border_draw(), but it also includes a horizontal separator line that divides the box into two sections. The separator line is drawn at a fixed position (line 00, page 00) and extends across the width of the box. Use this function when you want to visually separate two sections within a window, such as for a header and content area.

Definition at line 556 of file ui_common.c.

556 {
557 uint maxx = ui_getmaxx(sfc, w);
558 ui_mvwadd_wchnstr(sfc, w, y, 0, &cell_lt, 1);
559 for (uint x = 1; x < maxx - 1; x++)
560 ui_mvwadd_wchnstr(sfc, w, y, x, &cell_ho, 1);
561 ui_mvwadd_wchnstr(sfc, w, y, maxx - 1, &cell_rt, 1);
562#ifdef DEBUG_IMMED_UI
563 ui_render();
564#endif
565 return 0;
566}

References cell_ho, cell_lt, cell_rt, ui_getmaxx(), and ui_mvwadd_wchnstr().

Referenced by ui_tracked_sfc_split_box().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ui_border_ysplit_text()

int ui_border_ysplit_text ( UiSurface * sfc,
char * text_in,
uint separator_line )

Draw a box with a separator line and text around the specified window.

ui_border_ysplit_text

Parameters
boxPointer to the window to draw the box around
textText to display in the middle of the separator line
separator_lineLine number where the separator line should be drawn

This function draws a box around the specified window, similar to border_draw(), but it also includes a horizontal separator line that divides the box into two sections. The separator line is drawn at the specified line number and extends across the width of the box, with the provided text displayed in the middle of the line. Use this function when you want to visually separate two sections within a window and label the separator with descriptive text.

Definition at line 579 of file ui_common.c.

579 {
580 char text[MAXLEN];
581 uint maxx = ui_getmaxx(sfc, BOX);
582 uint l;
583 uint y = separator_line;
584 uint x = 0;
585 // Draw the horizontal line with text in the middle, so we start by drawing
586 // the left edge, then the text, then the right edge, and finally fill in the
587 // horizontal line on either side of the text.
588 ui_mvwadd_wchnstr(sfc, BOX, y, x++, &cell_lt, 1);
589 ui_mvwadd_wchnstr(sfc, BOX, y, x++, &cell_ho, 1);
590 ui_mvwadd_wchnstr(sfc, BOX, y, x++, &cell_rt, 1);
591 ui_mvwadd_wchnstr(sfc, BOX, y, x++, &cell_sp, 1);
592 strnz__cpy(text, text_in, maxx - 7);
593 wchar_t *text_wc;
594 text_wc = ui_mbstr_to_wcstr(text);
595 l = wcswidth(text_wc, wcslen(text_wc));
596 ui_bkgdset(sfc, BOX, &cell_nt_hl);
597 ui_mvwaddnwstr(sfc, BOX, y, x, text_wc, l);
598 x += l;
599 l = min(l, maxx - 7);
600 free(text_wc);
601 ui_mvwadd_wchnstr(sfc, BOX, y, x++, &cell_sp, 1);
602 ui_mvwadd_wchnstr(sfc, BOX, y, x++, &cell_lt, 1);
603 while (x < maxx - 1)
604 ui_mvwadd_wchnstr(sfc, BOX, y, x++, &cell_ho, 1);
605 ui_mvwadd_wchnstr(sfc, BOX, y, x++, &cell_rt, 1);
606#ifdef DEBUG_IMMED_UI
607 ui_render();
608#endif
609 return 0;
610}
UiCell cell_nt_hl
Definition ui_common.c:125
#define MAXLEN
Definition lf.h:38
size_t strnz__cpy(char *, const char *, size_t)
safer alternative to strncpy
Definition lf.c:2299

References cell_ho, cell_lt, cell_nt_hl, cell_rt, cell_sp, strnz__cpy(), ui_bkgdset(), ui_getmaxx(), ui_mbstr_to_wcstr(), ui_mvwadd_wchnstr(), and ui_mvwaddnwstr().

Referenced by picker().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ui_clear()

int ui_clear ( )

Clear the entire screen.

Clear the contents of the standard plane.

Returns
0 on success, or -1 on failure.
0 on success, -1 on failure.

This function clears the contents of the standard plane by erasing its contents. If the standard plane is not initialized, it returns -1.

Clear the entire screen.

Returns
0 on success, -1 on failure.

This function clears the contents of the standard plane by erasing its contents. If the standard plane is not initialized, it returns -1.

Definition at line 631 of file ui_ncurses.c.

631 {
632 clear();
633 return 0;
634}

References stdplane.

◆ ui_cm_surface_destroy()

int ui_cm_surface_destroy ( UiSurface * sfc)

Destroy the most recently created surface.

ui_cm_destroy_surface

Returns
0 on success, -1 if no surfaces exist

This function destroys the most recently created surface and decrements the surface pointer. It should be called when a surface is no longer needed to free up resources. If there are no surfaces to destroy, it returns -1.

Note
The difference between this function and ui_surface_destroy() is that this function destroys the surface pointed to by the surface pointer (sfc_ptr) and decrements the surface pointer after destroying the surface.

Definition at line 515 of file ui_common.c.

515 {
517 sfc_ptr--;
518 return 0;
519}
void ui_surface_destroy(UiSurface *s)
Destroy a UiSurface, cleaning up its windows and panels.
Definition ui_ncurses.c:499
int sfc_ptr
Definition ui_ncurses.c:42

References sfc_ptr, and ui_surface_destroy().

Referenced by init_form(), init_pick(), menu_engine(), ui_action_disposition(), ui_answer_yn(), ui_display_error(), ui_perror(), and ui_timeout_prompt().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ui_curs_set()

int ui_curs_set ( int visible)

Set the visibility of the cursor.

Enable or disable the cursor visibility.

Parameters
visibilityAn integer value indicating the desired cursor visibility: 0 - Invisible 1 - Visible 2 - Very visible (e.g., block cursor)
Returns
0 on success, or -1 on failure.
Parameters
visibleTrue to enable the cursor, false to disable it.
Returns
0 on success, -1 on failure.

This function enables or disables the cursor visibility. If the UI is not initialized, it returns -1. When enabling the cursor, it retrieves the current cursor position and enables the cursor at that position.

Set the visibility of the cursor.

Parameters
visibleTrue to enable the cursor, false to disable it.
Returns
0 on success, -1 on failure.

This function enables or disables the cursor visibility. If the UI is not initialized, it returns -1. When enabling the cursor, it retrieves the current cursor position and enables the cursor at that position.

Definition at line 881 of file ui_ncurses.c.

881 {
882 curs_set(visibility);
883 return 0;
884}

References ui.

Referenced by cf_accept(), field_editor(), fork_exec(), ui_answer_yn(), and ui_tracked_sfc_split_box().

Here is the caller graph for this function:

◆ ui_cursor_enable()

int ui_cursor_enable ( UiSurface * s,
ss_t w,
bool visible )

Enable or disable the cursor for a UiSurface.

Enable or disable the cursor at the current position on the surface and plane specified.

Parameters
sPointer to the UiSurface where the cursor will be enabled or disabled.
wThe index of the window within the surface where the cursor will be enabled or disabled.
visibleA boolean value indicating whether to make the cursor visible (true) or invisible (false).
Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
visibleTrue to enable the cursor, false to disable it.
Returns
0 on success, -1 on failure.

This function enables or disables the cursor at the current position on the surface and plane specified. If the UI is not initialized, it returns -1.

Enable or disable the cursor for a UiSurface.

Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
visibleTrue to enable the cursor, false to disable it.
Returns
0 on success, -1 on failure.

This function enables or disables the cursor at the current position on the surface and plane specified. If the UI is not initialized, it returns -1.

Definition at line 911 of file ui_ncurses.c.

911 {
912 (void)s;
913 (void)w;
914 if (!ui)
915 return -1;
916 ui->cursor_visible = visible;
917 curs_set(visible ? 1 : 0);
918 return 0;
919}
UiRuntime * ui
Definition ui_ncurses.c:39

References ui.

◆ ui_cursor_enable_yx()

int ui_cursor_enable_yx ( UiSurface * s,
ss_t w,
uint y,
uint x,
bool visible )

Enable or disable the cursor at a specific position within a UiSurface.

Enable or disable the cursor at a specific position on the surface and plane specified.

Parameters
sPointer to the UiSurface where the cursor will be enabled or disabled.
wThe index of the window within the surface where the cursor will be enabled or disabled.
yThe y-coordinate (row) for the cursor's position.
xThe x-coordinate (column) for the cursor's position.
visibleA boolean value indicating whether to make the cursor visible (true) or invisible (false).
Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
yThe y-coordinate for the cursor position.
xThe x-coordinate for the cursor position.
visibleTrue to enable the cursor, false to disable it.
Returns
0 on success, -1 on failure.

This function enables or disables the cursor at a specific position on the surface and plane specified. If the UI is not initialized, it returns -1.

Enable or disable the cursor at a specific position within a UiSurface.

Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
yThe y-coordinate for the cursor position.
xThe x-coordinate for the cursor position.
visibleTrue to enable the cursor, false to disable it.
Returns
0 on success, -1 on failure.

This function enables or disables the cursor at a specific position on the surface and plane specified. If the UI is not initialized, it returns -1.

Definition at line 896 of file ui_ncurses.c.

896 {
897 if (!ui)
898 return -1;
899 wmove(s->mwin[w], y, x);
900 ui->cursor_visible = visible;
901 curs_set(visible ? 2 : 0);
902 return 0;
903}

References ui.

Referenced by field_editor(), get_cmd_arg(), get_cmd_char(), and picker().

Here is the caller graph for this function:

◆ ui_cursor_move()

int ui_cursor_move ( UiSurface * s,
ss_t w,
uint y,
uint x )

Move the cursor to a specified position within a UiSurface.

Move the cursor to the specified position within a window of a UI surface.

Parameters
sPointer to the UiSurface where the cursor will be moved.
wThe index of the window within the surface where the cursor will be moved.
yThe new y-coordinate (row) for the cursor's position.
xThe new x-coordinate (column) for the cursor's position.
Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
yThe y-coordinate for the new cursor position.
xThe x-coordinate for the new cursor position.
Returns
0 on success, -1 on failure.

This function moves the cursor to the specified position within a window of a UI surface. If the surface or window is not initialized, it returns -1.

Move the cursor to a specified position within a UiSurface.

Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
yThe y-coordinate for the new cursor position.
xThe x-coordinate for the new cursor position.
Returns
0 on success, -1 on failure.

This function moves the cursor to the specified position within a window of a UI surface. If the surface or window is not initialized, it returns -1.

Definition at line 698 of file ui_ncurses.c.

698 {
699 if (!s || !s->mwin[w])
700 return -1;
701 return wmove(s->mwin[w], y, x);
702}

Referenced by cf_accept(), display_line(), display_line_eod(), display_prompt(), display_split_line(), form_post(), form_process(), get_cmd_arg(), get_cmd_char(), ncurses_input(), picker(), remove_right_angle(), scroll_next(), scroll_prev(), search(), unreverse_object(), and view_display_page().

Here is the caller graph for this function:

◆ ui_doupdate()

int ui_doupdate ( )

Refresh the display by updating the screen.

Definition at line 942 of file ui_ncurses.c.

942 {
943 doupdate();
944 return 0;
945}

◆ ui_draw_ch()

int ui_draw_ch ( UiSurface * s,
ss_t w,
char c )

Draw a character in a surface window.

on specified window, at current location, add character

Parameters
sThe surface to modify.
wThe window index within the surface.
cThe character to draw.
Returns
0 on success, -1 on error.
Parameters
ssurface
wwindow
ccharacter
Returns
0 on success, -1 on error

Draw a character in a surface window.

Parameters
ssurface
wwindow
ccharacter
Returns
0 on success, -1 on error

Definition at line 53 of file ui_ncurses_draw.c.

53 {
54 if (!s)
55 return -1;
56 waddch(s->mwin[w], c);
57 return 0;
58}

◆ ui_draw_ch_yx()

int ui_draw_ch_yx ( UiSurface * s,
ss_t w,
uint y,
uint x,
char c )

Draw a character at a specific position in a surface window.

on specified window, move to y, x, add character

Parameters
sThe surface to modify.
wThe window index within the surface.
yThe y-coordinate (row) to draw the character.
xThe x-coordinate (column) to draw the character.
cThe character to draw.
Returns
0 on success, -1 on error.
Parameters
ssurface
wwindow
yrow
xcolumn
ccharacter
Returns
0 on success, -1 on error

Draw a character at a specific position in a surface window.

Parameters
ssurface
wwindow
yrow
xcolumn
ccharacter
Returns
0 on success, -1 on error

Definition at line 67 of file ui_ncurses_draw.c.

67 {
68 if (!s)
69 return -1;
70 mvwaddch(s->mwin[w], y, x, c);
71 return 0;
72}

Referenced by menu_cmd_processor().

Here is the caller graph for this function:

◆ ui_draw_hline()

int ui_draw_hline ( UiSurface * s,
ss_t w,
uint y,
uint x,
uint len,
const UiStyle * style )

◆ ui_draw_text()

int ui_draw_text ( UiSurface * s,
ss_t w,
uint y,
uint x,
const char * text )

on specified window, move to y, x, add string

Parameters
ssurface
wwindow
yrow
xcolumn
textstring
Returns
0 on success, -1 on error

Definition at line 74 of file ui_ncurses_draw.c.

74 {
75 if (!s || !text)
76 return -1;
77 mvwaddstr(s->mwin[w], y, x, text);
78 return 0;
79}

Referenced by ui_action_disposition(), ui_answer_yn(), ui_display_error(), ui_perror(), ui_timeout_prompt(), and ui_update_timeout_prompt().

Here is the caller graph for this function:

◆ ui_draw_text_fill()

int ui_draw_text_fill ( UiSurface * s,
ss_t w,
uint y,
uint x,
const char * text,
int m )

Draw a text string at a specific position in a surface window, filling the remaining space with spaces if the string is shorter than n.

on specified window, move to y, x, add string, at most m columns, fill with spaces if text is shorter than m

Parameters
sThe surface to modify.
wThe window index within the surface.
yThe y-coordinate (row) to draw the text.
xThe x-coordinate (column) to draw the text.
textThe text string to draw.
nThe number of characters to draw, padding with spaces if necessary.
Returns
0 on success, -1 on error.
Parameters
ssurface
wwindow
yrow
xcolumn
textstring
mmaximum number of columns to write
Returns
0 on success, -1 on error

Draw a text string at a specific position in a surface window, filling the remaining space with spaces if the string is shorter than n.

Parameters
ssurface
wwindow
yrow
xcolumn
textstring
mmaximum number of columns to write
Returns
0 on success, -1 on error

Definition at line 103 of file ui_ncurses_draw.c.

103 {
104 if (!s || !text)
105 return -1;
106 uint l = strlen(text);
107 if (l < (uint)n) {
108 char *tmp_str = (char *)malloc(n + 1);
109 if (!tmp_str)
110 return -1;
111 strcpy(tmp_str, text);
112 for (int i = l; i < (int)n; i++) {
113 tmp_str[i] = ' ';
114 }
115 tmp_str[n] = '\0';
116 mvwaddstr(s->mwin[w], y, x, tmp_str);
117 free(tmp_str);
118 } else {
119 mvwaddnstr(s->mwin[w], y, x, text, (int)n);
120 }
121 return 0;
122}

References ui_render().

Referenced by menu_cmd_processor(), and menu_engine().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ui_draw_text_n()

int ui_draw_text_n ( UiSurface * s,
ss_t w,
uint y,
uint x,
const char * text,
int m )

Draw a text string at a specific position in a surface window.

on specified window, move to y, x, add string, at most m columns

Parameters
sThe surface to modify.
wThe window index within the surface.
yThe y-coordinate (row) to draw the text.
xThe x-coordinate (column) to draw the text.
textThe text string to draw.
Returns
0 on success, -1 on error.
Parameters
ssurface
wwindow
yrow
xcolumn
textstring
mmaximum number of columns to write
Returns
0 on success, -1 on error

Draw a text string at a specific position in a surface window.

Parameters
ssurface
wwindow
yrow
xcolumn
textstring
mmaximum number of columns to write
Returns
0 on success, -1 on error

Definition at line 88 of file ui_ncurses_draw.c.

88 {
89 if (!s || !text)
90 return -1;
91 mvwaddnstr(s->mwin[w], y, x, text, (int)n);
92 return 0;
93}

◆ ui_endwin()

void ui_endwin ( )

End the UI application, cleaning up resources and shutting down the UI runtime.

Destroy a UI surface and free its resources.

Parameters
sPointer to the UiSurface to be destroyed.

This function destroys a UI surface by freeing its associated ncplanes and metadata. It also frees the memory allocated for the UiSurface structure. If the provided pointer is NULL, the function does nothing.

End the UI application, cleaning up resources and shutting down the UI runtime.

Parameters
sPointer to the UiSurface to be destroyed.

This function destroys a UI surface by freeing its associated ncplanes and metadata. It also frees the memory allocated for the UiSurface structure. If the provided pointer is NULL, the function does nothing.

Definition at line 443 of file ui_ncurses.c.

443 {
444 endwin();
445 // ui_shutdown();
446}

References ui_shutdown().

Referenced by exec_objects(), fork_exec(), and form_exec_receiver().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ui_erase()

int ui_erase ( )

Erase the entire screen.

Clear the contents of the specified window within a UI surface.

Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface containing the window to clear.
wThe index of the window to clear.
Returns
0 on success, -1 on failure.

This function clears the contents of the specified window within a UI surface by erasing its contents. If the surface or window is not initialized, it returns -1.

Erase the entire screen.

Parameters
sPointer to the UiSurface containing the window to clear.
wThe index of the window to clear.
Returns
0 on success, -1 on failure.

This function clears the contents of the specified window within a UI surface by erasing its contents. If the surface or window is not initialized, it returns -1.

Definition at line 623 of file ui_ncurses.c.

623 {
624 erase();
625 return 0;
626}

References stdplane.

Referenced by view_full_screen_resize().

Here is the caller graph for this function:

◆ ui_get_caps()

void ui_get_caps ( UiCaps * caps)

Get the UI backend capabilities.

Get the capabilities of the current UI backend.

Parameters
capsPointer to a UiCaps struct to be filled with the backend capabilities.
capsPointer to a UiCaps structure to be filled with the capabilities.

This function populates the provided UiCaps structure with information about the capabilities of the current UI backend. It sets various fields in the structure, such as truecolor support, palette size, mouse support, Unicode support, and resize capability. If the provided pointer is NULL or if the UI runtime is not initialized, the function does nothing.

Get the UI backend capabilities.

Parameters
capsPointer to a UiCaps structure to be filled with the capabilities.

This function populates the provided UiCaps structure with information about the capabilities of the current UI backend. It sets various fields in the structure, such as truecolor support, palette size, mouse support, Unicode support, and resize capability. If the provided pointer is NULL or if the UI runtime is not initialized, the function does nothing.

Definition at line 62 of file ui_ncurses.c.

62 {
63 if (!caps)
64 return;
65 memset(caps, 0, sizeof(*caps));
66 if (!ui)
67 return;
68 // Will add code to actually check later. For now, just lie.
69 caps->truecolor = true;
70 caps->palette256 = true;
71 caps->mouse = ui->mouse_enabled;
72 caps->unicode = true;
73 caps->resize = true;
74 caps->color_pairs = UI_PAIRS;
75 caps->pad_relative_yx = false;
76}
#define UI_PAIRS
Definition ui_backend.h:62
bool palette256
Definition ui_backend.h:499
bool mouse
Definition ui_backend.h:500
bool pad_relative_yx
Definition ui_backend.h:504
int color_pairs
Definition ui_backend.h:503
bool truecolor
Definition ui_backend.h:498
bool unicode
Definition ui_backend.h:501
bool resize
Definition ui_backend.h:502

References UiCaps::color_pairs, UiCaps::mouse, UiCaps::pad_relative_yx, UiCaps::palette256, UiCaps::resize, UiCaps::truecolor, ui, and UiCaps::unicode.

Referenced by init_view_boxwin(), and init_view_full_screen().

Here is the caller graph for this function:

◆ ui_get_event_no_mouse()

int ui_get_event_no_mouse ( UiSurface * target,
ss_t w,
UiEvent * ev )

Wait for an input event on target (or stdscr if NULL) without mouse support.

Wait for an input event from the NotCurses context, ignoring mouse events.

Parameters
uiUI runtime context (unused — event comes from the window).
targetSurface to read from, or NULL for stdscr.
evOutput UiEvent structure.
Returns
0 on success, -1 if ev is NULL.
Parameters
targetUnused for NotCurses (events are global to the context).
evOutput UiEvent structure.
Returns
The NotCurses key code, or -1 if ui or ev is NULL.

Wait for an input event on target (or stdscr if NULL) without mouse support.

Parameters
targetUnused for NotCurses (events are global to the context).
evOutput UiEvent structure.
Returns
The NotCurses key code, or -1 if ui or ev is NULL.

Definition at line 234 of file ui_ncurses_input.c.

234 {
235 int ch;
236 mousemask(0, NULL);
237 curs_set(2);
239 cbreak();
240 do {
241 curs_set(2);
242 ch = wgetch(s->mwin[w]);
243 curs_set(0);
244 ev->key = translate_key(ch);
245 if (ev->key == UIKEY_CHAR) {
246 ev->ch = (uint32_t)ch;
247 break;
248 }
249 } while (ch == ERR);
250 curs_set(0);
251 return ch;
252}
#define ERR
Definition ui_backend.h:468
#define UIKEY_CHAR
void ui_flush_input()
Flush any pending input events from the NotCurses context. This function discards any input events th...
uint32_t ch
Definition ui_backend.h:130
UiKey key
Definition ui_backend.h:129

References UiEvent::alt, UiEvent::ch, UiEvent::ctrl, UiEvent::key, UiEvent::shift, ui, and ui_flush_input().

Here is the call graph for this function:

◆ ui_get_screen_size()

void ui_get_screen_size ( uint * lines,
uint * cols )

Get the current screen size (number of lines and columns).

Get the current screen size in lines and columns.

Parameters
linesPointer to a uint variable where the number of lines (rows) will be stored.
colsPointer to a uint variable where the number of columns will be stored.
linesPointer to an unsigned integer to store the number of lines (rows).
colsPointer to an unsigned integer to store the number of columns.

This function retrieves the current screen size in lines and columns.

Get the current screen size (number of lines and columns).

Parameters
linesPointer to an unsigned integer to store the number of lines (rows).
colsPointer to an unsigned integer to store the number of columns.

This function retrieves the current screen size in lines and columns.

Definition at line 754 of file ui_ncurses.c.

754 {
755 if (!ui)
756 return;
757 getmaxyx(stdscr, ui->lines, ui->cols);
758 if (lines)
759 *lines = ui->lines;
760 if (cols)
761 *cols = ui->cols;
762}

References ui, and ui_log_write().

Referenced by open_pick_win(), popup_ckeys(), ui_action_disposition(), ui_answer_yn(), ui_display_error(), ui_perror(), ui_surface_box(), ui_surface_new(), ui_timeout_prompt(), ui_tracked_sfc_box(), ui_tracked_sfc_split_box(), view_calc_boxwin_dimensions(), view_calc_full_screen_dimensions(), and view_cmd_processor().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ui_getch()

int ui_getch ( )

Wait for a single input character from the NotCurses context.

Returns
The NotCurses key code, or -1 if ui is NULL.

Definition at line 222 of file ui_notcurses_input.c.

222 {
223 if (!ui)
224 return -1;
225 ncinput ni;
226 do {
227 notcurses_get(ui->nc, NULL, &ni);
228 } while (ni.evtype == NCTYPE_RELEASE ||
229 ni.id == NCKEY_INVALID ||
230 ni.id == NCKEY_MOTION ||
231 ni.id == NCKEY_SIGNAL);
232 return ni.id;
233}

References ui.

◆ ui_getmaxx()

int ui_getmaxx ( UiSurface * s,
ss_t w )

Get the maximum number of columns of a UiSurface.

Get the maximum number of columns of a window within a UI surface.

Parameters
sPointer to the UiSurface for which to retrieve the maximum number of columns.
wThe index of the window within the surface for which to retrieve the maximum number of columns.
Returns
The maximum number of columns of the specified UiSurface, or -1 on failure.
Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
Returns
The maximum number of columns of the window, or -1 on failure.

This function retrieves the maximum number of columns of a window within a UI surface. If the surface or window is not initialized, it returns -1.

Get the maximum number of columns of a UiSurface.

Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
Returns
The maximum number of columns of the window, or -1 on failure.

This function retrieves the maximum number of columns of a window within a UI surface. If the surface or window is not initialized, it returns -1.

Definition at line 744 of file ui_ncurses.c.

744 {
745 if (!s->mwin[w])
746 return -1;
747 return (int)(getmaxx(s->mwin[w]));
748}

Referenced by ui_border_draw(), ui_border_title(), ui_border_ysplit(), and ui_border_ysplit_text().

Here is the caller graph for this function:

◆ ui_getmaxy()

int ui_getmaxy ( UiSurface * s,
ss_t w )

Get the maximum number of lines (rows) of a UiSurface.

Get the maximum number of lines (rows) of a window within a UI surface.

Parameters
sPointer to the UiSurface for which to retrieve the maximum number of lines.
wThe index of the window within the surface for which to retrieve the maximum number of lines.
Returns
The maximum number of lines (rows) of the specified UiSurface, or -1 on failure.
Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
Returns
The maximum number of lines (rows) of the window, or -1 on failure.

This function retrieves the maximum number of lines (rows) of a window within a UI surface. If the surface or window is not initialized, it returns -1.

Get the maximum number of lines (rows) of a UiSurface.

Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
Returns
The maximum number of lines (rows) of the window, or -1 on failure.

This function retrieves the maximum number of lines (rows) of a window within a UI surface. If the surface or window is not initialized, it returns -1.

Definition at line 733 of file ui_ncurses.c.

733 {
734 if (!s->mwin[w])
735 return -1;
736 return (int)(getmaxy(s->mwin[w]));
737}

Referenced by field_editor(), ui_assign_chyron_win(), and ui_border_draw().

Here is the caller graph for this function:

◆ ui_getmaxyx()

void ui_getmaxyx ( UiSurface * s,
ss_t w,
uint * y,
uint * x )

Get the maximum dimensions of a UiSurface.

Get the maximum dimensions of a window within a UI surface.

Parameters
sPointer to the UiSurface for which to retrieve the maximum dimensions.
wThe index of the window within the surface for which to retrieve the maximum dimensions.
linesPointer to a uint variable where the maximum number of lines (rows) will be stored.
colsPointer to a uint variable where the maximum number of columns will be stored.
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
yPointer to an unsigned integer to store the maximum number of lines (rows).
xPointer to an unsigned integer to store the maximum number of columns.

This function retrieves the maximum dimensions of a window within a UI surface. If the surface or window is not initialized, it does nothing.

Get the maximum dimensions of a UiSurface.

Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
yPointer to an unsigned integer to store the maximum number of lines (rows).
xPointer to an unsigned integer to store the maximum number of columns.

This function retrieves the maximum dimensions of a window within a UI surface. If the surface or window is not initialized, it does nothing.

Definition at line 722 of file ui_ncurses.c.

722 {
723 if (!s->mwin[w])
724 return;
725 getmaxyx(s->mwin[w], *lines, *cols);
726}

Referenced by form_post(), form_process(), and picker().

Here is the caller graph for this function:

◆ ui_getyx()

void ui_getyx ( UiSurface * s,
ss_t w,
uint * y,
uint * x )

Get the current cursor position within a window of a UI surface.

Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
yPointer to an unsigned integer to store the y-coordinate of the cursor.
xPointer to an unsigned integer to store the x-coordinate of the cursor.

This function retrieves the current cursor position within a window of a UI surface. If the surface or window is not initialized, it does nothing.

Definition at line 707 of file ui_ncurses.c.

707 {
708 if (!s->mwin[w])
709 return;
710 int _lines, _cols;
711 getyx(s->mwin[w], _lines, _cols);
712 *lines = (uint)(_lines);
713 *cols = (uint)(_cols);
714}

Referenced by display_prompt(), and get_cmd_char().

Here is the caller graph for this function:

◆ ui_idcok()

int ui_idcok ( UiSurface * s,
ss_t w,
bool enable )

Enable or disable the use of the insert/delete character capabilities for a UiSurface.

Enable or disable the keypad for the specified window within a UI surface.

Parameters
sPointer to the UiSurface for which to enable or disable the insert/delete character capabilities.
wThe index of the window within the surface for which to enable or disable the insert/delete character capabilities.
enableA boolean value indicating whether to enable (true) or disable (false) the insert/delete character capabilities.
Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
enableTrue to enable the keypad, false to disable the keypad.
Returns
0 on success, -1 on failure.

This function does nothing.

Enable or disable the use of the insert/delete character capabilities for a UiSurface.

Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
enableTrue to enable the keypad, false to disable the keypad.
Returns
0 on success, -1 on failure.

This function does nothing.

Definition at line 844 of file ui_ncurses.c.

844 {
845 if (!s->mwin[w])
846 return -1;
847 if (enable)
848 idcok(s->mwin[w], true);
849 else
850 idcok(s->mwin[w], false);
851 return 0;
852}

Referenced by init_view_boxwin(), and init_view_full_screen().

Here is the caller graph for this function:

◆ ui_idlok()

int ui_idlok ( UiSurface * s,
ss_t w,
bool enable )

Enable or disable the use of the insert/delete line capabilities for a UiSurface.

Enable or disable the use of the keypad for the specified window within a UI surface.

Parameters
sPointer to the UiSurface for which to enable or disable the insert/delete line capabilities.
wThe index of the window within the surface for which to enable or disable the insert/delete line capabilities.
enableA boolean value indicating whether to enable (true) or disable (false) the insert/delete line capabilities.
Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
enableTrue to enable the use of the keypad, false to disable it.
Returns
0 on success, -1 on failure.

This function does nothing.

Enable or disable the use of the insert/delete line capabilities for a UiSurface.

Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
enableTrue to enable the use of the keypad, false to disable it.
Returns
0 on success, -1 on failure.

This function does nothing.

Definition at line 828 of file ui_ncurses.c.

828 {
829 if (!s->mwin[w])
830 return -1;
831 if (enable)
832 idlok(s->mwin[w], true);
833 else
834 idlok(s->mwin[w], false);
835 return 0;
836}

Referenced by init_view_boxwin(), and init_view_full_screen().

Here is the caller graph for this function:

◆ ui_immedok()

int ui_immedok ( UiSurface * s,
ss_t w,
bool enable )

Definition at line 780 of file ui_ncurses.c.

780 {
781 if (!s->mwin[w])
782 return -1;
783 if (enable)
784 immedok(s->mwin[w], true);
785 else
786 immedok(s->mwin[w], false);
787 return 0;
788}

◆ ui_init()

UiRuntime * ui_init ( const UiConfig * cfg,
SIO * sio )

Initialize the UI runtime with the given configuration and SIO.

Initialize the UI runtime with the specified configuration and SIO.

Parameters
cfgPointer to a UiConfig structure containing the configuration settings.
sioPointer to an SIO structure for input/output operations.
Returns
A pointer to the initialized UiRuntime structure, or NULL on failure.
Parameters
cfgPointer to a UiConfig structure containing configuration options.
sioPointer to a SIO structure for input/output operations.
Returns
Pointer to the initialized UiRuntime structure, or NULL on failure.

This function initializes the UI runtime using the NotCurses library. It sets up the terminal, creates the standard plane, and initializes various UI components based on the provided configuration. If any step fails, it cleans up and returns NULL.

Initialize the UI runtime with the given configuration and SIO.

Parameters
cfgPointer to a UiConfig structure containing configuration options.
sioPointer to a SIO structure for input/output operations.
Returns
Pointer to the initialized UiRuntime structure, or NULL on failure.

This function initializes the UI runtime using the NotCurses library. It sets up the terminal, creates the standard plane, and initializes various UI components based on the provided configuration. If any step fails, it cleans up and returns NULL.

Definition at line 130 of file ui_ncurses.c.

130 {
131 setlocale(LC_ALL, "en_US.UTF-8");
132 ui = calloc(1, sizeof(*ui));
133 if (!ui)
134 return NULL;
135 char tty_name[MAXLEN];
136 if (ttyname_r(STDERR_FILENO, tty_name, sizeof(tty_name)) != 0) {
137 free(ui);
138 return NULL;
139 }
140 ui->tty_fp = fopen(tty_name, "r+");
141 if (!ui->tty_fp) {
142 free(ui);
143 return NULL;
144 }
145 ui->tty_fd = fileno(ui->tty_fp);
146 ui_log_ctx.min_level = cfg->log_level;
147
148 ui_log(INFO, _("ui_init: using tty: %s"), tty_name);
149 ui->screen = newterm(NULL, ui->tty_fp, ui->tty_fp);
150 f_ncurses_open = true;
151 if (!ui->screen) {
152 fclose(ui->tty_fp);
153 free(ui);
154 return NULL;
155 }
156 set_term(ui->screen);
157 if (!has_colors() || !can_change_color()) {
158 ui_shutdown();
159 return NULL;
160 }
161 start_color();
162 use_default_colors();
163 cbreak();
164 noecho();
165 keypad(stdscr, TRUE);
166 if (ui->mouse_enabled)
167 mousemask(ALL_MOUSE_EVENTS | REPORT_MOUSE_POSITION, NULL);
168 getmaxyx(stdscr, ui->lines, ui->cols);
169
170 stdsfc = calloc(1, sizeof(*stdsfc));
171 if (!stdsfc)
172 return NULL;
173 stdsfc->runtime = ui;
174 stdsfc->parent = NULL;
175 stdsfc->meta[BOX].lines = (int)ui->lines;
176 stdsfc->meta[BOX].cols = (int)ui->cols;
177 stdsfc->meta[BOX].y = 0;
178 stdsfc->meta[BOX].x = 0;
179 stdsfc->mwin[BOX] = stdscr;
180 stdsfc->mpan[BOX] = new_panel(stdsfc->mwin[BOX]);
181 if (!stdsfc->mpan[BOX]) {
182 free(stdsfc);
183 ui_log(ERROR, _("new_panel failed for stdsfc->mpan[BOX]"));
184 exit(EXIT_FAILURE);
185 }
186 if (cfg->border_style)
187 ui->border_style = cfg->border_style;
188 if (!ui->border_style)
189 ui->border_style = UI_BORDER_ROUNDED;
190 if (cfg) {
191 switch (ui->border_style) {
192 case UI_BORDER_SINGLE:
193 memcpy(bw.str, border_single, sizeof(bw.str));
194 break;
195 case UI_BORDER_DOUBLE:
196 memcpy(bw.str, border_double, sizeof(bw.str));
197 break;
198 case UI_BORDER_ROUNDED:
199 memcpy(bw.str, border_rounded, sizeof(bw.str));
200 break;
201 case UI_BORDER_HEAVY:
202 memcpy(bw.str, border_heavy, sizeof(bw.str));
203 break;
204 case UI_BORDER_NONE:
205 memcpy(bw.str, border_none, sizeof(bw.str));
206 break;
207 default:
208 memcpy(bw.str, border_rounded, sizeof(bw.str));
209 break;
210 }
211 }
213 ui_log(INFO, _("ui_init: stdsfc->mwin[BOX]: %p, stdsfc->mpan[BOX]: %p"), (void *)stdsfc->mwin[BOX], (void *)stdsfc->mpan[BOX]);
214 return ui;
215}
UiSurface * stdsfc
Definition ui_ncurses.c:46
const wchar_t * border_none
Definition ui_common.c:89
bool f_ncurses_open
Definition ui_common.c:50
UiLogContext ui_log_ctx
Definition ui_common.c:53
BorderWide bw
Definition ui_common.c:27
const wchar_t * border_double
Definition ui_common.c:86
const wchar_t * border_single
Definition ui_common.c:85
void ui_initialize_sio(SIO *sio)
Definition ui_common.c:211
const wchar_t * border_heavy
Definition ui_common.c:88
const wchar_t * border_rounded
Definition ui_common.c:87
void ui_shutdown()
Shutdown the UI runtime, cleaning up resources and freeing memory.
Definition ui_ncurses.c:449
#define TRUE
Definition iloan.c:31
#define _(String)
Definition amort.c:23
UiBorderStyle border_style
Definition ui_backend.h:486
UiLogLevel log_level
Definition ui_backend.h:488

References border_double, border_heavy, border_none, border_rounded, border_single, UiConfig::border_style, bw, f_ncurses_open, f_notcurses_open, UiConfig::log_level, UiLogContext::min_level, sfc_ptr, stdplane, stdsfc, border_wide::str, SUB_SFC_MAX, ui, ui_color, ui_color_cnt, ui_initialize_sio(), ui_log_ctx, ui_log_write(), ui_pair, ui_pair_cnt, and ui_shutdown().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ui_initialize_sio()

void ui_initialize_sio ( SIO * sio)

gamma correction values

These are read from ~/.minitrc

used when initializing colors

Definition at line 211 of file ui_common.c.

211 {
215 ui->sio = sio;
216 RED_GAMMA = sio->red_gamma;
218 BLUE_GAMMA = sio->blue_gamma;
219 GRAY_GAMMA = sio->gray_gamma;
221 //
222 // Initialize Standardized color pairs
223 //
236
245 //
246 // Initialize Standardized UiCells
247 //
250 mbstate_t mbstate;
251 memset(&mbstate, 0, sizeof(mbstate));
252 wchar_t brktl = sio->brackets[0];
253 cell_brktl = ui_cell_from_ucp(&brktl, &sio->brackets_fg, &sio->brackets_bg);
254 wchar_t brktr = sio->brackets[1];
255 cell_brktr = ui_cell_from_ucp(&brktr, &sio->brackets_fg, &sio->brackets_bg);
256 cell_nt = ui_cell_from_ucp(bw_sp, &sio->nt_fg, &sio->nt_bg);
263 cell_sp = ui_cell_from_ucp(bw_sp, &sio->nt_fg, &sio->nt_bg);
264 cell_ln = ui_cell_from_ucp(bw_sp, &sio->ln_fg, &sio->ln_bg);
268 cell_tl = ui_cell_from_ucp(&bw_tl, &sio->box_fg, &sio->box_bg);
269 cell_tr = ui_cell_from_ucp(&bw_tr, &sio->box_fg, &sio->box_bg);
270 cell_bl = ui_cell_from_ucp(&bw_bl, &sio->box_fg, &sio->box_bg);
271 cell_br = ui_cell_from_ucp(&bw_br, &sio->box_fg, &sio->box_bg);
272 cell_ho = ui_cell_from_ucp(&bw_ho, &sio->box_fg, &sio->box_bg);
273 cell_ve = ui_cell_from_ucp(&bw_ve, &sio->box_fg, &sio->box_bg);
274 cell_lt = ui_cell_from_ucp(&bw_lt, &sio->box_fg, &sio->box_bg);
275 cell_rt = ui_cell_from_ucp(&bw_rt, &sio->box_fg, &sio->box_bg);
276 cell_tt = ui_cell_from_ucp(&bw_tt, &sio->box_fg, &sio->box_bg);
277 cell_bt = ui_cell_from_ucp(&bw_bt, &sio->box_fg, &sio->box_bg);
278 cell_cr = ui_cell_from_ucp(&bw_cr, &sio->box_fg, &sio->box_bg);
280 cell_red_bg = ui_cell_from_ucp(bw_sp, &sio->white, &sio->red);
287}
#define bw_ho
Definition ui_backend.h:627
#define bw_tr
Definition ui_backend.h:635
#define bw_lt
Definition ui_backend.h:629
#define bw_br
Definition ui_backend.h:637
#define bw_bl
Definition ui_backend.h:636
#define bw_tt
Definition ui_backend.h:631
#define bw_cr
Definition ui_backend.h:633
#define bw_bt
Definition ui_backend.h:632
#define bw_ve
Definition ui_backend.h:628
#define bw_rt
Definition ui_backend.h:630
#define bw_tl
Definition ui_backend.h:634
const wchar_t * bw_sp
Definition ui_common.c:96
UiCell cell_blue_bg
Definition ui_common.c:154
ushort cp_nt
Definition ui_common.c:167
UiCell cell_nt
Definition ui_common.c:123
ushort cp_magenta
Definition ui_common.c:181
const wchar_t * bw_ran
Definition ui_common.c:101
UiCell cell_nt_hl_rev
Definition ui_common.c:126
UiCell cell_cyan_bg
Definition ui_common.c:155
UiCell cell_bt
Definition ui_common.c:147
ushort cp_green
Definition ui_common.c:177
UiCell cell_magenta_bg
Definition ui_common.c:156
ushort cp_red
Definition ui_common.c:176
ushort cp_white
Definition ui_common.c:182
ushort cp_box
Definition ui_common.c:163
ushort cp_blue
Definition ui_common.c:179
UiCell cell_ln
Definition ui_common.c:131
const wchar_t * bw_chk
Definition ui_common.c:103
ushort cp_black
Definition ui_common.c:175
double BLUE_GAMMA
Definition ui_common.c:82
ushort cp_cyan
Definition ui_common.c:180
ushort cp_nt_hl
Definition ui_common.c:169
UiCell cell_yellow_bg
Definition ui_common.c:153
ushort cp_cmdln
Definition ui_common.c:165
ushort cp_fill_char
Definition ui_common.c:173
UiCell cell_tt
Definition ui_common.c:146
ushort cp_brackets
Definition ui_common.c:174
ushort cp_yellow
Definition ui_common.c:178
UiCell cell_red_bg
Definition ui_common.c:151
bool ui_init_clr_palette(SIO *sio)
Definition ui_common.c:289
UiCell cell_default
Definition ui_common.c:119
ushort cp_nt_hl_rev
Definition ui_common.c:170
ushort cp_default
Definition ui_common.c:172
ushort cp_nt_rev
Definition ui_common.c:168
ushort cp_ln
Definition ui_common.c:171
ushort cp_title
Definition ui_common.c:166
UiCell cell_brktl
Definition ui_common.c:121
UiCell cell_cr
Definition ui_common.c:148
UiCell cell_ind
Definition ui_common.c:128
double GRAY_GAMMA
Definition ui_common.c:79
UiCell cell_ran
Definition ui_common.c:132
double RED_GAMMA
Definition ui_common.c:80
UiCell cell_black_bg
Definition ui_common.c:150
UiCell cell_white_bg
Definition ui_common.c:157
UiCell cell_cmdln
Definition ui_common.c:129
UiCell cell_brktr
Definition ui_common.c:122
ushort cp_ind
Definition ui_common.c:164
UiCell cell_green_bg
Definition ui_common.c:152
double GREEN_GAMMA
Definition ui_common.c:81
UiCell cell_fill_char
Definition ui_common.c:120
UiCell cell_chk
Definition ui_common.c:133
UiCell cell_nt_rev
Definition ui_common.c:124
uint ui_add_pair(uint fg, uint bg)
Add a new color pair to the UI, or retrieve the index of an existing pair.
UiCell ui_cell_from_ucp(const wchar_t *ucp, const uint32_t *fg, const uint32_t *bg)
Convert a Unicode code point to a curses UiCell with specified foreground and background colors.
Definition ui_ncurses.c:102
uint32_t ran_bg
Definition ui_backend.h:794
double green_gamma
Definition ui_backend.h:747
uint32_t ln_bg
Definition ui_backend.h:780
double blue_gamma
Definition ui_backend.h:748
char brackets[3]
Definition ui_backend.h:807
uint32_t magenta
Definition ui_backend.h:755
uint32_t cmdln_bg
Definition ui_backend.h:782
uint32_t cmdln_fg
Definition ui_backend.h:781
uint32_t nt_hl_rev_fg
Definition ui_backend.h:789
uint32_t ran_fg
Definition ui_backend.h:793
double red_gamma
Definition ui_backend.h:746
uint32_t green
Definition ui_backend.h:752
uint32_t nt_fg
Definition ui_backend.h:783
uint32_t yellow
Definition ui_backend.h:753
uint32_t fill_char_fg
Definition ui_backend.h:777
uint32_t box_fg
Definition ui_backend.h:771
uint32_t ln_fg
Definition ui_backend.h:779
uint32_t ind_bg
Definition ui_backend.h:774
uint32_t ind_fg
Definition ui_backend.h:773
uint32_t title_bg
Definition ui_backend.h:792
uint32_t cyan
Definition ui_backend.h:756
uint32_t red
Definition ui_backend.h:751
uint32_t nt_hl_rev_bg
Definition ui_backend.h:790
uint32_t title_fg
Definition ui_backend.h:791
uint32_t fill_char_bg
Definition ui_backend.h:778
uint32_t black
Definition ui_backend.h:750
uint32_t nt_rev_bg
Definition ui_backend.h:786
uint32_t brackets_bg
Definition ui_backend.h:776
uint32_t nt_bg
Definition ui_backend.h:784
uint32_t blue
Definition ui_backend.h:754
uint32_t brackets_fg
Definition ui_backend.h:775
uint32_t white
Definition ui_backend.h:757
uint32_t box_bg
Definition ui_backend.h:772
uint32_t nt_hl_fg
Definition ui_backend.h:787
uint32_t nt_rev_fg
Definition ui_backend.h:785
double gray_gamma
Definition ui_backend.h:749
uint32_t nt_hl_bg
Definition ui_backend.h:788

References SIO::black, SIO::blue, 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_black_bg, cell_blue_bg, cell_box, cell_br, cell_brktl, cell_brktr, cell_bt, cell_chk, cell_cmdln, cell_cr, cell_cyan_bg, cell_default, cell_fill_char, cell_green_bg, cell_ho, cell_ind, cell_ln, cell_lt, cell_magenta_bg, cell_nt, cell_nt_hl, cell_nt_hl_rev, cell_nt_rev, cell_ran, cell_red_bg, cell_rt, cell_sp, cell_title, cell_tl, cell_tr, cell_tt, cell_ve, cell_white_bg, cell_yellow_bg, CLR_BG, CLR_BLACK, CLR_BLUE, CLR_BOX_BG, CLR_BOX_FG, CLR_BRACKETS_BG, CLR_BRACKETS_FG, CLR_CMDLN_BG, CLR_CMDLN_FG, 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_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_WHITE, CLR_YELLOW, SIO::cmdln_bg, SIO::cmdln_fg, cp_black, cp_blue, cp_box, cp_brackets, cp_cmdln, cp_cyan, cp_default, cp_fill_char, cp_green, cp_ind, cp_ln, cp_magenta, cp_nt, cp_nt_hl, cp_nt_hl_rev, cp_nt_rev, cp_red, cp_title, cp_white, cp_yellow, SIO::cyan, SIO::fill_char_bg, SIO::fill_char_fg, GRAY_GAMMA, SIO::gray_gamma, SIO::green, GREEN_GAMMA, SIO::green_gamma, 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::ran_bg, SIO::ran_fg, SIO::red, RED_GAMMA, SIO::red_gamma, SIO::title_bg, SIO::title_fg, ui, ui_add_pair(), ui_cell_from_ucp(), ui_init_clr_palette(), SIO::white, and SIO::yellow.

Referenced by read_theme(), ui_init(), and ui_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ui_keypad()

int ui_keypad ( UiSurface * s,
ss_t w,
bool enable )

Enable or disable the keypad for a UiSurface.

Enable or disable the keypad for the specified window within a UI surface.

Parameters
sPointer to the UiSurface for which to enable or disable the keypad.
wThe index of the window within the surface for which to enable or disable the keypad.
enableA boolean value indicating whether to enable (true) or disable (false) the keypad.
Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
enableTrue to enable the keypad, false to disable it.
Returns
0 on success, -1 on failure.

This function does nothing.

Enable or disable the keypad for a UiSurface.

Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
enableTrue to enable the keypad, false to disable it.
Returns
0 on success, -1 on failure.

This function does nothing.

Definition at line 812 of file ui_ncurses.c.

812 {
813 if (!s->mwin[w])
814 return -1;
815 if (enable)
816 keypad(s->mwin[w], true);
817 else
818 keypad(s->mwin[w], false);
819 return 0;
820}

Referenced by fork_exec(), init_view_boxwin(), init_view_full_screen(), menu_cmd_processor(), open_pick_win(), picker(), and popup_ckeys().

Here is the caller graph for this function:

◆ ui_mice_enable()

int ui_mice_enable ( int mask)

Enable or disable mouse support.

Enable or disable mouse events for the NotCurses context.

Parameters
maskMouse event mask (0 to disable, non-zero to enable).
Returns
0 on success, -1 if UI is not initialized.
Parameters
maskThe mouse event mask to enable. If 0, all mouse events are enabled.
Returns
0 on success, or -1 if ui is NULL.

Enable or disable mouse support.

Parameters
maskThe mouse event mask to enable. If 0, all mouse events are enabled.
Returns
0 on success, or -1 if ui is NULL.

Definition at line 274 of file ui_ncurses_input.c.

274 {
275 if (!ui)
276 return -1;
277 if (mask)
278 mousemask(mask, nullptr);
279 else
280 mousemask(ALL_MOUSE_EVENTS | REPORT_MOUSE_POSITION, nullptr);
281 return 0;
282}

References ui.

◆ ui_mousemask()

int ui_mousemask ( int mask)

Enable or disable mouse support.

Set the mouse event mask for the NotCurses context.

Parameters
maskMouse event mask (0 to disable, non-zero to enable).
Returns
0 on success, -1 if UI is not initialized.
Parameters
maskThe mouse event mask to set. If 0, all mouse events are enabled.
Returns
0 on success, or -1 if ui is NULL.

Enable or disable mouse support.

Parameters
maskThe mouse event mask to set. If 0, all mouse events are enabled.
Returns
0 on success, or -1 if ui is NULL.

Definition at line 261 of file ui_ncurses_input.c.

261 {
262 if (!ui)
263 return -1;
264 if (mask)
265 mousemask(mask, nullptr);
266 else
267 mousemask(ALL_MOUSE_EVENTS | REPORT_MOUSE_POSITION, nullptr);
268 return 0;
269}

References ui.

Referenced by menu_cmd_processor(), and picker().

Here is the caller graph for this function:

◆ ui_plane_cpy()

int ui_plane_cpy ( NcPlane * dst,
NcPlane * src,
int dst_y,
int dst_x,
int src_y,
int src_x,
int ylen,
int xlen )

Definition at line 953 of file ui_notcurses.c.

953 {
954 if (!dst || !src)
955 return -1;
956 for (int y = 0; y < ylen; y++) {
957 for (int x = 0; x < xlen; x++) {
958 nccell c = NCCELL_TRIVIAL_INITIALIZER;
959 ncplane_at_yx_cell(src, src_y + y, src_x + x, &c);
960 ncplane_putc_yx(dst, dst_y + y, dst_x + x, &c);
961 nccell_release(src, &c);
962 }
963 }
964 return 0;
965}

Referenced by ui_prefresh().

Here is the caller graph for this function:

◆ ui_prefresh()

int ui_prefresh ( UiSurface * s,
ss_t w,
int pminrow,
int pmincol,
int sminrow,
int smincol,
int smaxrow,
int smaxcol )

Definition at line 923 of file ui_ncurses.c.

923 {
924 if (!s)
925 return -1;
926 return prefresh(s->mwin[w], pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol);
927}

References ui, ui_log_write(), and ui_plane_cpy().

Referenced by pad_refresh().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ui_render()

void ui_render ( )

Render the UI by updating panels and refreshing the display.

Render the UI.

This function renders the UI.

Render the UI by updating panels and refreshing the display.

This function renders the UI.

Definition at line 931 of file ui_ncurses.c.

931 {
932 update_panels();
933 doupdate();
934}

References ui.

Referenced by cf_accept(), display_form(), display_pick_page(), field_editor(), form_display_accept_field(), form_display_field(), form_display_fields(), get_cmd_arg(), get_cmd_char(), init_pick(), init_view_boxwin(), main(), menu_cmd_processor(), menu_engine(), ncurses_input(), picker(), read_theme(), ui_draw_text_fill(), ui_get_event(), ui_restore_wins(), ui_surface_box(), ui_surface_destroy(), ui_timeout_prompt(), ui_tracked_sfc_box(), ui_update_timeout_prompt(), view_boxwin_resize(), and view_full_screen_resize().

Here is the caller graph for this function:

◆ ui_restore_wins()

void ui_restore_wins ( )

Restore the state of all windows in the UI. This function refreshes the standard screen and all surface windows, ensuring that their contents are displayed correctly.

Definition at line 371 of file ui_ncurses_draw.c.

371 {
372 touchwin(stdscr);
373 for (int s = 0; s <= sfc_ptr; s++) {
374 for (ss_t w = BOX; w < SUB_SFC_MAX; w++)
375 if (ui_surface[s]->mwin[w] != nullptr)
376 touchwin(ui_surface[s]->mwin[w]);
377 }
378 ui_render();
379}
UiSurface * ui_surface[UI_SFC_MAX]
Definition ui_ncurses.c:40

References sfc_ptr, SUB_SFC_MAX, ui_render(), and ui_surface.

Referenced by enter_file_spec(), exec_objects(), fork_exec(), form_exec_receiver(), full_screen_shell(), menu_cmd_processor(), menu_engine(), view_cmd_processor(), view_init_input(), and write_view_buffer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ui_resume()

int ui_resume ( )

Resume the UI, restoring the previous program state and updating the display.

Resume the UI and enter the alternate screen.

Returns
0 on success, or -1 on failure.

This function resumes the UI and enters the alternate screen. It is typically used after a suspension of the UI, allowing the application to return to its previous state and continue rendering the UI.

Returns
0 on success, -1 on failure.

Resume the UI, restoring the previous program state and updating the display.

This function resumes the UI and enters the alternate screen. It is typically used after a suspension of the UI, allowing the application to return to its previous state and continue rendering the UI.

Returns
0 on success, -1 on failure.

Definition at line 534 of file ui_ncurses.c.

534 {
535 reset_prog_mode();
536 update_panels();
537 doupdate();
538 return 0;
539}

References ui.

Referenced by fork_exec().

Here is the caller graph for this function:

◆ ui_scrollok()

int ui_scrollok ( UiSurface * s,
ss_t w,
bool enable )

Enable or disable scrolling for a UiSurface.

Enable or disable scrolling for the specified window within a UI surface.

Parameters
sPointer to the UiSurface for which to enable or disable scrolling.
wThe index of the window within the surface for which to enable or disable scrolling.
enableA boolean value indicating whether to enable (true) or disable (false) scrolling.
Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
enableTrue to enable scrolling, false to disable scrolling.
Returns
0 on success, -1 on failure.

This function enables or disables scrolling for the specified window within a UI surface. If the surface or window is not initialized, it returns -1.

Enable or disable scrolling for a UiSurface.

Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
enableTrue to enable scrolling, false to disable scrolling.
Returns
0 on success, -1 on failure.

This function enables or disables scrolling for the specified window within a UI surface. If the surface or window is not initialized, it returns -1.

Definition at line 796 of file ui_ncurses.c.

796 {
797 if (!s->mwin[w])
798 return -1;
799 if (enable)
800 scrollok(s->mwin[w], true);
801 else
802 scrollok(s->mwin[w], false);
803 return 0;
804}

Referenced by init_view_boxwin(), init_view_full_screen(), menu_cmd_processor(), open_pick_win(), ui_surface_addpad(), and ui_surface_box().

Here is the caller graph for this function:

◆ ui_setscrreg()

int ui_setscrreg ( UiSurface * s,
ss_t w,
uint top,
uint bottom )

Set the scrolling region for a UiSurface.

Set the scrolling region for the specified window within a UI surface.

Parameters
sPointer to the UiSurface for which to set the scrolling region.
wThe index of the window within the surface for which to set the scrolling region.
topThe top line of the scrolling region (0-based).
bottomThe bottom line of the scrolling region (0-based).
Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
topThe top line of the scrolling region.
bottomThe bottom line of the scrolling region.
Returns
0 on success, -1 on failure.

This function does nothing.

Set the scrolling region for a UiSurface.

Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
topThe top line of the scrolling region.
bottomThe bottom line of the scrolling region.
Returns
0 on success, -1 on failure.

This function does nothing.

Definition at line 861 of file ui_ncurses.c.

861 {
862 if (!s->mwin[w])
863 return -1;
864 wsetscrreg(s->mwin[w], top, bottom);
865 return 0;
866}

Referenced by init_view_boxwin(), init_view_full_screen(), and open_pick_win().

Here is the caller graph for this function:

◆ ui_shutdown()

void ui_shutdown ( )

Shutdown the UI runtime, cleaning up resources and freeing memory.

Shutdown the UI runtime and free all associated resources.

This function shuts down the UI runtime by destroying all surfaces, freeing memory, and stopping the NotCurses library. It also closes the terminal file pointer if it was opened. If the UI runtime is not initialized, the function does nothing.

Shutdown the UI runtime, cleaning up resources and freeing memory.

This function shuts down the UI runtime by destroying all surfaces, freeing memory, and stopping the NotCurses library. It also closes the terminal file pointer if it was opened. If the UI runtime is not initialized, the function does nothing.

Definition at line 449 of file ui_ncurses.c.

449 {
450 if (ui == NULL)
451 return;
452 ui_log(INFO, _("ui_shutdown in progress..."));
453 while (sfc_ptr >= 0) {
454 if (ui_surface[sfc_ptr] != NULL) {
456 ui_surface[sfc_ptr] = NULL;
457 }
458 ui_log(INFO, _("surface destroy: %d"), sfc_ptr);
459 sfc_ptr--;
460 }
461 if (stdsfc->mpan[0] != NULL) {
462 ui_log(INFO, _("calling del_panel(stdsfc->mpan[BOX])"));
463 hide_panel(stdsfc->mpan[0]);
464 del_panel(stdsfc->mpan[0]);
465 stdsfc->mpan[0] = NULL;
466 }
467 ui_log(INFO, _("calling endwin()"));
468 endwin();
469 f_ncurses_open = false;
470 if (ui->screen != NULL) {
471 ui_log(INFO, _("calling delscreen(ui->screen)"));
472 delscreen(ui->screen);
473 ui->screen = NULL;
474 }
475 if (ui->tty_fp != NULL) {
476 ui_log(INFO, _("closing tty_fp"));
477 fclose(ui->tty_fp);
478 ui->tty_fp = NULL;
479 }
480 if (stdsfc != NULL) {
481 ui_log(INFO, _("freeing stdsfc"));
482 free(stdsfc);
483 stdsfc = NULL;
484 }
485 if (ui != NULL) {
486 if (ui->sio) {
487 free(ui->sio);
488 ui->sio = nullptr;
489 }
490 ui_log(INFO, _("freeing ui"));
491 free(ui);
492 ui = NULL;
493 }
494}
void ui_surface_destroy(UiSurface *s)
Destroy a UiSurface, cleaning up its windows and panels.
Definition ui_ncurses.c:499

References f_ncurses_open, f_notcurses_open, sfc_ptr, stdsfc, ui, ui_color, ui_pair, ui_surface, and ui_surface_destroy().

Referenced by cmenu_shutdown(), main(), ui_abend(), ui_destroy_curses(), ui_endwin(), and ui_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ui_sub_surface_str()

const char * ui_sub_surface_str ( ss_t w)

Definition at line 1436 of file ui_common.c.

1436 {
1437 if (w < BOX || w >= SUB_SFC_MAX)
1438 return _("unknown");
1439 return subsfc_s[w];
1440}
const char * subsfc_s[]
Definition ui_common.c:1434

References SUB_SFC_MAX, and subsfc_s.

◆ ui_surface_addpad()

int ui_surface_addpad ( UiSurface * s,
ss_t pad,
ss_t win,
uint lines,
uint cols,
uint y,
uint x,
bool hidden )

Add a new pad to the specified UiSurface.

Add padding to an existing UI surface.

Parameters
sPointer to the UiSurface to which the pad will be added.
wThe index of the window within the surface where the pad will be created.
view_winThe index of the window that will be used to view the pad.
linesThe number of lines (rows) for the new pad.
colsThe number of columns for the new pad.
begyThe y-coordinate (row) for the new pad's position (ignored in this implementation).
begxThe x-coordinate (column) for the new pad's position (ignored in this implementation).
Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface to which padding will be added.
wThe index of the new padded surface.
pThe index of the parent plane to attach to.
linesThe number of lines (rows) for the padded surface.
colsThe number of columns for the padded surface.
yThe y-coordinate for the padded surface's position.
xThe x-coordinate for the padded surface's position.
Returns
0 on success, -1 on failure.

This function adds padding to an existing UI surface by creating a new ncplane with the specified dimensions and position. It updates the metadata for the new padded surface and sets its background and scrolling properties. If any step fails, it cleans up and returns -1.

Add a new pad to the specified UiSurface.

Parameters
sPointer to the UiSurface to which padding will be added.
wThe index of the new padded surface.
pThe index of the parent plane to attach to.
linesThe number of lines (rows) for the padded surface.
colsThe number of columns for the padded surface.
yThe y-coordinate for the padded surface's position.
xThe x-coordinate for the padded surface's position.
Returns
0 on success, -1 on failure.

This function adds padding to an existing UI surface by creating a new ncplane with the specified dimensions and position. It updates the metadata for the new padded surface and sets its background and scrolling properties. If any step fails, it cleans up and returns -1.

Definition at line 381 of file ui_ncurses.c.

381 {
382 (void)p;
383 (void)hidden;
384 (void)begy;
385 (void)begx;
386 UiLogLevel level = INFO;
387 s->mwin[pad] = newpad(lines, cols);
388 if (s->mwin[pad] == nullptr) {
389 level = ERROR;
390 ui_log(level, "%s = newpad(lines=%d, cols=%d, hidden=%s) failed", ss_n[pad], lines, cols, hidden ? "true" : "false");
391 return -1;
392 }
393 ui_log(level, "%s = newpad(lines=%d, cols=%d) success", ss_n[pad], lines, cols);
394#ifdef ASDFJKL
395 s->mwin[v] = subpad(s->mwin[PAD], lines, cols, 0, 0);
396 if (s->mwin[v] == nullptr) {
397 level = ERROR;
398 ui_log(level, "subpad(%s, %s, lines=%d, cols=%d, begy=%d, begx=%d) failed", ss_n[w], ss_n[v], lines, cols, 0, 0);
399 return -1;
400 }
401 ui_log(level, "subpad(%s, %s, lines=%d, cols=%d) success", ss_n[w],
402 ss_n[v], lines, cols);
403 s->mpan[w] = new_panel(s->mwin[v]);
404 top_panel(s->mpan[w]);
405#endif
406 immedok(s->mwin[pad], true);
407 scrollok(s->mwin[pad], true);
408#ifdef DEBUG_IMMED_UI
409#endif
410 return 0;
411}

References stdplane, ui_log_write(), ui_plane_get_abs_yx(), ui_scrollok(), and ui_surface_addwin().

Referenced by init_view_boxwin(), and init_view_full_screen().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ui_surface_addwin()

int ui_surface_addwin ( UiSurface * s,
ss_t w,
ss_t p,
uint lines,
uint cols,
uint y,
uint x )

Add a new window to the specified UiSurface.

Add a new window to an existing UI surface.

Parameters
sPointer to the UiSurface to which the window will be added.
wThe index of the window within the surface where the new window will be created.
pThe index of the parent window from which the new window will be derived.
linesThe number of lines (rows) for the new window.
colsThe number of columns for the new window.
yThe y-coordinate (row) for the new window's position relative to the parent window.
xThe x-coordinate (column) for the new window's position relative to the parent window.
Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface to which the window will be added.
wThe index of the new window.
pThe index of the parent plane to attach to.
linesThe number of lines (rows) for the new window.
colsThe number of columns for the new window.
yThe y-coordinate for the new window's position.
xThe x-coordinate for the new window's position.
Returns
0 on success, -1 on failure.

This function adds a new window to an existing UI surface by creating a new ncplane with the specified dimensions and position. It updates the metadata for the new window and sets its background properties. If any step fails, it cleans up and returns -1.

Add a new window to the specified UiSurface.

Parameters
sPointer to the UiSurface to which the window will be added.
wThe index of the new window.
pThe index of the parent plane to attach to.
linesThe number of lines (rows) for the new window.
colsThe number of columns for the new window.
yThe y-coordinate for the new window's position.
xThe x-coordinate for the new window's position.
Returns
0 on success, -1 on failure.

This function adds a new window to an existing UI surface by creating a new ncplane with the specified dimensions and position. It updates the metadata for the new window and sets its background properties. If any step fails, it cleans up and returns -1.

Definition at line 423 of file ui_ncurses.c.

423 {
424 UiLogLevel level = INFO;
425 s->mwin[w] = derwin(s->mwin[p], lines, cols, y, x);
426 if (!s->mwin[w]) {
427 level = ERROR;
428 ui_log(level, "%s = derwin(%s, lines=%d, cols=%d, begy=%d, begx=%d) failed", ss_n[w], ss_n[p], lines, cols, y, x);
429 free(s);
430 return -1;
431 }
432 ui_log(level, "%s = derwin(%s, lines=%d, cols=%d, begy=%d, begx=%d) success", ss_n[w], ss_n[p], lines, cols, y, x);
433 s->mpan[w] = new_panel(s->mwin[w]);
434 keypad(s->mwin[w], true);
435 immedok(s->mwin[w], true);
436
437#ifdef DEBUG_IMMED_UI
438#endif
439 return 0;
440}

References f_notcurses_open, ui, and ui_log_write().

Referenced by init_view_boxwin(), init_view_full_screen(), ui_display_image(), ui_surface_addpad(), ui_tracked_sfc_box(), and ui_tracked_sfc_split_box().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ui_surface_box()

UiSurface * ui_surface_box ( UiSurface * parent,
ss_t p,
uint lines,
uint cols,
uint y,
uint x,
const char * wtitle )

Create a new UI surface with a border box and optional title.

Parameters
parentPointer to the parent UiSurface, or NULL for a top-level surface.
pThe index of the parent window to derive from, if applicable.
linesThe number of lines (rows) for the new surface.
colsThe number of columns for the new surface.
yThe y-coordinate (row) for the new surface's position.
xThe x-coordinate (column) for the new surface's position.
wtitleThe title string to display in the border box, or NULL for no title.
Returns
A pointer to the newly created UiSurface with a border box, or NULL on failure.
Parameters
parentPointer to the parent UiSurface, or NULL for no parent.
pThe index of the parent plane to attach to.
linesThe number of lines (rows) for the new surface.
colsThe number of columns for the new surface.
yThe y-coordinate for the new surface's position.
xThe x-coordinate for the new surface's position.
wtitleThe title to display on the border box, or NULL for no title.
Returns
Pointer to the newly created UiSurface, or NULL on failure.

This function creates a new UI surface with a border box and an optional title. It allocates memory for the surface, sets up its metadata, and creates a new ncplane for rendering. If any step fails, it cleans up and returns NULL.

Definition at line 293 of file ui_ncurses.c.

293 {
294 if (!ui)
295 return NULL;
296 uint maxy, maxx;
297 ui_get_screen_size(&maxy, &maxx);
298 if (lines > maxy)
299 lines = maxy;
300 if (cols > maxx)
301 cols = maxx;
302 UiSurface *s = calloc(1, sizeof(*s));
303 if (!s) {
304 ui_log(ERROR, _("calloc failed for UiSurface"));
305 return NULL;
306 }
307 ss_t w = BOX;
308 s->runtime = ui;
309 s->parent = parent;
310 s->meta[BOX].y = y;
311 s->meta[BOX].x = x;
312 s->meta[BOX].lines = lines;
313 s->meta[BOX].cols = cols;
314 UiLogLevel level = INFO;
315 if (parent && parent->mwin[p]) {
316 s->mwin[BOX] = derwin(parent->mwin[p], lines, cols, y, x);
317 if (!s->mwin[BOX]) {
318 free(s);
319 level = ERROR;
320 ui_log(level, "%s = derwin(%s, lines=%d, cols=%d, begy=%d, begx=%d) failed", ss_n[w], ss_n[p], lines, cols, y, x);
321 return NULL;
322 }
323 } else {
324 s->mwin[BOX] = newwin(lines, cols, y, x);
325 if (!s->mwin[BOX]) {
326 free(s);
327 level = ERROR;
328 ui_log(level, "%s = newwin(lines=%d, cols=%d, begy=%d, begx=%d) failed", ss_n[w], lines, cols, y, x);
329 return NULL;
330 }
331 s->mpan[BOX] = new_panel(s->mwin[BOX]);
332 if (!s->mpan[BOX]) {
333 delwin(s->mwin[BOX]);
334 level = ERROR;
335 ui_log(level, "%s = new_panel(lines=%d, cols=%d, begy=%d, begx=%d) failed", ss_n[w], lines, cols, y, x);
336 return NULL;
337 }
338 }
339 ui_scrollok(s, BOX, false);
340 ui_border_draw(s, BOX);
341 ui_border_title(s, BOX, wtitle);
342#ifdef DEBUG_IMMED_UI
343 immedok(s->mwin[BOX], true);
344#endif
345 return s;
346}
int ui_border_draw(UiSurface *sfc, ss_t w)
Definition ui_common.c:523
int ui_border_title(UiSurface *sfc, ss_t w, const char *title)
Draw a box with a title around the specified window.
Definition ui_common.c:621
void ui_get_screen_size(uint *lines, uint *cols)
Get the current screen size (number of lines and columns).
Definition ui_ncurses.c:754
int ui_scrollok(UiSurface *s, ss_t w, bool enable)
Enable or disable scrolling for a UiSurface.
Definition ui_ncurses.c:796
unsigned int y
Definition ui_backend.h:369
unsigned int lines
Definition ui_backend.h:371
unsigned int cols
Definition ui_backend.h:372
unsigned int x
Definition ui_backend.h:370
struct UiSurface * parent
Definition ui_backend.h:397
struct UiSurfaceMeta meta[SUB_SFC_MAX]
Definition ui_backend.h:395
struct UiRuntime * runtime
Definition ui_backend.h:396

References cell_box, stdplane, strnz__cpy(), ui, ui_border_draw(), ui_border_title(), ui_get_screen_size(), ui_log_write(), ui_render(), and ui_scrollok().

Referenced by init_view_boxwin(), ui_display_image(), ui_tracked_sfc_box(), and ui_tracked_sfc_split_box().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ui_surface_destroy()

void ui_surface_destroy ( UiSurface * s)

Destroy a UiSurface, cleaning up its windows and panels.

Destroy a UI surface and free its resources.

Parameters
sPointer to the UiSurface to be destroyed.
sPointer to the UiSurface to be destroyed.

This function destroys a UI surface by freeing its associated ncplanes and metadata. It also frees the memory allocated for the UiSurface structure. If the provided pointer is NULL, the function does nothing.

Destroy a UiSurface, cleaning up its windows and panels.

Parameters
sPointer to the UiSurface to be destroyed.

This function destroys a UI surface by freeing its associated ncplanes and metadata. It also frees the memory allocated for the UiSurface structure. If the provided pointer is NULL, the function does nothing.

Definition at line 499 of file ui_ncurses.c.

499 {
500 if (!s)
501 return;
502 for (int i = SUB_SFC_MAX - 1; i >= 0; i--) {
503 if (s->mpan[i] != NULL) {
504 hide_panel(s->mpan[i]);
505 ui_render();
506 del_panel(s->mpan[i]);
507 s->mpan[i] = NULL;
508 }
509 }
510 for (int i = SUB_SFC_MAX - 1; i >= 0; i--) {
511 if (s->mwin[i] != NULL) {
512 delwin(s->mwin[i]);
513 s->mwin[i] = NULL;
514 }
515 }
516 if (s != NULL) {
517 free(s);
518 s = NULL;
519 }
520}
void ui_render()
Render the UI by updating panels and refreshing the display.
Definition ui_ncurses.c:931

References SUB_SFC_MAX, and ui_render().

Referenced by destroy_pick_view(), main(), ui_cm_surface_destroy(), ui_framed_surface_destroy(), ui_framed_surface_new(), ui_shutdown(), view_boxwin_resize(), view_file(), and view_full_screen_resize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ui_surface_hide()

int ui_surface_hide ( UiSurface * s,
ss_t w )

Hide a UiSurface, making it invisible on the screen.

Hide the specified window within a UI surface.

Parameters
sPointer to the UiSurface to be hidden.
wThe index of the window within the surface to be hidden.
Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface containing the window to hide.
wThe index of the window to hide.
Returns
0 on success, -1 on failure.

This function hides the specified window within a UI surface by updating its metadata and moving it far off-screen. If the surface or window is not initialized, it returns -1.

Hide a UiSurface, making it invisible on the screen.

Parameters
sPointer to the UiSurface containing the window to hide.
wThe index of the window to hide.
Returns
0 on success, -1 on failure.

This function hides the specified window within a UI surface by updating its metadata and moving it far off-screen. If the surface or window is not initialized, it returns -1.

Definition at line 667 of file ui_ncurses.c.

667 {
668 if (!s)
669 return -1;
670 hide_panel(s->mpan[w]);
671 s->meta[w].hidden = true;
672 return 0;
673}

◆ ui_surface_move()

int ui_surface_move ( UiSurface * s,
ss_t w,
uint y,
uint x )

Move a UiSurface to a new position on the screen.

Move a UI surface to a new position on the screen.

Parameters
sPointer to the UiSurface to be moved.
wThe index of the window within the surface to be moved.
yThe new y-coordinate (row) for the surface's position.
xThe new x-coordinate (column) for the surface's position.
Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface to be moved.
wThe index of the window within the surface to move.
yThe new y-coordinate for the surface's position.
xThe new x-coordinate for the surface's position.
Returns
0 on success, -1 on failure.

This function moves a UI surface to a new position on the screen by updating its metadata and moving the associated ncplane. If the surface is hidden, it only updates the metadata without moving the ncplane. If any step fails, it returns -1.

Move a UiSurface to a new position on the screen.

Parameters
sPointer to the UiSurface to be moved.
wThe index of the window within the surface to move.
yThe new y-coordinate for the surface's position.
xThe new x-coordinate for the surface's position.
Returns
0 on success, -1 on failure.

This function moves a UI surface to a new position on the screen by updating its metadata and moving the associated ncplane. If the surface is hidden, it only updates the metadata without moving the ncplane. If any step fails, it returns -1.

Definition at line 552 of file ui_ncurses.c.

552 {
553 if (!s)
554 return -1;
555 s->meta[w].y = y;
556 s->meta[w].x = x;
557 return move_panel(s->mpan[w], y, x);
558}

◆ ui_surface_new()

UiSurface * ui_surface_new ( ss_t w,
UiSurface * parent,
ss_t p,
uint lines,
uint cols,
uint y,
uint x )

Create a new UI surface with the specified parameters.

Parameters
wThe index of the window within the surface.
parentPointer to the parent UiSurface, or NULL for a top-level surface.
pThe index of the parent window to derive from, if applicable.
linesThe number of lines (rows) for the new surface.
colsThe number of columns for the new surface.
yThe y-coordinate (row) for the new surface's position.
xThe x-coordinate (column) for the new surface's position.
Returns
A pointer to the newly created UiSurface, or NULL on failure.
Parameters
wThe index of the surface to create.
parentPointer to the parent UiSurface, or NULL for no parent.
pThe index of the parent plane to attach to.
linesThe number of lines (rows) for the new surface.
colsThe number of columns for the new surface.
yThe y-coordinate for the new surface's position.
xThe x-coordinate for the new surface's position.
Returns
Pointer to the newly created UiSurface, or NULL on failure.

This function creates a new UI surface and initializes its properties based on the provided parameters. It allocates memory for the surface, sets up its metadata, and creates a new ncplane for rendering. If any step fails, it cleans up and returns NULL.

Definition at line 230 of file ui_ncurses.c.

230 {
231 if (!ui)
232 return NULL;
233 uint maxy, maxx;
234 ui_get_screen_size(&maxy, &maxx);
235 if (lines > maxy)
236 lines = maxy;
237 if (cols > maxx)
238 cols = maxx;
239 UiSurface *s = calloc(1, sizeof(*s));
240 if (!s) {
241 ui_log(ERROR, _("calloc failed for UiSurface"));
242 return NULL;
243 }
244 for (int i = 0; i < SUB_SFC_MAX; i++) {
245 s->mwin[i] = NULL;
246 s->mpan[i] = NULL;
247 }
248 s->runtime = ui;
249 s->parent = parent;
250 s->meta[w].lines = lines;
251 s->meta[w].cols = cols;
252 s->meta[w].y = y;
253 s->meta[w].x = x;
254 UiLogLevel level = INFO;
255 if (parent && parent->mwin[p]) {
256 s->mwin[w] = derwin(parent->mwin[p], lines, cols, y, x);
257 if (!s->mwin[w]) {
258 free(s);
259 level = ERROR;
260 ui_log(level, "%s = derwin(%s, lines=%d, cols=%d, begy=%d, begx=%d) failed", ss_n[w], ss_n[p], lines, cols, y, x);
261 return NULL;
262 }
263 } else {
264 s->mwin[w] = newwin(lines, cols, y, x);
265 if (!s->mwin[w]) {
266 free(s);
267 level = ERROR;
268 ui_log(level, "%s = newwin(lines=%d, cols=%d, begy=%d, begx=%d) failed", ss_n[w], lines, cols, y, x);
269 return NULL;
270 }
271 s->mpan[w] = new_panel(s->mwin[w]);
272 if (!s->mpan[w]) {
273 delwin(s->mwin[w]);
274 level = ERROR;
275 ui_log(level, "%s = new_panel(lines=%d, cols=%d, begy=%d, begx=%d) failed", ss_n[w], lines, cols, y, x);
276 free(s);
277 return NULL;
278 }
279 }
280 return s;
281}

References cell_nt, f_notcurses_open, stdplane, SUB_SFC_MAX, ui, ui_get_screen_size(), and ui_log_write().

Referenced by init_view_full_screen(), and ui_framed_surface_new().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ui_surface_resize()

int ui_surface_resize ( UiSurface * s,
ss_t w,
uint lines,
uint cols )

Resize a UiSurface to new dimensions.

Resize a UI surface to new dimensions.

Parameters
sPointer to the UiSurface to be resized.
wThe index of the window within the surface to be resized.
linesThe new number of lines (rows) for the surface.
colsThe new number of columns for the surface.
Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface to be resized.
wThe index of the window within the surface to resize.
linesThe new number of lines (rows) for the surface.
colsThe new number of columns for the surface.
Returns
0 on success, -1 on failure.

This function resizes a UI surface to new dimensions by updating its metadata and resizing the associated ncplane. If any step fails, it returns -1.

Resize a UiSurface to new dimensions.

Parameters
sPointer to the UiSurface to be resized.
wThe index of the window within the surface to resize.
linesThe new number of lines (rows) for the surface.
colsThe new number of columns for the surface.
Returns
0 on success, -1 on failure.

This function resizes a UI surface to new dimensions by updating its metadata and resizing the associated ncplane. If any step fails, it returns -1.

Definition at line 567 of file ui_ncurses.c.

567 {
568 if (!s)
569 return -1;
570 s->meta[w].lines = lines;
571 s->meta[w].cols = cols;
572 wresize(s->mwin[w], lines + 2, cols + 2);
573 wresize(s->mwin[w + 1], lines, cols);
574 return 0;
575}

◆ ui_surface_show()

int ui_surface_show ( UiSurface * s,
ss_t w )

Show a UiSurface, making it visible on the screen.

Show the specified window within a UI surface.

Parameters
sPointer to the UiSurface to be shown.
wThe index of the window within the surface to be shown.
Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface containing the window to show.
wThe index of the window to show.
Returns
0 on success, -1 on failure.

This function shows the specified window within a UI surface by updating its metadata and moving it to its designated position. If the surface or window is not initialized, it returns -1.

Show a UiSurface, making it visible on the screen.

Parameters
sPointer to the UiSurface containing the window to show.
wThe index of the window to show.
Returns
0 on success, -1 on failure.

This function shows the specified window within a UI surface by updating its metadata and moving it to its designated position. If the surface or window is not initialized, it returns -1.

Definition at line 641 of file ui_ncurses.c.

641 {
642 if (!s)
643 return -1;
644 show_panel(s->mpan[w]);
645 s->meta[w].hidden = false;
646 return 0;
647 return 0;
648}

◆ ui_suspend()

int ui_suspend ( )

Suspend the UI, saving the current program state and ending the window session.

Suspend the UI and leave the alternate screen.

Returns
0 on success, or -1 on failure.

This function suspends the UI and leaves the alternate screen. It is typically used when the application needs to temporarily exit the UI mode, such as when executing a shell command or displaying a message outside of the UI context.

Returns
0 on success, -1 on failure.

Suspend the UI, saving the current program state and ending the window session.

This function suspends the UI and leaves the alternate screen. It is typically used when the application needs to temporarily exit the UI mode, such as when executing a shell command or displaying a message outside of the UI context.

Returns
0 on success, -1 on failure.

Definition at line 525 of file ui_ncurses.c.

525 {
526 def_prog_mode();
527 endwin();
528 return 0;
529}

References ui.

◆ ui_top_surface()

int ui_top_surface ( UiSurface * s,
ss_t w )

Hide a UiSurface, making it invisible on the screen.

Move the specified window within a UI surface to the top of the z-order.

Parameters
sPointer to the UiSurface to be hidden.
wThe index of the window within the surface to be hidden.
Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface containing the window to move.
wThe index of the window to move to the top.
Returns
0 on success, -1 on failure.

This function moves the specified window within a UI surface to the top of the z-order, making it the foremost window. If the surface or window is not initialized, it returns -1.

Hide a UiSurface, making it invisible on the screen.

Parameters
sPointer to the UiSurface containing the window to move.
wThe index of the window to move to the top.
Returns
0 on success, -1 on failure.

This function moves the specified window within a UI surface to the top of the z-order, making it the foremost window. If the surface or window is not initialized, it returns -1.

Definition at line 655 of file ui_ncurses.c.

655 {
656 if (!s)
657 return -1;
658 top_panel(s->mpan[w]);
659 return 0;
660}

Referenced by get_cmd_char(), and picker().

Here is the caller graph for this function:

◆ ui_tracked_sfc_box()

int ui_tracked_sfc_box ( uint wlines,
uint wcols,
uint wbegy,
uint wbegx,
const char * wtitle )

Create a new surface with a box window.

ui_tracked_sfc_box_com

Parameters
wlinesNumber of lines for the window
wcolsNumber of columns for the window
wbegyStarting Y position for the window
wbegxStarting X position for the window
wtitleTitle for the window
Returns
0 on success, -1 on error

This function creates a new surface and adds a box window to it. It checks if the maximum number of surfaces has been exceeded and adjusts the window size based on the screen size. The new surface is stored in the global ui_surface array, and the surface pointer (sfc_ptr) is incremented. The window is then rendered on the screen.

Definition at line 429 of file ui_common.c.

429 {
430 if (sfc_ptr >= SFC_MAX) {
431 ui_log(ERROR, _("Maximum number of surfaces (%d) exceeded"), SFC_MAX);
432 exit(EXIT_FAILURE);
433 }
434 uint maxy, maxx;
435 ui_get_screen_size(&maxy, &maxx);
436 wlines = min(wlines, maxy);
437 wcols = min(wcols, maxx);
438 sfc_ptr++;
439 // -------------------> UI_win_box <-------------------
440 ui_surface[sfc_ptr] = ui_surface_box(nullptr, 0, wlines + 2, wcols + 2, wbegy, wbegx, wtitle);
442 ui_surface_addwin(sfc, WIN, BOX, wlines, wcols, 1, 1);
443 ui_render();
444 return 0;
445}
UiSurface * ui_surface_box(UiSurface *parent, ss_t p, uint lines, uint cols, uint y, uint x, const char *title)
Create a new UI surface with a border box and optional title.
Definition ui_ncurses.c:293
int ui_surface_addwin(UiSurface *s, ss_t w, ss_t p, uint lines, uint cols, uint y, uint x)
Add a new window to the specified UiSurface.
Definition ui_ncurses.c:423
void ui_get_screen_size(uint *lines, uint *cols)
Get the current screen size (number of lines and columns).
Definition ui_ncurses.c:754
#define SFC_MAX
Definition ui_backend.h:65

References sfc_ptr, ui_get_screen_size(), ui_log_write(), ui_render(), ui_surface, ui_surface_addwin(), and ui_surface_box().

Referenced by display_form(), main(), menu_engine(), popup_ckeys(), ui_action_disposition(), ui_answer_yn(), ui_display_error(), ui_perror(), and ui_timeout_prompt().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ui_tracked_sfc_split_box()

int ui_tracked_sfc_split_box ( uint wlines,
uint wcols,
uint split_y,
uint split_x,
uint wbegy,
uint wbegx,
const char * wtitle )

Create a new surface with a split box window.

surface_split_box_win_new

Parameters
wlinesNumber of lines for the main window
wcolsNumber of columns for the main window
split_yY position for the split line
split_xX position for the split line (not implemented yet)
wbegyStarting Y position for the window
wbegxStarting X position for the window
wtitleTitle for the window
Returns
0 on success, -1 on error

This function creates a new surface and adds a split box window to it. It checks if the maximum number of surfaces has been exceeded and adjusts the window size based on the screen size. The new surface is stored in the global ui_surface array, and the surface pointer (sfc_ptr) is incremented. The main window and the split window are then rendered on the screen, with a separator line drawn at the specified Y position.

Definition at line 467 of file ui_common.c.

467 {
468 if (sfc_ptr >= SFC_MAX) {
469 ui_log(ERROR, _("Maximum number of surfaces (%d) exceeded"), SFC_MAX);
470 exit(EXIT_FAILURE);
471 }
472 if (wlines == 0 || wcols == 0) {
473 ui_log(ERROR, _("Invalid window size: lines=%d, cols=%d"), wlines, wcols);
474 return -1;
475 }
476 uint maxy, maxx;
477 ui_get_screen_size(&maxy, &maxx);
478 if (wbegy > maxy || wbegx > maxx) {
479 ui_log(ERROR, _("Invalid window position: wbegy=%d, wbegx=%d, wlines=%d, wcols=%d"), wbegy, wbegx, wlines, wcols);
480 return -1;
481 }
482 wlines = min(wlines, maxy);
483 wcols = min(wcols, maxx);
484 split_x = min(split_x, maxx); // not implemented yet
485 uint split_wlines = min(wlines + split_y + 1, maxy);
486 wcols = min(wcols, maxx);
487 sfc_ptr++;
488 // -------------------> surface_new <-------------------
489 ui_surface[sfc_ptr] = ui_surface_box(nullptr, 0, split_wlines + 2, wcols + 2, wbegy, wbegx, wtitle);
491
492 ui_surface_addwin(sfc, WIN, BOX, wlines, wcols, 1, 1);
493 ui_bkgd(sfc, WIN, &cell_nt);
494 ui_werase(sfc, WIN);
495 ui_border_ysplit(sfc, BOX, wlines + 1);
496 ui_surface_addwin(sfc, WIN2, BOX, 2, wcols, wlines + 2, 1);
497 ui_bkgd(sfc, WIN2, &cell_nt);
498 ui_werase(sfc, WIN2);
499 ui_curs_set(0);
500#ifdef DEBUG_IMMED_UI
501 ui_render();
502#endif
503 return 0;
504}
int ui_bkgd(UiSurface *s, ss_t w, const UiCell *cell)
Set the background of a specific window within a UiSurface.
Definition ui_ncurses.c:974
int ui_curs_set(int visibility)
Set the visibility of the cursor.
Definition ui_ncurses.c:881
int ui_werase(UiSurface *s, ss_t w)
Erase the contents of a UiSurface or all surfaces.
Definition ui_ncurses.c:582
int ui_border_ysplit(UiSurface *sfc, ss_t w, uint y)
Draw a box with a separator line around the specified window.
Definition ui_common.c:556

References cell_nt, sfc_ptr, ui_bkgd(), ui_border_ysplit(), ui_curs_set(), ui_get_screen_size(), ui_log_write(), ui_surface, ui_surface_addwin(), ui_surface_box(), and ui_werase().

Referenced by open_pick_win().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ui_update_panels()

void ui_update_panels ( )

Update the panels in the UI.

Update the panels and render the UI.

This function updates the panels and renders the UI.

Update the panels in the UI.

This function updates the panels and renders the UI.

Definition at line 937 of file ui_ncurses.c.

937 {
938 update_panels();
939}

References ui.

◆ ui_wclear()

int ui_wclear ( UiSurface * s,
ss_t w )

Clear the contents of a UiSurface or all surfaces.

Clear the contents of the specified window within a UI surface.

Parameters
sPointer to the UiSurface to be cleared, or NULL to clear all surfaces.
wThe index of the window within the surface to be cleared, or ALLWINS to clear all windows.
Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface containing the window to clear.
wThe index of the window to clear.
Returns
0 on success, -1 on failure.

This function clears the contents of the specified window within a UI surface by erasing its contents. If the surface or window is not initialized, it returns -1.

Clear the contents of a UiSurface or all surfaces.

Parameters
sPointer to the UiSurface containing the window to clear.
wThe index of the window to clear.
Returns
0 on success, -1 on failure.

This function clears the contents of the specified window within a UI surface by erasing its contents. If the surface or window is not initialized, it returns -1.

Definition at line 603 of file ui_ncurses.c.

603 {
604 if (!s)
605 return -1;
606 if (w == ALLWINS) {
607 for (int i = 1; i < SUB_SFC_MAX; i++) {
608 if (s->mwin[i]) {
609 wclear(s->mwin[i]);
610 }
611 }
612 } else {
613 if (s->mwin[w]) {
614 wclear(s->mwin[w]);
615 }
616 }
617 return 0;
618}
#define ALLWINS
Definition ui_backend.h:63

References SUB_SFC_MAX.

◆ ui_wclrtobot()

int ui_wclrtobot ( UiSurface * s,
ss_t w )

Set the style of a surface window.

clear from current cursor position to bottom of window

Parameters
sThe surface to modify.
wThe window index within the surface.
styleThe style to apply (UiStyle).
Returns
0 on success, -1 on error.
Parameters
ssurface
wwindow
Returns
0 on success, -1 on error

Set the style of a surface window.

Parameters
ssurface
wwindow
Returns
0 on success, -1 on error

Definition at line 27 of file ui_ncurses_draw.c.

27 {
28 if (!s)
29 return -1;
30 wclrtobot(s->mwin[w]);
31 return 0;
32}

Referenced by display_line_eod(), scroll_next(), scroll_prev(), and search().

Here is the caller graph for this function:

◆ ui_wclrtoeol()

int ui_wclrtoeol ( UiSurface * s,
ss_t w )

Clear to the end of the line in a surface window.

clear the window from the current cursor position to the end of the window

Parameters
sThe surface to modify.
wThe window index within the surface.
Returns
0 on success, -1 on error.
Parameters
ssurface
wwindow
Returns
0 on success, -1 on error

Clear to the end of the line in a surface window.

Parameters
ssurface
wwindow
Returns
0 on success, -1 on error

Definition at line 38 of file ui_ncurses_draw.c.

38 {
39 if (!s)
40 return -1;
41 wclrtoeol(s->mwin[w]);
42 return 0;
43}

Referenced by cf_accept(), display_line(), display_prompt(), display_split_line(), form_post(), get_cmd_arg(), get_cmd_char(), ncurses_input(), pick_engine(), picker(), ui_display_chyron(), and ui_update_timeout_prompt().

Here is the caller graph for this function:

◆ ui_werase()

int ui_werase ( UiSurface * s,
ss_t w )

Erase the contents of a UiSurface or all surfaces.

Clear the contents of the specified window within a UI surface.

Parameters
sPointer to the UiSurface to be erased, or NULL to erase all surfaces.
wThe index of the window within the surface to be erased, or ALLWINS to erase all windows.
Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface containing the window to clear.
wThe index of the window to clear.
Returns
0 on success, -1 on failure.

This function clears the contents of the specified window within a UI surface by erasing its contents. If the surface or window is not initialized, it returns -1.

Erase the contents of a UiSurface or all surfaces.

Parameters
sPointer to the UiSurface containing the window to clear.
wThe index of the window to clear.
Returns
0 on success, -1 on failure.

This function clears the contents of the specified window within a UI surface by erasing its contents. If the surface or window is not initialized, it returns -1.

Definition at line 582 of file ui_ncurses.c.

582 {
583 if (w == ALLWINS) {
584 for (int i = 1; i < SUB_SFC_MAX; i++) {
585 if (s->mwin[i]) {
586 werase(s->mwin[i]);
587 }
588 }
589 } else {
590 if (s->mwin[w]) {
591 werase(s->mwin[w]);
592 }
593 }
594 return 0;
595}

References SUB_SFC_MAX.

Referenced by exec_objects(), full_screen_shell(), init_view_boxwin(), init_view_full_screen(), ui_display_error(), ui_perror(), and ui_tracked_sfc_split_box().

Here is the caller graph for this function:

◆ ui_whide()

int ui_whide ( UiSurface * s,
ss_t w )

◆ ui_wmove()

int ui_wmove ( UiSurface * s,
ss_t w,
uint y,
uint x )

Move the cursor to a specified position within a UiSurface.

Move the cursor to the specified position within a window of a UI surface.

Parameters
sPointer to the UiSurface where the cursor will be moved.
wThe index of the window within the surface where the cursor will be moved.
yThe new y-coordinate (row) for the cursor's position.
xThe new x-coordinate (column) for the cursor's position.
Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
yThe y-coordinate for the new cursor position.
xThe x-coordinate for the new cursor position.
Returns
0 on success, -1 on failure.

This function moves the cursor to the specified position within a window of a UI surface. If the surface or window is not initialized, it returns -1.

Move the cursor to a specified position within a UiSurface.

Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
yThe y-coordinate for the new cursor position.
xThe x-coordinate for the new cursor position.
Returns
0 on success, -1 on failure.

This function moves the cursor to the specified position within a window of a UI surface. If the surface or window is not initialized, it returns -1.

Definition at line 685 of file ui_ncurses.c.

685 {
686 if (!s || !s->mwin[w])
687 return -1;
688 return wmove(s->mwin[w], y, x);
689}

Referenced by full_screen_shell(), menu_cmd_processor(), ui_display_chyron(), ui_mvwadd_wchnstr(), and ui_mvwadd_wchstr().

Here is the caller graph for this function:

◆ ui_wnoutrefresh()

int ui_wnoutrefresh ( UiSurface * s,
ss_t w )

Refresh a specific window within a UiSurface.


Refreshing

Parameters
sPointer to the UiSurface containing the window to be refreshed.
wThe index of the window within the surface to be refreshed.
Returns
0 on success, or -1 on failure.

Refreshing

Parameters
sPointer to the UiSurface containing the window to be refreshed.
wThe index of the window within the surface to be refreshed.
Returns
0 on success, or -1 on failure.

Refreshing

Parameters
sPointer to the UiSurface containing the window to be refreshed.
wThe index of the window within the surface to be refreshed.
Returns
0 on success, or -1 on failure.

Definition at line 955 of file ui_ncurses.c.

955 {
956 if (!s)
957 return -1;
958 wnoutrefresh(s->mwin[w]);
959 return 0;
960}

◆ ui_wresize()

int ui_wresize ( UiSurface * s,
ss_t w,
uint lines,
uint cols )

◆ ui_wscrl()

int ui_wscrl ( UiSurface * s,
ss_t w,
int r )

Scroll the contents of a UiSurface by a specified number of lines.

Scroll the contents of the specified window up or down by the specified number of lines.

Parameters
sPointer to the UiSurface to be scrolled.
wThe index of the window within the surface to be scrolled.
nThe number of lines to scroll. Positive values scroll down, negative values scroll up.
Returns
0 on success, or -1 on failure.
Parameters
sThe surface containing the window to scroll.
wThe index of the window to scroll.
rThe number of lines to scroll. Positive values scroll up, negative values scroll down.
Returns
0 on success, -1 on error.

If r is positive, the contents of the plane are moved up, leaving blank lines at the bottom. In the view application, the view scope is moved toward end of file (eof). - scope_toward_eof()

Note
ui_wscrl(-n) - If r is negative, the contents of the plane are moved down, leaving blank lines at the top. In the view application, the view scope is moved toward beginning of file (bof). - scope_toward_bof()

Scroll the contents of a UiSurface by a specified number of lines.

Parameters
sThe surface containing the window to scroll.
wThe index of the window to scroll.
rThe number of lines to scroll. Positive values scroll up, negative values scroll down.
Returns
0 on success, -1 on error.

If r is positive, the contents of the plane are moved up, leaving blank lines at the bottom. In the view application, the view scope is moved toward end of file (eof). - scope_toward_eof()

Note
ui_wscrl(-n) - If r is negative, the contents of the plane are moved down, leaving blank lines at the top. In the view application, the view scope is moved toward beginning of file (bof). - scope_toward_bof()

Definition at line 770 of file ui_ncurses.c.

770 {
771 if (!s->mwin[w])
772 return -1;
773 wscrl(s->mwin[w], n);
774 return 0;
775}

Referenced by display_pick_page(), scroll_next(), and scroll_prev().

Here is the caller graph for this function:

◆ ui_wshow()

int ui_wshow ( UiSurface * s,
ss_t w )

Variable Documentation

◆ border_double

const wchar_t* border_double
extern

Definition at line 86 of file ui_common.c.

Referenced by ui_init(), and ui_init().

◆ border_heavy

const wchar_t* border_heavy
extern

Definition at line 88 of file ui_common.c.

Referenced by ui_init(), and ui_init().

◆ border_none

const wchar_t* border_none
extern

Definition at line 89 of file ui_common.c.

Referenced by ui_init(), and ui_init().

◆ border_rounded

const wchar_t* border_rounded
extern

Definition at line 87 of file ui_common.c.

Referenced by ui_init(), and ui_init().

◆ border_single

const wchar_t* border_single
extern

BOX WIDE UNICODE CODEPOINTS

Definition at line 85 of file ui_common.c.

Referenced by ui_init(), and ui_init().

◆ bw

BorderWide bw
extern

Definition at line 27 of file ui_common.c.

Referenced by ui_init(), and ui_init().

◆ bw_chk

const wchar_t* bw_chk
extern

left_angle

Definition at line 103 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ bw_da

const wchar_t* bw_da
extern

large down arrow

Definition at line 100 of file ui_common.c.

◆ bw_h09

const wchar_t* bw_h09
extern

horizontal line 9

Definition at line 104 of file ui_common.c.

◆ bw_la

const wchar_t* bw_la
extern

large left arrow

Definition at line 98 of file ui_common.c.

◆ bw_lan

const wchar_t* bw_lan
extern

left_angle

Definition at line 102 of file ui_common.c.

◆ bw_ra

const wchar_t* bw_ra
extern

large right arrow

Definition at line 97 of file ui_common.c.

◆ bw_ran

const wchar_t* bw_ran
extern

right_angle

Definition at line 101 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ bw_rbl

const wchar_t* bw_rbl
extern

rounded bottom left

Definition at line 94 of file ui_common.c.

◆ bw_rbr

const wchar_t* bw_rbr
extern

rounded bottom right

Definition at line 95 of file ui_common.c.

◆ bw_rtl

const wchar_t* bw_rtl
extern

MISCELANEOUS UNICODE CODEPOINTS rounded top left

Definition at line 92 of file ui_common.c.

◆ bw_rtr

const wchar_t* bw_rtr
extern

rounded top right

Definition at line 93 of file ui_common.c.

◆ bw_sp

const wchar_t* bw_sp
extern

space

Definition at line 96 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ bw_ua

const wchar_t* bw_ua
extern

large up arrow

Definition at line 99 of file ui_common.c.

◆ cell_bl

UiCell cell_bl
extern

Definition at line 142 of file ui_common.c.

Referenced by ui_border_draw(), and ui_initialize_sio().

◆ cell_black_bg

UiCell cell_black_bg
extern

Definition at line 150 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ cell_blue_bg

UiCell cell_blue_bg
extern

Definition at line 154 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ cell_box

UiCell cell_box
extern

Definition at line 127 of file ui_common.c.

Referenced by ui_border_title(), ui_initialize_sio(), and ui_surface_box().

◆ cell_br

UiCell cell_br
extern

Definition at line 143 of file ui_common.c.

Referenced by ui_border_draw(), and ui_initialize_sio().

◆ cell_brktl

UiCell cell_brktl
extern

Definition at line 121 of file ui_common.c.

Referenced by display_form(), and ui_initialize_sio().

◆ cell_brktr

UiCell cell_brktr
extern

Definition at line 122 of file ui_common.c.

Referenced by display_form(), and ui_initialize_sio().

◆ cell_bs

UiCell cell_bs
extern

Definition at line 137 of file ui_common.c.

◆ cell_bt

UiCell cell_bt
extern

Definition at line 147 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ cell_chk

UiCell cell_chk
extern

◆ cell_cmdln

UiCell cell_cmdln
extern

Definition at line 129 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ cell_cr

UiCell cell_cr
extern

Definition at line 148 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ cell_cyan_bg

UiCell cell_cyan_bg
extern

Definition at line 155 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ cell_default

UiCell cell_default
extern

Definition at line 119 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ cell_fill_char

UiCell cell_fill_char
extern

Definition at line 120 of file ui_common.c.

Referenced by form_display_fields(), and ui_initialize_sio().

◆ cell_green_bg

UiCell cell_green_bg
extern

Definition at line 152 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ cell_ho

◆ cell_ind

UiCell cell_ind
extern

Definition at line 128 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ cell_ln

UiCell cell_ln
extern

Definition at line 131 of file ui_common.c.

Referenced by init_view_boxwin(), init_view_full_screen(), and ui_initialize_sio().

◆ cell_ls

UiCell cell_ls
extern

Definition at line 134 of file ui_common.c.

◆ cell_lt

UiCell cell_lt
extern

◆ cell_magenta_bg

UiCell cell_magenta_bg
extern

Definition at line 156 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ cell_nt

◆ cell_nt_hl

UiCell cell_nt_hl
extern

◆ cell_nt_hl_rev

UiCell cell_nt_hl_rev
extern

Definition at line 126 of file ui_common.c.

Referenced by field_editor(), form_engine(), menu_cmd_processor(), picker(), and ui_initialize_sio().

◆ cell_nt_rev

◆ cell_ran

UiCell cell_ran
extern

Definition at line 132 of file ui_common.c.

Referenced by get_cmd_arg(), get_cmd_char(), picker(), and ui_initialize_sio().

◆ cell_red_bg

UiCell cell_red_bg
extern

Definition at line 151 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ cell_rs

UiCell cell_rs
extern

Definition at line 135 of file ui_common.c.

◆ cell_rt

UiCell cell_rt
extern

◆ cell_sp

◆ cell_title

UiCell cell_title
extern

Definition at line 130 of file ui_common.c.

Referenced by ui_border_title(), and ui_initialize_sio().

◆ cell_tl

UiCell cell_tl
extern

Definition at line 138 of file ui_common.c.

Referenced by ui_border_draw(), ui_border_title(), and ui_initialize_sio().

◆ cell_tr

UiCell cell_tr
extern

Definition at line 139 of file ui_common.c.

Referenced by ui_border_draw(), and ui_initialize_sio().

◆ cell_ts

UiCell cell_ts
extern

Definition at line 136 of file ui_common.c.

◆ cell_tt

UiCell cell_tt
extern

Definition at line 146 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ cell_ve

UiCell cell_ve
extern

Definition at line 141 of file ui_common.c.

Referenced by ui_border_draw(), and ui_initialize_sio().

◆ cell_white_bg

UiCell cell_white_bg
extern

Definition at line 157 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ cell_yellow_bg

UiCell cell_yellow_bg
extern

Definition at line 153 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ click_x

int click_x
extern

the x coordinate of a mouse click

Definition at line 30 of file ui_common.c.

Referenced by cf_accept(), field_editor(), form_post(), and form_process().

◆ click_y

int click_y
extern

the y coordinate of a mouse click

Definition at line 29 of file ui_common.c.

Referenced by cf_accept(), field_editor(), form_post(), and form_process().

◆ clr_cnt

uint clr_cnt
extern

number of colors used

◆ clr_idx

uint clr_idx
extern

current color index

◆ clr_pair_cnt

uint clr_pair_cnt
extern

number of color pairs supported by the terminal

◆ clr_pair_idx

uint clr_pair_idx
extern

current color pair index

◆ colors_text

char const colors_text[][10]
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 110 of file ui_common.c.

110 {
111 _("black"), _("red"), _("green"), _("yellow"), _("blue"), _("magenta"), _("cyan"),
112 _("white"), _("orange"), _("bg"), _("abg"), _("bblack"), _("bred"), _("bgreen"),
113 _("byellow"), _("bblue"), _("bcyan"), _("bmagenta"), _("bwhite"), _("borange"), ""};

◆ COLS

uint COLS

Definition at line 467 of file ui_backend.h.

◆ cp_black

ushort cp_black
extern

red background color pair index

black

Definition at line 175 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ cp_blue

ushort cp_blue
extern

blue background color pair index

blue

Definition at line 179 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ cp_bold

ushort cp_bold
extern

bold color pair index

◆ cp_box

ushort cp_box
extern

box color pair index

border

Definition at line 163 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ cp_brackets

ushort cp_brackets
extern

color pair index for field brackets

field enclosure brackets

Definition at line 174 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ cp_cmdln_bg

ushort cp_cmdln_bg
extern

command line number background color pair index

◆ cp_cmdln_fg

ushort cp_cmdln_fg
extern

command line number color pair index

◆ cp_cyan

ushort cp_cyan
extern

cyan background color pair index

cyan

Definition at line 180 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ cp_default

ushort cp_default
extern

default color pair index

default color pair

Definition at line 172 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ cp_fill_char

ushort cp_fill_char
extern

fill character color pair index

field fill characters

Definition at line 173 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ cp_green

ushort cp_green
extern

greenbackground color pair index

green

Definition at line 177 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ cp_highlight

ushort cp_highlight
extern

highlight color pair index

◆ cp_ind

ushort cp_ind
extern

indicator color pair index

indicator character

Definition at line 164 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ cp_ln_bg

ushort cp_ln_bg
extern

line number background color pair index

◆ cp_ln_fg

ushort cp_ln_fg
extern

line number color pair index

◆ cp_magenta

ushort cp_magenta
extern

magenta background color pair index

magenta

Definition at line 181 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ cp_nt

ushort cp_nt
extern

normal color pair index

normal text

Definition at line 167 of file ui_common.c.

Referenced by fmt_line(), and ui_initialize_sio().

◆ cp_nt_hl

ushort cp_nt_hl
extern

highlight color pair index

normal text highlight

Definition at line 169 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ cp_nt_hl_rev

ushort cp_nt_hl_rev
extern

highlight reverse color pair index

normal text highlight reverse

Definition at line 170 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ cp_nt_rev

ushort cp_nt_rev
extern

reverse color pair index

normal text reverse

Definition at line 168 of file ui_common.c.

Referenced by search(), and ui_initialize_sio().

◆ cp_red

ushort cp_red
extern

red background color pair index

red

Definition at line 176 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ cp_title

ushort cp_title
extern

title color pair index

border title

Definition at line 166 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ cp_white

ushort cp_white
extern

white background color pair index

white

Definition at line 182 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ cp_yellow

ushort cp_yellow
extern

yellow background color pair index

yellow

Definition at line 178 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ em0

◆ em1

◆ em2

◆ em3

char em3[MAXLEN]
extern

error message string for error messages

Definition at line 45 of file lf.c.

Referenced by log_open(), ui_open_log(), ui_timeout_prompt(), ui_update_timeout_prompt(), verify_dir(), and verify_file().

◆ f_ncurses_open

◆ f_notcurses_open

◆ LINES

uint LINES
extern

Definition at line 30 of file ui_notcurses.c.

◆ sfc_ptr

◆ stdplane

NcPlane * stdplane
extern

◆ stdsfc

UiSurface * stdsfc
extern

◆ ui_ctx

ui_context_t ui_ctx
extern

◆ ui_log_ctx

UiLogContext ui_log_ctx
extern

Definition at line 53 of file ui_common.c.

53 {
54 .fd = -1,
55 .file_spec = "\0",
56 .min_level = INFO,
57 .localtime = false,
58 .timestamp = "\0",
59 .color = {
60 [FATAL] = "\033[1;31m", // Bold Red
61 [ERROR] = "\033[0;31m", // Regular Red
62 [WARN] = "\033[0;33m", // Yellow
63 [INFO] = "\033[0;32m", // Green
64 [VERBOSE] = "\033[0;36m", // Cyan
65 [DEBUG] = "\033[0;34m", // Blue
66 [SILENT] = _("SILENT"),
67 },
68 .level = {[FATAL] = "FATAL", [ERROR] = "ERROR", [WARN] = "WARN", [INFO] = "INFO", [VERBOSE] = "VERBOSE", [DEBUG] = "DEBUG", [SILENT] = "SILENT"}};

Referenced by mapp_initialization(), ui_init(), ui_init(), ui_log_write(), ui_open_log(), and write_config().

◆ win_ptr

int win_ptr
extern