Nudge clip gain with Ctrl+Shift+Up/Down on Windows and Linux too

Ctrl+Shift+Up/Down (#76) only worked on macOS. The registry's Ctrl there
is the Mac Control key, which has no key of its own on Windows and Linux
(#20), so the keys did nothing there, while the Shortcuts window and the
command palette still showed Ctrl+Shift+Up.

Pro Tools for Windows puts these on the Start key, but egui does not
report that key off macOS, and Windows and GNOME use Win/Super+Shift+
Up/Down to resize and move windows. So off macOS the nudge is
Ctrl+Shift+Up/Down: the same keys as on the Mac and what the labels
already say. No SoundCraft shortcut uses them there; Ctrl+Up/Down without
Shift still extends the selection.
This commit is contained in:
grovebit 2026-10-10 02:34:26 +01:00
parent 522e59f8f5
commit d3348bcbbc
2 changed files with 20 additions and 10 deletions

View File

@ -170,6 +170,12 @@ fn fixed(app: &mut SoundApp, key: Key, m: Modifiers, mac: bool) -> bool {
let _ = app.run(id, json!({}));
true
}
// Ctrl+Shift+Up/Down nudge clip gain off macOS too (the registry's Ctrl is the Mac Control key).
Key::ArrowUp | Key::ArrowDown if !mac && m.ctrl && m.shift && !m.alt => {
let id = if key == Key::ArrowUp { "clip.gain_nudge_up" } else { "clip.gain_nudge_down" };
let _ = app.run(id, json!({}));
true
}
// Commands Keyboard Focus: single-key editing (Edit window only).
k if plain && app.ui.window == MainWindow::Edit && app.engine.session().edit.keyboard_focus == "commands" && commands_focus(app, k) => true,
Key::R | Key::T if plain => {

View File

@ -1,3 +1,4 @@
use egui::os::OperatingSystem;
use egui::{Key, Modifiers};
use serde_json::json;
use soundcraft_ui_egui::{Services, SoundApp, shortcuts};
@ -9,14 +10,17 @@ fn press(ctx: &egui::Context, app: &mut SoundApp, key: Key, modifiers: Modifiers
#[test]
fn ctrl_shift_arrows_nudge_the_selected_clip_gain() {
let mut app = SoundApp::new(soundcraft_engine::demo::demo_engine(), None, Services::default());
let kick = app.engine.session().track_by_name("Kick").unwrap().clips()[0].id;
app.engine.execute("edit.select", &json!({"clips": [kick.0]})).unwrap();
let ctx = egui::Context::default();
ctx.set_os(egui::os::OperatingSystem::Mac);
let ctrl_shift = Modifiers { ctrl: true, shift: true, ..Modifiers::NONE };
press(&ctx, &mut app, Key::ArrowUp, ctrl_shift);
press(&ctx, &mut app, Key::ArrowUp, ctrl_shift);
press(&ctx, &mut app, Key::ArrowDown, ctrl_shift);
assert_eq!(app.engine.session().find_clip(kick).unwrap().1.gain_db, 1.0);
let pc_ctrl = Modifiers { ctrl: true, command: true, ..Modifiers::NONE };
for (os, ctrl) in [(OperatingSystem::Mac, Modifiers::CTRL), (OperatingSystem::Windows, pc_ctrl), (OperatingSystem::Nix, pc_ctrl)] {
let mut app = SoundApp::new(soundcraft_engine::demo::demo_engine(), None, Services::default());
let kick = app.engine.session().track_by_name("Kick").unwrap().clips()[0].id;
app.engine.execute("edit.select", &json!({"clips": [kick.0]})).unwrap();
let ctx = egui::Context::default();
ctx.set_os(os);
let ctrl_shift = Modifiers { shift: true, ..ctrl };
press(&ctx, &mut app, Key::ArrowUp, ctrl_shift);
press(&ctx, &mut app, Key::ArrowUp, ctrl_shift);
press(&ctx, &mut app, Key::ArrowDown, ctrl_shift);
assert_eq!(app.engine.session().find_clip(kick).unwrap().1.gain_db, 1.0, "{os:?}");
}
}