mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 04:06:45 +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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue