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

Bug 2049 - ENH: Noise Reduction error message for no selection is unhelpful

This commit is contained in:
James Crook 2019-07-29 08:29:19 +01:00
parent 7c4b624388
commit 0bd1beae9a
4 changed files with 32 additions and 2 deletions

View File

@ -102,6 +102,19 @@ const CommandFlagOptions cutCopyOptions{
XO("No Audio Selected")
};
// Noise Reduction has a custom error message, when nothing selected.
const CommandFlagOptions noiseReductionOptions{
[]( const wxString &Name ) {
wxString format;
// i18n-hint: %s will be replaced by the name of an effect, usually 'Noise Reduction'.
format = _("Select the audio for %s to use.\n\n1. Select audio that represents noise and use %s to get your 'noise profile'.\n\n2. When you have got your noise profile, select the audio you want to change\nand use %s to change that audio.");
return wxString::Format( format, Name, Name, Name );
},
"Noise_Reduction",
XO("No Audio Selected")
};
const ReservedCommandFlag
// The sequence of these definitions has a minor significance in determining
// which user error message has precedence if more than one might apply, so
@ -135,6 +148,10 @@ const ReservedCommandFlag
_("You must first select some stereo audio to perform this\naction. (You cannot use this with mono.)");
} ,"Audacity_Selection"}
}, //lda
NoiseReductionTimeSelectedFlag{
TimeSelectedPred,
noiseReductionOptions
},
TimeSelectedFlag{
TimeSelectedPred,
cutCopyOptions

View File

@ -2,7 +2,7 @@
Audacity: A Digital Audio Editor
CommonCommandFlags.cpp
CommonCommandFlags.h
Paul Licameli split from Menus.cpp
@ -23,6 +23,7 @@ extern const CommandFlagOptions cutCopyOptions;
extern AUDACITY_DLL_API const ReservedCommandFlag
AudioIONotBusyFlag,
StereoRequiredFlag, //lda
NoiseReductionTimeSelectedFlag,
TimeSelectedFlag, // This is equivalent to check if there is a valid selection, so it's used for Zoom to Selection too
WaveTracksSelectedFlag,
TracksExistFlag,

View File

@ -38,6 +38,7 @@
#include "ProjectSettings.h"
#include "UndoManager.h"
#include "commands/CommandManager.h"
#include "CommonCommandFlags.h"
#include "prefs/TracksPrefs.h"
#include "toolbars/ToolManager.h"
#include "widgets/ErrorDialog.h"
@ -305,7 +306,10 @@ void MenuCreator::CreateMenusAndCommands(AudacityProject &project)
wxASSERT(menubar);
VisitItem( project, menuTree.get() );
commandManager.SetCommandFlags(
wxT("Noise Reduction..."),
AudioIONotBusyFlag | NoiseReductionTimeSelectedFlag | WaveTracksSelectedFlag
);
GetProjectFrame( project ).SetMenuBar(menubar.release());
mLastFlags = AlwaysEnabledFlag;

View File

@ -1185,5 +1185,13 @@ RegisteredMenuItemEnabler selectWaveTracks{{
selectAll
}};
// Also enable select for the noise reduction case.
RegisteredMenuItemEnabler selectWaveTracks2{{
WaveTracksExistFlag,
NoiseReductionTimeSelectedFlag | WaveTracksSelectedFlag | CutCopyAvailableFlag,
canSelectAll,
selectAll
}};
#undef XXO
#undef FN