1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-25 15:53:52 +02:00

Locate and position the current Audacity source code, and clear a variety of old junk out of the way into junk-branches

This commit is contained in:
ra
2010-01-23 19:44:49 +00:00
commit e74978ba77
1011 changed files with 781704 additions and 0 deletions

131
src/prefs/BatchPrefs.cpp Normal file
View File

@@ -0,0 +1,131 @@
/**********************************************************************
Audacity: A Digital Audio Editor
BatchPrefs.cpp
Dominic Mazzoni
James Crook
*******************************************************************//**
\class BatchPrefs
\brief A PrefsPanel that builds up a chain of effects in BatchCommands
*//*******************************************************************/
#include "../Audacity.h"
#include <wx/defs.h>
#include <wx/intl.h>
#include <wx/textdlg.h>
#include "BatchPrefs.h"
#include "../Envelope.h"
#include "../Languages.h"
#include "../Prefs.h"
#include "../Project.h"
#include "../BatchCommandDialog.h"
#include "../ShuttleGui.h"
#include "../Menus.h"
#include "../toolbars/ToolManager.h"
#define ChainsListID 7005
#define AddButtonID 7006
#define RemoveButtonID 7007
#define CommandsListID 7008
#define ImportButtonID 7009
#define ExportButtonID 7010
#define DefaultsButtonID 7011
#define UpButtonID 7012
#define DownButtonID 7013
#define RenameButtonID 7014
BEGIN_EVENT_TABLE(BatchPrefs, wxPanel)
END_EVENT_TABLE()
enum { CleanSpeechID,
MP3ConversionID,
};
/// Constructor
BatchPrefs::BatchPrefs(wxWindow * parent):
PrefsPanel(parent, _("Batch"))
{
Populate();
}
/// Creates the dialog and its contents.
void BatchPrefs::Populate( )
{
//------------------------- Main section --------------------
// Now construct the GUI itself.
// Use 'eIsCreatingFromPrefs' so that the GUI is
// initialised with values from gPrefs.
ShuttleGui S(this, eIsCreatingFromPrefs);
PopulateOrExchange(S);
// ----------------------- End of main section --------------
}
/// Defines the dialog and does data exchange with it.
void BatchPrefs::PopulateOrExchange( ShuttleGui & S )
{
S.StartHorizontalLay( wxEXPAND, 0 );
S.SetBorder( 2 );
S.StartStatic( _("Behaviors"),1 );
{
#ifdef __WXDEBUG__
S.TieCheckBox( _("&Don't apply effects in batch mode"),
wxT("/Batch/Debug"), false);
#endif
S.TieCheckBox( _("Cl&eanSpeech Mode (Customized GUI)"),
wxT("/Batch/CleanSpeechMode"), false);
}
S.EndStatic();
S.EndHorizontalLay();
return;
}
// This commented out code might be useful as a first step if we want an immediate response to
// switching in and out of CleanSpeech mode.
// As things currently stand, the batch commands available will NOT reflect changes in
// CleanSpeech mode until we close and reopen the preferences dialog.
#if 0
int mode;
AudacityProject *proj = GetActiveProject();
mode = gPrefs->Read(wxT("/Batch/CleanSpeechMode"), 1L);
proj->GetControlToolBar()->SetCleanSpeechMode(mode == 1);
#endif
/// Send changed values back to Prefs, and update Audacity.
bool BatchPrefs::Apply()
{
ShuttleGui S( this, eIsSavingToPrefs );
PopulateOrExchange( S );
unsigned mode;
mode = gPrefs->Read(wxT("/Batch/CleanSpeechMode"), 1L);
for(unsigned i=0; i<gAudacityProjects.GetCount(); i++)
if(gAudacityProjects[i])
{
gAudacityProjects[i]->SetCleanSpeechMode(mode == 1);
gAudacityProjects[i]->mToolManager->LayoutToolBars(); // Just to add/remove the CleanSpeech button.
}
return true;
}
BatchPrefs::~BatchPrefs()
{
}
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
// arch-tag: 7e997d04-6b94-4abb-b3d6-748400f86598

48
src/prefs/BatchPrefs.h Normal file
View File

@@ -0,0 +1,48 @@
/**********************************************************************
Audacity: A Digital Audio Editor
BatchPrefs.h
Dominic Mazzoni
James Crook
**********************************************************************/
#ifndef __AUDACITY_BATCH_PREFS__
#define __AUDACITY_BATCH_PREFS__
#include <wx/defs.h>
#include <wx/window.h>
#include "../ShuttleGui.h"
#include "PrefsPanel.h"
class BatchPrefs : public PrefsPanel
{
public:
BatchPrefs(wxWindow * parent);
~BatchPrefs();
virtual bool Apply();
private:
void Populate();
void PopulateOrExchange(ShuttleGui & S);
DECLARE_EVENT_TABLE();
};
#endif
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
// arch-tag: 57018e2b-d264-4f93-bfa7-06752ebf631e

406
src/prefs/DevicePrefs.cpp Normal file
View File

@@ -0,0 +1,406 @@
/**********************************************************************
Audacity: A Digital Audio Editor
DevicePrefs.cpp
Joshua Haberman
Dominic Mazzoni
James Crook
*******************************************************************//**
\class DevicePrefs
\brief A PrefsPanel used to select recording and playback devices and
other settings.
Presents interface for user to select the recording device and
playback device, from the list of choices that PortAudio
makes available.
Also lets user decide how many channels to record.
*//********************************************************************/
#include "../Audacity.h"
#include <wx/defs.h>
#include <wx/choice.h>
#include <wx/intl.h>
#include <wx/log.h>
#include "portaudio.h"
#include "../AudioIO.h"
#include "../Internat.h"
#include "../Prefs.h"
#include "../ShuttleGui.h"
#include "DevicePrefs.h"
enum {
HostID = 10000,
PlayID,
RecordID,
ChannelsID
};
BEGIN_EVENT_TABLE(DevicePrefs, PrefsPanel)
EVT_CHOICE(HostID, DevicePrefs::OnHost)
EVT_CHOICE(RecordID, DevicePrefs::OnDevice)
END_EVENT_TABLE()
DevicePrefs::DevicePrefs(wxWindow * parent)
: PrefsPanel(parent, _("Devices"))
{
Populate();
}
DevicePrefs::~DevicePrefs()
{
}
void DevicePrefs::Populate()
{
// First any pre-processing for constructing the GUI.
GetNamesAndLabels();
// Get current setting for devices
mPlayDevice = gPrefs->Read(wxT("/AudioIO/PlaybackDevice"), wxT(""));
mRecordDevice = gPrefs->Read(wxT("/AudioIO/RecordingDevice"), wxT(""));
mRecordChannels = gPrefs->Read(wxT("/AudioIO/RecordChannels"), 2L);
//------------------------- Main section --------------------
// Now construct the GUI itself.
// Use 'eIsCreatingFromPrefs' so that the GUI is
// initialised with values from gPrefs.
ShuttleGui S(this, eIsCreatingFromPrefs);
PopulateOrExchange(S);
// ----------------------- End of main section --------------
wxCommandEvent e;
OnHost(e);
}
void DevicePrefs::GetNamesAndLabels()
{
// Gather list of hosts. Only added hosts that have devices attached.
int nDevices = Pa_GetDeviceCount();
for (int i = 0; i < nDevices; i++) {
const PaDeviceInfo *info = Pa_GetDeviceInfo(i);
if (info->maxOutputChannels > 0 || info->maxInputChannels > 0) {
wxString name(Pa_GetHostApiInfo(info->hostApi)->name, wxConvLocal);
if (mHostNames.Index(name) == wxNOT_FOUND) {
mHostNames.Add(name);
mHostLabels.Add(name);
}
}
}
}
void DevicePrefs::PopulateOrExchange(ShuttleGui & S)
{
wxArrayString empty;
S.SetBorder(2);
S.StartStatic(_("Interface"));
{
S.StartMultiColumn(2);
{
S.Id(HostID);
mHost = S.TieChoice(_("&Host") + wxString(wxT(":")),
wxT("/AudioIO/Host"),
wxT(""),
mHostNames,
mHostLabels);
S.SetSizeHints(mHostNames);
S.AddPrompt(_("Using:"));
S.AddFixedText(wxString(Pa_GetVersionText(), wxConvLocal));
}
S.EndMultiColumn();
}
S.EndStatic();
S.StartStatic(_("Playback"));
{
S.StartMultiColumn(2);
{
S.Id(PlayID);
mPlay = S.AddChoice(_("&Device") + wxString(wxT(":")),
wxEmptyString,
&empty);
}
S.EndMultiColumn();
}
S.EndStatic();
S.StartStatic(_("Recording"));
{
S.StartMultiColumn(2);
{
S.Id(RecordID);
mRecord = S.AddChoice(_("De&vice") + wxString(wxT(":")),
wxEmptyString,
&empty);
S.Id(ChannelsID);
mChannels = S.AddChoice(_("Cha&nnels") + wxString(wxT(":")),
wxEmptyString,
&empty);
}
S.EndMultiColumn();
}
S.EndStatic();
}
void DevicePrefs::OnHost(wxCommandEvent & e)
{
// Bail if we have no hosts
if (mHostNames.size() < 1)
return;
// Find the index for the host API selected
int index = -1;
wxString apiName = mHostNames[mHost->GetCurrentSelection()];
int nHosts = Pa_GetHostApiCount();
for (int i = 0; i < nHosts; ++i) {
wxString name(Pa_GetHostApiInfo(i)->name, wxConvLocal);
if (name == apiName) {
index = i;
break;
}
}
// We should always find the host!
if (index < 0) {
wxLogDebug(wxT("DevicePrefs::OnHost(): API index not found"));
return;
}
int nDevices = Pa_GetDeviceCount();
if (nDevices == 0) {
mHost->Clear();
mHost->Append(_("No audio interfaces"), (void *) NULL);
mHost->SetSelection(0);
}
mPlay->Clear();
mRecord->Clear();
wxArrayString playnames;
wxArrayString recordnames;
int devindex; /* temp variable to hold the numeric ID of each device in turn */
for (int i = 0; i < nDevices; i++) {
const PaDeviceInfo *info = Pa_GetDeviceInfo(i);
if (info->hostApi == index) { /* if the device is for the current HostAPI */
wxString name(info->name, wxConvLocal);
wxString device = DeviceName(info);
if (info->maxOutputChannels > 0) {
playnames.Add(name);
devindex = mPlay->Append(name, (void *) info);
if (device == mPlayDevice) { /* if this is the default device, select it */
mPlay->SetSelection(devindex);
}
}
if (info->maxInputChannels > 0) {
recordnames.Add(name);
devindex = mRecord->Append(name, (void *) info);
if (device == mRecordDevice) {
mRecord->SetSelection(devindex);
}
}
}
}
/* deal with not having any devices at all */
if (mPlay->GetCount() == 0) {
playnames.Add(_("No devices found"));
mPlay->Append(playnames[0], (void *) NULL);
mPlay->SetSelection(0);
}
if (mRecord->GetCount() == 0) {
recordnames.Add(_("No devices found"));
mRecord->Append(recordnames[0], (void *) NULL);
mRecord->SetSelection(0);
}
/* what if we have no device selected? we should choose the default on
* this API, as defined by PortAudio. We then fall back to using 0 only if
* that fails */
if (mPlay->GetCount() && mPlay->GetSelection() == wxNOT_FOUND) {
wxLogDebug(wxT("DevicePrefs::OnHost(): no play device selected"));
mPlay->SetStringSelection(GetDefaultPlayDevice(index));
if (mPlay->GetSelection() == wxNOT_FOUND) {
mPlay->SetSelection(0);
}
}
if (mRecord->GetCount() && mRecord->GetSelection() == wxNOT_FOUND) {
wxLogDebug(wxT("DevicePrefs::OnHost(): no record device selected"));
mRecord->SetStringSelection(GetDefaultRecordDevice(index));
if (mPlay->GetSelection() == wxNOT_FOUND) {
mPlay->SetSelection(0);
}
}
ShuttleGui S(this, eIsCreating);
S.SetSizeHints(mPlay, playnames);
S.SetSizeHints(mRecord, recordnames);
OnDevice(e);
}
void DevicePrefs::OnDevice(wxCommandEvent & e)
{
int ndx = mRecord->GetCurrentSelection();
if (ndx == wxNOT_FOUND) {
ndx = 0;
}
int sel = mChannels->GetSelection();
int cnt = 0;
const PaDeviceInfo *info = (const PaDeviceInfo *) mRecord->GetClientData(ndx);
if (info != NULL) {
cnt = info->maxInputChannels;
}
if (sel != wxNOT_FOUND) {
mRecordChannels = sel + 1;
}
mChannels->Clear();
// Mimic old behavior
if (cnt <= 0) {
cnt = 16;
}
// Place an artifical limit on the number of channels to prevent an
// outrageous number. I don't know if this is really necessary, but
// it doesn't hurt.
if (cnt > 256) {
cnt = 256;
}
wxArrayString channelnames;
// Channel counts, mono, stereo etc...
for (int i = 0; i < cnt; i++) {
wxString name;
if (i == 0) {
name = _("1 (Mono)");
}
else if (i == 1) {
name = _("2 (Stereo)");
}
else {
name = wxString::Format(wxT("%d"), i + 1);
}
channelnames.Add(name);
int index = mChannels->Append(name);
if (i == mRecordChannels - 1) {
mChannels->SetSelection(index);
}
}
if (mChannels->GetCount() && mChannels->GetCurrentSelection() == wxNOT_FOUND) {
mChannels->SetSelection(0);
}
ShuttleGui S(this, eIsCreating);
S.SetSizeHints(mChannels, channelnames);
Layout();
}
wxString DevicePrefs::GetDefaultPlayDevice(int index)
{
if (index < 0 || index >= Pa_GetHostApiCount()) {
return wxEmptyString;
}
const struct PaHostApiInfo *apiinfo = Pa_GetHostApiInfo(index); // get info on API
wxLogDebug(wxT("GetDefaultPlayDevice(): HostAPI index %d, name %s"), index, wxString(apiinfo->name, wxConvLocal).c_str());
wxLogDebug(wxT("GetDefaultPlayDevice() default output %d"), apiinfo->defaultOutputDevice);
const PaDeviceInfo* devinfo = Pa_GetDeviceInfo(apiinfo->defaultOutputDevice);
if (devinfo == NULL) {
wxLogDebug(wxT("GetDefaultPlayDevice() no default output device"));
return wxString("", wxConvLocal);
}
wxString name(devinfo->name, wxConvLocal);
wxLogDebug(wxT("GetDefaultPlayDevice() default output device name %s"), name.c_str());
return name;
}
wxString DevicePrefs::GetDefaultRecordDevice(int index)
{
if (index < 0 || index >= Pa_GetHostApiCount()) {
return wxEmptyString;
}
const struct PaHostApiInfo *apiinfo = Pa_GetHostApiInfo(index); // get info on API
wxLogDebug(wxT("GetDefaultRecordDevice(): HostAPI index %d, name %s"), index, wxString(apiinfo->name, wxConvLocal).c_str());
wxLogDebug(wxT("GetDefaultRecordDevice() default input %d"), apiinfo->defaultInputDevice);
const PaDeviceInfo* devinfo = Pa_GetDeviceInfo(apiinfo->defaultInputDevice);
if (devinfo == NULL) {
wxLogDebug(wxT("GetDefaultRecordDevice() no default input device"));
return wxString("", wxConvLocal);
}
wxString name(devinfo->name, wxConvLocal);
wxLogDebug(wxT("GetDefaultRecordDevice() default input device name %s"), name.c_str());
return name;
}
bool DevicePrefs::Apply()
{
ShuttleGui S(this, eIsSavingToPrefs);
PopulateOrExchange(S);
const PaDeviceInfo *info = NULL;
if (mPlay->GetCount() > 0) {
info = (const PaDeviceInfo *) mPlay->GetClientData(
mPlay->GetSelection());
}
if (info) {
gPrefs->Write(wxT("/AudioIO/PlaybackDevice"),
DeviceName(info));
}
info = NULL;
if (mRecord->GetCount() > 0) {
info = (const PaDeviceInfo *) mRecord->GetClientData(mRecord->GetSelection());
}
if (info) {
gPrefs->Write(wxT("/AudioIO/RecordingDevice"),
DeviceName(info));
gPrefs->Write(wxT("/AudioIO/RecordChannels"),
mChannels->GetSelection() + 1);
}
return true;
}
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
// arch-tag: d6904b91-a320-4194-8d60-caa9175b6bb4

78
src/prefs/DevicePrefs.h Normal file
View File

@@ -0,0 +1,78 @@
/**********************************************************************
Audacity: A Digital Audio Editor
DevicePrefs.h
Joshua Haberman
James Crook
**********************************************************************/
#ifndef __AUDACITY_DEVICE_PREFS__
#define __AUDACITY_DEVICE_PREFS__
#include <wx/defs.h>
#include <wx/choice.h>
#include <wx/string.h>
#include <wx/window.h>
#include <wx/dynarray.h>
#include "../ShuttleGui.h"
#include "PrefsPanel.h"
class DevicePrefs:public PrefsPanel
{
public:
DevicePrefs(wxWindow * parent);
virtual ~DevicePrefs();
virtual bool Apply();
private:
void Populate();
void PopulateOrExchange(ShuttleGui & S);
void GetNamesAndLabels();
void OnHost(wxCommandEvent & e);
void OnDevice(wxCommandEvent & e);
/* @return The default playback device name for the selected HostAPI
*
* Created so we can set a default that respects the user's choice of API,
* unlike Pa_GetDefaultOutputDevice() which always returns the default
* device in the default API.
* @param index Which HostAPI in the lists mHostNames / mHostIndexes /
* mHostLabels the user has selected.
*/
wxString GetDefaultPlayDevice(int index);
wxString GetDefaultRecordDevice(int index);
wxArrayString mHostNames;
wxArrayString mHostLabels;
wxString mPlayDevice;
wxString mRecordDevice;
long mRecordChannels;
wxChoice *mHost;
wxChoice *mPlay;
wxChoice *mRecord;
wxChoice *mChannels;
DECLARE_EVENT_TABLE();
};
#endif
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
// arch-tag: df22b108-e989-4ec4-a8b6-dddbcc7be6a7

View File

