Skip to main content

PianoRollState

Struct PianoRollState 

Source
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: PianoRollFocus

Current focus level.

§column: usize

Currently selected column (0-based). Columns map to time subdivisions.

§column_count: usize

Total 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: usize

Number 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: usize

Width 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: bool

Whether highlights are locked for stretching (Enter while highlights exist).

§edit_mode: bool§edit_cursor: usize

Index 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: usize

Settings panel cursor (for the Settings tab).

Implementations§

Source§

impl PianoRollState

Source

pub fn new() -> Self

Source

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).

Source

pub fn enter_row(&mut self)

Enter row mode for the current cursor note (called when j/k finds a note).

Source

pub fn escape(&mut self)

Source

pub fn can_escape(&self) -> bool

Returns true if escape was handled internally.

Source

pub fn move_up(&mut self)

Source

pub fn move_down(&mut self)

Source

pub fn move_column_left(&mut self)

Source

pub fn move_column_right(&mut self)

Source

pub fn type_digit(&mut self, ch: char) -> bool

Type a digit for column number jump. Returns true if the column was set.

Source

pub fn commit_digits(&mut self) -> bool

Force-resolve whatever is in the digit buffer.

Source

pub fn ensure_column_visible(&mut self)

Scroll to make the current column visible.

Source

pub fn column_digits_display(&self) -> &str

Source

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.

Source

pub fn highlight_left(&mut self)

Expand highlight left (Shift+h while highlighting).

Source

pub fn highlight_right(&mut self)

Expand highlight right (Shift+l while highlighting).

Source

pub fn clear_highlight(&mut self)

Clear the column highlight.

Source

pub fn start_row_highlight(&mut self)

Begin or cancel row highlighting at the current cursor note.

Source

pub fn highlight_down(&mut self)

Expand row highlight downward (Shift+j).

Source

pub fn highlight_up(&mut self)

Expand row highlight upward (Shift+k).

Source

pub fn clear_row_highlight(&mut self)

Source

pub fn is_row_highlighted(&self, note: u8) -> bool

Check if a MIDI note is within the row highlight range.

Source

pub fn row_highlight_range(&self) -> Option<(u8, u8)>

Get the highlighted row range as (low_note, high_note).

Source

pub fn clear_all_highlights(&mut self)

Clear both column and row highlights.

Source

pub fn is_highlighted(&self, col: usize) -> bool

Check if a column is within the highlight range.

Source

pub fn highlight_range(&self) -> Option<(usize, usize)>

Get the highlighted column range, if any.

Source

pub fn set_view_height(&mut self, h: u8)

Source

pub fn set_column_count(&mut self, count: usize)

Source

pub fn has_highlights(&self) -> bool

Returns true if any column or row highlights are active.

Source

pub fn column_display(&self) -> usize

The 1-based column number for display.

Trait Implementations§

Source§

impl Debug for PianoRollState

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for PianoRollState

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,