ENH:transparent colored filaments are supported in the color picker

Change-Id: I1800d66ba4002ccef5c7edbd3c72d4410d1cd7a3
This commit is contained in:
tao wang 2023-05-26 17:15:28 +08:00 committed by Lane.Wei
parent da42ed6f58
commit 7d17cb20c8
3 changed files with 31 additions and 3 deletions

View file

@ -0,0 +1,4 @@
<svg width="60" height="25" viewBox="0 0 60 25" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M0 8C0 3.58172 3.58172 0 8 0H52C56.4183 0 60 3.58172 60 8V17C60 21.4183 56.4183 25 52 25H8C3.58172 25 0 21.4183 0 17V8Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M0.581517 5C0.206507 5.92643 0 6.9391 0 8V10H5V15H0V17C0 18.0609 0.206507 19.0736 0.581517 20H5V24.4185C5.92643 24.7935 6.9391 25 8 25H10V20H15V25H20V20H25V25H30V20H35V25H40V20H45V25H50V20H55V24.4185C57.0054 23.6067 58.6067 22.0054 59.4185 20H55V15H60V10H55V5H59.4185C58.6067 2.9946 57.0054 1.39328 55 0.581517V5H50V0H45V5H40V0H35V5H30V0H25V5H20V0H15V5H10V0H8C6.9391 0 5.92643 0.206507 5 0.581517V5H0.581517ZM10 10V5H5V10H10ZM15 10H10V15H5V20H10V15H15V20H20V15H25V20H30V15H35V20H40V15H45V20H50V15H55V10H50V5H45V10H40V5H35V10H30V5H25V10H20V5H15V10ZM15 10V15H20V10H15ZM25 10H30V15H25V10ZM35 10H40V15H35V10ZM45 10H50V15H45V10Z" fill="#D9D9D9"/>
</svg>

After

Width:  |  Height:  |  Size: 939 B

View file

@ -523,7 +523,7 @@ void AMSMaterialsSetting::on_select_ok(wxCommandEvent &event)
nozzle_temp_max.ToLong(&nozzle_temp_max_int);
wxColour color = m_clr_picker->m_colour;
char col_buf[10];
sprintf(col_buf, "%02X%02X%02XFF", (int)color.Red(), (int)color.Green(), (int)color.Blue());
sprintf(col_buf, "%02X%02X%02X%02X", (int)color.Red(), (int)color.Green(), (int)color.Blue(), (int)color.Alpha());
ams_filament_id = "";
ams_setting_id = "";
@ -1165,6 +1165,14 @@ ColorPickerPopup::ColorPickerPopup(wxWindow* parent)
SetCursor(wxCURSOR_ARROW);
});
m_ts_bitmap_custom = ScalableBitmap(this, "ts_custom_color_picker", 25);
m_ts_stbitmap_custom = new wxStaticBitmap(m_custom_cp, wxID_ANY, m_ts_bitmap_custom.bmp());
auto sizer_custom = new wxBoxSizer(wxVERTICAL);
m_custom_cp->SetSizer(sizer_custom);
sizer_custom->Add(m_ts_stbitmap_custom, 0, wxEXPAND, 0);
m_custom_cp->Layout();
m_clrData = new wxColourData();
m_clrData->SetChooseFull(true);
m_clrData->SetChooseAlpha(false);
@ -1207,7 +1215,15 @@ void ColorPickerPopup::on_custom_clr_picker(wxMouseEvent& event)
m_clrData->GetColour().Blue(),
254
);
if (picker_color.Alpha() == 0) {
m_ts_stbitmap_custom->Show();
}
else {
m_ts_stbitmap_custom->Hide();
m_custom_cp->SetBackgroundColor(picker_color);
}
set_def_colour(picker_color);
wxCommandEvent evt(EVT_SELECTED_COLOR);
unsigned long g_col = ((picker_color.Red() & 0xff) << 24) + ((picker_color.Green() & 0xff) << 16) + ((picker_color.Blue() & 0xff) << 8) + (picker_color.Alpha() & 0xff);
@ -1272,7 +1288,13 @@ void ColorPickerPopup::set_def_colour(wxColour col)
}
}
if (m_def_col.Alpha() == 0) {
m_ts_stbitmap_custom->Show();
}
else {
m_ts_stbitmap_custom->Hide();
m_custom_cp->SetBackgroundColor(m_def_col);
}
Dismiss();
}

View file

@ -58,6 +58,8 @@ public:
class ColorPickerPopup : public PopupWindow
{
public:
ScalableBitmap m_ts_bitmap_custom;
wxStaticBitmap* m_ts_stbitmap_custom;
StaticBox* m_custom_cp;
wxColourData* m_clrData;
StaticBox* m_def_color_box;