mirror of
https://codeberg.org/unspeaker/tek.git
synced 2026-08-28 21:06:56 +02:00
argh
This commit is contained in:
parent
5ffa9472e1
commit
89df3cf191
7 changed files with 164 additions and 95 deletions
|
|
@ -245,28 +245,28 @@ impl Pool {
|
|||
impl<'a> PoolView<'a> {
|
||||
fn tui (&self) -> impl Draw<Tui> {
|
||||
let Self(pool) = self;
|
||||
//let color = self.1.clip().map(|c|c.read().unwrap().color).unwrap_or_else(||Tui::g(32).into());
|
||||
//let on_bg = |x|x;//below(Repeat(" "), Tui::bg(color.darkest.term, x));
|
||||
//let color = self.1.clip().map(|c|c.read().unwrap().color).unwrap_or_else(||g(32).into());
|
||||
//let on_bg = |x|x;//below(Repeat(" "), bg(color.darkest.term, x));
|
||||
//let border = |x|x;//Outer(Style::default().fg(color.dark.term).bg(color.darkest.term)).enclose(x);
|
||||
//let height = pool.clips.read().unwrap().len() as u16;
|
||||
w_exact(20, h_full(origin_n(iter(
|
||||
||pool.clips().clone().into_iter(),
|
||||
move|clip: Arc<RwLock<MidiClip>>, i: usize|{
|
||||
let item_height = 1;
|
||||
let item_offset = i as u16 * item_height;
|
||||
let selected = i == pool.clip_index();
|
||||
let MidiClip { ref name, color, length, .. } = *clip.read().unwrap();
|
||||
let bg = if selected { color.light.term } else { color.base.term };
|
||||
let fg = color.lightest.term;
|
||||
let name = if false { format!(" {i:>3}") } else { format!(" {i:>3} {name}") };
|
||||
let length = if false { String::default() } else { format!("{length} ") };
|
||||
h_exact(1, iter_south(item_offset, item_height, Tui::bg(bg, below!(
|
||||
w_full(origin_w(Tui::fg(fg, Tui::bold(selected, name)))),
|
||||
w_full(origin_e(Tui::fg(fg, Tui::bold(selected, length)))),
|
||||
w_full(origin_w(When::new(selected, Tui::bold(true, Tui::fg(Tui::g(255), "▶"))))),
|
||||
w_full(origin_e(When::new(selected, Tui::bold(true, Tui::fg(Tui::g(255), "◀"))))),
|
||||
))))
|
||||
}))))
|
||||
let MidiClip { ref name, color, length, .. } = *clip.read().unwrap();
|
||||
let item_height = 1;
|
||||
let item_offset = i as u16 * item_height;
|
||||
let selected = i == pool.clip_index();
|
||||
let b = if selected { color.light.term } else { color.base.term };
|
||||
let f = color.lightest.term;
|
||||
let name = if false { format!(" {i:>3}") } else { format!(" {i:>3} {name}") };
|
||||
let length = if false { String::default() } else { format!("{length} ") };
|
||||
h_exact(1, iter_south(item_offset, item_height, bg(b, below!(
|
||||
w_full(origin_w(fg(fg, bold(selected, name)))),
|
||||
w_full(origin_e(fg(fg, bold(selected, length)))),
|
||||
w_full(origin_w(When::new(selected, bold(true, fg(g(255), "▶"))))),
|
||||
w_full(origin_e(When::new(selected, bold(true, fg(g(255), "◀"))))),
|
||||
))))
|
||||
}))))
|
||||
}
|
||||
}
|
||||
impl ClipLength {
|
||||
|
|
@ -337,10 +337,10 @@ impl<'a> Iterator for EntriesIterator<'a> {
|
|||
let index = self.index;
|
||||
if self.index < dirs {
|
||||
self.index += 1;
|
||||
Some(Tui::bold(true, self.browser.dirs[index].1.as_str()))
|
||||
Some(bold(true, self.browser.dirs[index].1.as_str()))
|
||||
} else if self.index < dirs + files {
|
||||
self.index += 1;
|
||||
Some(Tui::bold(false, self.browser.files[index - dirs].1.as_str()))
|
||||
Some(bold(false, self.browser.files[index - dirs].1.as_str()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue