2 #include "../../util/util.h" 6 #include <sys/ttydefaults.h> 8 #include "../../util/cache.h" 9 #include "../../util/debug.h" 10 #include "../browser.h" 11 #include "../keysyms.h" 12 #include "../helpline.h" 15 #include "../libslang.h" 74 const char *exit_msg,
int delay_secs)
77 int max_len = 60, nr_lines = 0;
83 const char *sep = strchr(t,
'\n');
86 sep = strchr(t,
'\0');
100 y = SLtt_Screen_Rows / 2 - nr_lines / 2;
101 x = SLtt_Screen_Cols / 2 - max_len / 2;
104 SLsmg_draw_box(y, x++, nr_lines, max_len);
106 SLsmg_gotorc(y, x + 1);
107 SLsmg_write_string((
char *)title);
109 SLsmg_gotorc(++y, x);
112 SLsmg_write_wrapped_string((
unsigned char *)text, y, x,
113 nr_lines, max_len, 1);
117 SLsmg_gotorc(y + len - 1, x);
118 SLsmg_write_nstring((
char *)
" ", max_len);
120 SLsmg_draw_box(y++, x + 1, 3, max_len - 2);
122 SLsmg_gotorc(y + 3, x);
123 SLsmg_write_nstring((
char *)exit_msg, max_len);
139 SLsmg_gotorc(y, x + --len);
140 SLsmg_write_char(
' ');
143 SLsmg_gotorc(y, x + len++);
144 SLsmg_write_char(key);
151 if (len ==
sizeof(buf) - 1) {
161 strncpy(input, buf, len+1);
166 const char *exit_msg,
int delay_secs)
169 int max_len = 0, nr_lines = 0;
174 const char *sep = strchr(t,
'\n');
178 sep = strchr(t,
'\0');
192 y = SLtt_Screen_Rows / 2 - nr_lines / 2,
193 x = SLtt_Screen_Cols / 2 - max_len / 2;
196 SLsmg_draw_box(y, x++, nr_lines, max_len);
198 SLsmg_gotorc(y, x + 1);
199 SLsmg_write_string((
char *)title);
201 SLsmg_gotorc(++y, x);
204 SLsmg_write_wrapped_string((
unsigned char *)text, y, x,
205 nr_lines, max_len, 1);
206 SLsmg_gotorc(y + nr_lines - 2, x);
207 SLsmg_write_nstring((
char *)
" ", max_len);
208 SLsmg_gotorc(y + nr_lines - 1, x);
209 SLsmg_write_nstring((
char *)exit_msg, max_len);
231 if (vasprintf(&s, format, args) > 0) {
239 fprintf(stderr,
"%s\n", title);
240 vfprintf(stderr, format, args);
static int __ui__warning(const char *title, const char *format, va_list args)
int ui__help_window(const char *text)
int ui_browser__input_window(const char *title, const char *text, char *input, const char *exit_msg, int delay_secs)
unsigned int ui_browser__argv_refresh(struct ui_browser *browser)
#define HE_COLORSET_NORMAL
int ui__getch(int delay_secs)
int ui_browser__show(struct ui_browser *browser, const char *title, const char *helpline,...)
static int popup_menu__run(struct ui_browser *menu)
static void ui_browser__argv_write(struct ui_browser *browser, void *entry, int row)
static int input(yyscan_t yyscanner)
void ui_helpline__push(const char *msg)
bool ui_browser__is_current_entry(struct ui_browser *browser, unsigned row)
static int entry(u64 ip, struct unwind_info *ui)
static int perf_tui__warning(const char *format, va_list args)
struct perf_error_ops perf_tui_eops
void(* write)(struct ui_browser *browser, void *entry, int row)
unsigned int(* refresh)(struct ui_browser *browser)
int(* error)(const char *format, va_list args)
void ui_browser__write_nstring(struct ui_browser *browser __maybe_unused, const char *msg, unsigned int width)
#define HE_COLORSET_SELECTED
int ui_browser__run(struct ui_browser *browser, int delay_secs)
void(* seek)(struct ui_browser *browser, off_t offset, int whence)
int ui__dialog_yesno(const char *msg)
void ui_browser__hide(struct ui_browser *browser)
int ui__question_window(const char *title, const char *text, const char *exit_msg, int delay_secs)
int ui_browser__set_color(struct ui_browser *browser, int color)
static int perf_tui__error(const char *format, va_list args)
int ui__popup_menu(int argc, char *const argv[])
void ui_browser__argv_seek(struct ui_browser *browser, off_t offset, int whence)