Files
hcie-rust-v3.05/hcie-iced-app/crates/hcie-iced-gui/src/main.rs
T

77 lines
2.1 KiB
Rust
Raw Normal View History

//! HCIE Iced GUI — entry point.
//!
//! Launches the Iced application with the HCIE image editor.
mod ai_chat;
mod ai_script;
mod app;
2026-07-15 17:42:05 +03:00
mod brush_import;
mod canvas;
mod color_picker;
mod dialogs;
mod dock;
mod i18n;
mod io;
mod panels;
mod script;
mod selection;
mod settings;
mod sidebar;
mod theme;
mod viewer;
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))
.decorations(false)
.run_with(move || {
let (mut app, init_task) = HcieIcedApp::new(load_path);
app.tablet_state = tablet_state;
(app, init_task)
});
}