Audacity  3.0.3
Classes | Namespaces | Typedefs | Functions | Variables
Prefs.cpp File Reference

Utility functions for working with our wxConf (gPrefs) More...

#include "Prefs.h"
#include <wx/defs.h>
#include <wx/app.h>
#include <wx/intl.h>
#include <wx/filename.h>
#include <wx/stdpaths.h>
#include "Internat.h"
#include "MemoryX.h"
#include <set>
Include dependency graph for Prefs.cpp:

Go to the source code of this file.

Classes

struct  PrefsListener::Impl
 

Namespaces

 anonymous_namespace{Prefs.cpp}
 

Typedefs

using anonymous_namespace{Prefs.cpp}::PreferenceInitializers = std::set< PreferenceInitializer * >
 

Functions

 wxDEFINE_EVENT (EVT_PREFS_UPDATE, wxCommandEvent)
 
void InitPreferences (std::unique_ptr< FileConfig > uPrefs)
 
void FinishPreferences ()
 
wxString WarningDialogKey (const wxString &internalDialogName)
 
PreferenceInitializers & anonymous_namespace{Prefs.cpp}::allInitializers ()
 

Variables

std::unique_ptr< FileConfigugPrefs {}
 
FileConfiggPrefs = nullptr
 
int gMenusDirty = 0
 
ByColumns_t ByColumns {}
 

Detailed Description

Utility functions for working with our wxConf (gPrefs)

Audacity uses wxWidgets' wxConfig class to handle preferences. See Prefs.h for more information on how it works...

  Note: The info below is very outdated and incomplete

  Preference field specification:
   /
      Version              - Audacity Version that created these prefs
      DefaultOpenPath         - Default directory for NEW file selector
   /FileFormats
      CopyOrEditUncompressedData - Copy data from uncompressed files or
         [ "copy", "edit"]   - edit in place?
      ExportFormat_SF1        - Format to export PCM data in
                             (this number is a libsndfile1.0 format)
   /SamplingRate
      DefaultProjectSampleRate- New projects will have this rate
         [ 8000, 11025, 16000, 22050, 44100, 48000 ]
   /AudioIO
      PlaybackDevice       - device to use for playback
      RecordingDevice         - device to use for recording
         (these are device names understood by PortAudio)
   /Display
      WaveformColor        - 0xRRGGBB  --since it will be stored in
      ShadowColor          -          decimal, it will be somewhat
      SpectrumLowColor     -          non-intuitive to edit, but
      SpectrumHighColor    -          much easier to parse.
   /Locale
      Language          - two-letter language code for translations

   (*): wxGTK
   (+): wxWin
   ($): wxMac

Definition in file Prefs.cpp.

Function Documentation

◆ FinishPreferences()

void FinishPreferences ( )

Definition at line 181 of file Prefs.cpp.

182 {
183  if (gPrefs) {
184  wxConfigBase::Set(NULL);
185  ugPrefs.reset();
186  gPrefs = NULL;
187  }
188 }

References gPrefs, and ugPrefs.

Referenced by AudacityApp::InitPart2(), AudacityApp::OnExit(), and AudacityApp::OnInit().

Here is the caller graph for this function:

◆ InitPreferences()

void InitPreferences ( std::unique_ptr< FileConfig uPrefs)

Definition at line 174 of file Prefs.cpp.

175 {
176  gPrefs = uPrefs.get();
177  ugPrefs = std::move(uPrefs);
178  wxConfigBase::Set(gPrefs);
179 }

References gPrefs, and ugPrefs.

Referenced by AudacityApp::OnInit().

Here is the caller graph for this function:

◆ WarningDialogKey()

wxString WarningDialogKey ( const wxString &  internalDialogName)

Return the config file key associated with a warning dialog identified by internalDialogName. When the box is checked, the value at the key becomes false.

Definition at line 368 of file Prefs.cpp.

369 {
370  return wxT("/Warnings/") + internalDialogName;
371 }

Referenced by RecordingPrefs::PopulateOrExchange(), ShowWarningDialog(), and AudioIO::StartStream().

Here is the caller graph for this function:

◆ wxDEFINE_EVENT()

wxDEFINE_EVENT ( EVT_PREFS_UPDATE  ,
wxCommandEvent   
)

Variable Documentation

◆ ByColumns

ByColumns_t ByColumns {}

◆ gMenusDirty

int gMenusDirty = 0

Definition at line 68 of file Prefs.cpp.

◆ gPrefs

FileConfig* gPrefs = nullptr

Definition at line 67 of file Prefs.cpp.

