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

Termtab.UI.Widgets.Tablature

Description

GP-style ASCII/Unicode tablature rendering: one text row per string, fret numbers overlaid on horizontal line characters, measures separated by bar-line columns.

Column layout is duration-proportional: beatColumnWidth scales a beat's column with its Duration relative to asZoom so, e.g., an eighth note takes half the width of a quarter note at the same zoom. Because the viewport is narrower than the whole song, findVisibleRange decides which window of measures to actually draw, always keeping the cursor's measure on screen. findVisibleRange and beatColumnWidth are exported because Termtab.UI.Widgets.Notation reuses them so its staff rendering lines up column-for-column with the tab below it.

Synopsis

Documentation

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

Render one track's tab: a measure-number header row, then one string line per string (drawn high-to-low via reverse, matching how guitar tab is conventionally written with the highest string on top). Available width comes from Brick's layout context (getContext) rather than a parameter, so the visible measure range adapts to however much horizontal space the panel is actually given.

cursorAttr :: AttrName Source #

Attribute name for the cell under the editing cursor.

playheadAttr :: AttrName Source #

Attribute name for the cell at the current playback position.

selectionAttr :: AttrName Source #

Attribute name for cells within the active VisualMode selection.

barLineAttr :: AttrName Source #

Attribute name for measure-boundary bar-line characters.

stringLabelAttr :: AttrName Source #

Attribute name for the leading per-string label column (T/A/B or a line character).

findVisibleRange :: Track -> [Measure] -> Int -> Int -> Int -> [(MeasureIndex, [Beat], Measure)] Source #

Find the best visible range: start as early as possible while ensuring the cursor measure is visible and the width is filled.

beatColumnWidth :: Int -> Duration -> Int Source #

Column width for a beat, minimum 3 to fit double-digit frets