UI-8, UI-3: native macOS menu bar; timeline columns, search, reveal-add, UU, CTI snapping

Native menu bar (apps/effectcraft, muda, macOS only): the engine's After Effects
menu tree mirrored into NSMenu through a pure, serializable spec
(ui-egui native_menu: submenus, separators, live labels, check marks, enabled
state, Cmd/Ctrl/function-key shortcuts as accelerators, Open Recent). Hide /
Hide Others / Show All are macOS' predefined items (app.hideOthers/app.showAll
are real commands now, via NSApplication); Services added; About, Settings and
Quit dispatch our commands. State is pushed only when the session revision,
selection, history, settings or journal change; structural changes rebuild.
Activations dispatch the same command ids as the in-window bar; Edit
Cut/Copy/Paste/Select All/Undo/Redo act on a focused text field. Settings >
Appearance > Use In-Window Menu Bar on macOS switches back.

Timeline: column visibility from the column header's context menu (A/V
Features, Keys, Label, #, Comment, Switches, Modes, Parent & Link, In, Out,
Duration, Stretch; Source/Layer Name toggle), Comment editing
(layer.setComment), draggable In/Out/Duration cells, Stretch opens Time
Stretch; property search filters layers and reveals matching properties with
their groups; Shift+P/S/R/T/A/E/M/F/L/U add to the revealed properties; UU
reveals all modified properties; Shift-drag in the ruler snaps the CTI to keys,
in/out points, markers and the work area. Commands: timeline.column,
timeline.sourceName, timeline.search, timeline.revealAdd.*.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon Thomas
2026-10-02 22:21:08 -04:00
co-authored by Claude Opus 5.5
parent 758c3cebd4
commit 8404fead60
13 changed files with 1640 additions and 206 deletions
+39 -1
View File
@@ -7,6 +7,8 @@
mod audio_out;
mod control_server;
#[cfg(target_os = "macos")]
mod native_menu;
use effectcraft_ui_egui::EffectcraftApp;
use serde_json::json;
@@ -100,16 +102,52 @@ fn main() -> eframe::Result {
app.hooks.pick_save_file = Some(Box::new(|name: &str, ext: &str| {
rfd::FileDialog::new().add_filter(ext, &[ext]).set_file_name(name).save_file().map(|p| p.to_string_lossy().to_string())
}));
#[cfg(target_os = "macos")]
{
app.hooks.app_action = Some(Box::new(native_menu::app_action));
app.hooks.clipboard_text = Some(Box::new(native_menu::clipboard_text));
}
if let Some(port) = control_port {
disable_app_nap();
let rx = control_server::start(port, cc.egui_ctx.clone());
app = app.with_control(rx);
}
Ok(Box::new(app))
Ok(Box::new(Desktop {
#[cfg(target_os = "macos")]
menu: native_menu::NativeBar::new(&cc.egui_ctx),
app,
}))
}),
)
}
/// The desktop app: the egui app plus, on macOS, the system menu bar.
struct Desktop {
app: EffectcraftApp,
#[cfg(target_os = "macos")]
menu: native_menu::NativeBar,
}
impl eframe::App for Desktop {
fn logic(&mut self, ctx: &egui::Context, frame: &mut eframe::Frame) {
#[cfg(target_os = "macos")]
self.menu.update(&mut self.app, ctx);
self.app.logic(ctx, frame);
}
fn ui(&mut self, ui: &mut egui::Ui, frame: &mut eframe::Frame) {
self.app.ui(ui, frame);
}
fn on_exit(&mut self) {
self.app.on_exit();
}
fn raw_input_hook(&mut self, ctx: &egui::Context, raw_input: &mut egui::RawInput) {
self.app.raw_input_hook(ctx, raw_input);
}
}
/// The platform config directory for EffectCraft (`EFFECTCRAFT_CONFIG_DIR` overrides):
/// `~/Library/Application Support/EffectCraft` (macOS), `%APPDATA%\EffectCraft` (Windows),
/// `$XDG_CONFIG_HOME/effectcraft` or `~/.config/effectcraft` (Linux and others).