Skip to content

Commit

Permalink
refactor: merge viewers
Browse files Browse the repository at this point in the history
  • Loading branch information
sbwtw committed Jul 20, 2024
1 parent 1fec76b commit aeb74c2
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 21 deletions.
15 changes: 0 additions & 15 deletions viewer-egui/Cargo.toml

This file was deleted.

26 changes: 26 additions & 0 deletions viewer/src/bin.rs
Original file line number Diff line number Diff line change
@@ -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()
}
2 changes: 1 addition & 1 deletion viewer-egui/src/main.rs → viewer/src/egui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 3 additions & 5 deletions viewer/src/main.rs → viewer/src/gtk4.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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();
Expand Down

0 comments on commit aeb74c2

Please sign in to comment.