bool draw_lineno(struct view *view, unsigned int lineno) { char number[10]; int digits3 = view->digits < 3 ? 3 : view->digits; int max = MIN(VIEW_MAX_LEN(view), digits3); char *text = NULL; chtype separator = opt_line_graphics ? ACS_VLINE : '|'; if (!opt_show_line_numbers) return FALSE; lineno += view->pos.offset + 1; if (lineno == 1 || (lineno % opt_line_number_interval) == 0) { static char fmt[] = "%1ld"; fmt[1] = '0' + (view->digits <= 9 ? digits3 : 1); if (string_format(number, fmt, lineno)) text = number; } if (text) draw_chars(view, LINE_LINE_NUMBER, text, max, TRUE); else draw_space(view, LINE_LINE_NUMBER, max, digits3); return draw_graphic(view, LINE_DEFAULT, &separator, 1, TRUE); }
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_lineno_custom(struct view *view, struct view_column *column, unsigned int lineno) { char number[10]; unsigned long digits3 = column->width < 3 ? 3 : column->width; int max = MIN(VIEW_MAX_LEN(view), digits3); char *text = NULL; chtype separator = opt_line_graphics ? ACS_VLINE : '|'; struct line_number_options *opts = &column->opt.line_number; int interval = opts->interval > 0 ? opts->interval : 5; if (!column->opt.line_number.display) return false; if (lineno == 1 || (lineno % interval) == 0) { static char fmt[] = "%ld"; fmt[1] = '0' + (digits3 <= 9 ? digits3 : 1); if (string_format(number, fmt, lineno)) text = number; } if (text) draw_chars(view, LINE_LINE_NUMBER, text, -1, max, true); else draw_space(view, LINE_LINE_NUMBER, max, digits3); return draw_graphic(view, LINE_DEFAULT, &separator, 1, true); }
static bool draw_graph_chtype(struct view *view, struct graph_symbol *symbol, enum line_type color, bool first) { const chtype *chars = graph_symbol_to_chtype(symbol); return draw_graphic(view, color, chars + !!first, 2 - !!first, FALSE); }
/********************************************************************* * 電圧を毎回表示する. ********************************************************************* */ void draw_AnalogInput(void) { static double vavg_n=(-1); static double vavg_d=(-1); char buf[256]; double volt; int vcol, vsize; int dl = LOWPASS_DIGITAL; int nl = LOWPASS_NEEDLE; int f = getAnalogVolt(&volt,0); #if 1 if(f>=0) { if( vavg_n < 0) { vavg_n = volt; }else{ vavg_n = (vavg_n * (nl-1) + volt ) / nl; } if( vavg_d < 0) { vavg_d = volt; }else{ vavg_d = (vavg_d * (dl-1) + volt ) / dl; } } #endif if(f<0) { sprintf(buf,"ERROR"); }else{ sprintf(buf,"%6.2f ",vavg_d); } //アナログ針で表示. draw_needle( (int) (vavg_n*1000) ); vcol = 0xaa40e040; vsize = 36; //数値で表示. gr_puts(AIN_CENTER_X-80,AIN_CENTER_H+12,buf ,vcol,BKCOL2,vsize); gr_puts(AIN_CENTER_X+32,AIN_CENTER_H+12,"V ",vcol,BKCOL2,vsize); draw_graphic((int) (volt * VOLT_SCALE)); }
static void print_content(void) { int required_lines = 0, disable_detailed = 0, disabled_graphical = 0; if (NULL == get_current_node()) return; if (c_list_in_list) { NEXT_ROW; putl(""); if (c_use_colors) attrset(COLOR_PAIR(LAYOUT_HEADER) | layout[LAYOUT_HEADER].attr); NEXT_ROW; putl(" # Tarjeta RX Tasa RX # " \ " TX Tasa TX #"); NEXT_ROW; hline(ACS_HLINE, cols); if (c_combined_node_list) foreach_node(draw_node, NULL); else draw_node(get_current_node(), NULL); } else { NEXT_ROW; hline(ACS_HLINE, cols); move(row, 24); addstr(" Press l to enable list view "); move(row, 0); } /* * calculate lines required for graphical and detailed stats unfolded */ if (c_graphical_in_list) required_lines += lines_required_for_graphical(); else required_lines++; if (c_detailed_in_list) required_lines += lines_required_for_detailed(); else required_lines++; if ((rows - row) <= (required_lines + 1)) { /* * not enough lines, start over with detailed stats disabled */ required_lines = 0; disable_detailed = 1; /* * 1 line for folded detailed stats display */ required_lines++; if (c_graphical_in_list) required_lines += lines_required_for_graphical(); else required_lines++; if ((rows - row) <= (required_lines + 1)) { /* * bad luck, not even enough space for graphical stats * reserve 2 lines for displaying folded detailed and * graphical stats */ required_lines = 2; disabled_graphical = 1; } } /* * Clear out spare space */ while (row < (rows - (required_lines + 2))) { NEXT_ROW; putl(""); } NEXT_ROW; hline(ACS_HLINE, cols); if (c_graphical_in_list) { if (disabled_graphical) { move(row, 15); addstr(" Increase screen size to see graphical statistics "); move(row, 0); } else draw_graphic(); } else { move(row, 20); addstr(" Press g to enable graphical statistics "); move(row, 0); } NEXT_ROW; hline(ACS_HLINE, cols); if (c_detailed_in_list) { if (disable_detailed) { move(row, 15); addstr(" Increase screen size to see detailed statistics "); move(row, 0); } else draw_detailed(); } else { move(row, 20); addstr(" Press d to enable detailed statistics "); move(row, 0); } }