FIX: do not change others if mode not changed

JIRA: [STUDIO-12375]
Change-Id: I2ba64346706f22a6f143242c9236605de033754b
(cherry picked from commit 7b031c1536440dad942d536c831e316c5c57e677)
This commit is contained in:
xin.zhang
2025-06-09 10:54:08 +08:00
committed by Noisyfox
parent 0fd471fdcc
commit 6f7704470f

View File

@@ -938,20 +938,31 @@ void FanControlPopupNew::paintEvent(wxPaintEvent& evt)
void FanControlPopupNew::on_mode_changed(const wxMouseEvent &event) void FanControlPopupNew::on_mode_changed(const wxMouseEvent &event)
{ {
size_t btn_list_size = m_mode_switch_btn_list.size(); /* go check*/
for (size_t i = 0; i < btn_list_size; ++i) { if (m_obj && m_obj->is_in_printing())
if (m_mode_switch_btn_list[i]->GetId() == event.GetId()) { {
if (m_mode_switch_btn_list[i]->isSelected()) { return;} SendModeSwitchButton* btn = dynamic_cast<SendModeSwitchButton*> (event.GetEventObject());
if (btn && !btn->isSelected())
if (m_obj && m_obj->is_in_printing()) { {
MessageDialog msg_wingow(nullptr, _L("The selected material only supports the current fan mode, and it can't be changed during printing."), "", wxICON_WARNING | wxOK); MessageDialog msg_wingow(nullptr, _L("The selected material only supports the current fan mode, and it can't be changed during printing."), "", wxICON_WARNING | wxOK);
msg_wingow.ShowModal(); msg_wingow.ShowModal();
return; return;
} }
}
/* update buttons*/
for (size_t i = 0; i < m_mode_switch_btn_list.size(); ++i)
{
if (m_mode_switch_btn_list[i]->GetId() == event.GetId())
{
if (!m_mode_switch_btn_list[i]->isSelected())
{
m_mode_switch_btn_list[i]->setSelected(true); m_mode_switch_btn_list[i]->setSelected(true);
command_control_air_duct(i); command_control_air_duct(i);
} else { }
}
else
{
m_mode_switch_btn_list[i]->setSelected(false); m_mode_switch_btn_list[i]->setSelected(false);
} }
} }