FIX: bedshape dialog dark mode issue

Jira: STUDIO-4572

refine UI of the dialog under dark mode

Change-Id: I188a50bd8909c2ab090fbb1a095c4c45da150071
This commit is contained in:
liz.li 2023-09-26 17:42:41 +08:00 committed by Lane.Wei
parent d3e2f011e4
commit 999ceddea1
3 changed files with 14 additions and 6 deletions

View File

@ -34,11 +34,13 @@ void Bed_2D::repaint(const std::vector<Vec2d>& shape)
// On MacOS the background is erased, on Windows the background is not erased // On MacOS the background is erased, on Windows the background is not erased
// and on Linux / GTK the background is erased to gray color. // and on Linux / GTK the background is erased to gray color.
// Fill DC with the background on Windows & Linux / GTK. // Fill DC with the background on Windows & Linux / GTK.
#ifdef _WIN32 wxColour color;
auto color = wxGetApp().get_highlight_default_clr(); if (wxGetApp().dark_mode()) {// SetBackgroundColour
#else color = wxColour(45, 45, 49);
auto color = wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT); //GetSystemColour }
#endif else {
color = *wxWHITE;
}
dc.SetPen(*new wxPen(color, 1, wxPENSTYLE_SOLID)); dc.SetPen(*new wxPen(color, 1, wxPENSTYLE_SOLID));
dc.SetBrush(*new wxBrush(color, wxBRUSHSTYLE_SOLID)); dc.SetBrush(*new wxBrush(color, wxBRUSHSTYLE_SOLID));
auto rect = GetUpdateRegion().GetBox(); auto rect = GetUpdateRegion().GetBox();

View File

@ -132,6 +132,7 @@ void BedShapeDialog::build_dialog(const ConfigOptionPoints& default_pt, const Co
{ {
SetFont(wxGetApp().normal_font()); SetFont(wxGetApp().normal_font());
SetBackgroundColour(*wxWHITE);
m_panel = new BedShapePanel(this); m_panel = new BedShapePanel(this);
m_panel->build_panel(default_pt, custom_texture, custom_model); m_panel->build_panel(default_pt, custom_texture, custom_model);
@ -251,6 +252,7 @@ void BedShapePanel::build_panel(const ConfigOptionPoints& default_pt, const Conf
ConfigOptionsGroupShp BedShapePanel::init_shape_options_page(const wxString& title) ConfigOptionsGroupShp BedShapePanel::init_shape_options_page(const wxString& title)
{ {
wxPanel* panel = new wxPanel(m_shape_options_book); wxPanel* panel = new wxPanel(m_shape_options_book);
panel->SetBackgroundColour(*wxWHITE);
ConfigOptionsGroupShp optgroup = std::make_shared<ConfigOptionsGroup>(panel, _L("Settings")); ConfigOptionsGroupShp optgroup = std::make_shared<ConfigOptionsGroup>(panel, _L("Settings"));
optgroup->label_width = 10; optgroup->label_width = 10;
@ -348,6 +350,8 @@ wxPanel* BedShapePanel::init_texture_panel()
remove_btn->Bind(wxEVT_UPDATE_UI, ([this](wxUpdateUIEvent& e) { e.Enable(m_custom_texture != NONE); })); remove_btn->Bind(wxEVT_UPDATE_UI, ([this](wxUpdateUIEvent& e) { e.Enable(m_custom_texture != NONE); }));
parent->SetBackgroundColour(*wxWHITE);
return sizer; return sizer;
}; };
optgroup->append_line(line); optgroup->append_line(line);
@ -436,6 +440,8 @@ wxPanel* BedShapePanel::init_model_panel()
remove_btn->Bind(wxEVT_UPDATE_UI, ([this](wxUpdateUIEvent& e) { e.Enable(m_custom_model != NONE); })); remove_btn->Bind(wxEVT_UPDATE_UI, ([this](wxUpdateUIEvent& e) { e.Enable(m_custom_model != NONE); }));
parent->SetBackgroundColour(*wxWHITE);
return sizer; return sizer;
}; };
optgroup->append_line(line); optgroup->append_line(line);

View File

@ -93,7 +93,7 @@ class BedShapeDialog : public DPIDialog
BedShapePanel* m_panel; BedShapePanel* m_panel;
public: public:
BedShapeDialog(wxWindow* parent) : DPIDialog(parent, wxID_ANY, _(L("Bed Shape")), BedShapeDialog(wxWindow* parent) : DPIDialog(parent, wxID_ANY, _(L("Bed Shape")),
wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) {} wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE) {}
void build_dialog(const ConfigOptionPoints& default_pt, const ConfigOptionString& custom_texture, const ConfigOptionString& custom_model); void build_dialog(const ConfigOptionPoints& default_pt, const ConfigOptionString& custom_texture, const ConfigOptionString& custom_model);