static bool draw_graph_ascii(void *view, const struct graph *graph, const struct graph_symbol *symbol, int color_id, bool first) { const char *chars = graph->symbol_to_ascii(symbol); return draw_text(view, get_graph_color(color_id), chars + !!first); }
static bool draw_graph_chtype(void *view, const struct graph *graph, const struct graph_symbol *symbol, int color_id, bool first) { const chtype *chars = graph->symbol_to_chtype(symbol); return draw_graphic(view, get_graph_color(color_id), chars + !!first, 2 - !!first, false); }
static bool draw_graph(struct view *view, const struct graph_canvas *canvas) { static const draw_graph_fn fns[] = { draw_graph_ascii, draw_graph_chtype, draw_graph_utf8 }; draw_graph_fn fn = fns[opt_line_graphics]; int i; for (i = 0; i < canvas->size; i++) { struct graph_symbol *symbol = &canvas->symbols[i]; enum line_type color = get_graph_color(symbol); if (fn(view, symbol, color, i == 0)) return TRUE; } return draw_text(view, LINE_DEFAULT, " "); }