mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
sweeeeping sweep
This commit is contained in:
parent
c9b09b7dea
commit
e677d1d7d4
38 changed files with 766 additions and 691 deletions
|
|
@ -96,7 +96,7 @@ impl Command<MidiEditor> for PhraseCommand {
|
|||
|
||||
/// Contains state for viewing and editing a phrase
|
||||
pub struct MidiEditor {
|
||||
/// Renders the phrase
|
||||
/// Contents the phrase
|
||||
pub mode: Box<dyn PhraseViewMode>,
|
||||
pub size: Measure<Tui>
|
||||
}
|
||||
|
|
@ -111,7 +111,7 @@ impl Default for MidiEditor {
|
|||
|
||||
has_size!(<Tui>|self: MidiEditor|&self.size);
|
||||
|
||||
render!(<Tui>|self: MidiEditor|{
|
||||
render!(Tui: (self: MidiEditor) => {
|
||||
self.autoscroll();
|
||||
self.autozoom();
|
||||
&self.mode
|
||||
|
|
@ -119,7 +119,7 @@ render!(<Tui>|self: MidiEditor|{
|
|||
|
||||
//render!(<Tui>|self: MidiEditor|lay!(|add|{add(&self.size)?;add(self.mode)}));//bollocks
|
||||
|
||||
pub trait PhraseViewMode: Render<Tui> + HasSize<Tui> + MidiRange + MidiPoint + Debug + Send + Sync {
|
||||
pub trait PhraseViewMode: Content<Tui> + HasSize<Tui> + MidiRange + MidiPoint + Debug + Send + Sync {
|
||||
fn buffer_size (&self, phrase: &MidiClip) -> (usize, usize);
|
||||
fn redraw (&mut self);
|
||||
fn phrase (&self) -> &Option<Arc<RwLock<MidiClip>>>;
|
||||
|
|
@ -131,18 +131,10 @@ pub trait PhraseViewMode: Render<Tui> + HasSize<Tui> + MidiRange + MidiPoint + D
|
|||
}
|
||||
|
||||
impl Content<Tui> for Box<dyn PhraseViewMode> {
|
||||
fn content (&self) -> Option<impl Render<Tui>> {
|
||||
fn content (&self) -> Option<impl Content<Tui>> {
|
||||
Some(&(*self))
|
||||
}
|
||||
}
|
||||
impl Render<Tui> for Box<dyn PhraseViewMode> {
|
||||
fn min_size (&self, to: [u16;2]) -> Perhaps<[u16;2]> {
|
||||
self.content().unwrap().min_size(to)
|
||||
}
|
||||
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
||||
self.content().unwrap().render(to)
|
||||
}
|
||||
}
|
||||
|
||||
impl MidiView<Tui> for MidiEditor {}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue