Skip to content

Commit 6e546aa

Browse files
committed
Improve and clean up panic dialog code and wasm wrapper (#368)
Part of #357
1 parent 4f78c50 commit 6e546aa

File tree

17 files changed

+119
-89
lines changed

17 files changed

+119
-89
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

editor/src/communication/dispatcher.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ impl Dispatcher {
5353
}
5454

5555
pub fn collect_actions(&self) -> ActionList {
56-
//TODO: reduce the number of heap allocations
56+
// TODO: Reduce the number of heap allocations
5757
let mut list = Vec::new();
5858
list.extend(self.input_preprocessor.actions());
5959
list.extend(self.input_mapper.actions());

editor/src/frontend/frontend_message_handler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub enum FrontendMessage {
1313
SetActiveDocument { document_index: usize },
1414
UpdateOpenDocumentsList { open_documents: Vec<String> },
1515
DisplayError { title: String, description: String },
16-
DisplayPanic { title: String, description: String },
16+
DisplayPanic { panic_info: String, title: String, description: String },
1717
DisplayConfirmationToCloseDocument { document_index: usize },
1818
DisplayConfirmationToCloseAllDocuments,
1919
UpdateCanvas { document: String },

editor/src/lib.rs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,35 @@
1-
// since our policy is tabs, we want to stop clippy from warning about that
1+
// Since our policy is tabs, we want to stop clippy from warning about that
22
#![allow(clippy::tabs_in_doc_comments)]
33

44
extern crate graphite_proc_macros;
55

66
mod communication;
77
#[macro_use]
88
pub mod misc;
9+
pub mod consts;
910
mod document;
1011
mod frontend;
1112
mod global;
1213
pub mod input;
1314
pub mod tool;
1415

15-
pub mod consts;
16-
17-
#[doc(inline)]
18-
pub use misc::EditorError;
19-
2016
#[doc(inline)]
2117
pub use graphene::color::Color;
22-
18+
#[doc(inline)]
19+
pub use graphene::document::Document as SvgDocument;
2320
#[doc(inline)]
2421
pub use graphene::LayerId;
25-
2622
#[doc(inline)]
27-
pub use graphene::document::Document as SvgDocument;
23+
pub use misc::EditorError;
2824

2925
use communication::dispatcher::Dispatcher;
26+
use message_prelude::*;
27+
3028
// TODO: serialize with serde to save the current editor state
3129
pub struct Editor {
3230
dispatcher: Dispatcher,
3331
}
3432

35-
use message_prelude::*;
36-
3733
impl Editor {
3834
pub fn new() -> Self {
3935
Self { dispatcher: Dispatcher::new() }
@@ -49,6 +45,12 @@ impl Editor {
4945
}
5046
}
5147

48+
impl Default for Editor {
49+
fn default() -> Self {
50+
Self::new()
51+
}
52+
}
53+
5254
pub mod message_prelude {
5355
pub use crate::communication::generate_uuid;
5456
pub use crate::communication::message::{AsMessage, Message, MessageDiscriminant};

frontend/src/components/panels/Document.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ import { defineComponent } from "vue";
227227
import { ResponseType, registerResponseHandler, Response, UpdateCanvas, UpdateScrollbars, SetActiveTool, SetCanvasZoom, SetCanvasRotation } from "@/utilities/response-handler";
228228
import { SeparatorDirection, SeparatorType } from "@/components/widgets/widgets";
229229
import { comingSoon } from "@/utilities/errors";
230-
import { panicProxy } from "@/utilities/panic";
230+
import { panicProxy } from "@/utilities/panic-proxy";
231231
232232
import LayoutRow from "@/components/layout/LayoutRow.vue";
233233
import LayoutCol from "@/components/layout/LayoutCol.vue";

frontend/src/components/panels/LayerTree.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@
182182
import { defineComponent } from "vue";
183183
184184
import { ResponseType, registerResponseHandler, Response, BlendMode, ExpandFolder, CollapseFolder, UpdateLayer, LayerPanelEntry, LayerType } from "@/utilities/response-handler";
185-
import { panicProxy } from "@/utilities/panic";
185+
import { panicProxy } from "@/utilities/panic-proxy";
186186
import { SeparatorType } from "@/components/widgets/widgets";
187187
188188
import LayoutRow from "@/components/layout/LayoutRow.vue";

frontend/src/components/widgets/inputs/MenuBarInput.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
import { defineComponent } from "vue";
5555
5656
import { comingSoon } from "@/utilities/errors";
57-
import { panicProxy } from "@/utilities/panic";
57+
import { panicProxy } from "@/utilities/panic-proxy";
5858
5959
import IconLabel from "@/components/widgets/labels/IconLabel.vue";
6060
import { ApplicationPlatform } from "@/components/window/MainWindow.vue";

frontend/src/components/widgets/inputs/SwatchPairInput.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
import { defineComponent } from "vue";
7070
7171
import { rgbToDecimalRgb, RGB } from "@/utilities/color";
72-
import { panicProxy } from "@/utilities/panic";
72+
import { panicProxy } from "@/utilities/panic-proxy";
7373
import { ResponseType, registerResponseHandler, Response, UpdateWorkingColors } from "@/utilities/response-handler";
7474
7575
import ColorPicker from "@/components/widgets/floating-menus/ColorPicker.vue";

frontend/src/components/widgets/options/ToolOptions.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
import { defineComponent, PropType } from "vue";
3333
3434
import { comingSoon } from "@/utilities/errors";
35-
import { panicProxy } from "@/utilities/panic";
35+
import { panicProxy } from "@/utilities/panic-proxy";
3636
import { WidgetRow, SeparatorType, IconButtonWidget } from "@/components/widgets/widgets";
3737
3838
import Separator from "@/components/widgets/separators/Separator.vue";

frontend/src/utilities/documents.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
SaveDocument,
1313
} from "@/utilities/response-handler";
1414
import { download, upload } from "@/utilities/files";
15-
import { panicProxy } from "@/utilities/panic";
15+
import { panicProxy } from "@/utilities/panic-proxy";
1616

1717
const wasm = import("@/../wasm/pkg").then(panicProxy);
1818

0 commit comments

Comments
 (0)