mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-18 17:47:41 +02:00
Add all chains into the Tools menu.
This commit is contained in:
parent
8cd5d7f4fe
commit
e6a2d0f99a
@ -161,11 +161,18 @@ void BatchProcessDialog::OnApplyToProject(wxCommandEvent & WXUNUSED(event))
|
||||
long item = mChains->GetNextItem(-1,
|
||||
wxLIST_NEXT_ALL,
|
||||
wxLIST_STATE_SELECTED);
|
||||
|
||||
if (item == -1) {
|
||||
AudacityMessageBox(_("No chain selected"));
|
||||
return;
|
||||
}
|
||||
wxString name = mChains->GetItemText(item);
|
||||
}
|
||||
|
||||
void BatchProcessDialog::ApplyChainToProject( int iChain, bool bHasGui )
|
||||
{
|
||||
wxString name = mChains->GetItemText(iChain);
|
||||
if( name.IsEmpty() )
|
||||
return;
|
||||
|
||||
wxDialog * pD = safenew wxDialogWrapper(this, wxID_ANY, GetTitle());
|
||||
pD->SetName(pD->GetTitle());
|
||||
@ -197,6 +204,7 @@ void BatchProcessDialog::OnApplyToProject(wxCommandEvent & WXUNUSED(event))
|
||||
// the 'Hide' converts us from a Modal into a regular dialog,
|
||||
// as far as closing is concerned. On Linux we can't close with
|
||||
// EndModal() anymore after this.
|
||||
if( bHasGui )
|
||||
Hide();
|
||||
|
||||
gPrefs->Write(wxT("/Batch/ActiveChain"), name);
|
||||
@ -213,6 +221,10 @@ void BatchProcessDialog::OnApplyToProject(wxCommandEvent & WXUNUSED(event))
|
||||
[this]{ return mBatchCommands.ApplyChain(); } );
|
||||
}
|
||||
|
||||
if( !bHasGui )
|
||||
return;
|
||||
|
||||
|
||||
if (!success) {
|
||||
Show();
|
||||
return;
|
||||
|
@ -55,6 +55,9 @@ class BatchProcessDialog : public wxDialogWrapper {
|
||||
virtual wxString GetHelpPageName() {return "Tools_Menu#chains_compact_dialog";};
|
||||
|
||||
|
||||
void ApplyChainToProject( int iChain, bool bHasGui=true );
|
||||
|
||||
|
||||
// These will be reused in the derived class...
|
||||
wxListCtrl *mList;
|
||||
wxListCtrl *mChains;
|
||||
|
@ -167,6 +167,10 @@ enum {
|
||||
|
||||
#include "commands/CommandContext.h"
|
||||
#include "commands/ScreenshotCommand.h"
|
||||
|
||||
#include "BatchCommands.h"
|
||||
|
||||
|
||||
//
|
||||
// Effects menu arrays
|
||||
//
|
||||
@ -1193,6 +1197,8 @@ void AudacityProject::CreateMenusAndCommands()
|
||||
AudioIONotBusyFlag);
|
||||
c->AddItem(wxT("EditChains"), _("Edit C&hains..."), FN(OnEditChains));
|
||||
|
||||
c->AddSeparator();
|
||||
PopulateChainsMenu( c, AudioIONotBusyFlag );
|
||||
c->AddSeparator();
|
||||
|
||||
PopulateEffectsMenu(c,
|
||||
@ -1698,6 +1704,22 @@ void AudacityProject::CreateMenusAndCommands()
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
void AudacityProject::PopulateChainsMenu( CommandManager* c, CommandFlag flags )
|
||||
{
|
||||
wxArrayString names = BatchCommands::GetNames();
|
||||
int i;
|
||||
|
||||
for (i = 0; i < (int)names.GetCount(); i++) {
|
||||
c->AddItem(wxString::Format("Chain%03i", i ), names[i], FN(OnApplyChainDirectly),
|
||||
AudioIONotBusyFlag,
|
||||
AudioIONotBusyFlag);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// The effects come from a plug in list
|
||||
/// This code iterates through the list, adding effects into
|
||||
/// the menu.
|
||||
@ -8457,6 +8479,18 @@ void AudacityProject::OnApplyChain(const CommandContext &WXUNUSED(context) )
|
||||
ModifyUndoMenuItems();
|
||||
}
|
||||
|
||||
void AudacityProject::OnApplyChainDirectly(const CommandContext &context )
|
||||
{
|
||||
//wxLogDebug( "Chain was: %s", context.parameter);
|
||||
BatchProcessDialog dlg(this);
|
||||
wxString Name = context.parameter;
|
||||
long item=0;
|
||||
// Take last three letters (of e.g. Chain007) and convert to a number.
|
||||
Name.Mid( Name.Length() - 3 ).ToLong( &item, 10 );
|
||||
dlg.ApplyChainToProject( item, false );
|
||||
ModifyUndoMenuItems();
|
||||
}
|
||||
|
||||
void AudacityProject::OnEditChains(const CommandContext &WXUNUSED(context) )
|
||||
{
|
||||
EditChainsDialog dlg(this);
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
private:
|
||||
void CreateMenusAndCommands();
|
||||
|
||||
void PopulateChainsMenu( CommandManager* c, CommandFlag flags );
|
||||
void PopulateEffectsMenu(CommandManager *c, EffectType type,
|
||||
CommandFlag batchflags, CommandFlag realflags);
|
||||
void AddEffectMenuItems(CommandManager *c,
|
||||
@ -494,6 +494,7 @@ void OnEffect(const CommandContext &context );
|
||||
void OnRepeatLastEffect(const CommandContext &context );
|
||||
bool DoAudacityCommand(const PluginID & ID, const CommandContext &, int flags);
|
||||
void OnApplyChain(const CommandContext &context );
|
||||
void OnApplyChainDirectly(const CommandContext &context );
|
||||
void OnEditChains(const CommandContext &context );
|
||||
void OnStereoToMono(const CommandContext &context );
|
||||
void OnAudacityCommand(const CommandContext &context );
|
||||
|
Loading…
x
Reference in New Issue
Block a user