Skip to content

Commit

Permalink
Use egui_tiles for plot view
Browse files Browse the repository at this point in the history
  • Loading branch information
KoffeinFlummi committed Mar 17, 2024
1 parent dff6932 commit b9b02b9
Show file tree
Hide file tree
Showing 9 changed files with 522 additions and 445 deletions.
23 changes: 23 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ eframe = { version = "0.26", default-features = false, features = ["glow", "wayl
egui_plot = "0.26"
egui_extras = { version = "0.26", features = ["image"] }
image = { version = "0.24", default-features = false, features = ["jpeg", "png"] }
egui_tiles = "0.7.2"
egui-gizmo = "0.16"
walkers = { git = "https://github.com/podusowski/walkers" }
# serialization & communication
Expand All @@ -41,7 +42,6 @@ reqwest = { version = "0.11", default-features = false, features = ["rustls-tls"
# Used for profiling
puffin = { version = "0.19", optional = true }
puffin_egui = { version = "0.26", optional = true }
#egui_tiles = "0.6.0"

# X86 dependencies
[target.'cfg(target_arch = "x86_64")'.dependencies]
Expand Down
35 changes: 18 additions & 17 deletions src/gui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ use mithril::telemetry::*;
mod panels;
mod fc_settings;
mod map;
mod maxi_grid;
mod misc;
mod plot;
mod simulation_settings;
mod tabs;
pub mod tabs;
mod theme;
mod top_bar;
pub mod windows; // TODO: make this private (it is public because it has ARCHIVE)
Expand Down Expand Up @@ -151,19 +149,21 @@ impl Sam {
self.open_data_source(Box::new(log));
}

let enabled = !self.archive_window.open;

// Top menu bar
// TODO: avoid passing in self here
MenuBarPanel::show(ctx, self, !self.archive_window.open);
MenuBarPanel::show(ctx, self, enabled);

let data_source = self.data_sources.last_mut().unwrap();

// If our current data source is a simulation, show a config panel to the left
if let Some(sim) = data_source.as_any_mut().downcast_mut::<SimulationDataSource>() {
SimulationPanel::show(ctx, sim, !self.archive_window.open);
SimulationPanel::show(ctx, sim, enabled);
}

// Header containing text indicators and flight mode buttons
HeaderPanel::show(ctx, data_source.deref_mut(), !self.archive_window.open);
HeaderPanel::show(ctx, data_source.deref_mut(), enabled);

// Bottom status bar
egui::TopBottomPanel::bottom("bottombar").min_height(30.0).show(ctx, |ui| {
Expand All @@ -187,19 +187,20 @@ impl Sam {
});

// Everything else. This has to be called after all the other panels are created.
egui::CentralPanel::default().show(ctx, |ui| {
ui.set_enabled(!self.archive_window.open);
match self.tab {
GuiTab::Launch => {}
GuiTab::Plot => self.plot_tab.main_ui(ui, data_source.deref_mut()),
GuiTab::Configure => {
let changed = self.configure_tab.main_ui(ui, data_source.deref_mut(), &mut self.settings);
if changed {
data_source.apply_settings(&self.settings);
}
match self.tab {
GuiTab::Launch => {
egui::CentralPanel::default().show(ctx, |ui| {
ui.set_enabled(enabled)
}).inner
}
GuiTab::Plot => self.plot_tab.main_ui(ctx, data_source.deref_mut(), &mut self.settings, enabled),
GuiTab::Configure => {
let changed = self.configure_tab.main_ui(ctx, data_source.deref_mut(), &mut self.settings, enabled);
if changed {
data_source.apply_settings(&self.settings);
}
}
});
}
}
}

Expand Down
101 changes: 0 additions & 101 deletions src/gui/maxi_grid.rs

This file was deleted.

15 changes: 0 additions & 15 deletions src/gui/misc.rs

This file was deleted.

4 changes: 2 additions & 2 deletions src/gui/tabs.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
mod configure;
mod plot;
pub mod configure;
pub mod plot;

pub use configure::*;
pub use plot::*;
Expand Down
Loading

0 comments on commit b9b02b9

Please sign in to comment.