FIX:fixed some issues for dark mode

Change-Id: I6b2b75507cf8a72672cce39cf7d8af8773723c22
This commit is contained in:
tao wang 2022-12-05 19:42:05 +08:00 committed by Lane.Wei
parent 0acad21707
commit 6f1040f0df
7 changed files with 18 additions and 47 deletions

View File

@ -228,6 +228,7 @@ public:
// draw logo and constant info text // draw logo and constant info text
Decorate(m_main_bitmap); Decorate(m_main_bitmap);
wxGetApp().UpdateFrameDarkUI(this);
} }
void SetText(const wxString& text) void SetText(const wxString& text)
@ -239,7 +240,7 @@ public:
wxMemoryDC memDC; wxMemoryDC memDC;
memDC.SelectObject(bitmap); memDC.SelectObject(bitmap);
memDC.SetFont(m_action_font); memDC.SetFont(m_action_font);
memDC.SetTextForeground(wxColour(144, 144, 144)); memDC.SetTextForeground(StateColor::darkModeColorFor(wxColour(144, 144, 144)));
int width = bitmap.GetWidth(); int width = bitmap.GetWidth();
int text_height = memDC.GetTextExtent(text).GetHeight(); int text_height = memDC.GetTextExtent(text).GetHeight();
int text_width = memDC.GetTextExtent(text).GetWidth(); int text_width = memDC.GetTextExtent(text).GetWidth();
@ -276,13 +277,13 @@ public:
int version_width = memDc.GetTextExtent(m_constant_text.version).GetWidth(); int version_width = memDc.GetTextExtent(m_constant_text.version).GetWidth();
int split_width = (width + title_width - version_width) / 2; int split_width = (width + title_width - version_width) / 2;
wxRect title_rect(wxPoint(0, top_margin), wxPoint(split_width - text_padding, top_margin + title_height)); wxRect title_rect(wxPoint(0, top_margin), wxPoint(split_width - text_padding, top_margin + title_height));
memDc.SetTextForeground(wxColour(38, 46, 48)); memDc.SetTextForeground(StateColor::darkModeColorFor(wxColour(38, 46, 48)));
memDc.SetFont(m_constant_text.title_font); memDc.SetFont(m_constant_text.title_font);
memDc.DrawLabel(m_constant_text.title, title_rect, wxALIGN_RIGHT | wxALIGN_BOTTOM); memDc.DrawLabel(m_constant_text.title, title_rect, wxALIGN_RIGHT | wxALIGN_BOTTOM);
//BBS align bottom of title and version text //BBS align bottom of title and version text
wxRect version_rect(wxPoint(split_width + text_padding, top_margin), wxPoint(width, top_margin + title_height - text_padding)); wxRect version_rect(wxPoint(split_width + text_padding, top_margin), wxPoint(width, top_margin + title_height - text_padding));
memDc.SetFont(m_constant_text.version_font); memDc.SetFont(m_constant_text.version_font);
memDc.SetTextForeground(wxColor(134, 134, 134)); memDc.SetTextForeground(StateColor::darkModeColorFor(wxColor(134, 134, 134)));
memDc.DrawLabel(m_constant_text.version, version_rect, wxALIGN_LEFT | wxALIGN_BOTTOM); memDc.DrawLabel(m_constant_text.version, version_rect, wxALIGN_LEFT | wxALIGN_BOTTOM);
#if BBL_INTERNAL_TESTING #if BBL_INTERNAL_TESTING
@ -317,7 +318,7 @@ public:
wxMemoryDC memDC; wxMemoryDC memDC;
memDC.SelectObject(new_bmp); memDC.SelectObject(new_bmp);
memDC.SetBrush(*wxWHITE); memDC.SetBrush(StateColor::darkModeColorFor(*wxWHITE));
memDC.DrawRectangle(-1, -1, width + 2, height + 2); memDC.DrawRectangle(-1, -1, width + 2, height + 2);
memDC.DrawBitmap(new_bmp, 0, 0, true); memDC.DrawBitmap(new_bmp, 0, 0, true);
return new_bmp; return new_bmp;
@ -3126,8 +3127,6 @@ void GUI_App::force_colors_update()
//NppDarkMode::SetDarkExplorerTheme((HWND)mainframe->m_settings_dialog.GetHWND()); //NppDarkMode::SetDarkExplorerTheme((HWND)mainframe->m_settings_dialog.GetHWND());
//NppDarkMode::SetDarkTitleBar(mainframe->m_settings_dialog.GetHWND()); //NppDarkMode::SetDarkTitleBar(mainframe->m_settings_dialog.GetHWND());
//mainframe->m_settings_dialog.Refresh();
//mainframe->m_settings_dialog.Update();
#endif // __WINDOWS__ #endif // __WINDOWS__
#endif //_MSW_DARK_MODE #endif //_MSW_DARK_MODE

View File

@ -35,6 +35,7 @@ MediaPlayCtrl::MediaPlayCtrl(wxWindow *parent, wxMediaCtrl2 *media_ctrl, const w
m_button_play->SetCanFocus(false); m_button_play->SetCanFocus(false);
m_label_status = new Label(this, "", LB_HYPERLINK); m_label_status = new Label(this, "", LB_HYPERLINK);
m_label_status->SetForegroundColour(wxColour("#2C2C2E"));
m_button_play->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [this](auto &e) { TogglePlay(); }); m_button_play->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [this](auto &e) { TogglePlay(); });
m_button_play->Bind(wxEVT_RIGHT_UP, [this](auto & e) { m_media_ctrl->Play(); }); m_button_play->Bind(wxEVT_RIGHT_UP, [this](auto & e) { m_media_ctrl->Play(); });
@ -64,6 +65,8 @@ MediaPlayCtrl::MediaPlayCtrl(wxWindow *parent, wxMediaCtrl2 *media_ctrl, const w
m_lan_user = "bblp"; m_lan_user = "bblp";
m_lan_passwd = "bblp"; m_lan_passwd = "bblp";
wxGetApp().UpdateDarkUIWin(this);
} }
MediaPlayCtrl::~MediaPlayCtrl() MediaPlayCtrl::~MediaPlayCtrl()
@ -365,7 +368,7 @@ void MediaPlayCtrl::SetStatus(wxString const &msg2, bool hyperlink)
if (hyperlink) { if (hyperlink) {
style |= LB_HYPERLINK; style |= LB_HYPERLINK;
} }
m_label_status->SetWindowStyle(style); //m_label_status->SetWindowStyle(style);
m_label_status->InvalidateBestSize(); m_label_status->InvalidateBestSize();
Layout(); Layout();
} }

View File

@ -190,7 +190,7 @@ void ObjectDataViewModelNode::set_printable_icon(PrintIndicator printable)
{ {
m_printable = printable; m_printable = printable;
m_printable_icon = m_printable == piUndef ? m_empty_bmp : m_printable_icon = m_printable == piUndef ? m_empty_bmp :
create_scaled_bitmap(m_printable == piPrintable ? "obj_printable" : "obj_unprintable"); create_scaled_bitmap(m_printable == piPrintable ? "check_on" : "check_off_focused");
} }
void ObjectDataViewModelNode::set_action_icon(bool enable) void ObjectDataViewModelNode::set_action_icon(bool enable)

View File

@ -19,7 +19,6 @@ ParamsDialog::ParamsDialog(wxWindow * parent)
wxDefaultSize, wxCAPTION | wxCLOSE_BOX | wxRESIZE_BORDER) wxDefaultSize, wxCAPTION | wxCLOSE_BOX | wxRESIZE_BORDER)
{ {
m_panel = new ParamsPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBK_LEFT | wxTAB_TRAVERSAL); m_panel = new ParamsPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBK_LEFT | wxTAB_TRAVERSAL);
auto* topsizer = new wxBoxSizer(wxVERTICAL); auto* topsizer = new wxBoxSizer(wxVERTICAL);
topsizer->Add(m_panel, 1, wxALL | wxEXPAND, 0, NULL); topsizer->Add(m_panel, 1, wxALL | wxEXPAND, 0, NULL);
@ -57,15 +56,15 @@ ParamsDialog::ParamsDialog(wxWindow * parent)
wxGetApp().sidebar().finish_param_edit(); wxGetApp().sidebar().finish_param_edit();
}); });
wxGetApp().UpdateDlgDarkUI(this); //wxGetApp().UpdateDlgDarkUI(this);
} }
void ParamsDialog::Popup() void ParamsDialog::Popup()
{ {
wxGetApp().UpdateDlgDarkUI(this);
#ifdef __WIN32__ #ifdef __WIN32__
Reparent(wxGetApp().mainframe); Reparent(wxGetApp().mainframe);
#endif #endif
wxGetApp().UpdateDlgDarkUI(this);
Center(); Center();
Show(); Show();
} }

View File

@ -249,15 +249,6 @@ ParamsPanel::ParamsPanel( wxWindow* parent, wxWindowID id, const wxPoint& pos, c
}); });
} }
m_staticline_filament = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
//m_staticline_print = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
m_staticline_print_object = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
m_staticline_print_part = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
m_staticline_printer = new wxStaticLine(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL);
// BBS: new layout
//m_staticline_buttons = new wxStaticLine(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL);
//m_staticline_middle = new wxStaticLine(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL);
//m_export_to_file = new Button( this, wxT("Export To File"), ""); //m_export_to_file = new Button( this, wxT("Export To File"), "");
//m_import_from_file = new Button( this, wxT("Import From File") ); //m_import_from_file = new Button( this, wxT("Import From File") );
@ -400,8 +391,6 @@ void ParamsPanel::create_layout()
} }
if (m_tab_print) { if (m_tab_print) {
if (m_staticline_print)
m_left_sizer->Add( m_staticline_print, 0, wxEXPAND );
//m_print_sizer = new wxBoxSizer( wxHORIZONTAL ); //m_print_sizer = new wxBoxSizer( wxHORIZONTAL );
//m_print_sizer->Add( m_tab_print, 1, wxEXPAND | wxALL, 5 ); //m_print_sizer->Add( m_tab_print, 1, wxEXPAND | wxALL, 5 );
//m_left_sizer->Add( m_print_sizer, 1, wxEXPAND, 5 ); //m_left_sizer->Add( m_print_sizer, 1, wxEXPAND, 5 );
@ -409,17 +398,14 @@ void ParamsPanel::create_layout()
} }
if (m_tab_print_object) { if (m_tab_print_object) {
m_left_sizer->Add( m_staticline_print_object, 0, wxEXPAND );
m_left_sizer->Add( m_tab_print_object, 0, wxEXPAND ); m_left_sizer->Add( m_tab_print_object, 0, wxEXPAND );
} }
if (m_tab_print_part) { if (m_tab_print_part) {
m_left_sizer->Add( m_staticline_print_part, 0, wxEXPAND );
m_left_sizer->Add( m_tab_print_part, 0, wxEXPAND ); m_left_sizer->Add( m_tab_print_part, 0, wxEXPAND );
} }
if (m_tab_filament) { if (m_tab_filament) {
m_left_sizer->Add( m_staticline_filament, 0, wxEXPAND );
//m_filament_sizer = new wxBoxSizer( wxVERTICAL ); //m_filament_sizer = new wxBoxSizer( wxVERTICAL );
//m_filament_sizer->Add( m_tab_filament, 1, wxEXPAND | wxALL, 5 ); //m_filament_sizer->Add( m_tab_filament, 1, wxEXPAND | wxALL, 5 );
// m_left_sizer->Add( m_filament_sizer, 1, wxEXPAND, 5 ); // m_left_sizer->Add( m_filament_sizer, 1, wxEXPAND, 5 );
@ -427,7 +413,6 @@ void ParamsPanel::create_layout()
} }
if (m_tab_printer) { if (m_tab_printer) {
m_left_sizer->Add( m_staticline_printer, 0, wxEXPAND );
//m_printer_sizer = new wxBoxSizer( wxVERTICAL ); //m_printer_sizer = new wxBoxSizer( wxVERTICAL );
//m_printer_sizer->Add( m_tab_printer, 1, wxEXPAND | wxALL, 5 ); //m_printer_sizer->Add( m_tab_printer, 1, wxEXPAND | wxALL, 5 );
m_left_sizer->Add( m_tab_printer, 0, wxEXPAND ); m_left_sizer->Add( m_tab_printer, 0, wxEXPAND );
@ -441,11 +426,9 @@ void ParamsPanel::create_layout()
//m_button_sizer->Add( m_import_from_file, 0, wxALL, 5 ); //m_button_sizer->Add( m_import_from_file, 0, wxALL, 5 );
//m_left_sizer->Add( m_staticline_buttons, 0, wxEXPAND );
//m_left_sizer->Add( m_button_sizer, 0, wxALIGN_CENTER, 5 ); //m_left_sizer->Add( m_button_sizer, 0, wxALIGN_CENTER, 5 );
m_top_sizer->Add(m_left_sizer, 1, wxEXPAND); m_top_sizer->Add(m_left_sizer, 1, wxEXPAND);
//m_top_sizer->Add(m_staticline_middle, 0, wxEXPAND, 0);
//m_right_sizer = new wxBoxSizer( wxVERTICAL ); //m_right_sizer = new wxBoxSizer( wxVERTICAL );
@ -793,19 +776,6 @@ void ParamsPanel::delete_subwindows()
m_staticline_printer = nullptr; m_staticline_printer = nullptr;
} }
//// BBS: new layout
//if (m_staticline_buttons)
//{
// delete m_staticline_buttons;
// m_staticline_buttons = nullptr;
//}
//if (m_staticline_middle)
//{
// delete m_staticline_middle;
// m_staticline_middle = nullptr;
//}
if (m_export_to_file) if (m_export_to_file)
{ {
delete m_export_to_file; delete m_export_to_file;

View File

@ -665,9 +665,9 @@ Sidebar::Sidebar(Plater *parent)
std::pair<wxColour, int>(wxColour(238, 238, 238), StateColor::Hovered), std::pair<wxColour, int>(wxColour(238, 238, 238), StateColor::Hovered),
std::pair<wxColour, int>(wxColour(238, 238, 238), StateColor::Normal)); std::pair<wxColour, int>(wxColour(238, 238, 238), StateColor::Normal));
StateColor flush_fg_col(std::pair<wxColour, int>(wxColour(107, 107, 107), StateColor::Pressed), StateColor flush_fg_col(std::pair<wxColour, int>(wxColour(107, 107, 106), StateColor::Pressed),
std::pair<wxColour, int>(wxColour(107, 107, 107), StateColor::Hovered), std::pair<wxColour, int>(wxColour(107, 107, 106), StateColor::Hovered),
std::pair<wxColour, int>(wxColour(107, 107, 107), StateColor::Normal)); std::pair<wxColour, int>(wxColour(107, 107, 106), StateColor::Normal));
StateColor flush_bd_col(std::pair<wxColour, int>(wxColour(0, 174, 66), StateColor::Pressed), StateColor flush_bd_col(std::pair<wxColour, int>(wxColour(0, 174, 66), StateColor::Pressed),
std::pair<wxColour, int>(wxColour(0, 174, 66), StateColor::Hovered), std::pair<wxColour, int>(wxColour(0, 174, 66), StateColor::Hovered),

View File

@ -104,7 +104,7 @@ wxBoxSizer* WipingDialog::create_btn_sizer(long flags)
calc_btn->SetCornerRadius(FromDIP(12)); calc_btn->SetCornerRadius(FromDIP(12));
calc_btn->SetBackgroundColor(ok_btn_bg); calc_btn->SetBackgroundColor(ok_btn_bg);
calc_btn->SetBorderColor(ok_btn_bd); calc_btn->SetBorderColor(ok_btn_bd);
calc_btn->SetTextColor(ok_btn_text); calc_btn->SetTextColor(wxColour("#FFFFFE"));
calc_btn->SetFocus(); calc_btn->SetFocus();
calc_btn->SetId(wxID_RESET); calc_btn->SetId(wxID_RESET);
btn_sizer->Add(calc_btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, BTN_GAP); btn_sizer->Add(calc_btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, BTN_GAP);
@ -116,7 +116,7 @@ wxBoxSizer* WipingDialog::create_btn_sizer(long flags)
ok_btn->SetCornerRadius(FromDIP(12)); ok_btn->SetCornerRadius(FromDIP(12));
ok_btn->SetBackgroundColor(ok_btn_bg); ok_btn->SetBackgroundColor(ok_btn_bg);
ok_btn->SetBorderColor(ok_btn_bd); ok_btn->SetBorderColor(ok_btn_bd);
ok_btn->SetTextColor(ok_btn_text); ok_btn->SetTextColor(wxColour("#FFFFFE"));
ok_btn->SetFocus(); ok_btn->SetFocus();
ok_btn->SetId(wxID_OK); ok_btn->SetId(wxID_OK);
btn_sizer->Add(ok_btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, BTN_GAP); btn_sizer->Add(ok_btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, BTN_GAP);
@ -530,7 +530,7 @@ int WipingPanel::calc_flushing_volume(const wxColour& from, const wxColour& to)
void WipingPanel::update_warning_texts() void WipingPanel::update_warning_texts()
{ {
static const wxColour g_warning_color = *wxRED; static const wxColour g_warning_color = *wxRED;
static const wxColour g_normal_color = *wxBLACK; static const wxColour g_normal_color = StateColor::darkModeColorFor(*wxBLACK);
wxString multi_str = m_flush_multiplier_ebox->GetValue(); wxString multi_str = m_flush_multiplier_ebox->GetValue();
float multiplier = wxAtof(multi_str); float multiplier = wxAtof(multi_str);