Files
Graphite/editor/src/frontend/frontend_message.rs
0HyperCube 4b7d8b7ab0 Migrate dialogs to Rust and add a New File dialog (#623)
* Migrate coming soon and about dialog to Rust

* Migrate confirm close and close all

* Migrate dialog error

* Improve keyboard navigation throughout UI

* Cleanup and fix panic dialog

* Reduce css spacing to better match old dialogs

* Add new document modal

* Fix crash when generating default name

* Populate rust about graphite data on startup

* Code review changes

* Move one more :focus CSS rule into App.vue

* Add a dialog message and move dialogs

* Split out keyboard input navigation from this branch

* Improvements including simplifying panic dialog code

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2022-05-07 09:59:52 +01:00

57 lines
2.6 KiB
Rust

use super::utility_types::{FrontendDocumentDetails, FrontendImageData, MouseCursorIcon};
use crate::document::layer_panel::{LayerPanelEntry, RawBuffer};
use crate::layout::layout_message::LayoutTarget;
use crate::layout::widgets::SubLayout;
use crate::message_prelude::*;
use crate::misc::HintData;
use crate::Color;
use serde::{Deserialize, Serialize};
#[remain::sorted]
#[impl_message(Message, Frontend)]
#[derive(PartialEq, Clone, Deserialize, Serialize, Debug)]
pub enum FrontendMessage {
// Display prefix: make the frontend show something, like a dialog
DisplayDialog { icon: String },
DisplayDialogDismiss,
DisplayDialogPanic { panic_info: String, title: String, description: String },
DisplayDocumentLayerTreeStructure { data_buffer: RawBuffer },
DisplayEditableTextbox { text: String, line_width: Option<f64>, font_size: f64, color: Color },
DisplayRemoveEditableTextbox,
// Trigger prefix: cause a browser API to do something
TriggerFileDownload { document: String, name: String },
TriggerFileUpload,
TriggerFontLoad { font: String },
TriggerFontLoadDefault,
TriggerIndexedDbRemoveDocument { document_id: u64 },
TriggerIndexedDbWriteDocument { document: String, details: FrontendDocumentDetails, version: String },
TriggerTextCommit,
TriggerTextCopy { copy_text: String },
TriggerViewportResize,
TriggerVisitLink { url: String },
// Update prefix: give the frontend a new value or state for it to use
UpdateActiveDocument { document_id: u64 },
UpdateActiveTool { tool_name: String },
UpdateCanvasRotation { angle_radians: f64 },
UpdateCanvasZoom { factor: f64 },
UpdateDialogDetails { layout_target: LayoutTarget, layout: SubLayout },
UpdateDocumentArtboards { svg: String },
UpdateDocumentArtwork { svg: String },
UpdateDocumentBarLayout { layout_target: LayoutTarget, layout: SubLayout },
UpdateDocumentLayer { data: LayerPanelEntry },
UpdateDocumentOverlays { svg: String },
UpdateDocumentRulers { origin: (f64, f64), spacing: f64, interval: f64 },
UpdateDocumentScrollbars { position: (f64, f64), size: (f64, f64), multiplier: (f64, f64) },
UpdateImageData { image_data: Vec<FrontendImageData> },
UpdateInputHints { hint_data: HintData },
UpdateMouseCursor { cursor: MouseCursorIcon },
UpdateOpenDocumentsList { open_documents: Vec<FrontendDocumentDetails> },
UpdatePropertyPanelOptionsLayout { layout_target: LayoutTarget, layout: SubLayout },
UpdatePropertyPanelSectionsLayout { layout_target: LayoutTarget, layout: SubLayout },
UpdateToolOptionsLayout { layout_target: LayoutTarget, layout: SubLayout },
UpdateWorkingColors { primary: Color, secondary: Color },
}