From 445dd81b2968cb94437dccae8da44c0a5ba4a3df Mon Sep 17 00:00:00 2001 From: Leland Lucius Date: Sat, 15 Aug 2015 17:36:13 -0500 Subject: [PATCH 01/15] Fix format specifier --- src/Sequence.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Sequence.cpp b/src/Sequence.cpp index ec955f1d7..d9c19c189 100644 --- a/src/Sequence.cpp +++ b/src/Sequence.cpp @@ -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); From b2b23f12501680a953b83fa0da0da9ffa1b67489 Mon Sep 17 00:00:00 2001 From: Leland Lucius Date: Sat, 15 Aug 2015 21:52:30 -0500 Subject: [PATCH 02/15] Hopefully the last round of keyboard handling changes --- src/LabelTrack.cpp | 18 ++++++++++++++++++ src/commands/CommandManager.cpp | 31 ++++++++++++++++++++++++++++--- 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/src/LabelTrack.cpp b/src/LabelTrack.cpp index 16ecb8467..f1ed4aa1f 100644 --- a/src/LabelTrack.cpp +++ b/src/LabelTrack.cpp @@ -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; diff --git a/src/commands/CommandManager.cpp b/src/commands/CommandManager.cpp index 6e62f9871..68eddb603 100644 --- a/src/commands/CommandManager.cpp +++ b/src/commands/CommandManager.cpp @@ -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; From 2a6d423c17c70c94c390b33a29c8efd29406dc92 Mon Sep 17 00:00:00 2001 From: Leland Lucius Date: Sat, 15 Aug 2015 22:37:12 -0500 Subject: [PATCH 03/15] Fix bug #1087 --- src/AudacityApp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AudacityApp.cpp b/src/AudacityApp.cpp index 0c8218d1c..8cd39de17 100644 --- a/src/AudacityApp.cpp +++ b/src/AudacityApp.cpp @@ -1596,7 +1596,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"); From 4842e74964b1477456b78d0fde56cc5a8c22735f Mon Sep 17 00:00:00 2001 From: Leland Lucius Date: Sat, 15 Aug 2015 23:04:27 -0500 Subject: [PATCH 04/15] Fix for bug #1128 Ensure WX setup is included to check availability of crash report. --- src/Experimental.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Experimental.h b/src/Experimental.h index e77aa9b72..3138930d7 100644 --- a/src/Experimental.h +++ b/src/Experimental.h @@ -192,6 +192,7 @@ #define EXPERIMENTAL_TWO_TONE_TIME_RULER // Define to include crash reporting +#include #define EXPERIMENTAL_CRASH_REPORT #if !defined(wxUSE_DEBUGREPORT) || !wxUSE_DEBUGREPORT #undef EXPERIMENTAL_CRASH_REPORT From 7f7ff3c74978e510381119f2e607ca3789c4f299 Mon Sep 17 00:00:00 2001 From: Leland Lucius Date: Sat, 15 Aug 2015 23:48:48 -0500 Subject: [PATCH 05/15] Fix for bug #1117 --- src/effects/Reverb.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/effects/Reverb.cpp b/src/effects/Reverb.cpp index e24454ede..ece77c13b 100644 --- a/src/effects/Reverb.cpp +++ b/src/effects/Reverb.cpp @@ -230,7 +230,7 @@ sampleCount EffectReverb::ProcessBlock(float **inBlock, float **outBlock, sample reverb_process(&mP[c].reverb, len); } - if (mNumChans == 2) + if (mNumChans == 2 && mParams.mStereoWidth) { for (sampleCount i = 0; i < len; i++) { From b31aad83230e59bae8a1266b5f2a842689d22bdc Mon Sep 17 00:00:00 2001 From: Leland Lucius Date: Sun, 16 Aug 2015 00:15:55 -0500 Subject: [PATCH 06/15] Fix for bug #1117 Previous fix didn't produce the same results as 2.0.6, this one should. --- src/effects/Effect.cpp | 5 +++++ src/effects/Reverb.cpp | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/effects/Effect.cpp b/src/effects/Effect.cpp index 4748887e3..f0be05ed6 100644 --- a/src/effects/Effect.cpp +++ b/src/effects/Effect.cpp @@ -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()) { diff --git a/src/effects/Reverb.cpp b/src/effects/Reverb.cpp index ece77c13b..e026aeca4 100644 --- a/src/effects/Reverb.cpp +++ b/src/effects/Reverb.cpp @@ -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 @@ -230,7 +230,7 @@ sampleCount EffectReverb::ProcessBlock(float **inBlock, float **outBlock, sample reverb_process(&mP[c].reverb, len); } - if (mNumChans == 2 && mParams.mStereoWidth) + if (mNumChans == 2) { for (sampleCount i = 0; i < len; i++) { From 5b7ef6e3f181a5c0cdf929f820957104c1e5fe08 Mon Sep 17 00:00:00 2001 From: Leland Lucius Date: Sun, 16 Aug 2015 01:29:12 -0500 Subject: [PATCH 07/15] Fix the reference version number in flac files --- win/Projects/libflac/libflac.vcxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/win/Projects/libflac/libflac.vcxproj b/win/Projects/libflac/libflac.vcxproj index 8180a1efb..3c8315b2f 100755 --- a/win/Projects/libflac/libflac.vcxproj +++ b/win/Projects/libflac/libflac.vcxproj @@ -52,7 +52,7 @@ MaxSpeed ..\..\..\lib-src\libflac\src\libFLAC\include;..\..\..\lib-src\libflac\include;%(AdditionalIncludeDirectories) - FLAC__NO_DLL;NDEBUG;WIN32;_LIB;VERSION="1.0.4";FLAC__CPU_IA32;%(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) true MultiThreadedDLL true @@ -66,7 +66,7 @@ Disabled ..\..\..\lib-src\libflac\src\libFLAC\include;..\..\..\lib-src\libflac\include;%(AdditionalIncludeDirectories) - FLAC__NO_DLL;_DEBUG;WIN32;_LIB;VERSION="1.0.4";FLAC__CPU_IA32;%(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) true EnableFastChecks MultiThreadedDebugDLL From 09c8a739f7f6bdf235bcd13c6e37db5399837789 Mon Sep 17 00:00:00 2001 From: Leland Lucius Date: Sun, 16 Aug 2015 01:36:33 -0500 Subject: [PATCH 08/15] Possible fix for bug #940 --- mac/config/i386/lib-src/libflac/config.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mac/config/i386/lib-src/libflac/config.h b/mac/config/i386/lib-src/libflac/config.h index 15abcc2b0..7810ae825 100644 --- a/mac/config/i386/lib-src/libflac/config.h +++ b/mac/config/i386/lib-src/libflac/config.h @@ -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 From 141c42bbdbcf2fee91c38a814c65cf66d2f0a532 Mon Sep 17 00:00:00 2001 From: Leland Lucius Date: Sun, 16 Aug 2015 03:13:55 -0500 Subject: [PATCH 09/15] Protect against not having an initial file type selected --- lib-src/FileDialog/mac/FileDialogPrivate.mm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib-src/FileDialog/mac/FileDialogPrivate.mm b/lib-src/FileDialog/mac/FileDialogPrivate.mm index a171eea56..c5c080f5d 100644 --- a/lib-src/FileDialog/mac/FileDialogPrivate.mm +++ b/lib-src/FileDialog/mac/FileDialogPrivate.mm @@ -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() ) From 824293750257fac97682048c6e5345a9b41a2f44 Mon Sep 17 00:00:00 2001 From: Leland Lucius Date: Sun, 16 Aug 2015 04:01:49 -0500 Subject: [PATCH 10/15] Fix double open of files specified on the command line (wx3 issue) --- src/AudacityApp.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/AudacityApp.cpp b/src/AudacityApp.cpp index 8cd39de17..919bca0c4 100644 --- a/src/AudacityApp.cpp +++ b/src/AudacityApp.cpp @@ -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; From b7fc0e46317465d32d2f6176bb6dd1ceeb8fe7ea Mon Sep 17 00:00:00 2001 From: Leland Lucius Date: Sun, 16 Aug 2015 04:08:34 -0500 Subject: [PATCH 11/15] Fix for bug #1086 --- src/prefs/MousePrefs.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/prefs/MousePrefs.cpp b/src/prefs/MousePrefs.cpp index 42d99f78c..30366f450 100644 --- a/src/prefs/MousePrefs.cpp +++ b/src/prefs/MousePrefs.cpp @@ -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); From 7757297d826a6dda8eafdc36a989a33784e2bef7 Mon Sep 17 00:00:00 2001 From: Leland Lucius Date: Sun, 16 Aug 2015 06:18:41 -0500 Subject: [PATCH 12/15] Fix OSX special menu items (About, Preferences, Quit) And convert a few more command manager arguments to const --- src/AudacityApp.cpp | 6 ++--- src/commands/CommandManager.cpp | 42 +++++++++++++++------------------ src/commands/CommandManager.h | 18 ++++++++------ 3 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/AudacityApp.cpp b/src/AudacityApp.cpp index 919bca0c4..bc847067e 100644 --- a/src/AudacityApp.cpp +++ b/src/AudacityApp.cpp @@ -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... diff --git a/src/commands/CommandManager.cpp b/src/commands/CommandManager.cpp index 68eddb603..0054b1857 100644 --- a/src/commands/CommandManager.cpp +++ b/src/commands/CommandManager.cpp @@ -450,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) @@ -470,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++) { @@ -495,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; } @@ -526,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(); @@ -597,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(); @@ -649,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); @@ -727,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++) { diff --git a/src/commands/CommandManager.h b/src/commands/CommandManager.h index 86153de7e..0671bad88 100644 --- a/src/commands/CommandManager.h +++ b/src/commands/CommandManager.h @@ -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; From ef95285af280da8d1f804419d4a8d80564d08845 Mon Sep 17 00:00:00 2001 From: Leland Lucius Date: Sun, 16 Aug 2015 06:28:12 -0500 Subject: [PATCH 13/15] Add missing Transport EndMenu() --- src/Menus.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Menus.cpp b/src/Menus.cpp index 2610eb0b5..48a00426a 100644 --- a/src/Menus.cpp +++ b/src/Menus.cpp @@ -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) ////////////////////////////////////////////////////////////////////////// From 141d93bbc0bffc179c49d1619fba56ecce777d49 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Sun, 16 Aug 2015 12:18:17 -0400 Subject: [PATCH 14/15] Ctrl-mousewheel in vertical ruler of waveform dB view varies bottom of scale... ... provided the bottom is visible --- src/TrackPanel.cpp | 27 +++++++++++++++++++++++---- src/prefs/WaveformSettings.cpp | 17 ++++++++++++++++- src/prefs/WaveformSettings.h | 2 ++ 3 files changed, 41 insertions(+), 5 deletions(-) diff --git a/src/TrackPanel.cpp b/src/TrackPanel.cpp index d05039711..e27d8bc34 100644 --- a/src/TrackPanel.cpp +++ b/src/TrackPanel.cpp @@ -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(pTrack), false, (event.m_wheelRotation < 0), - true); + WaveTrack *const wt = static_cast(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); diff --git a/src/prefs/WaveformSettings.cpp b/src/prefs/WaveformSettings.cpp index ce94d4196..9872bc909 100644 --- a/src/prefs/WaveformSettings.cpp +++ b/src/prefs/WaveformSettings.cpp @@ -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() diff --git a/src/prefs/WaveformSettings.h b/src/prefs/WaveformSettings.h index 8be81b8d7..6765b9e48 100644 --- a/src/prefs/WaveformSettings.h +++ b/src/prefs/WaveformSettings.h @@ -47,6 +47,8 @@ public: void ConvertToEnumeratedDBRange(); void ConvertToActualDBRange(); + void NextLowerDBRange(); + void NextHigherDBRange(); enum ScaleType { stLinear, From 9ee76d93c11d1635a8f074b0a30b5bca5c2ad748 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Sun, 16 Aug 2015 13:11:00 -0400 Subject: [PATCH 15/15] Group "extended import" page of Prefs under "Import/Export" --- src/prefs/PrefsDialog.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/prefs/PrefsDialog.cpp b/src/prefs/PrefsDialog.cpp index 4b2a29335..dd32fc714 100644 --- a/src/prefs/PrefsDialog.cpp +++ b/src/prefs/PrefsDialog.cpp @@ -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,