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

Headder for C-Menu Menu, Form, Pick, and View components. More...

#include "cm.h"
#include <form.h>
#include <menu.h>
#include <pick.h>
#include <view.h>
#include <stddef.h>
Include dependency graph for common.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  Init
 Gathers runtime information for C-Menu Menu, Form, Pick, and View components, used for passing common data and state during initialization and processing of these componentsi. More...

Macros

#define _GNU_SOURCE
#define ABOUT   ".about"
#define ACCEPT_PROMPT_CHAR   '_'
#define COLOR_LEN   8
#define DEFAULTEDITOR   "vi"
#define destroy_cmenu()
#define EIGHT   8
#define FORM_HELP_FILE   "form.help"
#define MAPP_DIR   "~/menuapp"
#define MAX_FORMS   10
#define MAX_MENUS   10
#define MAX_PICK_OBJS   1024
#define MAX_PICKS   10
#define MAX_VIEWS   10
#define MAX_WIDE_LEN   1024
#define MAXOPTS   50
#define MENU_HELP_FILE   "menu.help"
#define MIN_COLS   40
#define MINITRC   ".minitrc"
#define NCURSES_WIDECHAR   1
#define new_cmenu()
#define P_READ   0
#define P_WRITE   1
#define PICK_HELP_FILE   "pick.help"
#define PICK_MAX_ARG_LEN   256
#define PRINTCMD   "lp -c -s"
#define TRUE   1
#define USE_PAD   TRUE
#define VIEW_HELP_FILE   "view.help"
#define VIEW_PRT_FILE   "prtout"

Typedefs

typedef Form Form
typedef Menu Menu
typedef Pick Pick
typedef View View

Enumerations

enum  Caller { VIEW , FORM , PICK , MENU }
enum  OptGroup {
  OG_FILES , OG_DIRS , OG_SPECS , OG_MISC ,
  OG_PARMS , OG_FLAGS , OG_COL
}
 option groups More...
enum  OptType { OT_STRING , OT_INT , OT_BOOL , OT_HEX }
 option types More...

Functions

void build_prompt (View *)
 Build Prompt String.
int cmd_processor (Init *)
void cmenu_abend (Init *init, int ec, char *s)
void cmenu_shutdown (Init *init)
bool derive_file_spec (char *, char *, char *)
 Derive full file specification from directory and file name.
Form * destroy_form (Init *init)
 Destroy Form structure.
Init * destroy_init (Init *init)
 Destroy Init structure.
void destroy_line_table (View *)
 Destroy Line Table.
Menu * destroy_menu (Init *init)
 Destroy Menu structure.
Pick * destroy_pick (Init *init)
 Destroy Pick structure.
View * destroy_view (Init *init)
 Destroy View structure.
void destroy_view_win (Init *)
int display_prompt (View *, char *)
 Display Command Line Prompt.
int init_form (Init *, int, char **, uint, uint)
 Initialize form data structure and parse description file.
int init_pick (Init *, int, char **, uint, uint)
 Initializes pick structure and opens pick input file or pipe.
int init_view_boxwin (Init *)
 Initialize the C-Menu View in box window mode.
int init_view_full_screen (Init *)
 Initialize C-Menu View in full screen mode.
void initialize_line_table (View *)
 Initialize Line Table.
void mapp_initialization (Init *, int, char **)
 Main initialization function for MAPP - Menu Application.
unsigned int menu_engine (Init *)
 The main loop of the menu system.
Form * new_form (Init *, int, char **, uint, uint)
 Create and initialize Form structure.
Init * new_init (int, char **)
 Create and initialize Init structure.
Menu * new_menu (Init *, int, char **, uint, uint)
 Create and initialize Menu structure.
Pick * new_pick (Init *, int, char **, uint, uint)
 Create and initialize Pick structure.
View * new_view (Init *)
 Create and initialize View structure.
int open_pick_win (Init *)
int pad_refresh (View *)
 Refresh Pad and Line Number Window.
void page_next (View *)
 Advance to Next Page.
unsigned int parse_menu_description (Init *)
 Parse menu description file and create Menu.
int parse_opt_args (Init *, int, char **)
 Parse command-line options and set Init struct values accordingly.
int pick_engine (Init *)
int popup_ckeys ()
int popup_form (Init *, int, char **, uint, uint)
 instantiate a form popup window
int popup_menu (Init *, int, char **, uint, uint)
 instantiate a menu popup window
int popup_pick (Init *, int, char **, uint, uint)
 instantiate a pick popup window
int popup_view (Init *, int, char **, uint, uint, uint, uint)
 instantiate a view popup window
int process_config_file (char *, Init *)
void view_boxwin_resize (Init *)
 Resize the current window and its box.
void view_calc_boxwin_dimensions (Init *)
 Calculate the dimensions and position of the box window for C-Menu View.
void view_calc_full_screen_dimensions (Init *)
 Calculate the dimensions for full screen mode.
int view_cmd_processor (Init *)
 Main Command Processing Loop for View.
int view_file (Init *)
 Start view.
void view_full_screen_resize (Init *)
 Resize the full screen view and its components.
int view_init_input (Init *, char *)
 Initialize the input for the C-Menu View.
void view_stack_free (ViewStack *)
bool view_stack_init (ViewStack *, size_t)
bool view_stack_peek (const ViewStack *, View *)
bool view_stack_pop (ViewStack *, View *)
bool view_stack_push (ViewStack *, View)
int write_config (Init *)
 Write the current configuration to a file specified in init->minitrc.
void zero_opt_args (Init *)
 Initialize optional arguments in the Init struct to default values.

Variables

int init_cnt
char minitrc [MAXLEN]
ViewStack view_stack

Detailed Description

Headder for C-Menu Menu, Form, Pick, and View components.

Author
Bill Waller Copyright (c) 2025 MIT License billx.nosp@m.wall.nosp@m.er@gm.nosp@m.ail..nosp@m.com
Date
2026-02-09

Definition in file common.h.

Macro Definition Documentation

◆ _GNU_SOURCE

#define _GNU_SOURCE

Definition at line 16 of file common.h.

◆ ABOUT

#define ABOUT   ".about"

Definition at line 48 of file common.h.

◆ ACCEPT_PROMPT_CHAR

#define ACCEPT_PROMPT_CHAR   '_'

Definition at line 33 of file common.h.

◆ COLOR_LEN

#define COLOR_LEN   8

Definition at line 30 of file common.h.

◆ DEFAULTEDITOR

#define DEFAULTEDITOR   "vi"

Definition at line 40 of file common.h.

◆ destroy_cmenu

#define destroy_cmenu ( )
Value:
destroy_init(init); \
win_del(); \
curs_set(1); \
destroy_curses(); \
return 0; \
}
Init * destroy_init(Init *init)
Destroy Init structure.
Definition mem.c:91

Definition at line 70 of file common.h.

70#define destroy_cmenu() \
71 destroy_init(init); \
72 win_del(); \
73 curs_set(1); \
74 destroy_curses(); \
75 return 0; \
76 }

◆ EIGHT

#define EIGHT   8

Definition at line 52 of file common.h.

◆ FORM_HELP_FILE

#define FORM_HELP_FILE   "form.help"

Definition at line 36 of file common.h.

◆ MAPP_DIR

#define MAPP_DIR   "~/menuapp"

Definition at line 49 of file common.h.

◆ MAX_FORMS

#define MAX_FORMS   10

Definition at line 43 of file common.h.

