mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-21 05:38:12 +08:00
Improve and clean up panic dialog code and wasm wrapper (#368)
Part of #357
This commit is contained in:
@@ -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
@@ -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};
|
||||
|
||||
Reference in New Issue
Block a user