From 32438ce25f69de99d2523b98237f62cfa90890d7 Mon Sep 17 00:00:00 2001 From: cashmere Date: Tue, 28 Jul 2026 20:14:51 +0200 Subject: feat: port domain crates to Rust (session 1 complete) All green: cargo test --workspace (~300 tests, 0 failures). - timeline (45): placement, resize/ripple, split, snap, retime, audio separation, scene helpers - animation (73): bezier solver, channel sampling, keyframe ops, split/clamp/clone, param definitions - commands (9): Command trait, BatchCommand, history, 19 concrete commands, freeze-frame port 1:1 - audio (22): audible collection, range mixing, mastering limiter, rms/peak buckets - text (19): cosmic-text layout/measure/raster, backgrounds, decorations - graphics (52): full CSS gradient parser, tiny-skia raster, 4 shape definitions - effect-defs (16): blur definition, registry, pass resolution - mask-defs (19): all 9 mask renderers via tiny-skia - renderer (6): node model + scene builder port - desktop: GPUI projects screen wired to ProjectStore - scene: factory (web defaults: v32, Main Track, 1920x1080, 30fps) --- apps/desktop/src/app.rs | 62 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 apps/desktop/src/app.rs (limited to 'apps/desktop/src/app.rs') diff --git a/apps/desktop/src/app.rs b/apps/desktop/src/app.rs new file mode 100644 index 00000000..8eab4f87 --- /dev/null +++ b/apps/desktop/src/app.rs @@ -0,0 +1,62 @@ +use gpui::{Context, Window, div, prelude::*, rgb}; + +use crate::projects_view::ProjectsView; +use crate::theme; + +pub enum Screen { + Projects, + Editor { project_id: String, project_name: String }, +} + +pub struct OpenCutApp { + pub screen: Screen, + pub projects_view: gpui::Entity, +} + +impl OpenCutApp { + pub fn new(cx: &mut Context) -> Self { + let app = cx.weak_entity(); + let projects_view = cx.new(|_| ProjectsView::new(app)); + Self { + screen: Screen::Projects, + projects_view, + } + } + + pub fn open_project(&mut self, project_id: String, project_name: String, cx: &mut Context) { + self.screen = Screen::Editor { + project_id, + project_name, + }; + cx.notify(); + } +} + +impl Render for OpenCutApp { + fn render(&mut self, _window: &mut Window, _cx: &mut Context) -> impl IntoElement { + let content: gpui::AnyElement = match &self.screen { + Screen::Projects => self.projects_view.clone().into_any_element(), + Screen::Editor { project_name, project_id } => div() + .size_full() + .flex() + .flex_col() + .items_center() + .justify_center() + .gap_2() + .child(format!("Editing: {project_name}")) + .child( + div() + .text_sm() + .text_color(rgb(theme::TEXT_SECONDARY)) + .child(format!("Editor UI lands here — preview, timeline, panels ({project_id})")), + ) + .into_any_element(), + }; + + div() + .size_full() + .bg(rgb(theme::BACKGROUND)) + .text_color(rgb(theme::TEXT_PRIMARY)) + .child(content) + } +} -- cgit v1.3.1