pub fn show(&mut self, query: &mut Query<'_, '_, &mut Concrete>, poly_name: &mut ResMut<'_, PolyName>, egui_ctx: &Res<'_, EguiContext>, open: &mut bool) {
        egui::Window::new("Memory")
            .open(open)
            .scroll(true)
            .default_width(260.0)
            .show(egui_ctx.ctx(), |ui| {
            egui::containers::ScrollArea::auto_sized().show(ui, |ui| {
                
                ui.horizontal(|ui| {
                    if ui.button("Clear memory").clicked() {
                        self.0.clear();
                    }
        
                    if ui.button("Add slot").clicked() {
                        self.0.push(None);
                    }
                });
    
                ui.separator();
    
                for (idx, slot) in self.0.iter_mut().enumerate() {
                    match slot {
                        // Shows an empty slot.
                        None => {
                            ui.horizontal(|ui| {
                                ui.label(format!("{}:", idx));
                                ui.label("Empty");

                                if ui.button("Save").clicked() {
                                    if let Some(p) = query.iter_mut().next() {
                                        *slot = Some((p.clone(), Some(poly_name.0.clone())));
                                    }
                                }
                             });
                        }

                        // Shows a slot with a polytope on it.
                        Some((poly, label)) => {
                            let mut clear = false;

                            ui.horizontal(|ui| {
                                ui.label(format!("{}:", idx));
                                let name = match label {
                                    None => {
                                        slot_label(idx)
                                    }
                                    
                                    Some(name) => {
                                        name.to_string()
                                    }
                                };

                                ui.label(&name);

                                // Clones a polytope from memory.
                                if ui.button("Load").clicked() {
                                    *query.iter_mut().next().unwrap() = poly.clone();
                                    poly_name.0 = name.clone();
                                }

                                // Swaps the current polytope with the one on memory.
                                if ui.button("Swap").clicked() {
                                    std::mem::swap(query.iter_mut().next().unwrap().as_mut(), poly);
                                    *label = Some(poly_name.0.clone());
                                    poly_name.0 = name;
                                }

                                // Clones a polytope into memory.
                                if ui.button("Save").clicked() {
                                    *poly = query.iter_mut().next().unwrap().clone();
                                    *label = Some(poly_name.0.clone());
                                }

                                // Clears a polytope from memory.
                                if ui.button("Clear").clicked() {
                                    clear = true;
                                }
                            });

                            if clear {
                                *slot = None;
                            }
                        }
                    }
                }
            });
        });
    }
/// Shows the memory menu in a specified Ui.
Shows the memory menu in a specified Ui.
Shows the memory menu in a specified Ui .
pub fn show(&mut self, query: &mut Query<'_, '_, &mut Concrete>, poly_name: &mut ResMut<'_, PolyName>, egui_ctx: &Res<'_, EguiContext>, open: &mut bool) {
        egui::Window::new("Memory")
            .open(open)
            .scroll(true)
            .default_width(260.0)
            .show(egui_ctx.ctx(), |ui| {
            egui::containers::ScrollArea::auto_sized().show(ui, |ui| {
                ui.horizontal(|ui| {
                    if ui.button("Clear memory").clicked() {
                        self.0.clear();
                    }
                    if ui.button("Add slot").clicked() {
                        self.0.push(None);
                    }
                });
                ui.separator();
                for (idx, slot) in self.0.iter_mut().enumerate() {
                    match slot {
                        // Shows an empty slot.
                        None => {
                            ui.horizontal(|ui| {
                                ui.label(format!("{}:", idx));
                                ui.label("Empty");
                                if ui.button("Save").clicked() {
                                    if let Some(p) = query.iter_mut().next() {
                                        *slot = Some((p.clone(), Some(poly_name.0.clone())));
                                    }
                                }
                             });
                        }
                        // Shows a slot with a polytope on it.
                        Some((poly, label)) => {
                            let mut clear = false;
                            ui.horizontal(|ui| {
                                ui.label(format!("{}:", idx));
                                let name = match label {
                                    None => {
                                        slot_label(idx)
                                    }
                                    Some(name) => {
                                        name.to_string()
                                    }
                                };
                                ui.label(&name);
                                // Clones a polytope from memory.
                                if ui.button("Load").clicked() {
                                    *query.iter_mut().next().unwrap() = poly.clone();
                                    poly_name.0 = name.clone();
                                }
                                // Swaps the current polytope with the one on memory.
                                if ui.button("Swap").clicked() {
                                    std::mem::swap(query.iter_mut().next().unwrap().as_mut(), poly);
                                    *label = Some(poly_name.0.clone());
                                    poly_name.0 = name;
                                }
                                // Clones a polytope into memory.
                                if ui.button("Save").clicked() {
                                    *poly = query.iter_mut().next().unwrap().clone();
                                    *label = Some(poly_name.0.clone());
                                }
                                // Clears a polytope from memory.
                                if ui.button("Clear").clicked() {
                                    clear = true;
                                }
                            });
                            if clear {
                                *slot = None;
                            }
                        }
                    }
                }
            });
        });
    }
