mirror of
https://codeberg.org/unspeaker/tek.git
synced 2026-09-18 04:46:43 +02:00
realign tracks
This commit is contained in:
parent
1082f62696
commit
3deef0641d
4 changed files with 94 additions and 111 deletions
|
|
@ -51,7 +51,7 @@ proptest = { version = "^1" }
|
||||||
proptest-derive = { version = "^0.5.1" }
|
proptest-derive = { version = "^0.5.1" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["cli", "arranger", "sampler", "prof"]
|
default = ["cli", "arranger", "sampler"]
|
||||||
|
|
||||||
prof = ["tengri/prof"]
|
prof = ["tengri/prof"]
|
||||||
hotpath = ["hotpath/hotpath"]
|
hotpath = ["hotpath/hotpath"]
|
||||||
|
|
|
||||||
|
|
@ -63,18 +63,10 @@ pub trait ClipsView: TracksView + ScenesView {
|
||||||
)| {
|
)| {
|
||||||
let (name, theme): (Arc<str>, ItemTheme) = view_scene_name_theme(scene, track_index);
|
let (name, theme): (Arc<str>, ItemTheme) = view_scene_name_theme(scene, track_index);
|
||||||
let f = theme.lightest.term;
|
let f = theme.lightest.term;
|
||||||
let (b, o) = view_scene_bg(
|
let (b, o) = view_scene_bg(theme, select, track_index, scene_index);
|
||||||
theme, select, track_index, scene_index
|
let w = view_scene_w(track, select, track_index, editor);
|
||||||
);
|
let y = view_scene_y(select, scene_index, editor);
|
||||||
let w = view_scene_w(
|
let is_selected = view_scene_sel(select, track_index, scene_index, editing);
|
||||||
track, select, track_index, editor
|
|
||||||
);
|
|
||||||
let y = view_scene_y(
|
|
||||||
select, scene_index, editor
|
|
||||||
);
|
|
||||||
let is_selected = view_scene_sel(
|
|
||||||
select, track_index, scene_index, editing
|
|
||||||
);
|
|
||||||
below(
|
below(
|
||||||
Outer(true, Style::default().fg(o)).full_wh(),
|
Outer(true, Style::default().fg(o)).full_wh(),
|
||||||
below(
|
below(
|
||||||
|
|
|
||||||
|
|
@ -345,90 +345,83 @@ pub trait TracksView: HasTracks + ScenesView + HasMidiIns + HasMidiOuts + HasTra
|
||||||
/// Draw name of each track
|
/// Draw name of each track
|
||||||
fn view_track_names (&self, theme: ItemTheme) -> impl Draw<Tui> {
|
fn view_track_names (&self, theme: ItemTheme) -> impl Draw<Tui> {
|
||||||
let selected = self.selection();
|
let selected = self.selection();
|
||||||
east(
|
let btn1t = button_3("t", "rack ", east(
|
||||||
south(
|
selected.track().map(|track|east(track, "/")),
|
||||||
button_3(
|
self.tracks().len()
|
||||||
"t",
|
), false);
|
||||||
"rack ",
|
let btn1s = button_3("s", "cene ", east(
|
||||||
east(
|
selected.scene().map(|scene|east(scene, "/")),
|
||||||
selected.track().map(|track|east(track, "/")),
|
self.scenes().len()
|
||||||
self.tracks().len()
|
), false);
|
||||||
),
|
let btns1 = south(btn1t, btn1s);
|
||||||
false
|
let btns2 = south(
|
||||||
),
|
button_2("T", "+", false),
|
||||||
button_3(
|
button_2("S", "+", false),
|
||||||
"s",
|
);
|
||||||
"cene ",
|
view_track_row_section(theme,
|
||||||
east(
|
btns1,
|
||||||
selected.scene().map(|scene|east(scene, "/")),
|
btns2,
|
||||||
self.scenes().len()
|
bg(theme.darker.term,
|
||||||
),
|
iter_east(||self.tracks_with_sizes().map(|(index, track, _x1, _x2)|{
|
||||||
false
|
let b = if selected.track() == Some(index) {
|
||||||
)
|
track.color.light.term
|
||||||
),
|
} else {
|
||||||
west(
|
track.color.base.term
|
||||||
south(
|
};
|
||||||
button_2("T", "+", false),
|
bg(b, south(
|
||||||
button_2("S", "+", false),
|
east!(
|
||||||
),
|
"·t",
|
||||||
bg(theme.darker.term, iter_east(||self.tracks_with_sizes()
|
index,
|
||||||
.map(|(index, track, _x1, _x2)|{
|
" ",
|
||||||
let b = if selected.track() == Some(index) {
|
fg(Rgb(255, 255, 255), bold(true, &track.name))
|
||||||
track.color.light.term
|
)
|
||||||
} else {
|
.align_nw()
|
||||||
track.color.base.term
|
.full_w(),
|
||||||
};
|
""
|
||||||
bg(b, south(
|
))
|
||||||
east!(
|
.exact_w(track_width(index, track))
|
||||||
"·t",
|
.exact_h(2)
|
||||||
index,
|
}))))
|
||||||
" ",
|
}
|
||||||
fg(Rgb(255, 255, 255), bold(true, &track.name))
|
|
||||||
)
|
fn view_track_output_count (&self) -> impl Draw<Tui> {
|
||||||
.align_nw()
|
south(button_2("o", "utput", false).align_w().full_w(),
|
||||||
.full_w(),
|
draw(|to: &mut Tui|{
|
||||||
""
|
for port in self.midi_outs().iter() {
|
||||||
))
|
let _ = port.port_name().align_w().full_w().draw(to)?;
|
||||||
.exact_w(track_width(index, track))
|
}
|
||||||
.exact_h(2)
|
Ok(Some(XYWH(0, 0, 0, 0)))
|
||||||
})))
|
}))
|
||||||
)
|
}
|
||||||
)
|
|
||||||
|
fn view_track_output_add (&self) -> impl Draw<Tui> {
|
||||||
|
button_2("O", "+", false)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Draw outputs per track
|
/// Draw outputs per track
|
||||||
fn view_track_outputs <'a> (&'a self, theme: ItemTheme, _h: u16) -> impl Draw<Tui> {
|
fn view_track_outputs <'a> (&'a self, theme: ItemTheme, _h: u16) -> impl Draw<Tui> {
|
||||||
view_track_row_section(theme,
|
view_track_row_section(theme,
|
||||||
south(button_2("o", "utput", false).align_w().full_w(),
|
self.view_track_output_count(),
|
||||||
draw(|to: &mut Tui|{
|
self.view_track_output_add(),
|
||||||
for port in self.midi_outs().iter() {
|
bg(theme.darker.term,
|
||||||
let _ = port.port_name().align_w().full_w().draw(to)?;
|
iter_east(move||self.tracks_with_sizes().map(move|(index, track, _x1, _x2)|{
|
||||||
}
|
|
||||||
Ok(Some(XYWH(0, 0, 0, 0)))
|
|
||||||
})),
|
|
||||||
button_2("O", "+", false),
|
|
||||||
bg(theme.darker.term, draw(|to: &mut Tui|{
|
|
||||||
for (index, track, _x1, _x2) in self.tracks_with_sizes() {
|
|
||||||
let f = Rgb(255, 255, 255);
|
let f = Rgb(255, 255, 255);
|
||||||
let b = track.color.dark.term;
|
let b = track.color.dark.term;
|
||||||
iter_south(||track.sequencer.midi_outs.iter().map(|port: &MidiOutput|{
|
iter_south(move||track.sequencer.midi_outs.iter().map(move|port: &MidiOutput|{
|
||||||
fg(f, bg(b, east!(
|
fg(f, bg(b, east!("·o", index, " ", port.port_name()).full_w().align_w()).exact_h(1))
|
||||||
"·o",
|
|
||||||
index,
|
|
||||||
" ",
|
|
||||||
port.port_name()
|
|
||||||
)
|
|
||||||
.full_w()
|
|
||||||
.align_w()
|
|
||||||
).exact_h(1))
|
|
||||||
}))
|
}))
|
||||||
.full_h()
|
.full_h()
|
||||||
.align_nw()
|
.align_nw()
|
||||||
.exact_w(track_width(index, track))
|
.exact_w(track_width(index, track))
|
||||||
.draw(to)?;
|
}))))
|
||||||
}
|
}
|
||||||
Ok(Some(XYWH(0, 0, 0, 0)))
|
|
||||||
}).align_w()))
|
fn view_track_input_count (&self) -> impl Draw<Tui> {
|
||||||
|
button_2("i", "nput", false)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn view_track_input_add (&self) -> impl Draw<Tui> {
|
||||||
|
button_2("I", "+", false)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Draw inputs per track
|
/// Draw inputs per track
|
||||||
|
|
@ -437,9 +430,11 @@ pub trait TracksView: HasTracks + ScenesView + HasMidiIns + HasMidiOuts + HasTra
|
||||||
for track in self.tracks().iter() {
|
for track in self.tracks().iter() {
|
||||||
height = height.max(track.sequencer.midi_ins.len() as u16);
|
height = height.max(track.sequencer.midi_ins.len() as u16);
|
||||||
}
|
}
|
||||||
view_track_row_section(theme, button_2("i", "nput", false), button_2("I", "+", false),
|
view_track_row_section(theme,
|
||||||
bg(theme.darker.term, draw(move|to: &mut Tui|{
|
self.view_track_input_count(),
|
||||||
for (index, track, _x1, _x2) in self.tracks_with_sizes() {
|
self.view_track_input_add(),
|
||||||
|
bg(theme.darker.term,
|
||||||
|
iter_east(move||self.tracks_with_sizes().map(move|(index, track, _x1, _x2)|{
|
||||||
south(
|
south(
|
||||||
bg(track.color.base.term,
|
bg(track.color.base.term,
|
||||||
east!(
|
east!(
|
||||||
|
|
@ -447,17 +442,13 @@ pub trait TracksView: HasTracks + ScenesView + HasMidiIns + HasMidiOuts + HasTra
|
||||||
either(track.sequencer.recording, fg(Red, "●rec "), "·rec "),
|
either(track.sequencer.recording, fg(Red, "●rec "), "·rec "),
|
||||||
either(track.sequencer.overdub, fg(Yellow, "●dub "), "·dub "),
|
either(track.sequencer.overdub, fg(Yellow, "●dub "), "·dub "),
|
||||||
).align_w().full_w()),
|
).align_w().full_w()),
|
||||||
iter_south(||track.sequencer.midi_ins.iter().map(|port|fg_bg(Rgb(255, 255, 255), track.color.dark.term,
|
iter_south(move||track.sequencer.midi_ins.iter().map(move|port|fg_bg(
|
||||||
east!(
|
Rgb(255, 255, 255),
|
||||||
"·i",
|
track.color.dark.term,
|
||||||
index,
|
east!("·i", index, " ", port.port_name()).align_w().full_w()))))
|
||||||
" ",
|
.align_nw()
|
||||||
port.port_name()
|
.exact_wh(track_width(index, track), height + 1)
|
||||||
).align_w().full_w())))
|
}))).align_w())
|
||||||
).align_nw().exact_wh(track_width(index, track), height + 1).draw(to)?;
|
|
||||||
}
|
|
||||||
Ok(Some(XYWH(0, 0, 0, 0)))
|
|
||||||
}).align_w()))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn view_track_devices (&self, theme: ItemTheme) -> impl Draw<Tui> {
|
fn view_track_devices (&self, theme: ItemTheme) -> impl Draw<Tui> {
|
||||||
|
|
@ -640,7 +631,7 @@ fn view_track_row_section <'a> (
|
||||||
west(
|
west(
|
||||||
button_add.align_nw().exact_w(4).full_h(),
|
button_add.align_nw().exact_w(4).full_h(),
|
||||||
east(
|
east(
|
||||||
button.align_nw().full_h().exact_w(20),
|
button.align_nw().full_h().exact_w(16),
|
||||||
content.align_c().full_wh()
|
content.align_c().full_wh()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
20
src/tek.rs
20
src/tek.rs
|
|
@ -16,15 +16,15 @@ pub fn show_version () {
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
#[hotpath::main]
|
#[hotpath::main]
|
||||||
fn main () -> Usually<()> {
|
fn main () -> Usually<()> {
|
||||||
//#[cfg(feature = "prof")] let _flame_guard = {
|
#[cfg(feature = "prof")] let _flame_guard = {
|
||||||
//use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
|
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
|
||||||
////let tracy = tracing_tracy::TracyLayer::default();
|
//let tracy = tracing_tracy::TracyLayer::default();
|
||||||
//let (flame, _guard) = tracing_flame::FlameLayer::with_file("./tracing.folded").unwrap();
|
let (flame, _guard) = tracing_flame::FlameLayer::with_file("./tracing.folded").unwrap();
|
||||||
////let registry = tracing_subscriber::registry().with(flame).init();
|
//let registry = tracing_subscriber::registry().with(flame).init();
|
||||||
////tracing::subscriber::set_global_default(registry)?;
|
//tracing::subscriber::set_global_default(registry)?;
|
||||||
//tracing::subscriber::set_global_default(tracing_subscriber::registry().with(flame))?;
|
tracing::subscriber::set_global_default(tracing_subscriber::registry().with(flame))?;
|
||||||
//_guard
|
_guard
|
||||||
//};
|
};
|
||||||
tengri::Tui::setup_panic();
|
tengri::Tui::setup_panic();
|
||||||
#[cfg(feature = "cli")] let outcome = Config::watched(crate::cli::run_with_config);
|
#[cfg(feature = "cli")] let outcome = Config::watched(crate::cli::run_with_config);
|
||||||
#[cfg(not(feature = "cli"))] let outcome = Config::watched(run_new_plain);
|
#[cfg(not(feature = "cli"))] let outcome = Config::watched(run_new_plain);
|
||||||
|
|
@ -963,7 +963,7 @@ mod draw {
|
||||||
format!("{}/{} {} ",
|
format!("{}/{} {} ",
|
||||||
self.perf.used.load(Relaxed),
|
self.perf.used.load(Relaxed),
|
||||||
self.perf.window.load(Relaxed),
|
self.perf.window.load(Relaxed),
|
||||||
self.perf.clock.raw() / 1000000000),
|
self.perf.clock.raw() / 10000000),
|
||||||
).align_se().draw(to)
|
).align_se().draw(to)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue