| 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 vim; |
| 14 | mod widgets; |
| 15 | |
| 16 | use std::path::PathBuf; |
| 17 | use std::sync::Arc; |
| 18 | |
| 19 | use clap::Parser; |
| 20 | use eframe::egui; |
| 21 | |
| 22 | /// Keil µVision-style desktop IDE for the Intel 8051, built on bench51. |
| 23 | #[derive(Parser, Debug)] |
| 24 | #[command(version, about)] |
| 25 | struct Args { |
| 26 | /// Assembly sources (.asm, .a51) or Intel HEX files (.hex, .ihx) to open. |
| 27 | files: Vec<PathBuf>, |
| 28 | |
| 29 | /// Oscillator frequency in MHz, used to show elapsed time. |
| 30 | #[arg(long)] |
| 31 | clock: Option<f64>, |
| 32 | |
| 33 | /// Colour theme, overriding the saved choice. |
| 34 | #[arg(long, value_enum)] |
| 35 | theme: Option<state::ThemePref>, |
| 36 | |
| 37 | /// Editor keybindings, overriding the saved choice. |
| 38 | #[arg(long, value_enum)] |
| 39 | keymap: Option<state::Keymap>, |
| 40 | } |
| 41 | |
| 42 | fn main() -> eframe::Result { |
| 43 | let args = Args::parse(); |
| 44 | let options = eframe::NativeOptions { |
| 45 | viewport: egui::ViewportBuilder::default() |
| 46 | .with_title("bench51") |
| 47 | .with_app_id("bench51-gui") |
| 48 | .with_inner_size([1440.0, 900.0]) |
| 49 | .with_min_inner_size([960.0, 600.0]) |
| 50 | .with_icon(Arc::new(icons::app_icon())), |
| 51 | ..Default::default() |
| 52 | }; |
| 53 | eframe::run_native( |
| 54 | "bench51-gui", |
| 55 | options, |
| 56 | Box::new(move |cc| { |
| 57 | Ok(Box::new(app::GuiApp::new( |
| 58 | cc, |
| 59 | args.files, |
| 60 | args.clock, |
| 61 | args.theme, |
| 62 | args.keymap, |
| 63 | ))) |
| 64 | }), |
| 65 | ) |
| 66 | } |