Enable dark mode for MacOS

This commit is contained in:
Jon Evans 2021-04-28 23:24:19 -04:00
parent f00cee438f
commit 64d35ecebc
13 changed files with 8 additions and 39 deletions

View File

@ -159,8 +159,6 @@ static const wxChar HotkeysDumper[] = wxT( "HotkeysDumper" );
static const wxChar DrawBoundingBoxes[] = wxT( "DrawBoundingBoxes" );
static const wxChar AllowDarkMode[] = wxT( "AllowDarkMode" );
static const wxChar ShowPcbnewExportNetlist[] = wxT( "ShowPcbnewExportNetlist" );
} // namespace KEYS
@ -264,7 +262,6 @@ ADVANCED_CFG::ADVANCED_CFG()
m_SmallDrillMarkSize = 0.35;
m_HotkeysDumper = false;
m_DrawBoundingBoxes = false;
m_AllowDarkMode = false;
m_ShowPcbnewExportNetlist = false;
loadFromConfigFile();
@ -359,15 +356,6 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::DrawBoundingBoxes,
&m_DrawBoundingBoxes, false ) );
#if defined( __WXGTK__ ) || defined( __WXMSW__ )
bool defaultDarkMode = true;
#else
bool defaultDarkMode = false;
#endif
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::AllowDarkMode,
&m_AllowDarkMode, defaultDarkMode ) );
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::ShowPcbnewExportNetlist,
&m_ShowPcbnewExportNetlist, false ) );

View File

