wip: p.53, e=118, fixed focus trait loop

This commit is contained in:
🪞👃🪞 2024-11-17 19:19:46 +01:00
parent 9b996878c2
commit 76af9d9bac
15 changed files with 737 additions and 727 deletions

View file

@ -45,6 +45,7 @@ impl TransportFocus {
Self::Quant => Self::Sync,
Self::Sync => Self::Clock,
Self::Clock => Self::PlayPause,
Self::Menu => { todo!() },
}
}
pub fn prev (&mut self) {
@ -54,6 +55,7 @@ impl TransportFocus {
Self::Quant => Self::Bpm,
Self::Sync => Self::Quant,
Self::Clock => Self::Sync,
Self::Menu => { todo!() },
}
}
pub fn wrap <'a, W: Widget<Engine = Tui>> (
@ -66,9 +68,9 @@ impl TransportFocus {
}
}
impl HasFocus for TransportTui {
type Item = TransportFocus;
}
//impl HasFocus for TransportTui {
//type Item = TransportFocus;
//}
impl FocusEnter for TransportTui {
type Item = TransportFocus;
@ -107,9 +109,9 @@ impl FocusGrid for TransportTui {
}
}
impl HasFocus for SequencerTui {
type Item = SequencerFocus;
}
//impl HasFocus for SequencerTui {
//type Item = SequencerFocus;
//}
impl FocusEnter for SequencerTui {
type Item = SequencerFocus;
@ -163,15 +165,15 @@ impl FocusEnter for ArrangerTui {
let focused = self.focused();
if !self.entered {
self.entered = focused == Arranger;
self.app.editor.entered = focused == PhraseEditor;
self.app.phrases.entered = focused == PhrasePool;
self.editor.entered = focused == PhraseEditor;
self.phrases.entered = focused == PhrasePool;
}
}
fn focus_exit (&mut self) {
if self.entered {
self.entered = false;
self.app.editor.entered = false;
self.app.phrases.entered = false;
self.editor.entered = false;
self.phrases.entered = false;
}
}
fn focus_entered (&self) -> Option<Self::Item> {
@ -207,7 +209,7 @@ impl FocusGrid for ArrangerTui {
if let Some(mut status_bar) = self.status_bar {
status_bar.update(&(
self.focused(),
self.app.selected,
self.selected,
focused == PhraseEditor && self.entered
))
}