From 49010dc7b09e3195155fd7be273ead4570bcabf3 Mon Sep 17 00:00:00 2001 From: James Crook Date: Mon, 13 Feb 2017 21:57:30 +0000 Subject: [PATCH] More #ifdefs to allow joint Audacity/DarkAudacity use. --- src/Experimental.h | 3 +-- src/Internat.cpp | 7 ++++++- src/Menus.cpp | 6 +++++- src/Project.cpp | 4 ++++ src/Theme.cpp | 4 ++++ src/TrackPanelAx.cpp | 4 ++++ src/effects/DtmfGen.cpp | 17 ++++++++++++----- src/effects/TruncSilence.cpp | 5 +++++ src/prefs/GUIPrefs.cpp | 4 ++++ src/toolbars/EditToolBar.cpp | 12 ++++++++---- src/toolbars/EditToolBar.h | 4 +++- src/widgets/HelpSystem.cpp | 6 ++++++ 12 files changed, 62 insertions(+), 14 deletions(-) diff --git a/src/Experimental.h b/src/Experimental.h index eead1a595..90612b777 100644 --- a/src/Experimental.h +++ b/src/Experimental.h @@ -48,8 +48,7 @@ // feature to link audio tracks to a label track #define EXPERIMENTAL_SYNC_LOCK -// enables dark theme and customisations. -#define EXPERIMENTAL_DARK_AUDACITY +// enables dark audacity theme and customisations. #define EXPERIMENTAL_DA // experimental theming diff --git a/src/Internat.cpp b/src/Internat.cpp index 30c4f2e82..eb216fcb3 100644 --- a/src/Internat.cpp +++ b/src/Internat.cpp @@ -57,6 +57,12 @@ const wxString& GetCustomSubstitution(const wxString& str2) str3.Replace( " an DarkAudacity", " a DarkAudacity" ); return wxTranslations::GetUntranslatedString(str3); } +#else +const wxString& GetCustomSubstitution(const wxString& str1) +{ + return str1 ; +} +#endif // In any translated string, we can replace the name 'Audacity' by 'DarkAudacity' // without requiring translators to see extra strings for the two versions. @@ -65,7 +71,6 @@ const wxString& GetCustomTranslation(const wxString& str1) const wxString& str2 = wxGetTranslation( str1 ); return GetCustomSubstitution( str2 ); } -#endif void Internat::Init() diff --git a/src/Menus.cpp b/src/Menus.cpp index 8f26ee4f2..a34387d3c 100644 --- a/src/Menus.cpp +++ b/src/Menus.cpp @@ -325,7 +325,7 @@ void AudacityProject::CreateMenusAndCommands() AudioIONotBusyFlag | UnsavedChangesFlag); c->AddItem(wxT("SaveAs"), _("Save Project &As..."), FN(OnSaveAs)); c->BeginSubMenu( _("Save Other") ); -#ifdef EXPERIMENTAL_DARK_AUDACITY +#ifdef EXPERIMENTAL_DA // Enable Export audio commands only when there are audio tracks. c->AddItem(wxT("ExportMp3"), _("Export as MP&3"), FN(OnExportMp3), wxT(""), AudioIONotBusyFlag | WaveTracksExistFlag, @@ -593,7 +593,11 @@ void AudacityProject::CreateMenusAndCommands() TracksExistFlag, TracksExistFlag); #ifdef EXPERIMENTAL_SYNC_LOCK +#ifdef EXPERIMENTAL_DA c->AddItem(wxT("SelSyncLockTracks"), _("In All Time-Locked Tracks"), +#else + c->AddItem(wxT("SelSyncLockTracks"), _("In All Sync-Locked Tracks"), +#endif FN(OnSelectSyncLockSel), wxT("Ctrl+Shift+Y"), TracksSelectedFlag | IsSyncLockedFlag, TracksSelectedFlag | IsSyncLockedFlag); diff --git a/src/Project.cpp b/src/Project.cpp index 144b2fd4c..c50154109 100644 --- a/src/Project.cpp +++ b/src/Project.cpp @@ -1256,7 +1256,11 @@ void AudacityProject::UpdatePrefsVariables() gPrefs->Read(wxT("/AudioFiles/NormalizeOnLoad"),&mNormalizeOnLoad, false); gPrefs->Read(wxT("/GUI/AutoScroll"), &mViewInfo.bUpdateTrackIndicator, true); gPrefs->Read(wxT("/GUI/EmptyCanBeDirty"), &mEmptyCanBeDirty, true ); +#ifdef EXPERIMENTAL_DA gPrefs->Read(wxT("/GUI/Help"), &mHelpPref, wxT("FromInternet") ); +#else + gPrefs->Read(wxT("/GUI/Help"), &mHelpPref, wxT("Local") ); +#endif gPrefs->Read(wxT("/GUI/SelectAllOnNone"), &mSelectAllOnNone, true); mStopIfWasPaused = true; // not configurable for now, but could be later. gPrefs->Read(wxT("/GUI/ShowSplashScreen"), &mShowSplashScreen, true); diff --git a/src/Theme.cpp b/src/Theme.cpp index 697a4a251..974bcb733 100644 --- a/src/Theme.cpp +++ b/src/Theme.cpp @@ -522,7 +522,11 @@ int SourceOutputStream::OpenFile(const wxString & Filename) bOk = File.Open( Filename, wxFile::write ); if( bOk ) { +#ifdef EXPERIMENTAL_DA File.Write( wxT("// DarkThemeAsCeeCode.h\r\n") ); +#else + File.Write( wxT("// ThemeAsCeeCode.h\r\n") ); +#endif File.Write( wxT("//\r\n") ); File.Write( wxT("// This file was Auto-Generated.\r\n") ); File.Write( wxT("// It is included by Theme.cpp.\r\n") ); diff --git a/src/TrackPanelAx.cpp b/src/TrackPanelAx.cpp index a61b78992..c036802a0 100644 --- a/src/TrackPanelAx.cpp +++ b/src/TrackPanelAx.cpp @@ -392,7 +392,11 @@ wxAccStatus TrackPanelAx::GetName( int childId, wxString* name ) this track is shown with a sync-locked icon.*/ // The absence of a dash between Sync and Locked is deliberate - // if present, Jaws reads it as "dash". +#ifdef EXPERIMENTAL_DA name->Append( wxT(" ") + wxString(_( " Time Lock Selected" )) ); +#else + name->Append( wxT(" ") + wxString(_( " Sync Lock Selected" )) ); +#endif } } } diff --git a/src/effects/DtmfGen.cpp b/src/effects/DtmfGen.cpp index 901b42872..8fa2c7da6 100644 --- a/src/effects/DtmfGen.cpp +++ b/src/effects/DtmfGen.cpp @@ -14,6 +14,7 @@ *//*******************************************************************/ #include "../Audacity.h" +#include "../Experimental.h" #include "DtmfGen.h" #include @@ -33,12 +34,18 @@ enum ID_DutyCycle, }; +#ifdef EXPERIMENTAL_DA +#define SHORT_APP_NAME "darkaudacity" +#else +#define SHORT_APP_NAME "audacity" +#endif + // Define keys, defaults, minimums, and maximums for the effect parameters // -// Name Type Key Def Min Max Scale -Param( Sequence, wxString, XO("Sequence"), wxT("darkaudacity"), wxT(""), wxT(""), wxT("")); -Param( DutyCycle, double, XO("Duty Cycle"), 55.0, 0.0, 100.0, 10.0 ); -Param( Amplitude, double, XO("Amplitude"), 0.8, 0.001, 1.0, 1 ); +// Name Type Key Def Min Max Scale +Param( Sequence, wxString, XO("Sequence"), wxT(SHORT_APP_NAME), wxT(""), wxT(""), wxT("")); +Param( DutyCycle, double, XO("Duty Cycle"), 55.0, 0.0, 100.0, 10.0 ); +Param( Amplitude, double, XO("Amplitude"), 0.8, 0.001, 1.0, 1 ); static const double kFadeInOut = 250.0; // used for fadein/out needed to remove clicking noise @@ -269,7 +276,7 @@ bool EffectDtmf::Startup() // Load the old "current" settings if (gPrefs->Exists(base)) { - gPrefs->Read(base + wxT("String"), &dtmfSequence, wxT("darkaudacity")); + gPrefs->Read(base + wxT("String"), &dtmfSequence, wxT(SHORT_APP_NAME)); gPrefs->Read(base + wxT("DutyCycle"), &dtmfDutyCycle, 550L); gPrefs->Read(base + wxT("Amplitude"), &dtmfAmplitude, 0.8f); diff --git a/src/effects/TruncSilence.cpp b/src/effects/TruncSilence.cpp index 5285bbad3..a9889c1b4 100644 --- a/src/effects/TruncSilence.cpp +++ b/src/effects/TruncSilence.cpp @@ -16,6 +16,7 @@ *//*******************************************************************/ #include "../Audacity.h" +#include "../Experimental.h" #include "TruncSilence.h" #include @@ -283,7 +284,11 @@ bool EffectTruncSilence::ProcessIndependently() if (track2->GetKind() == Track::Wave && !(track2 == track || track2 == link) && track2->GetSelected()) { +#ifdef EXPERIMENTAL_DA ::wxMessageBox(_("When truncating independently, there may only be one selected audio track in each Time-Locked Track Group.")); +#else + ::wxMessageBox(_("When truncating independently, there may only be one selected audio track in each Sync-Locked Track Group.")); +#endif return false; } } diff --git a/src/prefs/GUIPrefs.cpp b/src/prefs/GUIPrefs.cpp index 50d9fd536..09bc33d56 100644 --- a/src/prefs/GUIPrefs.cpp +++ b/src/prefs/GUIPrefs.cpp @@ -192,7 +192,11 @@ bool GUIPrefs::Apply() gPrefs->Flush(); } +#ifdef EXPERIMENTAL_DA wxString theme = gPrefs->Read(wxT("/GUI/Theme"), wxT("dark")); +#else + wxString theme = gPrefs->Read(wxT("/GUI/Theme"), wxT("light")); +#endif if( theme != "foo" ){ // gPrefs->Write(wxT("/GUI/Theme"), theme); // gPrefs->Flush(); diff --git a/src/toolbars/EditToolBar.cpp b/src/toolbars/EditToolBar.cpp index 967bfb908..25dd6efed 100644 --- a/src/toolbars/EditToolBar.cpp +++ b/src/toolbars/EditToolBar.cpp @@ -148,10 +148,12 @@ void EditToolBar::Populate() AddSeparator(); #ifdef EXPERIMENTAL_SYNC_LOCK -// AddButton(bmpSyncLockTracksUp, bmpSyncLockTracksDown, bmpSyncLockTracksUp, ETBSyncLockID, -// _("Time-Lock Tracks"), true); +#ifndef EXPERIMENTAL_DA + AddButton(bmpSyncLockTracksUp, bmpSyncLockTracksDown, bmpSyncLockTracksUp, ETBSyncLockID, + _("Sync-Lock Tracks"), true); -// AddSeparator(); + AddSeparator(); +#endif #endif AddButton(bmpZoomIn, bmpZoomIn, bmpZoomInDisabled, ETBZoomInID, @@ -212,7 +214,9 @@ void EditToolBar::RegenerateTooltips() { ETBRedoID, wxT("Redo"), XO("Redo") }, #ifdef EXPERIMENTAL_SYNC_LOCK -// { ETBSyncLockID, wxT("SyncLock"), XO("Time-Lock Tracks") }, +#ifndef EXPERIMENTAL_DA + { ETBSyncLockID, wxT("SyncLock"), XO("Sync-Lock Tracks") }, +#endif #endif { ETBZoomInID, wxT("ZoomIn"), XO("Zoom In") }, diff --git a/src/toolbars/EditToolBar.h b/src/toolbars/EditToolBar.h index 6b44224d7..a556471f9 100644 --- a/src/toolbars/EditToolBar.h +++ b/src/toolbars/EditToolBar.h @@ -38,7 +38,9 @@ enum { ETBRedoID, #ifdef EXPERIMENTAL_SYNC_LOCK -// ETBSyncLockID, +#ifndef EXPERIMENTAL_DA + ETBSyncLockID, +#endif #endif ETBZoomInID, diff --git a/src/widgets/HelpSystem.cpp b/src/widgets/HelpSystem.cpp index 934d13103..73fa13cc5 100644 --- a/src/widgets/HelpSystem.cpp +++ b/src/widgets/HelpSystem.cpp @@ -296,9 +296,15 @@ void HelpSystem::ShowHelpDialog(wxWindow *parent, } else if (releasePageName == wxT("Quick_Help")) { +#ifdef EXPERIMENTAL_DA releasePageName = wxT("video") + HelpSystem::ReleaseSuffix + anchor; localHelpPage = wxFileName(FileNames::HtmlHelpDir(), releasePageName).GetFullPath(); webHelpPath = wxT("http://www.darkaudacity.com/"); +#else + releasePageName = wxT("quick_help") + HelpSystem::ReleaseSuffix + anchor; + localHelpPage = wxFileName(FileNames::HtmlHelpDir(), releasePageName).GetFullPath(); + webHelpPath = wxT("http://")+HelpSystem::HelpHostname+HelpSystem::HelpServerHomeDir; +#endif } else {