use graphite_editor::messages::prelude::FrontendMessage; use std::path::PathBuf; pub(crate) use graphite_editor::messages::prelude::Message as EditorMessage; pub use graphite_editor::messages::input_mapper::utility_types::input_keyboard::{Key, ModifierKeys}; pub use graphite_editor::messages::input_mapper::utility_types::input_mouse::{EditorMouseState as MouseState, EditorPosition as Position, MouseKeys}; pub use graphite_editor::messages::prelude::InputPreprocessorMessage as InputMessage; pub use graphite_editor::messages::prelude::DocumentId; pub use graphite_editor::messages::prelude::PreferencesMessageHandler as Preferences; pub enum DesktopFrontendMessage { ToWeb(Vec), OpenLaunchDocuments, OpenFileDialog { title: String, filters: Vec, context: OpenFileDialogContext, }, SaveFileDialog { title: String, default_filename: String, default_folder: Option, filters: Vec, context: SaveFileDialogContext, }, WriteFile { path: PathBuf, content: Vec, }, OpenUrl(String), UpdateViewportPhysicalBounds { x: f64, y: f64, width: f64, height: f64, }, UpdateUIScale { scale: f64, }, UpdateOverlays(vello::Scene), PersistenceWriteDocument { id: DocumentId, document: Document, }, PersistenceDeleteDocument { id: DocumentId, }, PersistenceUpdateCurrentDocument { id: DocumentId, }, PersistenceLoadCurrentDocument, PersistenceLoadRemainingDocuments, PersistenceUpdateDocumentsList { ids: Vec, }, PersistenceWritePreferences { preferences: Preferences, }, PersistenceLoadPreferences, UpdateMenu { entries: Vec, }, ClipboardRead, ClipboardWrite { content: String, }, PointerLock, WindowClose, WindowMinimize, WindowMaximize, WindowFullscreen, WindowDrag, WindowHide, WindowHideOthers, WindowShowAll, Restart, LoadThirdPartyLicenses, } pub enum DesktopWrapperMessage { FromWeb(Box), Input(InputMessage), FileDialogResult { path: PathBuf, content: Vec, context: OpenFileDialogContext, }, SaveFileDialogResult { path: PathBuf, context: SaveFileDialogContext, }, OpenFile { path: PathBuf, content: Vec, }, ImportFile { path: PathBuf, content: Vec, }, PollNodeGraphEvaluation, UpdateMaximized { maximized: bool, }, UpdateFullscreen { fullscreen: bool, }, LoadDocument { id: DocumentId, document: Document, to_front: bool, select_after_open: bool, }, SelectDocument { id: DocumentId, }, LoadPreferences { preferences: Preferences, }, MenuEvent { id: String, }, ClipboardReadResult { content: Option, }, PointerLockMove { x: f64, y: f64, }, LoadThirdPartyLicenses { text: String, }, } #[derive(Clone, serde::Serialize, serde::Deserialize, Debug)] pub struct Document { pub content: String, pub name: String, pub path: Option, pub is_saved: bool, } pub struct FileFilter { pub name: String, pub extensions: Vec, } pub enum OpenFileDialogContext { Open, Import, } pub enum SaveFileDialogContext { Document { document_id: DocumentId, content: Vec }, File { content: Vec }, } pub enum MenuItem { Action { id: String, text: String, enabled: bool, shortcut: Option, }, Checkbox { id: String, text: String, enabled: bool, shortcut: Option, checked: bool, }, SubMenu { id: String, text: String, enabled: bool, items: Vec, }, Separator, } pub use keyboard_types::{Code as KeyCode, Modifiers}; pub struct Shortcut { pub key: KeyCode, pub modifiers: Modifiers, }