pub struct PresetModal {
pub open: bool,
pub instrument: Option<InstrumentType>,
pub track_idx: usize,
pub cursor: usize,
pub entries: Vec<String>,
pub error: Option<String>,
pub pending_name: String,
}Expand description
The user-preset browser for the track under the cursor.
A modal rather than extra entries on the patch knob: the patch selector stores a normalised fraction, so lengthening the bank it indexes would remap every value already saved in a session. Browsing presets in their own list moves nothing.
Fields§
§open: bool§instrument: Option<InstrumentType>Whose bank this is. None until the modal is opened on a track.
track_idx: usizeThe track the bank was opened for. Held so a load lands on that track even if something moved the cursor while the modal was up.
cursor: usize§entries: Vec<String>Preset names in bank order, read when the modal opened.
error: Option<String>Why the bank could not be read, when it could not.
pending_name: StringName waiting on an overwrite confirmation.
Implementations§
Source§impl PresetModal
impl PresetModal
pub fn new() -> Self
pub fn show( &mut self, instrument: InstrumentType, track_idx: usize, entries: Vec<String>, )
pub fn close(&mut self)
Sourcepub fn item_count(&self) -> usize
pub fn item_count(&self) -> usize
Rows in the list: the save row plus one per preset.
pub fn move_up(&mut self)
pub fn move_down(&mut self)
Sourcepub fn selected_preset(&self) -> Option<usize>
pub fn selected_preset(&self) -> Option<usize>
Index into the bank for the selected row, or None on the save row.
Sourcepub fn selected_name(&self) -> Option<&str>
pub fn selected_name(&self) -> Option<&str>
Name of the selected preset, or None on the save row.
Sourcepub fn set_entries(&mut self, entries: Vec<String>)
pub fn set_entries(&mut self, entries: Vec<String>)
Replace the list after a save or delete, keeping the cursor on something that exists.