mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
clone EdnItem
This commit is contained in:
parent
400fd9b6e9
commit
3dd8a7bc0d
8 changed files with 190 additions and 169 deletions
44
src/groovebox/groovebox_edn.rs
Normal file
44
src/groovebox/groovebox_edn.rs
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
use crate::*;
|
||||
|
||||
impl EdnViewData<TuiOut> for &Groovebox {
|
||||
fn get_unit (&self, item: EdnItem<&str>) -> u16 {
|
||||
use EdnItem::*;
|
||||
match item.to_str() {
|
||||
":sample-h" => if self.compact { 0 } else { 5 },
|
||||
":samples-w" => if self.compact { 4 } else { 11 },
|
||||
":samples-y" => if self.compact { 1 } else { 0 },
|
||||
":pool-w" => if self.compact { 5 } else {
|
||||
let w = self.size.w();
|
||||
if w > 60 { 20 } else if w > 40 { 15 } else { 10 }
|
||||
},
|
||||
_ => 0
|
||||
}
|
||||
}
|
||||
fn get_content <'a> (&'a self, item: EdnItem<&str>) -> RenderBox<'a, TuiOut> {
|
||||
use EdnItem::*;
|
||||
match item {
|
||||
Nil => Box::new(()),
|
||||
Sym(bol) => match bol {
|
||||
":input-meter-l" => Meter("L/", self.sampler.input_meter[0]).boxed(),
|
||||
":input-meter-r" => Box::new(Meter("R/", self.sampler.input_meter[1])),
|
||||
|
||||
":transport" => Box::new(TransportView::new(true, &self.player.clock)),
|
||||
":clip-play" => Box::new(ClipSelected::play_phrase(&self.player)),
|
||||
":clip-next" => Box::new(ClipSelected::next_phrase(&self.player)),
|
||||
":clip-edit" => Box::new(MidiEditClip(&self.editor)),
|
||||
":edit-stat" => Box::new(MidiEditStatus(&self.editor)),
|
||||
":pool-view" => Box::new(PoolView(self.compact, &self.pool)),
|
||||
":midi-view" => Box::new(&self.editor),
|
||||
|
||||
":sample-view" => Box::new(SampleViewer::from_sampler(&self.sampler, self.editor.note_point())),
|
||||
":sample-stat" => Box::new(SamplerStatus(&self.sampler, self.editor.note_point())),
|
||||
":samples-view" => Box::new(SampleList::new(self.compact, &self.sampler, &self.editor)),
|
||||
|
||||
_ => panic!("unknown sym {bol:?}")
|
||||
},
|
||||
Exp(items) => Box::new(EdnView::from_items(*self, items.as_slice())),
|
||||
_ => panic!("no content for {item:?}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue