FIX: [STUDIO-3341] The color of automatic flushing calculation issue

The color of automatic flushing calculation has an extra white outline

Change-Id: I056db06245a9a0ac8538fac173ab1425ef1d7b28
This commit is contained in:
maosheng.wei 2023-06-27 15:29:44 +08:00 committed by Lane.Wei
parent a29507dfa3
commit 8c97f1b2b4
2 changed files with 18 additions and 3 deletions

View file

@ -154,6 +154,8 @@ void WipingDialog::on_dpi_changed(const wxRect &suggested_rect)
button_item.second->SetCornerRadius(FromDIP(12)); button_item.second->SetCornerRadius(FromDIP(12));
} }
} }
m_panel_wiping->msw_rescale();
this->Refresh();
}; };
// Parent dialog for purging volume adjustments - it fathers WipingPanel widget (that contains all controls) and a button to toggle simple/advanced mode: // Parent dialog for purging volume adjustments - it fathers WipingPanel widget (that contains all controls) and a button to toggle simple/advanced mode:
@ -224,8 +226,9 @@ void WipingPanel::create_panels(wxWindow* parent, const int num) {
panel->SetSizer(sizer); panel->SetSizer(sizer);
wxButton* icon = new wxButton(panel, wxID_ANY, {}, wxDefaultPosition, ICON_SIZE, wxBORDER_NONE | wxBU_AUTODRAW); wxButton* icon = new wxButton(panel, wxID_ANY, {}, wxDefaultPosition, ICON_SIZE, wxBORDER_NONE | wxBU_AUTODRAW);
icon->SetBitmap(*get_extruder_color_icon(m_colours[i].GetAsString(wxC2S_HTML_SYNTAX).ToStdString(), std::to_string(i + 1), 16, 16)); icon->SetBitmap(*get_extruder_color_icon(m_colours[i].GetAsString(wxC2S_HTML_SYNTAX).ToStdString(), std::to_string(i + 1), FromDIP(16), FromDIP(16)));
icon->SetCanFocus(false); icon->SetCanFocus(false);
icon_list2.push_back(icon);
sizer->AddSpacer(ROW_BEG_PADDING); sizer->AddSpacer(ROW_BEG_PADDING);
sizer->Add(icon, 0, wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM, ROW_VERT_PADDING); sizer->Add(icon, 0, wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM, ROW_VERT_PADDING);
@ -324,9 +327,10 @@ WipingPanel::WipingPanel(wxWindow* parent, const std::vector<float>& matrix, con
header_line_sizer->AddSpacer(HEADER_BEG_PADDING); header_line_sizer->AddSpacer(HEADER_BEG_PADDING);
for (unsigned int i = 0; i < m_number_of_extruders; ++i) { for (unsigned int i = 0; i < m_number_of_extruders; ++i) {
wxButton* icon = new wxButton(header_line_panel, wxID_ANY, {}, wxDefaultPosition, ICON_SIZE, wxBORDER_NONE | wxBU_AUTODRAW); wxButton* icon = new wxButton(header_line_panel, wxID_ANY, {}, wxDefaultPosition, ICON_SIZE, wxBORDER_NONE | wxBU_AUTODRAW);
icon->SetBitmap(*get_extruder_color_icon(m_colours[i].GetAsString(wxC2S_HTML_SYNTAX).ToStdString(), std::to_string(i + 1), 16, 16)); icon->SetBitmap(*get_extruder_color_icon(m_colours[i].GetAsString(wxC2S_HTML_SYNTAX).ToStdString(), std::to_string(i + 1), FromDIP(16), FromDIP(16)));
icon->SetCanFocus(false); icon->SetCanFocus(false);
icon_list1.push_back(icon);
header_line_sizer->AddSpacer(ICON_GAP); header_line_sizer->AddSpacer(ICON_GAP);
header_line_sizer->Add(icon, 0, wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM, HEADER_VERT_PADDING); header_line_sizer->Add(icon, 0, wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM, HEADER_VERT_PADDING);
} }
@ -569,6 +573,14 @@ void WipingPanel::calc_flushing_volumes()
this->update_warning_texts(); this->update_warning_texts();
} }
void WipingPanel::msw_rescale()
{
for (unsigned int i = 0; i < icon_list1.size(); ++i) {
auto bitmap = *get_extruder_color_icon(m_colours[i].GetAsString(wxC2S_HTML_SYNTAX).ToStdString(), std::to_string(i + 1), FromDIP(16), FromDIP(16));
icon_list1[i]->SetBitmap(bitmap);
icon_list2[i]->SetBitmap(bitmap);
}
}
// Reads values from the (advanced) wiping matrix: // Reads values from the (advanced) wiping matrix:
std::vector<float> WipingPanel::read_matrix_values() { std::vector<float> WipingPanel::read_matrix_values() {

View file

@ -21,6 +21,7 @@ public:
void toggle_advanced(bool user_action = false); void toggle_advanced(bool user_action = false);
void create_panels(wxWindow* parent, const int num); void create_panels(wxWindow* parent, const int num);
void calc_flushing_volumes(); void calc_flushing_volumes();
void msw_rescale();
float get_flush_multiplier() float get_flush_multiplier()
{ {
@ -50,6 +51,8 @@ private:
wxBoxSizer* m_sizer_advanced = nullptr; wxBoxSizer* m_sizer_advanced = nullptr;
wxGridSizer* m_gridsizer_advanced = nullptr; wxGridSizer* m_gridsizer_advanced = nullptr;
wxButton* m_widget_button = nullptr; wxButton* m_widget_button = nullptr;
std::vector<wxButton *> icon_list1;
std::vector<wxButton *> icon_list2;
const int m_min_flush_volume; const int m_min_flush_volume;
const int m_max_flush_volume; const int m_max_flush_volume;