1 /* SPDX-License-Identifier: GPL-2.0 */ << 2 /* 1 /* 3 * Copyright (C) 2008 Nir Tzachar <nir.tzachar !! 2 * Copyright (C) 2008 Nir Tzachar <nir.tzachar@gmail.com? >> 3 * Released under the terms of the GNU GPL v2.0. 4 * 4 * 5 * Derived from menuconfig. 5 * Derived from menuconfig. >> 6 * 6 */ 7 */ 7 8 8 #include <ctype.h> 9 #include <ctype.h> 9 #include <errno.h> 10 #include <errno.h> 10 #include <fcntl.h> 11 #include <fcntl.h> 11 #include <limits.h> 12 #include <limits.h> 12 #include <stdarg.h> 13 #include <stdarg.h> 13 #include <stdlib.h> 14 #include <stdlib.h> 14 #include <string.h> 15 #include <string.h> 15 #include <unistd.h> 16 #include <unistd.h> 16 #include <ncurses.h> !! 17 #include <locale.h> >> 18 #include <curses.h> 17 #include <menu.h> 19 #include <menu.h> 18 #include <panel.h> 20 #include <panel.h> 19 #include <form.h> 21 #include <form.h> 20 22 21 #include <stdio.h> 23 #include <stdio.h> 22 #include <time.h> 24 #include <time.h> 23 #include <sys/time.h> 25 #include <sys/time.h> 24 26 >> 27 #include "ncurses.h" >> 28 25 #define max(a, b) ({\ 29 #define max(a, b) ({\ 26 typeof(a) _a = a;\ 30 typeof(a) _a = a;\ 27 typeof(b) _b = b;\ 31 typeof(b) _b = b;\ 28 _a > _b ? _a : _b; }) 32 _a > _b ? _a : _b; }) 29 33 30 #define min(a, b) ({\ 34 #define min(a, b) ({\ 31 typeof(a) _a = a;\ 35 typeof(a) _a = a;\ 32 typeof(b) _b = b;\ 36 typeof(b) _b = b;\ 33 _a < _b ? _a : _b; }) 37 _a < _b ? _a : _b; }) 34 38 35 extern int attr_normal; !! 39 typedef enum { 36 extern int attr_main_heading; !! 40 NORMAL = 1, 37 extern int attr_main_menu_box; !! 41 MAIN_HEADING, 38 extern int attr_main_menu_fore; !! 42 MAIN_MENU_BOX, 39 extern int attr_main_menu_back; !! 43 MAIN_MENU_FORE, 40 extern int attr_main_menu_grey; !! 44 MAIN_MENU_BACK, 41 extern int attr_main_menu_heading; !! 45 MAIN_MENU_GREY, 42 extern int attr_scrollwin_text; !! 46 MAIN_MENU_HEADING, 43 extern int attr_scrollwin_heading; !! 47 SCROLLWIN_TEXT, 44 extern int attr_scrollwin_box; !! 48 SCROLLWIN_HEADING, 45 extern int attr_dialog_text; !! 49 SCROLLWIN_BOX, 46 extern int attr_dialog_menu_fore; !! 50 DIALOG_TEXT, 47 extern int attr_dialog_menu_back; !! 51 DIALOG_MENU_FORE, 48 extern int attr_dialog_box; !! 52 DIALOG_MENU_BACK, 49 extern int attr_input_box; !! 53 DIALOG_BOX, 50 extern int attr_input_heading; !! 54 INPUT_BOX, 51 extern int attr_input_text; !! 55 INPUT_HEADING, 52 extern int attr_input_field; !! 56 INPUT_TEXT, 53 extern int attr_function_text; !! 57 INPUT_FIELD, 54 extern int attr_function_highlight; !! 58 FUNCTION_TEXT, >> 59 FUNCTION_HIGHLIGHT, >> 60 ATTR_MAX >> 61 } attributes_t; >> 62 extern attributes_t attributes[]; 55 63 56 typedef enum { 64 typedef enum { 57 F_HELP = 1, 65 F_HELP = 1, 58 F_SYMBOL = 2, 66 F_SYMBOL = 2, 59 F_INSTS = 3, 67 F_INSTS = 3, 60 F_CONF = 4, 68 F_CONF = 4, 61 F_BACK = 5, 69 F_BACK = 5, 62 F_SAVE = 6, 70 F_SAVE = 6, 63 F_LOAD = 7, 71 F_LOAD = 7, 64 F_SEARCH = 8, 72 F_SEARCH = 8, 65 F_EXIT = 9, 73 F_EXIT = 9, 66 } function_key; 74 } function_key; 67 75 68 void set_colors(void); 76 void set_colors(void); 69 77 70 typedef int (*extra_key_cb_fn)(int, size_t, si << 71 << 72 /* this changes the windows attributes !!! */ 78 /* this changes the windows attributes !!! */ 73 void print_in_middle(WINDOW *win, int y, int w !! 79 void print_in_middle(WINDOW *win, >> 80 int starty, >> 81 int startx, >> 82 int width, >> 83 const char *string, >> 84 chtype color); 74 int get_line_length(const char *line); 85 int get_line_length(const char *line); 75 int get_line_no(const char *text); 86 int get_line_no(const char *text); 76 const char *get_line(const char *text, int lin 87 const char *get_line(const char *text, int line_no); 77 void fill_window(WINDOW *win, const char *text 88 void fill_window(WINDOW *win, const char *text); 78 int btn_dialog(WINDOW *main_window, const char 89 int btn_dialog(WINDOW *main_window, const char *msg, int btn_num, ...); 79 int dialog_inputbox(WINDOW *main_window, 90 int dialog_inputbox(WINDOW *main_window, 80 const char *title, const char 91 const char *title, const char *prompt, 81 const char *init, char **resul 92 const char *init, char **resultp, int *result_len); 82 void refresh_all_windows(WINDOW *main_window); 93 void refresh_all_windows(WINDOW *main_window); 83 int show_scroll_win_ext(WINDOW *main_window, c << 84 int *vscroll, int *hsc << 85 extra_key_cb_fn extra_ << 86 void show_scroll_win(WINDOW *main_window, 94 void show_scroll_win(WINDOW *main_window, 87 const char *title, 95 const char *title, 88 const char *text); 96 const char *text); 89 97
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.