Skip to main content

lutgen_studio/ui/
status.rs

1use egui::Context;
2
3use crate::App;
4
5impl App {
6    pub fn show_statusline(&self, ctx: &Context) {
7        // statusline with events and other info
8        egui::TopBottomPanel::bottom("statusline").show(ctx, |ui| {
9            if self.inline_layout {
10                ui.vertical_centered(|ui| {
11                    ui.add_space(5.);
12                    ui.label(&self.state.last_event);
13                    if let Some(tex) = &self.state.image_texture
14                        && let Some(path) = &self.state.current_image
15                    {
16                        ui.separator();
17                        let [w, h] = tex.size();
18                        let path = path.display().to_string();
19                        ui.label(format!("{path} ({w}x{h})"));
20                    }
21                    ui.add_space(5.);
22                });
23            } else {
24                ui.horizontal(|ui| {
25                    ui.label(&self.state.last_event);
26                    ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
27                        // let scale = self.scene_rect.scaling * 100.;
28                        // ui.label(format!("{scale:.0} %"));
29                        ui.separator();
30
31                        if let Some(tex) = &self.state.image_texture {
32                            let [w, h] = tex.size();
33                            ui.label(format!("{w}x{h}"));
34                            ui.separator();
35                        }
36                        if let Some(path) = &self.state.current_image {
37                            let path = path.display().to_string();
38                            ui.label(path);
39                            ui.separator();
40                        }
41                    });
42                });
43            }
44        });
45    }
46}