diff --git a/viewer-egui/Cargo.toml b/viewer-egui/Cargo.toml deleted file mode 100644 index 14360bf..0000000 --- a/viewer-egui/Cargo.toml +++ /dev/null @@ -1,15 +0,0 @@ -[package] -name = "viewer-egui" -version = "0.1.0" -edition = "2021" - -[dependencies] -stc-rs = { path = "../lib", features = ["lalrpop_parser"] } -pretty_env_logger = "*" -log = "*" -once_cell = "*" -async-channel = "*" -quick-xml = { version = "*", features = ["serialize"] } -serde = { version = "*", features = ["derive"] } -eframe = { version = "*", features = ["default"] } -egui_extras = { version = "*", features = ["default", "image"] } \ No newline at end of file diff --git a/viewer/src/bin.rs b/viewer/src/bin.rs new file mode 100644 index 0000000..7a649cd --- /dev/null +++ b/viewer/src/bin.rs @@ -0,0 +1,26 @@ +mod storage; + +#[cfg(feature = "gui-egui")] +mod egui; + +#[cfg(feature = "gui-gtk4")] +mod column_object; +#[cfg(feature = "gui-gtk4")] +mod gtk4; +#[cfg(feature = "gui-gtk4")] +mod stc_viewer; + +#[cfg(all(feature = "gui-egui", feature = "gui-gtk4"))] +compile_error!( + "Feature gui-egui and gui-gtk4 are mutually exclusive and cannot be enabled together" +); + +#[cfg(feature = "gui-gtk4")] +fn main() { + gtk4::main() +} + +#[cfg(feature = "gui-egui")] +fn main() -> Result<(), eframe::Error> { + egui::main() +} diff --git a/viewer-egui/src/main.rs b/viewer/src/egui.rs similarity index 97% rename from viewer-egui/src/main.rs rename to viewer/src/egui.rs index 7cf6ab1..1d7b0e9 100644 --- a/viewer-egui/src/main.rs +++ b/viewer/src/egui.rs @@ -44,7 +44,7 @@ impl eframe::App for StcViewer { } } -fn main() -> Result<(), eframe::Error> { +pub fn main() -> Result<(), eframe::Error> { pretty_env_logger::init(); let options = eframe::NativeOptions { diff --git a/viewer/src/main.rs b/viewer/src/gtk4.rs similarity index 98% rename from viewer/src/main.rs rename to viewer/src/gtk4.rs index 7eb9e45..6847c96 100644 --- a/viewer/src/main.rs +++ b/viewer/src/gtk4.rs @@ -1,8 +1,6 @@ -mod column_object; -mod stc_viewer; -mod storage; - use crate::stc_viewer::{StcViewerApp, UIMessages, STC_VIEWER_COLUMN_NAME}; +use crate::storage; + use glib::MainContext; use gtk4::gdk::ffi::GDK_BUTTON_SECONDARY; use gtk4::gdk::Rectangle; @@ -16,7 +14,7 @@ use stc::prelude::*; use std::rc::Rc; use std::sync::Mutex; -fn main() { +pub fn main() { pretty_env_logger::init(); let mgr = UnitsManager::new();