mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-16 16:10:06 +02:00
Use global ChoiceSettings variables, not coincidental string literals
This commit is contained in:
parent
9b41741074
commit
87a9e7ccbb
@ -52,6 +52,7 @@ AliasedFile s.
|
||||
|
||||
#include "blockfile/SimpleBlockFile.h"
|
||||
#include "DirManager.h"
|
||||
#include "FileFormats.h"
|
||||
#include "Prefs.h"
|
||||
#include "Project.h"
|
||||
#include "ProjectSettings.h"
|
||||
@ -589,8 +590,7 @@ void DependencyDialog::SaveFutureActionChoice()
|
||||
case 2: savePref = wxT("never"); break;
|
||||
default: savePref = wxT("ask");
|
||||
}
|
||||
gPrefs->Write(wxT("/FileFormats/SaveProjectWithDependencies"),
|
||||
savePref);
|
||||
FileFormatsSaveWithDependenciesSetting.Write( savePref );
|
||||
gPrefs->Flush();
|
||||
}
|
||||
}
|
||||
@ -632,9 +632,7 @@ New projects will be self-contained and are less risky.");
|
||||
{
|
||||
#ifdef EXPERIMENTAL_OD_DATA
|
||||
wxString action =
|
||||
gPrefs->Read(
|
||||
wxT("/FileFormats/SaveProjectWithDependencies"),
|
||||
wxT("ask"));
|
||||
FileFormatsSaveWithDependenciesSetting.Read();
|
||||
if (action == wxT("copy"))
|
||||
{
|
||||
// User always wants to remove dependencies
|
||||
|
@ -360,7 +360,7 @@ void MixerTrackCluster::UpdatePrefs()
|
||||
{
|
||||
this->SetBackgroundColour( theTheme.Colour( clrMedium ) );
|
||||
mStaticText_TrackName->SetForegroundColour(theTheme.Colour(clrTrackPanelText));
|
||||
HandleResize(); // in case prefs "/GUI/Solo" changed
|
||||
HandleResize(); // in case TracksBehaviorsSolo changed
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -22,6 +22,7 @@ Paul Licameli split from AudacityProject.cpp
|
||||
#include "AutoRecovery.h"
|
||||
#include "Dependencies.h"
|
||||
#include "DirManager.h"
|
||||
#include "FileFormats.h"
|
||||
#include "FileNames.h"
|
||||
#include "Legacy.h"
|
||||
#include "PlatformCompatibility.h"
|
||||
@ -122,13 +123,12 @@ auto ProjectFileManager::ReadProjectFile( const FilePath &fileName )
|
||||
#ifdef EXPERIMENTAL_OD_DATA
|
||||
// 'Lossless copy' projects have dependencies. We need to always copy-in
|
||||
// these dependencies when converting to a normal project.
|
||||
wxString oldAction =
|
||||
gPrefs->Read(wxT("/FileFormats/CopyOrEditUncompressedData"), wxT("copy"));
|
||||
auto oldAction = FileFormatsCopyOrEditSetting.Read();
|
||||
bool oldAsk =
|
||||
gPrefs->ReadBool(wxT("/Warnings/CopyOrEditUncompressedDataAsk"), true);
|
||||
|
||||
if (oldAction != wxT("copy"))
|
||||
gPrefs->Write(wxT("/FileFormats/CopyOrEditUncompressedData"), wxT("copy"));
|
||||
FileFormatsCopyOrEditSetting.Write( wxT("copy") );
|
||||
if (oldAsk)
|
||||
gPrefs->Write(wxT("/Warnings/CopyOrEditUncompressedDataAsk"), (long) false);
|
||||
gPrefs->Flush();
|
||||
@ -136,7 +136,7 @@ auto ProjectFileManager::ReadProjectFile( const FilePath &fileName )
|
||||
auto cleanup = finally( [&] {
|
||||
// and restore old settings if necessary.
|
||||
if (oldAction != wxT("copy"))
|
||||
gPrefs->Write(wxT("/FileFormats/CopyOrEditUncompressedData"), oldAction);
|
||||
FileFormatsCopyOrEditSetting.Write( oldAction );
|
||||
if (oldAsk)
|
||||
gPrefs->Write(wxT("/Warnings/CopyOrEditUncompressedDataAsk"), (long) true);
|
||||
gPrefs->Flush();
|
||||
|
@ -16,6 +16,7 @@ Paul Licameli split from AudacityProject.cpp
|
||||
#include "Project.h"
|
||||
#include "prefs/QualityPrefs.h"
|
||||
#include "widgets/NumericTextCtrl.h"
|
||||
#include "prefs/TracksBehaviorsPrefs.h"
|
||||
|
||||
wxDEFINE_EVENT(EVT_PROJECT_SETTINGS_CHANGE, wxCommandEvent);
|
||||
|
||||
@ -91,7 +92,7 @@ void ProjectSettings::UpdatePrefs()
|
||||
gPrefs->Read(wxT("/AudioFiles/ShowId3Dialog"), &mShowId3Dialog, true);
|
||||
gPrefs->Read(wxT("/GUI/EmptyCanBeDirty"), &mEmptyCanBeDirty, true );
|
||||
gPrefs->Read(wxT("/GUI/ShowSplashScreen"), &mShowSplashScreen, true);
|
||||
gPrefs->Read(wxT("/GUI/Solo"), &mSoloPref, wxT("Simple"));
|
||||
mSoloPref = TracksBehaviorsSolo.Read();
|
||||
// Update the old default to the NEW default.
|
||||
if (mSoloPref == wxT("Standard"))
|
||||
mSoloPref = wxT("Simple");
|
||||
|
@ -77,6 +77,7 @@ can't be.
|
||||
#include "Prefs.h"
|
||||
#include "ImageManipulation.h"
|
||||
#include "Internat.h"
|
||||
#include "prefs/GUIPrefs.h"
|
||||
#include "widgets/AudacityMessageBox.h"
|
||||
|
||||
// JKC: First get the MAC specific images.
|
||||
@ -234,11 +235,7 @@ void Theme::EnsureInitialised()
|
||||
bool ThemeBase::LoadPreferredTheme()
|
||||
{
|
||||
// DA: Default themes differ.
|
||||
#ifdef EXPERIMENTAL_DA
|
||||
wxString theme = gPrefs->Read(wxT("/GUI/Theme"), wxT("dark"));
|
||||
#else
|
||||
wxString theme = gPrefs->Read(wxT("/GUI/Theme"), wxT("light"));
|
||||
#endif
|
||||
auto theme = GUITheme.Read();
|
||||
|
||||
theTheme.LoadTheme( theTheme.ThemeTypeOfTypeName( theme ) );
|
||||
return true;
|
||||
|
@ -40,9 +40,9 @@ Paul Licameli split from TrackPanel.cpp
|
||||
#include "Track.h"
|
||||
#include "TrackPanelDrawingContext.h"
|
||||
#include "ViewInfo.h"
|
||||
#include "prefs/TracksBehaviorsPrefs.h"
|
||||
#include "tracks/ui/TrackView.h"
|
||||
|
||||
|
||||
// Subscribe to preference changes to update static variables
|
||||
struct Settings : PrefsListener {
|
||||
wxString gSoloPref;
|
||||
@ -52,7 +52,7 @@ struct Settings : PrefsListener {
|
||||
|
||||
void UpdatePrefs() override
|
||||
{
|
||||
gPrefs->Read(wxT("/GUI/Solo"), &gSoloPref, wxT("Simple"));
|
||||
gSoloPref = TracksBehaviorsSolo.Read();
|
||||
|
||||
// Calculation of best font size depends on language, so it should be redone in case
|
||||
// the language preference changed.
|
||||
|
@ -264,11 +264,10 @@ ProgressResult ExportFLAC::Export(AudacityProject *project,
|
||||
wxLogNull logNo; // temporarily disable wxWidgets error messages
|
||||
auto updateResult = ProgressResult::Success;
|
||||
|
||||
int levelPref;
|
||||
gPrefs->Read(wxT("/FileFormats/FLACLevel"), &levelPref, 5);
|
||||
long levelPref;
|
||||
FLACLevel.Read().ToLong( &levelPref );
|
||||
|
||||
wxString bitDepthPref =
|
||||
gPrefs->Read(wxT("/FileFormats/FLACBitDepth"), wxT("16"));
|
||||
auto bitDepthPref = FLACBitDepth.Read();
|
||||
|
||||
FLAC::Encoder::File encoder;
|
||||
|
||||
|
@ -236,7 +236,7 @@ auto PCMImportFileHandle::GetFileUncompressedBytes() -> ByteCount
|
||||
static wxString AskCopyOrEdit()
|
||||
{
|
||||
|
||||
wxString oldCopyPref = gPrefs->Read(wxT("/FileFormats/CopyOrEditUncompressedData"), wxT("copy"));
|
||||
auto oldCopyPref = FileFormatsCopyOrEditSetting.Read();
|
||||
|
||||
bool firstTimeAsk = gPrefs->Read(wxT("/Warnings/CopyOrEditUncompressedDataFirstAsk"), true)?true:false;
|
||||
bool oldAskPref = gPrefs->Read(wxT("/Warnings/CopyOrEditUncompressedDataAsk"), true)?true:false;
|
||||
@ -245,7 +245,7 @@ static wxString AskCopyOrEdit()
|
||||
// This effectively does a one-time change to the preferences.
|
||||
if (firstTimeAsk) {
|
||||
if (oldCopyPref != wxT("copy")) {
|
||||
gPrefs->Write(wxT("/FileFormats/CopyOrEditUncompressedData"), wxT("copy"));
|
||||
FileFormatsCopyOrEditSetting.Write( wxT("copy") );
|
||||
oldCopyPref = wxT("copy");
|
||||
}
|
||||
gPrefs->Write(wxT("/Warnings/CopyOrEditUncompressedDataFirstAsk"), (long) false);
|
||||
@ -338,7 +338,7 @@ static wxString AskCopyOrEdit()
|
||||
|
||||
// if the preference changed, save it.
|
||||
if (newCopyPref != oldCopyPref) {
|
||||
gPrefs->Write(wxT("/FileFormats/CopyOrEditUncompressedData"), newCopyPref);
|
||||
FileFormatsCopyOrEditSetting.Write( newCopyPref );
|
||||
gPrefs->Flush();
|
||||
}
|
||||
oldCopyPref = newCopyPref;
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "../effects/Contrast.h"
|
||||
#include "../effects/EffectManager.h"
|
||||
#include "../effects/RealtimeEffectManager.h"
|
||||
#include "../prefs/EffectsPrefs.h"
|
||||
|
||||
// private helper classes and functions
|
||||
namespace {
|
||||
@ -195,7 +196,7 @@ void AddEffectMenuItems(
|
||||
{
|
||||
size_t pluginCnt = plugs.size();
|
||||
|
||||
wxString groupBy = gPrefs->Read(wxT("/Effects/GroupBy"), wxT("sortby:name"));
|
||||
auto groupBy = EffectsGroupBy.Read();
|
||||
|
||||
bool grouped = false;
|
||||
if (groupBy.StartsWith(wxT("groupby")))
|
||||
@ -382,7 +383,7 @@ MenuTable::BaseItemPtrs PopulateEffectsMenu(
|
||||
plug = pm.GetNextPluginForEffectType(type);
|
||||
}
|
||||
|
||||
wxString groupby = gPrefs->Read(wxT("/Effects/GroupBy"), wxT("sortby:name"));
|
||||
wxString groupby = EffectsGroupBy.Read();
|
||||
|
||||
using Comparator = bool(*)(const PluginDescriptor*, const PluginDescriptor*);
|
||||
Comparator comp1, comp2;
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "PrefsPanel.h"
|
||||
|
||||
class ChoiceSetting;
|
||||
class ShuttleGui;
|
||||
|
||||
#define EFFECTS_PREFS_PLUGIN_SYMBOL ComponentInterfaceSymbol{ XO("Effects") }
|
||||
@ -39,4 +40,7 @@ class EffectsPrefs final : public PrefsPanel
|
||||
|
||||
/// A PrefsPanel::Factory that creates one EffectsPrefs panel.
|
||||
extern PrefsPanel::Factory EffectsPrefsFactory;
|
||||
|
||||
extern ChoiceSetting EffectsGroupBy;
|
||||
|
||||
#endif
|
||||
|
@ -275,7 +275,7 @@ bool GUIPrefs::Commit()
|
||||
gPrefs->Flush();
|
||||
}
|
||||
|
||||
// Reads preference /GUI/Theme
|
||||
// Reads preference GUITheme
|
||||
theTheme.LoadPreferredTheme();
|
||||
ThemePrefs::ApplyUpdatedImages();
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "PrefsPanel.h"
|
||||
|
||||
class ChoiceSetting;
|
||||
class ShuttleGui;
|
||||
class wxArrayStringEx;
|
||||
|
||||
@ -69,4 +70,9 @@ extern PrefsPanel::Factory GUIPrefsFactory;
|
||||
|
||||
int ShowClippingPrefsID();
|
||||
|
||||
extern ChoiceSetting
|
||||
GUIManualLocation
|
||||
, GUITheme
|
||||
;
|
||||
|
||||
#endif
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
#include "PrefsPanel.h"
|
||||
|
||||
class ChoiceSetting;
|
||||
class ShuttleGui;
|
||||
class wxArrayStringEx;
|
||||
|
||||
@ -42,4 +43,7 @@ class TracksBehaviorsPrefs final : public PrefsPanel
|
||||
|
||||
/// A PrefsPanel::Factory that creates one TracksBehaviorsPrefs panel.
|
||||
extern PrefsPanel::Factory TracksBehaviorsPrefsFactory;
|
||||
|
||||
extern ChoiceSetting TracksBehaviorsSolo;
|
||||
|
||||
#endif
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include "../HelpText.h"
|
||||
#include "../Prefs.h"
|
||||
#include "../wxFileNameWrapper.h"
|
||||
#include "../prefs/GUIPrefs.h"
|
||||
|
||||
#ifdef USE_ALPHA_MANUAL
|
||||
const wxString HelpSystem::HelpHostname = wxT("alphamanual.audacityteam.org");
|
||||
@ -248,8 +249,8 @@ void HelpSystem::ShowHelp(wxWindow *parent,
|
||||
// these next lines are for legacy cfg files (pre 2.0) where we had different modes
|
||||
if( (HelpMode == wxT("Standard")) || (HelpMode == wxT("InBrowser")) )
|
||||
{
|
||||
HelpMode = wxT("Local");
|
||||
gPrefs->Write(wxT("/GUI/Help"), HelpMode);
|
||||
HelpMode = GUIManualLocation.Default().Internal();
|
||||
GUIManualLocation.Write(HelpMode);
|
||||
gPrefs->Flush();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user