Improve and clean up panic dialog code and wasm wrapper (#368)

Part of #357
This commit is contained in:
Keavon Chambers
2021-09-01 04:09:23 -07:00
parent 4f78c50010
commit 6e546aa726
17 changed files with 122 additions and 92 deletions
+1 -1
View File
@@ -53,7 +53,7 @@ impl Dispatcher {
}
pub fn collect_actions(&self) -> ActionList {
//TODO: reduce the number of heap allocations
// TODO: Reduce the number of heap allocations
let mut list = Vec::new();
list.extend(self.input_preprocessor.actions());
list.extend(self.input_mapper.actions());
@@ -13,7 +13,7 @@ pub enum FrontendMessage {
SetActiveDocument { document_index: usize },
UpdateOpenDocumentsList { open_documents: Vec<String> },
DisplayError { title: String, description: String },
DisplayPanic { title: String, description: String },
DisplayPanic { panic_info: String, title: String, description: String },
DisplayConfirmationToCloseDocument { document_index: usize },
DisplayConfirmationToCloseAllDocuments,
UpdateCanvas { document: String },
+16 -14
View File
@@ -1,4 +1,4 @@
// since our policy is tabs, we want to stop clippy from warning about that
// Since our policy is tabs, we want to stop clippy from warning about that
#![allow(clippy::tabs_in_doc_comments)]
extern crate graphite_proc_macros;
@@ -6,34 +6,30 @@ extern crate graphite_proc_macros;
mod communication;
#[macro_use]
pub mod misc;
pub mod consts;
mod document;
mod frontend;
mod global;
pub mod input;
pub mod tool;
pub mod consts;
#[doc(inline)]
pub use graphene::color::Color;
#[doc(inline)]
pub use graphene::document::Document as SvgDocument;
#[doc(inline)]
pub use graphene::LayerId;
#[doc(inline)]
pub use misc::EditorError;
#[doc(inline)]
pub use graphene::color::Color;
#[doc(inline)]
pub use graphene::LayerId;
#[doc(inline)]
pub use graphene::document::Document as SvgDocument;
use communication::dispatcher::Dispatcher;
use message_prelude::*;
// TODO: serialize with serde to save the current editor state
pub struct Editor {
dispatcher: Dispatcher,
}
use message_prelude::*;
impl Editor {
pub fn new() -> Self {
Self { dispatcher: Dispatcher::new() }
@@ -49,6 +45,12 @@ impl Editor {
}
}
impl Default for Editor {
fn default() -> Self {
Self::new()
}
}
pub mod message_prelude {
pub use crate::communication::generate_uuid;
pub use crate::communication::message::{AsMessage, Message, MessageDiscriminant};