1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-27 15:53:49 +01:00

Bug2224: Should have error message trying to cut without selection...

... I got bitten by problems of static variable initialization order
This commit is contained in:
Paul Licameli
2019-12-31 12:08:07 -05:00
parent 917e84f382
commit 353a235708
3 changed files with 7 additions and 4 deletions

View File

@@ -71,7 +71,8 @@ bool TimeSelectedPred( const AudacityProject &project )
return !ViewInfo::Get( project ).selectedRegion.isPoint(); return !ViewInfo::Get( project ).selectedRegion.isPoint();
}; };
const CommandFlagOptions cutCopyOptions{ const CommandFlagOptions &cutCopyOptions() {
static CommandFlagOptions result{
// In reporting the issue with cut or copy, we don't tell the user they could also select some text in a label. // In reporting the issue with cut or copy, we don't tell the user they could also select some text in a label.
[]( const TranslatableString &Name ) { []( const TranslatableString &Name ) {
// PRL: These strings have hard-coded mention of a certain shortcut key, // PRL: These strings have hard-coded mention of a certain shortcut key,
@@ -101,6 +102,8 @@ const CommandFlagOptions cutCopyOptions{
"Selecting_Audio_-_the_basics", "Selecting_Audio_-_the_basics",
XO("No Audio Selected") XO("No Audio Selected")
}; };
return result;
}
// Noise Reduction has a custom error message, when nothing selected. // Noise Reduction has a custom error message, when nothing selected.
const CommandFlagOptions noiseReductionOptions{ const CommandFlagOptions noiseReductionOptions{
@@ -153,7 +156,7 @@ const ReservedCommandFlag
}, },
TimeSelectedFlag{ TimeSelectedFlag{
TimeSelectedPred, TimeSelectedPred,
cutCopyOptions cutCopyOptions()
}, },
WaveTracksSelectedFlag{ WaveTracksSelectedFlag{
[](const AudacityProject &project){ [](const AudacityProject &project){

View File

@@ -18,7 +18,7 @@ Paul Licameli split from Menus.cpp
bool TracksSelectedPred( const AudacityProject &project ); bool TracksSelectedPred( const AudacityProject &project );
bool AudioIOBusyPred( const AudacityProject &project ); bool AudioIOBusyPred( const AudacityProject &project );
bool TimeSelectedPred( const AudacityProject &project ); bool TimeSelectedPred( const AudacityProject &project );
extern const CommandFlagOptions cutCopyOptions; extern const CommandFlagOptions &cutCopyOptions();
extern AUDACITY_DLL_API const ReservedCommandFlag extern AUDACITY_DLL_API const ReservedCommandFlag
AudioIONotBusyFlag, AudioIONotBusyFlag,

View File

@@ -1025,7 +1025,7 @@ const ReservedCommandFlag
return false; return false;
}, },
cutCopyOptions cutCopyOptions()
}; };
MenuTable::BaseItemPtr EditMenu( AudacityProject & ) MenuTable::BaseItemPtr EditMenu( AudacityProject & )