@ -170,7 +170,7 @@ bool BITMAP_STORE::ThemeChanged()
wxString oldTheme = m_theme;
if( ADVANCED_CFG::GetCfg().m_AllowDarkMode && settings )
if( settings )
{
switch( settings->m_Appearance.icon_theme )
{

View File

@ -72,14 +72,6 @@ PANEL_COMMON_SETTINGS::PANEL_COMMON_SETTINGS( DIALOG_SHIM* aDialog, wxWindow* aP
m_antialiasingFallbackLabel->Show( false );
#endif
if( !ADVANCED_CFG::GetCfg().m_AllowDarkMode )
{
m_rbIconThemeLight->Hide();
m_rbIconThemeDark->Hide();
m_rbIconThemeAuto->Hide();
m_stIconTheme->Hide();
}
m_textEditorBtn->SetBitmap( KiBitmap( BITMAPS::small_folder ) );
m_pdfViewerBtn->SetBitmap( KiBitmap( BITMAPS::small_folder ) );

View File

@ -181,11 +181,8 @@ ACTION_TOOLBAR::ACTION_TOOLBAR( EDA_BASE_FRAME* parent, wxWindowID id, const wxP
#if !wxCHECK_VERSION( 3, 1, 0 )
// Custom art provider makes dark mode work on wx < 3.1
if( ADVANCED_CFG::GetCfg().m_AllowDarkMode )
{
WX_AUI_TOOLBAR_ART* newArt = new WX_AUI_TOOLBAR_ART();
SetArtProvider( newArt );
}
WX_AUI_TOOLBAR_ART* newArt = new WX_AUI_TOOLBAR_ART();
SetArtProvider( newArt );
#endif
Connect( wxEVT_COMMAND_TOOL_CLICKED, wxAuiToolBarEventHandler( ACTION_TOOLBAR::onToolEvent ),

View File

@ -19,6 +19,7 @@
*/
#include <id.h>
#include <kiplatform/ui.h>
#include <widgets/infobar.h>
#include "wx/artprov.h"
#include <wx/aui/framemanager.h>
@ -54,7 +55,10 @@ WX_INFOBAR::WX_INFOBAR( wxWindow* aParent, wxAuiManager* aMgr, wxWindowID aWinid
#ifdef __WXMAC__
// wxWidgets hard-codes wxSYS_COLOUR_INFOBK to { 0xFF, 0xFF, 0xD3 } on Mac.
SetBackgroundColour( wxColour( 255, 249, 189 ) );
if( KIPLATFORM::UI::IsDarkTheme() )
SetBackgroundColour( wxColour( 28, 27, 20 ) );
else
SetBackgroundColour( wxColour( 255, 249, 189 ) );
#endif
SetShowHideEffects( wxSHOW_EFFECT_ROLL_TO_BOTTOM, wxSHOW_EFFECT_ROLL_TO_TOP );

View File

@ -165,11 +165,6 @@ public:
*/
bool m_DrawBoundingBoxes;
/**
* Enable detection of dark mode and automatic switch to dark-mode icon theme
*/
bool m_AllowDarkMode;
/**
* Enable exporting board editor netlist to a file for troubleshooting purposes.
*/

View File

@ -17,7 +17,6 @@
<key>CFBundleVersion</key> <string>@KICAD_VERSION_FULL@</string>
<key>CSResourcesFileMapped</key> <true/>
<key>LSRequiresCarbon</key> <true/>
<key>NSRequiresAquaSystemAppearance</key> <true/>
<key>NSHumanReadableCopyright</key> <string>Copyright The KiCad Developers</string>
<key>NSHighResolutionCapable</key> <string>True</string>
</dict>

View File

@ -30,7 +30,6 @@
<key>CFBundleVersion</key> <string>@KICAD_VERSION_FULL@</string>
<key>CSResourcesFileMapped</key> <true/>
<key>LSRequiresCarbon</key> <true/>
<key>NSRequiresAquaSystemAppearance</key> <true/>
<key>NSHumanReadableCopyright</key> <string>Copyright The KiCad Developers</string>
<key>NSHighResolutionCapable</key> <string>True</string>
</dict>

View File

@ -49,7 +49,6 @@
<key>CFBundleVersion</key> <string>@KICAD_VERSION_FULL@</string>
<key>CSResourcesFileMapped</key> <true/>
<key>LSRequiresCarbon</key> <true/>
<key>NSRequiresAquaSystemAppearance</key> <true/>
<key>NSHumanReadableCopyright</key> <string>Copyright The KiCad Developers</string>
<key>NSHighResolutionCapable</key> <string>True</string>
</dict>

View File

@ -29,7 +29,6 @@
<key>CFBundleVersion</key> <string>@KICAD_VERSION_FULL@</string>
<key>CSResourcesFileMapped</key> <true/>
<key>LSRequiresCarbon</key> <true/>
<key>NSRequiresAquaSystemAppearance</key> <true/>
<key>NSHumanReadableCopyright</key> <string>Copyright The KiCad Developers</string>
<key>NSHighResolutionCapable</key> <string>True</string>
</dict>

View File

@ -16,7 +16,6 @@
<key>CFBundleVersion</key> <string>@KICAD_VERSION_FULL@</string>
<key>CSResourcesFileMapped</key> <true/>
<key>LSRequiresCarbon</key> <true/>
<key>NSRequiresAquaSystemAppearance</key> <true/>
<key>NSHumanReadableCopyright</key> <string>Copyright The KiCad Developers</string>
<key>NSHighResolutionCapable</key> <string>True</string>
</dict>

View File

@ -31,7 +31,6 @@
<key>CFBundleVersion</key> <string>@KICAD_VERSION_FULL@</string>
<key>CSResourcesFileMapped</key> <true/>
<key>LSRequiresCarbon</key> <true/>
<key>NSRequiresAquaSystemAppearance</key> <true/>
<key>NSHumanReadableCopyright</key> <string>Copyright The KiCad Developers</string>
<key>NSHighResolutionCapable</key> <string>True</string>
</dict>

View File

@ -29,7 +29,6 @@
<key>CFBundleVersion</key> <string>@KICAD_VERSION_FULL@</string>
<key>CSResourcesFileMapped</key> <true/>
<key>LSRequiresCarbon</key> <true/>
<key>NSRequiresAquaSystemAppearance</key> <true/>
<key>NSHumanReadableCopyright</key> <string>Copyright The KiCad Developers</string>
<key>NSHighResolutionCapable</key> <string>True</string>
</dict>