mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
highlight phrase selectors
This commit is contained in:
parent
bbd784f58b
commit
c0c32c89b7
3 changed files with 27 additions and 11 deletions
|
|
@ -60,8 +60,8 @@ impl_focus!(TransportTui TransportFocus [
|
||||||
&[
|
&[
|
||||||
PlayPause,
|
PlayPause,
|
||||||
Bpm,
|
Bpm,
|
||||||
Quant,
|
|
||||||
Sync,
|
Sync,
|
||||||
|
Quant,
|
||||||
Clock,
|
Clock,
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -8,20 +8,28 @@ pub struct PhraseSelector<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> PhraseSelector<'a> {
|
impl<'a> PhraseSelector<'a> {
|
||||||
pub fn play_phrase <T: HasPhrase> (state: &'a T) -> Self {
|
pub fn play_phrase <T: HasPhrase> (
|
||||||
|
state: &'a T,
|
||||||
|
focused: bool,
|
||||||
|
entered: bool,
|
||||||
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
focused,
|
||||||
|
entered: focused && entered,
|
||||||
|
phrase: state.next_phrase(),
|
||||||
title: "Now:",
|
title: "Now:",
|
||||||
phrase: state.play_phrase(),
|
|
||||||
focused: false,
|
|
||||||
entered: false,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub fn next_phrase <T: HasPhrase> (state: &'a T) -> Self {
|
pub fn next_phrase <T: HasPhrase> (
|
||||||
|
state: &'a T,
|
||||||
|
focused: bool,
|
||||||
|
entered: bool,
|
||||||
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
title: "Next:",
|
focused,
|
||||||
|
entered: focused && entered,
|
||||||
phrase: state.next_phrase(),
|
phrase: state.next_phrase(),
|
||||||
focused: false,
|
title: "Next:",
|
||||||
entered: false,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,16 @@ impl Content for SequencerTui {
|
||||||
TransportView::from(self),
|
TransportView::from(self),
|
||||||
Split::right(20,
|
Split::right(20,
|
||||||
col_up!(
|
col_up!(
|
||||||
PhraseSelector::play_phrase(&self.player).fixed_y(4),
|
PhraseSelector::play_phrase(
|
||||||
PhraseSelector::next_phrase(&self.player).fixed_y(4),
|
&self.player,
|
||||||
|
self.focused() == SequencerFocus::PhrasePlay,
|
||||||
|
self.entered()
|
||||||
|
).fixed_y(4),
|
||||||
|
PhraseSelector::next_phrase(
|
||||||
|
&self.player,
|
||||||
|
self.focused() == SequencerFocus::PhraseNext,
|
||||||
|
self.entered()
|
||||||
|
).fixed_y(4),
|
||||||
PhraseListView::from(self),
|
PhraseListView::from(self),
|
||||||
),
|
),
|
||||||
PhraseView::from(self),
|
PhraseView::from(self),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue