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

FILES' drawing: the two panes with their headers, rows and scroll bars, the message line and the footer, NEW's choice, the DELETE question, the INFO box, the progress box and the keyboard. files_screen.c holds the state; files_int.h is what the screen's three files share. More...

#include <inttypes.h>
#include <stdio.h>
#include <string.h>
#include "files_screen.h"
#include "fm_name.h"
#include "log_name.h"
#include "ui_card_text.h"
#include "ui_icons.h"
#include "ui_text.h"
#include "ui_textkey.h"
#include "ui_theme.h"
#include "ui_widgets.h"
#include "wall_clock.h"
#include "files_int.h"

Functions

const char * fs_kind_word (int kind)
 The words of entry kind kind.
static void cut_cells (const char *src, int cells, char *out, size_t n)
 src cut to cells cells: whole when it fits, else its first cells and "..", never inside a character.
static void tail_cells (const char *src, int cells, char *out, size_t n)
 src cut from its front to cells cells: ".." and its end.
static void draw_header (gfx_canvas_t *c, int i)
 A pane's header row: UP with the folder's path, PREV and NEXT while the folder holds more than its page.
static void heading (int i, char *out, size_t n)
 A pane's heading: how many entries the folder holds and which of them the page shows, and how many were not listed.
static void draw_empty (gfx_canvas_t *c, int i)
 The lines a pane with no rows shows in their place.
static const char * state_word (const fm_entry_t *e)
 The word in the warning colour after an entry's kind: the logger writes it, the servo programmer's record, a folder the bench keeps; NULL for none.
static void draw_row (gfx_canvas_t *c, int i, int idx, int y)
 One row: the icon, the name and its kind line, the size.
static void draw_bar (gfx_canvas_t *c, int i)
 Pane i's scroll bar.
static void draw_pane (gfx_canvas_t *c, int i)
 One pane: its header, its list's panel and rows, its bar. The active pane's heading is an accent tag; the other's is dim text.
static void draw_message (gfx_canvas_t *c)
 The message line: the last result or refusal, else the write gate's sentence while it is shut.
static void draw_footer (gfx_canvas_t *c)
 The footer's buttons, each dimmed while it would be refused.
static void draw_new (gfx_canvas_t *c)
 NEW's choice over the panes: FOLDER and TEXT FILE.
static void draw_question (gfx_canvas_t *c)
 The DELETE question: the entry and its size, what goes, CANCEL and DELETE.
static void info_row (gfx_canvas_t *c, int y, const char *key, const char *value, gfx_color_t col)
 One row of INFO: its key and its value.
static const char * rule_words (const fm_entry_t *e)
 INFO's Rule row: what the bench keeps the entry from.
static void draw_info (gfx_canvas_t *c)
 The INFO box: name, folder, kind, size or entries, time, rule, and CLOSE.
static void draw_job (gfx_canvas_t *c)
 The progress box: the job and its entry, the target, a copy's bar and bytes, and a copy's CANCEL.
static bool job_box_shows (void)
 Whether the progress box shows: a copy's at once, a single call's once it has run FS_JOB_BOX_S.
void fs_render (gfx_canvas_t *c, int buffer_index)
 FILES drawn: the panes and the footer, or a box over them, and the keyboard on top.

Detailed Description

FILES' drawing: the two panes with their headers, rows and scroll bars, the message line and the footer, NEW's choice, the DELETE question, the INFO box, the progress box and the keyboard. files_screen.c holds the state; files_int.h is what the screen's three files share.

SPDX-License-Identifier: MIT

Function Documentation

◆ cut_cells()

void cut_cells ( const char * src,
int cells,
char * out,
size_t n )
static

src cut to cells cells: whole when it fits, else its first cells and "..", never inside a character.

Parameters
srcthe text
cellsthe cells it may take, 3 or more
outtakes the text
nbytes at out

◆ draw_bar()

