(&mut self, ctx: &egui::Context)
| 88 | } |
| 89 | |
| 90 | fn draw_main_window(&mut self, ctx: &egui::Context) { |
| 91 | egui::CentralPanel::default().show(ctx, |ui| { |
| 92 | ui.columns(2, |ui| { |
| 93 | ui[0].horizontal(|ui| { |
| 94 | let logo = Image::new(egui::include_image!("../../assets/icon.png")); |
| 95 | let logo_interaction = ui.add(logo.sense(Sense::click())); |
| 96 | |
| 97 | #[cfg(feature = "allow-dev-mode")] |
| 98 | if logo_interaction.double_clicked() { |
| 99 | self.cfg.dev_mode = !self.cfg.dev_mode; |
| 100 | } |
| 101 | |
| 102 | #[cfg(not(feature = "allow-dev-mode"))] |
| 103 | let _ = logo_interaction; |
| 104 | |
| 105 | let heading = RichText::new("devfiler").heading(); |
| 106 | Label::new(heading).ui(ui); |
| 107 | |
| 108 | self.tab_selector(ui); |
| 109 | }); |
| 110 | ui[1].with_layout(Layout::right_to_left(Align::Min), |ui| { |
| 111 | self.sample_selector(ui); |
| 112 | self.time_selector(ui) |
| 113 | }); |
| 114 | }); |
| 115 | |
| 116 | let (data_start, data_end) = self.samples_widget(ui); |
| 117 | |
| 118 | if let Some(active_tab) = self.tabs.iter_mut().find(|t| t.id() == self.active_tab) { |
| 119 | ui.push_id(active_tab.id(), |ui| { |
| 120 | let action = active_tab.update(ui, &self.cfg, self.kind, data_start, data_end); |
| 121 | |
| 122 | // Handle any tab action returned |
| 123 | if let Some(tabs::TabAction::SwitchTabWithTimeRange { tab, start, end }) = |
| 124 | action |
| 125 | { |
| 126 | self.active_tab = tab; |
| 127 | // Disable auto-scroll when switching with a specific time range |
| 128 | self.auto_scroll_time = None; |
| 129 | // Set the requested time range for the next frame |
| 130 | self.requested_time_range = Some((start, end)); |
| 131 | ctx.request_repaint(); |
| 132 | } |
| 133 | }); |
| 134 | } |
| 135 | }); |
| 136 | } |
| 137 | |
| 138 | fn draw_add_data_window(&mut self, ctx: &egui::Context) { |
| 139 | const DEFAULT_WIDTH: f32 = 800.0; |
no test coverage detected