Audacity 3.2.0
Public Member Functions | List of all members
PluginActions::Handler Struct Reference
Inheritance diagram for PluginActions::Handler:
[legend]
Collaboration diagram for PluginActions::Handler:
[legend]

Public Member Functions

void OnResetConfig (const CommandContext &context)
 
void OnManageGenerators (const CommandContext &context)
 
void OnEffect (const CommandContext &context)
 
void OnManageEffects (const CommandContext &context)
 
void OnAddRealtimeEffects (const CommandContext &context)
 
void OnAnalyzer2 (wxCommandEvent &evt)
 
void OnRepeatLastGenerator (const CommandContext &context)
 
void OnRepeatLastEffect (const CommandContext &context)
 
void OnRepeatLastAnalyzer (const CommandContext &context)
 
void OnRepeatLastTool (const CommandContext &context)
 
void OnManageAnalyzers (const CommandContext &context)
 
void OnManageTools (const CommandContext &context)
 
void OnManageMacros (const CommandContext &context)
 
void OnApplyMacrosPalette (const CommandContext &context)
 
void OnScreenshot (const CommandContext &context)
 
void OnBenchmark (const CommandContext &context)
 
void OnSimulateRecordingErrors (const CommandContext &context)
 
void OnDetectUpstreamDropouts (const CommandContext &context)
 
void OnWriteJournal (const CommandContext &)
 
void OnApplyMacroDirectly (const CommandContext &context)
 
void OnApplyMacroDirectlyByName (const CommandContext &context, const MacroID &Name)
 
void OnAudacityCommand (const CommandContext &ctx)
 

Detailed Description

Definition at line 733 of file PluginMenus.cpp.

Member Function Documentation

◆ OnAddRealtimeEffects()

void PluginActions::Handler::OnAddRealtimeEffects ( const CommandContext context)
inline

Definition at line 805 of file PluginMenus.cpp.

806{
807 auto& project = context.project;
809}
AudacityProject & project
void DoManageRealtimeEffectsSidePanel(AudacityProject &project)

References anonymous_namespace{PluginMenus.cpp}::DoManageRealtimeEffectsSidePanel(), and CommandContext::project.

Here is the call graph for this function:

◆ OnAnalyzer2()

void PluginActions::Handler::OnAnalyzer2 ( wxCommandEvent &  evt)
inline

Definition at line 811 of file PluginMenus.cpp.

811{ return; }

◆ OnApplyMacroDirectly()

void PluginActions::Handler::OnApplyMacroDirectly ( const CommandContext context)
inline

Definition at line 977 of file PluginMenus.cpp.

978{
979 const MacroID& Name = context.parameter.GET();
980 OnApplyMacroDirectlyByName(context, Name);
981}
wxString MacroID
Definition: Menus.h:33
CommandParameter parameter
const wxString & GET() const
Explicit conversion to wxString, meant to be ugly-looking and demanding of a comment why it's correct...
Definition: Identifier.h:66
void OnApplyMacroDirectlyByName(const CommandContext &context, const MacroID &Name)

References Identifier::GET(), OnApplyMacroDirectlyByName(), and CommandContext::parameter.

Here is the call graph for this function:

◆ OnApplyMacroDirectlyByName()

void PluginActions::Handler::OnApplyMacroDirectlyByName ( const CommandContext context,
const MacroID Name 
)
inline

Definition at line 982 of file PluginMenus.cpp.

983{
984 auto &project = context.project;
985 auto &window = ProjectWindow::Get( project );
986 //wxLogDebug( "Macro was: %s", context.parameter);
987 ApplyMacroDialog dlg( &window, project );
988 //const auto &Name = context.parameter;
989
990// We used numbers previously, but macros could get renumbered, making
991// macros containing macros unpredictable.
992#ifdef MACROS_BY_NUMBERS
993 long item=0;
994 // Take last three letters (of e.g. Macro007) and convert to a number.
995 Name.Mid( Name.length() - 3 ).ToLong( &item, 10 );
996 dlg.ApplyMacroToProject( item, false );
997#else
998 dlg.ApplyMacroToProject( Name, false );
999#endif
1000 /* i18n-hint: %s will be the name of the macro which will be
1001 * repeated if this menu item is chosen */
1003
1006 auto shortDesc = em.GetCommandName(Name);
1007 auto& undoManager = UndoManager::Get(project);
1008 auto& commandManager = CommandManager::Get(project);
1009 int cur = undoManager.GetCurrentState();
1010 if (undoManager.UndoAvailable()) {
1011 undoManager.GetShortDescription(cur, &desc);
1012 commandManager.Modify(wxT("RepeatLastTool"), XXO("&Repeat %s")
1013 .Format(desc));
1014 auto& menuManager = MenuManager::Get(project);
1015 menuManager.mLastTool = Name;
1016 menuManager.mLastToolRegistration = MenuCreator::repeattypeapplymacro;
1017 }
1018
1019}
wxT("CloseDown"))
const TranslatableString desc
Definition: ExportPCM.cpp:58
#define XXO(s)
Definition: Internat.h:44
Shows progress in executing commands in MacroCommands.
static CommandManager & Get(AudacityProject &project)
EffectManager is the class that handles effects and effect categories.
Definition: EffectManager.h:48
static EffectManager & Get()
TranslatableString GetCommandName(const PluginID &ID)
Abstract base class used in importing a file.
@ repeattypeapplymacro
Definition: Menus.h:64
static MenuManager & Get(AudacityProject &project)
Definition: Menus.cpp:71
static void ModifyUndoMenuItems(AudacityProject &project)
Definition: Menus.cpp:444
static ProjectWindow & Get(AudacityProject &project)
Holds a msgid for the translation catalog; may also bind format arguments.
static UndoManager & Get(AudacityProject &project)
Definition: UndoManager.cpp:67

References ApplyMacroDialog::ApplyMacroToProject(), desc, EffectManager::Get(), UndoManager::Get(), CommandManager::Get(), MenuManager::Get(), ProjectWindow::Get(), EffectManager::GetCommandName(), MenuManager::ModifyUndoMenuItems(), CommandContext::project, MenuCreator::repeattypeapplymacro, wxT(), and XXO.

Referenced by OnApplyMacroDirectly(), and OnRepeatLastTool().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnApplyMacrosPalette()

void PluginActions::Handler::OnApplyMacrosPalette ( const CommandContext context)
inline

Definition at line 906 of file PluginMenus.cpp.

907{
908 auto &project = context.project;
909 CommandManager::Get(project).RegisterLastTool(context); //Register Palette as Last Tool
910 auto macrosWindow = &GetAttachedWindows(project)
911 .AttachedWindows::Get< MacrosWindow >( sMacrosWindowKey );
912 if (macrosWindow) {
913 macrosWindow->Show();
914 macrosWindow->Raise();
915 macrosWindow->UpdateDisplay( false );
916 }
917}
AUDACITY_DLL_API AttachedWindows & GetAttachedWindows(AudacityProject &project)
void RegisterLastTool(const CommandContext &context)
void UpdateDisplay(bool bExpanded)
AttachedWindows::RegisteredFactory sMacrosWindowKey

References CommandManager::Get(), GetAttachedWindows(), CommandContext::project, CommandManager::RegisterLastTool(), anonymous_namespace{PluginMenus.cpp}::sMacrosWindowKey, and MacrosWindow::UpdateDisplay().

Here is the call graph for this function:

◆ OnAudacityCommand()

void PluginActions::Handler::OnAudacityCommand ( const CommandContext ctx)
inline

Definition at line 1021 of file PluginMenus.cpp.

1022{
1023 // using GET in a log message for devs' eyes only
1024 wxLogDebug( "Command was: %s", ctx.parameter.GET());
1025 // Not configured, so prompt user.
1027 EffectManager::Get().GetEffectByIdentifier(ctx.parameter),
1029}
static bool DoAudacityCommand(const PluginID &ID, const CommandContext &context, unsigned flags)

References MacroCommands::DoAudacityCommand(), EffectManager::Get(), Identifier::GET(), EffectManager::kNone, and CommandContext::parameter.

Here is the call graph for this function:

◆ OnBenchmark()

void PluginActions::Handler::OnBenchmark ( const CommandContext context)
inline

Definition at line 925 of file PluginMenus.cpp.

