FIX:fixed some issues with dark mode on mac

Change-Id: Ic43760cd8e934f463c2bf35c2fa240d8e5b14c20
This commit is contained in:
tao wang 2022-12-06 10:10:40 +08:00 committed by Lane.Wei
parent a1fcd05baa
commit dc55a6a2a6
3 changed files with 28 additions and 4 deletions

View file

@ -2110,6 +2110,14 @@ bool GUI_App::on_init_inner()
// If load_language() fails, the application closes.
load_language(wxString(), true);
#ifdef _MSW_DARK_MODE
#ifdef __APPLE__
wxSystemAppearance app = wxSystemSettings::GetAppearance();
GUI::wxGetApp().app_config->set("dark_color_mode", app.IsDark() ? "1" : "0");
GUI::wxGetApp().app_config->save();
#endif // __APPLE__
bool init_dark_color_mode = app_config->get("dark_color_mode") == "1";
bool init_sys_menu_enabled = app_config->get("sys_menu_enabled") == "1";
#ifdef __WINDOWS__

View file

@ -839,6 +839,7 @@ void MainFrame::init_tabpanel()
// BBS
wxBoxSizer* side_tools = create_side_tools();
m_tabpanel = new Notebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, side_tools, wxNB_TOP | wxTAB_TRAVERSAL | wxNB_NOPAGETHEME);
m_tabpanel->SetBackgroundColour(*wxWHITE);
#ifndef __WXOSX__ // Don't call SetFont under OSX to avoid name cutting in ObjectList
m_tabpanel->SetFont(Slic3r::GUI::wxGetApp().normal_font());
@ -944,9 +945,11 @@ void MainFrame::init_tabpanel()
//BBS add pages
m_monitor = new MonitorPanel(m_tabpanel, wxID_ANY, wxDefaultPosition, wxDefaultSize);
m_monitor->SetBackgroundColour(*wxWHITE);
m_tabpanel->AddPage(m_monitor, _L("Device"), std::string("tab_monitor_active"), std::string("tab_monitor_active"));
m_auxiliary = new AuxiliaryPanel(m_tabpanel, wxID_ANY, wxDefaultPosition, wxDefaultSize);
m_auxiliary->SetBackgroundColour(*wxWHITE);
m_tabpanel->AddPage(m_auxiliary, _L("Project"), std::string("tab_auxiliary_avtice"), std::string("tab_auxiliary_avtice"));
if (m_plater) {
@ -1733,8 +1736,8 @@ void MainFrame::on_dpi_changed(const wxRect& suggested_rect)
update_side_button_style();
m_slice_btn->Rescale();
//m_slice_option_btn->Rescale();
m_print_btn->Rescale();
m_slice_option_btn->Rescale();
m_print_option_btn->Rescale();
// update Plater

View file

@ -38,6 +38,8 @@ WebViewPanel::WebViewPanel(wxWindow *parent)
wxBoxSizer* topsizer = new wxBoxSizer(wxVERTICAL);
#if !BBL_RELEASE_TO_PUBLIC
// Create the button
bSizer_toolbar = new wxBoxSizer(wxHORIZONTAL);
@ -67,10 +69,11 @@ WebViewPanel::WebViewPanel(wxWindow *parent)
topsizer->Add(bSizer_toolbar, 0, wxEXPAND, 0);
topsizer->Add(panel, wxSizerFlags().Expand());
// Create sizer for panel.
wxBoxSizer* panel_sizer = new wxBoxSizer(wxVERTICAL);
panel->SetSizer(panel_sizer);
#endif //BBL_RELEASE_TO_PUBLIC
// Create the info panel
m_info = new wxInfoBar(this);
topsizer->Add(m_info, wxSizerFlags().Expand());
@ -168,6 +171,7 @@ WebViewPanel::WebViewPanel(wxWindow *parent)
m_zoomFactor = 100;
// Connect the button events
#if !BBL_RELEASE_TO_PUBLIC
Bind(wxEVT_BUTTON, &WebViewPanel::OnBack, this, m_button_back->GetId());
Bind(wxEVT_BUTTON, &WebViewPanel::OnForward, this, m_button_forward->GetId());
Bind(wxEVT_BUTTON, &WebViewPanel::OnStop, this, m_button_stop->GetId());
@ -175,6 +179,8 @@ WebViewPanel::WebViewPanel(wxWindow *parent)
Bind(wxEVT_BUTTON, &WebViewPanel::OnToolsClicked, this, m_button_tools->GetId());
Bind(wxEVT_TEXT_ENTER, &WebViewPanel::OnUrl, this, m_url->GetId());
#endif //BBL_RELEASE_TO_PUBLIC
// Connect the webview events
Bind(wxEVT_WEBVIEW_NAVIGATING, &WebViewPanel::OnNavigationRequest, this);
Bind(wxEVT_WEBVIEW_NAVIGATED, &WebViewPanel::OnNavigationComplete, this);
@ -258,14 +264,17 @@ void WebViewPanel::load_url(wxString& url)
*/
void WebViewPanel::UpdateState()
{
#if !BBL_RELEASE_TO_PUBLIC
if (m_browser->CanGoBack()) {
m_button_back->Enable(true);
} else {
}
else {
m_button_back->Enable(false);
}
if (m_browser->CanGoForward()) {
m_button_forward->Enable(true);
} else {
}
else {
m_button_forward->Enable(false);
}
if (m_browser->IsBusy())
@ -279,10 +288,12 @@ void WebViewPanel::UpdateState()
//SetTitle(m_browser->GetCurrentTitle());
m_url->SetValue(m_browser->GetCurrentURL());
#endif //BBL_RELEASE_TO_PUBLIC
}
void WebViewPanel::OnIdle(wxIdleEvent& WXUNUSED(evt))
{
#if !BBL_RELEASE_TO_PUBLIC
if (m_browser->IsBusy())
{
wxSetCursor(wxCURSOR_ARROWWAIT);
@ -293,6 +304,8 @@ void WebViewPanel::OnIdle(wxIdleEvent& WXUNUSED(evt))
wxSetCursor(wxNullCursor);
m_button_stop->Enable(false);
}
#endif //BBL_RELEASE_TO_PUBLIC
}
/**