diff --git a/docs/getting_started.md b/docs/getting_started.md index 71deca7..04467a8 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -1,5 +1,3 @@ -# Getting Started - Welcome to mslicer! Currently, mslicer can only output `.goo` files, which is a format spsific to [ELEGOO](https://www.elegoo.com) resin printers. In the future I plan to add support for other formats, but in the meantime you can use [UVTools](https://github.com/sn4k3/UVtools) to convert between formats. diff --git a/docs/readme.md b/docs/readme.md new file mode 100644 index 0000000..707177e --- /dev/null +++ b/docs/readme.md @@ -0,0 +1,5 @@ +# mslicer Documentation + +This pages can also be viewed directly in mslcier on the `About` panel. + +- [Getting Started](getting_started.md) diff --git a/mslicer/src/ui/state.rs b/mslicer/src/ui/state.rs index 61059ad..444443f 100644 --- a/mslicer/src/ui/state.rs +++ b/mslicer/src/ui/state.rs @@ -13,6 +13,9 @@ pub struct UiState { pub working_filename: String, pub send_print_completion: bool, pub remote_print_connecting: RemotePrintConnectStatus, + + // documentation + pub docs_page: DocsPage, } #[derive(Default, PartialEq, Eq)] @@ -22,3 +25,10 @@ pub enum RemotePrintConnectStatus { Connecting, Scanning, } + +#[derive(Default, PartialEq)] +pub enum DocsPage { + #[default] + GettingStarted, + AnotherPage, +} diff --git a/mslicer/src/windows/about.rs b/mslicer/src/windows/about.rs index 14948ad..d8acd1e 100644 --- a/mslicer/src/windows/about.rs +++ b/mslicer/src/windows/about.rs @@ -1,9 +1,13 @@ use egui::{Context, Ui}; -use crate::{app::App, ui::markdown::CompiledMarkdown}; +use crate::{ + app::App, + ui::{markdown::CompiledMarkdown, state::DocsPage}, +}; const DESCRIPTION: &str = "A work in progress FOSS slicer for resin printers, created by Connor Slade. Source code is available on Github at "; const GITHUB_LINK: &str = "https://github.com/connorslade/mslicer"; +const DOCS_LINK: &str = "https://github.com/connorslade/mslicer/tree/main/docs"; pub fn ui(app: &mut App, ui: &mut Ui, _ctx: &Context) { ui.monospace(concat!("mslicer v", env!("CARGO_PKG_VERSION"))); @@ -17,13 +21,26 @@ pub fn ui(app: &mut App, ui: &mut Ui, _ctx: &Context) { ui.add_space(16.0); - CompiledMarkdown::compile(include_str!("../../../docs/getting_started.md")).render(ui); + ui.heading("Documentation"); + ui.horizontal_wrapped(|ui| { + ui.spacing_mut().item_spacing.x = 0.0; + ui.label("This documentation is also available online "); + ui.hyperlink_to("here", DOCS_LINK).on_hover_text(DOCS_LINK); + ui.label("."); + }); - ui.add_space(16.0); - ui.heading("Stats"); - ui.label(format!( - "Frame Time: {:.2}ms", - app.fps.frame_time() * 1000.0 - )); - ui.label(format!("FPS: {:.2}", 1.0 / app.fps.frame_time())); + ui.horizontal(|ui| { + ui.selectable_value( + &mut app.state.docs_page, + DocsPage::GettingStarted, + "Getting Started", + ); + ui.selectable_value( + &mut app.state.docs_page, + DocsPage::AnotherPage, + "Another Page", + ); + }); + + CompiledMarkdown::compile(include_str!("../../../docs/getting_started.md")).render(ui); } diff --git a/mslicer/src/windows/workspace.rs b/mslicer/src/windows/workspace.rs index 3301109..1b49922 100644 --- a/mslicer/src/windows/workspace.rs +++ b/mslicer/src/windows/workspace.rs @@ -90,4 +90,12 @@ pub fn ui(app: &mut App, ui: &mut Ui, _ctx: &Context) { ui.end_row(); }); }); + + ui.collapsing("Stats", |ui| { + ui.label(format!( + "Frame Time: {:.2}ms", + app.fps.frame_time() * 1000.0 + )); + ui.label(format!("FPS: {:.2}", 1.0 / app.fps.frame_time())); + }); }