Add shortcuts tab.

This commit is contained in:
2025-08-22 09:08:44 +02:00
parent 69f85bad0d
commit 3171f2d936

View File

@@ -73,7 +73,7 @@ impl TabViewer {
let magnitude = self.magnitude_series.lock().unwrap(); let magnitude = self.magnitude_series.lock().unwrap();
Plot::new("magnitude") Plot::new("magnitude")
.legend(Legend::default().position(Corner::LeftTop)) .legend(Legend::default().position(Corner::LeftTop))
.y_axis_label("Magnitude at {} Hz[Ω]") .y_axis_label("Magnitude [Ω]")
.y_axis_min_width(80.0) .y_axis_min_width(80.0)
.show(ui, |plot_ui| { .show(ui, |plot_ui| {
plot_ui.line( plot_ui.line(
@@ -108,6 +108,14 @@ impl TabViewer {
fn multi_tab(&mut self, ui: &mut egui::Ui) { fn multi_tab(&mut self, ui: &mut egui::Ui) {
ui.heading("Bode plots!"); ui.heading("Bode plots!");
} }
fn shortcuts(&mut self, ui: &mut egui::Ui) {
ui.heading("Shortcuts");
ui.label("Space: Start/Stop measurement");
ui.label("C: Clear plots");
ui.label("S: Toggle settings");
ui.label("CMD-W: Close window");
}
} }
impl egui_dock::TabViewer for TabViewer { impl egui_dock::TabViewer for TabViewer {
@@ -121,6 +129,7 @@ impl egui_dock::TabViewer for TabViewer {
match tab.as_str() { match tab.as_str() {
"Single" => self.single_tab(ui), "Single" => self.single_tab(ui),
"Multi" => self.multi_tab(ui), "Multi" => self.multi_tab(ui),
"Shortcuts" => self.shortcuts(ui),
_ => { _ => {
let _ = ui.label("Unknown tab"); let _ = ui.label("Unknown tab");
} }
@@ -152,7 +161,7 @@ impl App {
// Step 3: Construct App // Step 3: Construct App
let app = App { let app = App {
tree: DockState::new(vec!["Single".to_string(), "Multi".to_string()]), tree: DockState::new(vec!["Single".to_string(), "Multi".to_string(), "Shortcuts".to_string()]),
tab_viewer, tab_viewer,
run_impedancemeter_tx, run_impedancemeter_tx,
magnitude, magnitude,
@@ -255,7 +264,7 @@ impl eframe::App for App {
ctx.send_viewport_cmd(egui::ViewportCommand::Close); ctx.send_viewport_cmd(egui::ViewportCommand::Close);
} }
// CMD- or control-W to close window // Space to start/stop measurement
if ctx.input(|i| i.key_pressed(Key::Space)) if ctx.input(|i| i.key_pressed(Key::Space))
{ {
let value = *self.on.lock().unwrap(); let value = *self.on.lock().unwrap();