◆ MAX_MENUS

#define MAX_MENUS   10

Definition at line 44 of file common.h.

◆ MAX_PICK_OBJS

#define MAX_PICK_OBJS   1024

Definition at line 32 of file common.h.

◆ MAX_PICKS

#define MAX_PICKS   10

Definition at line 45 of file common.h.

◆ MAX_VIEWS

#define MAX_VIEWS   10

Definition at line 42 of file common.h.

◆ MAX_WIDE_LEN

#define MAX_WIDE_LEN   1024

Definition at line 29 of file common.h.

◆ MAXOPTS

#define MAXOPTS   50

Definition at line 51 of file common.h.

◆ MENU_HELP_FILE

#define MENU_HELP_FILE   "menu.help"

Definition at line 35 of file common.h.

◆ MIN_COLS

#define MIN_COLS   40

Definition at line 27 of file common.h.

◆ MINITRC

#define MINITRC   ".minitrc"

Definition at line 47 of file common.h.

◆ NCURSES_WIDECHAR

#define NCURSES_WIDECHAR   1

Definition at line 18 of file common.h.

◆ new_cmenu

#define new_cmenu ( )
Value:
__end_pgm; \
int main(int argc, char **argv) { \
capture_shell_tioctl(); \
Init *init = new_init(argc, argv); \
SIO *sio = init->sio; \
mapp_initialization(init); \
ui_init(sio); \
sig_prog_mode(); \
capture_curses_tioctl(); \
win_init_attrs();
#define __atexit
This macro registers the end_pgm function to be called when the program exits.
Definition cm.h:275
int main(void)
Init * new_init(int argc, char **argv)
Create and initialize Init structure.
Definition mem.c:60
Gathers runtime information for C-Menu Menu, Form, Pick, and View components, used for passing common...
Definition common.h:116
SIO * sio
Definition common.h:117

Definition at line 57 of file common.h.

57#define new_cmenu() \
58 __end_pgm; \
59 int main(int argc, char **argv) { \
60 __atexit; \
61 capture_shell_tioctl(); \
62 Init *init = new_init(argc, argv); \
63 SIO *sio = init->sio; \
64 mapp_initialization(init); \
65 ui_init(sio); \
66 sig_prog_mode(); \
67 capture_curses_tioctl(); \
68 win_init_attrs();

◆ P_READ

#define P_READ   0

Definition at line 53 of file common.h.

◆ P_WRITE

#define P_WRITE   1

Definition at line 54 of file common.h.

◆ PICK_HELP_FILE

#define PICK_HELP_FILE   "pick.help"

Definition at line 37 of file common.h.

◆ PICK_MAX_ARG_LEN

#define PICK_MAX_ARG_LEN   256

Definition at line 31 of file common.h.

◆ PRINTCMD

#define PRINTCMD   "lp -c -s"

Definition at line 50 of file common.h.

◆ TRUE

#define TRUE   1

Definition at line 55 of file common.h.

◆ USE_PAD

#define USE_PAD   TRUE

Definition at line 26 of file common.h.

◆ VIEW_HELP_FILE

#define VIEW_HELP_FILE   "view.help"

Definition at line 38 of file common.h.

◆ VIEW_PRT_FILE

#define VIEW_PRT_FILE   "prtout"

Definition at line 39 of file common.h.

Typedef Documentation

◆ Form

typedef Form Form

Definition at line 105 of file common.h.

◆ Menu

typedef Menu Menu

Definition at line 104 of file common.h.

◆ Pick

typedef Pick Pick

Definition at line 106 of file common.h.

◆ View

typedef View View

Definition at line 107 of file common.h.

Enumeration Type Documentation

◆ Caller

enum Caller
Enumerator
VIEW 
FORM 
PICK 
MENU 

Definition at line 78 of file common.h.

78 {
79 VIEW,
80 FORM,
81 PICK,
82 MENU
83} Caller;
Caller
Definition common.h:78
@ FORM
Definition common.h:80
@ MENU
Definition common.h:82
@ VIEW
Definition common.h:79
@ PICK
Definition common.h:81

◆ OptGroup

enum OptGroup

option groups

Enumerator
OG_FILES 
OG_DIRS 
OG_SPECS 
OG_MISC 
OG_PARMS 
OG_FLAGS 
OG_COL 

Definition at line 94 of file common.h.

94 {
96 OG_DIRS,
98 OG_MISC,
100 OG_FLAGS,
101 OG_COL
102} OptGroup;
OptGroup
option groups
Definition common.h:94
@ OG_FILES
Definition common.h:95
@ OG_DIRS
Definition common.h:96
@ OG_SPECS
Definition common.h:97
@ OG_MISC
Definition common.h:98
@ OG_FLAGS
Definition common.h:100
@ OG_PARMS
Definition common.h:99
@ OG_COL
Definition common.h:101

◆ OptType

enum OptType

option types

Enumerator
OT_STRING 
OT_INT 
OT_BOOL 
OT_HEX 

Definition at line 86 of file common.h.

86 {
88 OT_INT,
89 OT_BOOL,
90 OT_HEX,
91} OptType;
OptType
option types
Definition common.h:86
@ OT_INT
Definition common.h:88
@ OT_BOOL
Definition common.h:89
@ OT_HEX
Definition common.h:90
@ OT_STRING
Definition common.h:87

Function Documentation

◆ cmd_processor()

int cmd_processor ( Init * )
extern

◆ cmenu_abend()

void cmenu_abend ( Init * init,
int ec,
char * s )

Definition at line 94 of file menu.c.

94 {
95 cmenu_shutdown(init);
98 fprintf(stderr, _("\n\nABEND: %s (code: %d)\n"), s, ec);
99 exit(EXIT_FAILURE);
100}
void cmenu_shutdown(Init *init)
Definition menu.c:88
#define _(String)
Definition amort.c:23
bool restore_shell_tioctl()
restore_shell_tioctl() - restore shell terminal settings
Definition scriou.c:57
void sig_dfl_mode()
Set signal handlers to default behavior.
Definition sig.c:41

References cmenu_shutdown(), restore_shell_tioctl(), and sig_dfl_mode().

Referenced by view_init_input().

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

◆ cmenu_shutdown()

void cmenu_shutdown ( Init * init)

Definition at line 88 of file menu.c.

88 {
89 destroy_view(init);
91 destroy_init(init);
92}
void ui_shutdown()
Shutdown the UI runtime, cleaning up resources and freeing memory.
Definition ui_ncurses.c:418
View * destroy_view(Init *init)
Destroy View structure.
Definition mem.c:337

References destroy_init(), destroy_view(), and ui_shutdown().

Referenced by cmenu_abend().

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

◆ destroy_view_win()

void destroy_view_win ( Init * )
extern

◆ open_pick_win()

int open_pick_win ( Init * init)
extern

Definition at line 247 of file pick_engine.c.

247 {
248 uint maxy, maxx;
249 uint whitespace_ratio = 15;
250 uint usable_lines;
251 uint pick_ratio = 50;
252 uint tbl_max_cols, pg_max_objs;
253
254 Pick *pick = init->pick;
255 ui_get_screen_size(&maxy, &maxx);
256 // Screen Geometry
257 // Calculate pick window size and position based on terminal size and pick
258 // parameters
259 //
260 // Calculate line usage:
261 if (pick->begy == 0)
262 pick->begy = (maxy * whitespace_ratio) / 200;
263 usable_lines = maxy - (maxy * whitespace_ratio) / 100;
264 usable_lines -= pick->begy;
265 usable_lines -= 5; // Pick overhead lines
266 if (pick->p_view_files) {
267 if (pick->lines == 0) {
268 pick->lines = usable_lines * pick_ratio / 100;
269 usable_lines -= pick->lines;
270 }
271 init->begy = pick->begy + 5 + pick->lines;
272 init->begx = 0;
273 usable_lines -= 3; // View overhead lines
274 init->lines = usable_lines;
275 init->cols = maxx - 2;
276 } else if (pick->lines == 0)
277 pick->lines = usable_lines;
278
279 pick->tbl_col_width = max(pick->tbl_col_width, 4);
280 pick->tbl_col_width = min(pick->tbl_col_width, (maxx - (2 + pick->begx)));
281 pick->m_idx = 0; // master index
282 pick->d_idx = 0; // display index
283 while (pick->m_idx < pick->m_cnt)
284 pick->d_object[pick->d_idx++] = pick->m_object[pick->m_idx++];
285 pick->d_cnt = pick->d_idx;
286 if (pick->d_cnt <= pick->lines) {
287 pick->tbl_lines = pick->d_cnt;
288 pick->lines = pick->d_cnt;
289 pick->tbl_cols = 1;
290 } else {
291 tbl_max_cols = ((maxx - (2 + pick->begx)) / (pick->tbl_col_width + 1));
292 pg_max_objs = pick->lines * tbl_max_cols;
293 if (pick->d_cnt > pg_max_objs)
294 pick->tbl_cols = tbl_max_cols;
295 else
296 pick->tbl_cols = pick->d_cnt / pick->lines;
297 pick->tbl_lines = pick->d_cnt / tbl_max_cols;
298 }
299 pick->tbl_pages = (pick->tbl_lines / (pick->lines - 1)) + 1;
300 // pick->lines = (pick->tbl_lines + pick->tbl_pages - 1) / pick->tbl_pages;
301 pick->tbl_page = 0;
302 // if (pick->begy == 0)
303 // pick->begy = (LINES - pick->lines) / 5;
304 // else if (pick->begy + pick->lines > LINES - 4)
305 // pick->begy = LINES - pick->lines - 2;
306 pick->width = (pick->tbl_col_width + 1) * pick->tbl_cols;
307
308 pick->width = max(pick->width, 60);
309 char tmp_str[MAXLEN];
310
311 int ui_split_win_lines = 2;
312 if (ui_tracked_sfc_split_box(pick->lines, pick->width, ui_split_win_lines, 0, pick->begy, pick->begx, pick->title)) {
313 ssnprintf(tmp_str, MAXLEN - 1, "ui_tracked_sfc_split_box(%d, %d, %d, %d, %d, %d, %s) failed",
314 pick->lines, pick->width, ui_split_win_lines, 0, pick->begy, pick->begx, pick->title);
315 ui_perror(tmp_str);
316 return (1);
317 }
318 pick->surface = ui_surface[sfc_ptr];
319 UiSurface *sfc = pick->surface;
320 ui_setscrreg(sfc, WIN, 0, pick->lines - 1);
321 ui_scrollok(sfc, WIN, true);
322 ui_keypad(sfc, WIN, true);
323 pick->separator_line = pick->lines + 1;
324
325 pick->x = 1;
326
327 pick->chyron = ui_new_chyron(pick->surface, WIN2);
328 ui_set_chyron_key(pick->chyron, 1, _("F1 Help"), UIKEY_F01);
329 ui_set_chyron_key(pick->chyron, 2, _("F9 Cancel"),
330 UIKEY_F09);
331 ui_set_chyron_key(pick->chyron, 3, _("F10 Accept"),
332 UIKEY_F10);
333 ui_set_chyron_key(pick->chyron, 4, _("F11 View"),
334 UIKEY_F11);
335 ui_set_chyron_key(pick->chyron, 5, _("<q> Quit View"),
336 'q');
337 ui_set_chyron_key(pick->chyron, 6, _("<Sp> Process"), ' ');
338 ui_set_chyron_key(pick->chyron, 7, _("<Sp> Edit"), ' ');
339 ui_set_chyron_key(pick->chyron, 9, _("<Tab> Search"),
340 '\t');
341 ui_set_chyron_key(pick->chyron, 10, _("<Tab> Select"),
342 '\t');
343 ui_set_chyron_key(pick->chyron, 11, "PgUp",
345 ui_set_chyron_key(pick->chyron, 12, "PgDn",
347 ui_set_chyron_key(pick->chyron, 13, "INS", UIKEY_IC);
349 ui_compile_chyron(pick->chyron);
350 return 0;
351}
#define min(x, y)
min macro evaluates two expressions, returning least result
Definition cm.h:104
#define max(a, b)
max macro evaluates two expressions, returning greatest result.
Definition cm.h:97
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.
Definition ui_common.c:425
int ui_setscrreg(UiSurface *s, ss_t w, uint top, uint bottom)
Set the scrolling region for a UiSurface.
Definition ui_ncurses.c:820
void ui_get_screen_size(uint *lines, uint *cols)
Get the current screen size (number of lines and columns).
Definition ui_ncurses.c:722
int sfc_ptr
Definition ui_ncurses.c:42
int ui_scrollok(UiSurface *s, ss_t w, bool enable)
Enable or disable scrolling for a UiSurface.
Definition ui_ncurses.c:755
int ui_keypad(UiSurface *s, ss_t w, bool enable)
Enable or disable the keypad for a UiSurface.
Definition ui_ncurses.c:771
#define UIKEY_F09
#define UIKEY_IC
#define UIKEY_PPAGE
#define UIKEY_F01
#define UIKEY_F10
#define UIKEY_F11
#define UIKEY_NPAGE
void ui_set_chyron_key(UiChyron *chyron, uint k, char *s, uint kc)
Set chyron key with default color pair (cp_nt_rev).
Definition ui_common.c:717
UiChyron * ui_new_chyron(UiSurface *sfc, ss_t w)
Create new chyron structure.
Definition ui_common.c:601
void ui_compile_chyron(UiChyron *chyron)
construct the chyron string from the chyron structure
Definition ui_common.c:782
UiSurface * ui_surface[UI_SFC_MAX]
Definition ui_ncurses.c:40
Pick * pick
Definition mem.c:36
#define MAXLEN
Definition curskeys.c:15
size_t ssnprintf(char *, size_t, const char *,...)
ssnprintf was designed to be a safer alternative to snprintf.
Definition futil.c:390
void pick_std_chyron(Pick *)
Sets standard chyron key states based on pick structure.
int ui_perror(char *emsg_str)
Display a simple error message window or print to stderr.
Definition ui_common.c:1257
int begx
Definition common.h:121
int cols
Definition common.h:119
int begy
Definition common.h:120
int lines
Definition common.h:118
Pick * pick
Definition common.h:191
Pick data structure.
Definition pick.h:25

References Init::begx, Pick::begx, Init::begy, Pick::begy, Pick::chyron, Init::cols, Pick::d_cnt, Pick::d_idx, Pick::d_object, Init::lines, Pick::lines, Pick::m_cnt, Pick::m_idx, Pick::m_object, Pick::p_view_files, Init::pick, pick_std_chyron(), Pick::separator_line, sfc_ptr, ssnprintf(), Pick::surface, Pick::tbl_col_width, Pick::tbl_cols, Pick::tbl_lines, Pick::tbl_page, Pick::tbl_pages, Pick::title, ui_compile_chyron(), ui_get_screen_size(), ui_keypad(), ui_new_chyron(), ui_perror(), ui_scrollok(), ui_set_chyron_key(), ui_setscrreg(), ui_surface, ui_tracked_sfc_split_box(), Pick::width, and Pick::x.

Referenced by init_pick().

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

◆ pick_engine()

int pick_engine ( Init * init)
extern

Enter picker loop to handle user input and interactions

< Buffer for user input in the field

Definition at line 353 of file pick_engine.c.

353 {
354 int rc = 0;
355 bool f_processed = false;
356 Pick *pick = init->pick;
359 char field[MAXLEN];
360 field[0] = '\0';
362 do {
363 rc = picker(init, field);
364 if (rc == UIKEY_F09)
365 break;
366 if (rc == -1)
367 break;
368 else {
369 if (pick->select_cnt > 0) {
370 if (pick->f_out_spec && pick->out_spec[0]) {
372 f_processed = true;
373 }
374 if (pick->f_cmd && pick->cmd[0]) {
375 exec_objects(init);
376 f_processed = true;
377 }
378 if (pick->f_read_theme) {
379 read_theme(init);
380 f_processed = true;
381 }
382 if (f_processed) {
383 ui_mvwaddstr(pick->surface, WIN2, 0, 0, _("Selection Processed"));
384 ui_wclrtoeol(pick->surface, WIN2);
385 }
386 }
387 }
389 } while (1);
390 ui_destroy_chyron(pick->chyron);
391 return (rc);
392}
int ui_wclrtoeol(UiSurface *s, ss_t w)
Clear to the end of the line in a surface window.
UiChyron * ui_destroy_chyron(UiChyron *chyron)
Destroy UiChyron structure.
Definition ui_common.c:656
int ui_mvwaddstr(UiSurface *s, ss_t w, uint y, uint x, const char *text)
Draw a text string at a specific position in a surface window.
int read_theme(Init *)
int picker(Init *, char *field)
Main loop for handling user input and interactions in the pick interface.
int output_objects(Pick *)
Outputs selected objects to specified output file.
void deselect_object(Pick *)
Deselects the currently selected object in pick window.
void display_pick_page(Pick *)
Displays current page of objects in pick window.
int exec_objects(Init *)
Executes specified command with selected objects as arguments.

References Pick::chyron, Pick::cmd, deselect_object(), display_pick_page(), exec_objects(), Pick::f_cmd, Pick::f_out_spec, Pick::f_read_theme, Pick::out_spec, output_objects(), Init::pick, picker(), read_theme(), Pick::select_cnt, Pick::surface, ui_destroy_chyron(), ui_mvwaddstr(), and ui_wclrtoeol().

Referenced by init_pick().

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

◆ popup_ckeys()

int popup_ckeys ( )
extern

Definition at line 31 of file curskeys.c.

31 {
32
33 char Title[] = _("TEST CURSES KEYS");
34 unsigned lines = 10;
35 unsigned cols = 55;
36 char tmp[MAXLEN];
37 uint maxy, maxx;
38 ui_get_screen_size(&maxy, &maxx);
39 uint begy = (maxy - lines) / 3;
40 uint begx = (maxx - cols) / 2;
41 if (ui_tracked_sfc_box(lines, cols, begy, begx, Title)) {
42 strnz__cpy(tmp, _("ui_tracked_sfc_box failed: "), MAXLEN - 1);
43 strnz__cat(tmp, Title, MAXLEN - 1);
44 ui_perror(tmp);
45 exit(EXIT_FAILURE);
46 }
48 ui_keypad(sfc, WIN, true);
49 ui_bkgdset(sfc, WIN, &cell_nt_rev);
50 ui_mvwaddstr(sfc, WIN, lines - 1, 0, _(" <ALT>END to exit "));
51 ui_bkgdset(sfc, WIN, &cell_nt);
52 ui_mvwaddstr(sfc, WIN, 1, 4, _("Press a key or activate the mouse:"));
53#ifdef UAL_UI
54 ncurses_input(sfc, WIN);
55#else
56 notcurses_input(sfc, WIN);
57#endif
58 return 0;
59}
UiCell cell_nt
Definition ui_common.c:106
int ui_tracked_sfc_box(uint wlines, uint wcols, uint wbegy, uint wbegx, const char *wtitle)
Create a new surface with a box window.
Definition ui_common.c:387
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:941
UiCell cell_nt_rev
Definition ui_common.c:107
int notcurses_input(UiSurface *s, uint w)
Display Curses Keys Responds to curses keys and mouse events, displaying the key code and description...
Definition curskeys.c:594
size_t strnz__cpy(char *, const char *, size_t)
safer alternative to strncpy
Definition whence.c:291
size_t strnz__cat(char *, const char *, size_t)
safer alternative to strncat
Definition whence.c:320

References cell_nt, cell_nt_rev, sfc_ptr, strnz__cat(), strnz__cpy(), ui_bkgdset(), ui_get_screen_size(), ui_keypad(), ui_mvwaddstr(), ui_perror(), ui_surface, and ui_tracked_sfc_box().

Referenced by main(), and menu_cmd_processor().

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

◆ popup_form()

int popup_form ( Init * init,
int argc,
char ** argv,
uint by,
uint bx )
extern

instantiate a form popup window

Parameters
initthe Init struct pointer
argcthe number of command line arguments
argvthe command line arguments
bythe y coordinate for the form window
bxthe x coordinate for the form window

by and bx may be set as command line option arguments, in which case, they will take precedence over arguments passed in the function arguments.

 by, and bx may be set by
    1. the calling function
       or
    2. command line arguments
 Non-zero command line arguments will override the calling function's
arguments.

Definition at line 113 of file popups.c.

113 {
114 int rc;
115 zero_opt_args(init);
116 parse_opt_args(init, argc, argv);
117 Form *sav_form = init->form;
118 init->form = nullptr;
119 rc = init_form(init, init->argc, init->argv, by, bx);
120 destroy_form(init);
121 init->form = sav_form;
122 return rc;
123}
int init_form(Init *, int, char **, uint, uint)
Initialize form data structure and parse description file.
Definition form_engine.c:61
int parse_opt_args(Init *, int, char **)
Parse command-line options and set Init struct values accordingly.
Definition init.c:622
void zero_opt_args(Init *)
Initialize optional arguments in the Init struct to default values.
Definition init.c:637
Form * destroy_form(Init *init)
Destroy Form structure.
Definition mem.c:267
Form * form
Definition common.h:189
int argc
Definition common.h:133
char ** argv
Definition common.h:134
Definition form.h:146

References Init::argc, Init::argv, destroy_form(), Init::form, init_form(), parse_opt_args(), and zero_opt_args().

Referenced by enter_file_spec(), and menu_cmd_processor().

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

◆ popup_menu()

int popup_menu ( Init * init,
int argc,
char ** argv,
uint by,
uint bx )
extern

instantiate a menu popup window

Parameters
initthe Init struct pointer
argcthe number of command line arguments
argvthe command line arguments
bythe y coordinate for the menu window
bxthe x coordinate for the menu window

by and bx may be set as command line option arguments, in which case, they will take precedence over arguments passed in the function arguments.

 by, and bx may be set by
    1. the calling function
       or
    2. command line arguments
 Non-zero command line arguments will override the calling function's
arguments.

Definition at line 53 of file popups.c.

53 {
54 int rc;
55 zero_opt_args(init);
56 parse_opt_args(init, argc, argv);
57 Menu *sav_menu = init->menu;
58 init->menu = nullptr;
59 init->menu = new_menu(init, init->argc, init->argv, by, bx);
60 rc = menu_engine(init);
61 destroy_menu(init);
62 init->menu = sav_menu;
63 return rc;
64}
Menu * new_menu(Init *init, int argc, char **argv, uint begy, uint begx)
Create and initialize Menu structure.
Definition mem.c:126
Menu * destroy_menu(Init *init)
Destroy Menu structure.
Definition mem.c:147
unsigned int menu_engine(Init *)
The main loop of the menu system.
Definition menu_engine.c:36
Menu * menu
Definition common.h:187
The Menu structure is the main data structure for the menu application, containing all the informatio...
Definition menu.h:104

References Init::argc, Init::argv, destroy_menu(), Init::menu, menu_engine(), new_menu(), parse_opt_args(), and zero_opt_args().

Referenced by menu_cmd_processor().

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

◆ popup_pick()

int popup_pick ( Init * init,
int argc,
char ** argv,
uint by,
uint bx )
extern

instantiate a pick popup window

Parameters
initthe Init struct pointer
argcthe number of command line arguments
argvthe command line arguments
bythe y coordinate for the pick window
bxthe x coordinate for the pick window

by and bx may be set as command line option arguments, in which case, they will take precedence over arguments passed in the function arguments.

 by, and bx may be set by
    1. the calling function
       or
    2. command line arguments
 Non-zero command line arguments will override the calling function's
arguments.

Definition at line 83 of file popups.c.

83 {
84 int rc;
85 zero_opt_args(init);
86 parse_opt_args(init, argc, argv);
87 Pick *sav_pick = init->pick;
88 init->pick = nullptr;
89
90 rc = init_pick(init, init->argc, init->argv, by, bx);
91 destroy_pick(init);
92 init->pick = sav_pick;
93 return rc;
94}
Pick * destroy_pick(Init *init)
Destroy Pick structure.
Definition mem.c:217
int init_pick(Init *, int, char **, uint, uint)
Initializes pick structure and opens pick input file or pipe.
Definition pick_engine.c:68

References Init::argc, Init::argv, destroy_pick(), init_pick(), parse_opt_args(), Init::pick, and zero_opt_args().

Referenced by menu_cmd_processor().

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

◆ popup_view()

int popup_view ( Init * init,
int argc,
char ** argv,
uint ilines,
uint icols,
uint by,
uint bx )
extern

instantiate a view popup window

Parameters
initthe Init struct pointer
argcthe number of command line arguments
argvthe command line arguments
ilinesthe number of lines for the view window
icolsthe number of columns for the view window
bythe y coordinate for the view window
bxthe x coordinate for the view window

ilines, cols, by, and bx may also be set as command line option arguments, in which case, they will take precedence over arguments passed in the function arguments.

 ilines, cols, by, and bx may be set by
    1. the calling function
       or
    2. command line arguments
 Non-zero command line arguments will override the calling function's
arguments.

Definition at line 145 of file popups.c.

146 {
147 int rc = 0;
148 zero_opt_args(init);
149 parse_opt_args(init, argc, argv);
150 // view_stack_push(&view_stack, *init->view);
151 View *view_sav = init->view;
152 init->view = nullptr;
153 View *view = nullptr;
154 view = nullptr;
155 view = new_view(init);
156
157 if (init->lines > 0 && init->cols > 0) {
158 ilines = init->lines;
159 icols = init->cols;
160 }
161 if (init->begy > 0 || init->begx > 0) {
162 by = init->begy;
163 bx = init->begx;
164 }
165 view->begy = by;
166 view->begx = bx;
167 view->lines = ilines;
168 view->cols = icols;
169 view->f_full_screen = false;
170 if (!init_view_boxwin(init))
171 rc = view_file(init);
172 destroy_view(init);
173 init->view = view_sav;
174 // view_stack_pop(&view_stack, init->view);
175 return rc;
176}
View * view
Definition mem.c:38
int init_view_boxwin(Init *init)
Initialize the C-Menu View in box window mode.
Definition init_view.c:162
View * new_view(Init *init)
Create and initialize View structure.
Definition mem.c:291
int view_file(Init *)
Start view.
View * view
Definition common.h:193
Definition view.h:59

References Init::begx, View::begx, Init::begy, View::begy, Init::cols, View::cols, destroy_view(), View::f_full_screen, init_view_boxwin(), Init::lines, View::lines, new_view(), parse_opt_args(), Init::view, view_file(), and zero_opt_args().

Referenced by display_pick_help(), exec_objects(), form_engine(), form_exec_receiver(), menu_cmd_processor(), and view_display_help().

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

◆ process_config_file()

int process_config_file ( char * ,
Init *  )
extern

Definition at line 694 of file init.c.

694 {
695 char include_file_name[MAXLEN];
696 char tmp_str[MAXLEN];
697 char *src_p, *dp;
698 SIO *sio = init->sio;
699 char hex_clr_str[8];
700 char key[MAXLEN];
701 char value[MAXLEN];
702 FILE *config_fp = fopen(config_file_name, "r");
703 char quote_char = '\0';
704 if (!config_fp) {
705 fprintf(stderr, "failed to read file: %s %s\n", config_file_name, strerror(errno));
706 return (-1);
707 }
708 while (fgets(tmp_str, sizeof(tmp_str), config_fp)) {
709 bool inquotes = false;
710 if (tmp_str[0] == '#')
711 continue;
712 src_p = tmp_str;
713 key[0] = '\0';
714 dp = key;
715 // copy delimited by "=" into value
716 while (*src_p != '\0') {
717 if (*src_p == '\n')
718 *dp = *src_p = '\0';
719 if (*src_p == '=') {
720 *dp = '\0';
721 src_p++;
722 break;
723 }
724 if (*src_p == '"' && *src_p == ' ') {
725 src_p++;
726 continue;
727 }
728 *dp++ = *src_p++;
729 }
730 value[0] = '\0';
731 dp = value;
732 // copy delimited by newline or unquoted "#" into value, removing quotes, spaces, semicolons, and newlines, but respecting quotes
733 while (*src_p != '\0') {
734 if ((*src_p == '"' || *src_p == '\'') && (*(src_p + 1) != '\\')) {
735 if (!inquotes) {
736 inquotes = true;
737 quote_char = *src_p++;
738 } else if (*src_p == quote_char) {
739 inquotes = false;
740 quote_char = '\0';
741 }
742 }
743 if (!inquotes) {
744 if (*src_p == '#') {
745 if (unstr_hex_clr(hex_clr_str, src_p)) {
746 strnz__cpy(value, hex_clr_str, MAXLEN - 1);
747 dp = value + strlen(value);
748 }
749 break;
750 }
751 }
752 if (*src_p == ' ' || *src_p == ';') {
753 src_p++;
754 continue;
755 }
756 if (*src_p == '\n') {
757 *src_p = '\0';
758 break;
759 }
760 *dp++ = *src_p++;
761 }
762 *dp = '\0';
763 if (key[0] == '\0')
764 continue;
765 if (value[0] == '\0')
766 continue;
767 if (!strcmp(key, "include")) {
768 strnz__cpy(include_file_name, value, MAXLEN - 1);
769 expand_tilde(include_file_name, MAXLEN - 1);
770 process_config_file(include_file_name, init);
771 continue;
772 }
773 if (!strcmp(key, "minitrc")) {
774 strnz__cpy(init->minitrc, value, MAXLEN - 1);
775 continue;
776 }
777 if (!strcmp(key, "lines")) {
778 init->lines = atoi(value);
779 continue;
780 }
781 if (!strcmp(key, "cols")) {
782 init->cols = atoi(value);
783 continue;
784 }
785 if (!strcmp(key, "begy")) {
786 init->begy = atoi(value);
787 continue;
788 }
789 if (!strcmp(key, "begx")) {
790 init->begx = atoi(value);
791 continue;
792 }
793 if (!strcmp(key, "f_ln")) {
794 init->f_ln = str_to_bool(value);
795 continue;
796 }
797 if (!strcmp(key, "f_at_end_remove")) {
798 init->f_at_end_remove = str_to_bool(value);
799 continue;
800 }
801 if (!strcmp(key, "f_erase_remainder")) {
802 init->f_erase_remainder = str_to_bool(value);
803 continue;
804 }
805 if (!strcmp(key, "brackets")) {
806 strnz__cpy(init->brackets, value, 2);
807 continue;
808 }
809 if (!strcmp(key, "fill_char")) {
810 if (strlen(value) > 1)
811 value[1] = '\0';
812 if (wcwidth((int)value[0]) > 1)
813 value[0] = '?';
814 strnz__cpy(init->fill_char, value, 4);
815 continue;
816 }
817 if (!strcmp(key, "f_ignore_case")) {
818 init->f_ignore_case = str_to_bool(value);
819 continue;
820 }
821 if (!strcmp(key, "p_view_files")) {
822 init->p_view_files = str_to_bool(value);
823 continue;
824 }
825 if (!strcmp(key, "f_read_theme")) {
826 init->f_read_theme = str_to_bool(value);
827 continue;
828 }
829 if (!strcmp(key, "f_squeeze")) {
830 init->f_squeeze = str_to_bool(value);
831 continue;
832 }
833 if (!strcmp(key, "f_strip_ansi")) {
834 init->f_strip_ansi = str_to_bool(value);
835 continue;
836 }
837 if (!strcmp(key, "f_multiple_cmd_args")) {
838 init->f_multiple_cmd_args = str_to_bool(value);
839 continue;
840 }
841 if (!strcmp(key, "select_max")) {
842 init->select_max = atoi(value);
843 continue;
844 }
845 if (!strcmp(key, "tab_stop")) {
846 init->tab_stop = atoi(value);
847 continue;
848 }
849 if (!strcmp(key, "timeout_secs")) {
850 init->timeout_secs = atoi(value);
851 continue;
852 }
853 if (!strcmp(key, "h_shift")) {
854 init->h_shift = atoi(value);
855 continue;
856 }
857 if (!strcmp(key, "wrap")) {
858 init->wrap = str_to_bool(value);
859 continue;
860 }
861 if (!strcmp(key, "title")) {
862 strnz__cpy(init->title, value, MAXLEN - 1);
863 continue;
864 }
865 if (!strcmp(key, "cmd")) {
866 strnz__cpy(init->cmd, value, MAXLEN - 1);
867 continue;
868 }
869 if (!strcmp(key, "cmd_all")) {
870 strnz__cpy(init->cmd_all, value, MAXLEN - 1);
871 continue;
872 }
873 if (!strcmp(key, "parent_cmd")) {
874 strnz__cpy(init->parent_cmd, value, MAXLEN - 1);
875 continue;
876 }
877 if (!strcmp(key, "provider_cmd")) {
878 strnz__cpy(init->provider_cmd, value, MAXLEN - 1);
879 continue;
880 }
881 if (!strcmp(key, "receiver_cmd")) {
882 strnz__cpy(init->receiver_cmd, value, MAXLEN - 1);
883 continue;
884 }
885 if (!strcmp(key, "editor")) {
886 strnz__cpy(init->editor, value, MAXLEN - 1);
887 continue;
888 }
889 if (!strcmp(key, "border")) {
890 char c = value[0];
891 if (c == 'r' || c == 'R')
892 sio->border = 'r';
893 else if (c == 's' || c == 'S')
894 sio->border = 's';
895 else if (c == 'd' || c == 'D')
896 sio->border = 'd';
897 else if (c == 'h' || c == 'H')
898 sio->border = 'h';
899 else
900 sio->border = 'n';
901 continue;
902 }
903 if (!strcmp(key, "fg")) {
904 sscanf(value, "#%06x", &sio->fg);
905 continue;
906 }
907 if (!strcmp(key, "bg")) {
908 sscanf(value, "#%06x", &sio->bg);
909 continue;
910 }
911 if (!strcmp(key, "box_fg")) {
912 sscanf(value, "#%06x", &sio->fg);
913 continue;
914 }
915 if (!strcmp(key, "box_bg")) {
916 sscanf(value, "#%06x", &sio->box_bg);
917 continue;
918 }
919 if (!strcmp(key, "ind_fg")) {
920 sscanf(value, "#%06x", &sio->ind_fg);
921 continue;
922 }
923 if (!strcmp(key, "ind_bg")) {
924 sscanf(value, "#%06x", &sio->ind_bg);
925 continue;
926 }
927 if (!strcmp(key, "brackets_fg")) {
928 sscanf(value, "#%06x", &sio->brackets_fg);
929 continue;
930 }
931 if (!strcmp(key, "brackets_bg")) {
932 sscanf(value, "#%06x", &sio->brackets_bg);
933 continue;
934 }
935 if (!strcmp(key, "fill_char_fg")) {
936 sscanf(value, "#%06x", &sio->fill_char_fg);
937 continue;
938 }
939 if (!strcmp(key, "fill_char_bg")) {
940 sscanf(value, "#%06x", &sio->fill_char_bg);
941 continue;
942 }
943 if (!strcmp(key, "ln_fg")) {
944 sscanf(value, "#%06x", &sio->ln_fg);
945 continue;
946 }
947 if (!strcmp(key, "ln_bg")) {
948 sscanf(value, "#%06x", &sio->ln_bg);
949 continue;
950 }
951 if (!strcmp(key, "cmdln_fg")) {
952 sscanf(value, "#%06x", &sio->cmdln_fg);
953 continue;
954 }
955 if (!strcmp(key, "cmdln_bg")) {
956 sscanf(value, "#%06x", &sio->cmdln_bg);
957 continue;
958 }
959 if (!strcmp(key, "nt_fg")) {
960 sscanf(value, "#%06x", &sio->nt_fg);
961 continue;
962 }
963 if (!strcmp(key, "nt_bg")) {
964 sscanf(value, "#%06x", &sio->nt_bg);
965 continue;
966 }
967 if (!strcmp(key, "nt_rev_fg")) {
968 sscanf(value, "#%06x", &sio->nt_rev_fg);
969 continue;
970 }
971 if (!strcmp(key, "nt_rev_bg")) {
972 sscanf(value, "#%06x", &sio->nt_rev_bg);
973 continue;
974 }
975 if (!strcmp(key, "nt_hl_fg")) {
976 sscanf(value, "#%06x", &sio->nt_hl_fg);
977 continue;
978 }
979 if (!strcmp(key, "nt_hl_bg")) {
980 sscanf(value, "#%06x", &sio->nt_hl_bg);
981 continue;
982 }
983 if (!strcmp(key, "nt_hl_rev_fg")) {
984 sscanf(value, "#%06x", &sio->nt_hl_rev_fg);
985 continue;
986 }
987 if (!strcmp(key, "nt_hl_rev_bg")) {
988 sscanf(value, "#%06x", &sio->nt_hl_rev_bg);
989 continue;
990 }
991 if (!strcmp(key, "title_fg")) {
992 sscanf(value, "#%06x", &sio->title_fg);
993 continue;
994 }
995 if (!strcmp(key, "title_bg")) {
996 sscanf(value, "#%06x", &sio->title_bg);
997 continue;
998 }
999 if (!strcmp(key, "ran_fg")) {
1000 sscanf(value, "#%06x", &sio->ran_fg);
1001 continue;
1002 }
1003 if (!strcmp(key, "ran_bg")) {
1004 sscanf(value, "#%06x", &sio->ran_bg);
1005 continue;
1006 }
1007 if (!strcmp(key, "red_gamma")) {
1008 sio->red_gamma = str_to_double(value);
1009 continue;
1010 }
1011 if (!strcmp(key, "green_gamma")) {
1012 sio->green_gamma = str_to_double(value);
1013 continue;
1014 }
1015 if (!strcmp(key, "blue_gamma")) {
1016 sio->blue_gamma = str_to_double(value);
1017 continue;
1018 }
1019 if (!strcmp(key, "gray_gamma")) {
1020 sio->gray_gamma = str_to_double(value);
1021 continue;
1022 }
1023 if (!strcmp(key, "black")) {
1024 sscanf(value, "#%06x", &sio->black);
1025 continue;
1026 }
1027 if (!strcmp(key, "red")) {
1028 sscanf(value, "#%06x", &sio->red);
1029 continue;
1030 }
1031 if (!strcmp(key, "green")) {
1032 sscanf(value, "#%06x", &sio->green);
1033 continue;
1034 }
1035 if (!strcmp(key, "yellow")) {
1036 sscanf(value, "#%06x", &sio->yellow);
1037 continue;
1038 }
1039 if (!strcmp(key, "blue")) {
1040 sscanf(value, "#%06x", &sio->blue);
1041 continue;
1042 }
1043 if (!strcmp(key, "magenta")) {
1044 sscanf(value, "#%06x", &sio->magenta);
1045 continue;
1046 }
1047 if (!strcmp(key, "cyan")) {
1048 sscanf(value, "#%06x", &sio->cyan);
1049 continue;
1050 }
1051 if (!strcmp(key, "white")) {
1052 sscanf(value, "#%06x", &sio->white);
1053 continue;
1054 }
1055 if (!strcmp(key, "orange")) {
1056 sscanf(value, "#%06x", &sio->orange);
1057 continue;
1058 }
1059 if (!strcmp(key, "bblack")) {
1060 sscanf(value, "#%06x", &sio->bblack);
1061 continue;
1062 }
1063 if (!strcmp(key, "bred")) {
1064 sscanf(value, "#%06x", &sio->bred);
1065 continue;
1066 }
1067 if (!strcmp(key, "bgreen")) {
1068 sscanf(value, "#%06x", &sio->bgreen);
1069 continue;
1070 }
1071 if (!strcmp(key, "byellow")) {
1072 sscanf(value, "#%06x", &sio->byellow);
1073 continue;
1074 }
1075 if (!strcmp(key, "bblue")) {
1076 sscanf(value, "#%06x", &sio->bblue);
1077 continue;
1078 }
1079 if (!strcmp(key, "bmagenta")) {
1080 sscanf(value, "#%06x", &sio->bmagenta);
1081 continue;
1082 }
1083 if (!strcmp(key, "bcyan")) {
1084 sscanf(value, "#%06x", &sio->bcyan);
1085 continue;
1086 }
1087 if (!strcmp(key, "bwhite")) {
1088 sscanf(value, "#%06x", &sio->bwhite);
1089 continue;
1090 }
1091 if (!strcmp(key, "borange")) {
1092 sscanf(value, "#%06x", &sio->borange);
1093 continue;
1094 }
1095 if (!strcmp(key, "mapp_spec")) {
1096 strnz__cpy(init->mapp_spec, value, MAXLEN - 1);
1097 continue;
1098 }
1099 if (!strcmp(key, "mapp_data")) {
1100 strnz__cpy(init->mapp_data, value, MAXLEN - 1);
1101 continue;
1102 }
1103 if (!strcmp(key, "mapp_help")) {
1104 strnz__cpy(init->mapp_help, value, MAXLEN - 1);
1105 continue;
1106 }
1107 if (!strcmp(key, "mapp_home")) {
1108 strnz__cpy(init->mapp_home, value, MAXLEN - 1);
1109 continue;
1110 }
1111 if (!strcmp(key, "mapp_msrc")) {
1112 strnz__cpy(init->mapp_msrc, value, MAXLEN - 1);
1113 continue;
1114 }
1115 if (!strcmp(key, "mapp_user")) {
1116 strnz__cpy(init->mapp_user, value, MAXLEN - 1);
1117 continue;
1118 }
1119 if (!strcmp(key, "mapp_theme")) {
1120 strnz__cpy(init->mapp_theme, value, MAXLEN - 1);
1121 continue;
1122 }
1123 if (!strcmp(key, "log_file_spec")) {
1124 strnz__cpy(init->log_file_spec, value, MAXLEN - 1);
1125 continue;
1126 }
1127 if (!strcmp(key, "log_level")) {
1128 str_to_upper(value);
1129 if (!strcmp(value, "SILENT"))
1130 init->min_log_level = SILENT;
1131 else if (!strcmp(value, "DEBUG"))
1132 init->min_log_level = DEBUG;
1133 else if (!strcmp(value, "INFO"))
1134 init->min_log_level = INFO;
1135 else if (!strcmp(value, "WARN"))
1136 init->min_log_level = WARN;
1137 else if (!strcmp(value, "ERROR"))
1138 init->min_log_level = ERROR;
1139 else if (!strcmp(value, "FATAL"))
1140 init->min_log_level = FATAL;
1141 else
1142 init->min_log_level = SILENT;
1143 continue;
1144 }
1145 }
1146 (void)fclose(config_fp);
1147 return 0;
1148}
bool str_to_bool(const char *)
Converts String to boolean true or false.
Definition futil.c:960
int process_config_file(char *, Init *)
Definition init.c:694
bool str_to_upper(char *)
Converts a string to uppercase.
Definition futil.c:496
double str_to_double(char *)
converts string to double
Definition futil.c:948
bool expand_tilde(char *, uint)
Replaces "~/" in string with the user's home directory.
Definition futil.c:989
bool unstr_hex_clr(char *, char *)
Validates that a string is a hex color code in the format "#RRGGBB".
Definition futil.c:220
uint32_t ran_bg
Definition ui_backend.h:740
double green_gamma
Definition ui_backend.h:693
uint32_t ln_bg
Definition ui_backend.h:726
double blue_gamma
Definition ui_backend.h:694
uint32_t magenta
Definition ui_backend.h:701
uint32_t cmdln_bg
Definition ui_backend.h:728
uint32_t cmdln_fg
Definition ui_backend.h:727
uint32_t nt_hl_rev_fg
Definition ui_backend.h:735
uint32_t ran_fg
Definition ui_backend.h:739
uint32_t bgreen
Definition ui_backend.h:707
double red_gamma
Definition ui_backend.h:692
uint32_t green
Definition ui_backend.h:698
uint32_t nt_fg
Definition ui_backend.h:729
uint32_t yellow
Definition ui_backend.h:699
uint32_t fill_char_fg
Definition ui_backend.h:723
uint32_t orange
Definition ui_backend.h:704
uint32_t ln_fg
Definition ui_backend.h:725
uint32_t ind_bg
Definition ui_backend.h:720
uint32_t bmagenta
Definition ui_backend.h:710
uint32_t ind_fg
Definition ui_backend.h:719
uint32_t byellow
Definition ui_backend.h:708
uint32_t bblue
Definition ui_backend.h:709
uint32_t borange
Definition ui_backend.h:713
uint32_t title_bg
Definition ui_backend.h:738
uint32_t fg
Definition ui_backend.h:715
uint32_t cyan
Definition ui_backend.h:702
uint32_t bblack
Definition ui_backend.h:705
uint32_t red
Definition ui_backend.h:697
uint32_t nt_hl_rev_bg
Definition ui_backend.h:736
uint32_t title_fg
Definition ui_backend.h:737
uint32_t bred
Definition ui_backend.h:706
uint32_t fill_char_bg
Definition ui_backend.h:724
uint32_t black
Definition ui_backend.h:696
uint32_t nt_rev_bg
Definition ui_backend.h:732
uint32_t brackets_bg
Definition ui_backend.h:722
uint32_t bcyan
Definition ui_backend.h:711
uint32_t nt_bg
Definition ui_backend.h:730
uint32_t blue
Definition ui_backend.h:700
uint32_t brackets_fg
Definition ui_backend.h:721
uint32_t white
Definition ui_backend.h:703
uint32_t box_bg
Definition ui_backend.h:718
uint32_t nt_hl_fg
Definition ui_backend.h:733
uint32_t bwhite
Definition ui_backend.h:712
char border
Definition ui_backend.h:755
uint32_t nt_rev_fg
Definition ui_backend.h:731
double gray_gamma
Definition ui_backend.h:695
uint32_t nt_hl_bg
Definition ui_backend.h:734
uint32_t bg
Definition ui_backend.h:716

References SIO::bblack, SIO::bblue, SIO::bcyan, Init::begx, Init::begy, SIO::bg, SIO::bgreen, SIO::black, SIO::blue, SIO::blue_gamma, SIO::bmagenta, SIO::borange, SIO::border, SIO::box_bg, Init::brackets, SIO::brackets_bg, SIO::brackets_fg, SIO::bred, SIO::bwhite, SIO::byellow, Init::cmd, Init::cmd_all, SIO::cmdln_bg, SIO::cmdln_fg, Init::cols, SIO::cyan, Init::editor, expand_tilde(), Init::f_at_end_remove, Init::f_erase_remainder, Init::f_ignore_case, Init::f_ln, Init::f_multiple_cmd_args, Init::f_read_theme, Init::f_squeeze, Init::f_strip_ansi, SIO::fg, Init::fill_char, SIO::fill_char_bg, SIO::fill_char_fg, SIO::gray_gamma, SIO::green, SIO::green_gamma, Init::h_shift, SIO::ind_bg, SIO::ind_fg, Init::lines, SIO::ln_bg, SIO::ln_fg, Init::log_file_spec, SIO::magenta, Init::mapp_data, Init::mapp_help, Init::mapp_home, Init::mapp_msrc, Init::mapp_spec, Init::mapp_theme, Init::mapp_user, Init::min_log_level, Init::minitrc, 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::orange, Init::p_view_files, Init::parent_cmd, process_config_file(), Init::provider_cmd, SIO::ran_bg, SIO::ran_fg, Init::receiver_cmd, SIO::red, SIO::red_gamma, Init::select_max, Init::sio, str_to_bool(), str_to_double(), str_to_upper(), strnz__cpy(), Init::tab_stop, Init::timeout_secs, Init::title, SIO::title_bg, SIO::title_fg, unstr_hex_clr(), SIO::white, Init::wrap, and SIO::yellow.

Referenced by process_config_file(), process_config_files(), and read_theme().

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

◆ view_boxwin_resize()

void view_boxwin_resize ( Init * init)
extern

Resize the current window and its box.

Parameters
initPointer to the Init structure containing view settings.

This function resizes the current window and its associated box window to the specified number of lines and columns.

Definition at line 198 of file init_view.c.

198 {
199 View *view = init->view;
201 ui_render();
202 init_view_boxwin(init);
203 ui_border_title(init->view->sfc, init->view->title);
204 // initialize_line_table(init->view);
205}
void ui_render()
Render the UI by updating panels and refreshing the display.
Definition ui_ncurses.c:884
void ui_surface_destroy(UiSurface *s)
Destroy a UiSurface, cleaning up its windows and panels.
Definition ui_ncurses.c:468
int ui_border_title(UiSurface *sfc, const char *title)
Draw a box with a title around the specified window.
Definition ui_common.c:563
char title[MAXLEN]
Definition view.h:79
UiSurface * sfc
Definition view.h:89

References init_view_boxwin(), View::sfc, View::title, ui_border_title(), ui_render(), ui_surface_destroy(), and Init::view.

Referenced by view_cmd_processor().

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

◆ view_full_screen_resize()

void view_full_screen_resize ( Init * init)
extern

Resize the full screen view and its components.

Parameters
initPointer to the Init structure containing view settings.

This function resizes the full screen view and its components, including the command line window, line number window, and main content pad. It also recalculates the dimensions for the full screen mode and updates the scroll regions accordingly.

Definition at line 111 of file init_view.c.

111 {
112 ui_erase();
114 ui_log(INFO, _("view_full_screen_resize: lines=%d, cols=%d, ln_win_lines=%d, ln_win_cols=%d, scroll_lines=%d"), init->view->lines, init->view->cols, init->view->ln_win_lines, init->view->ln_win_cols, init->view->scroll_lines);
115 View *view = init->view;
117 ui_render();
119}
int ui_erase()
Erase the entire screen.
Definition ui_ncurses.c:591
int init_view_full_screen(Init *init)
Initialize C-Menu View in full screen mode.
Definition init_view.c:47
void view_calc_full_screen_dimensions(Init *)
Calculate the dimensions for full screen mode.
Definition init_view.c:128
uint lines
Definition view.h:70
uint ln_win_cols
Definition view.h:180
uint scroll_lines
Definition view.h:123
uint cols
Definition view.h:71
uint ln_win_lines
Definition view.h:179

References View::cols, init_view_full_screen(), View::lines, View::ln_win_cols, View::ln_win_lines, View::scroll_lines, View::sfc, ui_erase(), ui_render(), ui_surface_destroy(), Init::view, and view_calc_full_screen_dimensions().

Referenced by view_cmd_processor().

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

◆ view_stack_free()

void view_stack_free ( ViewStack * )
extern

◆ view_stack_init()

bool view_stack_init ( ViewStack * ,
size_t  )
extern

◆ view_stack_peek()

bool view_stack_peek ( const ViewStack * ,
View *  )
extern

◆ view_stack_pop()

bool view_stack_pop ( ViewStack * ,
View *  )
extern

◆ view_stack_push()

bool view_stack_push ( ViewStack * ,
View  )
extern

Variable Documentation

◆ init_cnt

int init_cnt
extern

Definition at line 28 of file mem.c.

Referenced by destroy_init(), and new_init().

◆ minitrc

char minitrc[MAXLEN]
extern

number of Init data structures allocated

◆ view_stack

ViewStack view_stack
extern

Definition at line 32 of file init_view.c.