Referenced by anonymous_namespace{PluginMenus.cpp}::AddEffectMenuItemGroup(), AdornedRulerPanel::AdornedRulerPanel(), EffectTruncSilence::Analyze(), GetPreferenceCommand::Apply(), SetPreferenceCommand::Apply(), MacroCommands::ApplyMacro(), ApplyMacroDialog::ApplyMacroToProject(), ProjectSelectionManager::AS_SetSelectionFormat(), ProjectSelectionManager::AS_SetSnapTo(), ProgressDialog::Beep(), ScreenshotCommand::CapturePreferences(), DeviceToolBar::ChangeDevice(), DeviceToolBar::ChangeHost(), ExportMP3::CheckFileName(), ProjectAudioManager::ChooseExistingRecordingTracks(), DevicePrefs::Commit(), GUIPrefs::Commit(), KeyConfigPrefs::Commit(), QualityPrefs::Commit(), RecordingPrefs::Commit(), TracksPrefs::Commit(), LabelTrackView::ComputeLayout(), ControlToolBar::ControlToolBar(), anonymous_namespace{LabelMenus.cpp}::DoAddLabel(), LabelTrackView::DoCaptureKey(), LabelTrackView::DoChar(), Exporter::DoEditMetadata(), anonymous_namespace{FileMenus.cpp}::DoImport(), ProjectAudioManager::DoRecord(), WaveTrackVZoomHandle::DoRelease(), SpectrumView::DoSetMinimized(), WaveformView::DoSetMinimized(), SpectrumVZoomHandle::DoZoom(), Effect::Effect(), EffectNoiseRemoval::EffectNoiseRemoval(), EVT_COMMAND_RANGE(), Exporter::ExamineTracks(), ExportFFmpeg::Export(), ExportMP3::Export(), ExportOGG::Export(), ExportFFmpegOptions::ExportFFmpegOptions(), ExportMultipleDialog::ExportMultipleByLabel(), ExportMultipleDialog::ExportMultipleByTrack(), ExportOGGOptions::ExportOGGOptions(), anonymous_namespace{ExtraMenus.cpp}::ExtraMenu(), FFmpegLibs::FFmpegLibs(), FFmpegStartup(), DeviceToolBar::FillHostDevices(), DeviceToolBar::FillInputChannels(), MP3Exporter::FindLibrary(), FFmpegLibs::FindLibs(), FinishPreferences(), EditToolBar::ForAllButtons(), anonymous_namespace{Registry.cpp}::ItemOrdering::Get(), ModulePrefs::GetAllModuleStatuses(), TracksPrefs::GetDefaultAudioTrackNamePreference(), AudioIOBase::GetDeviceInfo(), GetEditClipsCanMove(), ProjectManager::GetEstimatedRecordingMinsLeftOnDisk(), Exporter::GetFilename(), PluginManager::GetFirstPlugin(), PluginManager::GetFirstPluginForEffectType(), ModulePrefs::GetModuleStatus(), PluginManager::GetNextPlugin(), PluginManager::GetNextPluginForEffectType(), GetNextWindowPlacement(), TracksPrefs::GetPinnedHeadPositionPreference(), TracksPrefs::GetPinnedHeadPreference(), AudioIOBase::getPlayDevIndex(), GlobalPrefsDialog::GetPreferredPage(), AudioIOBase::getRecordDevIndex(), ExportCL::GetSettings(), AudioIOBase::GetSupportedCaptureRates(), PlaybackPrefs::GetUnpinnedScrubbingPreference(), FileHistory::Global(), AudioIOBase::HandleDeviceChange(), NoteTrackVZoomHandle::HitPreview(), WaveTrackVZoomHandle::HitPreview(), Importer::Import(), AudioIO::Init(), EffectNoiseRemoval::Init(), ExportFFmpeg::InitCodecs(), GUIPrefs::InitLang(), AudacityApp::InitPart2(), InitPreferences(), anonymous_namespace{NoteTrackVZoomHandle.cpp}::IsDragZooming(), WaveTrackVZoomHandle::IsDragZooming(), EffectEqualization::LoadCurves(), Tags::LoadDefaults(), LoadEncoding(), LoadFFmpeg(), LoadOtherFormat(), SpectrogramSettings::Globals::LoadPrefs(), SpectrogramSettings::LoadPrefs(), WaveformSettings::LoadPrefs(), ToolBar::MakeButtonBackgroundsLarge(), ToolBar::MakeButtonBackgroundsSmall(), CommandManager::Options::MakeCheckFn(), EnumSettingBase::Migrate(), TracksViewModeEnumSetting::Migrate(), MenuManager::ModifyToolbarMenus(), MP3Exporter::MP3Exporter(), CommandManager::NewIdentifier(), FileHistory::NotifyMenus(), ViewActions::Handler::OnAdvancedVZoom(), TrackActions::Handler::OnAlign(), ApplyMacroDialog::OnApplyToFiles(), AdornedRulerPanel::OnAutoScroll(), PrefsDialog::OnCancel(), DeviceToolBar::OnChoice(), ScreenshotBigDialog::OnClose(), BrowserDialog::OnClose(), FrequencyPlotDialog::OnCloseButton(), ScreenshotBigDialog::OnCloseWindow(), EditActions::Handler::OnCut(), LabelEditActions::Handler::OnCutLabels(), ScreenshotBigDialog::OnDirChoose(), SplashDialog::OnDontShow(), TagsEditorDialog::OnDontShow(), AudacityApp::OnExit(), ExportMultipleDialog::OnExport(), ExportFFmpegOptions::OnExportPresets(), EffectUIHost::OnFFwd(), KeyConfigPrefs::OnImportDefaults(), ExportFFmpegOptions::OnImportPresets(), ExportMP3Options::OnMono(), TrackActions::Handler::OnMoveSelectionWithTracks(), PrefsDialog::OnOK(), ExportFFmpegOptions::OnOK(), SoundActivatedRecordDialog::OnOK(), TagsEditorDialog::OnOk(), TimerRecordDialog::OnOK(), FFmpegNotFoundDialog::OnOk(), TransportActions::Handler::OnPlayAfterSelectionEnd(), TransportActions::Handler::OnPlayAfterSelectionStart(), TransportActions::Handler::OnPlayBeforeAndAfterSelectionEnd(), TransportActions::Handler::OnPlayBeforeAndAfterSelectionStart(), TransportActions::Handler::OnPlayBeforeSelectionEnd(), TransportActions::Handler::OnPlayBeforeSelectionStart(), MeterPanel::OnPreferences(), ProjectAudioManager::OnRecord(), FrequencyPlotDialog::OnReplot(), PluginActions::Handler::OnResetConfig(), EffectUIHost::OnRewind(), BenchmarkDialog::OnRun(), TagsEditorDialog::OnSaveDefaults(), LabelTrackMenuTable::OnSetFont(), ViewActions::Handler::OnShowClipping(), ViewActions::Handler::OnShowExtraMenus(), ViewActions::Handler::OnShowNameOverlay(), TrackActions::Handler::OnSyncLock(), AdornedRulerPanel::OnSyncSelToQuickPlay(), DirectoriesPrefs::OnTempBrowse(), TransportActions::Handler::OnTimerRecord(), TransportActions::Handler::OnTogglePlayRecording(), AdornedRulerPanel::OnToggleQuickPlay(), TransportActions::Handler::OnToggleSoundActivated(), TransportActions::Handler::OnToggleSWPlaythrough(), LabelEditActions::Handler::OnToggleTypeToCreateLabel(), ToolsToolBar::OnTool(), FFmpegImportPlugin::Open(), Registry::OrderingPreferenceInitializer::operator()(), TranscriptionToolBar::PlayAtSpeed(), ProjectAudioManager::PlayPlayRegion(), ApplyMacroDialog::Populate(), MacrosWindow::Populate(), FrequencyPlotDialog::Populate(), DevicePrefs::Populate(), QualityPrefs::Populate(), ControlToolBar::Populate(), SplashDialog::Populate(), ExportFFmpegOptions::PopulateOrExchange(), ExportMP3Options::PopulateOrExchange(), ExportMultipleDialog::PopulateOrExchange(), FFmpegNotFoundDialog::PopulateOrExchange(), anonymous_namespace{HelpMenus.cpp}::QuickFixDialog::PopulateOrExchange(), ScreenshotBigDialog::PopulateOrExchange(), SoundActivatedRecordDialog::PopulateOrExchange(), TagsEditorDialog::PopulateOrExchange(), TimerRecordDialog::PopulateOrExchange(), RecordingPrefs::PopulateOrExchange(), anonymous_namespace{AudacityApp.cpp}::PopulatePreferences(), PrefsDialog::PrefsDialog(), EffectNoiseReduction::Settings::PrefsIO(), Effect::Preview(), NyquistEffect::Process(), Exporter::Process(), EffectPaulstretch::ProcessOne(), Effect::ProcessTrack(), ToolBarConfiguration::Read(), ToolManager::ReadConfig(), ThemeBase::ReadImageCache(), Importer::ReadImportItems(), anonymous_namespace{NoiseReduction.cpp}::readPrefs(), LabelDialog::ReadSize(), ChoiceSetting::ReadWithDefault(), RecordingPrefs::RecordingPrefs(), ControlToolBar::RegenerateTooltips(), LabelStruct::RegionRelation(), NoteTrackVZoomHandle::Release(), CommandManager::RemoveDuplicateShortcuts(), MacroCommands::ReportAndSkip(), LabelTrackView::ResetFont(), MacrosWindow::SaveChanges(), SaveEncoding(), DependencyDialog::SaveFutureActionChoice(), SaveOtherFormat(), GlobalPrefsDialog::SavePreferredPage(), SpectrogramSettings::Globals::SavePrefs(), SpectrogramSettings::SavePrefs(), ProjectManager::SaveWindowSize(), SelectUtilities::SelectAllIfNoneAndAllowed(), Importer::SelectDefaultOpenType(), SelectionBar::SelectionBar(), SelectionBar::SelectionModeUpdated(), ToolsToolBar::SetCurrentTool(), Importer::SetDefaultOpenType(), DeviceToolBar::SetDevices(), GUIPrefs::SetLang(), Importer::SetLastOpenType(), CommandManager::SetMaxList(), ModulePrefs::SetModuleStatus(), ExportMP3::SetNumExportChannels(), TracksPrefs::SetPinnedHeadPositionPreference(), TracksPrefs::SetPinnedHeadPreference(), FrequencyPlotDialog::Show(), HelpSystem::ShowHelp(), EffectNoiseRemoval::ShowInterface(), ShowWarningDialog(), ProjectSelectionManager::SSBL_SetBandwidthSelectionFormatName(), ProjectSelectionManager::SSBL_SetFrequencySelectionFormatName(), AudioIO::StartMonitoring(), AudioIO::StartPortAudioStream(), ControlToolBar::StartScrolling(), AudioIO::StartStream(), EffectAutoDuck::Startup(), EffectChangeSpeed::Startup(), EffectClickRemoval::Startup(), EffectCompressor::Startup(), EffectDtmf::Startup(), EffectEqualization::Startup(), EffectLoudness::Startup(), EffectNoise::Startup(), EffectNormalize::Startup(), EffectReverb::Startup(), EffectScienFilter::Startup(), EffectTruncSilence::Startup(), AudioIO::StopStream(), WaveTrack::SyncLockAdjust(), TagsEditorDialog::TagsEditorDialog(), TempDirectory::TempDir(), ShuttlePrefs::TransferBool(), ExportCLOptions::TransferDataFromWindow(), ExportFFmpegAC3Options::TransferDataFromWindow(), ExportFFmpegAACOptions::TransferDataFromWindow(), ExportFFmpegAMRNBOptions::TransferDataFromWindow(), ExportFFmpegOPUSOptions::TransferDataFromWindow(), ExportFFmpegWMAOptions::TransferDataFromWindow(), ExportFLACOptions::TransferDataFromWindow(), ExportMP3Options::TransferDataFromWindow(), ExportOGGOptions::TransferDataFromWindow(), TimerRecordDialog::TransferDataFromWindow(), ExportFFmpegCustomOptions::TransferDataToWindow(), ShuttlePrefs::TransferDouble(), ShuttlePrefs::TransferInt(), ShuttlePrefs::TransferString(), anonymous_namespace{TransportMenus.cpp}::TransportMenu(), ProjectSelectionManager::TT_SetAudioTimeFormat(), EffectEqualization::UpdateDefaultCurves(), AdornedRulerPanel::UpdatePrefs(), MenuManager::UpdatePrefs(), NavigationActions::Handler::UpdatePrefs(), SelectActions::Handler::UpdatePrefs(), SpectrogramSettings::UpdatePrefs(), WaveformSettings::UpdatePrefs(), ProjectSettings::UpdatePrefs(), ControlToolBar::UpdatePrefs(), DeviceToolBar::UpdatePrefs(), SelectionBar::UpdatePrefs(), TrackArtist::UpdatePrefs(), ViewInfo::UpdatePrefs(), MeterPanel::UpdatePrefs(), ZoomInfo::UpdatePrefs(), TrackArtist::UpdateSelectedPrefs(), ViewInfo::UpdateSelectedPrefs(), ProjectAudioManager::UseDuplex(), Registry::Visit(), anonymous_namespace{Registry.cpp}::VisitItems(), FileNames::WithDefaultPath(), ToolBarConfiguration::Write(), ChoiceSetting::Write(), ToolManager::WriteConfig(), Importer::WriteImportItems(), anonymous_namespace{NoiseReduction.cpp}::writePrefs(), and LabelDialog::WriteSize().

◆ ugPrefs

std::unique_ptr<FileConfig> ugPrefs {}

Definition at line 65 of file Prefs.cpp.

Referenced by FinishPreferences(), and InitPreferences().

gPrefs
FileConfig * gPrefs
Definition: Prefs.cpp:67
ugPrefs
std::unique_ptr< FileConfig > ugPrefs
Definition: Prefs.cpp:65