/// Browses for files to load/save. /// /// ``` /// let browse = tek::Browse::default(); /// ``` #[derive(Debug, Clone, Default, PartialEq)] pub struct Browse { pub cwd: PathBuf, pub dirs: Vec<(OsString, String)>, pub files: Vec<(OsString, String)>, pub filter: String, pub index: usize, pub scroll: usize, pub size: Measure, } pub(crate) struct EntriesIterator<'a> { pub browser: &'a Browse, pub offset: usize, pub length: usize, pub index: usize, } #[derive(Clone, Debug)] pub enum BrowseTarget { SaveProject, LoadProject, ImportSample(Arc>>), ExportSample(Arc>>), ImportClip(Arc>>), ExportClip(Arc>>), } /// A clip pool. /// /// ``` /// let pool = tek::Pool::default(); /// ``` #[derive(Debug)] pub struct Pool { pub visible: bool, /// Selected clip pub clip: AtomicUsize, /// Mode switch pub mode: Option, /// Embedded file browse #[cfg(feature = "browse")] pub browse: Option, /// Collection of MIDI clips. #[cfg(feature = "clip")] pub clips: Arc>>>>, /// Collection of sound samples. #[cfg(feature = "sampler")] pub samples: Arc>>>>, } /// Displays and edits clip length. #[derive(Clone, Debug, Default)] pub struct ClipLength { /// Pulses per beat (quaver) pub ppq: usize, /// Beats per bar pub bpb: usize, /// Length of clip in pulses pub pulses: usize, /// Selected subdivision pub focus: Option, } /// Some sort of wrapper again? pub struct PoolView<'a>(pub &'a Pool); // Commands supported by [Browse] //#[derive(Debug, Clone, PartialEq)] //pub enum BrowseCommand { //Begin, //Cancel, //Confirm, //Select(usize), //Chdir(PathBuf), //Filter(Arc), //} /// Modes for clip pool #[derive(Debug, Clone)] pub enum PoolMode { /// Renaming a pattern Rename(usize, Arc), /// Editing the length of a pattern Length(usize, usize, ClipLengthFocus), /// Load clip from disk Import(usize, Browse), /// Save clip to disk Export(usize, Browse), } /// Focused field of `ClipLength` #[derive(Copy, Clone, Debug)] pub enum ClipLengthFocus { /// Editing the number of bars Bar, /// Editing the number of beats Beat, /// Editing the number of ticks Tick, }