diff --git a/src/Tools/tim_tool/src/gui/file_tab.rs b/src/Tools/tim_tool/src/gui/file_tab.rs index df361c1a..1e42318b 100644 --- a/src/Tools/tim_tool/src/gui/file_tab.rs +++ b/src/Tools/tim_tool/src/gui/file_tab.rs @@ -142,10 +142,9 @@ impl FileTab { pub fn on_update_palette_size(&self, gui_elements: GUIElementsRef, mut function: impl FnMut(&mut GUIElements, &MainWindow, u32, u32) -> Result<(), Error> + 'static) { let main_window_cloned = self.main_window.clone(); - let gui_cloned = gui_elements.clone(); self.main_window.borrow().on_file_tab_update_palette_size(move |width, height| { - if let Err(error) = function(&mut gui_cloned.borrow_mut(), &main_window_cloned.borrow(), width as u32, height as u32) { + if let Err(error) = function(&mut gui_elements.borrow_mut(), &main_window_cloned.borrow(), width as u32, height as u32) { display_error("Loadind file failed", &error.to_string()); } }); @@ -153,10 +152,9 @@ impl FileTab { pub fn on_add_image(&self, gui_elements: GUIElementsRef, mut function: impl FnMut(&mut GUIElements, &MainWindow) -> Result<(), Error> + 'static) { let main_window_cloned = self.main_window.clone(); - let gui_cloned = gui_elements.clone(); self.main_window.borrow().on_file_tab_add_convert_image(move || { - if let Err(error) = function(&mut gui_cloned.borrow_mut(), &main_window_cloned.borrow()) { + if let Err(error) = function(&mut gui_elements.borrow_mut(), &main_window_cloned.borrow()) { display_error("Adding file failed", &error.to_string()); } }); diff --git a/src/Tools/tim_tool/src/gui/main_tab.rs b/src/Tools/tim_tool/src/gui/main_tab.rs index 4bb58145..48efeb74 100644 --- a/src/Tools/tim_tool/src/gui/main_tab.rs +++ b/src/Tools/tim_tool/src/gui/main_tab.rs @@ -140,17 +140,17 @@ impl MainTab { pub fn on_move_vram_image(&self, gui_elements: GUIElementsRef, mut function: impl FnMut(&mut MainTab, &MainWindow, i32, i32, i32) + 'static) { let main_window_cloned = self.main_window.clone(); - let gui_cloned = gui_elements.clone(); + self.main_window.borrow().on_move_vram_image(move |idx, dx, dy| { - function(&mut gui_cloned.borrow_mut().main_tab, &main_window_cloned.borrow(), idx, dx, dy); + function(&mut gui_elements.borrow_mut().main_tab, &main_window_cloned.borrow(), idx, dx, dy); }); } pub fn on_remove_file(&self, gui_elements: GUIElementsRef, mut function: impl FnMut(&mut MainTab, &MainWindow, i32) + 'static) { let main_window_cloned = self.main_window.clone(); - let gui_cloned = gui_elements.clone(); + self.main_window.borrow().on_main_tab_remove_file_clicked(move |idx| { - function(&mut gui_cloned.borrow_mut().main_tab, &main_window_cloned.borrow(), idx); + function(&mut gui_elements.borrow_mut().main_tab, &main_window_cloned.borrow(), idx); }); } } \ No newline at end of file