8 #include <sys/ttydefaults.h>
18 newtComponent form, scale;
21 struct ui_progress *ui_progress__new(const char *title, u64 total)
23 struct ui_progress *self = malloc(sizeof(*self));
27 newtGetScreenSize(&cols, NULL);
29 newtCenteredWindow(cols, 1, title);
30 self->form = newtForm(NULL, NULL, 0);
31 if (self->form == NULL)
33 self->scale = newtScale(0, 0, cols, total);
34 if (self->scale == NULL)
36 newtFormAddComponent(self->form, self->scale);
43 newtFormDestroy(self->form);
49 void ui_progress__update(struct ui_progress *self, u64 curr)
51 newtScaleSet(self->scale, curr);
55 void ui_progress__delete(struct ui_progress *self)
57 newtFormDestroy(self->form);
62 static void ui_helpline__pop(void)
67 static void ui_helpline__push(const char *msg)
69 newtPushHelpLine(msg);
72 static void ui_helpline__vpush(const char *fmt, va_list ap)
76 if (vasprintf(&s, fmt, ap) < 0)
77 vfprintf(stderr, fmt, ap);
84 static void ui_helpline__fpush(const char *fmt, ...)
89 ui_helpline__vpush(fmt, ap);
93 static void ui_helpline__puts(const char *msg)
96 ui_helpline__push(msg);
99 static char browser__last_msg[1024];
101 int browser__show_help(const char *format, va_list ap)
106 ret = vsnprintf(browser__last_msg + backlog,
107 sizeof(browser__last_msg) - backlog, format, ap);
110 if (browser__last_msg[backlog - 1] == '\n') {
111 ui_helpline__puts(browser__last_msg);
119 static void newt_form__set_exit_keys(newtComponent self)
121 newtFormAddHotKey(self, NEWT_KEY_LEFT);
122 newtFormAddHotKey(self, NEWT_KEY_ESCAPE);
123 newtFormAddHotKey(self, 'Q');
124 newtFormAddHotKey(self, 'q');
125 newtFormAddHotKey(self, CTRL('c'));
128 static newtComponent newt_form__new(void)
130 newtComponent self = newtForm(NULL, NULL, 0);
132 newt_form__set_exit_keys(self);
136 static int popup_menu(int argc, char * const argv[])
138 struct newtExitStruct es;
139 int i, rc = -1, max_len = 5;
140 newtComponent listbox, form = newt_form__new();
145 listbox = newtListbox(0, 0, argc, NEWT_FLAG_RETURNEXIT);
147 goto out_destroy_form;
149 newtFormAddComponent(form, listbox);
151 for (i = 0; i < argc; ++i) {
152 int len = strlen(argv[i]);
155 if (newtListboxAddEntry(listbox, argv[i], (void *)(long)i))
156 goto out_destroy_form;
159 newtCenteredWindow(max_len, argc, NULL);
160 newtFormRun(form, &es);
161 rc = newtListboxGetCurrent(listbox) - NULL;
162 if (es.reason == NEWT_EXIT_HOTKEY)
166 newtFormDestroy(form);
170 static int ui__help_window(const char *text)
172 struct newtExitStruct es;
173 newtComponent tb, form = newt_form__new();
175 int max_len = 0, nr_lines = 0;
183 const char *sep = strchr(t, '\n');
187 sep = strchr(t, '\0');
197 tb = newtTextbox(0, 0, max_len, nr_lines, 0);
199 goto out_destroy_form;
201 newtTextboxSetText(tb, text);
202 newtFormAddComponent(form, tb);
203 newtCenteredWindow(max_len, nr_lines, NULL);
204 newtFormRun(form, &es);
208 newtFormDestroy(form);
212 static bool dialog_yesno(const char *msg)
214 /* newtWinChoice should really be accepting const char pointers... */
215 char yes[] = "Yes", no[] = "No";
216 return newtWinChoice(NULL, yes, no, (char *)msg) == 1;
219 #define HE_COLORSET_TOP 50
220 #define HE_COLORSET_MEDIUM 51
221 #define HE_COLORSET_NORMAL 52
222 #define HE_COLORSET_SELECTED 53
223 #define HE_COLORSET_CODE 54
225 static int ui_browser__percent_color(double percent, bool current)
228 return HE_COLORSET_SELECTED;
229 if (percent >= MIN_RED)
230 return HE_COLORSET_TOP;
231 if (percent >= MIN_GREEN)
232 return HE_COLORSET_MEDIUM;
233 return HE_COLORSET_NORMAL;
237 newtComponent form, sb;
238 u64 index, first_visible_entry_idx;
239 void *first_visible_entry, *entries;
240 u16 top, left, width, height;
245 static void ui_browser__refresh_dimensions(struct ui_browser *self)
248 newtGetScreenSize(&cols, &rows);
250 if (self->width > cols - 4)
251 self->width = cols - 4;
252 self->height = rows - 5;
253 if (self->height > self->nr_entries)
254 self->height = self->nr_entries;
255 self->top = (rows - self->height) / 2;
256 self->left = (cols - self->width) / 2;
259 static void ui_browser__reset_index(struct ui_browser *self)
261 self->index = self->first_visible_entry_idx = 0;
262 self->first_visible_entry = NULL;
265 static int objdump_line__show(struct objdump_line *self, struct list_head *head,
266 int width, struct hist_entry *he, int len,
269 if (self->offset != -1) {
270 struct symbol *sym = he->ms.sym;
271 unsigned int hits = 0;
272 double percent = 0.0;
274 struct sym_priv *priv = symbol__priv(sym);
275 struct sym_ext *sym_ext = priv->ext;
276 struct sym_hist *h = priv->hist;
277 s64 offset = self->offset;
278 struct objdump_line *next = objdump__get_next_ip_line(head, self);
280 while (offset < (s64)len &&
281 (next == NULL || offset < next->offset)) {
283 percent += sym_ext[offset].percent;
285 hits += h->ip[offset];
290 if (sym_ext == NULL && h->sum)
291 percent = 100.0 * hits / h->sum;
293 color = ui_browser__percent_color(percent, current_entry);
294 SLsmg_set_color(color);
295 SLsmg_printf(" %7.2f ", percent);
297 SLsmg_set_color(HE_COLORSET_CODE);
299 int color = ui_browser__percent_color(0, current_entry);
300 SLsmg_set_color(color);
301 SLsmg_write_nstring(" ", 9);
304 SLsmg_write_char(':');
305 SLsmg_write_nstring(" ", 8);
307 SLsmg_write_nstring(" ", width - 18);
309 SLsmg_write_nstring(self->line, width - 18);
314 static int ui_browser__refresh_entries(struct ui_browser *self)
316 struct objdump_line *pos;
317 struct list_head *head = self->entries;
318 struct hist_entry *he = self->priv;
320 int len = he->ms.sym->end - he->ms.sym->start;
322 if (self->first_visible_entry == NULL || self->first_visible_entry == self->entries)
323 self->first_visible_entry = head->next;
325 pos = list_entry(self->first_visible_entry, struct objdump_line, node);
327 list_for_each_entry_from(pos, head, node) {
328 bool current_entry = (self->first_visible_entry_idx + row) == self->index;
329 SLsmg_gotorc(self->top + row, self->left);
330 objdump_line__show(pos, head, self->width,
331 he, len, current_entry);
332 if (++row == self->height)
336 SLsmg_set_color(HE_COLORSET_NORMAL);
337 SLsmg_fill_region(self->top + row, self->left,
338 self->height - row, self->width, ' ');
343 static int ui_browser__run(struct ui_browser *self, const char *title,
344 struct newtExitStruct *es)
347 newtFormDestroy(self->form);
351 ui_browser__refresh_dimensions(self);
352 newtCenteredWindow(self->width + 2, self->height, title);
353 self->form = newt_form__new();
354 if (self->form == NULL)
357 self->sb = newtVerticalScrollbar(self->width + 1, 0, self->height,
359 HE_COLORSET_SELECTED);
360 if (self->sb == NULL)
363 newtFormAddHotKey(self->form, NEWT_KEY_UP);
364 newtFormAddHotKey(self->form, NEWT_KEY_DOWN);
365 newtFormAddHotKey(self->form, NEWT_KEY_PGUP);
366 newtFormAddHotKey(self->form, NEWT_KEY_PGDN);
367 newtFormAddHotKey(self->form, NEWT_KEY_HOME);
368 newtFormAddHotKey(self->form, NEWT_KEY_END);
370 if (ui_browser__refresh_entries(self) < 0)
372 newtFormAddComponent(self->form, self->sb);
377 newtFormRun(self->form, es);
379 if (es->reason != NEWT_EXIT_HOTKEY)
383 if (self->index == self->nr_entries - 1)
386 if (self->index == self->first_visible_entry_idx + self->height) {
387 struct list_head *pos = self->first_visible_entry;
388 ++self->first_visible_entry_idx;
389 self->first_visible_entry = pos->next;
393 if (self->index == 0)
396 if (self->index < self->first_visible_entry_idx) {
397 struct list_head *pos = self->first_visible_entry;
398 --self->first_visible_entry_idx;
399 self->first_visible_entry = pos->prev;
403 if (self->first_visible_entry_idx + self->height > self->nr_entries - 1)
406 offset = self->height;
407 if (self->index + offset > self->nr_entries - 1)
408 offset = self->nr_entries - 1 - self->index;
409 self->index += offset;
410 self->first_visible_entry_idx += offset;
413 struct list_head *pos = self->first_visible_entry;
414 self->first_visible_entry = pos->next;
419 if (self->first_visible_entry_idx == 0)
422 if (self->first_visible_entry_idx < self->height)
423 offset = self->first_visible_entry_idx;
425 offset = self->height;
427 self->index -= offset;
428 self->first_visible_entry_idx -= offset;
431 struct list_head *pos = self->first_visible_entry;
432 self->first_visible_entry = pos->prev;
436 ui_browser__reset_index(self);
439 struct list_head *head = self->entries;
440 offset = self->height - 1;
442 if (offset > self->nr_entries)
443 offset = self->nr_entries;
445 self->index = self->first_visible_entry_idx = self->nr_entries - 1 - offset;
446 self->first_visible_entry = head->prev;
447 while (offset-- != 0) {
448 struct list_head *pos = self->first_visible_entry;
449 self->first_visible_entry = pos->prev;
453 case NEWT_KEY_ESCAPE:
462 if (ui_browser__refresh_entries(self) < 0)
469 * When debugging newt problems it was useful to be able to "unroll"
470 * the calls to newtCheckBoxTreeAdd{Array,Item}, so that we can generate
471 * a source file with the sequence of calls to these methods, to then
472 * tweak the arrays to get the intended results, so I'm keeping this code
473 * here, may be useful again in the future.
477 static void newt_checkbox_tree__add(newtComponent tree, const char *str,
478 void *priv, int *indexes)
481 /* Print the newtCheckboxTreeAddArray to tinker with its index arrays */
482 int i = 0, len = 40 - strlen(str);
485 "\tnewtCheckboxTreeAddItem(tree, %*.*s\"%s\", (void *)%p, 0, ",
486 len, len, " ", str, priv);
487 while (indexes[i] != NEWT_ARG_LAST) {
488 if (indexes[i] != NEWT_ARG_APPEND)
489 fprintf(stderr, " %d,", indexes[i]);
491 fprintf(stderr, " %s,", "NEWT_ARG_APPEND");
494 fprintf(stderr, " %s", " NEWT_ARG_LAST);\n");
497 newtCheckboxTreeAddArray(tree, str, priv, 0, indexes);
500 static char *callchain_list__sym_name(struct callchain_list *self,
501 char *bf, size_t bfsize)
504 return self->ms.sym->name;
506 snprintf(bf, bfsize, "%#Lx", self->ip);
510 static void __callchain__append_graph_browser(struct callchain_node *self,
511 newtComponent tree, u64 total,
512 int *indexes, int depth)
514 struct rb_node *node;
515 u64 new_total, remaining;
518 if (callchain_param.mode == CHAIN_GRAPH_REL)
519 new_total = self->children_hit;
523 remaining = new_total;
524 node = rb_first(&self->rb_root);
526 struct callchain_node *child = rb_entry(node, struct callchain_node, rb_node);
527 struct rb_node *next = rb_next(node);
528 u64 cumul = cumul_hits(child);
529 struct callchain_list *chain;
530 int first = true, printed = 0;
534 indexes[depth] = NEWT_ARG_APPEND;
535 indexes[depth + 1] = NEWT_ARG_LAST;
537 list_for_each_entry(chain, &child->val, list) {
538 char ipstr[BITS_PER_LONG / 4 + 1],
540 const char *str = callchain_list__sym_name(chain, ipstr, sizeof(ipstr));
543 double percent = cumul * 100.0 / new_total;
546 if (asprintf(&alloc_str, "%2.2f%% %s", percent, str) < 0)
547 str = "Not enough memory!";
551 indexes[depth] = idx;
552 indexes[depth + 1] = NEWT_ARG_APPEND;
553 indexes[depth + 2] = NEWT_ARG_LAST;
556 newt_checkbox_tree__add(tree, str, &chain->ms, indexes);
561 indexes[depth] = idx;
563 indexes[depth + 1] = chain_idx;
566 __callchain__append_graph_browser(child, tree, new_total, indexes,
567 depth + (chain_idx != -1 ? 2 : 1));
572 static void callchain__append_graph_browser(struct callchain_node *self,
573 newtComponent tree, u64 total,
574 int *indexes, int parent_idx)
576 struct callchain_list *chain;
579 indexes[1] = NEWT_ARG_APPEND;
580 indexes[2] = NEWT_ARG_LAST;
582 list_for_each_entry(chain, &self->val, list) {
583 char ipstr[BITS_PER_LONG / 4 + 1], *str;
585 if (chain->ip >= PERF_CONTEXT_MAX)
588 if (!i++ && sort__first_dimension == SORT_SYM)
591 str = callchain_list__sym_name(chain, ipstr, sizeof(ipstr));
592 newt_checkbox_tree__add(tree, str, &chain->ms, indexes);
595 indexes[1] = parent_idx;
596 indexes[2] = NEWT_ARG_APPEND;
597 indexes[3] = NEWT_ARG_LAST;
598 __callchain__append_graph_browser(self, tree, total, indexes, 2);
601 static void hist_entry__append_callchain_browser(struct hist_entry *self,
602 newtComponent tree, u64 total, int parent_idx)
604 struct rb_node *rb_node;
605 int indexes[1024] = { [0] = parent_idx, };
607 struct callchain_node *chain;
609 rb_node = rb_first(&self->sorted_chain);
611 chain = rb_entry(rb_node, struct callchain_node, rb_node);
612 switch (callchain_param.mode) {
615 case CHAIN_GRAPH_ABS: /* falldown */
616 case CHAIN_GRAPH_REL:
617 callchain__append_graph_browser(chain, tree, total, indexes, idx++);
623 rb_node = rb_next(rb_node);
627 static size_t hist_entry__append_browser(struct hist_entry *self,
628 newtComponent tree, u64 total)
633 if (symbol_conf.exclude_other && !self->parent)
636 ret = hist_entry__snprintf(self, s, sizeof(s), NULL,
637 false, 0, false, total);
638 if (symbol_conf.use_callchain) {
641 indexes[0] = NEWT_ARG_APPEND;
642 indexes[1] = NEWT_ARG_LAST;
643 newt_checkbox_tree__add(tree, s, &self->ms, indexes);
645 newtListboxAppendEntry(tree, s, &self->ms);
650 static void hist_entry__annotate_browser(struct hist_entry *self)
652 struct ui_browser browser;
653 struct newtExitStruct es;
654 struct objdump_line *pos, *n;
657 if (self->ms.sym == NULL)
660 if (hist_entry__annotate(self, &head) < 0)
663 ui_helpline__push("Press <- or ESC to exit");
665 memset(&browser, 0, sizeof(browser));
666 browser.entries = &head;
668 list_for_each_entry(pos, &head, node) {
669 size_t line_len = strlen(pos->line);
670 if (browser.width < line_len)
671 browser.width = line_len;
672 ++browser.nr_entries;
675 browser.width += 18; /* Percentage */
676 ui_browser__run(&browser, self->ms.sym->name, &es);
677 newtFormDestroy(browser.form);
679 list_for_each_entry_safe(pos, n, &head, node) {
680 list_del(&pos->node);
681 objdump_line__free(pos);
686 static const void *newt__symbol_tree_get_current(newtComponent self)
688 if (symbol_conf.use_callchain)
689 return newtCheckboxTreeGetCurrent(self);
690 return newtListboxGetCurrent(self);
693 static void hist_browser__selection(newtComponent self, void *data)
695 const struct map_symbol **symbol_ptr = data;
696 *symbol_ptr = newt__symbol_tree_get_current(self);
699 struct hist_browser {
700 newtComponent form, tree;
701 const struct map_symbol *selection;
704 static struct hist_browser *hist_browser__new(void)
706 struct hist_browser *self = malloc(sizeof(*self));
714 static void hist_browser__delete(struct hist_browser *self)
716 newtFormDestroy(self->form);
721 static int hist_browser__populate(struct hist_browser *self, struct hists *hists,
724 int max_len = 0, idx, cols, rows;
725 struct ui_progress *progress;
728 char seq[] = ".", unit;
730 unsigned long nr_events = hists->stats.nr_events[PERF_RECORD_SAMPLE];
733 newtFormDestroy(self->form);
737 nr_events = convert_unit(nr_events, &unit);
738 snprintf(str, sizeof(str), "Events: %lu%c ",
740 newtDrawRootText(0, 0, str);
742 newtGetScreenSize(NULL, &rows);
744 if (symbol_conf.use_callchain)
745 self->tree = newtCheckboxTreeMulti(0, 0, rows - 5, seq,
748 self->tree = newtListbox(0, 0, rows - 5,
750 NEWT_FLAG_RETURNEXIT));
752 newtComponentAddCallback(self->tree, hist_browser__selection,
755 progress = ui_progress__new("Adding entries to the browser...",
757 if (progress == NULL)
761 for (nd = rb_first(&hists->entries); nd; nd = rb_next(nd)) {
762 struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node);
768 len = hist_entry__append_browser(h, self->tree, hists->stats.total_period);
771 if (symbol_conf.use_callchain)
772 hist_entry__append_callchain_browser(h, self->tree,
773 hists->stats.total_period, idx++);
776 ui_progress__update(progress, curr_hist);
779 ui_progress__delete(progress);
781 newtGetScreenSize(&cols, &rows);
786 if (!symbol_conf.use_callchain)
787 newtListboxSetWidth(self->tree, max_len);
789 newtCenteredWindow(max_len + (symbol_conf.use_callchain ? 5 : 0),
791 self->form = newt_form__new();
792 if (self->form == NULL)
795 newtFormAddHotKey(self->form, 'A');
796 newtFormAddHotKey(self->form, 'a');
797 newtFormAddHotKey(self->form, 'D');
798 newtFormAddHotKey(self->form, 'd');
799 newtFormAddHotKey(self->form, 'T');
800 newtFormAddHotKey(self->form, 't');
801 newtFormAddHotKey(self->form, '?');
802 newtFormAddHotKey(self->form, 'H');
803 newtFormAddHotKey(self->form, 'h');
804 newtFormAddHotKey(self->form, NEWT_KEY_F1);
805 newtFormAddHotKey(self->form, NEWT_KEY_RIGHT);
806 newtFormAddComponents(self->form, self->tree, NULL);
807 self->selection = newt__symbol_tree_get_current(self->tree);
812 static struct hist_entry *hist_browser__selected_entry(struct hist_browser *self)
816 if (!symbol_conf.use_callchain)
819 indexes = newtCheckboxTreeFindItem(self->tree, (void *)self->selection);
821 bool is_hist_entry = indexes[1] == NEWT_ARG_LAST;
828 return container_of(self->selection, struct hist_entry, ms);
831 static struct thread *hist_browser__selected_thread(struct hist_browser *self)
833 struct hist_entry *he = hist_browser__selected_entry(self);
834 return he ? he->thread : NULL;
837 static int hist_browser__title(char *bf, size_t size, const char *input_name,
838 const struct dso *dso, const struct thread *thread)
843 printed += snprintf(bf + printed, size - printed,
845 (thread->comm_set ? thread->comm : ""),
848 printed += snprintf(bf + printed, size - printed,
849 "%sDSO: %s", thread ? " " : "",
851 return printed ?: snprintf(bf, size, "Report: %s", input_name);
854 int hists__browse(struct hists *self, const char *helpline, const char *input_name)
856 struct hist_browser *browser = hist_browser__new();
857 struct pstack *fstack = pstack__new(2);
858 const struct thread *thread_filter = NULL;
859 const struct dso *dso_filter = NULL;
860 struct newtExitStruct es;
867 fstack = pstack__new(2);
871 ui_helpline__push(helpline);
873 hist_browser__title(msg, sizeof(msg), input_name,
874 dso_filter, thread_filter);
875 if (hist_browser__populate(browser, self, msg) < 0)
879 const struct thread *thread;
880 const struct dso *dso;
882 int nr_options = 0, choice = 0, i,
883 annotate = -2, zoom_dso = -2, zoom_thread = -2;
885 newtFormRun(browser->form, &es);
887 thread = hist_browser__selected_thread(browser);
888 dso = browser->selection->map ? browser->selection->map->dso : NULL;
890 if (es.reason == NEWT_EXIT_HOTKEY) {
891 if (es.u.key == NEWT_KEY_F1)
894 switch (toupper(es.u.key)) {
904 ui__help_window("-> Zoom into DSO/Threads & Annotate current symbol\n"
906 "a Annotate current symbol\n"
907 "h/?/F1 Show this window\n"
908 "d Zoom into current DSO\n"
909 "t Zoom into current Thread\n"
910 "q/CTRL+C Exit browser");
914 if (toupper(es.u.key) == 'Q' ||
915 es.u.key == CTRL('c'))
917 if (es.u.key == NEWT_KEY_ESCAPE) {
918 if (dialog_yesno("Do you really want to exit?"))
924 if (es.u.key == NEWT_KEY_LEFT) {
927 if (pstack__empty(fstack))
929 top = pstack__pop(fstack);
930 if (top == &dso_filter)
932 if (top == &thread_filter)
933 goto zoom_out_thread;
938 if (browser->selection->sym != NULL &&
939 asprintf(&options[nr_options], "Annotate %s",
940 browser->selection->sym->name) > 0)
941 annotate = nr_options++;
943 if (thread != NULL &&
944 asprintf(&options[nr_options], "Zoom %s %s(%d) thread",
945 (thread_filter ? "out of" : "into"),
946 (thread->comm_set ? thread->comm : ""),
948 zoom_thread = nr_options++;
951 asprintf(&options[nr_options], "Zoom %s %s DSO",
952 (dso_filter ? "out of" : "into"),
953 (dso->kernel ? "the Kernel" : dso->short_name)) > 0)
954 zoom_dso = nr_options++;
956 options[nr_options++] = (char *)"Exit";
958 choice = popup_menu(nr_options, options);
960 for (i = 0; i < nr_options - 1; ++i)
963 if (choice == nr_options - 1)
969 if (choice == annotate) {
970 struct hist_entry *he;
972 if (browser->selection->map->dso->origin == DSO__ORIG_KERNEL) {
973 ui_helpline__puts("No vmlinux file found, can't "
974 "annotate with just a "
979 he = hist_browser__selected_entry(browser);
983 hist_entry__annotate_browser(he);
984 } else if (choice == zoom_dso) {
987 pstack__remove(fstack, &dso_filter);
994 ui_helpline__fpush("To zoom out press <- or -> + \"Zoom out of %s DSO\"",
995 dso->kernel ? "the Kernel" : dso->short_name);
997 pstack__push(fstack, &dso_filter);
999 hists__filter_by_dso(self, dso_filter);
1000 hist_browser__title(msg, sizeof(msg), input_name,
1001 dso_filter, thread_filter);
1002 if (hist_browser__populate(browser, self, msg) < 0)
1004 } else if (choice == zoom_thread) {
1006 if (thread_filter) {
1007 pstack__remove(fstack, &thread_filter);
1010 thread_filter = NULL;
1012 ui_helpline__fpush("To zoom out press <- or -> + \"Zoom out of %s(%d) thread\"",
1013 thread->comm_set ? thread->comm : "",
1015 thread_filter = thread;
1016 pstack__push(fstack, &thread_filter);
1018 hists__filter_by_thread(self, thread_filter);
1019 hist_browser__title(msg, sizeof(msg), input_name,
1020 dso_filter, thread_filter);
1021 if (hist_browser__populate(browser, self, msg) < 0)
1027 pstack__delete(fstack);
1029 hist_browser__delete(browser);
1033 static struct newtPercentTreeColors {
1034 const char *topColorFg, *topColorBg;
1035 const char *mediumColorFg, *mediumColorBg;
1036 const char *normalColorFg, *normalColorBg;
1037 const char *selColorFg, *selColorBg;
1038 const char *codeColorFg, *codeColorBg;
1039 } defaultPercentTreeColors = {
1041 "green", "lightgray",
1042 "black", "lightgray",
1043 "lightgray", "magenta",
1044 "blue", "lightgray",
1047 void setup_browser(void)
1049 struct newtPercentTreeColors *c = &defaultPercentTreeColors;
1056 ui_helpline__puts(" ");
1057 SLtt_set_color(HE_COLORSET_TOP, NULL, c->topColorFg, c->topColorBg);
1058 SLtt_set_color(HE_COLORSET_MEDIUM, NULL, c->mediumColorFg, c->mediumColorBg);
1059 SLtt_set_color(HE_COLORSET_NORMAL, NULL, c->normalColorFg, c->normalColorBg);
1060 SLtt_set_color(HE_COLORSET_SELECTED, NULL, c->selColorFg, c->selColorBg);
1061 SLtt_set_color(HE_COLORSET_CODE, NULL, c->codeColorFg, c->codeColorBg);
1064 void exit_browser(bool wait_for_ok)
1068 char title[] = "Fatal Error", ok[] = "Ok";
1069 newtWinMessage(title, ok, browser__last_msg);