NEW:disabled materials item will retain original color

jira:[STUDIO-10539]

Change-Id: Iabdbc6582dae5bcb2ec31775163949f0d451dcca
This commit is contained in:
tao wang 2025-03-05 18:26:11 +08:00 committed by lane.wei
parent 7115c1ca17
commit fdb57550aa
3 changed files with 10 additions and 5 deletions

View File

@ -99,16 +99,18 @@ void MaterialItem::reset_ams_info() {
void MaterialItem::disable()
{
if (IsEnabled()) {
this->Disable();
Refresh();
//this->Disable();
//Refresh();
m_enable = false;
}
}
void MaterialItem::enable()
{
if (!IsEnabled()) {
this->Enable();
Refresh();
/*this->Enable();
Refresh();*/
m_enable = true;
}
}

View File

@ -104,6 +104,7 @@ public:
bool m_selected {false};
bool m_warning{false};
bool m_match {true};
bool m_enable {true};
void msw_rescale();
void allow_paint_dropdown(bool flag);
@ -116,7 +117,6 @@ public:
void on_selected();
void on_warning();
void on_left_down(wxMouseEvent &evt);
void paintEvent(wxPaintEvent &evt);
virtual void render(wxDC &dc);
void match(bool mat);

View File

@ -3854,6 +3854,7 @@ void SelectMachineDialog::reset_and_sync_ams_list()
item->SetToolTip(m_ams_tooltip);
item->Bind(wxEVT_LEFT_UP, [this, item, materials, extruder](wxMouseEvent &e) {});
item->Bind(wxEVT_LEFT_DOWN, [this, item, materials, extruder](wxMouseEvent &e) {
if (!item->m_enable) {return;}
MaterialHash::iterator iter = m_materialList.begin();
while (iter != m_materialList.end()) {
int id = iter->first;
@ -4359,6 +4360,8 @@ void SelectMachineDialog::set_default_from_sdcard()
item->Bind(wxEVT_LEFT_UP, [this, item, materials](wxMouseEvent& e) {});
item->Bind(wxEVT_LEFT_DOWN, [this, obj_, item, materials, diameters_count, fo](wxMouseEvent& e) {
if (!item->m_enable) {return;}
MaterialHash::iterator iter = m_materialList.begin();
while (iter != m_materialList.end()) {
int id = iter->first;