pub mod controller;
pub mod model;
pub mod view;
use controller::PlotController;
use eframe::egui;
use view::PlotEditorView;
pub struct PlotEditorApp {
controller: PlotController,
view: PlotEditorView,
}
impl PlotEditorApp {
pub fn new() -> Self {
Self {
controller: PlotController::new(),
view: PlotEditorView::new(),
}
}
pub fn controller_mut(&mut self) -> &mut PlotController {
&mut self.controller
}
}
impl Default for PlotEditorApp {
fn default() -> Self {
Self::new()
}
}
impl eframe::App for PlotEditorApp {
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
let actions = self.view.draw(ctx, &self.controller);
for action in actions {
let _ = self.controller.dispatch(action);
}
}
}
pub fn run_native() -> Result<(), eframe::Error> {
let native_options = eframe::NativeOptions::default();
eframe::run_native(
"KiThe Plot Redactor",
native_options,
Box::new(|cc| {
cc.egui_ctx.set_visuals(eframe::egui::Visuals::light());
Ok(Box::new(PlotEditorApp::new()))
}),
)
}