Sort messages and message handlers

This commit is contained in:
Keavon Chambers
2022-01-12 16:17:40 -08:00
parent 6c639270ae
commit 011c2be26d
24 changed files with 834 additions and 781 deletions
+23 -20
View File
@@ -12,33 +12,36 @@ pub struct FrontendDocumentDetails {
pub id: u64,
}
#[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
// Update prefix: give the frontend a new value or state for it to use
// Trigger prefix: cause a browser API to do something
DisplayDocumentLayerTreeStructure { data_buffer: RawBuffer },
UpdateActiveTool { tool_name: String, tool_options: Option<ToolOptions> },
UpdateActiveDocument { document_id: u64 },
UpdateOpenDocumentsList { open_documents: Vec<FrontendDocumentDetails> },
UpdateInputHints { hint_data: HintData },
DisplayConfirmationToCloseAllDocuments,
DisplayConfirmationToCloseDocument { document_id: u64 },
DisplayDialogAboutGraphite,
DisplayDialogError { title: String, description: String },
DisplayDialogPanic { panic_info: String, title: String, description: String },
DisplayConfirmationToCloseDocument { document_id: u64 },
DisplayConfirmationToCloseAllDocuments,
DisplayDialogAboutGraphite,
UpdateDocumentLayer { data: LayerPanelEntry },
UpdateDocumentArtwork { svg: String },
UpdateDocumentOverlays { svg: String },
UpdateDocumentArtboards { svg: String },
UpdateDocumentScrollbars { position: (f64, f64), size: (f64, f64), multiplier: (f64, f64) },
UpdateDocumentRulers { origin: (f64, f64), spacing: f64, interval: f64 },
TriggerFileUpload,
DisplayDocumentLayerTreeStructure { data_buffer: RawBuffer },
// Trigger prefix: cause a browser API to do something
TriggerFileDownload { document: String, name: String },
TriggerIndexedDbWriteDocument { document: String, details: FrontendDocumentDetails, version: String },
TriggerFileUpload,
TriggerIndexedDbRemoveDocument { document_id: u64 },
UpdateWorkingColors { primary: Color, secondary: Color },
UpdateCanvasZoom { factor: f64 },
TriggerIndexedDbWriteDocument { document: String, details: FrontendDocumentDetails, version: String },
// Update prefix: give the frontend a new value or state for it to use
UpdateActiveDocument { document_id: u64 },
UpdateActiveTool { tool_name: String, tool_options: Option<ToolOptions> },
UpdateCanvasRotation { angle_radians: f64 },
UpdateCanvasZoom { factor: f64 },
UpdateDocumentArtboards { svg: String },
UpdateDocumentArtwork { svg: String },
UpdateDocumentLayer { data: LayerPanelEntry },
UpdateDocumentOverlays { svg: String },
UpdateDocumentRulers { origin: (f64, f64), spacing: f64, interval: f64 },
UpdateDocumentScrollbars { position: (f64, f64), size: (f64, f64), multiplier: (f64, f64) },
UpdateInputHints { hint_data: HintData },
UpdateOpenDocumentsList { open_documents: Vec<FrontendDocumentDetails> },
UpdateWorkingColors { primary: Color, secondary: Color },
}