rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Loading...
Searching...
No Matches
log_viewer_draw.c File Reference

The log viewer's drawing: the browse view with its tabs, list, scroll bar and DELETE question, the import view, and the plot. log_viewer_screen.c holds the state, the card's listing and paging and the screen's interface (log_viewer_screen.h); log_viewer_int.h is what the screen's four files share. More...

#include <stdio.h>
#include <string.h>
#include "files_screen.h"
#include "log_viewer_screen.h"
#include "settings.h"
#include "ui_screen.h"
#include "ui_card_text.h"
#include "ui_tabs.h"
#include "ui_text.h"
#include "ui_widgets.h"
#include "wall_clock.h"
#include "log_viewer_int.h"

Functions

void log_viewer_size_text (char *out, size_t n, uint64_t bytes)
 A file's size as the list and the DELETE question write it into out (n bytes): "300B", "4kB", "3.0MB" from 1MiB, "8.00GB" from 1GiB. The units are binary: 1kB is 1024 bytes, 1GB 1024^3.
void log_viewer_row_text (const log_viewer_file_t *f, log_viewer_row_t *out)
 The texts of the list's row for f: its name, cut as FILES cuts a name; its time as FILES INFO writes it (files_time_text() of wall_local_s()), and nothing for none or a 1980 stamp; its size.
static void render_question (gfx_canvas_t *c)
 Draws the DELETE question: the box, the file's name and size, CANCEL and DELETE.
static void render_bar_of (gfx_canvas_t *c, int total, int visible, int scroll)
 Draw the scroll bar on BR_BAR.
static void render_bar (gfx_canvas_t *c)
 Draw the browse list's scroll bar (render_bar_of()).
static void empty_lines (char *why, size_t n, const char **hint)
 The empty list's two lines: why it is empty, and what the folder holds when it does not.
static void render_browse (gfx_canvas_t *c)
 Draws the browse view: the tabs, the header, the file list with its scroll bar and the footer.
static const char * conv_label (log_conv_t v)
 Returns the label of a number convention: an example of its format, or AUTO.
static void render_import (gfx_canvas_t *c)
 Draws the import view: what was detected, the column list and the footer's buttons.
static void draw_grid_band (gfx_canvas_t *band, int band_y0, int rows)
 Draws the plot's grid into the band of rows rows that starts at row band_y0.
static void draw_trace_band (gfx_canvas_t *band, int k, int band_y0, int rows)
 Draws series k's trace into the band of rows rows that starts at row band_y0.
static int cursor_x (void)
 Returns the pixel column of the cursor.
static void render_plot (gfx_canvas_t *c)
 Draws the plot view: the summary, the series' chips, the traces in bands, the time axis and the footer.
static void render_text (gfx_canvas_t *c)
 Draw the TEXT view: the report's rows in the browse list's panel, its name as the panel's title, the scroll bar and BACK.
void lv_render (gfx_canvas_t *c, int buffer_index)
 Draws the view on screen into frame buffer buffer_index.

Detailed Description

The log viewer's drawing: the browse view with its tabs, list, scroll bar and DELETE question, the import view, and the plot. log_viewer_screen.c holds the state, the card's listing and paging and the screen's interface (log_viewer_screen.h); log_viewer_int.h is what the screen's four files share.

SPDX-License-Identifier: MIT

Function Documentation

◆ log_viewer_row_text()

void log_viewer_row_text ( const log_viewer_file_t * f,
log_viewer_row_t * out )

The texts of the list's row for f: its name, cut as FILES cuts a name; its time as FILES INFO writes it (files_time_text() of wall_local_s()), and nothing for none or a 1980 stamp; its size.

Parameters
fthe entry
outtakes the texts; all three "" for a NULL f

◆ log_viewer_size_text()

void log_viewer_size_text ( char * out,
size_t n,
uint64_t bytes )

A file's size as the list and the DELETE question write it into out (n bytes): "300B", "4kB", "3.0MB" from 1MiB, "8.00GB" from 1GiB. The units are binary: 1kB is 1024 bytes, 1GB 1024^3.

Parameters
outthe text
nits size, bytes
bytesthe file's size

◆ lv_render()

void lv_render ( gfx_canvas_t * c,
int buffer_index )

Draws the view on screen into frame buffer buffer_index.

Parameters
ccanvas drawn on
buffer_indexthe frame buffer, 0 to MAX_FBS - 1

◆ render_bar()

void render_bar ( gfx_canvas_t * c)
static

Draw the browse list's scroll bar (render_bar_of()).

Parameters
cThe canvas.

◆ render_bar_of()

void render_bar_of ( gfx_canvas_t * c,
int total,
int visible,
int scroll )
static

Draw the scroll bar on BR_BAR.

Parameters
cThe canvas.
totalRows of the list.
visibleRows on screen.
scrollThe first row on screen.

◆ render_text()

void render_text ( gfx_canvas_t * c)
static

Draw the TEXT view: the report's rows in the browse list's panel, its name as the panel's title, the scroll bar and BACK.

The rows are in the 10 x 20 face, TX_COLS cells each.

Parameters
cThe canvas.