@@ -0,0 +1,233 @@
/**********************************************************************
Audacity: A Digital Audio Editor
DirectoriesPrefs.cpp
Joshua Haberman
James Crook
*******************************************************************//**
\class DirectoriesPrefs
\brief A PrefsPanel used to select directories.
*//*******************************************************************/
#include "../Audacity.h"
#include <math.h>
#include <wx/defs.h>
#include <wx/intl.h>
#include <wx/log.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/button.h>
#include <wx/dirdlg.h>
#include <wx/event.h>
#include <wx/filefn.h>
#include <wx/filename.h>
#include <wx/msgdlg.h>
#include <wx/utils.h>
#include "../Prefs.h"
#include "../AudacityApp.h"
#include "../Internat.h"
#include "../ShuttleGui.h"
#include "DirectoriesPrefs.h"
enum {
TempDirID = 1000,
ChooseButtonID
};
BEGIN_EVENT_TABLE(DirectoriesPrefs, PrefsPanel)
EVT_TEXT(TempDirID, DirectoriesPrefs::UpdateFreeSpace)
EVT_BUTTON(ChooseButtonID, DirectoriesPrefs::OnChooseTempDir)
END_EVENT_TABLE()
DirectoriesPrefs::DirectoriesPrefs(wxWindow * parent)
: PrefsPanel(parent, _("Directories")),
mTempDir(NULL),
mFreeSpace(NULL)
{
Populate();
}
DirectoriesPrefs::~DirectoriesPrefs()
{
}
/// Creates the dialog and its contents.
void DirectoriesPrefs::Populate()
{
//------------------------- Main section --------------------
// Now construct the GUI itself.
// Use 'eIsCreatingFromPrefs' so that the GUI is
// initialised with values from gPrefs.
ShuttleGui S(this, eIsCreatingFromPrefs);
PopulateOrExchange(S);
// ----------------------- End of main section --------------
wxCommandEvent e;
UpdateFreeSpace(e);
}
void DirectoriesPrefs::PopulateOrExchange(ShuttleGui & S)
{
S.SetBorder(2);
S.StartStatic(_("Temporary files directory"));
{
S.StartMultiColumn(3, wxEXPAND);
{
S.SetStretchyCol(1);
S.Id(TempDirID);
mTempDir = S.TieTextBox(_("&Location:"),
wxT("/Directories/TempDir"),
wxT(""),
30);
S.Id(ChooseButtonID);
S.AddButton(_("C&hoose..."));
S.AddFixedText(_("Free Space:"));
mFreeSpace = S.AddVariableText(wxT(""));
}
S.EndMultiColumn();
}
S.EndStatic();
S.StartStatic(_("Audio cache"));
{
S.TieCheckBox(_("Play and/or record using &RAM (useful for slow drives)"),
wxT("/Directories/CacheBlockFiles"),
false);
S.StartTwoColumn();
{
S.TieTextBox(_("Mi&nimum Free Memory (MB):"),
wxT("/Directories/CacheLowMem"),
16,
9);
}
S.EndTwoColumn();
S.AddVariableText(_("If the available system memory falls below this value, audio will no longer\nbe cached in memory and will be written to disk."))->Wrap(600);
}
S.EndStatic();
}
void DirectoriesPrefs::OnChooseTempDir(wxCommandEvent & e)
{
wxDirDialog dlog(this,
_("Choose a location to place the temporary directory"),
gPrefs->Read(wxT("/Directories/TempDir"),
wxGetApp().defaultTempDir));
dlog.ShowModal();
if (dlog.GetPath() != wxT("")) {
wxFileName tmpDirPath;
tmpDirPath.AssignDir(dlog.GetPath());
#if defined(__WXMSW__) || defined(__WXMAC__)
tmpDirPath.AppendDir(wxT("audacity_temp"));
#else
tmpDirPath.AppendDir(wxT(".audacity_temp"));
#endif
mTempDir->SetValue(tmpDirPath.GetPath(wxPATH_GET_VOLUME|wxPATH_GET_SEPARATOR));
UpdateFreeSpace(e);
}
}
void DirectoriesPrefs::UpdateFreeSpace(wxCommandEvent & e)
{
wxString tempDir;
wxString label;
if (mTempDir != NULL) {
tempDir = mTempDir->GetValue();
}
if (wxDirExists(tempDir)) {
wxLongLong space;
wxGetDiskSpace(tempDir, NULL, &space);
label = Internat::FormatSize(space);
}
else {
label = _("unavailable - above location doesn't exist");
}
if( mFreeSpace != NULL ) {
mFreeSpace->SetLabel(label);
}
}
bool DirectoriesPrefs::Validate()
{
wxFileName tempDir;
tempDir.SetPath(mTempDir->GetValue());
if (!tempDir.DirExists()) {
int ans = wxMessageBox(
wxString::Format(_("Directory %s does not exist. Create it?"),
tempDir.GetPath().c_str()),
_("New Temporary Directory"),
wxYES_NO | wxCENTRE | wxICON_EXCLAMATION);
if (ans != wxYES) {
return false;
}
if (!tempDir.Mkdir(0755, wxPATH_MKDIR_FULL)) {
/* wxWidgets throws up a decent looking dialog */
return false;
}
}
else {
/* If the directory already exists, make sure it is writable */
wxLogNull logNo;
tempDir.AppendDir(wxT("canicreate"));
if (!tempDir.Mkdir(0755)) {
wxMessageBox(
wxString::Format(_("Directory %s is not writable"),
tempDir.GetPath().c_str()),
_("Error"),
wxOK | wxICON_ERROR);
return false;
}
tempDir.Rmdir();
tempDir.RemoveLastDir();
}
wxFileName oldDir;
oldDir.SetPath(gPrefs->Read(wxT("/Directories/TempDir")));
if (tempDir != oldDir) {
wxMessageBox(
_("Changes to temporary directory will not take effect until Audacity is restarted"),
wxT("Temp Directory Update"),
wxOK | wxCENTRE | wxICON_INFORMATION);
}
return true;
}
bool DirectoriesPrefs::Apply()
{
ShuttleGui S(this, eIsSavingToPrefs);
PopulateOrExchange(S);
return true;
}
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
// arch-tag: b152d0c9-973a-44a2-a6ce-b4f6e79be37b

View File

@@ -0,0 +1,53 @@
/**********************************************************************
Audacity: A Digital Audio Editor
DirectoriesPrefs.h
Joshua Haberman
**********************************************************************/
#ifndef __AUDACITY_DIRECTORIES_PREFS__
#define __AUDACITY_DIRECTORIES_PREFS__
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include "../ShuttleGui.h"
#include "PrefsPanel.h"
class DirectoriesPrefs:public PrefsPanel
{
public:
DirectoriesPrefs(wxWindow * parent);
~DirectoriesPrefs();
virtual bool Apply();
virtual bool Validate();
private:
void Populate();
void PopulateOrExchange(ShuttleGui & S);
void UpdateFreeSpace(wxCommandEvent & e);
void OnChooseTempDir(wxCommandEvent & e);
wxStaticText *mFreeSpace;
wxTextCtrl *mTempDir;
DECLARE_EVENT_TABLE();
};
#endif
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
// arch-tag: f9f9d986-cc0f-4cd9-9589-7743d9f2c6d8

146
src/prefs/EffectsPrefs.cpp Normal file
View File

@@ -0,0 +1,146 @@
/**********************************************************************
Audacity: A Digital Audio Editor
EffectsPrefs.cpp
Brian Gunlogson
Joshua Haberman
Dominic Mazzoni
James Crook
*******************************************************************//**
\class EffectsPrefs
\brief A PrefsPanel for general GUI prefernces.
*//*******************************************************************/
#include "../Audacity.h"
#include <wx/defs.h>
#include "../AudacityApp.h"
#include "../Languages.h"
#include "../Prefs.h"
#include "../ShuttleGui.h"
#include "EffectsPrefs.h"
EffectsPrefs::EffectsPrefs(wxWindow * parent)
: PrefsPanel(parent, _("Effects"))
{
Populate();
}
EffectsPrefs::~EffectsPrefs()
{
}
void EffectsPrefs::Populate()
{
//------------------------- Main section --------------------
// Now construct the GUI itself.
// Use 'eIsCreatingFromPrefs' so that the GUI is
// initialised with values from gPrefs.
ShuttleGui S(this, eIsCreatingFromPrefs);
PopulateOrExchange(S);
// ----------------------- End of main section --------------
}
void EffectsPrefs::PopulateOrExchange(ShuttleGui & S)
{
S.SetBorder(2);
S.StartStatic(_("Enable Effects"));
{
#if USE_AUDIO_UNITS
S.TieCheckBox(_("Audio Unit"),
wxT("/AudioUnits/Enable"),
true);
#endif
#if USE_LADSPA
S.TieCheckBox(_("&LADSPA"),
wxT("/Ladspa/Enable"),
true);
#endif
#if USE_NYQUIST
S.TieCheckBox(_("N&yquist"),
wxT("/Nyquist/Enable"),
true);
#endif
#if USE_VAMP
S.TieCheckBox(_("&VAMP"),
wxT("/VAMP/Enable"),
true);
#endif
#if USE_VST
S.TieCheckBox(_("V&ST"),
wxT("/VST/Enable"),
true);
#endif
S.AddFixedText(_("Restart Audacity to apply changes."));
}
S.EndStatic();
#if USE_AUDIO_UNITS
S.StartStatic(_("Audio Unit Effects"));
{
S.TieCheckBox(_("Display Audio Unit effects in graphical mode"),
wxT("/AudioUnits/GUI"),
true);
#if 0
S.TieCheckBox(_("Rescan VST effects next time Audacity is started"),
wxT("/VST/Rescan"),
false);
#endif
}
S.EndStatic();
#endif
#if USE_VST
S.StartStatic(_("VST Effects"));
{
S.TieCheckBox(_("&Display VST effects in graphical mode"),
wxT("/VST/GUI"),
true);
S.TieCheckBox(_("&Rescan VST effects next time Audacity is started"),
wxT("/VST/Rescan"),
false);
}
S.EndStatic();
#endif
}
bool EffectsPrefs::Apply()
{
ShuttleGui S(this, eIsSavingToPrefs);
PopulateOrExchange(S);
// If language has changed, we want to change it now, not on the next reboot.
wxString lang = gPrefs->Read(wxT("/Locale/Language"), wxT(""));
if (lang == wxT(""))
lang = GetSystemLanguageCode();
wxGetApp().InitLang(lang);
return true;
}
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
// arch-tag: 7e997d04-6b94-4abb-b3d6-748400f86598

48
src/prefs/EffectsPrefs.h Normal file
View File

@@ -0,0 +1,48 @@
/**********************************************************************
Audacity: A Digital Audio Editor
EffectsPrefs.h
Brian Gunlogson
Joshua Haberman
James Crook
**********************************************************************/
#ifndef __AUDACITY_EFFECTS_PREFS__
#define __AUDACITY_EFFECTS_PREFS__
#include <wx/defs.h>
#include <wx/arrstr.h>
#include <wx/window.h>
#include "../ShuttleGui.h"
#include "PrefsPanel.h"
class EffectsPrefs:public PrefsPanel
{
public:
EffectsPrefs(wxWindow * parent);
~EffectsPrefs();
virtual bool Apply();
private:
void Populate();
void PopulateOrExchange(ShuttleGui & S);
};
#endif
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
// arch-tag: 57018e2b-d264-4f93-bfa7-06752ebf631e

181
src/prefs/GUIPrefs.cpp Normal file
View File

@@ -0,0 +1,181 @@
/**********************************************************************
Audacity: A Digital Audio Editor
GUIPrefs.cpp
Brian Gunlogson
Joshua Haberman
Dominic Mazzoni
James Crook
*******************************************************************//**
\class GUIPrefs
\brief A PrefsPanel for general GUI preferences.
*//*******************************************************************/
#include "../Audacity.h"
#include <wx/defs.h>
#include "../AudacityApp.h"
#include "../Languages.h"
#include "../Prefs.h"
#include "../ShuttleGui.h"
#include "GUIPrefs.h"
GUIPrefs::GUIPrefs(wxWindow * parent)
: PrefsPanel(parent, _("Interface"))
{
Populate();
}
GUIPrefs::~GUIPrefs()
{
}
void GUIPrefs::Populate()
{
// First any pre-processing for constructing the GUI.
GetLanguages(mLangCodes, mLangNames);
mHtmlHelpCodes.Add(wxT("Local"));
mHtmlHelpCodes.Add(wxT("FromInternet"));
mHtmlHelpChoices.Add(_("Local"));
mHtmlHelpChoices.Add(_("From Internet"));
mRangeCodes.Add(_("36"));
mRangeCodes.Add(_("48"));
mRangeCodes.Add(_("60"));
mRangeCodes.Add(_("96"));
mRangeCodes.Add(_("120"));
mRangeCodes.Add(_("145"));
mRangeChoices.Add(_("-36 dB (shallow range for high-amplitude editing)"));
mRangeChoices.Add(_("-48 dB (PCM range of 8 bit samples)"));
mRangeChoices.Add(_("-60 dB (PCM range of 10 bit samples)"));
mRangeChoices.Add(_("-96 dB (PCM range of 16 bit samples)"));
mRangeChoices.Add(_("-120 dB (approximate limit of human hearing)"));
mRangeChoices.Add(_("-145 dB (PCM range of 24 bit samples)"));
#if 0
// only for testing...
mLangCodes.Add("kg"); mLangNames.Add("Klingon");
mLangCodes.Add("ep"); mLangNames.Add("Esperanto");
#endif
//------------------------- Main section --------------------
// Now construct the GUI itself.
// Use 'eIsCreatingFromPrefs' so that the GUI is
// initialised with values from gPrefs.
ShuttleGui S(this, eIsCreatingFromPrefs);
PopulateOrExchange(S);
// ----------------------- End of main section --------------
}
// Code duplication warning: this default is repeated in Project.cpp
// in the destructor. -DMM
#ifdef __WXMAC__
const bool bQuitOnCloseDefault = false;
#else
const bool bQuitOnCloseDefault = true;
#endif
// End code duplication warning
void GUIPrefs::PopulateOrExchange(ShuttleGui & S)
{
S.SetBorder(2);
S.StartStatic(_("Display"));
{
S.TieCheckBox(_("&Ergonomic order of audio I/O buttons"),
wxT("/GUI/ErgonomicTransportButtons"),
true);
S.TieCheckBox(_("S&how 'How to get Help' message at program start up"),
wxT("/GUI/ShowSplashScreen"),
true);
S.AddSpace(10);
S.StartMultiColumn(2);
{
S.TieChoice(_("Meter/Waveform dB &range:"),
wxT("/GUI/EnvdBRange"),
wxT("60"),
mRangeChoices,
mRangeCodes);
S.SetSizeHints(mRangeChoices);
S.TieChoice(_("&Language:"),
wxT("/Locale/Language"),
wxT(""),
mLangNames,
mLangCodes);
S.SetSizeHints(mLangNames);
S.TieChoice(_("Location of &Manual:"),
wxT("/GUI/Help"),
wxT("Local"),
mHtmlHelpChoices,
mHtmlHelpCodes);
S.SetSizeHints(mHtmlHelpChoices);
}
S.EndMultiColumn();
}
S.EndStatic();
S.StartStatic(_("Behaviors"));
{
S.TieCheckBox(_("Closing last window &quits Audacity"),
wxT("/GUI/QuitOnClose"),
bQuitOnCloseDefault);
S.TieCheckBox(_("&Beep on completion of longer activities"),
wxT("/GUI/BeepOnCompletion"),
false);
}
S.EndStatic();
S.StartStatic(_("Modes"));
{
S.TieCheckBox(_("Clea&nSpeech Mode (Customized GUI)"),
wxT("/Batch/CleanSpeechMode"),
false);
#ifdef __WXDEBUG__
S.TieCheckBox(_("Don't a&pply effects in batch mode"),
wxT("/Batch/Debug"),
false);
#endif
}
S.EndStatic();
}
bool GUIPrefs::Apply()
{
ShuttleGui S(this, eIsSavingToPrefs);
PopulateOrExchange(S);
// If language has changed, we want to change it now, not on the next reboot.
wxString lang = gPrefs->Read(wxT("/Locale/Language"), wxT(""));
if (lang == wxT(""))
lang = GetSystemLanguageCode();
wxGetApp().InitLang(lang);
return true;
}
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
// arch-tag: 7e997d04-6b94-4abb-b3d6-748400f86598

57
src/prefs/GUIPrefs.h Normal file
View File

@@ -0,0 +1,57 @@
/**********************************************************************
Audacity: A Digital Audio Editor
GUIPrefs.h
Brian Gunlogson
Joshua Haberman
James Crook
**********************************************************************/
#ifndef __AUDACITY_GUI_PREFS__
#define __AUDACITY_GUI_PREFS__
#include <wx/defs.h>
#include <wx/arrstr.h>
#include <wx/window.h>
#include "../ShuttleGui.h"
#include "PrefsPanel.h"
class GUIPrefs:public PrefsPanel
{
public:
GUIPrefs(wxWindow * parent);
~GUIPrefs();
virtual bool Apply();
private:
void Populate();
void PopulateOrExchange(ShuttleGui & S);
wxArrayString mLangCodes;
wxArrayString mLangNames;
wxArrayString mHtmlHelpCodes;
wxArrayString mHtmlHelpChoices;
wxArrayString mRangeCodes;
wxArrayString mRangeChoices;
};
#endif
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
// arch-tag: 57018e2b-d264-4f93-bfa7-06752ebf631e

View File

@@ -0,0 +1,107 @@
/**********************************************************************
Audacity: A Digital Audio Editor
ImportExportPrefs.cpp
Joshua Haberman
Dominic Mazzoni
James Crook
*******************************************************************//**
\class ImportExportPrefs
\brief A PrefsPanel used to select import and export options.
*//*******************************************************************/
#include "../Audacity.h"
#include <wx/defs.h>
#include "../Prefs.h"
#include "../ShuttleGui.h"
#include "ImportExportPrefs.h"
ImportExportPrefs::ImportExportPrefs(wxWindow * parent)
: PrefsPanel(parent, _("Import / Export"))
{
Populate();
}
ImportExportPrefs::~ImportExportPrefs()
{
}
/// Creates the dialog and its contents.
void ImportExportPrefs::Populate()
{
//------------------------- Main section --------------------
// Now construct the GUI itself.
// Use 'eIsCreatingFromPrefs' so that the GUI is
// initialised with values from gPrefs.
ShuttleGui S(this, eIsCreatingFromPrefs);
PopulateOrExchange(S);
// ----------------------- End of main section --------------
}
void ImportExportPrefs::PopulateOrExchange(ShuttleGui & S)
{
S.SetBorder(2);
S.StartStatic(_("When importing audio files"));
{
S.StartRadioButtonGroup(wxT("/FileFormats/CopyOrEditUncompressedData"), wxT("edit"));
{
S.TieRadioButton(_("&Make a copy of uncompressed audio files before editing (safer)"),
wxT("copy"));
S.TieRadioButton(_("&Read uncompressed audio files directly from the original (faster)"),
wxT("edit"));
}
S.EndRadioButtonGroup();
S.TieCheckBox(_("&Normalize all tracks in project"),
wxT("/AudioFiles/NormalizeOnLoad"),
false);
}
S.EndStatic();
S.StartStatic(_("When exporting tracks to an audio file"));
{
S.StartRadioButtonGroup(wxT("/FileFormats/ExportDownMix"), true);
{
S.TieRadioButton(_("&Always mix all tracks down to Stereo or Mono channel(s)"),
true);
S.TieRadioButton(_("&Use custom mix (for example to export a 5.1 multichannel file)"),
false);
}
S.EndRadioButtonGroup();
S.TieCheckBox(_("S&how Metadata Editor prior to export step"),
wxT("/AudioFiles/ShowId3Dialog"),
true);
S.AddFixedText(_("Note: Export quality options can be chosen by clicking the Options\nbutton in the Export dialog."));
}
S.EndStatic();
}
bool ImportExportPrefs::Apply()
{
ShuttleGui S(this, eIsSavingToPrefs);
PopulateOrExchange(S);
return true;
}
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
// arch-tag: 427b9e64-3fc6-40ef-bbf8-e6fff1d442f0

View File

@@ -0,0 +1,47 @@
/**********************************************************************
Audacity: A Digital Audio Editor
ImportExportPrefs.h
Joshua Haberman
Dominic Mazzoni
James Crook
**********************************************************************/
#ifndef __AUDACITY_IMPORT_EXPORT_PREFS__
#define __AUDACITY_IMPORT_EXPORT_PREFS__
#include <wx/defs.h>
#include <wx/window.h>
#include "../ShuttleGui.h"
#include "PrefsPanel.h"
class ImportExportPrefs:public PrefsPanel
{
public:
ImportExportPrefs(wxWindow * parent);
~ImportExportPrefs();
virtual bool Apply();
private:
void Populate();
void PopulateOrExchange(ShuttleGui & S);
};
#endif
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
// arch-tag: 300a00cc-0770-45a1-8ab5-88cfb7ae1239

View File

@@ -0,0 +1,551 @@
/**********************************************************************
Audacity: A Digital Audio Editor
KeyConfigPrefs.cpp
Brian Gunlogson
Dominic Mazzoni
James Crook
*******************************************************************//*!
\class KeyConfigPrefs
\brief A PrefsPanel for keybindings.
The code for displaying keybindings is similar to code in MousePrefs.
It would be nice to create a new 'Bindings' class which both
KeyConfigPrefs and MousePrefs use.
*//*********************************************************************/
#include "../Audacity.h"
#include <wx/defs.h>
#include <wx/ffile.h>
#include <wx/intl.h>
#include <wx/filedlg.h>
#include "../Prefs.h"
#include "../Project.h"
#include "../commands/CommandManager.h"
#include "../commands/Keyboard.h"
#include "../xml/XMLFileReader.h"
#include "../Internat.h"
#include "../ShuttleGui.h"
#include "KeyConfigPrefs.h"
#include "FileDialog.h"
//
// KeyConfigPrefs
//
#define AssignDefaultsButtonID 17001
#define CurrentComboID 17002
#define SetButtonID 17003
#define ClearButtonID 17004
#define CommandsListID 17005
#define SaveButtonID 17006
#define LoadButtonID 17007
#define CategoryID 17008
// The numbers of the columns of the mList.
enum
{
CommandColumn,
KeyComboColumn
};
BEGIN_EVENT_TABLE(KeyConfigPrefs, PrefsPanel)
EVT_BUTTON(AssignDefaultsButtonID, KeyConfigPrefs::OnDefaults)
EVT_BUTTON(SetButtonID, KeyConfigPrefs::OnSet)
EVT_BUTTON(ClearButtonID, KeyConfigPrefs::OnClear)
EVT_BUTTON(SaveButtonID, KeyConfigPrefs::OnSave)
EVT_BUTTON(LoadButtonID, KeyConfigPrefs::OnLoad)
EVT_CHOICE(CategoryID, KeyConfigPrefs::OnCategory)
EVT_LIST_ITEM_SELECTED(CommandsListID, KeyConfigPrefs::OnItemSelected)
EVT_LIST_KEY_DOWN(CommandsListID, KeyConfigPrefs::OnKeyDown)
END_EVENT_TABLE()
KeyConfigPrefs::KeyConfigPrefs(wxWindow * parent)
: PrefsPanel(parent, _("Keyboard")),
mKey(NULL)
{
Populate();
}
KeyConfigPrefs::~KeyConfigPrefs()
{
if (mKey)
{
mKey->Disconnect(wxEVT_KEY_DOWN,
wxKeyEventHandler(KeyConfigPrefs::OnCaptureKeyDown));
mKey->Disconnect(wxEVT_CHAR,
wxKeyEventHandler(KeyConfigPrefs::OnCaptureChar));
}
}
void KeyConfigPrefs::Populate()
{
ShuttleGui S(this, eIsCreatingFromPrefs);
AudacityProject *project = GetActiveProject();
if (!project) {
S.StartVerticalLay(true);
{
S.StartStatic(wxEmptyString, true);
{
S.AddTitle(_("Keyboard preferences currently unavailable."));
S.AddTitle(_("Open a new project to modify keyboard shortcuts."));
}
S.EndStatic();
}
S.EndVerticalLay();
return;
}
mManager = project->GetCommandManager();
mManager->GetCategories(mCats);
mCats.Insert(_("All"), 0);
PopulateOrExchange(S);
CreateList();
mCommandSelected = -1;
}
/// Normally in classes derived from PrefsPanel this function
/// is used both to populate the panel and to exchange data with it.
/// With KeyConfigPrefs all the exchanges are handled specially,
/// so this is only used in populating the panel.
void KeyConfigPrefs::PopulateOrExchange(ShuttleGui & S)
{
S.SetBorder(2);
S.StartStatic(_("Key Bindings"), 1);
{
S.StartHorizontalLay(wxALIGN_CENTRE, false);
{
S.Id(CategoryID);
mCat = S.AddChoice(_("C&ategory:"),
mCats[0],
&mCats);
}
S.EndHorizontalLay();
mList = S.Id(CommandsListID).AddListControlReportMode();
mList->SetName(_("Key Bindings"));
S.StartThreeColumn();
{
if (!mKey) {
mKey = new wxTextCtrl(this,
CurrentComboID,
wxT(""),
wxDefaultPosition,
#if defined(__WXMAC__)
wxSize(300, -1));
#else
wxSize(210, -1));
#endif
mKey->Connect(wxEVT_KEY_DOWN,
wxKeyEventHandler(KeyConfigPrefs::OnCaptureKeyDown));
mKey->Connect(wxEVT_CHAR,
wxKeyEventHandler(KeyConfigPrefs::OnCaptureChar));
}
S.AddWindow(mKey);
S.Id(SetButtonID).AddButton(_("Set"));
S.Id(ClearButtonID).AddButton(_("Cl&ear"));
}
S.EndThreeColumn();
#if defined(__WXMAC__)
S.AddFixedText(_("Note: Pressing Cmd+Q will quit. All other keys are valid."));
#endif
S.StartThreeColumn();
{
S.Id(LoadButtonID).AddButton(_("&Load..."));
S.Id(SaveButtonID).AddButton(_("&Save..."));
S.Id(AssignDefaultsButtonID).AddButton(_("&Defaults"));
}
S.EndThreeColumn();
}
S.EndStatic();
}
/// Sets up mList with the right number of columns, titles,
/// fills the contents and sets column widths.
void KeyConfigPrefs::CreateList()
{
mList->InsertColumn(CommandColumn, _("Command"), wxLIST_FORMAT_LEFT);
mList->InsertColumn(KeyComboColumn, _("Key Combination"), wxLIST_FORMAT_LEFT);
RepopulateBindingsList();
mList->SetColumnWidth(CommandColumn, wxLIST_AUTOSIZE);
mList->SetColumnWidth(KeyComboColumn, 250);
}
int wxCALLBACK SortCallback(long item1, long item2, long sortData)
{
wxArrayString *names = (wxArrayString *) sortData;
if (names->Item(item1) < names->Item(item2)) {
return -1;
}
if (names->Item(item1) > names->Item(item2)) {
return 1;
}
return 0;
}
void KeyConfigPrefs::RepopulateBindingsList()
{
wxString cat = mCat->GetStringSelection();
mList->DeleteAllItems(); // Delete contents, but not the column headers.
mNames.Clear();
mManager->GetAllCommandNames(mNames, false);
bool save = (mKeys.GetCount() == 0);
size_t ndx = 0;
int color = 0;
for (size_t i = 0; i < mNames.GetCount(); i++) {
wxString name = mNames[i];
wxString key = KeyStringDisplay(mManager->GetKeyFromName(name));
// Save the original key value to support canceling
if (save) {
mKeys.Add(key);
}
if (cat != _("All") && mManager->GetCategoryFromName(name) != cat) {
continue;
}
wxString label;
// Labels for undo and redo change according to the last command
// which can be undone/redone, so give them a special check in order
// not to confuse users
if (name == wxT("Undo")) {
label = _("Undo");
}
else if (name == wxT("Redo")) {
label = _("Redo");
}
else {
label = mManager->GetPrefixedLabelFromName(name);
}
label = wxMenuItem::GetLabelFromText(label.BeforeFirst(wxT('\t')));
mList->InsertItem(ndx, label);
mList->SetItem(ndx, KeyComboColumn, key);
mList->SetItemData(ndx, i);
mList->SetItemBackgroundColour(ndx, color ? wxColour(240, 240, 240) : *wxWHITE);
color = 1 - color;
ndx++;
}
// mList->SortItems(SortCallback, (long) &mNames);
}
void KeyConfigPrefs::OnLoad(wxCommandEvent & e)
{
wxString file = wxT("Audacity-keys.xml");
wxString path = gPrefs->Read(wxT("/DefaultOpenPath"),
::wxGetCwd());
file = FileSelector(_("Select an XML file containing Audacity keyboard shortcuts..."),
path,
file,
wxT(""),
_("XML files (*.xml)|*.xml|All files (*.*)|*.*"),
wxRESIZE_BORDER,
this);
if (!file) {
return;
}
path = wxPathOnly(file);
gPrefs->Write(wxT("/DefaultOpenPath"), path);
XMLFileReader reader;
if (!reader.Parse(mManager, file)) {
wxMessageBox(reader.GetErrorStr(),
_("Error loading keyboard shortcuts"),
wxOK | wxCENTRE, this);
}
RepopulateBindingsList();
}
void KeyConfigPrefs::OnSave(wxCommandEvent & e)
{
wxString file = wxT("Audacity-keys.xml");
wxString path = gPrefs->Read(wxT("/DefaultExportPath"),
::wxGetCwd());
file = FileSelector(_("Export Keyboard Shortcuts As:"),
path,
file,
wxT("xml"),
_("XML files (*.xml)|*.xml|All files (*.*)|*.*"),
wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER,
this);
if (!file) {
return;
}
path = wxPathOnly(file);
gPrefs->Write(wxT("/DefaultExportPath"), path);
XMLFileWriter prefFile;
try
{
prefFile.Open(file, wxT("wb"));
mManager->WriteXML(prefFile);
prefFile.Close();
}
catch (XMLFileWriterException* pException)
{
wxMessageBox(_("Couldn't write to file: ") + file,
_("Error saving keyboard shortcuts"),
wxOK | wxCENTRE, this);
delete pException;
}
}
void KeyConfigPrefs::OnDefaults(wxCommandEvent & e)
{
for (size_t i = 0; i < mNames.GetCount(); i++) {
mManager->SetKeyFromName(mNames[i],
mManager->GetDefaultKeyFromName(mNames[i]));
}
RepopulateBindingsList();
}
void KeyConfigPrefs::OnCaptureKeyDown(wxKeyEvent & e)
{
wxTextCtrl *t = (wxTextCtrl *)e.GetEventObject();
#if defined(__WXMAC__)
if (e.GetKeyCode() == WXK_TAB) {
wxNavigationKeyEvent nevent;
nevent.SetWindowChange(e.ControlDown());
nevent.SetDirection(!e.ShiftDown());
nevent.SetEventObject(t);
nevent.SetCurrentFocus(t);
t->GetParent()->ProcessEvent(nevent);
return;
}
#endif
t->SetValue(KeyStringDisplay(KeyEventToKeyString(e)));
}
void KeyConfigPrefs::OnCaptureChar(wxKeyEvent & e)
{
}
void KeyConfigPrefs::OnSet(wxCommandEvent & e)
{
if (mCommandSelected < 0 || mCommandSelected >= mNames.GetCount()) {
return;
}
wxString newKey = mKey->GetValue();
// Check if shortcut has already been assigned
for (int i = 0; i < mList->GetItemCount(); i++) {
wxListItem item;
item.SetColumn(KeyComboColumn);
item.SetMask(wxLIST_MASK_TEXT);
item.SetId(i);
mList->GetItem(item);
if (item.GetText() == newKey) {
item.SetColumn(CommandColumn);
mList->GetItem(item);
wxString prompt;
prompt = wxString::Format(_("The keyboard shortcut '%s' is already assigned to:\n\n'%s'"),
newKey.c_str(),
item.GetText().c_str());
wxMessageBox(prompt, _("Error"), wxICON_STOP | wxCENTRE, this);
return;
}
}
mList->SetItem(mCommandSelected, KeyComboColumn, newKey);
mManager->SetKeyFromName(mNames[mList->GetItemData(mCommandSelected)], newKey);
}
void KeyConfigPrefs::OnClear(wxCommandEvent& event)
{
mKey->Clear();
if (mCommandSelected < 0 || mCommandSelected >= mNames.GetCount()) {
return;
}
mList->SetItem(mCommandSelected, KeyComboColumn, wxT(""));
mManager->SetKeyFromName(mNames[mList->GetItemData(mCommandSelected)], wxT(""));
}
void KeyConfigPrefs::OnKeyDown(wxListEvent & e)
{
// the code in this function allows the user to seek to the next
// command which begins with the letter that is pressed
#ifdef __WXMAC__
// I (Ed) have no way of telling what code will work on
// the Mac but the following code does not
return;
#endif
#ifdef __WXMSW__
// Windows seems to have this built-in
// and does not need the following code
return;
#endif
// The following code seems to work well on at least some versions of Linux
int keycode = e.GetKeyCode();
int selected = mList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
int cnt = mList->GetItemCount();
wxListItem item;
bool found = false;
item.SetColumn(CommandColumn);
item.SetMask(wxLIST_MASK_TEXT);
for (int i = selected + 1; i < cnt; i++)
{
item.SetId(i);
mList->GetItem(item);
if (item.GetText().Left(1).IsSameAs(keycode, false)) {
mList->SetItemState(e.GetIndex(),
0,
wxLIST_STATE_FOCUSED | wxLIST_STATE_SELECTED);
mList->SetItemState(i,
wxLIST_STATE_FOCUSED | wxLIST_STATE_SELECTED,
wxLIST_STATE_FOCUSED | wxLIST_STATE_SELECTED);
mList->EnsureVisible(i);
found = true;
break;
}
}
if (!found) {
for (int i = 0; i < selected; i++)
{
item.SetId(i);
mList->GetItem(item);
if (item.GetText().Left(1).IsSameAs(keycode, false)) {
mList->SetItemState(e.GetIndex(),
0,
wxLIST_STATE_FOCUSED | wxLIST_STATE_SELECTED);
mList->SetItemState(i,
wxLIST_STATE_FOCUSED | wxLIST_STATE_SELECTED,
wxLIST_STATE_FOCUSED | wxLIST_STATE_SELECTED);
mList->EnsureVisible(i);
break;
}
}
}
}
void KeyConfigPrefs::OnCategory(wxCommandEvent & e)
{
RepopulateBindingsList();
}
void KeyConfigPrefs::OnItemSelected(wxListEvent & e)
{
mCommandSelected = e.GetIndex();
if (mCommandSelected < 0 || mCommandSelected >= mNames.GetCount()) {
mKey->SetLabel(wxT(""));
return;
}
wxListItem item;
item.SetColumn(KeyComboColumn);
item.SetMask(wxLIST_MASK_TEXT);
item.SetId(mCommandSelected);
mList->GetItem(item);
mKey->Clear();
mKey->AppendText(item.GetText());
}
bool KeyConfigPrefs::Apply()
{
for (size_t i = 0; i < mNames.GetCount(); i++) {
wxString dkey = KeyStringNormalize(mManager->GetDefaultKeyFromName(mNames[i]));
wxString name = wxT("/NewKeys/") + mNames[i];
wxString key = KeyStringNormalize(mManager->GetKeyFromName(mNames[i]));
if (gPrefs->HasEntry(name)) {
if (key != KeyStringNormalize(gPrefs->Read(name, key))) {
gPrefs->Write(name, key);
}
if (key == dkey) {
gPrefs->DeleteEntry(name);
}
}
else {
if (key != dkey) {
gPrefs->Write(name, key);
}
}
}
return true;
}
void KeyConfigPrefs::Cancel()
{
// Restore original key values
for (size_t i = 0; i < mNames.GetCount(); i++) {
mManager->SetKeyFromName(mNames[i], mKeys[i]);
}
return;
}
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
// arch-tag: f09afeeb-9805-463a-b3ca-e3e3bfe05549

View File

@@ -0,0 +1,76 @@
/**********************************************************************
Audacity: A Digital Audio Editor
KeyConfigPrefs.h
Brian Gunlogson
Dominic Mazzoni
**********************************************************************/
#ifndef __AUDACITY_KEY_CONFIG_PREFS__
#define __AUDACITY_KEY_CONFIG_PREFS__
#include <wx/defs.h>
#include <wx/listctrl.h>
#include <wx/textctrl.h>
#include <wx/string.h>
#include "../ShuttleGui.h"
#include "../commands/CommandManager.h"
#include "PrefsPanel.h"
class KeyConfigPrefs:public PrefsPanel
{
public:
KeyConfigPrefs(wxWindow * parent);
~KeyConfigPrefs();
virtual bool Apply();
virtual void Cancel();
private:
void Populate();
void PopulateOrExchange(ShuttleGui & S);
void CreateList();
void RepopulateBindingsList();
void OnDefaults(wxCommandEvent & e);
void OnLoad(wxCommandEvent & e);
void OnSave(wxCommandEvent & e);
void OnSet(wxCommandEvent & e);
void OnClear(wxCommandEvent & e);
void OnCategory(wxCommandEvent & e);
void OnItemSelected(wxListEvent & e);
void OnKeyDown(wxListEvent & e);
void OnCaptureKeyDown(wxKeyEvent & e);
void OnCaptureChar(wxKeyEvent & e);
wxChoice *mCat;
wxTextCtrl *mKey;
wxListCtrl *mList;
CommandManager *mManager;
size_t mCommandSelected;
wxArrayString mCats;
wxArrayString mNames;
wxArrayString mKeys;
DECLARE_EVENT_TABLE();
};
#endif
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
// arch-tag: 40d9b726-ab6b-431f-b384-e1a66303dba5

230
src/prefs/LibraryPrefs.cpp Normal file
View File

@@ -0,0 +1,230 @@
/**********************************************************************
Audacity: A Digital Audio Editor
LibraryPrefs.cpp
Joshua Haberman
Dominic Mazzoni
James Crook
*******************************************************************//**
\class LibraryPrefs
\brief A PrefsPanel used to select manage external libraries like the
MP3 and FFmpeg encoding libraries.
*//*******************************************************************/
#include "../Audacity.h"
#include <wx/defs.h>
#include <wx/button.h>
#include "../FFmpeg.h"
#include "../ShuttleGui.h"
#include "../export/ExportMP3.h"
#include "../widgets/LinkingHtmlWindow.h"
#include "LibraryPrefs.h"
////////////////////////////////////////////////////////////////////////////////
#define ID_MP3_FIND_BUTTON 7001
#define ID_MP3_DOWN_BUTTON 7002
#define ID_FFMPEG_FIND_BUTTON 7003
#define ID_FFMPEG_DOWN_BUTTON 7004
BEGIN_EVENT_TABLE(LibraryPrefs, PrefsPanel)
EVT_BUTTON(ID_MP3_FIND_BUTTON, LibraryPrefs::OnMP3FindButton)
EVT_BUTTON(ID_MP3_DOWN_BUTTON, LibraryPrefs::OnMP3DownButton)
EVT_BUTTON(ID_FFMPEG_FIND_BUTTON, LibraryPrefs::OnFFmpegFindButton)
EVT_BUTTON(ID_FFMPEG_DOWN_BUTTON, LibraryPrefs::OnFFmpegDownButton)
END_EVENT_TABLE()
LibraryPrefs::LibraryPrefs(wxWindow * parent)
: PrefsPanel(parent, _("Libraries"))
{
Populate();
}
LibraryPrefs::~LibraryPrefs()
{
}
/// Creates the dialog and its contents.
void LibraryPrefs::Populate()
{
//------------------------- Main section --------------------
// Now construct the GUI itself.
// Use 'eIsCreatingFromPrefs' so that the GUI is
// initialised with values from gPrefs.
ShuttleGui S(this, eIsCreatingFromPrefs);
PopulateOrExchange(S);
// ----------------------- End of main section --------------
// Set the MP3 Version string.
SetMP3VersionText();
SetFFmpegVersionText();
}
/// This PopulateOrExchange function is a good example of mixing the fully
/// automatic style of reading/writing from GUI to prefs with the partial form.
///
/// You'll notice that some of the Tie functions have Prefs identifiers in them
/// and others don't.
void LibraryPrefs::PopulateOrExchange(ShuttleGui & S)
{
S.SetBorder(2);
S.StartStatic(_("MP3 Export Library"));
{
S.StartTwoColumn();
{
S.AddVariableText(_("MP3 Library Version:"),
true,
wxALL | wxALIGN_RIGHT | wxALIGN_CENTRE_VERTICAL);
mMP3Version = S.AddVariableText(wxT("9.99"),
true,
wxALL | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL);
S.AddVariableText(_("MP3 Library:"),
true,
wxALL | wxALIGN_RIGHT | wxALIGN_CENTRE_VERTICAL);
S.Id(ID_MP3_FIND_BUTTON).AddButton(_("&Locate..."),
wxALL | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL);
S.AddVariableText(_("LAME MP3 Library:"),
true,
wxALL | wxALIGN_RIGHT | wxALIGN_CENTRE_VERTICAL);
S.Id(ID_MP3_DOWN_BUTTON).AddButton(_("&Download"),
wxALL | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL);
}
S.EndTwoColumn();
}
S.EndStatic();
S.StartStatic(_("FFmpeg Import/Export Library"));
{
S.StartTwoColumn();
{
S.AddVariableText(_("FFmpeg Library Version:"),
true,
wxALL | wxALIGN_RIGHT | wxALIGN_CENTRE_VERTICAL);
#if defined(USE_FFMPEG)
mFFmpegVersion = S.AddVariableText(_("No compatible FFmpeg library was found"),
true,
wxALL | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL);
#else
mFFmpegVersion = S.AddVariableText(wxT("FFmpeg support is not compiled in"),
true,
wxALL | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL);
#endif
S.AddVariableText(_("FFmpeg Library:"),
true,
wxALL | wxALIGN_RIGHT | wxALIGN_CENTRE_VERTICAL);
S.Id(ID_FFMPEG_FIND_BUTTON);
wxButton *bfnd = S.AddButton(_("Loca&te..."),
wxALL | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL);
S.AddVariableText(_("FFmpeg Library:"),
true,
wxALL | wxALIGN_RIGHT | wxALIGN_CENTRE_VERTICAL);
S.Id(ID_FFMPEG_DOWN_BUTTON);
wxButton *bdwn = S.AddButton(_("Dow&nload"),
wxALL | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL);
#if !defined(USE_FFMPEG)
bdwn->Enable(FALSE);
bfnd->Enable(FALSE);
#endif
}
S.EndTwoColumn();
}
S.EndStatic();
}
/// Sets the a text area on the dialog to have the name
/// of the MP3 Library version.
void LibraryPrefs::SetMP3VersionText(bool prompt)
{
mMP3Version->SetLabel(GetMP3Version(this, prompt));
}
/// Opens a file-finder dialog so that the user can
/// tell us where the MP3 library is.
void LibraryPrefs::OnMP3FindButton(wxCommandEvent & e)
{
SetMP3VersionText(true);
}
/// Opens a file-finder dialog so that the user can
/// tell us where the MP3 library is.
void LibraryPrefs::OnMP3DownButton(wxCommandEvent & e)
{
wxString url = wxT("http://www.audacityteam.org/manual/index.php?title=FAQ:Installation_and_Plug-Ins%23How_do_I_download_and_install_the_LAME_MP3_encoder.3F");
::OpenInDefaultBrowser(url);
}
void LibraryPrefs::SetFFmpegVersionText()
{
mFFmpegVersion->SetLabel(GetFFmpegVersion(this));
}
void LibraryPrefs::OnFFmpegFindButton(wxCommandEvent & e)
{
#ifdef USE_FFMPEG
FFmpegLibs* FFmpegLibsInst = PickFFmpegLibs();
bool showerrs =
#if defined(__WXDEBUG__)
true;
#else
false;
#endif
FFmpegLibsInst->FreeLibs();
// Load the libs ('true' means that all errors will be shown)
bool locate = !LoadFFmpeg(showerrs);
// Libs are fine, don't show "locate" dialog unless user really wants it
if (!locate) {
int response = wxMessageBox(_("Audacity has automatically detected valid FFmpeg libraries.\nDo you still want to locate them manually?"),
wxT("Success"),
wxCENTRE | wxYES_NO | wxNO_DEFAULT |wxICON_QUESTION);
if (response == wxYES) {
locate = true;
}
}
if (locate) {
// Show "Locate FFmpeg" dialog
FFmpegLibsInst->FindLibs(this);
FFmpegLibsInst->FreeLibs();
LoadFFmpeg(showerrs);
}
SetFFmpegVersionText();
DropFFmpegLibs();
#endif
}
void LibraryPrefs::OnFFmpegDownButton(wxCommandEvent & e)
{
wxString url = wxT("http://www.audacityteam.org/manual/index.php?title=FAQ:Installation_and_Plug-Ins%23installffmpeg");
::OpenInDefaultBrowser(url);
}
bool LibraryPrefs::Apply()
{
ShuttleGui S(this, eIsSavingToPrefs);
PopulateOrExchange(S);
return true;
}
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
// arch-tag: 427b9e64-3fc6-40ef-bbf8-e6fff1d442f0

60
src/prefs/LibraryPrefs.h Normal file
View File

@@ -0,0 +1,60 @@
/**********************************************************************
Audacity: A Digital Audio Editor
FileFormatPrefs.h
Joshua Haberman
Dominic Mazzoni
James Crook
**********************************************************************/
#ifndef __AUDACITY_FILE_FORMAT_PREFS__
#define __AUDACITY_FILE_FORMAT_PREFS__
#include <wx/defs.h>
#include <wx/stattext.h>
#include <wx/window.h>
#include "../ShuttleGui.h"
#include "PrefsPanel.h"
class LibraryPrefs:public PrefsPanel
{
public:
LibraryPrefs(wxWindow * parent);
~LibraryPrefs();
virtual bool Apply();
private:
void Populate();
void PopulateOrExchange(ShuttleGui & S);
void SetMP3VersionText(bool prompt = false);
void SetFFmpegVersionText();
void OnMP3FindButton(wxCommandEvent & e);
void OnMP3DownButton(wxCommandEvent & e);
void OnFFmpegFindButton(wxCommandEvent & e);
void OnFFmpegDownButton(wxCommandEvent & e);
wxStaticText *mMP3Version;
wxStaticText *mFFmpegVersion;
DECLARE_EVENT_TABLE();
};
#endif
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
// arch-tag: 300a00cc-0770-45a1-8ab5-88cfb7ae1239

425
src/prefs/MidiIOPrefs.cpp Normal file
View File

@@ -0,0 +1,425 @@
/**********************************************************************
Audacity: A Digital Audio Editor
MidiIOPrefs.cpp
Joshua Haberman
Dominic Mazzoni
James Crook
*******************************************************************//**
\class MidiIOPrefs
\brief A PrefsPanel used to select recording and playback devices and
other settings.
Presents interface for user to select the recording device and
playback device, from the list of choices that PortMidi
makes available.
Also lets user decide whether or not to record in stereo, and
whether or not to play other tracks while recording one (duplex).
*//********************************************************************/
#include "../Audacity.h"
#include "../Experimental.h"
#ifdef EXPERIMENTAL_MIDI_OUT
#include <wx/defs.h>
#include <wx/choice.h>
#include <wx/intl.h>
#include "portmidi.h"
#include "../AudioIO.h"
#include "../Internat.h"
#include "../Prefs.h"
#include "../Project.h"
#include "../ShuttleGui.h"
#include "MidiIOPrefs.h"
enum {
HostID = 10000,
PlayID,
RecordID,
ChannelsID
};
BEGIN_EVENT_TABLE(MidiIOPrefs, PrefsPanel)
EVT_CHOICE(HostID, MidiIOPrefs::OnHost)
// EVT_CHOICE(RecordID, MidiIOPrefs::OnDevice)
END_EVENT_TABLE()
MidiIOPrefs::MidiIOPrefs(wxWindow * parent)
: PrefsPanel(parent, _("MIDI Devices"))
{
Populate();
}
MidiIOPrefs::~MidiIOPrefs()
{
}
void MidiIOPrefs::Populate()
{
// First any pre-processing for constructing the GUI.
GetNamesAndLabels();
// Get current setting for devices
mPlayDevice = gPrefs->Read(wxT("/MidiIO/PlaybackDevice"), wxT(""));
mRecordDevice = gPrefs->Read(wxT("/MidiIO/RecordingDevice"), wxT(""));
// mRecordChannels = gPrefs->Read(wxT("/MidiIO/RecordChannels"), 2L);
//------------------------- Main section --------------------
// Now construct the GUI itself.
// Use 'eIsCreatingFromPrefs' so that the GUI is
// initialised with values from gPrefs.
ShuttleGui S(this, eIsCreatingFromPrefs);
PopulateOrExchange(S);
// ----------------------- End of main section --------------
wxCommandEvent e;
OnHost(e);
}
/// Gets the lists of names and lists of labels which are
/// used in the choice controls.
/// The names are what the user sees in the wxChoice.
/// The corresponding labels are what gets stored.
void MidiIOPrefs::GetNamesAndLabels() {
// Gather list of hosts. Only added hosts that have devices attached.
int nDevices = Pm_CountDevices();
for (int i = 0; i < nDevices; i++) {
const PmDeviceInfo *info = Pm_GetDeviceInfo(i);
if (info->output || info->input) { //should always happen
wxString name(info->interf, wxConvLocal);
if (mHostNames.Index(name) == wxNOT_FOUND) {
mHostNames.Add(name);
mHostLabels.Add(name);
}
}
}
}
void MidiIOPrefs::PopulateOrExchange( ShuttleGui & S ) {
wxArrayString empty;
S.SetBorder(2);
S.StartStatic(_("Interface"));
{
S.StartMultiColumn(2);
{
S.Id(HostID);
mHost = S.TieChoice(_("Host") + wxString(wxT(":")),
wxT("/MidiIO/Host"),
wxT(""),
mHostNames,
mHostLabels);
S.SetSizeHints(mHostNames);
S.AddPrompt(_("Using:"));
S.AddFixedText(wxString(Pa_GetVersionText(), wxConvLocal));
}
S.EndMultiColumn();
}
S.EndStatic();
S.StartStatic(_("Playback"));
{
S.StartMultiColumn(2);
{
S.Id(PlayID);
mPlay = S.AddChoice(_("Device") + wxString(wxT(":")),
wxEmptyString,
&empty);
}
S.EndMultiColumn();
}
S.EndStatic();
S.StartStatic(_("Recording"));
{
S.StartMultiColumn(2);
{
S.Id(RecordID);
mRecord = S.AddChoice(_("Device") + wxString(wxT(":")),
wxEmptyString,
&empty);
S.Id(ChannelsID);
/*
mChannels = S.AddChoice(_("Channels") + wxString(wxT(":")),
wxEmptyString,
&empty);
*/
}
S.EndMultiColumn();
}
S.EndStatic();
}
// Not sure that these settings are needed right now.
#if 0
S.StartStatic( _("Playthrough") );
{
S.TieCheckBox( _("&Play other tracks while recording new one"),
wxT("Duplex"),true);
#ifdef __MACOSX__
S.TieCheckBox( _("&Hardware Playthrough (Play new track while recording it)"),
wxT("Playthrough"),false);
#endif
S.TieCheckBox( _("&Software Playthrough (Play new track while recording it)"),
wxT("SWPlaythrough"),false);
}
S.EndStatic();
S.StartHorizontalLay( wxEXPAND, 0 );
S.StartStatic( _("Cut Preview"),1 );
{
S.StartThreeColumn();
S.TieTextBox( _("Play before cut region:"), wxT("CutPreviewBeforeLen"),1.0,9);
S.AddUnits( _("seconds") );
S.TieTextBox( _("Play after cut region:"),wxT("CutPreviewAfterLen"), 1.0,9);
S.AddUnits( _("seconds") );
S.EndThreeColumn();
}
S.EndStatic();
S.StartStatic( _("Latency"),1 );
{
S.StartThreeColumn();
// only show the following controls if we use Portaudio v19, because
// for Portaudio v19 we always use default buffer sizes
S.TieTextBox( _("Audio to buffer:"),wxT("LatencyDuration"),100.0,9);
S.AddUnits( _("milliseconds") );
S.TieTextBox( _("Latency correction:"),wxT("LatencyCorrection"),0.0,9);
S.AddUnits( _("milliseconds") );
S.EndThreeColumn();
}
S.EndStatic();
S.EndHorizontalLay();
S.StartHorizontalLay( wxEXPAND, 0 );
S.StartStatic( _("Seek Time"),1 );
{
S.StartThreeColumn();
S.TieTextBox( _("Short period:"), wxT("SeekShortPeriod"),1.0,9);
S.AddUnits( _("seconds") );
S.TieTextBox( _("Long period:"),wxT("SeekLongPeriod"), 15.0,9);
S.AddUnits( _("seconds") );
S.EndThreeColumn();
}
S.EndStatic();
S.StartStatic( _("Effects Preview"),1 );
{
S.StartThreeColumn();
S.TieTextBox( _("Play when previewing:"), wxT("EffectsPreviewLen"), 3.0,9);
S.AddUnits( _("seconds") );
S.EndThreeColumn();
}
gPrefs->SetPath(wxT("/"));
#endif
// JKC: This is some old code that was sizing control labels all the same,
// even if in different static controls. It made for a nicer layout.
// We might want to do something like that again in future.
#if 0
// find out the biggest minimum size of labels
int maxIndex = 0,r;
wxSize maxMinSize = textSizer[0]->GetMinSize();
for (r = 1; r < 3; r++) {
if (textSizer[r]->GetMinSize().GetWidth() > maxMinSize.GetWidth()) {
maxMinSize = textSizer[r]->GetMinSize();
maxIndex = r;
}
}
// set small minimum sizes to max minumum size
for (r = 0; r < 3; r++) {
if (r != maxIndex)
textSizer[r]->SetMinSize( maxMinSize );
}
#endif
void MidiIOPrefs::OnHost(wxCommandEvent & e)
{
int index = mHost->GetCurrentSelection();
wxString itemAtIndex = mHostNames.Item(index);
int nDevices = Pm_CountDevices();
if (nDevices == 0) {
mHost->Clear();
mHost->Append(_("No MIDI interfaces"), (void *) NULL);
mHost->SetSelection(0);
}
mPlay->Clear();
mRecord->Clear();
wxArrayString playnames;
wxArrayString recordnames;
for (int i = 0; i < nDevices; i++) {
const PmDeviceInfo *info = Pm_GetDeviceInfo(i);
wxString interf(info->interf, wxConvLocal);
if (itemAtIndex.IsSameAs(interf)) {
wxString name(info->name, wxConvLocal);
wxString device = wxString::Format(wxT("%s: %s"),
interf.c_str(),
name.c_str());
int index;
if (info->output) {
playnames.Add(name);
index = mPlay->Append(name, (void *) info);
if (device == mPlayDevice) {
mPlay->SetSelection(index);
}
}
if (info->input) {
recordnames.Add(name);
index = mRecord->Append(name, (void *) info);
if (device == mRecordDevice) {
mRecord->SetSelection(index);
}
}
}
}
if (mPlay->GetCount() == 0) {
playnames.Add(_("No devices found"));
mPlay->Append(playnames[0], (void *) NULL);
}
if (mRecord->GetCount() == 0) {
recordnames.Add(_("No devices found"));
mRecord->Append(recordnames[0], (void *) NULL);
}
if (mPlay->GetCount() && mPlay->GetSelection() == wxNOT_FOUND) {
mPlay->SetSelection(0);
}
if (mRecord->GetCount() && mRecord->GetSelection() == wxNOT_FOUND) {
mRecord->SetSelection(0);
}
ShuttleGui S(this, eIsCreating);
S.SetSizeHints(mPlay, playnames);
S.SetSizeHints(mRecord, recordnames);
// OnDevice(e);
}
/*
void MidiIOPrefs::OnDevice(wxCommandEvent & e)
{
int ndx = mRecord->GetCurrentSelection();
if (ndx == wxNOT_FOUND) {
ndx = 0;
}
int sel = mChannels->GetSelection();
int cnt = 0;
const PmDeviceInfo *info = (const PmDeviceInfo *) mRecord->GetClientData(ndx);
if (info != NULL) {
cnt = info->input;
}
if (sel != wxNOT_FOUND) {
mRecordChannels = sel + 1;
}
mChannels->Clear();
// Limit cnt
cnt = cnt <= 0 ? 16 : cnt;
cnt = cnt > 256 ? 256 : cnt;
wxArrayString channelnames;
// Channel counts, mono, stereo etc...
for (int i = 0; i < cnt; i++) {
wxString name;
if (i == 0) {
name = _("1 (Mono)");
}
else if (i == 1) {
name = _("2 (Stereo)");
}
else {
name = wxString::Format(wxT("%d"), i + 1);
}
channelnames.Add(name);
int index = mChannels->Append(name);
if (i == mRecordChannels - 1) {
mChannels->SetSelection(index);
}
}
if (mChannels->GetCount() && mChannels->GetCurrentSelection() == wxNOT_FOUND) {
mChannels->SetSelection(0);
}
ShuttleGui S(this, eIsCreating);
S.SetSizeHints(mChannels, channelnames);
Layout();
}
*/
bool MidiIOPrefs::Apply()
{
ShuttleGui S(this, eIsSavingToPrefs);
PopulateOrExchange(S);
const PmDeviceInfo *info;
info = (const PmDeviceInfo *) mPlay->GetClientData(mPlay->GetSelection());
if (info) {
gPrefs->Write(wxT("/MidiIO/PlaybackDevice"),
wxString::Format(wxT("%s: %s"),
wxString(info->interf, wxConvLocal).c_str(),
wxString(info->name, wxConvLocal).c_str()));
}
info = (const PmDeviceInfo *) mRecord->GetClientData(mRecord->GetSelection());
if (info) {
gPrefs->Write(wxT("/MidiIO/RecordingDevice"),
wxString::Format(wxT("%s: %s"),
wxString(info->interf, wxConvLocal).c_str(),
wxString(info->name, wxConvLocal).c_str()));
}
/*
gPrefs->Write(wxT("/MidiIO/RecordChannels"),
wxString::Format(wxT("%d"),
mChannels->GetSelection() + 1));
*/
#if USE_PORTMIXER
if (gAudioIO)
gAudioIO->HandleDeviceChange();
#endif // USE_PORTMIXER
return true;
}
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
// arch-tag: d6904b91-a320-4194-8d60-caa9175b6bb4
#endif

71
src/prefs/MidiIOPrefs.h Normal file
View File

@@ -0,0 +1,71 @@
/**********************************************************************
Audacity: A Digital Audio Editor
AudioIOPrefs.h
Joshua Haberman
James Crook
**********************************************************************/
#include "../Experimental.h"
#ifdef EXPERIMENTAL_MIDI_OUT
#ifndef __AUDACITY_MIDI_IO_PREFS__
#define __AUDACITY_MIDI_IO_PREFS__
#include <wx/defs.h>
#include <wx/choice.h>
#include <wx/string.h>
#include <wx/window.h>
#include "../ShuttleGui.h"
#include "PrefsPanel.h"
class MidiIOPrefs:public PrefsPanel
{
public:
MidiIOPrefs(wxWindow * parent);
virtual ~MidiIOPrefs();
virtual bool Apply();
private:
void Populate();
void PopulateOrExchange(ShuttleGui & S);
void GetNamesAndLabels();
void OnHost(wxCommandEvent & e);
// void OnDevice(wxCommandEvent & e);
wxArrayString mHostNames;
wxArrayString mHostLabels;
wxString mPlayDevice;
wxString mRecordDevice;
// long mRecordChannels;
wxChoice *mHost;
wxChoice *mPlay;
wxChoice *mRecord;
// wxChoice *mChannels;
DECLARE_EVENT_TABLE();
};
#endif
#endif
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
// arch-tag: df22b108-e989-4ec4-a8b6-dddbcc7be6a7

184
src/prefs/MousePrefs.cpp Normal file
View File

@@ -0,0 +1,184 @@
/**********************************************************************
Audacity: A Digital Audio Editor
MousePrefs.cpp
James Crook
********************************************************************//*!
\class MousePrefs
\brief A PrefsPanel that presents an interface for user to view the
default bindings of mouse buttons to commands.
April/2003: These are default bindings and are not yet configurable.
They are provided to give information about what the bindings are.
Configuration when available will be mostly used by power users
who are unlikely to change the default bindings, but will add
bindings (e.g. for cut, play, and their own nyquist filters)
using currently unused combinations.
Unlike key-bindings which are parameterless, mouse bindings
provide parameters:
- a single point for a click, and
- a stream of points or a start and end point for a drag.
If we allow a nyquist filter to be bound to the mouse, instead of
being applied to the current selection it would be applied to the
start and end points of the drag.
*//********************************************************************/
#include "../Audacity.h"
#include <wx/defs.h>
#include <wx/intl.h>
#include <wx/listctrl.h>
#include "../Prefs.h"
#include "../ShuttleGui.h"
#include "MousePrefs.h"
// The numbers of the columns of the mList.
enum
{
BlankColumn,
ToolColumn,
ActionColumn,
ButtonsColumn,
CommentColumn
};
/// Constructor
MousePrefs::MousePrefs(wxWindow * parent)
: PrefsPanel(parent, _("Mouse"))
{
Populate();
}
MousePrefs::~MousePrefs()
{
}
/// Creates the dialog and its contents.
void MousePrefs::Populate()
{
//------------------------- Main section --------------------
// Now construct the GUI itself.
// Use 'eIsCreatingFromPrefs' so that the GUI is
// initialised with values from gPrefs.
ShuttleGui S(this, eIsCreatingFromPrefs);
PopulateOrExchange(S);
// ----------------------- End of main section --------------
CreateList();
}
/// Places controls on the panel and also exchanges data with them.
void MousePrefs::PopulateOrExchange(ShuttleGui & S)
{
S.SetBorder(2);
S.StartStatic(_("Mouse Bindings (default values, not configurable)"), 1);
{
mList = S.AddListControlReportMode();
}
S.EndStatic();
}
/// Creates the contents of mList
void MousePrefs::CreateList()
{
//An empty first column is a workaround - under Win98 the first column
//can't be right aligned.
mList->InsertColumn(BlankColumn, wxT(""), wxLIST_FORMAT_LEFT);
mList->InsertColumn(ToolColumn, _("Tool"), wxLIST_FORMAT_RIGHT);
mList->InsertColumn(ActionColumn, _("Command Action"), wxLIST_FORMAT_RIGHT);
mList->InsertColumn(ButtonsColumn, _("Buttons"), wxLIST_FORMAT_LEFT);
mList->InsertColumn(CommentColumn, _("Comments"), wxLIST_FORMAT_LEFT);
AddItem(_("Left-Click"), _("Select"), _("Set Selection Point"));
AddItem(_("Left-Drag"), _("Select"), _("Set Selection Range"));
AddItem(_("Shift-Left-Click"), _("Select"), _("Extend Selection Range"));
AddItem(_("Left-Double-Click"), _("Select"), _("Select Clip or Entire Track"));
AddItem(_("Ctrl-Left-Click"), _("Select"), _("Set Selection Point and Play"));
AddItem(_("Left-Click"), _("Zoom"), _("Zoom in on Point"));
AddItem(_("Left-Drag"), _("Zoom"), _("Zoom in on a Range"), _("same as right-drag"));
AddItem(_("Right-Click"), _("Zoom"), _("Zoom out one step"));
AddItem(_("Right-Drag"), _("Zoom"), _("Zoom in on a Range"), _("same as left-drag"));
AddItem(_("Shift-Drag"), _("Zoom"), _("Zoom out on a Range"));
AddItem(_("Middle-Click"), _("Zoom"), _("Zoom default"));
AddItem(_("Left-Drag"), _("Time-Shift"),_("Time shift clip or move up/down between tracks"));
AddItem(_("Shift-Left-Drag"), _("Time-Shift"),_("Time shift all clips in track"));
AddItem(_("Ctrl-Left-Drag"), _("Time-Shift"),_("Move clip up/down between tracks"));
AddItem(_("Left-Drag"), _("Envelope"), _("Change Amplification Envelope"));
AddItem(_("Left-Click"), _("Pencil"), _("Change Sample"));
AddItem(_("Alt-Left-Click"), _("Pencil"), _("Smooth at Sample"));
AddItem(_("Left-Drag"), _("Pencil"), _("Change Several Samples"));
AddItem(_("Ctrl-Left-Drag"), _("Pencil"), _("Change ONE Sample only"));
AddItem(_("Left-Click"), _("Multi"), _("Set Selection Point"), _("same as select tool"));
AddItem(_("Left-Drag"), _("Multi"), _("Set Selection Range"), _("same as select tool"));
AddItem(_("Right-Click"), _("Multi"), _("Zoom out one step"), _("same as zoom tool"));
AddItem(_("Right-Drag"), _("Multi"), _("Zoom in on a Range"), _("same as zoom tool"));
AddItem(_("Wheel-Rotate"), _("Any"), _("Scroll up or down"));
AddItem(_("Shift-Wheel-Rotate"),_("Any"), _("Scroll left or right"));
AddItem(_("Ctrl-Wheel-Rotate"), _("Any"), _("Zoom in or out"));
mList->SetColumnWidth(BlankColumn, 0);
mList->SetColumnWidth(ToolColumn, wxLIST_AUTOSIZE);
mList->SetColumnWidth(ActionColumn, wxLIST_AUTOSIZE);
mList->SetColumnWidth(ButtonsColumn, wxLIST_AUTOSIZE);
// Not sure if this extra column is a good idea or not.
// Anyway, 5 pixels wide is wide enough that some people who are curious will drag it
// wider to see what's there (the comments show that the duplication of functions
// is for a reason, and not just random).
mList->SetColumnWidth(CommentColumn, 5);
}
/// Adds an item to mList
void MousePrefs::AddItem(wxString const & buttons, wxString const & tool,
wxString const & action, wxString const & comment)
{
int i = mList->GetItemCount();
mList->InsertItem(i, wxT(""));
mList->SetItem(i, ToolColumn, tool);
mList->SetItem(i, ActionColumn, action);
mList->SetItem(i, ButtonsColumn, buttons);
// Add a space before the text to work around a minor bug in the
// list control when showing narrow columns.
mList->SetItem(i, CommentColumn, wxT(" ") + comment);
}
/// Update the preferences stored on disk.
/// Currently does nothing as Mouse Preferences don't change.
bool MousePrefs::Apply()
{
// Not yet required...
// ShuttleGui S(this, eIsSavingToPrefs);
// PopulateOrExchange(S);
return true;
}
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
// arch-tag: b8ccdb72-61a3-42d9-acde-a163ed516f8f

53
src/prefs/MousePrefs.h Normal file
View File

@@ -0,0 +1,53 @@
/**********************************************************************
Audacity: A Digital Audio Editor
MousePrefs.h
**********************************************************************/
#ifndef __AUDACITY_MOUSE_PREFS__
#define __AUDACITY_MOUSE_PREFS__
#include <wx/defs.h>
#include <wx/listctrl.h>
#include <wx/string.h>
#include <wx/window.h>
#include "../ShuttleGui.h"
#include "PrefsPanel.h"
class MousePrefs:public PrefsPanel
{
public:
MousePrefs(wxWindow * parent);
~MousePrefs();
virtual bool Apply();
private:
void Populate();
void PopulateOrExchange(ShuttleGui & S);
void CreateList();
void AddItem(wxString const & buttons,
wxString const & tool,
wxString const & action,
wxString const & comment = wxEmptyString);
wxListCtrl * mList;
};
#endif
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
// arch-tag: d7366e17-0464-4863-8b68-de4edea64974

135
src/prefs/PlaybackPrefs.cpp Normal file
View File

@@ -0,0 +1,135 @@
/**********************************************************************
Audacity: A Digital Audio Editor
PlaybackPrefs.cpp
Joshua Haberman
Dominic Mazzoni
James Crook
*******************************************************************//**
\class PlaybackPrefs
\brief A PrefsPanel used to select playback options.
Presents interface for user to update the various playback options
like previewing and seeking.
*//********************************************************************/
#include "../Audacity.h"
#include <wx/defs.h>
#include <wx/textctrl.h>
#include "../ShuttleGui.h"
#include "PlaybackPrefs.h"
PlaybackPrefs::PlaybackPrefs(wxWindow * parent)
: PrefsPanel(parent, _("Playback"))
{
Populate();
}
PlaybackPrefs::~PlaybackPrefs()
{
}
void PlaybackPrefs::Populate()
{
//------------------------- Main section --------------------
// Now construct the GUI itself.
// Use 'eIsCreatingFromPrefs' so that the GUI is
// initialised with values from gPrefs.
ShuttleGui S(this, eIsCreatingFromPrefs);
PopulateOrExchange(S);
// ----------------------- End of main section --------------
}
void PlaybackPrefs::PopulateOrExchange(ShuttleGui & S)
{
wxTextCtrl *w;
S.SetBorder(2);
S.StartStatic(_("Effects Preview"));
{
S.StartThreeColumn();
{
w = S.TieTextBox(_("&Length of preview:"),
wxT("/AudioIO/EffectsPreviewLen"),
3.0,
9);
S.AddUnits(_("seconds"));
w->SetName(w->GetName() + wxT(" ") + _("seconds"));
}
S.EndThreeColumn();
}
S.EndStatic();
S.StartStatic(_("Cut Preview"));
{
S.StartThreeColumn();
{
w = S.TieTextBox(_("Preview &before cut region:"),
wxT("/AudioIO/CutPreviewBeforeLen"),
1.0,
9);
S.AddUnits(_("seconds"));
w->SetName(w->GetName() + wxT(" ") + _("seconds"));
w = S.TieTextBox(_("Preview &after cut region:"),
wxT("/AudioIO/CutPreviewAfterLen"),
1.0,
9);
S.AddUnits(_("seconds"));
w->SetName(w->GetName() + wxT(" ") + _("seconds"));
}
S.EndThreeColumn();
}
S.EndStatic();
S.StartStatic(_("Seek Time when playing"));
{
S.StartThreeColumn();
{
w = S.TieTextBox(_("&Short period:"),
wxT("/AudioIO/SeekShortPeriod"),
1.0,
9);
S.AddUnits(_("seconds"));
w->SetName(w->GetName() + wxT(" ") + _("seconds"));
w = S.TieTextBox(_("Lo&ng period:"),
wxT("/AudioIO/SeekLongPeriod"),
15.0,
9);
S.AddUnits(_("seconds"));
w->SetName(w->GetName() + wxT(" ") + _("seconds"));
}
S.EndThreeColumn();
}
S.EndStatic();
}
bool PlaybackPrefs::Apply()
{
ShuttleGui S(this, eIsSavingToPrefs);
PopulateOrExchange(S);
return true;
}
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
// arch-tag: d6904b91-a320-4194-8d60-caa9175b6bb4

46
src/prefs/PlaybackPrefs.h Normal file
View File

@@ -0,0 +1,46 @@
/**********************************************************************
Audacity: A Digital Audio Editor
PlaybackPrefs.h
Joshua Haberman
James Crook
**********************************************************************/
#ifndef __AUDACITY_PLAYBACK_PREFS__
#define __AUDACITY_PLAYBACK_PREFS__
#include <wx/defs.h>
#include <wx/window.h>
#include "../ShuttleGui.h"
#include "PrefsPanel.h"
class PlaybackPrefs:public PrefsPanel
{
public:
PlaybackPrefs(wxWindow * parent);
virtual ~PlaybackPrefs();
virtual bool Apply();
private:
void Populate();
void PopulateOrExchange(ShuttleGui & S);
};
#endif
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
// arch-tag: df22b108-e989-4ec4-a8b6-dddbcc7be6a7

252
src/prefs/PrefsDialog.cpp Normal file
View File

@@ -0,0 +1,252 @@
/**********************************************************************
Audacity: A Digital Audio Editor
PrefsDialog.cpp
Joshua Haberman
James Crook
*******************************************************************//**
\class PrefsDialog
\brief Dialog that shows the current PrefsPanel in a tabbed divider.
*//*******************************************************************/
#include "../Audacity.h"
#include <wx/defs.h>
#include <wx/button.h>
#include <wx/dialog.h>
#include <wx/event.h>
#include <wx/font.h>
#include <wx/gdicmn.h>
#include <wx/intl.h>
#include <wx/listbox.h>
#include <wx/msgdlg.h>
#include <wx/sizer.h>
#include <wx/listbook.h>
#if wxCHECK_VERSION(2, 8, 4)
#include <wx/treebook.h>
#else
#include "../widgets/treebook.h"
#endif
#include "../Experimental.h"
#include "../Project.h"
#include "../Prefs.h"
#include "PrefsDialog.h"
#include "PrefsPanel.h"
#include "BatchPrefs.h"
#include "DevicePrefs.h"
#include "DirectoriesPrefs.h"
#include "EffectsPrefs.h"
#include "GUIPrefs.h"
#include "ImportExportPrefs.h"
#include "KeyConfigPrefs.h"
#include "LibraryPrefs.h"
#include "MousePrefs.h"
#include "PlaybackPrefs.h"
#include "ProjectsPrefs.h"
#include "QualityPrefs.h"
#include "RecordingPrefs.h"
#include "SpectrumPrefs.h"
#include "ThemePrefs.h"
#include "TracksPrefs.h"
#include "WarningsPrefs.h"
#ifdef EXPERIMENTAL_MIDI_OUT
#include "MidiIOPrefs.h"
#endif
BEGIN_EVENT_TABLE(PrefsDialog, wxDialog)
EVT_BUTTON(wxID_OK, PrefsDialog::OnOK)
EVT_BUTTON(wxID_CANCEL, PrefsDialog::OnCancel)
EVT_TREE_KEY_DOWN(wxID_ANY, PrefsDialog::OnTreeKeyDown) // Handles key events when tree has focus
END_EVENT_TABLE()
PrefsDialog::PrefsDialog(wxWindow * parent)
: wxDialog(parent, wxID_ANY, wxString(_("Audacity Preferences")),
wxDefaultPosition,
wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
{
ShuttleGui S(this, eIsCreating);
S.StartVerticalLay(true);
{
S.StartHorizontalLay(wxALIGN_LEFT | wxEXPAND, true);
{
mCategories = new wxTreebook(this, wxID_ANY);
S.Prop(1);
S.AddWindow(mCategories, wxEXPAND);
wxWindow *w;
// Parameters are: AppPage( page, name, IsSelected, imageId)
w = new DevicePrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0);
w = new PlaybackPrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0);
w = new RecordingPrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0);
#ifdef EXPERIMENTAL_MIDI_OUT
w = new MidiIOPrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0);
#endif
w = new QualityPrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0);
w = new GUIPrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0);
w = new TracksPrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0);
w = new ImportExportPrefs(mCategories);mCategories->AddPage(w, w->GetName(), false, 0);
w = new ProjectsPrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0);
w = new LibraryPrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0);
w = new SpectrumPrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0);
w = new DirectoriesPrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0);
w = new WarningsPrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0);
w = new EffectsPrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0);
#ifdef EXPERIMENTAL_THEME_PREFS
w = new ThemePrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0);
#endif
// w = new BatchPrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0);
w = new KeyConfigPrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0);
w = new MousePrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0);
}
S.EndHorizontalLay();
}
S.EndVerticalLay();
S.AddStandardButtons(eOkButton | eCancelButton);
/* long is signed, size_t is unsigned. On some platforms they are different
* lengths as well. So we must check that the stored category is both > 0
* and within the possible range of categories, making the first check on the
* _signed_ value to avoid issues when converting an unsigned one.
*/
size_t selected;
long prefscat = gPrefs->Read(wxT("/Prefs/PrefsCategory"), 0L);
if (prefscat > 0L )
selected = prefscat; // only assign if number will fit
else
selected = 0; // use 0 if value can't be assigned
if (selected >= mCategories->GetPageCount())
selected = 0; // clamp to available range of tabs
mCategories->SetSelection(selected);
#if defined(__WXGTK__)
mCategories->GetTreeCtrl()->EnsureVisible(mCategories->GetTreeCtrl()->GetRootItem());
#endif
// mCategories->SetSizeHints(-1, -1, 790, 600); // 790 = 800 - (border * 2)
Layout();
Fit();
wxSize sz = GetSize();
wxASSERT_MSG(sz.x <= 800 && sz.y <= 600, wxT("Preferences dialog exceeds max size"));
if (sz.x > 800) {
sz.x = 800;
}
if (sz.y > 600) {
sz.y = 600;
}
SetSizeHints(sz.x, sz.y, 800, 600);
// Center after all that resizing, but make sure it doesn't end up
// off-screen
CentreOnParent();
}
PrefsDialog::~PrefsDialog()
{
}
void PrefsDialog::OnCancel(wxCommandEvent & event)
{
for (size_t i = 0; i < mCategories->GetPageCount(); i++) {
((PrefsPanel *) mCategories->GetPage(i))->Cancel();
}
EndModal(false);
}
void PrefsDialog::OnTreeKeyDown(wxTreeEvent & event)
{
if(event.GetKeyCode() == WXK_RETURN)
OnOK(event);
else
event.Skip(); // Ensure standard behavior when enter is not pressed
}
void PrefsDialog::OnOK(wxCommandEvent & event)
{
// Validate all pages first
for (size_t i = 0; i < mCategories->GetPageCount(); i++) {
PrefsPanel *panel = (PrefsPanel *) mCategories->GetPage(i);
// The dialog doesn't end until all the input is valid
if (!panel->Validate()) {
mCategories->SetSelection(i);
return;
}
}
// Now apply the changes
for (size_t i = 0; i < mCategories->GetPageCount(); i++) {
PrefsPanel *panel = (PrefsPanel *) mCategories->GetPage(i);
panel->Apply();
}
gPrefs->Write(wxT("/Prefs/PrefsCategory"), (long)mCategories->GetSelection());
#if USE_PORTMIXER
if (gAudioIO) {
gAudioIO->HandleDeviceChange();
}
#endif
// LL: wxMac can't handle recreating the menus when this dialog is still active,
// so AudacityProject::UpdatePrefs() or any of the routines it calls must
// not cause AudacityProject::RebuildMenuBar() to be executed.
for (size_t i = 0; i < gAudacityProjects.GetCount(); i++) {
gAudacityProjects[i]->UpdatePrefs();
}
EndModal(true);
}
void PrefsDialog::SelectPageByName(wxString pageName)
{
size_t n = mCategories->GetPageCount();
for (size_t i = 0; i < n; i++) {
if (mCategories->GetPageText(i) == pageName) {
mCategories->SetSelection(i);
return;
}
}
}
void PrefsDialog::ShowTempDirPage()
{
SelectPageByName(_("Directories"));
}
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
// arch-tag: b305b538-1d2e-4acf-a997-95023d10a7bd

54
src/prefs/PrefsDialog.h Normal file
View File

@@ -0,0 +1,54 @@
/**********************************************************************
Audacity: A Digital Audio Editor
PrefsDialog.h
Joshua Haberman
James Crook
**********************************************************************/
#ifndef __AUDACITY_PREFS_DIALOG__
#define __AUDACITY_PREFS_DIALOG__
#include <wx/button.h>
#include <wx/event.h>
#include <wx/dialog.h>
#include <wx/string.h>
#include <wx/treebook.h>
#include <wx/window.h>
class PrefsDialog:public wxDialog
{
public:
PrefsDialog(wxWindow * parent);
virtual ~PrefsDialog();
void OnCategoryChange(wxCommandEvent & e);
void OnOK(wxCommandEvent & e);
void OnCancel(wxCommandEvent & e);
void OnTreeKeyDown(wxTreeEvent & e); // Used to dismiss the dialog when enter is pressed with focus on tree
void SelectPageByName(wxString pageName);
void ShowTempDirPage();
private:
wxTreebook *mCategories;
DECLARE_EVENT_TABLE()
};
#endif
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
// arch-tag: 43249bcd-739b-4b30-95dd-3e70495da6eb

76
src/prefs/PrefsPanel.h Normal file
View File

@@ -0,0 +1,76 @@
/**********************************************************************
Audacity: A Digital Audio Editor
PrefsPanel.h
Joshua Haberman
*******************************************************************//**
\class PrefsPanel
\brief Used within the PrefsDialog, classes derived from this class
include AudioIOPrefs, BatchPrefs, DirectoriesPrefs, FileFormatPrefs,
GUIPrefs, KeyConfigPrefs, MousePrefs, QualityPrefs, SpectrumPrefs and
ThemePrefs.
The interface works like this: Each panel in the preferences dialog
must derive from PrefsPanel. You must override Apply() with code
to validate fields (returning false if any are bad), updating the
global preferences object gPrefs, and instructing the applicable parts
of the program to re-read the preference options.
To actually add a the new panel, edit the PrefsDialog constructor
to append the panel to its list of panels.
*//*******************************************************************/
#ifndef __AUDACITY_PREFS_PANEL__
#define __AUDACITY_PREFS_PANEL__
#include <wx/panel.h>
#include <wx/window.h>
/* A few constants for an attempt at semi-uniformity */
#define PREFS_FONT_SIZE 8
/* these are spacing guidelines: ie. radio buttons should have a 5 pixel
* border on each side */
#define RADIO_BUTTON_BORDER 5
#define TOP_LEVEL_BORDER 5
#define GENERIC_CONTROL_BORDER 5
class PrefsPanel:public wxPanel
{
public:
PrefsPanel(wxWindow * parent, wxString title)
: wxPanel(parent, wxID_ANY)
{
SetLabel(title); // Provide visual label
SetName(title); // Provide audible label
}
virtual ~PrefsPanel()
{
}
virtual bool Apply() = 0;
virtual void Cancel()
{
}
};
#endif
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
// arch-tag: 0ed163a8-b4fa-4992-bd7e-89657c56eeb8

112
src/prefs/ProjectsPrefs.cpp Normal file
View File

@@ -0,0 +1,112 @@
/**********************************************************************
Audacity: A Digital Audio Editor
ProjectsPrefs.cpp
Joshua Haberman
Dominic Mazzoni
James Crook
*******************************************************************//**
\class ProjectsPrefs
\brief A PrefsPanel used to select options related to Audacity Project
handling.
*//*******************************************************************/
#include "../Audacity.h"
#include <wx/defs.h>
#include <wx/textctrl.h>
#include "../Prefs.h"
#include "../ShuttleGui.h"
#include "ProjectsPrefs.h"
////////////////////////////////////////////////////////////////////////////////
ProjectsPrefs::ProjectsPrefs(wxWindow * parent)
: PrefsPanel(parent, _("Projects"))
{
Populate();
}
ProjectsPrefs::~ProjectsPrefs()
{
}
/// Creates the dialog and its contents.
void ProjectsPrefs::Populate()
{
//------------------------- Main section --------------------
// Now construct the GUI itself.
// Use 'eIsCreatingFromPrefs' so that the GUI is
// initialised with values from gPrefs.
ShuttleGui S(this, eIsCreatingFromPrefs);
PopulateOrExchange(S);
// ----------------------- End of main section --------------
}
void ProjectsPrefs::PopulateOrExchange(ShuttleGui & S)
{
wxTextCtrl *w;
S.SetBorder(2);
S.StartStatic(_("When saving a project that depends on other audio files"));
{
S.StartRadioButtonGroup(wxT("/FileFormats/SaveProjectWithDependencies"), wxT("ask"));
{
S.TieRadioButton(_("&Always copy all audio into project (safest)"),
wxT("copy"));
S.TieRadioButton(_("Do &not copy any audio"),
wxT("never"));
S.TieRadioButton(_("As&k user"),
wxT("ask"));
}
S.EndRadioButtonGroup();
}
S.EndStatic();
S.StartStatic(_("Auto save"));
{
S.TieCheckBox(_("Auto &save a copy of the project in a separate folder"),
wxT("/Directories/AutoSaveEnabled"),
true);
S.StartThreeColumn();
{
w = S.TieTextBox(_("Auto save in&terval:"),
wxT("/Directories/AutoSaveMinutes"),
2.0,
9);
S.AddUnits(_("minutes"));
w->SetName(w->GetName() + wxT(" ") + _("minutes"));
}
S.EndThreeColumn();
}
S.EndStatic();
}
bool ProjectsPrefs::Apply()
{
ShuttleGui S(this, eIsSavingToPrefs);
PopulateOrExchange(S);
return true;
}
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
// arch-tag: 427b9e64-3fc6-40ef-bbf8-e6fff1d442f0

47
src/prefs/ProjectsPrefs.h Normal file
View File

@@ -0,0 +1,47 @@
/**********************************************************************
Audacity: A Digital Audio Editor
ProjectsPrefs.h
Joshua Haberman
Dominic Mazzoni
James Crook
**********************************************************************/
#ifndef __AUDACITY_PROJECT_PREFS__
#define __AUDACITY_PROJECT_PREFS__
#include <wx/defs.h>
#include <wx/window.h>
#include "../ShuttleGui.h"
#include "PrefsPanel.h"
class ProjectsPrefs:public PrefsPanel
{
public:
ProjectsPrefs(wxWindow * parent);
~ProjectsPrefs();
virtual bool Apply();
private:
void Populate();
void PopulateOrExchange(ShuttleGui & S);
};
#endif
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
// arch-tag: 300a00cc-0770-45a1-8ab5-88cfb7ae1239

247
src/prefs/QualityPrefs.cpp Normal file
View File

@@ -0,0 +1,247 @@
/**********************************************************************
Audacity: A Digital Audio Editor
QualityPrefs.cpp
Joshua Haberman
James Crook
*******************************************************************//**
\class QualityPrefs
\brief A PrefsPanel used for setting audio quality.
*//*******************************************************************/
#include "../Audacity.h"
#include <wx/defs.h>
#include "../AudioIO.h"
#include "../Dither.h"
#include "../Prefs.h"
#include "../Resample.h"
#include "../SampleFormat.h"
#include "../ShuttleGui.h"
#include "QualityPrefs.h"
#define ID_SAMPLE_RATE_CHOICE 7001
BEGIN_EVENT_TABLE(QualityPrefs, PrefsPanel)
EVT_CHOICE(ID_SAMPLE_RATE_CHOICE, QualityPrefs::OnSampleRateChoice)
END_EVENT_TABLE()
QualityPrefs::QualityPrefs(wxWindow * parent)
: PrefsPanel(parent, _("Quality"))
{
Populate();
}
QualityPrefs::~QualityPrefs()
{
}
void QualityPrefs::Populate()
{
// First any pre-processing for constructing the GUI.
GetNamesAndLabels();
gPrefs->Read(wxT("/SamplingRate/DefaultProjectSampleRate"),
&mOtherSampleRateValue,
44100);
//------------------------- Main section --------------------
// Now construct the GUI itself.
// Use 'eIsCreatingFromPrefs' so that the GUI is
// initialised with values from gPrefs.
ShuttleGui S(this, eIsCreatingFromPrefs);
PopulateOrExchange(S);
// ----------------------- End of main section --------------
wxCommandEvent e;
OnSampleRateChoice(e); // Enable/disable the control.
}
/// Gets the lists of names and lists of labels which are
/// used in the choice controls.
/// The names are what the user sees in the wxChoice.
/// The corresponding labels are what gets stored.
void QualityPrefs::GetNamesAndLabels()
{
//------------ Dither Names
mDitherNames.Add(_("None")); mDitherLabels.Add(Dither::none);
mDitherNames.Add(_("Rectangle")); mDitherLabels.Add(Dither::rectangle);
mDitherNames.Add(_("Triangle")); mDitherLabels.Add(Dither::triangle);
mDitherNames.Add(_("Shaped")); mDitherLabels.Add(Dither::shaped);
//------------ Sample Rate Names
// JKC: I don't understand the following comment.
// Can someone please explain or correct it?
// XXX: This should use a previously changed, but not yet saved
// sound card setting from the "I/O" preferences tab.
// LLL: It means that until the user clicks "Ok" in preferences, the
// GetSupportedSampleRates() call should use the devices they
// may have changed on the Audio I/O page. As coded, the sample
// rates it will return could be completely invalid as they will
// be what's supported by the devices that were selected BEFORE
// coming into preferences.
//
// GetSupportedSampleRates() allows passing in device names, but
// how do you get at them as they are on the Audio I/O page????
for (int i = 0; i < AudioIO::NumStandardRates; i++) {
int iRate = AudioIO::StandardRates[i];
mSampleRateLabels.Add(iRate);
mSampleRateNames.Add(wxString::Format(wxT("%i Hz"), iRate));
}
mSampleRateNames.Add(_("Other..."));
// The label for the 'Other...' case can be any value at all.
mSampleRateLabels.Add(44100); // If chosen, this value will be overwritten
//------------- Sample Format Names
mSampleFormatNames.Add(wxT("16-bit")); mSampleFormatLabels.Add(int16Sample);
mSampleFormatNames.Add(wxT("24-bit")); mSampleFormatLabels.Add(int24Sample);
mSampleFormatNames.Add(wxT("32-bit float")); mSampleFormatLabels.Add(floatSample);
//------------- Converter Names
// We used to set and get best/fast method via Resample.cpp.
// Need to ensure that preferences strings in Resample.cpp match.
// int converterHQ = Resample::GetBestMethod();
// int converter = Resample::GetFastMethod();
int numConverters = Resample::GetNumMethods();
for (int i = 0; i < numConverters; i++) {
mConverterNames.Add(Resample::GetMethodName(i));
mConverterLabels.Add(i);
}
}
void QualityPrefs::PopulateOrExchange(ShuttleGui & S)
{
S.SetBorder(2);
S.StartStatic(_("Sampling"));
{
S.StartMultiColumn(2);
{
S.AddPrompt(_("Default Sample &Rate:"));
S.StartMultiColumn(2);
{
// If the value in Prefs isn't in the list, then we want
// the last item, 'Other...' to be shown.
S.SetNoMatchSelector(mSampleRateNames.GetCount() - 1);
// First the choice...
// We make sure it uses the ID we want, so that we get changes
S.Id(ID_SAMPLE_RATE_CHOICE);
// We make sure we have a pointer to it, so that we can drive it.
mSampleRates = S.TieChoice(wxT(""),
wxT("/SamplingRate/DefaultProjectSampleRate"),
AudioIO::GetOptimalSupportedSampleRate(),
mSampleRateNames,
mSampleRateLabels);
S.SetSizeHints(mSampleRateNames);
// Now do the edit box...
mOtherSampleRate = S.TieTextBox(wxT(""),
mOtherSampleRateValue,
15);
}
S.EndHorizontalLay();
S.TieChoice(_("Default Sample &Format:"),
wxT("/SamplingRate/DefaultProjectSampleFormat"),
floatSample,
mSampleFormatNames,
mSampleFormatLabels);
S.SetSizeHints(mSampleFormatNames);
}
S.EndMultiColumn();
}
S.EndStatic();
S.StartStatic(_("Real-time Conversion"));
{
S.StartMultiColumn(2, wxEXPAND);
{
S.SetStretchyCol(2);
S.TieChoice(_("Sample Rate Con&verter:"),
Resample::GetFastMethodKey(),
Resample::GetFastMethodDefault(),
mConverterNames,
mConverterLabels),
S.SetSizeHints(mConverterNames);
S.TieChoice(_("&Dither:"),
wxT("/Quality/DitherAlgorithm"),
Dither::none,
mDitherNames,
mDitherLabels);
S.SetSizeHints(mDitherNames);
}
S.EndMultiColumn();
}
S.EndStatic();
S.StartStatic(_("High-quality Conversion"));
{
S.StartMultiColumn(2);
{
S.TieChoice(_("Sample Rate Conver&ter:"),
Resample::GetBestMethodKey(),
Resample::GetBestMethodDefault(),
mConverterNames,
mConverterLabels),
S.SetSizeHints(mConverterNames);
S.TieChoice(_("Dit&her:"),
wxT("/Quality/HQDitherAlgorithm"),
Dither::shaped,
mDitherNames,
mDitherLabels);
S.SetSizeHints(mDitherNames);
}
S.EndMultiColumn();
}
S.EndStatic();
}
/// Enables or disables the Edit box depending on
/// whether we selected 'Other...' or not.
void QualityPrefs::OnSampleRateChoice(wxCommandEvent & e)
{
int sel = mSampleRates->GetSelection();
mOtherSampleRate->Enable(sel == (int)mSampleRates->GetCount() - 1);
}
bool QualityPrefs::Apply()
{
ShuttleGui S(this, eIsSavingToPrefs);
PopulateOrExchange(S);
// The complex compound control may have value 'other' in which case the
// value in prefs comes from the second field.
if (mOtherSampleRate->IsEnabled()) {
gPrefs->Write(wxT("/SamplingRate/DefaultProjectSampleRate"), mOtherSampleRateValue);
}
// Tell CopySamples() to use these ditherers now
InitDitherers();
return true;
}
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
// arch-tag: 135e3a62-5d8a-472d-ab66-462a5157e6b8

67
src/prefs/QualityPrefs.h Normal file
View File

@@ -0,0 +1,67 @@
/**********************************************************************
Audacity: A Digital Audio Editor
QualityPrefs.h
Joshua Haberman
James Crook
**********************************************************************/
#ifndef __AUDACITY_QUALITY_PREFS__
#define __AUDACITY_QUALITY_PREFS__
#include <wx/defs.h>
#include <wx/arrstr.h>
#include <wx/choice.h>
#include <wx/dynarray.h>
#include <wx/textctrl.h>
#include "../ShuttleGui.h"
#include "PrefsPanel.h"
class QualityPrefs:public PrefsPanel
{
public:
QualityPrefs(wxWindow * parent);
virtual ~QualityPrefs();
virtual bool Apply();
private:
void Populate();
void PopulateOrExchange(ShuttleGui & S);
void GetNamesAndLabels();
void OnSampleRateChoice(wxCommandEvent & e);
wxArrayString mDitherNames;
wxArrayInt mDitherLabels;
wxArrayString mSampleRateNames;
wxArrayInt mSampleRateLabels;
wxArrayString mSampleFormatNames;
wxArrayInt mSampleFormatLabels;
wxArrayString mConverterNames;
wxArrayInt mConverterLabels;
wxChoice *mSampleRates;
wxTextCtrl *mOtherSampleRate;
int mOtherSampleRateValue;
DECLARE_EVENT_TABLE();
};
#endif
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
// arch-tag: ccb794d2-45d5-4f7b-ba0c-6a4d2438ac93

View File

@@ -0,0 +1,212 @@
/**********************************************************************
Audacity: A Digital Audio Editor
RecordingPrefs.cpp
Joshua Haberman
Dominic Mazzoni
James Crook
*******************************************************************//**
\class RecordingPrefs
\brief A PrefsPanel used to select recording options.
Presents interface for user to update the various recording options
like playthrough, latency correction, and others.
*//********************************************************************/
#include "../Audacity.h"
#include <wx/defs.h>
#include <wx/textctrl.h>
#include <algorithm>
#include "../AudioIO.h"
#include "../Envelope.h"
#include "../Prefs.h"
#include "../ShuttleGui.h"
#include "RecordingPrefs.h"
using std::min;
RecordingPrefs::RecordingPrefs(wxWindow * parent)
: PrefsPanel(parent, _("Recording"))
{
Populate();
}
RecordingPrefs::~RecordingPrefs()
{
}
void RecordingPrefs::Populate()
{
//------------------------- Main section --------------------
// Now construct the GUI itself.
// Use 'eIsCreatingFromPrefs' so that the GUI is
// initialised with values from gPrefs.
ShuttleGui S(this, eIsCreatingFromPrefs);
PopulateOrExchange(S);
// ----------------------- End of main section --------------
}
void RecordingPrefs::PopulateOrExchange(ShuttleGui & S)
{
wxTextCtrl *w;
S.SetBorder(2);
S.StartStatic(_("Playthrough"));
{
S.TieCheckBox(_("Overdub: &Play other tracks while recording new one"),
wxT("/AudioIO/Duplex"),
true);
#if defined(__WXMAC__)
S.TieCheckBox(_("&Hardware Playthrough: Listen while recording or monitoring new track"),
wxT("/AudioIO/Playthrough"),
false);
#endif
S.TieCheckBox(_("&Software Playthrough: Listen while recording or monitoring new track"),
wxT("/AudioIO/SWPlaythrough"),
false);
#if !defined(__WXMAC__)
S.AddUnits(wxString(wxT(" ")) + _("(uncheck when recording \"stereo mix\")"));
#endif
}
S.EndStatic();
S.StartStatic( _("Latency"));
{
S.StartThreeColumn();
{
// only show the following controls if we use Portaudio v19, because
// for Portaudio v18 we always use default buffer sizes
w = S.TieTextBox(_("Audio to &buffer:"),
wxT("/AudioIO/LatencyDuration"),
DEFAULT_LATENCY_DURATION,
9);
S.AddUnits(_("milliseconds (higher = more latency)"));
w->SetName(w->GetName() + wxT(" ") + _("milliseconds (higher = more latency)"));
w = S.TieTextBox(_("L&atency correction:"),
wxT("/AudioIO/LatencyCorrection"),
DEFAULT_LATENCY_CORRECTION,
9);
S.AddUnits(_("milliseconds (negative = backwards)"));
w->SetName(w->GetName() + wxT(" ") + _("milliseconds (negative = backwards)"));
}
S.EndThreeColumn();
}
S.EndStatic();
S.StartStatic(_("Sound Activated Recording"));
{
S.TieCheckBox(_("Sound Activated &Recording"),
wxT("/AudioIO/SoundActivatedRecord"),
false);
S.StartMultiColumn(2, wxEXPAND);
{
S.SetStretchyCol(1);
int dBRange = gPrefs->Read(wxT("/GUI/EnvdBRange"), ENV_DB_RANGE);
S.TieSlider(_("Sound Activation Le&vel (dB):"),
wxT("/AudioIO/SilenceLevel"),
-50,
0,
-dBRange);
}
S.EndMultiColumn();
}
S.EndStatic();
#ifdef AUTOMATED_INPUT_LEVEL_ADJUSTMENT
S.StartStatic(_("Automated Input Level Adjustment"));
{
S.TieCheckBox(_("Enable Automated Input Level Adjustment."),
wxT("/AudioIO/AutomatedInputLevelAdjustment"),
false);
S.StartMultiColumn(2, wxEXPAND);
{
S.SetStretchyCol(1);
S.TieSlider(_("Target Peak:"),
wxT("/AudioIO/TargetPeak"),
AILA_DEF_TARGET_PEAK,
100,
0);
S.TieSlider(_("Within:"),
wxT("/AudioIO/DeltaPeakVolume"),
AILA_DEF_DELTA_PEAK,
100,
0);
}
S.EndMultiColumn();
S.StartThreeColumn();
{
S.TieTextBox(_("Analysis Time:"),
wxT("/AudioIO/AnalysisTime"),
AILA_DEF_ANALYSIS_TIME,
9);
S.AddUnits(_("milliseconds (time of one analysis)"));
S.TieTextBox(_("Number of consecutive analysis:"),
wxT("/AudioIO/NumberAnalysis"),
AILA_DEF_NUMBER_ANALYSIS,
2);
S.AddUnits(_("0 means endless"));
}
S.EndThreeColumn();
}
S.EndStatic();
#endif
}
bool RecordingPrefs::Apply()
{
ShuttleGui S(this, eIsSavingToPrefs);
PopulateOrExchange(S);
double latencyDuration = DEFAULT_LATENCY_DURATION;
gPrefs->Read(wxT("/AudioIO/LatencyDuration"), &latencyDuration);
if (latencyDuration < 0) {
gPrefs->Write(wxT("/AudioIO/LatencyDuration"), DEFAULT_LATENCY_DURATION);
}
#ifdef AUTOMATED_INPUT_LEVEL_ADJUSTMENT
double targetpeak, deltapeak;
gPrefs->Read(wxT("/AudioIO/TargetPeak"), &targetpeak);
gPrefs->Read(wxT("/AudioIO/DeltaPeakVolume"), &deltapeak);
if (targetpeak + deltapeak > 100.0 || targetpeak - deltapeak < 0.0)
gPrefs->Write(wxT("/AudioIO/DeltaPeakVolume"), min(100.0 - targetpeak, targetpeak));
int value;
gPrefs->Read(wxT("/AudioIO/AnalysisTime"), &value);
if (value <= 0)
gPrefs->Write(wxT("/AudioIO/AnalysisTime"), AILA_DEF_ANALYSIS_TIME);
gPrefs->Read(wxT("/AudioIO/NumberAnalysis"), &value);
if (value < 0)
gPrefs->Write(wxT("/AudioIO/NumberAnalysis"), AILA_DEF_NUMBER_ANALYSIS);
#endif
return true;
}
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
// arch-tag: d6904b91-a320-4194-8d60-caa9175b6bb4

View File

@@ -0,0 +1,46 @@
/**********************************************************************
Audacity: A Digital Audio Editor
RecordingPrefs.h
Joshua Haberman
James Crook
**********************************************************************/
#ifndef __AUDACITY_RECORDING_PREFS__
#define __AUDACITY_RECORDING_PREFS__
#include <wx/defs.h>
#include <wx/window.h>
#include "../ShuttleGui.h"
#include "PrefsPanel.h"
class RecordingPrefs:public PrefsPanel
{
public:
RecordingPrefs(wxWindow * parent);
virtual ~RecordingPrefs();
virtual bool Apply();
private:
void Populate();
void PopulateOrExchange(ShuttleGui & S);
};
#endif
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
// arch-tag: df22b108-e989-4ec4-a8b6-dddbcc7be6a7

302
src/prefs/SpectrumPrefs.cpp Normal file
View File

@@ -0,0 +1,302 @@
/**********************************************************************
Audacity: A Digital Audio Editor
SpectrumPrefs.cpp
Dominic Mazzoni
James Crook
*******************************************************************//**
\class SpectrumPrefs
\brief A PrefsPanel for spectrum settings.
*//*******************************************************************/
#include "../Audacity.h"
#include <wx/defs.h>
#include <wx/intl.h>
#include <wx/msgdlg.h>
#include "../Prefs.h"
#include "../Project.h"
#include "../ShuttleGui.h"
#include "SpectrumPrefs.h"
#include "../FFT.h"
SpectrumPrefs::SpectrumPrefs(wxWindow * parent)
: PrefsPanel(parent, _("Spectrograms"))
{
Populate();
}
SpectrumPrefs::~SpectrumPrefs()
{
}
void SpectrumPrefs::Populate()
{
mSizeChoices.Add(_("8 - most wideband"));
mSizeChoices.Add(_("16"));
mSizeChoices.Add(_("32"));
mSizeChoices.Add(_("64"));
mSizeChoices.Add(_("128"));
mSizeChoices.Add(_("256 - default"));
mSizeChoices.Add(_("512"));
mSizeChoices.Add(_("1024"));
mSizeChoices.Add(_("2048"));
#ifdef EXPERIMENTAL_FIND_NOTES
mSizeChoices.Add(_("4096"));
mSizeChoices.Add(_("8192"));
mSizeChoices.Add(_("16384"));
mSizeChoices.Add(_("32768 - most narrowband"));
#else
mSizeChoices.Add(_("4096 - most narrowband"));
#endif //LOGARITHMIC_SPECTRUM
for (size_t i = 0; i < mSizeChoices.GetCount(); i++) {
mSizeCodes.Add(1 << (i + 3));
}
for (int i = 0; i < NumWindowFuncs(); i++) {
mTypeChoices.Add(WindowFuncName(i));
mTypeCodes.Add(i);
}
//------------------------- Main section --------------------
// Now construct the GUI itself.
// Use 'eIsCreatingFromPrefs' so that the GUI is
// initialised with values from gPrefs.
ShuttleGui S(this, eIsCreatingFromPrefs);
PopulateOrExchange(S);
// ----------------------- End of main section --------------
}
void SpectrumPrefs::PopulateOrExchange(ShuttleGui & S)
{
S.SetBorder(2);
S.StartStatic(_("FFT Window"));
{
S.StartMultiColumn(2);
{
S.TieChoice(_("Window &size") + wxString(wxT(":")),
wxT("/Spectrum/FFTSize"),
256,
mSizeChoices,
mSizeCodes);
S.SetSizeHints(mSizeChoices);
S.TieChoice(_("Window &type") + wxString(wxT(":")),
wxT("/Spectrum/WindowType"),
3,
mTypeChoices,
mTypeCodes);
S.SetSizeHints(mTypeChoices);
}
S.EndMultiColumn();
}
S.EndStatic();
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS
wxArrayString wskipn;
wxArrayInt wskipv;
for (size_t i = 0; i < 7; i++) {
wskipn.Add(wxString::Format(wxT("%d"), (1 << i) - 1));
wskipv.Add((1 << i) - 1);
}
S.StartStatic(_("FFT Skip Points"));
{
S.StartMultiColumn(2);
{
S.TieChoice(_("Skip Points") + wxString(wxT(":")),
wxT("/Spectrum/FFTSkipPoints"),
0,
wskipn,
wskipv);
S.SetSizeHints(wskipn);
}
S.EndMultiColumn();
}
S.EndStatic();
#endif //EXPERIMENTAL_FFT_SKIP_POINTS
S.StartStatic(_("Display"));
{
S.StartTwoColumn();
{
mMinFreq =
S.TieTextBox(_("Mi&nimum Frequency (Hz):"),
wxT("/Spectrum/MinFreq"),
0,
12);
mMaxFreq =
S.TieTextBox(_("Ma&ximum Frequency (Hz):"),
wxT("/Spectrum/MaxFreq"),
8000,
12);
mGain =
S.TieTextBox(_("&Gain (dB):"),
wxT("/Spectrum/Gain"),
20,
8);
mRange =
S.TieTextBox(_("&Range (dB):"),
wxT("/Spectrum/Range"),
80,
8);
mFrequencyGain =
S.TieTextBox(_("Frequency g&ain (dB/dec):"),
wxT("/Spectrum/FrequencyGain"),
0,
4);
}
S.EndTwoColumn();
S.TieCheckBox(_("S&how the spectrum using grayscale colors"),
wxT("/Spectrum/Grayscale"),
false);
#ifdef EXPERIMENTAL_FFT_Y_GRID
S.TieCheckBox(_("Show a grid along the &Y-axis"),
wxT("/Spectrum/FFTYGrid"),
false);
#endif //EXPERIMENTAL_FFT_Y_GRID
}
S.EndStatic();
#ifdef EXPERIMENTAL_FIND_NOTES
S.StartStatic(_("FFT Find Notes"));
{
S.StartTwoColumn();
{
mFindNotesMinA =
S.TieTextBox(_("Minimum Amplitude (dB):"),
wxT("/Spectrum/FindNotesMinA"),
-30L,
8);
mFindNotesN =
S.TieTextBox(_("Max. Number of Notes (1..128):"),
wxT("/Spectrum/FindNotesN"),
5L,
8);
}
S.EndTwoColumn();
S.TieCheckBox(_("&Find Notes"),
wxT("/Spectrum/FFTFindNotes"),
false);
S.TieCheckBox(_("&Quantize Notes"),
wxT("/Spectrum/FindNotesQuantize"),
false);
}
S.EndStatic();
#endif //EXPERIMENTAL_FIND_NOTES
}
bool SpectrumPrefs::Validate()
{
long maxFreq;
if (!mMaxFreq->GetValue().ToLong(&maxFreq)) {
wxMessageBox(_("The maximum frequency must be an integer"));
return false;
}
if (maxFreq < 100 || maxFreq > 100000) {
wxMessageBox(_("Maximum frequency must be in the range 100 Hz - 100,000 Hz"));
return false;
}
long minFreq;
if (!mMinFreq->GetValue().ToLong(&minFreq)) {
wxMessageBox(_("The minimum frequency must be an integer"));
return false;
}
if (minFreq < 0) {
wxMessageBox(_("Minimum frequency must be at least 0 Hz"));
return false;
}
if (maxFreq < minFreq) {
wxMessageBox(_("Minimum frequency must be less than maximum frequency"));
return false;
}
long gain;
if (!mGain->GetValue().ToLong(&gain)) {
wxMessageBox(_("The gain must be an integer"));
return false;
}
long range;
if (!mRange->GetValue().ToLong(&range)) {
wxMessageBox(_("The range must be a positive integer"));
return false;
}
if (range <= 0) {
wxMessageBox(_("The range must be at least 1 dB"));
return false;
}
long frequencygain;
if (!mFrequencyGain->GetValue().ToLong(&frequencygain)) {
wxMessageBox(_("The frequency gain must be an integer"));
return false;
}
if (frequencygain < 0) {
wxMessageBox(_("The frequency gain cannot be negative"));
return false;
}
if (frequencygain > 60) {
wxMessageBox(_("The frequency gain must be no more than 60 dB/dec"));
return false;
}
#ifdef EXPERIMENTAL_FIND_NOTES
long findNotesMinA;
if (!mFindNotesMinA->GetValue().ToLong(&findNotesMinA)) {
wxMessageBox(_("The minimum amplitude (dB) must be an integer"));
return false;
}
long findNotesN;
if (!mFindNotesN->GetValue().ToLong(&findNotesN)) {
wxMessageBox(_("The maximum number of notes must be an integer"));
return false;
}
if (findNotesN < 1 || findNotesN > 128) {
wxMessageBox(_("The maximum number of notes must be in the range 1..128"));
return false;
}
#endif //EXPERIMENTAL_FIND_NOTES
return true;
}
bool SpectrumPrefs::Apply()
{
ShuttleGui S(this, eIsSavingToPrefs);
PopulateOrExchange(S);
return true;
}
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
// arch-tag: 54d8e954-f415-40e9-afa4-9d53ab37770d

76
src/prefs/SpectrumPrefs.h Normal file
View File

@@ -0,0 +1,76 @@
/**********************************************************************
Audacity: A Digital Audio Editor
SpectrumPrefs.h
Dominic Mazzoni
James Crook
**********************************************************************/
/*
Salvo Ventura
November 2006
Added selection box for windowType
All params are saved in config file.
*/
#ifndef __AUDACITY_SPECTRUM_PREFS__
#define __AUDACITY_SPECTRUM_PREFS__
#include <wx/defs.h>
#include <wx/string.h>
#include <wx/window.h>
#include "../Experimental.h"
#include "../ShuttleGui.h"
#include "PrefsPanel.h"
class SpectrumPrefs:public PrefsPanel
{
public:
SpectrumPrefs(wxWindow * parent);
virtual ~SpectrumPrefs();
virtual bool Apply();
virtual bool Validate();
private:
void Populate();
void PopulateOrExchange(ShuttleGui & S);
wxTextCtrl *mMinFreq;
wxTextCtrl *mMaxFreq;
wxTextCtrl *mGain;
wxTextCtrl *mRange;
wxTextCtrl *mFrequencyGain;
wxArrayString mSizeChoices;
wxArrayInt mSizeCodes;
wxArrayString mTypeChoices;
wxArrayInt mTypeCodes;
#ifdef EXPERIMENTAL_FIND_NOTES
wxTextCtrl *mFindNotesMinA;
wxTextCtrl *mFindNotesN;
#endif
};
#endif
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
// arch-tag: d68b1a74-12e3-49a5-a50b-3ba6fe65b40b

218
src/prefs/ThemePrefs.cpp Normal file
View File

@@ -0,0 +1,218 @@
/**********************************************************************
Audacity: A Digital Audio Editor
ThemePrefs.cpp
James Crook
Audacity is free software.
This file is licensed under the wxWidgets license, see License.txt
********************************************************************//**
\class ThemePrefs
\brief A PrefsPanel that configures dynamic loading of Theme
icons and colours.
Provides:
- Button to save current theme as a single png image.
- Button to load theme from a single png image.
- Button to save current theme to multiple png images.
- Button to load theme from multiple png images.
- (Optional) Button to save theme as Cee data.
- Button to read theme from default values in program.
- CheckBox for loading custom themes at startup.
\see \ref Themability
*//********************************************************************/
#include "../Audacity.h"
#include <wx/wxprec.h>
#include "../Prefs.h"
#include "../Theme.h"
#include "../Project.h"
#include "../ShuttleGui.h"
#include "ThemePrefs.h"
#include "../AColor.h"
enum eThemePrefsIds {
idLoadThemeCache=7000,
idSaveThemeCache,
idLoadThemeComponents,
idSaveThemeComponents,
idReadThemeInternal,
idSaveThemeAsCode
};
BEGIN_EVENT_TABLE(ThemePrefs, PrefsPanel)
EVT_BUTTON(idLoadThemeCache, ThemePrefs::OnLoadThemeCache)
EVT_BUTTON(idSaveThemeCache, ThemePrefs::OnSaveThemeCache)
EVT_BUTTON(idLoadThemeComponents, ThemePrefs::OnLoadThemeComponents)
EVT_BUTTON(idSaveThemeComponents, ThemePrefs::OnSaveThemeComponents)
EVT_BUTTON(idReadThemeInternal, ThemePrefs::OnReadThemeInternal)
EVT_BUTTON(idSaveThemeAsCode, ThemePrefs::OnSaveThemeAsCode)
END_EVENT_TABLE()
ThemePrefs::ThemePrefs(wxWindow * parent)
: PrefsPanel(parent, _("Theme"))
{
Populate();
}
ThemePrefs::~ThemePrefs(void)
{
}
/// Creates the dialog and its contents.
void ThemePrefs::Populate()
{
// First any pre-processing for constructing the GUI.
//------------------------- Main section --------------------
// Now construct the GUI itself.
// Use 'eIsCreatingFromPrefs' so that the GUI is
// initialised with values from gPrefs.
ShuttleGui S(this, eIsCreatingFromPrefs);
PopulateOrExchange(S);
// ----------------------- End of main section --------------
}
/// Create the dialog contents, or exchange data with it.
void ThemePrefs::PopulateOrExchange(ShuttleGui & S)
{
S.SetBorder(2);
S.StartStatic(_("Info"));
{
S.AddFixedText(
_("Themability is an experimental feature.\n\nTo try it out, click \"Save Theme Cache\" then find and modify the images and colors in\nImageCacheVxx.png using an image editor such as the Gimp.\n\nClick \"Load Theme Cache\" to load the changed images and colors back into Audacity.\n\n[Only the control toolbar and the colors on the wavetrack are currently affected, even\nthough the image file shows other icons too.]")
);
#ifdef __WXDEBUG__
S.AddFixedText(
_("You have compiled Audacity with an extra button, 'Output Sourcery'. This will save a\nC version of the image cache that can be compiled in as a default.")
);
#endif
S.AddFixedText(
_("If 'Load Theme Cache At Startup' is checked, then the Theme Cache will be loaded\nwhen the program starts up.")
);
S.AddFixedText(
_("Saving and loading individual theme files uses a separate file for each image, but is\notherwise the same idea.")
);
}
S.EndStatic();
/* i18n-hint: && in here is an escape character to get a single & on screen,
* so keep it as is */
S.StartStatic( _("Theme Cache - Images && Color"));
{
S.StartHorizontalLay(wxALIGN_LEFT);
{
S.Id(idSaveThemeCache).AddButton(_("Save Theme Cache"));
S.Id(idLoadThemeCache).AddButton(_("Load Theme Cache"));
// This next button is only provided in Debug mode.
// It is for developers who are compiling Audacity themselves
// and who who wish to generate a new ThemeAsCeeCode.h and compile it in.
#ifdef __WXDEBUG__
S.Id(idSaveThemeAsCode).AddButton(wxT("Output Sourcery"));
#endif
S.Id(idReadThemeInternal).AddButton(_("&Defaults"));
}
S.EndHorizontalLay();
S.StartHorizontalLay(wxALIGN_LEFT);
{
S.TieCheckBox(_("Load Theme Cache At Startup"),
wxT("/Theme/LoadAtStart"),
false);
}
S.EndHorizontalLay();
}
S.EndStatic();
// JKC: 'Ergonomic' details:
// Theme components are used much less frequently than
// the ImageCache. Yet it's easy to click them 'by mistake'.
//
// To reduce that risk, we use a separate box to separate them off.
// And choose text on the buttons that is shorter, making the
// buttons smaller and less tempting to click.
S.StartStatic( _("Individual Theme Files"),1);
{
S.StartHorizontalLay(wxALIGN_LEFT);
{
S.Id(idSaveThemeComponents).AddButton( _("Save Files"));
S.Id(idLoadThemeComponents).AddButton( _("Load Files"));
}
S.EndHorizontalLay();
}
S.EndStatic();
}
/// Load Theme from multiple png files.
void ThemePrefs::OnLoadThemeComponents(wxCommandEvent & e)
{
theTheme.LoadComponents();
theTheme.ApplyUpdatedImages();
}
/// Save Theme to multiple png files.
void ThemePrefs::OnSaveThemeComponents(wxCommandEvent & e)
{
theTheme.SaveComponents();
}
/// Load Theme from single png file.
void ThemePrefs::OnLoadThemeCache(wxCommandEvent & e)
{
theTheme.ReadImageCache();
AColor::ReInit();
theTheme.ApplyUpdatedImages();
}
/// Save Theme to single png file.
void ThemePrefs::OnSaveThemeCache(wxCommandEvent & e)
{
theTheme.CreateImageCache();
theTheme.WriteImageMap();// bonus - give them the html version.
}
/// Read Theme from internal storage.
void ThemePrefs::OnReadThemeInternal(wxCommandEvent & e)
{
theTheme.ReadThemeInternal();
theTheme.ApplyUpdatedImages();
}
/// Save Theme as C source code.
void ThemePrefs::OnSaveThemeAsCode(wxCommandEvent & e)
{
theTheme.SaveThemeAsCode();
theTheme.WriteImageDefs();// bonus - give them the Defs too.
}
/// Update the preferences stored on disk.
bool ThemePrefs::Apply()
{
ShuttleGui S(this, eIsSavingToPrefs);
PopulateOrExchange(S);
return true;
}
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
// arch-tag: f09afeeb-9805-463a-b3ca-e3e3bfe05549

55
src/prefs/ThemePrefs.h Normal file
View File

@@ -0,0 +1,55 @@
/**********************************************************************
Audacity: A Digital Audio Editor
ThemePrefs.h
James Crook
Audacity is free software.
This file is licensed under the wxWidgets license, see License.txt
**********************************************************************/
#ifndef __AUDACITY_THEME_PREFS__
#define __AUDACITY_THEME_PREFS__
#include <wx/defs.h>
#include <wx/window.h>
#include "../ShuttleGui.h"
#include "PrefsPanel.h"
class ThemePrefs:public PrefsPanel
{
public:
ThemePrefs(wxWindow * parent);
~ThemePrefs(void);
virtual bool Apply();
private:
void Populate();
void PopulateOrExchange(ShuttleGui & S);
void OnLoadThemeComponents(wxCommandEvent & e);
void OnSaveThemeComponents(wxCommandEvent & e);
void OnLoadThemeCache(wxCommandEvent & e);
void OnSaveThemeCache(wxCommandEvent & e);
void OnReadThemeInternal(wxCommandEvent & e);
void OnSaveThemeAsCode(wxCommandEvent & e);
DECLARE_EVENT_TABLE();
};
#endif
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
// arch-tag: f09afeeb-9805-463a-b3ca-e3e3bfe05549

153
src/prefs/TracksPrefs.cpp Normal file
View File

@@ -0,0 +1,153 @@
/**********************************************************************
Audacity: A Digital Audio Editor
TracksPrefs.cpp
Brian Gunlogson
Joshua Haberman
Dominic Mazzoni
James Crook
*******************************************************************//**
\class TracksPrefs
\brief A PrefsPanel for track display and behavior properties.
*//*******************************************************************/
#include "../Audacity.h"
#include <wx/defs.h>
#include "../ShuttleGui.h"
#include "TracksPrefs.h"
////////////////////////////////////////////////////////////////////////////////
TracksPrefs::TracksPrefs(wxWindow * parent)
: PrefsPanel(parent, _("Tracks"))
{
Populate();
}
TracksPrefs::~TracksPrefs()
{
}
void TracksPrefs::Populate()
{
mSoloCodes.Add(wxT("Standard"));
mSoloCodes.Add(wxT("Simple"));
mSoloCodes.Add(wxT("None"));
mSoloChoices.Add(_("Standard"));
mSoloChoices.Add(_("Simple"));
mSoloChoices.Add(_("None"));
// Keep the same order as in TrackPanel.cpp menu: OnWaveformID, OnWaveformDBID, OnSpectrumID, OnSpectrumLogID, OnPitchID
mViewCodes.Add(0);
mViewCodes.Add(1);
mViewCodes.Add(2);
mViewCodes.Add(3);
mViewCodes.Add(4);
mViewChoices.Add(_("Waveform"));
mViewChoices.Add(_("Waveform (dB)"));
mViewChoices.Add(_("Spectrum"));
mViewChoices.Add(_("Spectrum log(f)"));
mViewChoices.Add(_("Pitch (EAC)"));
//------------------------- Main section --------------------
// Now construct the GUI itself.
// Use 'eIsCreatingFromPrefs' so that the GUI is
// initialised with values from gPrefs.
ShuttleGui S(this, eIsCreatingFromPrefs);
PopulateOrExchange(S);
// ----------------------- End of main section --------------
}
void TracksPrefs::PopulateOrExchange(ShuttleGui & S)
{
S.SetBorder(2);
S.StartStatic(_("Display"));
{
S.TieCheckBox(_("&Update display while playing"),
wxT("/GUI/AutoScroll"),
true);
S.TieCheckBox(_("Automatically &fit tracks vertically zoomed"),
wxT("/GUI/TracksFitVerticallyZoomed"),
false);
S.AddSpace(10);
S.StartMultiColumn(2);
{
S.TieChoice(_("Default &View Mode:"),
wxT("/GUI/DefaultViewMode"),
0,
mViewChoices,
mViewCodes);
S.SetSizeHints(mViewChoices);
}
S.EndMultiColumn();
}
S.EndStatic();
S.StartStatic(_("Behaviors"));
{
S.TieCheckBox(_("&Select all audio in project, if none selected"),
wxT("/GUI/SelectAllOnNone"),
true);
S.TieCheckBox(_("Enable cu&t lines"),
wxT("/GUI/EnableCutLines"),
false);
S.TieCheckBox(_("Enable &dragging of left and right selection edges"),
wxT("/GUI/AdjustSelectionEdges"),
true);
S.TieCheckBox(_("\"Move track focus\" c&ycles repeatedly through tracks"),
wxT("/GUI/CircularTrackNavigation"),
false);
S.TieCheckBox(_("Editing a clip can &move other clips"),
wxT("/GUI/EditClipCanMove"),
true);
S.AddSpace(10);
S.StartMultiColumn(2);
{
S.TieChoice(_("Solo &Button:"),
wxT("/GUI/Solo"),
wxT("Standard"),
mSoloChoices,
mSoloCodes);
S.SetSizeHints(mSoloChoices);
}
S.EndMultiColumn();
}
S.EndStatic();
}
bool TracksPrefs::Apply()
{
ShuttleGui S(this, eIsSavingToPrefs);
PopulateOrExchange(S);
return true;
}
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
// arch-tag: 7e997d04-6b94-4abb-b3d6-748400f86598

53
src/prefs/TracksPrefs.h Normal file
View File

@@ -0,0 +1,53 @@
/**********************************************************************
Audacity: A Digital Audio Editor
TracksPrefs.h
Brian Gunlogson
Joshua Haberman
James Crook
**********************************************************************/
#ifndef __AUDACITY_TRACKS_PREFS__
#define __AUDACITY_TRACKS_PREFS__
#include <wx/defs.h>
#include <wx/arrstr.h>
#include <wx/window.h>
#include "../ShuttleGui.h"
#include "PrefsPanel.h"
class TracksPrefs:public PrefsPanel
{
public:
TracksPrefs(wxWindow * parent);
~TracksPrefs();
virtual bool Apply();
private:
void Populate();
void PopulateOrExchange(ShuttleGui & S);
wxArrayString mSoloCodes;
wxArrayString mSoloChoices;
wxArrayInt mViewCodes;
wxArrayString mViewChoices;
};
#endif
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
// arch-tag: 57018e2b-d264-4f93-bfa7-06752ebf631e

View File

@@ -0,0 +1,94 @@
/**********************************************************************
Audacity: A Digital Audio Editor
WarningsPrefs.cpp
Brian Gunlogson
Joshua Haberman
Dominic Mazzoni
James Crook
*******************************************************************//**
\class WarningsPrefs
\brief A PrefsPanel to enable/disable certain warning messages.
*//*******************************************************************/
#include "../Audacity.h"
#include <wx/defs.h>
#include "../ShuttleGui.h"
#include "WarningsPrefs.h"
////////////////////////////////////////////////////////////////////////////////
WarningsPrefs::WarningsPrefs(wxWindow * parent)
: PrefsPanel(parent, _("Warnings"))
{
Populate();
}
WarningsPrefs::~WarningsPrefs()
{
}
void WarningsPrefs::Populate()
{
//------------------------- Main section --------------------
// Now construct the GUI itself.
// Use 'eIsCreatingFromPrefs' so that the GUI is
// initialised with values from gPrefs.
ShuttleGui S(this, eIsCreatingFromPrefs);
PopulateOrExchange(S);
// ----------------------- End of main section --------------
}
void WarningsPrefs::PopulateOrExchange(ShuttleGui & S)
{
S.SetBorder(2);
S.StartStatic(_("Show Warnings/Prompts for"));
{
S.TieCheckBox(_("Saving &projects"),
wxT("/Warnings/FirstProjectSave"),
true);
S.TieCheckBox(_("Saving &empty project"),
wxT("/GUI/EmptyCanBeDirty"),
true);
S.TieCheckBox(_("&Low disk space at program start up"),
wxT("/Warnings/DiskSpaceWarning"),
true);
S.TieCheckBox(_("Mixing down to &stereo during export"),
wxT("/Warnings/MixStereo"),
true);
S.TieCheckBox(_("Mixing down to &mono during export"),
wxT("/Warnings/MixMono"),
true);
}
S.EndStatic();
}
bool WarningsPrefs::Apply()
{
ShuttleGui S(this, eIsSavingToPrefs);
PopulateOrExchange(S);
return true;
}
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
// arch-tag: 7e997d04-6b94-4abb-b3d6-748400f86598

47
src/prefs/WarningsPrefs.h Normal file
View File

@@ -0,0 +1,47 @@
/**********************************************************************
Audacity: A Digital Audio Editor
WarningsPrefs.h
Brian Gunlogson
Joshua Haberman
James Crook
**********************************************************************/
#ifndef __AUDACITY_WARNINGS_PREFS__
#define __AUDACITY_WARNINGS_PREFS__
#include <wx/defs.h>
#include <wx/window.h>
#include "../ShuttleGui.h"
#include "PrefsPanel.h"
class WarningsPrefs:public PrefsPanel
{
public:
WarningsPrefs(wxWindow * parent);
~WarningsPrefs();
virtual bool Apply();
private:
void Populate();
void PopulateOrExchange(ShuttleGui & S);
};
#endif
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
// arch-tag: 57018e2b-d264-4f93-bfa7-06752ebf631e