926{
927 auto &project = context.project;
928 CommandManager::Get(project).RegisterLastTool(context); //Register Run Benchmark as Last Tool
929 auto &window = GetProjectFrame( project );
930 ::RunBenchmark( &window, project);
931}
void RunBenchmark(wxWindow *parent, AudacityProject &project)
Definition: Benchmark.cpp:95
AUDACITY_DLL_API wxFrame & GetProjectFrame(AudacityProject &project)
Get the top-level window associated with the project (as a wxFrame only, when you do not need to use ...

References CommandManager::Get(), GetProjectFrame(), CommandContext::project, CommandManager::RegisterLastTool(), and RunBenchmark().

Here is the call graph for this function:

◆ OnDetectUpstreamDropouts()

void PluginActions::Handler::OnDetectUpstreamDropouts ( const CommandContext context)
inline

Definition at line 944 of file PluginMenus.cpp.

945{
946 auto &project = context.project;
947 auto &commandManager = CommandManager::Get( project );
948
949 auto gAudioIO = AudioIO::Get();
950 auto &setting = gAudioIO->mDetectUpstreamDropouts;
951 auto oldValue = setting.load(std::memory_order_relaxed);
952 commandManager.Check(wxT("DetectUpstreamDropouts"), !oldValue);
953 setting.store(!oldValue, std::memory_order_relaxed);
954}
static AudioIO * Get()
Definition: AudioIO.cpp:133

References AudioIO::Get(), CommandManager::Get(), CommandContext::project, and wxT().

Here is the call graph for this function:

◆ OnEffect()

void PluginActions::Handler::OnEffect ( const CommandContext context)
inline

Definition at line 793 of file PluginMenus.cpp.

794{
795 // using GET to interpret parameter as a PluginID
796 EffectUI::DoEffect(context.parameter.GET(), context, 0);
797}
AUDACITY_DLL_API bool DoEffect(const PluginID &ID, const CommandContext &context, unsigned flags)
'Repeat Last Effect'.
Definition: EffectUI.cpp:1240

References EffectUI::DoEffect(), Identifier::GET(), and CommandContext::parameter.

Here is the call graph for this function:

◆ OnManageAnalyzers()

void PluginActions::Handler::OnManageAnalyzers ( const CommandContext context)
inline

Definition at line 881 of file PluginMenus.cpp.

882{
883 auto &project = context.project;
884 DoManagePluginsMenu(project);
885}
void DoManagePluginsMenu(AudacityProject &project)

References anonymous_namespace{PluginMenus.cpp}::DoManagePluginsMenu(), and CommandContext::project.

Here is the call graph for this function:

◆ OnManageEffects()

void PluginActions::Handler::OnManageEffects ( const CommandContext context)
inline

Definition at line 799 of file PluginMenus.cpp.

800{
801 auto &project = context.project;
802 DoManagePluginsMenu(project);
803}

References anonymous_namespace{PluginMenus.cpp}::DoManagePluginsMenu(), and CommandContext::project.

Here is the call graph for this function:

◆ OnManageGenerators()

void PluginActions::Handler::OnManageGenerators ( const CommandContext context)
inline

Definition at line 787 of file PluginMenus.cpp.

788{
789 auto &project = context.project;
790 DoManagePluginsMenu(project);
791}

References anonymous_namespace{PluginMenus.cpp}::DoManagePluginsMenu(), and CommandContext::project.

Here is the call graph for this function:

◆ OnManageMacros()

void PluginActions::Handler::OnManageMacros ( const CommandContext context)
inline

Definition at line 893 of file PluginMenus.cpp.

894{
895 auto &project = context.project;
896 CommandManager::Get(project).RegisterLastTool(context); //Register Macros as Last Tool
897 auto macrosWindow = &GetAttachedWindows(project)
898 .AttachedWindows::Get< MacrosWindow >( sMacrosWindowKey );
899 if (macrosWindow) {
900 macrosWindow->Show();
901 macrosWindow->Raise();
902 macrosWindow->UpdateDisplay( true );
903 }
904}

References CommandManager::Get(), GetAttachedWindows(), CommandContext::project, CommandManager::RegisterLastTool(), anonymous_namespace{PluginMenus.cpp}::sMacrosWindowKey, and MacrosWindow::UpdateDisplay().

Here is the call graph for this function:

◆ OnManageTools()

void PluginActions::Handler::OnManageTools ( const CommandContext context)
inline

Definition at line 887 of file PluginMenus.cpp.

888{
889 auto &project = context.project;
890 DoManagePluginsMenu(project);
891}

References anonymous_namespace{PluginMenus.cpp}::DoManagePluginsMenu(), and CommandContext::project.

Here is the call graph for this function:

◆ OnRepeatLastAnalyzer()

void PluginActions::Handler::OnRepeatLastAnalyzer ( const CommandContext context)
inline

Definition at line 835 of file PluginMenus.cpp.

836{
837 auto& menuManager = MenuManager::Get(context.project);
838 switch (menuManager.mLastAnalyzerRegistration) {
840 {
841 auto lastEffect = menuManager.mLastAnalyzer;
842 if (!lastEffect.empty())
843 {
845 lastEffect, context, menuManager.mRepeatAnalyzerFlags);
846 }
847 }
848 break;
851 menuManager.mLastAnalyzerRegisteredId);
852 break;
853 }
854}
void DoRepeatProcess(const CommandContext &context, int)
@ repeattypeplugin
Definition: Menus.h:62
@ repeattypeunique
Definition: Menus.h:63

