pub struct PianoRollState {Show 24 fields
pub cursor_note: u8,
pub scroll_x: usize,
pub view_bottom_note: u8,
pub view_height: u8,
pub focus: PianoRollFocus,
pub column: usize,
pub column_count: usize,
pub selected_note_indices: Vec<usize>,
pub highlight_start: Option<usize>,
pub highlight_end: Option<usize>,
pub visible_columns: usize,
pub yank_buffer: Vec<NoteSnapshot>,
pub yank_columns: usize,
pub row_highlight_low: Option<u8>,
pub row_highlight_high: Option<u8>,
pub highlight_locked: bool,
pub edit_mode: bool,
pub edit_cursor: usize,
pub edit_selected: Vec<usize>,
pub edit_sub: EditSubMode,
pub grid: GridResolution,
pub snap_enabled: bool,
pub default_velocity: u8,
pub settings_cursor: usize,
/* private fields */
}Fields§
§cursor_note: u8§scroll_x: usize§view_bottom_note: u8§view_height: u8§focus: PianoRollFocusCurrent focus level.
column: usizeCurrently selected column (0-based). Columns map to time subdivisions.
column_count: usizeTotal number of columns in the grid (set by renderer).
selected_note_indices: Vec<usize>Indices of notes that belong to the selected column (set on Enter). Edits operate on these indices so notes don’t “escape” the column.
highlight_start: Option<usize>Highlight range for bulk selection (Shift+h/l in Navigation mode). When set, columns from highlight_start..=highlight_end are selected.
highlight_end: Option<usize>§visible_columns: usizeNumber of columns visible on screen (set by renderer each frame).
yank_buffer: Vec<NoteSnapshot>Yanked (copied) notes buffer. Notes stored with start_frac relative to the yank origin (leftmost yanked column), so they can be pasted at any position.
yank_columns: usizeWidth of the yanked region in columns, so paste knows the source span.
row_highlight_low: Option<u8>Row highlight range (Shift+j/k). Stores MIDI note numbers (low..=high).
row_highlight_high: Option<u8>§highlight_locked: boolWhether highlights are locked for stretching (Enter while highlights exist).
edit_mode: bool§edit_cursor: usizeIndex into the clip’s notes vec — the “cursor” note.
edit_selected: Vec<usize>Indices of selected notes (for multi-select + move).
edit_sub: EditSubMode§grid: GridResolution§snap_enabled: bool§default_velocity: u8§settings_cursor: usizeSettings panel cursor (for the Settings tab).
Implementations§
Source§impl PianoRollState
impl PianoRollState
pub fn new() -> Self
Sourcepub fn enter(&mut self, note_indices: Vec<usize>)
pub fn enter(&mut self, note_indices: Vec<usize>)
Enter the next focus level. note_indices are the indices of notes
in the current column (captured at selection time so they don’t drift).
Sourcepub fn enter_row(&mut self)
pub fn enter_row(&mut self)
Enter row mode for the current cursor note (called when j/k finds a note).
pub fn escape(&mut self)
Sourcepub fn can_escape(&self) -> bool
pub fn can_escape(&self) -> bool
Returns true if escape was handled internally.
pub fn move_up(&mut self)
pub fn move_down(&mut self)
pub fn move_column_left(&mut self)
pub fn move_column_right(&mut self)
Sourcepub fn type_digit(&mut self, ch: char) -> bool
pub fn type_digit(&mut self, ch: char) -> bool
Type a digit for column number jump. Returns true if the column was set.
Sourcepub fn commit_digits(&mut self) -> bool
pub fn commit_digits(&mut self) -> bool
Force-resolve whatever is in the digit buffer.
Sourcepub fn ensure_column_visible(&mut self)
pub fn ensure_column_visible(&mut self)
Scroll to make the current column visible.
pub fn column_digits_display(&self) -> &str
Sourcepub fn start_highlight(&mut self)
pub fn start_highlight(&mut self)
Begin or cancel highlighting at the current column. If already highlighting and range is just the anchor column, cancel.
Sourcepub fn highlight_left(&mut self)
pub fn highlight_left(&mut self)
Expand highlight left (Shift+h while highlighting).
Sourcepub fn highlight_right(&mut self)
pub fn highlight_right(&mut self)
Expand highlight right (Shift+l while highlighting).
Sourcepub fn clear_highlight(&mut self)
pub fn clear_highlight(&mut self)
Clear the column highlight.
Sourcepub fn start_row_highlight(&mut self)
pub fn start_row_highlight(&mut self)
Begin or cancel row highlighting at the current cursor note.
Sourcepub fn highlight_down(&mut self)
pub fn highlight_down(&mut self)
Expand row highlight downward (Shift+j).
Sourcepub fn highlight_up(&mut self)
pub fn highlight_up(&mut self)
Expand row highlight upward (Shift+k).
pub fn clear_row_highlight(&mut self)
Sourcepub fn is_row_highlighted(&self, note: u8) -> bool
pub fn is_row_highlighted(&self, note: u8) -> bool
Check if a MIDI note is within the row highlight range.
Sourcepub fn row_highlight_range(&self) -> Option<(u8, u8)>
pub fn row_highlight_range(&self) -> Option<(u8, u8)>
Get the highlighted row range as (low_note, high_note).
Sourcepub fn clear_all_highlights(&mut self)
pub fn clear_all_highlights(&mut self)
Clear both column and row highlights.
Sourcepub fn is_highlighted(&self, col: usize) -> bool
pub fn is_highlighted(&self, col: usize) -> bool
Check if a column is within the highlight range.
Sourcepub fn highlight_range(&self) -> Option<(usize, usize)>
pub fn highlight_range(&self) -> Option<(usize, usize)>
Get the highlighted column range, if any.
pub fn set_view_height(&mut self, h: u8)
pub fn set_column_count(&mut self, count: usize)
Sourcepub fn has_highlights(&self) -> bool
pub fn has_highlights(&self) -> bool
Returns true if any column or row highlights are active.
Sourcepub fn column_display(&self) -> usize
pub fn column_display(&self) -> usize
The 1-based column number for display.