gled-ui 2.32.1

gled's egui interface, shared by the desktop app and the browser
Documentation
use super::{App, controller_feedback};
use crate::ui::scene_instance::SceneInstanceUi;
use egui::{CentralPanel, Color32, Margin, RichText};

impl App {
    #[cfg_attr(feature = "profiling", profiling::function)]
    pub(crate) fn config(&mut self, ui: &mut egui::Ui) {
        let Some(project) = self.project.as_mut() else {
            return;
        };

        egui::Panel::top("project config")
            .resizable(false)
            .frame(egui::Frame::NONE.inner_margin(Margin::from(4.0)))
            .show(ui, |ui| {
                if project.patch.topology.fixtures.is_empty() {
                    ui.painter().rect_filled(
                        {
                            let rect = ui.cursor();
                            rect.with_max_y(rect.min.y + 20.0)
                        },
                        0.0,
                        Color32::ORANGE,
                    );
                    ui.add_sized(
                        [ui.available_width(), 20.0],
                        egui::Label::new(
                            RichText::new("☢ No fixtures patched = no output! ☢")
                                .color(Color32::DARK_RED),
                        ),
                    );
                }
            });

        CentralPanel::default()
            .frame(egui::Frame::NONE.inner_margin(Margin::from(4.0)))
            .show(ui, |ui| {
                // The patch and the scenes are borrowed apart, so the patch is
                // not copied every frame.
                let patch = &project.patch;
                match project
                    .scenes_instances_grid
                    .get_mut(&self.selected_scene_instance)
                {
                    Some(scene_instance) => {
                        controller_feedback::set_shown_effect(
                            ui.ctx(),
                            self.selected_scene_instance,
                            self.selected_scene_effect_editor.selected_effect,
                        );
                        scene_instance.config_ui(
                            ui,
                            &mut self.selected_scene_effect_editor,
                            &self.thumbnail_textures,
                            patch,
                            &self.timing,
                            &mut self.model.replica.assets,
                            &self.model.sound,
                        )
                    }
                    None => {
                        ui.label("There's no Effect to configure.");
                    }
                };
            });
    }
}