FIX:fixed gradient filament color display on MacOS
Change-Id: I57f3243f5013b8d26ace3fae2cc41e807494af6b
This commit is contained in:
parent
975aa70651
commit
ef6827a6f8
5 changed files with 24 additions and 12 deletions
|
@ -1,3 +1,3 @@
|
|||
<svg width="25" height="25" viewBox="0 0 25 25" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.5 0H0V12.5V25H12.5H25V12.5V0H12.5ZM12.5 0C19.4033 0 25 5.59644 25 12.5C25 19.4036 19.4033 25 12.5 25C5.59668 25 0 19.4036 0 12.5C0 5.59644 5.59668 0 12.5 0Z" fill="white"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.5 0H0V12.5V25H12.5H25V12.5V0H12.5ZM12.5 0C19.4033 0 25 5.59644 25 12.5C25 19.4036 19.4033 25 12.5 25C5.59668 25 0 19.4036 0 12.5C0 5.59644 5.59668 0 12.5 0Z" fill="#FFFFFF"/>
|
||||
</svg>
|
||||
|
|
Before Width: | Height: | Size: 329 B After Width: | Height: | Size: 331 B |
|
@ -728,6 +728,7 @@ bool AMSMaterialsSetting::Show(bool show)
|
|||
}
|
||||
Layout();
|
||||
Fit();
|
||||
wxGetApp().UpdateDarkUI(this);
|
||||
}
|
||||
return DPIDialog::Show(show);
|
||||
}
|
||||
|
@ -870,6 +871,11 @@ void AMSMaterialsSetting::post_select_event() {
|
|||
wxPostEvent(m_comboBox_filament, event);
|
||||
}
|
||||
|
||||
void AMSMaterialsSetting::msw_rescale()
|
||||
{
|
||||
m_clr_picker->msw_rescale();
|
||||
}
|
||||
|
||||
void AMSMaterialsSetting::on_select_filament(wxCommandEvent &evt)
|
||||
{
|
||||
m_filament_type = "";
|
||||
|
@ -939,6 +945,12 @@ ColorPicker::ColorPicker(wxWindow* parent, wxWindowID id, const wxPoint& pos /*=
|
|||
|
||||
ColorPicker::~ColorPicker(){}
|
||||
|
||||
void ColorPicker::msw_rescale()
|
||||
{
|
||||
m_bitmap_border = create_scaled_bitmap("color_picker_border", nullptr, 25);
|
||||
Refresh();
|
||||
}
|
||||
|
||||
void ColorPicker::set_color(wxColour col)
|
||||
{
|
||||
m_colour = col;
|
||||
|
@ -1088,7 +1100,7 @@ ColorPickerPopup::ColorPickerPopup(wxWindow* parent)
|
|||
auto cp = new ColorPicker(m_def_color_box, wxID_ANY, wxDefaultPosition, wxDefaultSize);
|
||||
cp->set_color(col);
|
||||
cp->set_selected(false);
|
||||
cp->SetBackgroundColour(wxColour(238, 238, 238));
|
||||
cp->SetBackgroundColour(StateColor::darkModeColorFor(wxColour(238,238,238)));
|
||||
m_color_pickers.push_back(cp);
|
||||
fg_sizer->Add(cp, 0, wxALL, FromDIP(3));
|
||||
cp->Bind(wxEVT_LEFT_DOWN, [this, cp](auto& e) {
|
||||
|
|
|
@ -40,6 +40,7 @@ public:
|
|||
ColorPicker(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize);
|
||||
~ColorPicker();
|
||||
|
||||
void msw_rescale();
|
||||
void set_color(wxColour col);
|
||||
void set_colors(std::vector<wxColour> cols);
|
||||
void set_selected(bool sel) {m_selected = sel;Refresh();};
|
||||
|
@ -93,7 +94,7 @@ public:
|
|||
wxString k = wxEmptyString, wxString n = wxEmptyString);
|
||||
|
||||
void post_select_event();
|
||||
|
||||
void msw_rescale();
|
||||
void set_color(wxColour color);
|
||||
void set_colors(std::vector<wxColour> colors);
|
||||
|
||||
|
|
|
@ -3430,6 +3430,7 @@ void StatusPanel::on_sys_color_changed()
|
|||
m_bitmap_speed_active.msw_rescale();
|
||||
m_switch_speed->SetImages(m_bitmap_speed, m_bitmap_speed);
|
||||
m_ams_control->msw_rescale();
|
||||
if (m_filament_setting_dlg) {m_filament_setting_dlg->msw_rescale();}
|
||||
rescale_camera_icons();
|
||||
}
|
||||
|
||||
|
|
|
@ -887,9 +887,7 @@ void AMSLib::doRender(wxDC &dc)
|
|||
int top = height - curr_height;
|
||||
|
||||
if (curr_height >= FromDIP(6)) {
|
||||
#ifdef __APPLE__
|
||||
dc.DrawRoundedRectangle(FromDIP(4), FromDIP(4) + top, size.x - FromDIP(8), curr_height, m_radius);
|
||||
#else
|
||||
|
||||
//gradient
|
||||
if (m_info.material_cols.size() > 1) {
|
||||
int left = FromDIP(4);
|
||||
|
@ -898,22 +896,22 @@ void AMSLib::doRender(wxDC &dc)
|
|||
|
||||
for (int i = 0; i < m_info.material_cols.size() - 1; i++) {
|
||||
|
||||
if ( (left + gwidth) > (size.x - FromDIP(8)) ) {
|
||||
if ((left + gwidth) > (size.x - FromDIP(8))) {
|
||||
gwidth = (size.x - FromDIP(4)) - left;
|
||||
}
|
||||
|
||||
auto rect = wxRect(left, height - curr_height + FromDIP(4), gwidth, curr_height);
|
||||
dc.GradientFillLinear(rect, m_info.material_cols[i], m_info.material_cols[i+1], wxEAST);
|
||||
dc.GradientFillLinear(rect, m_info.material_cols[i], m_info.material_cols[i + 1], wxEAST);
|
||||
left += gwidth;
|
||||
}
|
||||
}
|
||||
else {
|
||||
#ifdef __APPLE__
|
||||
dc.DrawRoundedRectangle(FromDIP(4), FromDIP(4) + top, size.x - FromDIP(8), curr_height, m_radius);
|
||||
#else
|
||||
dc.DrawRoundedRectangle(FromDIP(4), FromDIP(4) + top, size.x - FromDIP(8), curr_height, m_radius - 1);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (top > 2) {
|
||||
|
|
Loading…
Reference in a new issue