Some command flags can be defined nearer their sole points of use
This commit is contained in:
parent
9d800c8969
commit
5fda4b959f
|
@ -237,36 +237,6 @@ const ReservedCommandFlag&
|
|||
;
|
||||
}
|
||||
}; return flag; }
|
||||
const ReservedCommandFlag&
|
||||
HasLastGeneratorFlag() { static ReservedCommandFlag flag{
|
||||
[](const AudacityProject &project){
|
||||
return !MenuManager::Get( project ).mLastGenerator.empty();
|
||||
}
|
||||
}; return flag; }
|
||||
const ReservedCommandFlag&
|
||||
HasLastEffectFlag() { static ReservedCommandFlag flag{
|
||||
[](const AudacityProject &project) {
|
||||
return !MenuManager::Get(project).mLastEffect.empty();
|
||||
}
|
||||
}; return flag;
|
||||
}
|
||||
const ReservedCommandFlag&
|
||||
HasLastAnalyzerFlag() { static ReservedCommandFlag flag{
|
||||
[](const AudacityProject &project) {
|
||||
if (MenuManager::Get(project).mLastAnalyzerRegistration == MenuCreator::repeattypeunique) return true;
|
||||
return !MenuManager::Get(project).mLastAnalyzer.empty();
|
||||
}
|
||||
}; return flag;
|
||||
}
|
||||
const ReservedCommandFlag&
|
||||
HasLastToolFlag() { static ReservedCommandFlag flag{
|
||||
[](const AudacityProject &project) {
|
||||
auto& menuManager = MenuManager::Get(project);
|
||||
if (menuManager.mLastToolRegistration == MenuCreator::repeattypeunique) return true;
|
||||
return !menuManager.mLastTool.empty();
|
||||
}
|
||||
}; return flag;
|
||||
}
|
||||
const ReservedCommandFlag&
|
||||
UndoAvailableFlag() { static ReservedCommandFlag flag{
|
||||
[](const AudacityProject &project){
|
||||
|
|
|
@ -38,10 +38,6 @@ extern AUDACITY_DLL_API const ReservedCommandFlag
|
|||
extern AUDACITY_DLL_API const ReservedCommandFlag
|
||||
&LabelTracksExistFlag(),
|
||||
&UnsavedChangesFlag(),
|
||||
&HasLastGeneratorFlag(),
|
||||
&HasLastEffectFlag(),
|
||||
&HasLastAnalyzerFlag(),
|
||||
&HasLastToolFlag(),
|
||||
&UndoAvailableFlag(),
|
||||
&RedoAvailableFlag(),
|
||||
&ZoomInAvailableFlag(),
|
||||
|
|
|
@ -811,6 +811,14 @@ MenuTable::BaseItemPtrs PopulateMacrosMenu( CommandFlag flags )
|
|||
// Under /MenuBar
|
||||
namespace {
|
||||
using namespace MenuTable;
|
||||
|
||||
const ReservedCommandFlag&
|
||||
HasLastGeneratorFlag() { static ReservedCommandFlag flag{
|
||||
[](const AudacityProject &project){
|
||||
return !MenuManager::Get( project ).mLastGenerator.empty();
|
||||
}
|
||||
}; return flag; }
|
||||
|
||||
BaseItemSharedPtr GenerateMenu()
|
||||
{
|
||||
// All of this is a bit hacky until we can get more things connected into
|
||||
|
@ -873,6 +881,14 @@ AttachedItem sAttachment1{
|
|||
Shared( GenerateMenu() )
|
||||
};
|
||||
|
||||
const ReservedCommandFlag&
|
||||
HasLastEffectFlag() { static ReservedCommandFlag flag{
|
||||
[](const AudacityProject &project) {
|
||||
return !MenuManager::Get(project).mLastEffect.empty();
|
||||
}
|
||||
}; return flag;
|
||||
}
|
||||
|
||||
BaseItemSharedPtr EffectMenu()
|
||||
{
|
||||
// All of this is a bit hacky until we can get more things connected into
|
||||
|
@ -926,6 +942,15 @@ AttachedItem sAttachment2{
|
|||
Shared( EffectMenu() )
|
||||
};
|
||||
|
||||
const ReservedCommandFlag&
|
||||
HasLastAnalyzerFlag() { static ReservedCommandFlag flag{
|
||||
[](const AudacityProject &project) {
|
||||
if (MenuManager::Get(project).mLastAnalyzerRegistration == MenuCreator::repeattypeunique) return true;
|
||||
return !MenuManager::Get(project).mLastAnalyzer.empty();
|
||||
}
|
||||
}; return flag;
|
||||
}
|
||||
|
||||
BaseItemSharedPtr AnalyzeMenu()
|
||||
{
|
||||
// All of this is a bit hacky until we can get more things connected into
|
||||
|
@ -983,6 +1008,16 @@ AttachedItem sAttachment3{
|
|||
Shared( AnalyzeMenu() )
|
||||
};
|
||||
|
||||
const ReservedCommandFlag&
|
||||
HasLastToolFlag() { static ReservedCommandFlag flag{
|
||||
[](const AudacityProject &project) {
|
||||
auto& menuManager = MenuManager::Get(project);
|
||||
if (menuManager.mLastToolRegistration == MenuCreator::repeattypeunique) return true;
|
||||
return !menuManager.mLastTool.empty();
|
||||
}
|
||||
}; return flag;
|
||||
}
|
||||
|
||||
BaseItemSharedPtr ToolsMenu()
|
||||
{
|
||||
using Options = CommandManager::Options;
|
||||
|
|
Loading…
Reference in New Issue