|
C-Menu 0.2.9
A User Interface Toolkit
|
Functions to Navigate, Select, and Perform Action on Objects. More...
Functions | |
| int | init_pick (Init *init, int argc, char **argv, int begy, int begx) |
| Initializes pick structure and opens pick input file or pipe. | |
| int | read_pick_input (Init *init) |
| Reads pick input from file pointer and saves objects into pick structure. | |
| int | pick_engine (Init *init) |
| Initializes pick interface, calculates window size and position, and enters picker loop. | |
| void | save_object (Pick *pick, char *s) |
| Saves a string as an object in the pick structure. | |
| int | picker (Init *init) |
| Main loop to handle user input and interactions for pick interface. | |
| void | display_page (Pick *pick) |
| Displays current page of objects in pick window. | |
| void | reverse_object (Pick *pick) |
| Reverses the display of the currently selected object in pick window. | |
| void | unreverse_object (Pick *pick) |
| Unreverses the display of the currently selected object in pick window. | |
| void | toggle_object (Pick *pick) |
| Toggles the selection state of the currently selected object in pick window. | |
| void | deselect_object (Pick *pick) |
| Deselects the currently selected object in pick window. | |
| int | output_objects (Pick *pick) |
| Outputs selected objects to specified output file. | |
| int | exec_objects (Init *init) |
| Executes specified command with selected objects as arguments. | |
| int | open_pick_win (Init *init) |
| Initializes the pick window based on the parameters specified in the Pick structure. | |
| void | display_pick_help (Init *init) |
| Displays the help screen for the pick interface using view. | |
Functions to Navigate, Select, and Perform Action on Objects.
| void deselect_object | ( | Pick * | pick | ) |
Deselects the currently selected object in pick window.
like toggle, but only deselects object
Definition at line 696 of file pick_engine.c.
References Pick::f_selected, Pick::obj_idx, Pick::select_cnt, Pick::tbl_col, Pick::tbl_col_width, Pick::win, Pick::x, and Pick::y.
Referenced by pick_engine(), and picker().
| void display_page | ( | Pick * | pick | ) |
Displays current page of objects in pick window.
| pick | Pointer to Pick structure containing objects and display information |
Definition at line 608 of file pick_engine.c.
References Pick::chyron, compile_chyron(), display_chyron(), Pick::f_selected, Chyron::l, mvwaddstr_fill(), Pick::obj_cnt, Pick::object, Pick::pg_lines, Pick::tbl_col_width, Pick::tbl_cols, Pick::tbl_page, Pick::win, and Pick::x.
Referenced by pick_engine(), and picker().
| void display_pick_help | ( | Init * | init | ) |
Displays the help screen for the pick interface using view.
| init | Pointer to Init structure containing pick information |
Definition at line 953 of file pick_engine.c.
References Init::begx, Pick::begx, Init::begy, Pick::begy, Init::cols, destroy_argv(), eargc, eargv, Pick::f_help_spec, Pick::help_spec, Init::lines, Init::mapp_help, pick, popup_view(), strnz__cat(), strnz__cpy(), and Init::title.
Referenced by picker().
| int exec_objects | ( | Init * | init | ) |
Executes specified command with selected objects as arguments.
| init | Pointer to Init structure |
This is the line that gets the selected objects
append arguments onto tmp_str
initialize popup_view arguments and execute popup_view to display command output within pick interface
fork failed, free eargv and return error
Child process to execute command
If execvp returns, it means execution failed, so free eargv and print error message before exiting
Definition at line 765 of file pick_engine.c.
References base_name(), Init::begx, Pick::begx, Init::begy, Pick::begy, Pick::cmd, Init::cols, destroy_argv(), Pick::f_multiple_cmd_args, Pick::f_selected, Init::lines, Pick::obj_cnt, Pick::object, Perror(), pick, popup_view(), rep_substring(), restore_curses_tioctl(), restore_wins(), sig_prog_mode(), str_to_args(), strnz__cat(), strnz__cpy(), and Init::title.
Referenced by pick_engine().
| int init_pick | ( | Init * | init, |
| int | argc, | ||
| char ** | argv, | ||
| int | begy, | ||
| int | begx ) |
Initializes pick structure and opens pick input file or pipe.
| init | Pointer to Init structure |
| argc | Argument count |
| argv | Argument vector |
| begy | Beginning y coordinate for pick window |
| begx | Beginning x coordinate for pick window |
Spawn Child to execute provider_cmd Close read end of pipe as Child only needs to write to pipe
Connect CHILD STDOUT to write end of pipe
STDOUT attached to write end of pipe, so close pipe fd
Return to Parent Close write end of pipe as Parent only needs to read from pipe
Open a file pointer on read end of pipe
No provider_cmd specified, so read pick input from file or stdin
< Initial timeout of 200ms to check for pick input
If user cancels while waiting for pick input, kill provider_cmd child process and close pipe
If error occurs while waiting for pick input, kill provider_cmd child process and close pipe
If timeout occurs while waiting for pick input, kill provider_cmd child process and close pipe
If unexpected error occurs while waiting for pick input, kill provider_cmd child process and close pipe
Wait for provider_cmd child process to finish before proceeding
Enter pick_engine
Definition at line 59 of file pick_engine.c.
References abend(), cmd_key, destroy_argv(), destroy_pick(), Pick::f_in_pipe, Pick::in_fp, Pick::in_spec, new_pick(), Pick::obj_cnt, Perror(), Init::pick, pick_engine(), pipe_fd, Pick::provider_cmd, read_pick_input(), restore_curses_tioctl(), sig_prog_mode(), Init::sio, SIO::stdin_fd, SIO::stdout_fd, str_to_args(), strnz__cat(), strnz__cpy(), wait_continue(), wait_destroy(), wait_mk_chyron(), wait_mk_win(), wait_timeout, waitpid_with_timeout(), Pick::win, and win_del().
Referenced by main(), and popup_pick().
| int open_pick_win | ( | Init * | init | ) |
Initializes the pick window based on the parameters specified in the Pick structure.
| init | Pointer to Init structure containing pick information |
Definition at line 928 of file pick_engine.c.
References Pick::begx, Pick::begy, Pick::box, box_new(), Perror(), Init::pick, pick, ssnprintf(), Pick::title, Pick::win, win_box, Pick::win_lines, win_ptr, Pick::win_width, and win_win.
Referenced by pick_engine().
| int output_objects | ( | Pick * | pick | ) |
Outputs selected objects to specified output file.
| pick | Pointer to Pick structure containing selected objects and output file information |
Definition at line 713 of file pick_engine.c.
References Pick::f_selected, Pick::in_spec, Pick::obj_cnt, Pick::obj_idx, Pick::object, Pick::out_fp, Pick::out_spec, strnz__cat(), and strnz__cpy().
Referenced by pick_engine().
| int pick_engine | ( | Init * | init | ) |
Initializes pick interface, calculates window size and position, and enters picker loop.
| init | Pointer to Init structure containing pick information |
Initialize window and data structures
Initialize key command strings for chyron display
Calculate pick window size and position based on terminal size and pick parameters
Enter picker loop to handle user input and interactions
Definition at line 300 of file pick_engine.c.
References Pick::begx, Pick::begy, Pick::chyron, Pick::cmd, compile_chyron(), deselect_object(), destroy_chyron(), display_page(), exec_objects(), Pick::f_cmd, Pick::f_out_spec, Chyron::l, new_chyron(), Pick::obj_cnt, Pick::obj_idx, open_pick_win(), Pick::out_spec, output_objects(), Pick::pg_lines, pick, picker(), reverse_object(), Chyron::s, Pick::select_cnt, set_chyron_key(), strnz(), Pick::tbl_col_width, Pick::tbl_cols, Pick::tbl_lines, Pick::tbl_page, Pick::tbl_pages, Pick::win_lines, Pick::win_width, and Pick::x.
Referenced by init_pick().
| int picker | ( | Init * | init | ) |
Main loop to handle user input and interactions for pick interface.
| init | Pointer to Init structure |
'q', or KEY_F(9) cancel selection and exit picker
KEY_F(1) or 'H' Displays help screen for pick interface
't' or Space Toggles selection of current object
Enter or KEY_F(10) Accepts current selection and exits picker, returning count of selected objects
KEY_END Moves selection to last object in list
'l' or KEY_RIGHT Moves selection to next object in list
pick->obj_idx += pick->tbl_lines -> next column
'h' or KEY_LEFT or Backspace Moves selection to previous object in list
'j' or KEY_DOWN Moves selection to next object in list, 'k' or KEY_UP Moves selection to previous object in list
'k' or KEY_UP Moves selection to previous object in list
KEY_NPAGE or 'Ctrl+f' Moves selection to next page of objects,
KEY_PPAGE or 'Ctrl+b' Moves selection to previous page of objects
KEY_HOME Moves selection to first object in list
KEY_LL (lower left of numeric pad) Moves selection to last object in list
KEY_MOUSE Handles mouse events for selection and chyron key activation
Set cmdkey to 't' to toggle selection on mouse click
Definition at line 418 of file pick_engine.c.
References Pick::chyron, click_x, click_y, deselect_object(), display_page(), display_pick_help(), mvwaddstr_fill(), Pick::obj_cnt, Pick::obj_idx, Pick::object, Pick::pg_line, Pick::pg_lines, Init::pick, pick, reverse_object(), Pick::select_cnt, Pick::select_max, Pick::tbl_col, Pick::tbl_col_width, Pick::tbl_cols, Pick::tbl_line, Pick::tbl_page, Pick::tbl_pages, toggle_object(), tty_fd, unreverse_object(), Pick::win, Pick::x, xwgetch(), and Pick::y.
Referenced by pick_engine().
| int read_pick_input | ( | Init * | init | ) |
Reads pick input from file pointer and saves objects into pick structure.
| init | Pointer to Init structure containing pick information |
Definition at line 265 of file pick_engine.c.
References Pick::argc, Pick::argv, Pick::in_buf, Pick::in_fp, Pick::obj_cnt, Pick::obj_idx, Pick::pg_lines, Init::pick, save_object(), Pick::select_cnt, Pick::tbl_col, Pick::tbl_cols, Pick::tbl_page, Pick::tbl_pages, Pick::x, and Pick::y.
Referenced by init_pick().
| void reverse_object | ( | Pick * | pick | ) |
Reverses the display of the currently selected object in pick window.
| pick | Pointer to Pick structure containing object and display information |
Definition at line 639 of file pick_engine.c.
References mvwaddstr_fill(), Pick::obj_idx, Pick::object, Pick::pg_lines, Pick::tbl_col, Pick::tbl_col_width, Pick::tbl_cols, Pick::tbl_line, Pick::win, Pick::x, and Pick::y.
Referenced by pick_engine(), and picker().
| void save_object | ( | Pick * | pick, |
| char * | s ) |
Saves a string as an object in the pick structure.
Definition at line 390 of file pick_engine.c.
References Pick::f_selected, Pick::obj_idx, Pick::object, strnz__cpy(), and Pick::tbl_col_width.
Referenced by read_pick_input().
| void toggle_object | ( | Pick * | pick | ) |
Toggles the selection state of the currently selected object in pick window.
| pick | Pointer to Pick structure containing object and selection information |
Definition at line 681 of file pick_engine.c.
References Pick::f_selected, Pick::obj_idx, Pick::select_cnt, Pick::tbl_col, Pick::tbl_col_width, Pick::win, Pick::x, and Pick::y.
Referenced by picker().
| void unreverse_object | ( | Pick * | pick | ) |
Unreverses the display of the currently selected object in pick window.
| pick | Pointer to Pick structure containing object and display information |
Definition at line 661 of file pick_engine.c.
References mvwaddstr_fill(), Pick::obj_idx, Pick::object, Pick::tbl_col, Pick::tbl_col_width, Pick::win, Pick::x, and Pick::y.
Referenced by picker().