pub fn show ( & mut self , query : & mut Query < ' _ , ' _ , & mut Concrete > , poly_name : & mut ResMut < ' _ , PolyName > , egui_ctx : & Res < ' _ , EguiContext > , open : & mut bool ) { egui :: Window :: new ( " " ) . open ( open ) . scroll ( true ) . default_width ( 260.0 ) . show ( egui_ctx . ctx ( ) , | ui | { egui :: containers :: ScrollArea :: auto_sized ( ) . show ( ui , | ui | { ui . horizontal ( | ui | { if ui . button ( " " ) . clicked ( ) { self . 0 . clear ( ) ; } if ui . button ( " " ) . clicked ( ) { self . 0 . push ( None ) ; } } ) ; ui . separator ( ) ; for ( idx , slot ) in self . 0 . iter_mut ( ) . enumerate ( ) { match slot { // Shows an empty slot. None => { ui . horizontal ( | ui | { ui . label ( format ! ( " " idx ) ) ; ui . label ( " " ) ; if ui . button ( " " ) . clicked ( ) { if let Some ( p ) = query . iter_mut ( ) . next ( ) { * slot = Some ( ( p . clone ( ) , Some ( poly_name . 0 . clone ( ) ) ) ) ; } } } ) ; } // Shows a slot with a polytope on it. Some ( ( poly , label ) ) => { let mut clear = false ; ui . horizontal ( | ui | { ui . label ( format ! ( " " idx ) ) ; let name = match label { None => { slot_label ( idx ) } Some ( name ) => { name . to_string ( ) } } ; ui . label ( & name ) ; // Clones a polytope from memory. if ui . button ( " " ) . clicked ( ) { * query . iter_mut ( ) . next ( ) . unwrap ( ) = poly . clone ( ) ; poly_name . 0 = name . clone ( ) ; } // Swaps the current polytope with the one on memory. if ui . button ( " " ) . clicked ( ) { std :: mem :: swap ( query . iter_mut ( ) . next ( ) . unwrap ( ) . as_mut ( ) , poly ) ; * label = Some ( poly_name . 0 . clone ( ) ) ; poly_name . 0 = name ; } // Clones a polytope into memory. if ui . button ( " " ) . clicked ( ) { * poly = query . iter_mut ( ) . next ( ) . unwrap ( ) . clone ( ) ; * label = Some ( poly_name . 0 . clone ( ) ) ; } // Clears a polytope from memory. if ui . button ( " " ) . clicked ( ) { clear = true ; } } ) ; if clear { * slot = None ; } } } } } ) ; } ) ; }
Shows the memory menu in a specified Ui.
Shows the memory menu in a specified Ui .
&mut self
query
&mut Query<'_, '_, &mut Concrete>
poly_name
&mut ResMut<'_, PolyName>
egui_ctx
&Res<'_, EguiContext>
open
&mut bool