References EffectUI::DoEffect(), CommandManager::DoRepeatProcess(), CommandManager::Get(), MenuManager::Get(), CommandContext::project, MenuCreator::repeattypeplugin, and MenuCreator::repeattypeunique.

Here is the call graph for this function:

◆ OnRepeatLastEffect()

void PluginActions::Handler::OnRepeatLastEffect ( const CommandContext context)
inline

Definition at line 824 of file PluginMenus.cpp.

825{
826 auto& menuManager = MenuManager::Get(context.project);
827 auto lastEffect = menuManager.mLastEffect;
828 if (!lastEffect.empty())
829 {
831 lastEffect, context, menuManager.mRepeatEffectFlags);
832 }
833}

References EffectUI::DoEffect(), MenuManager::Get(), and CommandContext::project.

Here is the call graph for this function:

◆ OnRepeatLastGenerator()

void PluginActions::Handler::OnRepeatLastGenerator ( const CommandContext context)
inline

Definition at line 813 of file PluginMenus.cpp.

814{
815 auto& menuManager = MenuManager::Get(context.project);
816 auto lastEffect = menuManager.mLastGenerator;
817 if (!lastEffect.empty())
818 {
820 lastEffect, context, menuManager.mRepeatGeneratorFlags | EffectManager::kRepeatGen);
821 }
822}

References EffectUI::DoEffect(), MenuManager::Get(), EffectManager::kRepeatGen, and CommandContext::project.

Here is the call graph for this function:

◆ OnRepeatLastTool()

void PluginActions::Handler::OnRepeatLastTool ( const CommandContext context)
inline

Definition at line 856 of file PluginMenus.cpp.

857{
858 auto& menuManager = MenuManager::Get(context.project);
859 switch (menuManager.mLastToolRegistration) {
861 {
862 auto lastEffect = menuManager.mLastTool;
863 if (!lastEffect.empty())
864 {
866 lastEffect, context, menuManager.mRepeatToolFlags);
867 }
868 }
869 break;
872 menuManager.mLastToolRegisteredId);
873 break;
875 OnApplyMacroDirectlyByName(context, menuManager.mLastTool);
876 break;
877 }
878}

References EffectUI::DoEffect(), CommandManager::DoRepeatProcess(), CommandManager::Get(), MenuManager::Get(), OnApplyMacroDirectlyByName(), CommandContext::project, MenuCreator::repeattypeapplymacro, MenuCreator::repeattypeplugin, and MenuCreator::repeattypeunique.

Here is the call graph for this function:

◆ OnResetConfig()

void PluginActions::Handler::OnResetConfig ( const CommandContext context)
inline

Definition at line 735 of file PluginMenus.cpp.

736{
737 auto &project = context.project;
738 auto &menuManager = MenuManager::Get(project);
739 menuManager.mLastAnalyzerRegistration = MenuCreator::repeattypenone;
740 menuManager.mLastToolRegistration = MenuCreator::repeattypenone;
741 menuManager.mLastGenerator = "";
742 menuManager.mLastEffect = "";
743 menuManager.mLastAnalyzer = "";
744 menuManager.mLastTool = "";
745
747
748 // Directory will be reset on next restart.
749 FileNames::UpdateDefaultPath(FileNames::Operation::Temp, TempDirectory::DefaultTempDir());
750
751 // There are many more things we could reset here.
752 // Beeds discussion as to which make sense to.
753 // Maybe in future versions?
754 // - Reset Effects
755 // - Reset Recording and Playback volumes
756 // - Reset Selection formats (and for spectral too)
757 // - Reset Play-at-speed speed to x1
758 // - Stop playback/recording and unapply pause.
759 // - Set Zoom sensibly.
760 gPrefs->Write("/GUI/SyncLockTracks", 0);
761 gPrefs->Write("/AudioIO/SoundActivatedRecord", 0);
762 gPrefs->Write("/SelectionToolbarMode", 0);
763 gPrefs->Flush();
764 DoReloadPreferences(project);
765
768
769 // These are necessary to preserve the newly correctly laid out toolbars.
770 // In particular the Device Toolbar ends up short on next restart,
771 // if they are left out.
772 gPrefs->Write(wxT("/PrefsVersion"), wxString(wxT(AUDACITY_PREFS_VERSION_STRING)));
773
774 // write out the version numbers to the prefs file for future checking
775 gPrefs->Write(wxT("/Version/Major"), AUDACITY_VERSION);
776 gPrefs->Write(wxT("/Version/Minor"), AUDACITY_RELEASE);
777 gPrefs->Write(wxT("/Version/Micro"), AUDACITY_REVISION);
778
779 gPrefs->Flush();
780
782 .AS_SetSnapTo(gPrefs->ReadLong("/SnapTo", SNAP_OFF));
784 .AS_SetRate(gPrefs->ReadDouble("/DefaultProjectSampleRate", 44100.0));
785}
FileConfig * gPrefs
Definition: Prefs.cpp:71
void ResetPreferences()
Call this to reset preferences to an (almost)-"new" default state.
Definition: Prefs.cpp:208
#define AUDACITY_PREFS_VERSION_STRING
Definition: Prefs.h:39
void DoReloadPreferences(AudacityProject &project)
@ SNAP_OFF
virtual bool Flush(bool bCurrentOnly=false) wxOVERRIDE
Definition: FileConfig.cpp:143
@ repeattypenone
Definition: Menus.h:61
void AS_SetSnapTo(int snap) override
static ProjectSelectionManager & Get(AudacityProject &project)
void AS_SetRate(double rate) override
static void OnResetWindow(const CommandContext &context)
static void OnResetToolBars(const CommandContext &context)
FILES_API void UpdateDefaultPath(Operation op, const FilePath &path)
FILES_API const FilePath & DefaultTempDir()

