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