mirror of
https://codeberg.org/unspeaker/tek.git
synced 2026-10-08 18:56:42 +02:00
unified compact flag in groovebox
This commit is contained in:
parent
c9a79b1f29
commit
511ff91864
12 changed files with 129 additions and 188 deletions
34
src/pool.rs
34
src/pool.rs
|
|
@ -1,14 +1,10 @@
|
|||
mod pool_tui; pub use self::pool_tui::*;
|
||||
mod clip_length; pub use self::clip_length::*;
|
||||
mod clip_rename; pub use self::clip_rename::*;
|
||||
mod clip_select; pub use self::clip_select::*;
|
||||
|
||||
use super::*;
|
||||
|
||||
pub mod phrase_length;
|
||||
pub(crate) use phrase_length::*;
|
||||
|
||||
pub mod phrase_rename;
|
||||
pub(crate) use phrase_rename::*;
|
||||
|
||||
pub mod phrase_selector;
|
||||
pub(crate) use phrase_selector::*;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct PoolModel {
|
||||
pub(crate) visible: bool,
|
||||
|
|
@ -205,23 +201,3 @@ impl PoolModel {
|
|||
}
|
||||
}
|
||||
}
|
||||
pub struct PoolView<'a>(pub(crate) &'a PoolModel);
|
||||
render!(Tui: (self: PoolView<'a>) => {
|
||||
let PoolModel { phrases, mode, .. } = self.0;
|
||||
let color = self.0.phrase().read().unwrap().color;
|
||||
Outer(
|
||||
Style::default().fg(color.dark.rgb).bg(color.darkest.rgb)
|
||||
).enclose(Tui::map(||self.0.phrases().iter(), |clip, i|{
|
||||
let MidiClip { ref name, color, length, .. } = *clip.read().unwrap();
|
||||
let item_height = 1;
|
||||
let item_offset = i as u16 * item_height;
|
||||
let selected = i == self.0.phrase_index();
|
||||
let offset = |a|Push::y(item_offset, Align::n(Fixed::y(item_height, Fill::x(a))));
|
||||
offset(Tui::bg(if selected { color.light.rgb } else { color.base.rgb }, lay!(
|
||||
Align::w(Tui::fg(color.lightest.rgb, Tui::bold(selected, format!(" {i:>3} {name}")))),
|
||||
Align::e(Tui::fg(color.lightest.rgb, Tui::bold(selected, format!("{length} ")))),
|
||||
Align::w(Tui::when(selected, Tui::bold(true, Tui::fg(TuiTheme::g(255), "▶")))),
|
||||
Align::e(Tui::when(selected, Tui::bold(true, Tui::fg(TuiTheme::g(255), "◀")))),
|
||||
)))
|
||||
}))
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue