use crate::*; impl EdnViewData 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(self.player.play_status()), ":clip-next" => Box::new(self.player.next_status()), ":clip-edit" => Box::new(self.editor.clip_status()), ":edit-stat" => Box::new(self.editor.edit_status()), ":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:?}") } } }