| 1 | // No console window behind the app on Windows release builds. |
| 2 | #![cfg_attr(all(windows, not(debug_assertions)), windows_subsystem = "windows")] |
| 3 | |
| 4 | mod app; |
| 5 | mod chrome; |
| 6 | mod editor; |
| 7 | mod icons; |
| 8 | mod layout; |
| 9 | mod modals; |
| 10 | mod panes; |
| 11 | mod state; |
| 12 | mod theme; |
| 13 | mod widgets; |
| 14 | |
| 15 | use std::path::PathBuf; |
| 16 | use std::sync::Arc; |
| 17 | |
| 18 | use clap::Parser; |
| 19 | use eframe::egui; |
| 20 | |
| 21 | /// Keil µVision-style desktop IDE for the Intel 8051, built on bench51. |
| 22 | #[derive(Parser, Debug)] |
| 23 | #[command(version, about)] |
| 24 | struct Args { |
| 25 | /// Assembly sources (.asm, .a51) or Intel HEX files (.hex, .ihx) to open. |
| 26 | files: Vec<PathBuf>, |
| 27 | |
| 28 | /// Oscillator frequency in MHz, used to show elapsed time. |
| 29 | #[arg(long)] |
| 30 | clock: Option<f64>, |
| 31 | |
| 32 | /// Colour theme, overriding the saved choice. |
| 33 | #[arg(long, value_enum)] |
| 34 | theme: Option<state::ThemePref>, |
| 35 | } |
| 36 | |
| 37 | fn main() -> eframe::Result { |
| 38 | let args = Args::parse(); |
| 39 | let options = eframe::NativeOptions { |
| 40 | viewport: egui::ViewportBuilder::default() |
| 41 | .with_title("bench51") |
| 42 | .with_app_id("bench51-gui") |
| 43 | .with_inner_size([1440.0, 900.0]) |
| 44 | .with_min_inner_size([960.0, 600.0]) |
| 45 | .with_icon(Arc::new(icons::app_icon())), |
| 46 | ..Default::default() |
| 47 | }; |
| 48 | eframe::run_native( |
| 49 | "bench51-gui", |
| 50 | options, |
| 51 | Box::new(move |cc| { |
| 52 | Ok(Box::new(app::GuiApp::new( |
| 53 | cc, args.files, args.clock, args.theme, |
| 54 | ))) |
| 55 | }), |
| 56 | ) |
| 57 | } |