From f5a82152394fde4d8f740f664ab7737b82861618 Mon Sep 17 00:00:00 2001 From: cashmere Date: Tue, 28 Jul 2026 19:41:16 +0200 Subject: feat: GPUI desktop port foundation - scene crate: full project/scene/element model, serde round-trip proven against the web SerializedProject shape - transfer crate: .ocp zip container, cross-compat with web fflate archives proven in both directions - storage crate: filesystem project store replacing IndexedDB, .ocp import/export - media crate: ffmpeg-next 8 decoder (frames, audio, thumbnails, waveform summaries) - playback crate: wall-clock anchored, frame-rounded playback clock - gpu crate: native texture readback; compositor renders headless offscreen on Vulkan (spike test) - flake devshell: rust toolchain, GPUI native deps, ffmpeg dev, bindgen clang args; GPUI hello-world builds - port plan in notes/gpui-port.md --- rust/crates/commands/src/command.rs | 46 +++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 rust/crates/commands/src/command.rs (limited to 'rust/crates/commands/src/command.rs') diff --git a/rust/crates/commands/src/command.rs b/rust/crates/commands/src/command.rs new file mode 100644 index 00000000..c13468e7 --- /dev/null +++ b/rust/crates/commands/src/command.rs @@ -0,0 +1,46 @@ +use scene::{ElementRef, Project}; +use thiserror::Error; + +#[derive(Debug, Error)] +pub enum CommandError { + #[error("source track or element not found")] + SourceNotFound, + #[error("target track not found")] + TargetTrackNotFound, + #[error("{0}")] + IncompatiblePlacement(String), +} + +#[derive(Clone, Debug, Default, PartialEq)] +pub struct SelectionPatch { + pub selected_elements: Vec, +} + +#[derive(Clone, Debug, Default, PartialEq)] +pub struct CommandResult { + pub selection: Option, +} + +impl CommandResult { + pub fn element_selection(selected_elements: Vec) -> Self { + Self { + selection: Some(SelectionPatch { selected_elements }), + } + } +} + +pub trait Command { + fn execute( + &mut self, + project: &mut Project, + ) -> Result, CommandError>; + + fn undo(&mut self, project: &mut Project); + + fn redo( + &mut self, + project: &mut Project, + ) -> Result, CommandError> { + self.execute(project) + } +} -- cgit v1.3.1