mirror of
https://github.com/hubaldv/bioz-host-rs.git
synced 2025-12-05 21:01:18 +00:00
Add shortcuts tab.
This commit is contained in:
15
src/app.rs
15
src/app.rs
@@ -73,7 +73,7 @@ impl TabViewer {
|
||||
let magnitude = self.magnitude_series.lock().unwrap();
|
||||
Plot::new("magnitude")
|
||||
.legend(Legend::default().position(Corner::LeftTop))
|
||||
.y_axis_label("Magnitude at {} Hz[Ω]")
|
||||
.y_axis_label("Magnitude [Ω]")
|
||||
.y_axis_min_width(80.0)
|
||||
.show(ui, |plot_ui| {
|
||||
plot_ui.line(
|
||||
@@ -108,6 +108,14 @@ impl TabViewer {
|
||||
fn multi_tab(&mut self, ui: &mut egui::Ui) {
|
||||
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 {
|
||||
@@ -121,6 +129,7 @@ impl egui_dock::TabViewer for TabViewer {
|
||||
match tab.as_str() {
|
||||
"Single" => self.single_tab(ui),
|
||||
"Multi" => self.multi_tab(ui),
|
||||
"Shortcuts" => self.shortcuts(ui),
|
||||
_ => {
|
||||
let _ = ui.label("Unknown tab");
|
||||
}
|
||||
@@ -152,7 +161,7 @@ impl App {
|
||||
|
||||
// Step 3: Construct 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,
|
||||
run_impedancemeter_tx,
|
||||
magnitude,
|
||||
@@ -255,7 +264,7 @@ impl eframe::App for App {
|
||||
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))
|
||||
{
|
||||
let value = *self.on.lock().unwrap();
|
||||
|
||||
Reference in New Issue
Block a user