mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 12:46:42 +01:00
move containers to space 🪐
This commit is contained in:
parent
2073bb541d
commit
35b37e3e3a
3 changed files with 514 additions and 520 deletions
|
|
@ -88,7 +88,7 @@ impl<E: Engine> TransportToolbar<E> {
|
|||
}
|
||||
}
|
||||
pub fn toggle_play (&mut self) -> Usually<()> {
|
||||
self.playing.toggle();
|
||||
self.playing.toggle()?;
|
||||
Ok(())
|
||||
}
|
||||
pub fn update (&mut self, scope: &ProcessScope) -> (bool, usize, usize, usize, usize, f64) {
|
||||
|
|
@ -146,40 +146,6 @@ impl<E: Engine> TransportToolbar<E> {
|
|||
self.sync.value
|
||||
}
|
||||
}
|
||||
impl Focus<5, Tui> for TransportToolbar<Tui> {
|
||||
fn focus (&self) -> usize {
|
||||
self.focus
|
||||
}
|
||||
fn focus_mut (&mut self) -> &mut usize {
|
||||
&mut self.focus
|
||||
}
|
||||
fn focusable (&self) -> [&dyn Focusable<Tui>;5] {
|
||||
[
|
||||
&self.playing as &dyn Focusable<Tui>,
|
||||
&self.bpm as &dyn Focusable<Tui>,
|
||||
&self.quant as &dyn Focusable<Tui>,
|
||||
&self.sync as &dyn Focusable<Tui>,
|
||||
&self.clock as &dyn Focusable<Tui>,
|
||||
]
|
||||
}
|
||||
fn focusable_mut (&mut self) -> [&mut dyn Focusable<Tui>;5] {
|
||||
[
|
||||
&mut self.playing as &mut dyn Focusable<Tui>,
|
||||
&mut self.bpm as &mut dyn Focusable<Tui>,
|
||||
&mut self.quant as &mut dyn Focusable<Tui>,
|
||||
&mut self.sync as &mut dyn Focusable<Tui>,
|
||||
&mut self.clock as &mut dyn Focusable<Tui>,
|
||||
]
|
||||
}
|
||||
}
|
||||
impl Focusable<Tui> for TransportToolbar<Tui> {
|
||||
fn is_focused (&self) -> bool {
|
||||
self.focused
|
||||
}
|
||||
fn set_focused (&mut self, focused: bool) {
|
||||
self.focused = focused
|
||||
}
|
||||
}
|
||||
impl<E: Engine> Audio for TransportToolbar<E> {
|
||||
fn process (&mut self, _: &Client, scope: &ProcessScope) -> Control {
|
||||
self.update(&scope);
|
||||
|
|
@ -214,6 +180,40 @@ impl Content for TransportToolbar<Tui> {
|
|||
})
|
||||
}
|
||||
}
|
||||
impl Focus<5, Tui> for TransportToolbar<Tui> {
|
||||
fn focus (&self) -> usize {
|
||||
self.focus
|
||||
}
|
||||
fn focus_mut (&mut self) -> &mut usize {
|
||||
&mut self.focus
|
||||
}
|
||||
fn focusable (&self) -> [&dyn Focusable<Tui>;5] {
|
||||
[
|
||||
&self.playing as &dyn Focusable<Tui>,
|
||||
&self.bpm as &dyn Focusable<Tui>,
|
||||
&self.quant as &dyn Focusable<Tui>,
|
||||
&self.sync as &dyn Focusable<Tui>,
|
||||
&self.clock as &dyn Focusable<Tui>,
|
||||
]
|
||||
}
|
||||
fn focusable_mut (&mut self) -> [&mut dyn Focusable<Tui>;5] {
|
||||
[
|
||||
&mut self.playing as &mut dyn Focusable<Tui>,
|
||||
&mut self.bpm as &mut dyn Focusable<Tui>,
|
||||
&mut self.quant as &mut dyn Focusable<Tui>,
|
||||
&mut self.sync as &mut dyn Focusable<Tui>,
|
||||
&mut self.clock as &mut dyn Focusable<Tui>,
|
||||
]
|
||||
}
|
||||
}
|
||||
impl Focusable<Tui> for TransportToolbar<Tui> {
|
||||
fn is_focused (&self) -> bool {
|
||||
self.focused
|
||||
}
|
||||
fn set_focused (&mut self, focused: bool) {
|
||||
self.focused = focused
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
@ -260,8 +260,8 @@ impl Content for TransportPlayPauseButton<Tui> {
|
|||
type Engine = Tui;
|
||||
fn content (&self) -> impl Widget<Engine = Tui> {
|
||||
Layers::new(|add|{
|
||||
//add(&self.focused.then_some(CORNERS))?;
|
||||
add(&Styled(match self.value {
|
||||
add(&self.focused.then_some(CORNERS))?;
|
||||
add(&Plus::X(1, Min::Y(2, Styled(match self.value {
|
||||
Some(TransportState::Stopped) => Some(GRAY_DIM.bold()),
|
||||
Some(TransportState::Starting) => Some(GRAY_NOT_DIM_BOLD),
|
||||
Some(TransportState::Rolling) => Some(WHITE_NOT_DIM_BOLD),
|
||||
|
|
@ -271,7 +271,7 @@ impl Content for TransportPlayPauseButton<Tui> {
|
|||
Some(TransportState::Starting) => "READY ...",
|
||||
Some(TransportState::Stopped) => "⏹ STOPPED",
|
||||
_ => unreachable!(),
|
||||
}))?;
|
||||
}))))?;
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue