mirror of
https://github.com/storytold/soundcraft.git
synced 2026-11-19 00:25:08 +00:00
* Hide the input selector on the Master strip (#1271) * Keep the Master I/O section at full height so its fader lines up with other strips (#1271)
This commit is contained in:
1 parent
1110e6804a
commit
c542fe931d
2 files changed
+32
-15
No files matched your search
@@ -550,7 +550,7 @@ fn io_column(app: &mut SoundApp, ui: &mut Ui, track: &Track, r: Rect) {
|
||||
ui.painter().rect_filled(r, 0.0, t.slot_well);
|
||||
let ui = column_ui(ui, "io", r);
|
||||
let row = |y: f32, h: f32| (r.height() >= y + h + 1.0).then_some(Rect::from_min_size(r.min + vec2(7.0, y), vec2(r.width() - 14.0, h)));
|
||||
if let Some(input) = row(4.0, 15.0) {
|
||||
if let Some(input) = row(4.0, 15.0).filter(|_| crate::mix_window::has_input_selector(track.kind)) {
|
||||
let input_name = crate::mix_window::input_name(app, track);
|
||||
let resp = header_selector(&ui, input, ui.scope_id().with(("in", id.0)), &input_name, t.text, true, &format!("Input for {}", track.name));
|
||||
crate::mix_window::route_popup(app, &resp.on_hover_text("Input"), id, true);
|
||||
|
||||
@@ -371,27 +371,36 @@ fn comments_section(app: &mut SoundApp, ui: &mut Ui, cx: &StripCtx<'_>, mut y: f
|
||||
y
|
||||
}
|
||||
|
||||
/// Input, output and automation mode selectors.
|
||||
/// Whether a track shows an input selector. A master fader has no input of its own:
|
||||
/// it only shows the output of the path it controls.
|
||||
pub(crate) fn has_input_selector(kind: TrackKind) -> bool {
|
||||
kind != TrackKind::Master
|
||||
}
|
||||
|
||||
/// Input (except on master faders), output and automation mode selectors.
|
||||
fn io_section(app: &mut SoundApp, ui: &mut Ui, cx: &StripCtx<'_>, mut y: f32) -> f32 {
|
||||
let StripCtx { track, id, narrow, x0, inner_w, .. } = *cx;
|
||||
let t = Tokens::current();
|
||||
if cx.shows("io") {
|
||||
let has_input = has_input_selector(track.kind);
|
||||
let sec = Rect::from_min_size(pos2(x0, y), vec2(inner_w, 16.0 + 2.0 * 18.0 + 30.0));
|
||||
inset(ui.painter(), sec, t.strip_section);
|
||||
section_label(ui, sec, "I / O", narrow);
|
||||
let in_r = Rect::from_min_size(pos2(x0 + 2.0, sec.min.y + 15.0), vec2(inner_w - 4.0, 16.0));
|
||||
let out_r = Rect::from_min_size(pos2(x0 + 2.0, sec.min.y + 33.0), vec2(inner_w - 4.0, 16.0));
|
||||
let mut c = ui.new_child(egui::UiBuilder::new().id_salt(("mix-input", id.0)).max_rect(in_r));
|
||||
let input = input_name(app, track);
|
||||
let resp = selector_box_named(
|
||||
&mut c,
|
||||
in_r.width(),
|
||||
in_r.height(),
|
||||
&input,
|
||||
t.text,
|
||||
SelectorLabels { name: &format!("Input for {}", track.name), value: &input, tooltip: "Input" },
|
||||
);
|
||||
route_popup(app, &resp, id, true);
|
||||
let out_r = if has_input { Rect::from_min_size(pos2(x0 + 2.0, sec.min.y + 33.0), vec2(inner_w - 4.0, 16.0)) } else { in_r };
|
||||
if has_input {
|
||||
let mut c = ui.new_child(egui::UiBuilder::new().id_salt(("mix-input", id.0)).max_rect(in_r));
|
||||
let input = input_name(app, track);
|
||||
let resp = selector_box_named(
|
||||
&mut c,
|
||||
in_r.width(),
|
||||
in_r.height(),
|
||||
&input,
|
||||
t.text,
|
||||
SelectorLabels { name: &format!("Input for {}", track.name), value: &input, tooltip: "Input" },
|
||||
);
|
||||
route_popup(app, &resp, id, true);
|
||||
}
|
||||
let mut c = ui.new_child(egui::UiBuilder::new().id_salt(("mix-output", id.0)).max_rect(out_r));
|
||||
let output = route_name(app, &track.mixer.output);
|
||||
let resp = selector_box_named(
|
||||
@@ -404,7 +413,7 @@ fn io_section(app: &mut SoundApp, ui: &mut Ui, cx: &StripCtx<'_>, mut y: f32) ->
|
||||
);
|
||||
route_popup(app, &resp, id, false);
|
||||
// Automation mode.
|
||||
let am_r = Rect::from_min_size(pos2(x0 + 2.0, sec.min.y + 51.0), vec2(inner_w - 4.0, 16.0));
|
||||
let am_r = Rect::from_min_size(pos2(x0 + 2.0, sec.min.y + 15.0 + 2.0 * 18.0), vec2(inner_w - 4.0, 16.0));
|
||||
ui.painter().text(pos2(am_r.center().x, am_r.min.y - 1.0), Align2::CENTER_BOTTOM, "", regular(9.0), t.text_dim);
|
||||
let mut c = ui.new_child(egui::UiBuilder::new().max_rect(am_r));
|
||||
let mode = track.mixer.automation_mode;
|
||||
@@ -667,6 +676,14 @@ fn name_and_readout(app: &mut SoundApp, ui: &mut Ui, cx: &StripCtx<'_>) {
|
||||
mod tests {
|
||||
use super::{Readout, dragged_send_db, editable_readout, parse_db, parse_pan};
|
||||
use egui::{Event, Modifiers, PointerButton, Rect, pos2, vec2};
|
||||
use soundcraft_model::TrackKind;
|
||||
|
||||
#[test]
|
||||
fn master_strip_has_no_input_selector() {
|
||||
assert!(!super::has_input_selector(TrackKind::Master));
|
||||
assert!(super::has_input_selector(TrackKind::Audio));
|
||||
assert!(super::has_input_selector(TrackKind::Aux));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn typed_db_accepts_console_notation_and_clamps() {
|
||||
|
||||
Reference in new issue
Block a user