mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
add focus mode
This commit is contained in:
parent
5b57f2b998
commit
ddff9b3a60
4 changed files with 50 additions and 82 deletions
|
|
@ -102,56 +102,55 @@ render!(Tui: (self: Groovebox) => {
|
|||
let w = self.size.w();
|
||||
let phrase_w = if w > 60 { 20 } else if w > 40 { 15 } else { 10 };
|
||||
let pool_w = if self.pool.visible { phrase_w } else { 0 };
|
||||
let sampler_w = 11;
|
||||
let sampler_w = if self.pool.visible { phrase_w } else { 0 };
|
||||
let sample_h = if self.pool.visible { 8 } else { 0 };
|
||||
let note_pt = self.editor.note_point();
|
||||
let color = self.player.play_phrase().as_ref()
|
||||
.and_then(|(_,p)|p.as_ref().map(|p|p.read().unwrap().color))
|
||||
.clone();
|
||||
Fill::xy(Bsp::b(
|
||||
&self.size,
|
||||
Bsp::s(
|
||||
Fill::x(Fixed::y(3, Align::x(TransportView(&self.player.clock)))),
|
||||
Bsp::n(
|
||||
Fixed::y(9, Bsp::s(
|
||||
self.sampler.mapped[note_pt].as_ref().map(|sample|format!(
|
||||
"Sample {}-{}",
|
||||
sample.read().unwrap().start,
|
||||
sample.read().unwrap().end,
|
||||
)),
|
||||
Bsp::a(
|
||||
Outer(Style::default().fg(TuiTheme::g(128))),
|
||||
Fill::x(Fixed::y(8, if let Some((_, sample)) = &self.sampler.recording {
|
||||
SampleViewer(Some(sample.clone()))
|
||||
} else if let Some(sample) = &self.sampler.mapped[note_pt] {
|
||||
SampleViewer(Some(sample.clone()))
|
||||
} else {
|
||||
SampleViewer(None)
|
||||
})),
|
||||
),
|
||||
)),
|
||||
Bsp::w(
|
||||
Align::e(Fill::y(Fixed::x(pool_w, PoolView(&self.pool)))),
|
||||
Fill::xy(Bsp::e(
|
||||
Align::w(Fixed::x(sampler_w, Tui::bg(TuiTheme::g(32), Fill::xy(col!(
|
||||
Meters(self.sampler.input_meter.as_ref()),
|
||||
GrooveboxSamples(self)
|
||||
))))),
|
||||
Bsp::s(
|
||||
Fill::x(Align::c(Bsp::e(
|
||||
PhraseSelector::play_phrase(&self.player),
|
||||
PhraseSelector::next_phrase(&self.player),
|
||||
))),
|
||||
Bsp::n(
|
||||
MidiEditStatus(&self.editor),
|
||||
&self.editor,
|
||||
),
|
||||
self.size.of(Bsp::s(
|
||||
Fill::x(Fixed::y(3, lay!(
|
||||
Align::w(Meter("L/", self.sampler.input_meter[0])),
|
||||
Align::x(TransportView(&self.player.clock)),
|
||||
Align::e(Meter("R/", self.sampler.input_meter[1])),
|
||||
))),
|
||||
Bsp::n(
|
||||
Bsp::s(
|
||||
Fixed::y(1, self.sampler.mapped[note_pt].as_ref().map(|sample|format!(
|
||||
"Sample {}-{}",
|
||||
sample.read().unwrap().start,
|
||||
sample.read().unwrap().end,
|
||||
))),
|
||||
Bsp::a(
|
||||
Outer(Style::default().fg(TuiTheme::g(128))),
|
||||
Fill::x(Fixed::y(sample_h, if let Some((_, sample)) = &self.sampler.recording {
|
||||
SampleViewer(Some(sample.clone()))
|
||||
} else if let Some(sample) = &self.sampler.mapped[note_pt] {
|
||||
SampleViewer(Some(sample.clone()))
|
||||
} else {
|
||||
SampleViewer(None)
|
||||
})),
|
||||
),
|
||||
),
|
||||
Bsp::w(
|
||||
Fixed::x(pool_w, Align::e(Fill::y(PoolView(&self.pool)))),
|
||||
Fill::xy(Bsp::e(
|
||||
Align::w(Fixed::x(sampler_w, Fill::xy(GrooveboxSamples(self)))),
|
||||
Bsp::s(
|
||||
Fill::x(Align::c(Bsp::e(
|
||||
PhraseSelector::play_phrase(&self.player),
|
||||
PhraseSelector::next_phrase(&self.player),
|
||||
))),
|
||||
Bsp::n(
|
||||
MidiEditStatus(&self.editor),
|
||||
&self.editor,
|
||||
),
|
||||
))
|
||||
)
|
||||
),
|
||||
))
|
||||
)
|
||||
)
|
||||
)
|
||||
)});
|
||||
))
|
||||
});
|
||||
|
||||
// TODO move this to sampler
|
||||
struct GrooveboxSamples<'a>(&'a Groovebox);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
use crate::*;
|
||||
|
||||
pub struct Meter<'a>(pub &'a str, pub f32);
|
||||
|
||||
render!(Tui: (self: Meter<'a>) => format!("{}{:>+9.3}", self.0, self.1));
|
||||
|
||||
pub struct Meters<'a>(pub &'a[f32]);
|
||||
|
||||
render!(Tui: (self: Meters<'a>) => col!(
|
||||
|
|
|
|||
|
|
@ -13,13 +13,13 @@ render!(Tui: (self: PianoHorizontal) => {
|
|||
};
|
||||
let field = move|x, y|row!(
|
||||
Tui::fg_bg(color.lighter.rgb, color.darker.rgb, Tui::bold(true, x)),
|
||||
Tui::fg_bg(color.lighter.rgb, color.dark.rgb, y),
|
||||
Tui::fg_bg(color.lightest.rgb, color.dark.rgb, format!(" {y} ")),
|
||||
);
|
||||
Bsp::s(
|
||||
Fixed::y(1, row!(
|
||||
field("Edit:", name.to_string()), " ",
|
||||
field("Length:", length.to_string()), " ",
|
||||
field("Loop:", looped.to_string())
|
||||
field(" Edit ", name.to_string()), " ",
|
||||
field(" Length ", length.to_string()), " ",
|
||||
field(" Loop ", looped.to_string())
|
||||
)),
|
||||
Bsp::s(
|
||||
Fixed::y(1, Bsp::e(
|
||||
|
|
|
|||
35
src/pool.rs
35
src/pool.rs
|
|
@ -224,39 +224,4 @@ render!(Tui: (self: PoolView<'a>) => {
|
|||
Align::e(Tui::when(selected, Tui::bold(true, Tui::fg(TuiTheme::g(255), "◀")))),
|
||||
)))
|
||||
}))
|
||||
/*//format!(" {i} {name} {length} ")[>
|
||||
//Push::y(i as u16 * 2, Fixed::y(2, Tui::bg(color.base.rgb, Fill::x(
|
||||
//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)))*/
|
||||
////let with_files = |x|Tui::either(self.0.file_picker().is_some(),
|
||||
////Thunk::new(||self.0.file_picker().unwrap()),
|
||||
////Thunk::new(x));
|
||||
//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);
|
||||
//}
|
||||
//}
|
||||
//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()
|
||||
//))
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue