mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
wip: fixing Map, centering
This commit is contained in:
parent
059ff2ca79
commit
d17d20e7db
10 changed files with 104 additions and 78 deletions
|
|
@ -19,7 +19,7 @@ impl<'a> ArrangerVClips<'a> {
|
|||
}
|
||||
impl<'a> Content<Tui> for ArrangerVClips<'a> {
|
||||
fn content (&self) -> impl Content<Tui> {
|
||||
let iter = self.scenes.iter().zip(self.rows.iter().map(|row|row.0));
|
||||
let iter = ||self.scenes.iter().zip(self.rows.iter().map(|row|row.0));
|
||||
let col = Tui::map(iter, |(scene, pulses), i|Self::format_scene(self.tracks, scene, pulses));
|
||||
Fill::xy(col)
|
||||
}
|
||||
|
|
@ -37,7 +37,7 @@ impl<'a> ArrangerVClips<'a> {
|
|||
let name = Tui::fg_bg(scene.color.lightest.rgb, scene.color.base.rgb,
|
||||
Expand::x(1, Tui::bold(true, scene.name.read().unwrap().clone()))
|
||||
);
|
||||
let clips = Tui::map(ArrangerTrack::with_widths(tracks), move|(index, track, x1, x2), _|
|
||||
let clips = Tui::map(||ArrangerTrack::with_widths(tracks), move|(index, track, x1, x2), _|
|
||||
Push::x((x2 - x1) as u16, Self::format_clip(scene, index, track, (x2 - x1) as u16, height))
|
||||
);
|
||||
Fixed::y(height, row!(icon, name, clips))
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ render!(Tui: (self: ArrangerVHead<'a>) => {
|
|||
row!(Tui::fg(color.light.rgb, "▎"), Tui::fg(color.lightest.rgb, field))
|
||||
}
|
||||
Some(Push::x(self.scenes_w,
|
||||
Tui::map(ArrangerTrack::with_widths(self.tracks), |(_, track, x1, x2), i| {
|
||||
Tui::map(||ArrangerTrack::with_widths(self.tracks), |(_, track, x1, x2), i| {
|
||||
let (w, h) = (ArrangerTrack::MIN_WIDTH.max(x2 - x1), HEADER_H);
|
||||
let color = track.color();
|
||||
let input = Self::format_input(track);
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ render!(Tui: (self: Groovebox) => {
|
|||
PhraseSelector::play_phrase(&self.player),
|
||||
PhraseSelector::next_phrase(&self.player),
|
||||
)));
|
||||
"tabula rasa"
|
||||
PoolView(&self.pool)
|
||||
//let pool = PoolView(&self.pool);
|
||||
//let with_pool = move|x|Bsp::w(Fixed::x(pool_w, Pull::y(1, Fill::y(Align::e(pool)))), x);
|
||||
//with_pool(col!(transport, selector))
|
||||
|
|
@ -182,7 +182,8 @@ render!(Tui: (self: GrooveboxSamples<'a>) => {
|
|||
let note_lo = self.0.editor.note_lo().load(Relaxed);
|
||||
let note_pt = self.0.editor.note_point();
|
||||
let note_hi = self.0.editor.note_hi();
|
||||
Fill::xy(Tui::map((note_lo..=note_hi).rev(), move|note, i| {
|
||||
let range = move||(note_lo..=note_hi).rev();
|
||||
Fill::xy(Tui::map(range, move|note, i| {
|
||||
let mut bg = if note == note_pt { TuiTheme::g(64) } else { Color::Reset };
|
||||
let mut fg = TuiTheme::g(160);
|
||||
if let Some((index, _)) = self.0.sampler.recording {
|
||||
|
|
|
|||
85
src/pool.rs
85
src/pool.rs
|
|
@ -209,49 +209,54 @@ pub struct PoolView<'a>(pub(crate) &'a PoolModel);
|
|||
// TODO: Display phrases always in order of appearance
|
||||
render!(Tui: (self: PoolView<'a>) => {
|
||||
let PoolModel { phrases, mode, .. } = self.0;
|
||||
let bg = TuiTheme::g(32);
|
||||
let bg = TuiTheme::g(32);
|
||||
let title_color = TuiTheme::ti1();
|
||||
let upper_left = "Pool:";
|
||||
let upper_left = "Pool:";
|
||||
let upper_right = format!("({})", phrases.len());
|
||||
let color = self.0.phrase().read().unwrap().color;
|
||||
let border = Fill::xy(Outer(Style::default().fg(color.base.rgb).bg(bg)));
|
||||
let enclose = |x|lay!(border, Padding::xy(0, 1, Tui::bg(bg, x)));
|
||||
let content = Tui::either(
|
||||
self.0.file_picker().is_some(),
|
||||
let color = self.0.phrase().read().unwrap().color;
|
||||
let with_files = |x|Tui::either(self.0.file_picker().is_some(),
|
||||
Thunk::new(||self.0.file_picker().unwrap()),
|
||||
Thunk::new(||Tui::map(phrases.iter(), |phrase, i|{
|
||||
let MidiClip { ref name, color, length, .. } = *phrase.read().unwrap();
|
||||
let mut length = PhraseLength::new(length, None);
|
||||
if let Some(PoolMode::Length(phrase, new_length, focus)) = self.0.mode {
|
||||
if i == phrase {
|
||||
length.pulses = new_length;
|
||||
length.focus = Some(focus);
|
||||
}
|
||||
}
|
||||
let clip = Tui::bg(color.base.rgb, Fill::x(col!(
|
||||
Fill::x(lay!(
|
||||
Fill::x(Align::w(format!(" {i}"))),
|
||||
Fill::x(Align::e(Pull::x(1, length.clone()))),
|
||||
)),
|
||||
Tui::bold(true, {
|
||||
let mut row2 = format!(" {name}");
|
||||
if let Some(PoolMode::Rename(phrase, _)) = self.0.mode {
|
||||
if i == phrase {
|
||||
row2 = format!("{row2}▄");
|
||||
}
|
||||
};
|
||||
row2
|
||||
}),
|
||||
)));
|
||||
Push::y(i as u16 * 2, lay!(clip, Tui::when(i == self.0.phrase_index(), CORNERS)))
|
||||
})));
|
||||
enclose(lay!(
|
||||
//add(&Lozenge(Style::default().bg(border_bg).fg(border_color)))?;
|
||||
content,
|
||||
Fill::x(Align::nw(Push::x(1, Tui::fg(title_color, upper_left.to_string())))),
|
||||
Fill::x(Align::ne(Pull::x(1, Tui::fg(title_color, upper_right.to_string())))),
|
||||
self.0.size.clone()
|
||||
))
|
||||
Thunk::new(x));
|
||||
let content = with_files(||Tui::map(||phrases.iter(), |clip, i|{
|
||||
let MidiClip { ref name, color, length, .. } = *clip.read().unwrap();
|
||||
//let mut length = PhraseLength::new(length, None);
|
||||
//if let Some(PoolMode::Length(clip, new_length, focus)) = self.0.mode {
|
||||
//if i == clip {
|
||||
//length.pulses = new_length;
|
||||
//length.focus = Some(focus);
|
||||
//}
|
||||
//}
|
||||
Push::y(1 + i as u16 * 2, Fill::x(Fixed::y(2, Tui::bg(color.base.rgb,
|
||||
format!(" {i} {name} {length} ")))))/*,
|
||||
name.clone()))))Bsp::s(
|
||||
Fill::x(Bsp::a(
|
||||
Align::w(format!(" {i}")),
|
||||
Align::e(Pull::x(1, length)),
|
||||
)),
|
||||
Tui::bold(true, {
|
||||
let mut row2 = format!(" {name}");
|
||||
if let Some(PoolMode::Rename(clip, _)) = self.0.mode {
|
||||
if i == clip {
|
||||
row2 = format!("{row2}▄");
|
||||
}
|
||||
};
|
||||
row2
|
||||
}),
|
||||
))))//lay!(clip, Tui::when(i == self.0.clip_index(), CORNERS)))*/
|
||||
}));
|
||||
content
|
||||
//let border = Outer(Style::default().fg(color.base.rgb).bg(color.dark.rgb));
|
||||
//let enclose = |x|lay!(
|
||||
//Fill::xy(border),
|
||||
//Padding::xy(0, 1, Tui::bg(bg, x))
|
||||
//);
|
||||
//enclose(lay!(
|
||||
////add(&Lozenge(Style::default().bg(border_bg).fg(border_color)))?;
|
||||
//Fill::xy(content),
|
||||
//Fill::x(Align::nw(Push::x(1, Tui::fg(title_color, upper_left.to_string())))),
|
||||
//Fill::x(Align::ne(Pull::x(1, Tui::fg(title_color, upper_right.to_string())))),
|
||||
//self.0.size.clone()
|
||||
//))
|
||||
});
|
||||
command!(|self: FileBrowserCommand, state: PoolModel|{
|
||||
use PoolMode::*;
|
||||
|
|
|
|||
|
|
@ -23,10 +23,11 @@ from_jack!(|jack|TransportTui Self {
|
|||
has_clock!(|self: TransportTui|&self.clock);
|
||||
audio!(|self: TransportTui, client, scope|ClockAudio(self).process(client, scope));
|
||||
handle!(<Tui>|self: TransportTui, from|TransportCommand::execute_with_state(self, from));
|
||||
render!(Tui: (self: TransportTui) => Align::x(Fixed::y(3, row!(
|
||||
render!(Tui: (self: TransportTui) => PlayPause(false));
|
||||
/*Align::x(Fixed::y(3, row!(
|
||||
Fixed::x(5, Fixed::y(3, PlayPause(false))),
|
||||
TransportView::new(self, Some(self.color), true),
|
||||
))));
|
||||
))));*/
|
||||
impl std::fmt::Debug for TransportTui {
|
||||
fn fmt (&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
|
||||
f.debug_struct("TransportTui")
|
||||
|
|
@ -111,14 +112,9 @@ render!(Tui: (self: TransportView) => {
|
|||
pub struct PlayPause(pub bool);
|
||||
render!(Tui: (self: PlayPause) => Tui::bg(
|
||||
if self.0{Color::Rgb(0,128,0)}else{Color::Rgb(128,64,0)},
|
||||
Fixed::x(5, Tui::either(self.0, Tui::fg(Color::Rgb(0, 255, 0), col!(
|
||||
" 🭍🭑🬽 ",
|
||||
" 🭞🭜🭘 ",
|
||||
)), Tui::fg(Color::Rgb(255, 128, 0), col!(
|
||||
" ▗▄▖ ",
|
||||
" ▝▀▘ ",
|
||||
))))
|
||||
));
|
||||
Fixed::x(5, Tui::either(self.0,
|
||||
Tui::fg(Color::Rgb(0, 255, 0), Bsp::s(" 🭍🭑🬽 ", " 🭞🭜🭘 ",)),
|
||||
Tui::fg(Color::Rgb(255, 128, 0), Bsp::s(" ▗▄▖ ", " ▝▀▘ ",))))));
|
||||
impl HasFocus for TransportTui {
|
||||
type Item = TransportFocus;
|
||||
fn focused (&self) -> Self::Item {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue