2026-07-11 18:13:03 +03:00
|
|
|
//! HCIE Iced GUI — entry point.
|
|
|
|
|
//!
|
|
|
|
|
//! Launches the Iced application with the HCIE image editor.
|
|
|
|
|
|
|
|
|
|
mod app;
|
|
|
|
|
mod canvas;
|
|
|
|
|
mod color_picker;
|
|
|
|
|
mod dialogs;
|
|
|
|
|
mod dock;
|
|
|
|
|
mod io;
|
|
|
|
|
mod panels;
|
|
|
|
|
mod sidebar;
|
|
|
|
|
mod theme;
|
|
|
|
|
|
|
|
|
|
use app::HcieIcedApp;
|
|
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
|
let _ = env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("info"))
|
|
|
|
|
.try_init();
|
|
|
|
|
|
|
|
|
|
log::info!("Starting HCIE Iced GUI");
|
|
|
|
|
|
|
|
|
|
let args: Vec<String> = std::env::args().collect();
|
|
|
|
|
let mut load_path: Option<std::path::PathBuf> = None;
|
|
|
|
|
|
|
|
|
|
let mut i = 1;
|
|
|
|
|
while i < args.len() {
|
|
|
|
|
match args[i].as_str() {
|
|
|
|
|
"--help" | "-h" => {
|
|
|
|
|
println!("Usage: hcie-iced [OPTIONS] [FILE]");
|
|
|
|
|
println!();
|
|
|
|
|
println!("HCIE — Iced Edition");
|
|
|
|
|
println!();
|
|
|
|
|
println!("Options:");
|
|
|
|
|
println!(" -h, --help Print this help message");
|
|
|
|
|
println!();
|
|
|
|
|
println!("Arguments:");
|
|
|
|
|
println!(" FILE Image file to open on startup");
|
|
|
|
|
std::process::exit(0);
|
|
|
|
|
}
|
|
|
|
|
other if !other.starts_with('-') => {
|
|
|
|
|
load_path = Some(std::path::PathBuf::from(other));
|
|
|
|
|
}
|
|
|
|
|
unknown => {
|
|
|
|
|
eprintln!("Unknown argument: {}", unknown);
|
|
|
|
|
std::process::exit(1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
i += 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Start tablet evdev listener
|
|
|
|
|
let tablet_state = std::sync::Arc::new(std::sync::Mutex::new(
|
|
|
|
|
io::tablet::TabletState::new(),
|
|
|
|
|
));
|
|
|
|
|
io::tablet::start_evdev_listener(tablet_state.clone());
|
|
|
|
|
|
|
|
|
|
let _ = iced::application("HCIE — Iced Edition", HcieIcedApp::update, HcieIcedApp::view)
|
|
|
|
|
.subscription(HcieIcedApp::subscription)
|
|
|
|
|
.theme(HcieIcedApp::theme)
|
|
|
|
|
.window_size((1280.0, 800.0))
|
2026-07-12 02:05:31 +03:00
|
|
|
.decorations(false)
|
2026-07-11 18:13:03 +03:00
|
|
|
.run_with(move || {
|
2026-07-12 02:05:31 +03:00
|
|
|
let (mut app, init_task) = HcieIcedApp::new(load_path);
|
2026-07-11 18:13:03 +03:00
|
|
|
app.tablet_state = tablet_state;
|
2026-07-12 02:05:31 +03:00
|
|
|
(app, init_task)
|
2026-07-11 18:13:03 +03:00
|
|
|
});
|
|
|
|
|
}
|