From 2cc39d791f212c597be36b6868878b900987ea03 Mon Sep 17 00:00:00 2001 From: James Crook Date: Tue, 25 Apr 2017 17:19:46 +0100 Subject: [PATCH] Option so (theme) developers can work with Mac buttons on PC (and vice versa) --- src/prefs/GUIPrefs.cpp | 7 +++++ src/toolbars/ToolBar.cpp | 55 ++++++++++++++++++++++++++++------------ 2 files changed, 46 insertions(+), 16 deletions(-) diff --git a/src/prefs/GUIPrefs.cpp b/src/prefs/GUIPrefs.cpp index b851ec8b9..c500c2f0c 100644 --- a/src/prefs/GUIPrefs.cpp +++ b/src/prefs/GUIPrefs.cpp @@ -177,6 +177,13 @@ void GUIPrefs::PopulateOrExchange(ShuttleGui & S) S.TieCheckBox(_("Show e&xtra menus"), wxT("/GUI/ShowExtraMenus"), false); +#ifdef EXPERIMENTAL_THEME_PREFS + // We do not want to make this option mainstream. It's a + // convenience for developers. + S.TieCheckBox(_("Show alternative &styling (Mac vs PC)"), + wxT("/GUI/ShowMac"), + false); +#endif } S.EndStatic(); diff --git a/src/toolbars/ToolBar.cpp b/src/toolbars/ToolBar.cpp index 146ef3c4c..0c8f7175d 100644 --- a/src/toolbars/ToolBar.cpp +++ b/src/toolbars/ToolBar.cpp @@ -52,6 +52,7 @@ in which buttons can be placed. #include "../commands/Keyboard.h" #include "../widgets/AButton.h" #include "../widgets/Grabber.h" +#include "../Prefs.h" //////////////////////////////////////////////////////////// /// ToolBarResizer @@ -705,28 +706,50 @@ void ToolBar::MakeRecoloredImage( teBmps eBmpOut, teBmps eBmpIn ) void ToolBar:: MakeButtonBackgroundsLarge() { -#ifdef USE_AQUA_THEME - MakeMacRecoloredImage( bmpRecoloredUpLarge, bmpMacUpButton ); - MakeMacRecoloredImage( bmpRecoloredDownLarge, bmpMacDownButton ); - MakeMacRecoloredImage( bmpRecoloredHiliteLarge, bmpMacHiliteButton ); -#else - MakeRecoloredImage( bmpRecoloredUpLarge, bmpUpButtonLarge ); - MakeRecoloredImage( bmpRecoloredDownLarge, bmpDownButtonLarge ); - MakeRecoloredImage( bmpRecoloredHiliteLarge, bmpHiliteButtonLarge ); + + bool bUseAqua = false; + +#ifdef EXPERIMENTAL_THEME_PREFS + gPrefs->Read( wxT("/GUI/ShowMac"), &bUseAqua, false); #endif + +#ifdef USE_AQUA_THEME + bUseAqua = !bUseAqua; +#endif + + if( bUseAqua ){ + MakeMacRecoloredImage( bmpRecoloredUpLarge, bmpMacUpButton ); + MakeMacRecoloredImage( bmpRecoloredDownLarge, bmpMacDownButton ); + MakeMacRecoloredImage( bmpRecoloredHiliteLarge, bmpMacHiliteButton ); + } else { + MakeRecoloredImage( bmpRecoloredUpLarge, bmpUpButtonLarge ); + MakeRecoloredImage( bmpRecoloredDownLarge, bmpDownButtonLarge ); + MakeRecoloredImage( bmpRecoloredHiliteLarge, bmpHiliteButtonLarge ); + } } void ToolBar::MakeButtonBackgroundsSmall() { -#ifdef USE_AQUA_THEME - MakeMacRecoloredImage( bmpRecoloredUpSmall, bmpMacUpButtonSmall ); - MakeMacRecoloredImage( bmpRecoloredDownSmall, bmpMacDownButtonSmall ); - MakeMacRecoloredImage( bmpRecoloredHiliteSmall, bmpMacHiliteButtonSmall ); -#else - MakeRecoloredImage( bmpRecoloredUpSmall, bmpUpButtonSmall ); - MakeRecoloredImage( bmpRecoloredDownSmall, bmpDownButtonSmall ); - MakeRecoloredImage( bmpRecoloredHiliteSmall, bmpHiliteButtonSmall ); + + bool bUseAqua = false; + +#ifdef EXPERIMENTAL_THEME_PREFS + gPrefs->Read( wxT("/GUI/ShowMac"), &bUseAqua, false); #endif + +#ifdef USE_AQUA_THEME + bUseAqua = !bUseAqua; +#endif + + if( bUseAqua ){ + MakeMacRecoloredImage( bmpRecoloredUpSmall, bmpMacUpButtonSmall ); + MakeMacRecoloredImage( bmpRecoloredDownSmall, bmpMacDownButtonSmall ); + MakeMacRecoloredImage( bmpRecoloredHiliteSmall, bmpMacHiliteButtonSmall ); + } else { + MakeRecoloredImage( bmpRecoloredUpSmall, bmpUpButtonSmall ); + MakeRecoloredImage( bmpRecoloredDownSmall, bmpDownButtonSmall ); + MakeRecoloredImage( bmpRecoloredHiliteSmall, bmpHiliteButtonSmall ); + } } /// Makes a button and its four different state bitmaps