diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index c8cfeb156d..c6a5ac3aba 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -1747,19 +1747,23 @@ Sidebar::Sidebar(Plater *parent) e.Skip(); }); + // hover state data for printer panel + auto printer_preset_hovered = std::make_shared>(); + p->btn_edit_printer = new ScalableButton(p->panel_printer_preset, wxID_ANY, "edit"); p->btn_edit_printer->SetToolTip(_L("Click to edit preset")); p->btn_edit_printer->Hide(); // hide for first launch - p->btn_edit_printer->Bind(wxEVT_BUTTON, [this, panel_color](wxCommandEvent){ + p->btn_edit_printer->Bind(wxEVT_BUTTON, [this, panel_color, printer_preset_hovered](wxCommandEvent){ p->editing_filament = -1; if (p->combo_printer->switch_to_tab()) p->editing_filament = 0; // ORCA: FIX crash on wxGTK, directly modifying UI (self->Hide() / parent->Layout()) inside a button event can crash because callbacks are not re-entrant, leaving widgets in an inconsistent state - wxGetApp().CallAfter([this, panel_color]() { + wxGetApp().CallAfter([this, panel_color, printer_preset_hovered]() { // ORCA clicking edit button not triggers wxEVT_KILL_FOCUS wxEVT_LEAVE_WINDOW make changes manually to prevent stucked colors when opening printer settings if (!p || !p->panel_printer_preset || !p->btn_edit_printer) return; p->panel_printer_preset->SetBorderColor(panel_color.bd_normal); + printer_preset_hovered->clear(); p->btn_edit_printer->Hide(); p->panel_printer_preset->Layout(); }); @@ -1797,7 +1801,6 @@ Sidebar::Sidebar(Plater *parent) }); */ // ORCA use Show/Hide to gain text area instead using blank icon. also manages hover effect for border - auto printer_preset_hovered = std::make_shared>(); for (wxWindow *w : std::initializer_list{p->panel_printer_preset, p->btn_edit_printer, p->image_printer, p->combo_printer}) { w->Bind(wxEVT_ENTER_WINDOW, [this, w, panel_color, printer_preset_hovered](wxMouseEvent &e) { printer_preset_hovered->insert(w);