From 2959f7549cf871b0930cf302958586b232dd3103 Mon Sep 17 00:00:00 2001 From: "weizhen.xie" Date: Mon, 15 Sep 2025 11:42:53 +0800 Subject: [PATCH] =?UTF-8?q?FIX=EF=BC=9AFlushing=20volume=20button=20intera?= =?UTF-8?q?ction=20optimization?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Jira:STUDIO-14583 Change-Id: Ic1a600e92fb408b690febbd3f7a78924aed42e7a (cherry picked from commit 672b3b54119b46c8e19f635520d4f78710128815) --- src/slic3r/GUI/GLCanvas3D.cpp | 8 +++---- src/slic3r/GUI/Plater.cpp | 35 ++++++++++++++++++++---------- src/slic3r/GUI/Plater.hpp | 2 +- src/slic3r/GUI/WipeTowerDialog.cpp | 14 +++--------- src/slic3r/GUI/WipeTowerDialog.hpp | 3 +-- 5 files changed, 33 insertions(+), 29 deletions(-) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 81b3b35047..9fef91ca75 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -10282,14 +10282,14 @@ void GLCanvas3D::_set_warning_notification(EWarning warning, bool state) if (state) { auto callback = [](wxEvtHandler *) { auto plater = wxGetApp().plater(); - auto flushing_volume_btn = wxGetApp().sidebar().get_flushing_volume_btn(); const wxEventTypeTag EVT_SCHEDULE_BACKGROUND_PROCESS(wxNewEventType()); - open_flushing_dialog(flushing_volume_btn, plater, SimpleEvent(EVT_SCHEDULE_BACKGROUND_PROCESS, plater)); + open_flushing_dialog(plater, SimpleEvent(EVT_SCHEDULE_BACKGROUND_PROCESS, plater)); + plater->get_view3D_canvas3D()->reload_scene(true); return false; }; - notification_manager.push_slicing_customize_error_notification(NotificationType::BBLFlushingVolumeZero, NotificationLevel::WarningNotificationLevel, text, _u8L("Flushing Volume"), callback); + notification_manager.push_flushing_volume_error_notification(NotificationType::BBLFlushingVolumeZero, NotificationLevel::WarningNotificationLevel, text, _u8L("Flushing Volume"), callback); } else - notification_manager.close_slicing_customize_error_notification(NotificationType::BBLFlushingVolumeZero, NotificationLevel::WarningNotificationLevel); + notification_manager.close_flushing_volume_error_notification(NotificationType::BBLFlushingVolumeZero, NotificationLevel::WarningNotificationLevel); } else { if (state) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index ef8401a899..5d0491c41c 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -1857,16 +1857,11 @@ Sidebar::Sidebar(Plater *parent) p->m_flushing_volume_btn->SetStyle(ButtonStyle::Confirm, ButtonType::Compact); p->m_flushing_volume_btn->SetId(wxID_RESET); auto has_modify = is_flush_config_modified(); - if (has_modify) { - p->m_flushing_volume_btn->SetBorderColor(wxColour(255, 111, 0)); - p->m_flushing_volume_btn->SetTextColor(wxColour(255, 111, 0)); - } else { - p->m_flushing_volume_btn->SetBorderColor(wxColour(172, 172, 172)); - p->m_flushing_volume_btn->SetTextColor(wxColour(172, 172, 172)); - } + set_flushing_volume_warning(has_modify); p->m_flushing_volume_btn->Bind(wxEVT_BUTTON, ([parent, this](wxCommandEvent &e) { - open_flushing_dialog(p->m_flushing_volume_btn, parent, SimpleEvent(EVT_SCHEDULE_BACKGROUND_PROCESS, parent)); + open_flushing_dialog(parent, SimpleEvent(EVT_SCHEDULE_BACKGROUND_PROCESS, parent)); + p->plater->get_view3D_canvas3D()->reload_scene(true); })); bSizer39->Add(p->m_flushing_volume_btn, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(4)); @@ -3345,9 +3340,24 @@ wxButton* Sidebar::get_wiping_dialog_button() return NULL; } -Button* Sidebar::get_flushing_volume_btn() { - return p->m_flushing_volume_btn; - } +void Sidebar::set_flushing_volume_warning(const bool flushing_volume_modify) +{ + if (flushing_volume_modify){ + p->m_flushing_volume_btn->SetBorderColor(wxColour(255, 111, 0)); + p->m_flushing_volume_btn->SetTextColor(wxColour(255, 111, 0)); + } + else { + StateColor flush_fg_col(std::pair(wxColour(107, 107, 106), StateColor::Pressed), + std::pair(wxColour(107, 107, 106), StateColor::Hovered), + std::pair(wxColour(107, 107, 106), StateColor::Normal)); + + StateColor flush_bd_col(std::pair(wxColour(0, 174, 66), StateColor::Pressed), + std::pair(wxColour(0, 174, 66), StateColor::Hovered), + std::pair(wxColour(172, 172, 172), StateColor::Normal)); + p->m_flushing_volume_btn->SetBorderColor(flush_bd_col); + p->m_flushing_volume_btn->SetTextColor(flush_fg_col); + } +} void Sidebar::enable_buttons(bool enable) { @@ -11185,6 +11195,9 @@ void Plater::load_project(wxString const& filename2, wxGetApp().params_panel()->switch_to_object_if_has_object_configs(); + auto has_modify = is_flush_config_modified(); + sidebar().set_flushing_volume_warning(has_modify); + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << __LINE__ << " load project done"; m_loading_project = false; } diff --git a/src/slic3r/GUI/Plater.hpp b/src/slic3r/GUI/Plater.hpp index 6d23b98e99..b8787e85df 100644 --- a/src/slic3r/GUI/Plater.hpp +++ b/src/slic3r/GUI/Plater.hpp @@ -213,7 +213,7 @@ public: ConfigOptionsGroup* og_freq_chng_params(const bool is_fff); wxButton* get_wiping_dialog_button(); - Button* get_flushing_volume_btn(); + void set_flushing_volume_warning(const bool flushing_volume_modify); // BBS void enable_buttons(bool enable); diff --git a/src/slic3r/GUI/WipeTowerDialog.cpp b/src/slic3r/GUI/WipeTowerDialog.cpp index b61a3e9342..0ed1e3240b 100644 --- a/src/slic3r/GUI/WipeTowerDialog.cpp +++ b/src/slic3r/GUI/WipeTowerDialog.cpp @@ -235,7 +235,7 @@ bool is_flush_config_modified() return has_modify; } -void open_flushing_dialog(Button *flushing_volume_btn, wxEvtHandler *parent, const wxEvent &event) +void open_flushing_dialog(wxEvtHandler *parent, const wxEvent &event) { auto &project_config = wxGetApp().preset_bundle->project_config; const std::vector &init_matrix = (project_config.option("flush_volumes_matrix"))->values; @@ -258,17 +258,9 @@ void open_flushing_dialog(Button *flushing_volume_btn, wxEvtHandler *parent, con auto flush_multipliers = dlg.GetMultipliers(); (project_config.option("flush_volumes_matrix"))->values = std::vector(matrix.begin(), matrix.end()); (project_config.option("flush_multiplier"))->values = std::vector(flush_multipliers.begin(), flush_multipliers.end()); - auto has_modify = is_flush_config_modified(); - if (has_modify) { - flushing_volume_btn->SetBorderColor(wxColour(255, 111, 0)); - flushing_volume_btn->SetTextColor(wxColour(255, 111, 0)); - } else { - flushing_volume_btn->SetBorderColor(wxColour(172, 172, 172)); - flushing_volume_btn->SetTextColor(wxColour(172, 172, 172)); - } - + bool flushing_volume_modify = is_flush_config_modified(); + wxGetApp().sidebar().set_flushing_volume_warning(flushing_volume_modify); wxGetApp().preset_bundle->export_selections(*wxGetApp().app_config); - wxGetApp().plater()->update_project_dirty_from_presets(); wxPostEvent(parent, event); } diff --git a/src/slic3r/GUI/WipeTowerDialog.hpp b/src/slic3r/GUI/WipeTowerDialog.hpp index 7444b64996..2a3469e1c1 100644 --- a/src/slic3r/GUI/WipeTowerDialog.hpp +++ b/src/slic3r/GUI/WipeTowerDialog.hpp @@ -38,10 +38,9 @@ private: }; -class Button; bool is_flush_config_modified(); -void open_flushing_dialog(Button *flushing_volume_btn, wxEvtHandler *parent, const wxEvent &event); +void open_flushing_dialog(wxEvtHandler *parent, const wxEvent &event); class WipingDialog : public wxDialog {