void draw_bar ( gfx_canvas_t * c,
int i )
static

Pane i's scroll bar.

Parameters
cthe canvas
ithe pane

◆ draw_empty()

void draw_empty ( gfx_canvas_t * c,
int i )
static

The lines a pane with no rows shows in their place.

Parameters
cthe canvas
ithe pane

◆ draw_footer()

void draw_footer ( gfx_canvas_t * c)
static

The footer's buttons, each dimmed while it would be refused.

Parameters
cthe canvas

◆ draw_header()

void draw_header ( gfx_canvas_t * c,
int i )
static

A pane's header row: UP with the folder's path, PREV and NEXT while the folder holds more than its page.

Parameters
cthe canvas
ithe pane

◆ draw_info()

void draw_info ( gfx_canvas_t * c)
static

The INFO box: name, folder, kind, size or entries, time, rule, and CLOSE.

Parameters
cthe canvas

◆ draw_job()

void draw_job ( gfx_canvas_t * c)
static

The progress box: the job and its entry, the target, a copy's bar and bytes, and a copy's CANCEL.

Parameters
cthe canvas

◆ draw_message()

void draw_message ( gfx_canvas_t * c)
static

The message line: the last result or refusal, else the write gate's sentence while it is shut.

Parameters
cthe canvas

◆ draw_new()

void draw_new ( gfx_canvas_t * c)
static

NEW's choice over the panes: FOLDER and TEXT FILE.

Parameters
cthe canvas

◆ draw_pane()

void draw_pane ( gfx_canvas_t * c,
int i )
static

One pane: its header, its list's panel and rows, its bar. The active pane's heading is an accent tag; the other's is dim text.

Parameters
cthe canvas
ithe pane

◆ draw_question()

void draw_question ( gfx_canvas_t * c)
static

The DELETE question: the entry and its size, what goes, CANCEL and DELETE.

Parameters
cthe canvas

◆ draw_row()

void draw_row ( gfx_canvas_t * c,
int i,
int idx,
int y )
static

One row: the icon, the name and its kind line, the size.

Parameters
cthe canvas
ithe pane
idxthe entry's index on the page
ythe row's top

◆ fs_kind_word()

const char * fs_kind_word ( int kind)

The words of entry kind kind.

Parameters
kindan fm_kind_t
Returns
the word

◆ fs_render()

void fs_render ( gfx_canvas_t * c,
int buffer_index )

FILES drawn: the panes and the footer, or a box over them, and the keyboard on top.

Parameters
cthe canvas
buffer_indexthe framebuffer, whose cache it follows

◆ heading()

void heading ( int i,
char * out,
size_t n )
static

A pane's heading: how many entries the folder holds and which of them the page shows, and how many were not listed.

Parameters
ithe pane
outtakes the heading
nbytes at out

◆ info_row()

void info_row ( gfx_canvas_t * c,
int y,
const char * key,
const char * value,
gfx_color_t col )
static

One row of INFO: its key and its value.

Parameters
cthe canvas
ythe row's top
keythe key
valuethe value
colthe value's colour

◆ job_box_shows()

bool job_box_shows ( void )
static

Whether the progress box shows: a copy's at once, a single call's once it has run FS_JOB_BOX_S.

Returns
true when it shows

◆ rule_words()

const char * rule_words ( const fm_entry_t * e)
static

INFO's Rule row: what the bench keeps the entry from.

Parameters
ethe entry
Returns
the words

◆ state_word()

const char * state_word ( const fm_entry_t * e)
static

The word in the warning colour after an entry's kind: the logger writes it, the servo programmer's record, a folder the bench keeps; NULL for none.

Parameters
ethe entry
Returns
the word

◆ tail_cells()

void tail_cells ( const char * src,
int cells,
char * out,
size_t n )
static

src cut from its front to cells cells: ".." and its end.

Parameters
srcthe text
cellsthe cells it may take, 3 or more
outtakes the text
nbytes at out