ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
sh_toc.c File Reference

Table-of-contents screen: scrollable chapter list for the open book. More...

#include "ra8_gfx.h"
#include "ra8_gfx_font.h"
#include "sh_app.h"
Include dependency graph for sh_toc.c:

Go to the source code of this file.

Enumerations

enum  sh_toc_const_t : int32_t {
  k_sh_toc_text_pad = 14 ,
  k_sh_toc_num_w = 64
}
 TOC layout constants. More...

Functions

static int32_t sh_toc_visible_rows (void)
 Rows of the chapter list visible at once.
static void sh_toc_label (uint32_t idx, char *buf, size_t cap)
 Resolve chapter idx's display label into buf (cap bytes), truncated.
void sh_toc_render (void)
 Render the open book's chapter list (TOC).
int32_t sh_toc_hit (int32_t x, int32_t y)
 Hit-test a TOC tap; returns the chapter index or -1.
void sh_toc_scroll (int32_t dir)
 Scroll the TOC list by dir pages (-1 up / +1 down), clamped.

Detailed Description

Table-of-contents screen: scrollable chapter list for the open book.

Lists the open book's spine chapters using their book TOC labels (falling back to "Chapter N" for unlabelled spine items). The list scrolls a page at a time via SW1/SW2; tapping a visible row opens the reader at that chapter. The window of visible rows is derived from the panel height and k_sh_toc_row_h.

[Ring 6 / App] {World: NS}

Since
0.1.0

Definition in file sh_toc.c.

Enumeration Type Documentation

◆ sh_toc_const_t

enum sh_toc_const_t : int32_t

TOC layout constants.

Enumerator
k_sh_toc_text_pad 

Row text inset.

k_sh_toc_num_w 

Chapter-number column width.

Definition at line 23 of file sh_toc.c.

Function Documentation

◆ sh_toc_hit()

int32_t sh_toc_hit ( int32_t x,
int32_t y )

Hit-test a TOC tap; returns the chapter index or -1.

Definition at line 79 of file sh_toc.c.

References g_sh, k_sh_bar_h, and k_sh_toc_row_h.

Referenced by sh_tap_toc().

◆ sh_toc_label()

void sh_toc_label ( uint32_t idx,
char * buf,
size_t cap )
static

Resolve chapter idx's display label into buf (cap bytes), truncated.

Definition at line 35 of file sh_toc.c.

References k_sh_fb_w, k_sh_linebuf, k_sh_pad, k_sh_toc_num_w, sh_book_chapter_label(), sh_cells(), and sh_fit().

Referenced by sh_toc_render().

◆ sh_toc_render()

◆ sh_toc_scroll()

void sh_toc_scroll ( int32_t dir)

Scroll the TOC list by dir pages (-1 up / +1 down), clamped.

Definition at line 90 of file sh_toc.c.

References g_sh, and sh_toc_visible_rows().

Referenced by sh_handle_button().

◆ sh_toc_visible_rows()

int32_t sh_toc_visible_rows ( void )
static

Rows of the chapter list visible at once.

Definition at line 29 of file sh_toc.c.

References k_sh_bar_h, k_sh_fb_h, and k_sh_toc_row_h.

Referenced by sh_toc_render(), and sh_toc_scroll().