phrases: autoshow, autoedit

This commit is contained in:
🪞👃🪞 2024-11-02 20:25:28 +02:00
parent 02fa22e2ea
commit 2f904ed78b
4 changed files with 14 additions and 26 deletions

View file

@ -160,6 +160,7 @@ impl<E: Engine> Arranger<E> {
} }
self.show_phrase(); self.show_phrase();
self.focus(ArrangerFocus::PhraseEditor); self.focus(ArrangerFocus::PhraseEditor);
self.editor.entered = true;
} }
/// Rename the selected track, scene, or clip /// Rename the selected track, scene, or clip
pub fn rename_selected (&mut self) { pub fn rename_selected (&mut self) {

View file

@ -27,9 +27,10 @@ impl Arranger<Tui> {
fn handle_focused (&mut self, from: &TuiInput) -> Perhaps<bool> { fn handle_focused (&mut self, from: &TuiInput) -> Perhaps<bool> {
match self.focused() { match self.focused() {
ArrangerFocus::Transport => self.transport.handle(from), ArrangerFocus::Transport => self.transport.handle(from),
ArrangerFocus::Arrangement => self.handle_arrangement(from),
ArrangerFocus::PhrasePool => self.handle_pool(from), ArrangerFocus::PhrasePool => self.handle_pool(from),
ArrangerFocus::PhraseEditor => self.editor.handle(from), ArrangerFocus::PhraseEditor => self.editor.handle(from),
ArrangerFocus::Arrangement => self.handle_arrangement(from)
.and_then(|result|{self.show_phrase();Ok(result)}),
} }
} }
/// Helper for phrase event passthru when phrase pool is focused /// Helper for phrase event passthru when phrase pool is focused

View file

@ -134,8 +134,8 @@ impl<'a> Content for VerticalArranger<'a, Tui> {
let scenes = state.scenes.as_ref(); let scenes = state.scenes.as_ref();
let bg = state.color; let bg = state.color;
let clip_bg = Color::Rgb(40, 50, 30); let clip_bg = Color::Rgb(40, 50, 30);
let border_hi = Color::Rgb(100, 110, 40); //let border_hi = Color::Rgb(100, 110, 40);
let border_lo = Color::Rgb(70, 80, 50); //let border_lo = Color::Rgb(70, 80, 50);
//let border_bg = Color::Rgb(40, 50, 30); //let border_bg = Color::Rgb(40, 50, 30);
//let border_fg = if self.0.focused { border_hi } else { border_lo }; //let border_fg = if self.0.focused { border_hi } else { border_lo };
//let border = Lozenge(Style::default().bg(border_bg).fg(border_fg)); //let border = Lozenge(Style::default().bg(border_bg).fg(border_fg));
@ -334,9 +334,7 @@ impl<'a> Content for HorizontalArranger<'a, Tui> {
focused.then_some(Background(Color::Rgb(40, 50, 30))), focused.then_some(Background(Color::Rgb(40, 50, 30))),
row!( row!(
// name // name
CustomWidget::new(|_|{ CustomWidget::new(|_|{todo!()}, |_: &mut TuiOutput|{
todo!()
}, |_: &mut TuiOutput|{
todo!() todo!()
//let Self(tracks, selected) = self; //let Self(tracks, selected) = self;
//let yellow = Some(Style::default().yellow().bold().not_dim()); //let yellow = Some(Style::default().yellow().bold().not_dim());
@ -360,9 +358,7 @@ impl<'a> Content for HorizontalArranger<'a, Tui> {
//Ok(Some(area)) //Ok(Some(area))
}), }),
// monitor // monitor
CustomWidget::new(|_|{ CustomWidget::new(|_|{todo!()}, |_: &mut TuiOutput|{
todo!()
}, |_: &mut TuiOutput|{
todo!() todo!()
//let Self(tracks) = self; //let Self(tracks) = self;
//let mut area = to.area(); //let mut area = to.area();
@ -387,9 +383,7 @@ impl<'a> Content for HorizontalArranger<'a, Tui> {
//Ok(Some(area)) //Ok(Some(area))
}), }),
// record // record
CustomWidget::new(|_|{ CustomWidget::new(|_|{todo!()}, |_: &mut TuiOutput|{
todo!()
}, |_: &mut TuiOutput|{
todo!() todo!()
//let Self(tracks) = self; //let Self(tracks) = self;
//let mut area = to.area(); //let mut area = to.area();
@ -414,9 +408,7 @@ impl<'a> Content for HorizontalArranger<'a, Tui> {
//Ok(Some(area)) //Ok(Some(area))
}), }),
// overdub // overdub
CustomWidget::new(|_|{ CustomWidget::new(|_|{todo!()}, |_: &mut TuiOutput|{
todo!()
}, |_: &mut TuiOutput|{
todo!() todo!()
//let Self(tracks) = self; //let Self(tracks) = self;
//let mut area = to.area(); //let mut area = to.area();
@ -444,9 +436,7 @@ impl<'a> Content for HorizontalArranger<'a, Tui> {
//Ok(Some(area)) //Ok(Some(area))
}), }),
// erase // erase
CustomWidget::new(|_|{ CustomWidget::new(|_|{todo!()}, |_: &mut TuiOutput|{
todo!()
}, |_: &mut TuiOutput|{
todo!() todo!()
//let Self(tracks) = self; //let Self(tracks) = self;
//let mut area = to.area(); //let mut area = to.area();
@ -469,9 +459,7 @@ impl<'a> Content for HorizontalArranger<'a, Tui> {
//Ok(Some(area)) //Ok(Some(area))
}), }),
// gain // gain
CustomWidget::new(|_|{ CustomWidget::new(|_|{todo!()}, |_: &mut TuiOutput|{
todo!()
}, |_: &mut TuiOutput|{
todo!() todo!()
//let Self(tracks) = self; //let Self(tracks) = self;
//let mut area = to.area(); //let mut area = to.area();
@ -494,9 +482,7 @@ impl<'a> Content for HorizontalArranger<'a, Tui> {
//Ok(Some(area)) //Ok(Some(area))
}), }),
// scenes // scenes
CustomWidget::new(|_|{ CustomWidget::new(|_|{todo!()}, |to: &mut TuiOutput|{
todo!()
}, |to: &mut TuiOutput|{
let Arrangement { scenes, selected, .. } = self.0; let Arrangement { scenes, selected, .. } = self.0;
let area = to.area(); let area = to.area();
let mut x2 = 0; let mut x2 = 0;

View file

@ -96,7 +96,7 @@ impl Content for PhraseEditor<Tui> {
}) })
}).fill_x(); }).fill_x();
let cursor = CustomWidget::new(|to|Ok(Some(to)), move|to: &mut TuiOutput|{ let cursor = CustomWidget::new(|to|Ok(Some(to)), move|to: &mut TuiOutput|{
Ok(if *entered { Ok(if *focused && *entered {
let area = to.area(); let area = to.area();
if let (Some(time), Some(note)) = (time_point, note_point) { if let (Some(time), Some(note)) = (time_point, note_point) {
let x1 = area.x() + (time / time_scale) as u16; let x1 = area.x() + (time / time_scale) as u16;
@ -104,7 +104,7 @@ impl Content for PhraseEditor<Tui> {
let y = area.y() + note.saturating_sub(note_start) as u16 / 2; let y = area.y() + note.saturating_sub(note_start) as u16 / 2;
let c = if note % 2 == 0 { "" } else { "" }; let c = if note % 2 == 0 { "" } else { "" };
for x in x1..x2 { for x in x1..x2 {
to.blit(&c, x, y, Some(Style::default().fg(color))); to.blit(&c, x, y, Some(Style::default().fg(Color::Rgb(0,255,0))));
} }
} }
}) })