mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-05-03 07:10:13 +02:00
trying to fix the main layout, what happened
This commit is contained in:
parent
0c6484d733
commit
85749a3437
|
@ -69,13 +69,14 @@ pub(crate) struct ArrangerView<'a> {
|
|||
|
||||
impl<'a> Content<TuiOut> for ArrangerView<'a> {
|
||||
fn content (&self) -> impl Render<TuiOut> {
|
||||
Bsp::s(self.inputs(),
|
||||
Bsp::s(self.tracks(),
|
||||
Bsp::n(self.outputs(), Tui::bg(Reset, Bsp::s(
|
||||
&self.track_scroll,
|
||||
Bsp::e(
|
||||
&self.scene_scroll,
|
||||
Fixed::y(self.scenes_height, self.scenes())))))))
|
||||
let with_inputs = |x|Bsp::s(self.inputs(), x);
|
||||
let with_tracks = |x|Bsp::s(self.tracks(), x);
|
||||
let with_outputs = |x|Bsp::n(self.outputs(), x);
|
||||
let with_track_scroll = |x|Bsp::s(&self.track_scroll, x);
|
||||
let with_scene_scroll = |x|Bsp::e(&self.scene_scroll, x);
|
||||
let with_background = |x|Tui::bg(Reset, x);
|
||||
with_inputs(with_tracks(with_outputs(with_background(with_track_scroll(with_scene_scroll(
|
||||
self.scenes()))))))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,7 +90,7 @@ impl<'a> ArrangerView<'a> {
|
|||
width_mid: app.w_tracks_area(),
|
||||
width_side: app.w_sidebar(),
|
||||
|
||||
inputs_height: app.h_inputs().saturating_sub(1),
|
||||
inputs_height: app.h_inputs(),
|
||||
inputs_count: app.midi_ins.len(),
|
||||
|
||||
outputs_height: app.h_outputs().saturating_sub(1),
|
||||
|
@ -147,14 +148,16 @@ impl<'a> ArrangerView<'a> {
|
|||
self.app.scenes_with_sizes(self.is_editing, Tek::H_SCENE, Tek::H_EDITOR).map_while(
|
||||
move|(s, scene, y1, y2)|if y2 as u16 > self.tracks_height {
|
||||
None
|
||||
} else { Some((s, scene, y1, y2, if s == 0 {
|
||||
None
|
||||
} else {
|
||||
Some(self.app.scenes[s-1].clips[self.track_selected.unwrap_or(0)].as_ref()
|
||||
.map(|c|c.read().unwrap().color)
|
||||
.unwrap_or(ItemPalette::G[32]))
|
||||
}))
|
||||
})
|
||||
Some((s, scene, y1, y2, if s == 0 {
|
||||
None
|
||||
} else {
|
||||
Some(self.app.scenes[s-1].clips[self.track_selected.unwrap_or(0)].as_ref()
|
||||
.map(|c|c.read().unwrap().color)
|
||||
.unwrap_or(ItemPalette::G[32]))
|
||||
}))
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,14 +33,14 @@ impl Tek {
|
|||
self.update_clock();
|
||||
let theme = ItemPalette::G[96];
|
||||
let fmtd = self.fmtd.read().unwrap();
|
||||
Tui::bg(Black, row!(Bsp::a(
|
||||
Fixed::y(1, Tui::bg(Black, row!(Bsp::a(
|
||||
Fill::xy(Align::w(button_play_pause(self.clock.is_rolling()))),
|
||||
Fill::xy(Align::e(row!(
|
||||
FieldH(theme, "BPM", fmtd.bpm.view.clone()),
|
||||
FieldH(theme, "Beat", fmtd.beat.view.clone()),
|
||||
FieldH(theme, "Time", fmtd.time.view.clone())
|
||||
)))
|
||||
)))
|
||||
))))
|
||||
}
|
||||
pub(crate) fn view_transport (&self) -> impl Content<TuiOut> + use<'_> {
|
||||
self.update_clock();
|
||||
|
|
|
@ -34,23 +34,23 @@ impl<A, B, C> Content<TuiOut> for Tryptich<A, B, C>
|
|||
where A: Content<TuiOut>, B: Content<TuiOut>, C: Content<TuiOut> {
|
||||
fn content (&self) -> impl Render<TuiOut> {
|
||||
let Self { top, h, left: (w_a, ref a), middle: (w_b, ref b), right: (w_c, ref c) } = *self;
|
||||
if top {
|
||||
Fixed::y(h, Bsp::a(
|
||||
Fixed::y(h, if top {
|
||||
Bsp::a(
|
||||
Fill::x(Align::n(Fixed::x(w_b, Align::x(Tui::bg(Reset, b))))),
|
||||
Bsp::a(
|
||||
Fill::x(Align::nw(Fixed::x(w_a, Tui::bg(Reset, a)))),
|
||||
Fill::x(Align::ne(Fixed::x(w_c, Tui::bg(Reset, c)))),
|
||||
),
|
||||
))
|
||||
)
|
||||
} else {
|
||||
Fixed::y(h, Bsp::a(
|
||||
Bsp::a(
|
||||
Fill::xy(Align::c(Fixed::x(w_b, Align::x(Tui::bg(Reset, b))))),
|
||||
Bsp::a(
|
||||
Fill::xy(Align::w(Fixed::x(w_a, Tui::bg(Reset, a)))),
|
||||
Fill::xy(Align::e(Fixed::x(w_c, Tui::bg(Reset, c)))),
|
||||
),
|
||||
))
|
||||
}
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,9 +21,9 @@ impl<'a> ArrangerView<'a> {
|
|||
}
|
||||
|
||||
fn input_ports (&'a self) -> impl Content<TuiOut> + 'a {
|
||||
Tryptich::top(1)
|
||||
Tryptich::top(self.inputs_count as u16)
|
||||
.left(self.width_side,
|
||||
button_3("i", "midi ins", format!("{}", self.outputs_count), self.is_editing))
|
||||
button_3("i", "midi ins", format!("{}", self.inputs_count), self.is_editing))
|
||||
.right(self.width_side,
|
||||
button_2("I", "add midi in", self.is_editing))
|
||||
.middle(self.width_mid,
|
||||
|
@ -63,7 +63,7 @@ impl<'a> ArrangerView<'a> {
|
|||
|
||||
/// Render output matrix.
|
||||
pub(crate) fn outputs (&'a self) -> impl Content<TuiOut> + 'a {
|
||||
Align::n(Bsp::s(
|
||||
Fixed::y(3, Align::n(Bsp::s(
|
||||
Bsp::s(
|
||||
self.output_nexts(),
|
||||
self.output_froms(),
|
||||
|
@ -72,21 +72,21 @@ impl<'a> ArrangerView<'a> {
|
|||
self.output_ports(),
|
||||
self.output_conns(),
|
||||
)
|
||||
))
|
||||
)))
|
||||
}
|
||||
|
||||
fn output_nexts (&'a self) -> impl Content<TuiOut> + 'a {
|
||||
Tryptich::top(2)
|
||||
Fixed::y(1, Tryptich::top(2)
|
||||
.left(self.width_side, Align::ne("From:"))
|
||||
.middle(self.width_mid, per_track_top(
|
||||
self.width_mid,
|
||||
||self.tracks_with_sizes_scrolled(),
|
||||
|_, _|{
|
||||
Tui::bg(Reset, Align::c(Bsp::s(" ------ ", OctaveVertical::default())))
|
||||
}))
|
||||
})))
|
||||
}
|
||||
fn output_froms (&'a self) -> impl Content<TuiOut> + 'a {
|
||||
Tryptich::top(2)
|
||||
Fixed::y(1, Tryptich::top(2)
|
||||
.left(self.width_side, Align::ne("Next:"))
|
||||
.middle(self.width_mid, per_track_top(
|
||||
self.width_mid,
|
||||
|
@ -99,10 +99,10 @@ impl<'a> ArrangerView<'a> {
|
|||
.map(|clip|clip.read().unwrap().name.clone()))
|
||||
.flatten().as_ref()))),
|
||||
Thunk::new(||Tui::bg(Reset, " ------ "))
|
||||
)))
|
||||
))))
|
||||
}
|
||||
fn output_ports (&'a self) -> impl Content<TuiOut> + 'a {
|
||||
Tryptich::top(1)
|
||||
Fixed::y(3, Tryptich::top(1)
|
||||
.left(self.width_side,
|
||||
button_3("o", "midi outs", format!("{}", self.outputs_count), self.is_editing))
|
||||
.right(self.width_side,
|
||||
|
@ -121,10 +121,10 @@ impl<'a> ArrangerView<'a> {
|
|||
let mute = Tui::fg_bg(mute, bg_1, "Play ");
|
||||
let solo = Tui::fg_bg(solo, bg_1, "Solo ");
|
||||
wrap(bg_1, Tui::g(224), Tui::bold(true, Fill::x(Bsp::e(mute, solo))))
|
||||
}))
|
||||
})))
|
||||
}
|
||||
fn output_conns (&'a self) -> impl Content<TuiOut> + 'a {
|
||||
Tryptich::top(self.outputs_height)
|
||||
Fixed::y(3, Tryptich::top(self.outputs_height)
|
||||
.left(self.width_side,
|
||||
io_ports(Tui::g(224), Tui::g(32), ||self.app.outputs_with_sizes()))
|
||||
.middle(self.width_mid, per_track_top(
|
||||
|
@ -134,6 +134,6 @@ impl<'a> ArrangerView<'a> {
|
|||
t.color.dark.rgb,
|
||||
t.color.darker.rgb,
|
||||
||self.app.outputs_with_sizes()
|
||||
)))
|
||||
))))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ impl<'a> ArrangerView<'a> {
|
|||
|
||||
/// Render track headers
|
||||
pub(crate) fn tracks (&'a self) -> impl Content<TuiOut> + 'a {
|
||||
Tryptich::center(1)
|
||||
Tryptich::center(3)
|
||||
.left(self.width_side,
|
||||
button_3("t", "track", format!("{}", self.track_count), self.is_editing))
|
||||
.right(self.width_side,
|
||||
|
|
|
@ -166,7 +166,8 @@ content!(TuiOut: |self: PoolView<'a>| {
|
|||
let on_bg = |x|x;//Bsp::b(Repeat(" "), Tui::bg(color.darkest.rgb, x));
|
||||
let border = |x|x;//Outer(Style::default().fg(color.dark.rgb).bg(color.darkest.rgb)).enclose(x);
|
||||
let iter = | |model.clips().clone().into_iter();
|
||||
Tui::bg(Color::Reset, Fixed::y(clips.read().unwrap().len() as u16, on_bg(border(Map::new(iter, move|clip, i|{
|
||||
let height = clips.read().unwrap().len() as u16;
|
||||
Tui::bg(Color::Reset, Fixed::y(height, on_bg(border(Map::new(iter, move|clip, i|{
|
||||
let item_height = 1;
|
||||
let item_offset = i as u16 * item_height;
|
||||
let selected = i == model.clip_index();
|
||||
|
|
Loading…
Reference in a new issue