References ProjectSelectionManager::AS_SetRate(), ProjectSelectionManager::AS_SetSnapTo(), AUDACITY_PREFS_VERSION_STRING, TempDirectory::DefaultTempDir(), DoReloadPreferences(), FileConfig::Flush(), MenuManager::Get(), ProjectSelectionManager::Get(), gPrefs, ToolManager::OnResetToolBars(), ProjectWindow::OnResetWindow(), CommandContext::project, MenuCreator::repeattypenone, ResetPreferences(), SNAP_OFF, FileNames::UpdateDefaultPath(), and wxT().

Here is the call graph for this function:

◆ OnScreenshot()

void PluginActions::Handler::OnScreenshot ( const CommandContext context)
inline

Definition at line 919 of file PluginMenus.cpp.

920{
921 CommandManager::Get(context.project).RegisterLastTool(context); //Register Screenshot as Last Tool
923}
void OpenScreenshotTools(AudacityProject &project)
Definition: Screenshot.cpp:135

References CommandManager::Get(), OpenScreenshotTools(), CommandContext::project, and CommandManager::RegisterLastTool().

Here is the call graph for this function:

◆ OnSimulateRecordingErrors()

void PluginActions::Handler::OnSimulateRecordingErrors ( const CommandContext context)
inline

Definition at line 933 of file PluginMenus.cpp.

934{
935 auto &project = context.project;
936 auto &commandManager = CommandManager::Get( project );
937
938 auto gAudioIO = AudioIO::Get();
939 bool &setting = gAudioIO->mSimulateRecordingErrors;
940 commandManager.Check(wxT("SimulateRecordingErrors"), !setting);
941 setting = !setting;
942}

References AudioIO::Get(), CommandManager::Get(), CommandContext::project, and wxT().

Here is the call graph for this function:

◆ OnWriteJournal()

void PluginActions::Handler::OnWriteJournal ( const CommandContext )
inline

Definition at line 956 of file PluginMenus.cpp.

957{
958 auto OnMessage =
959 /* i18n-hint a "journal" is a text file that records
960 the user's interactions with the application */
961 XO("A journal will be recorded after Audacity restarts.");
962 auto OffMessage =
963 /* i18n-hint a "journal" is a text file that records
964 the user's interactions with the application */
965 XO("No journal will be recorded after Audacity restarts.");
966
967 using namespace Journal;
968 bool enabled = RecordEnabled();
969 if ( SetRecordEnabled(!enabled) )
970 enabled = !enabled;
971 if ( enabled )
972 AudacityMessageBox( OnMessage );
973 else
974 AudacityMessageBox( OffMessage );
975}
int AudacityMessageBox(const TranslatableString &message, const TranslatableString &caption, long style, wxWindow *parent, int x, int y)
#define XO(s)
Definition: Internat.h:31
Facilities for recording and playback of sequences of user interaction.
bool RecordEnabled()
Definition: Journal.cpp:204
bool SetRecordEnabled(bool value)
Definition: Journal.cpp:209

References AudacityMessageBox(), Journal::RecordEnabled(), Journal::SetRecordEnabled(), and XO.

Here is the call graph for this function:

The documentation for this struct was generated from the following file: