1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-25 08:38:39 +02:00

Merge branch 'master'

This commit is contained in:
Paul Licameli 2015-08-16 14:39:32 -04:00
commit 6d0043860e
17 changed files with 165 additions and 59 deletions

View File

@ -337,6 +337,11 @@ void FileDialog::ShowWindowModal()
void FileDialog::DoOnFilterSelected(int index)
{
if (index == wxNOT_FOUND)
{
return;
}
NSArray* types = GetTypesFromExtension(m_filterExtensions[index],m_currentExtensions);
NSSavePanel* panel = (NSSavePanel*) GetWXWindow();
[panel setAllowedFileTypes:types];
@ -551,13 +556,15 @@ int FileDialog::ShowModal()
m_useFileTypeFilter = m_filterExtensions.GetCount() > 0;
#if defined(we_always_want_the_types)
if( HasFlag(wxFD_OPEN) )
{
if ( !(wxSystemOptions::HasOption( wxOSX_FILEDIALOG_ALWAYS_SHOW_TYPES ) && (wxSystemOptions::GetOptionInt( wxOSX_FILEDIALOG_ALWAYS_SHOW_TYPES ) == 1)) )
m_useFileTypeFilter = false;
}
#endif
m_firstFileTypeFilter = -1;
m_firstFileTypeFilter = wxNOT_FOUND;
if ( m_useFileTypeFilter
&& m_filterIndex >= 0 && m_filterIndex < m_filterExtensions.GetCount() )

View File

@ -14,7 +14,7 @@
#define FLAC__ALIGN_MALLOC_DATA 1
/* define if building for ia32/i386 */
/* #undef FLAC__CPU_IA32 */
#define FLAC__CPU_IA32 1
/* define if building for PowerPC */
/* #undef FLAC__CPU_PPC */
@ -26,7 +26,7 @@
/* #undef FLAC__CPU_SPARC */
/* define if building for x86_64 */
#define FLAC__CPU_X86_64 1
/* #undef FLAC__CPU_X86_64 */
/* define if you have docbook-to-man or docbook2man */
/* #undef FLAC__HAS_DOCBOOK_TO_MAN */
@ -168,7 +168,7 @@
#define SIZEOF_OFF_T 8
/* The size of `void*', as computed by sizeof. */
#define SIZEOF_VOIDP 8
#define SIZEOF_VOIDP 4
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1

View File

@ -1159,14 +1159,14 @@ bool AudacityApp::OnInit()
#ifdef AUDACITY_NAME
wxString appName = wxT(AUDACITY_NAME);
wxString vendorName = wxT(AUDACITY_NAME);
#else
wxString vendorName = wxT("Audacity");
wxString appName = wxT("Audacity");
#endif
wxTheApp->SetVendorName(vendorName);
wxTheApp->SetAppName(appName);
// Explicitly set since OSX will use it for the "Quit" menu item
wxTheApp->SetAppDisplayName(wxT("Audacity"));
wxTheApp->SetVendorName(wxT("Audacity"));
// Unused strings that we want to be translated, even though
// we're not using them yet...
@ -1465,10 +1465,14 @@ bool AudacityApp::OnInit()
return false;
}
// As of wx3, there's no need to process the filename arguments as they
// will be sent view the MacOpenFile() method.
#if !defined(__WXMAC__)
for (size_t i = 0, cnt = parser->GetParamCount(); i < cnt; i++)
{
MRUOpen(parser->GetParam(i));
}
}
#endif
}
delete parser;
@ -1596,7 +1600,7 @@ bool AudacityApp::CreateSingleInstanceChecker(wxString dir)
mChecker = new wxSingleInstanceChecker();
#if defined(__UNIX__)
wxString sockFile(defaultTempDir + wxT("/.audacity.sock"));
wxString sockFile(dir + wxT("/.audacity.sock"));
#endif
wxString runningTwoCopiesStr = _("Running two copies of Audacity simultaneously may cause\ndata loss or cause your system to crash.\n\n");

View File

@ -192,6 +192,7 @@
#define EXPERIMENTAL_TWO_TONE_TIME_RULER
// Define to include crash reporting
#include <wx/defs.h>
#define EXPERIMENTAL_CRASH_REPORT
#if !defined(wxUSE_DEBUGREPORT) || !wxUSE_DEBUGREPORT
#undef EXPERIMENTAL_CRASH_REPORT

View File

@ -1667,6 +1667,12 @@ bool LabelTrack::OnKeyDown(SelectedRegion &newSel, wxKeyEvent & event)
int keyCode = event.GetKeyCode();
int mods = event.GetModifiers();
// Check for modifiers and only allow shift
if (mods != wxMOD_NONE && mods != wxMOD_SHIFT) {
event.Skip();
return updated;
}
// All editing keys are only active if we're currently editing a label
if (mSelIndex >= 0) {
switch (keyCode) {
@ -1907,11 +1913,23 @@ bool LabelTrack::OnKeyDown(SelectedRegion &newSel, wxKeyEvent & event)
/// by OnKeyDown.
bool LabelTrack::OnChar(SelectedRegion &WXUNUSED(newSel), wxKeyEvent & event)
{
// Check for modifiers and only allow shift.
//
// We still need to check this or we will eat the top level menu accelerators
// on Windows if our capture or key down handlers skipped the event.
int mods = event.GetModifiers();
if (mods != wxMOD_NONE && mods != wxMOD_SHIFT) {
event.Skip();
return false;
}
// Only track true changes to the label
bool updated = false;
// Cache the character
wxChar charCode = event.GetUnicodeKey();
// Skip if it's not a valid unicode character or a control character
if (charCode == 0 || wxIscntrl(charCode)) {
event.Skip();
return false;

View File

@ -825,6 +825,8 @@ void AudacityProject::CreateMenusAndCommands()
#endif
c->AddItem(wxT("RescanDevices"), _("R&escan Audio Devices"), FN(OnRescanDevices));
c->EndMenu();
//////////////////////////////////////////////////////////////////////////
// Tracks Menu (formerly Project Menu)
//////////////////////////////////////////////////////////////////////////

View File

@ -1123,7 +1123,7 @@ bool Sequence::Read(samplePtr buffer, sampleFormat format,
if (result != len)
{
wxLogWarning(wxT("Expected to read %d samples, got %d samples."), len, result);
wxLogWarning(wxT("Expected to read %ld samples, got %d samples."), len, result);
if (result < 0)
result = 0;
ClearSamples(buffer, format, result, len-result);

View File

@ -6126,10 +6126,29 @@ void TrackPanel::HandleWheelRotation(wxMouseEvent & event)
Track *const pTrack = FindTrack(event.m_x, event.m_y, true, false, &rect);
if (pTrack && event.m_x >= GetVRulerOffset()) {
if (pTrack->GetKind() == Track::Wave) {
HandleWaveTrackVZoom(
mTracks, rect, event.m_y, event.m_y,
static_cast<WaveTrack*>(pTrack), false, (event.m_wheelRotation < 0),
true);
WaveTrack *const wt = static_cast<WaveTrack*>(pTrack);
if (event.CmdDown() &&
wt->GetWaveformSettings().scaleType == WaveformSettings::stLogarithmic) {
// Vary the bottom of the dB scale, but only if the midline is visible
float min, max;
wt->GetDisplayBounds(&min, &max);
if (min < 0.0 && max > 0.0) {
WaveformSettings &settings = wt->GetIndependentWaveformSettings();
if (event.m_wheelRotation < 0)
// Zoom out
settings.NextLowerDBRange();
else
settings.NextHigherDBRange();
}
else
return;
}
else {
HandleWaveTrackVZoom(
mTracks, rect, event.m_y, event.m_y,
wt, false, (event.m_wheelRotation < 0),
true);
}
UpdateVRuler(pTrack);
Refresh(false);
MakeParentModifyState(true);

View File

@ -179,36 +179,46 @@ public:
int FilterEvent(wxEvent& event)
{
// Quickly bail if this isn't something we want.
wxEventType type = event.GetEventType();
if (type != wxEVT_CHAR_HOOK && type != wxEVT_KEY_UP)
{
return Event_Skip;
}
// We must have a project since we will be working with the Command Manager
// and capture handler, both of which are (currently) tied to individual projects.
//
// Shouldn't they be tied to the application instead???
AudacityProject *project = GetActiveProject();
if (!project || !project->IsEnabled())
{
return Event_Skip;
}
// Make a copy of the event and (possibly) make it look like a key down
// event.
wxKeyEvent key = (wxKeyEvent &) event;
if (type == wxEVT_CHAR_HOOK)
{
key.SetEventType(wxEVT_KEY_DOWN);
}
// Give the capture handler first dibs at the event.
wxWindow *handler = project->GetKeyboardCaptureHandler();
if (handler && HandleCapture(handler, key))
{
return Event_Processed;
}
// Capture handler didn't want it, so ask the Command Manager.
CommandManager *manager = project->GetCommandManager();
if (manager && manager->FilterKeyEvent(project, key))
{
return Event_Processed;
}
// Give it back to WX for normal processing.
return Event_Skip;
}
@ -223,6 +233,7 @@ private:
}
wxEvtHandler *handler = target->GetEventHandler();
// We make a copy of the event because the capture handler may modify it.
wxKeyEvent temp = event;
#if defined(__WXGTK__)
@ -235,24 +246,35 @@ private:
}
#endif
// Ask the capture handler if the key down/up event is something they it
// might be interested in handling.
wxCommandEvent e(EVT_CAPTURE_KEY);
e.SetEventObject(&temp);
e.StopPropagation();
if (!handler->ProcessEvent(e))
{
return false;
}
// Now, let the handler process the normal key event.
bool keyDown = temp.GetEventType() == wxEVT_KEY_DOWN;
temp.WasProcessed();
temp.StopPropagation();
wxEventProcessInHandlerOnly onlyDown(temp, handler);
if (!handler->ProcessEvent(temp))
bool processed = handler->ProcessEvent(temp);
// Don't go any further if the capture handler didn't process
// the key down event.
if (!processed && keyDown)
{
return false;
}
if (temp.GetEventType() == wxEVT_KEY_DOWN)
// At this point the capture handler has either processed a key down event
// or we're dealing with a key up event.
//
// So, only generate the char events for key down events.
if (keyDown)
{
wxString chars = GetUnicodeString(temp);
for (size_t i = 0, cnt = chars.Length(); i < cnt; i++)
@ -267,9 +289,12 @@ private:
}
}
// We get here for processed key down events or for key up events, whether
// processed or not.
return true;
}
// Convert the key down event to a unicode string.
wxString GetUnicodeString(const wxKeyEvent & event)
{
wxString chars;
@ -425,7 +450,7 @@ void CommandManager::PurgeData()
/// Names it according to the passed-in string argument.
///
/// If the menubar already exists, simply returns it.
wxMenuBar *CommandManager::AddMenuBar(wxString sMenu)
wxMenuBar *CommandManager::AddMenuBar(const wxString & sMenu)
{
wxMenuBar *menuBar = GetMenuBar(sMenu);
if (menuBar)
@ -445,7 +470,7 @@ wxMenuBar *CommandManager::AddMenuBar(wxString sMenu)
///
/// Retrieves the menubar based on the name given in AddMenuBar(name)
///
wxMenuBar * CommandManager::GetMenuBar(wxString sMenu) const
wxMenuBar * CommandManager::GetMenuBar(const wxString & sMenu) const
{
for(unsigned int i = 0; i < mMenuBarList.GetCount(); i++)
{
@ -470,29 +495,26 @@ wxMenuBar * CommandManager::CurrentMenuBar() const
///
/// This makes a new menu and adds it to the 'CurrentMenuBar'
/// This starts a new menu
///
/// If the menu already exists, all of the items in it are
/// cleared instead.
///
void CommandManager::BeginMenu(wxString tNameIn)
void CommandManager::BeginMenu(const wxString & tName)
{
wxString tName = tNameIn;
wxMenu *tmpMenu = new wxMenu();
mCurrentMenu = tmpMenu;
mCurrentMenuName = tName;
CurrentMenuBar()->Append(mCurrentMenu, tName);
}
///
/// This ends a menu by setting the pointer to it
/// to NULL. It is still attached to the CurrentMenuBar()
/// This attaches a menu to the menubar and ends the menu
///
void CommandManager::EndMenu()
{
// Add the menu to the menubard after all menu items have been
// added to the menu to allow OSX to rearrange special menu
// items like Preferences, About, and Quit.
CurrentMenuBar()->Append(mCurrentMenu, mCurrentMenuName);
mCurrentMenu = NULL;
mCurrentMenuName = COMMAND;
}
@ -501,10 +523,8 @@ void CommandManager::EndMenu()
///
/// This starts a new submenu, and names it according to
/// the function's argument.
wxMenu* CommandManager::BeginSubMenu(wxString tNameIn)
wxMenu* CommandManager::BeginSubMenu(const wxString & tName)
{
wxString tName = tNameIn;
SubMenuListEntry *tmpEntry = new SubMenuListEntry;
tmpEntry->menu = new wxMenu();
@ -572,12 +592,12 @@ wxMenu * CommandManager::CurrentMenu() const
///
/// Add a menu item to the current menu. When the user selects it, the
/// given functor will be called
void CommandManager::InsertItem(wxString name, wxString label_in,
CommandFunctor *callback, wxString after,
void CommandManager::InsertItem(const wxString & name,
const wxString & label_in,
CommandFunctor *callback,
const wxString & after,
int checkmark)
{
wxString label = label_in;
wxMenuBar *bar = GetActiveProject()->GetMenuBar();
wxArrayString names = ::wxStringTokenize(after, wxT(":"));
size_t cnt = names.GetCount();
@ -624,9 +644,9 @@ void CommandManager::InsertItem(wxString name, wxString label_in,
}
}
CommandListEntry *entry = NewIdentifier(name, label, menu, callback, false, 0, 0);
CommandListEntry *entry = NewIdentifier(name, label_in, menu, callback, false, 0, 0);
int ID = entry->id;
label = GetLabel(entry);
wxString label = GetLabel(entry);
if (checkmark >= 0) {
menu->InsertCheckItem(pos, ID, label);
@ -702,7 +722,8 @@ void CommandManager::AddItem(const wxChar *name,
/// with its position in the list as the index number.
/// When you call Enable on this command name, it will enable or disable
/// all of the items at once.
void CommandManager::AddItemList(wxString name, wxArrayString labels,
void CommandManager::AddItemList(const wxString & name,
const wxArrayString & labels,
CommandFunctor *callback)
{
for (size_t i = 0, cnt = labels.GetCount(); i < cnt; i++) {

View File

@ -90,21 +90,25 @@ class AUDACITY_DLL_API CommandManager: public XMLTagHandler
// Creating menus and adding commands
//
wxMenuBar *AddMenuBar(wxString sMenu);
wxMenuBar *AddMenuBar(const wxString & sMenu);
void BeginMenu(wxString tName);
void BeginMenu(const wxString & tName);
void EndMenu();
wxMenu* BeginSubMenu(wxString tName);
wxMenu* BeginSubMenu(const wxString & tName);
void EndSubMenu();
void SetToMenu( wxMenu * menu ){
mCurrentMenu = menu;
};
void InsertItem(wxString name, wxString label, CommandFunctor *callback,
wxString after, int checkmark = -1);
void InsertItem(const wxString & name,
const wxString & label,
CommandFunctor *callback,
const wxString & after,
int checkmark = -1);
void AddItemList(wxString name, wxArrayString labels,
void AddItemList(const wxString & name,
const wxArrayString & labels,
CommandFunctor *callback);
void AddCheck(const wxChar *name,
@ -267,7 +271,7 @@ protected:
//
wxMenuBar * CurrentMenuBar() const;
wxMenuBar * GetMenuBar(wxString sMenu) const;
wxMenuBar * GetMenuBar(const wxString & sMenu) const;
wxMenu * CurrentSubMenu() const;
wxMenu * CurrentMenu() const;
wxString GetLabel(const CommandListEntry *entry) const;

View File

@ -1282,6 +1282,11 @@ bool Effect::Process()
CopyInputTracks(Track::All);
bool bGoodResult = true;
// It's possible that the number of channels the effect expects changed based on
// the parameters (the Audacity Reverb effect does when the stereo width is 0).
mNumAudioIn = GetAudioInCount();
mNumAudioOut = GetAudioOutCount();
mPass = 1;
if (InitPass1())
{

View File

@ -151,12 +151,12 @@ EffectType EffectReverb::GetType()
int EffectReverb::GetAudioInCount()
{
return 2;
return mParams.mStereoWidth ? 2 : 1;
}
int EffectReverb::GetAudioOutCount()
{
return 2;
return mParams.mStereoWidth ? 2 : 1;
}
#define BLOCK 16384

View File

@ -53,6 +53,12 @@ enum
CommentColumn
};
#if defined(__WXMAC__)
#define CTRL _("Command")
#else
#define CTRL _("Ctrl")
#endif
/// Constructor
MousePrefs::MousePrefs(wxWindow * parent)
: PrefsPanel(parent, _("Mouse"))
@ -105,11 +111,11 @@ void MousePrefs::CreateList()
AddItem(_("Shift-Left-Click"), _("Select"), _("Extend Selection Range"));
AddItem(_("Left-Double-Click"), _("Select"), _("Select Clip or Entire Track"));
#ifdef EXPERIMENTAL_SCRUBBING_BASIC
AddItem(_("Ctrl-Left-Click"), _("Select"), _("Scrub"));
AddItem(_("Ctrl-Left-Drag"), _("Select"), _("Seek"));
AddItem(CTRL + _("-Left-Click"), _("Select"), _("Scrub"));
AddItem(CTRL + _("-Left-Drag"), _("Select"), _("Seek"));
#endif
#ifdef EXPERIMENTAL_SCRUBBING_SMOOTH_SCROLL
AddItem(_("Ctrl-Left-Double-Click"), _("Select"), _("Scroll-scrub"));
AddItem(CTRL + _("-Left-Double-Click"), _("Select"), _("Scroll-scrub"));
#endif
#ifdef EXPERIMENTAL_SCRUBBING_SCROLL_WHEEL
AddItem(_("Wheel-Rotate"), _("Select"), _("Change scrub speed"));
@ -131,7 +137,7 @@ void MousePrefs::CreateList()
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(CTRL + _("-Left-Drag"),_("Time-Shift"),_("Move clip up/down between tracks"));
AddItem(_("Left-Drag"),
/* i18n-hint: The envelope is a curve that controls the audio loudness.*/
@ -141,7 +147,7 @@ void MousePrefs::CreateList()
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(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"));
@ -157,7 +163,7 @@ void MousePrefs::CreateList()
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 on Mouse Pointer"));
AddItem(CTRL + _("-Wheel-Rotate"), _("Any"), _("Zoom in or out on Mouse Pointer"));
mList->SetColumnWidth(BlankColumn, 0);
mList->SetColumnWidth(ToolColumn, wxLIST_AUTOSIZE);

View File

@ -162,8 +162,10 @@ PrefsDialog::Factories
&waveformPrefsFactory,
&spectrumPrefsFactory,
&importExportPrefsFactory,
// Group one other page
PrefsNode(&importExportPrefsFactory, 1, true),
&extImportPrefsFactory,
&projectsPrefsFactory,
#if !defined(DISABLE_DYNAMIC_LOADING_FFMPEG) || !defined(DISABLE_DYNAMIC_LOADING_LAME)
&libraryPrefsFactory,

View File

@ -126,10 +126,25 @@ void WaveformSettings::ConvertToActualDBRange()
wxArrayString codes;
GUIPrefs::GetRangeChoices(NULL, &codes);
long value = 0;
codes[dBRange].ToLong(&value);
codes[std::max(0, std::min(int(codes.size()) - 1, dBRange))]
.ToLong(&value);
dBRange = int(value);
}
void WaveformSettings::NextLowerDBRange()
{
ConvertToEnumeratedDBRange();
++dBRange;
ConvertToActualDBRange();
}
void WaveformSettings::NextHigherDBRange()
{
ConvertToEnumeratedDBRange();
--dBRange;
ConvertToActualDBRange();
}
namespace
{
wxArrayString &scaleNamesArray()

View File

@ -47,6 +47,8 @@ public:
void ConvertToEnumeratedDBRange();
void ConvertToActualDBRange();
void NextLowerDBRange();
void NextHigherDBRange();
enum ScaleType {
stLinear,

View File

@ -52,7 +52,7 @@
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>..\..\..\lib-src\libflac\src\libFLAC\include;..\..\..\lib-src\libflac\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>FLAC__NO_DLL;NDEBUG;WIN32;_LIB;VERSION="1.0.4";FLAC__CPU_IA32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;WIN32;_LIB;FLAC__CPU_IA32;FLAC__SSE_OS;FLAC__HAS_X86INTRIN;FLAC__ALIGN_MALLOC_DATA;VERSION="1.3.1";FLAC__NO_DLL;FLaC__INLINE=_inline;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
@ -66,7 +66,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\..\lib-src\libflac\src\libFLAC\include;..\..\..\lib-src\libflac\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>FLAC__NO_DLL;_DEBUG;WIN32;_LIB;VERSION="1.0.4";FLAC__CPU_IA32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_LIB;WIN32;DEBUG;FLAC__CPU_IA32;FLAC__SSE_OS;FLAC__HAS_X86INTRIN;FLAC__ALIGN_MALLOC_DATA;VERSION="1.3.1";FLAC__NO_DLL;FLAC__OVERFLOW_DETECT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>