termtab-0.1.0.0: TUI guitar tablature and score editor
Safe HaskellNone
LanguageGHC2021

Termtab.UI.NotationGraphics

Description

Glue between the notation image renderer and the brick UI, using Kitty graphics protocol direct placement.

Each track that shows notation reserves a fixed-height region (notationRegionWidget) of blank cells. brick lays it out and reports its on-screen extent; in the event handler syncNotationGraphics looks that extent up, renders the notation image, moves the cursor there, and blits the image scaled to the region (Kitty draws it over the blank cells). Re-emitting with a stable image/placement id replaces the placement rather than stacking.

Gated on the detected protocol being Kitty with Bravura loaded; otherwise the caller falls back to the Unicode text staff.

Synopsis

Documentation

syncNotationGraphics :: EventM ResourceName AppState () Source #

For every track, blit its notation image if it shows notation and its content/position changed since last time, or clear a stale image if it stopped showing notation. A no-op when graphics are unavailable.

notationRegionWidget :: TrackIndex -> Widget ResourceName Source #

The reserved region a track's notation image is blitted over: blank cells whose extent we report so the transmit step can find its screen position.

graphicsNotationActive :: AppState -> Bool Source #

True when the graphics notation path is available: the terminal speaks the Kitty protocol and Bravura loaded.

notationRows :: Int Source #

Height of the notation strip, in terminal cells.