mirror of
https://codeberg.org/unspeaker/tek.git
synced 2026-07-17 15:56:57 +02:00
use origin/align methods
This commit is contained in:
parent
d8a767326c
commit
ae75019d97
4 changed files with 104 additions and 109 deletions
163
src/app/draw.rs
163
src/app/draw.rs
|
|
@ -73,8 +73,8 @@ fn tek_draw_word (state: &App, to: &mut Tui, dsl: &impl Expression) -> Drawn<u16
|
|||
|
||||
pub fn draw_meter_section (to: &mut Tui, mut frags: std::str::Split<&str>) -> Drawn<u16> {
|
||||
match frags.next() {
|
||||
Some("input") => bg(Rgb(30, 30, 30), align_s("Input Meters").full_h()).draw(to),
|
||||
Some("output") => bg(Rgb(30, 30, 30), align_s("Output Meters").full_h()).draw(to),
|
||||
Some("input") => bg(Rgb(30, 30, 30), "Input Meters".align_s().full_h()).draw(to),
|
||||
Some("output") => bg(Rgb(30, 30, 30), "Output Meters".align_s().full_h()).draw(to),
|
||||
_ => panic!()
|
||||
}
|
||||
}
|
||||
|
|
@ -83,9 +83,9 @@ pub fn draw_tracks (to: &mut Tui, mut frags: std::str::Split<&str>, state: &App)
|
|||
match frags.next() {
|
||||
None => "TODO tracks".draw(to),
|
||||
Some("names") => state.project.view_track_names(state.color.clone()).draw(to),//bg(Rgb(40, 40, 40), full_w(align_w("Track Names")))),
|
||||
Some("inputs") => bg(Rgb(40, 40, 40), align_w("Track Inputs").full_w()).draw(to),
|
||||
Some("devices") => bg(Rgb(40, 40, 40), align_w("Track Devices").full_w()).draw(to),
|
||||
Some("outputs") => bg(Rgb(40, 40, 40), align_w("Track Outputs").full_w()).draw(to),
|
||||
Some("inputs") => bg(Rgb(40, 40, 40), "Track Inputs".align_w().full_w()).draw(to),
|
||||
Some("devices") => bg(Rgb(40, 40, 40), "Track Devices".align_w().full_w()).draw(to),
|
||||
Some("outputs") => bg(Rgb(40, 40, 40), "Track Outputs".align_w().full_w()).draw(to),
|
||||
_ => panic!()
|
||||
}
|
||||
}
|
||||
|
|
@ -108,7 +108,7 @@ pub fn draw_dialog (
|
|||
for (index, MenuItem(item, _)) in items.0.iter().enumerate() {
|
||||
let f = if *selected == index { Rgb(240,200,180) } else { Rgb(200, 200, 200) };
|
||||
let b = if *selected == index { Rgb(80, 80, 50) } else { Rgb(30, 30, 30) };
|
||||
fg_bg(f, b, align_n(item.full_w()).exact_h(2))
|
||||
fg_bg(f, b, item.full_w().align_w().exact_h(2))
|
||||
.push_y((2 * index) as u16).draw(to)?;
|
||||
}
|
||||
Ok(Some(to.area().into()))
|
||||
|
|
@ -130,9 +130,9 @@ pub fn draw_templates (to: &mut Tui, frags: std::str::Split<&str>, state: &App)
|
|||
let info = profile.info.get(0).map(|x|x.as_ref()).unwrap_or("<no info>");
|
||||
let fg1 = Rgb(224, 192, 128);
|
||||
let fg2 = Rgb(224, 128, 32);
|
||||
let field_name = align_w(fg(fg1, name)).full_w();
|
||||
let field_id = align_e(fg(fg2, id)).full_w();
|
||||
let field_info = align_w(info).full_w();
|
||||
let field_name = fg(fg1, name).align_w().full_w();
|
||||
let field_id = fg(fg2, id).align_e().full_w();
|
||||
let field_info = info.align_w().full_w();
|
||||
let _ = bg(b, south(above(field_name, field_id), field_info))
|
||||
.full_w().exact_h(2).push_y((2 * index) as u16).draw(to);
|
||||
index += 1;
|
||||
|
|
@ -162,12 +162,12 @@ pub fn view_logo () -> impl Draw<Tui> {
|
|||
pub fn view_transport (play: bool, bpm: &str, beat: &str, time: &str) -> impl Draw<Tui> {
|
||||
let theme = ItemTheme::G[96];
|
||||
bg(Black, east!(above(
|
||||
align_w(button_play_pause(play, false)).full_wh(),
|
||||
align_e(east!(
|
||||
button_play_pause(play, false).align_w().full_wh(),
|
||||
east!(
|
||||
field_h(theme, "BPM", bpm),
|
||||
field_h(theme, "Beat", beat),
|
||||
field_h(theme, "Time", time),
|
||||
)).full_wh()
|
||||
).align_e().full_wh()
|
||||
)))
|
||||
}
|
||||
|
||||
|
|
@ -182,8 +182,8 @@ pub fn view_status (sel: Option<&str>, sr: &str, buf: &str, lat: &str) -> impl D
|
|||
let buf = field_h(theme, "Buf", buf);
|
||||
let lat = field_h(theme, "Lat", lat);
|
||||
bg(Black, east!(above(
|
||||
align_w(sel.map(|sel|field_h(theme, "Selected", sel))).full_wh(),
|
||||
align_e(east!(sr, buf, lat)).full_wh(),
|
||||
sel.map(|sel|field_h(theme, "Selected", sel)).align_w().full_wh(),
|
||||
east!(sr, buf, lat).align_e().full_wh(),
|
||||
)))
|
||||
}
|
||||
|
||||
|
|
@ -215,10 +215,10 @@ pub fn button_play_pause (playing: bool, compact: bool) -> impl Draw<Tui> {
|
|||
content: impl Draw<Tui>,
|
||||
) -> impl Draw<Tui> {
|
||||
west(
|
||||
align_nw(button_add).exact_w(4).full_h(),
|
||||
button_add.align_nw().exact_w(4).full_h(),
|
||||
east(
|
||||
align_nw(button).full_h().exact_w(20),
|
||||
align_c(content).full_wh()
|
||||
button.align_nw().full_h().exact_w(20),
|
||||
content.align_c().full_wh()
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
@ -286,12 +286,12 @@ pub fn view_sample_info_v (sample: Option<&Arc<RwLock<Sample>>>) -> impl Draw<Tu
|
|||
let sample = sample.unwrap().read().unwrap();
|
||||
let theme = sample.color;
|
||||
south!(
|
||||
align_w(field_h(theme, "Name ", format!("{:<10}", sample.name.clone()))).full_w(),
|
||||
align_w(field_h(theme, "Length", format!("{:<8}", sample.channels[0].len()))).full_w(),
|
||||
align_w(field_h(theme, "Start ", format!("{:<8}", sample.start))).full_w(),
|
||||
align_w(field_h(theme, "End ", format!("{:<8}", sample.end))).full_w(),
|
||||
align_w(field_h(theme, "Trans ", "0")).full_w(),
|
||||
align_w(field_h(theme, "Gain ", format!("{}", sample.gain))).full_w(),
|
||||
field_h(theme, "Name ", format!("{:<10}", sample.name.clone())) .align_w().full_w(),
|
||||
field_h(theme, "Length", format!("{:<8}", sample.channels[0].len())).align_w().full_w(),
|
||||
field_h(theme, "Start ", format!("{:<8}", sample.start)) .align_w().full_w(),
|
||||
field_h(theme, "End ", format!("{:<8}", sample.end)) .align_w().full_w(),
|
||||
field_h(theme, "Trans ", "0") .align_w().full_w(),
|
||||
field_h(theme, "Gain ", format!("{}", sample.gain)) .align_w().full_w(),
|
||||
).exact_w(20).draw(to)
|
||||
});
|
||||
|
||||
|
|
@ -314,7 +314,7 @@ pub fn view_sample_status (sample: Option<&Arc<RwLock<Sample>>>) -> impl Draw<Tu
|
|||
}
|
||||
|
||||
pub fn view_track_header (theme: ItemTheme, content: impl Draw<Tui>) -> impl Draw<Tui> {
|
||||
bg(theme.darker.term, align_e(content).full_w()).exact_w(12)
|
||||
bg(theme.darker.term, content.align_e().full_w()).exact_w(12)
|
||||
}
|
||||
|
||||
pub fn view_ports_status <'a, T: JackPort> (theme: ItemTheme, title: &'a str, ports: &'a [T])
|
||||
|
|
@ -323,7 +323,7 @@ pub fn view_ports_status <'a, T: JackPort> (theme: ItemTheme, title: &'a str, po
|
|||
let ins = ports.len() as u16;
|
||||
let frame = Outer(true, Style::default().fg(g(96)));
|
||||
let iter = move||ports.iter();
|
||||
let names = iter_south(iter, move|port, index|align_w(format!(" {index} {}", port.port_name())).full_h());
|
||||
let names = iter_south(iter, move|port, index|format!(" {index} {}", port.port_name()).align_w().full_h());
|
||||
let field = field_v(theme, title, names);
|
||||
border(true, frame, field.exact_wh(20, 1 + ins)).exact_wh(20, 1 + ins)
|
||||
}
|
||||
|
|
@ -334,9 +334,9 @@ pub fn view_io_ports <'a, T: PortsSizes<'a>> (
|
|||
type Item<'a> = (usize, &'a Arc<str>, &'a [Connect], usize, usize);
|
||||
iter(items,
|
||||
move|(_index, name, connections, y, y2): Item<'a>, _| south(
|
||||
bold(true, fg_bg(fg, bg, align_w(east(" ", name)))).full_h(),
|
||||
bold(true, fg_bg(fg, bg, east(" ", name).align_w())).full_h(),
|
||||
iter(||connections.iter(), move|connect: &'a Connect, index|{
|
||||
align_w(bold(false, fg_bg(fg, bg, &connect.info)).exact_h(1)).push_y(index as u16)
|
||||
bold(false, fg_bg(fg, bg, &connect.info)).exact_h(1).align_w().push_y(index as u16)
|
||||
})
|
||||
).exact_h((y2 - y) as u16).push_y(y as u16))
|
||||
}
|
||||
|
|
@ -349,7 +349,7 @@ pub fn view_scenes_clips <'a, S: ScenesSizes<'a>> (
|
|||
size: &Sizer,
|
||||
editing: bool,
|
||||
) -> impl Draw<Tui> {
|
||||
let status = align_se(fg(Green, format!("{}x{}", size.w(), size.h()))).full_wh();
|
||||
let status = fg(Green, format!("{}x{}", size.w(), size.h())).align_se().full_wh();
|
||||
let tracks = iter_once(tracks, move|(track_index, track, _, _), _| {
|
||||
let scenes = iter_once(scenes(), move|(scene_index, scene, _, _), _| {
|
||||
let (name, theme): (Arc<str>, ItemTheme) = scene_name_theme(scene, track_index);
|
||||
|
|
@ -363,7 +363,7 @@ pub fn view_scenes_clips <'a, S: ScenesSizes<'a>> (
|
|||
below(
|
||||
below(
|
||||
fg_bg(o, b, "".full_wh()),
|
||||
align_nw(fg_bg(f, b, bold(true, name))).full_wh(),
|
||||
fg_bg(f, b, bold(true, name)).align_nw().full_wh(),
|
||||
),
|
||||
when(is_selected, editor.map(|e|e.view())).full_wh()
|
||||
).full_wh()
|
||||
|
|
@ -446,10 +446,10 @@ pub fn view_track_names (
|
|||
} else {
|
||||
track.color.base.term
|
||||
};
|
||||
bg(b, south(align_nw(east(
|
||||
bg(b, south(east(
|
||||
format!("·t{index:02} "),
|
||||
fg(Rgb(255, 255, 255), bold(true, &track.name))
|
||||
)).full_w(), ""))
|
||||
).align_nw().full_w(), ""))
|
||||
.exact_w(track_width(index, track))
|
||||
.push_x(x1 as u16)
|
||||
.draw(to)?;
|
||||
|
|
@ -462,50 +462,49 @@ pub fn view_track_outputs (
|
|||
theme: ItemTheme, tracks: impl TracksSizes<'_>, midi_outs: impl Iterator<Item = &MidiOutput>,
|
||||
) -> impl Draw<Tui> {
|
||||
view_track_row_section(theme,
|
||||
south(align_w(button_2("o", "utput", false)).full_w(),
|
||||
south(button_2("o", "utput", false).align_w().full_w(),
|
||||
thunk(|to: &mut Tui|{
|
||||
for port in midi_outs {
|
||||
align_w(port.port_name()).full_w().draw(to);
|
||||
port.port_name().align_w().full_w().draw(to);
|
||||
}
|
||||
Ok(Some(XYWH(0, 0, 0, 0)))
|
||||
})),
|
||||
button_2("O", "+", false),
|
||||
bg(theme.darker.term, align_w(thunk(|to: &mut Tui|{
|
||||
bg(theme.darker.term, thunk(|to: &mut Tui|{
|
||||
for (index, track, _x1, _x2) in tracks {
|
||||
let f = Rgb(255, 255, 255);
|
||||
let b = track.color.dark.term;
|
||||
let iter = ||track.sequencer.midi_outs.iter();
|
||||
let draw = |port: &MidiOutput, _|fg(f, bg(b, align_w(
|
||||
format!("·o{index:02} {}", port.port_name()).full_w()
|
||||
)).exact_h(1));
|
||||
align_nw(iter_south(iter, draw).full_h())
|
||||
let draw = |port: &MidiOutput, _|fg(f, bg(b,
|
||||
format!("·o{index:02} {}", port.port_name()).full_w().align_w()).exact_h(1));
|
||||
iter_south(iter, draw).full_h().align_nw()
|
||||
.exact_w(track_width(index, track))
|
||||
.draw(to)?;
|
||||
}
|
||||
Ok(Some(XYWH(0, 0, 0, 0)))
|
||||
}))))
|
||||
}).align_w()))
|
||||
}
|
||||
|
||||
pub fn view_track_inputs (
|
||||
theme: ItemTheme, tracks: impl TracksSizes<'_>, height: u16,
|
||||
) -> impl Draw<Tui> {
|
||||
view_track_row_section(theme, button_2("i", "nput", false), button_2("I", "+", false),
|
||||
bg(theme.darker.term, align_w(thunk(move|to: &mut Tui|{
|
||||
bg(theme.darker.term, thunk(move|to: &mut Tui|{
|
||||
for (index, track, _x1, _x2) in tracks {
|
||||
align_nw(south(
|
||||
south(
|
||||
bg(track.color.base.term,
|
||||
align_w(east!(
|
||||
east!(
|
||||
either(track.sequencer.monitoring, fg(Green, "●mon "), "·mon "),
|
||||
either(track.sequencer.recording, fg(Red, "●rec "), "·rec "),
|
||||
either(track.sequencer.overdub, fg(Yellow, "●dub "), "·dub "),
|
||||
)).full_w()),
|
||||
).align_w().full_w()),
|
||||
iter_south(||track.sequencer.midi_ins.iter(),
|
||||
|port, _|fg_bg(Rgb(255, 255, 255), track.color.dark.term,
|
||||
align_w(format!("·i{index:02} {}", port.port_name())).full_w()))
|
||||
)).exact_wh(track_width(index, track), height + 1).draw(to)?;
|
||||
format!("·i{index:02} {}", port.port_name()).align_w().full_w()))
|
||||
).align_nw().exact_wh(track_width(index, track), height + 1).draw(to)?;
|
||||
}
|
||||
Ok(Some(XYWH(0, 0, 0, 0)))
|
||||
}))))
|
||||
}).align_w()))
|
||||
}
|
||||
|
||||
pub fn view_scenes_names (
|
||||
|
|
@ -534,18 +533,17 @@ pub fn view_scene_name (
|
|||
} else {
|
||||
H_SCENE as u16
|
||||
};
|
||||
let a = align_w(east(format!("·s{index:02} "),
|
||||
fg(g(255), bold(true, &scene.name)))).full_w();
|
||||
let b = when(select.scene() == Some(index) && editing, align_nw(south(
|
||||
let a = east(format!("·s{index:02} "),
|
||||
fg(g(255), bold(true, &scene.name))).align_w().full_w();
|
||||
let b = when(select.scene() == Some(index) && editing, south(
|
||||
editor.as_ref().map(|e|e.clip_status()),
|
||||
editor.as_ref().map(|e|e.edit_status()))).full_wh());
|
||||
editor.as_ref().map(|e|e.edit_status())).align_nw().full_wh());
|
||||
let c = if select.scene() == Some(index) {
|
||||
scene.color.light.term
|
||||
} else {
|
||||
scene.color.base.term
|
||||
};
|
||||
bg(c, align_nw(south(a, b)))
|
||||
.exact_wh(20, h)
|
||||
bg(c, south(a, b).align_nw()).exact_wh(20, h)
|
||||
}
|
||||
|
||||
pub fn view_midi_ins_status (theme: ItemTheme, track: Option<&Track>) -> impl Draw<Tui> {
|
||||
|
|
@ -582,31 +580,31 @@ pub fn view_per_track () -> impl Draw<Tui> {}
|
|||
pub fn view_per_track_top () -> impl Draw<Tui> {}
|
||||
|
||||
pub fn view_inputs (tracks: impl TracksSizes<'_>, midi_ins: &[MidiInput]) -> impl Draw<Tui> {
|
||||
let title_1 = align_w(button_3("i", "nput ", format!("{}", midi_ins.len()), false)).exact_wh(20, 1);
|
||||
let title_1 = button_3("i", "nput ", format!("{}", midi_ins.len()), false).align_w().exact_wh(20, 1);
|
||||
let title_2 = button_2("I", "+", false).exact_wh(4, 1);
|
||||
east(title_1, west(title_2, thunk(move|to: &mut Tui|{
|
||||
for (_index, track, x1, _x2) in tracks {
|
||||
south(
|
||||
bg(track.color.dark.term, align_w(east!(
|
||||
bg(track.color.dark.term, east!(
|
||||
either(track.sequencer.monitoring, fg(Green, "mon "), "mon "),
|
||||
either(track.sequencer.recording, fg(Red, "rec "), "rec "),
|
||||
either(track.sequencer.overdub, fg(Yellow, "dub "), "dub "),
|
||||
).exact_w(track.width as u16))).push_x(x1 as u16),
|
||||
).exact_w(track.width as u16)).align_w().push_x(x1 as u16),
|
||||
thunk(move |to: &mut Tui|{
|
||||
for (index, port) in midi_ins.iter().enumerate() {
|
||||
east(
|
||||
align_w(east(
|
||||
east(
|
||||
" ● ",
|
||||
bold(true, fg(Rgb(255,255,255), port.port_name()))
|
||||
)).exact_w(20),
|
||||
).align_w().exact_w(20),
|
||||
west(
|
||||
().exact_w(4),
|
||||
thunk(move|to: &mut Tui|{
|
||||
bg(track.color.darker.term, align_w(east!(
|
||||
bg(track.color.darker.term, east!(
|
||||
either(track.sequencer.monitoring, fg(Green, " ● "), " · "),
|
||||
either(track.sequencer.recording, fg(Red, " ● "), " · "),
|
||||
either(track.sequencer.overdub, fg(Yellow, " ● "), " · "),
|
||||
).exact_w(track.width as u16))).draw(to);
|
||||
).exact_w(track.width as u16).align_w()).draw(to);
|
||||
todo!()
|
||||
}))
|
||||
).push_x(index as u16 * 10).exact_h(1).draw(to);
|
||||
|
|
@ -627,38 +625,37 @@ pub fn view_outputs (
|
|||
) -> impl Draw<Tui> {
|
||||
|
||||
let list = south(
|
||||
align_w(button_3(
|
||||
button_3(
|
||||
"o", "utput", format!("{}", midi_outs.len()), false
|
||||
)).full_w().exact_h(1),
|
||||
align_nw(thunk(|to: &mut Tui|{
|
||||
).align_w().full_w().exact_h(1),
|
||||
thunk(|to: &mut Tui|{
|
||||
for (_index, port) in midi_outs.iter().enumerate() {
|
||||
east(
|
||||
align_w(east(" ● ", fg(Rgb(255,255,255), bold(true, port.port_name())))),
|
||||
align_e(format!("{}/{} ",
|
||||
east(" ● ", fg(Rgb(255,255,255), bold(true, port.port_name()))).align_w(),
|
||||
format!("{}/{} ",
|
||||
port.port().get_connections().len(),
|
||||
port.connections.len())
|
||||
).full_w().exact_h(1)).full_w().draw(to)?;
|
||||
port.connections.len()).align_e().full_w().exact_h(1)).full_w().draw(to)?;
|
||||
for (index, conn) in port.connections.iter().enumerate() {
|
||||
align_w(format!(" c{index:02}{}", conn.info())).full_w().exact_h(1).draw(to)?;
|
||||
format!(" c{index:02}{}", conn.info()).align_w().full_w().exact_h(1).draw(to)?;
|
||||
}
|
||||
}
|
||||
todo!();
|
||||
})).full_wh().exact_h(height - 1)
|
||||
}).align_nw().full_wh().exact_h(height - 1)
|
||||
);
|
||||
|
||||
view_track_row_section(theme, list, button_2("O", "+", false),
|
||||
bg(theme.darker.term, align_w(thunk(|to: &mut Tui|{
|
||||
bg(theme.darker.term, thunk(|to: &mut Tui|{
|
||||
for (index, track, _x1, _x2) in tracks {
|
||||
thunk(|to: &mut Tui|{
|
||||
align_w(east(
|
||||
east(
|
||||
either(true, fg(Green, "play "), "play "),
|
||||
either(false, fg(Yellow, "solo "), "solo "),
|
||||
)).exact_h(1).draw(to)?;
|
||||
).align_w().exact_h(1).draw(to)?;
|
||||
for (_index, port) in midi_outs.iter().enumerate() {
|
||||
align_w(east(
|
||||
east(
|
||||
either(true, fg(Green, " ● "), " · "),
|
||||
either(false, fg(Yellow, " ● "), " · "),
|
||||
)).exact_h(1).draw(to)?;
|
||||
).align_w().exact_h(1).draw(to)?;
|
||||
for (_index, _conn) in port.connections.iter().enumerate() {
|
||||
"".full_w().exact_h(1).draw(to)?;
|
||||
}
|
||||
|
|
@ -667,7 +664,7 @@ pub fn view_outputs (
|
|||
}).exact_w(track_width(index, track)).draw(to);
|
||||
}
|
||||
todo!()
|
||||
}).full_w()))).exact_h(height)
|
||||
}).align_w().full_w())).exact_h(height)
|
||||
}
|
||||
|
||||
pub fn view_track_devices (
|
||||
|
|
@ -681,13 +678,13 @@ pub fn view_track_devices (
|
|||
button_2("D", "+", false),
|
||||
iter_once(tracks, move|(_, track, _x1, _x2), index|bg(
|
||||
track.color.dark.term,
|
||||
align_nw(iter_south(move||0..h,
|
||||
iter_south(move||0..h,
|
||||
|_, _index|fg_bg(
|
||||
ItemTheme::G[32].lightest.term,
|
||||
ItemTheme::G[32].dark.term,
|
||||
align_nw(format!(" · {}", "--"))
|
||||
format!(" · {}", "--").align_nw()
|
||||
).exact_wh(track.width as u16, 2)
|
||||
))).exact_wh(
|
||||
).align_nw()).exact_wh(
|
||||
Some(track_width(index, track)),
|
||||
Some(h + 1),
|
||||
)))
|
||||
|
|
@ -697,21 +694,21 @@ pub fn per_track <'a, T: Draw<Tui> + 'a, U: TracksSizes<'a>> (
|
|||
tracks: impl Fn() -> U + Send + Sync + 'a,
|
||||
callback: impl Fn(usize, &'a Track)->T + Send + Sync + 'a
|
||||
) -> impl Draw<Tui> + 'a {
|
||||
per_track_top(tracks, move|index, track|align_y(callback(index, track).full_h()))
|
||||
per_track_top(tracks, move|index, track|callback(index, track).full_h().align_y())
|
||||
}
|
||||
|
||||
pub fn per_track_top <'a, T: Draw<Tui> + 'a, U: TracksSizes<'a>> (
|
||||
tracks: impl Fn() -> U + Send + Sync + 'a,
|
||||
callback: impl Fn(usize, &'a Track)->T + Send + Sync + 'a
|
||||
) -> impl Draw<Tui> + 'a {
|
||||
align_x(bg(Reset, iter_east(tracks,
|
||||
bg(Reset, iter_east(tracks,
|
||||
move|(index, track, x1, x2): (usize, &'a Track, usize, usize), _|{
|
||||
fg_bg(
|
||||
track.color.lightest.term,
|
||||
track.color.base.term,
|
||||
callback(index, track)
|
||||
).exact_w((x2 - x1) as u16)
|
||||
})))
|
||||
}).align_x())
|
||||
}
|
||||
|
||||
pub fn field_h <T: Screen> (theme: ItemTheme, head: impl Draw<T>, body: impl Draw<T>) -> impl Draw<T> {
|
||||
|
|
@ -729,14 +726,14 @@ pub fn view_sessions () -> impl Draw<Tui> {
|
|||
let b = if index == 0 { Rgb(50,50,50) } else { Rgb(40,40,40) };
|
||||
let y = (2 * index) as u16;
|
||||
let h = 2;
|
||||
bg(b, align_w(fg(f, *name))).full_w().exact_h(h).push_y(y).draw(to)?;
|
||||
bg(b, fg(f, *name).align_w()).full_w().exact_h(h).push_y(y).draw(to)?;
|
||||
}
|
||||
Ok(Some(to.area().into()))
|
||||
}).min_w(w).exact_h(h)
|
||||
}
|
||||
|
||||
pub fn view_browse_title (state: &App) -> impl Draw<Tui> {
|
||||
align_w(field_v(ItemTheme::default(),
|
||||
field_v(ItemTheme::default(),
|
||||
match state.dialog.browser_target().unwrap() {
|
||||
BrowseTarget::SaveProject => "Save project:",
|
||||
BrowseTarget::LoadProject => "Load project:",
|
||||
|
|
@ -745,7 +742,7 @@ pub fn view_browse_title (state: &App) -> impl Draw<Tui> {
|
|||
BrowseTarget::ImportClip(_) => "Import clip:",
|
||||
BrowseTarget::ExportClip(_) => "Export clip:",
|
||||
}, fg(g(96), x_repeat("🭻")).exact_h(1)
|
||||
)).full_w()
|
||||
).align_w().full_w()
|
||||
}
|
||||
|
||||
pub fn view_device (state: &App) -> impl Draw<Tui> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue