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

Termtab.UI.Widgets.Notation

Description

Plain Unicode-text rendering of standard staff notation, used as the fallback when the terminal can't display the rasterized Bravura image from Termtab.UI.NotationGraphics (see Termtab.UI.Widgets.TrackPanel's choice between the two). Draws the staff by brute force: one text row per vertical position (staff line or space, plus a couple of ledger positions above and below), each row built independently across all visible measures.

Synopsis

Documentation

renderNotation :: AppState -> TrackIndex -> Widget ResourceName Source #

Render standard notation above the tab. 9 rows: 5 staff lines (even positions) + 4 spaces (odd positions). Staff positions: 0=E4, 1=F4, 2=G4, 3=A4, 4=B4, 5=C5, 6=D5, 7=E5, 8=F5 Lines are at positions 0, 2, 4, 6, 8. Spaces at 1, 3, 5, 7.

Two extra rows are drawn above (positions 9, 10) and two below (-1, -2) for ledger-line/off-staff notes; pitchToStaffPos can return values outside [0, 8] and those still need somewhere to render, even without an actual ledger line drawn for them. The visible measure range comes from findVisibleRange (shared with Termtab.UI.Widgets.Tablature so notation and tab columns line up).