diff --git a/src/tools/prelude.rs b/src/tools/prelude.rs index f91c28e9..79fe0fb0 100644 --- a/src/tools/prelude.rs +++ b/src/tools/prelude.rs @@ -29,6 +29,7 @@ pub use std::cell::RefCell; pub use std::mem; //UI +pub use crate::user_interface::gui; pub use crate::user_interface::{Interface, MouseInfo}; pub use imgui::Ui; pub use sdl2::mouse::MouseButton; diff --git a/src/tools/vws/dialog.rs b/src/tools/vws/dialog.rs index 9c4e653a..1c20bf53 100644 --- a/src/tools/vws/dialog.rs +++ b/src/tools/vws/dialog.rs @@ -75,6 +75,11 @@ impl VWS { let s_selection = idx_to_cap_type(s_current_selection); let e_selection = idx_to_cap_type(e_current_selection); + if s_selection == CapType::Custom || e_selection == CapType::Custom { + gui::error!("Cannot use custom caps at this time from MFEKglif."); + return; + } + // we only update the contour and previews when our selection changes if old_s != s_current_selection || e_current_selection != old_e { let mut new_data = vws_contour; diff --git a/src/user_interface/gui/mod.rs b/src/user_interface/gui/mod.rs index 7a6bb7b0..e6aa88cb 100644 --- a/src/user_interface/gui/mod.rs +++ b/src/user_interface/gui/mod.rs @@ -39,6 +39,9 @@ use imgui_sdl2::ImguiSdl2; use imgui_skia_renderer::Renderer; use sdl2::{event::Event, mouse::MouseState, video::Window}; +#[macro_use] +pub(crate) mod msgbox; +pub(crate) use self::msgbox::gui_error as error; pub mod layer_list; pub mod prompts; diff --git a/src/user_interface/gui/msgbox.rs b/src/user_interface/gui/msgbox.rs new file mode 100644 index 00000000..f26bc088 --- /dev/null +++ b/src/user_interface/gui/msgbox.rs @@ -0,0 +1,15 @@ +macro_rules! gui_error { + ($($format_args:tt),*) => { + use log; + use msgbox::{self, IconType::*}; + use std::thread; + log::error!($($format_args),*); + thread::spawn(|| { + match msgbox::create("MFEKglif critical error", &format!($($format_args),*), Error) { + Ok(_) => log::trace!("Opened crash msgbox successfully"), + Err(e) => log::error!("Failed to create error box! {:?}", e), + } + }); + } +} +pub(crate) use gui_error;