mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-02 00:29:41 +02:00
Merge branch 'tools-menu'
- New Tools menu, with macros and some nyquist in it - Also has Macros... dialog, which can both edit and apply macros. - 'Macros' feature was previously called 'Chains', so a lot of renaming.
This commit is contained in:
commit
eab0af21ee
@ -55,7 +55,8 @@ typedef enum EffectType
|
||||
EffectTypeHidden,
|
||||
EffectTypeGenerate,
|
||||
EffectTypeProcess,
|
||||
EffectTypeAnalyze
|
||||
EffectTypeAnalyze,
|
||||
EffectTypeTool,
|
||||
} EffectType;
|
||||
|
||||
class ShuttleParams;
|
||||
|
@ -1,6 +1,6 @@
|
||||
;nyquist plug-in
|
||||
;version 4
|
||||
;type analyze
|
||||
;type tool
|
||||
$name (_"Regular Interval Labels")
|
||||
;manpage "Regular_Interval_Labels"
|
||||
$action (_"Adding equally-spaced labels to the label track...")
|
||||
|
@ -1,6 +1,6 @@
|
||||
;nyquist plug-in
|
||||
;version 3
|
||||
;type analyze
|
||||
;type tool
|
||||
$name (_"Sample Data Export")
|
||||
;manpage "Sample_Data_Export"
|
||||
$action (_"Analyzing...")
|
||||
|
@ -1,6 +1,6 @@
|
||||
;nyquist plug-in
|
||||
;version 4
|
||||
;type generate
|
||||
;type tool
|
||||
$name (_"Sample Data Import")
|
||||
;manpage "Sample_Data_Import"
|
||||
$action (_"Reading and rendering samples...")
|
||||
|
@ -9,8 +9,8 @@
|
||||
|
||||
*******************************************************************//*!
|
||||
|
||||
\class BatchCommandDialog
|
||||
\brief Provides a list of configurable commands for use with BatchCommands
|
||||
\class MacroCommandDialog
|
||||
\brief Provides a list of configurable commands for use with MacroCommands
|
||||
|
||||
Provides a list of commands, mostly effects, which can be chained
|
||||
together in a simple linear sequence. Can configure parameters on each
|
||||
@ -48,17 +48,17 @@ selected command.
|
||||
#define EditParamsButtonID 7002
|
||||
#define UsePresetButtonID 7003
|
||||
|
||||
BEGIN_EVENT_TABLE(BatchCommandDialog, wxDialogWrapper)
|
||||
EVT_BUTTON(wxID_OK, BatchCommandDialog::OnOk)
|
||||
EVT_BUTTON(wxID_CANCEL, BatchCommandDialog::OnCancel)
|
||||
EVT_BUTTON(wxID_HELP, BatchCommandDialog::OnHelp)
|
||||
EVT_BUTTON(EditParamsButtonID, BatchCommandDialog::OnEditParams)
|
||||
EVT_BUTTON(UsePresetButtonID, BatchCommandDialog::OnUsePreset)
|
||||
EVT_LIST_ITEM_ACTIVATED(CommandsListID, BatchCommandDialog::OnItemSelected)
|
||||
EVT_LIST_ITEM_SELECTED(CommandsListID, BatchCommandDialog::OnItemSelected)
|
||||
BEGIN_EVENT_TABLE(MacroCommandDialog, wxDialogWrapper)
|
||||
EVT_BUTTON(wxID_OK, MacroCommandDialog::OnOk)
|
||||
EVT_BUTTON(wxID_CANCEL, MacroCommandDialog::OnCancel)
|
||||
EVT_BUTTON(wxID_HELP, MacroCommandDialog::OnHelp)
|
||||
EVT_BUTTON(EditParamsButtonID, MacroCommandDialog::OnEditParams)
|
||||
EVT_BUTTON(UsePresetButtonID, MacroCommandDialog::OnUsePreset)
|
||||
EVT_LIST_ITEM_ACTIVATED(CommandsListID, MacroCommandDialog::OnItemSelected)
|
||||
EVT_LIST_ITEM_SELECTED(CommandsListID, MacroCommandDialog::OnItemSelected)
|
||||
END_EVENT_TABLE();
|
||||
|
||||
BatchCommandDialog::BatchCommandDialog(wxWindow * parent, wxWindowID id):
|
||||
MacroCommandDialog::MacroCommandDialog(wxWindow * parent, wxWindowID id):
|
||||
wxDialogWrapper(parent, id, _("Select Command"),
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxCAPTION | wxRESIZE_BORDER)
|
||||
@ -68,7 +68,7 @@ BatchCommandDialog::BatchCommandDialog(wxWindow * parent, wxWindowID id):
|
||||
Populate();
|
||||
}
|
||||
|
||||
void BatchCommandDialog::Populate()
|
||||
void MacroCommandDialog::Populate()
|
||||
{
|
||||
//------------------------- Main section --------------------
|
||||
ShuttleGui S(this, eIsCreating);
|
||||
@ -76,7 +76,7 @@ void BatchCommandDialog::Populate()
|
||||
// ----------------------- End of main section --------------
|
||||
}
|
||||
|
||||
void BatchCommandDialog::PopulateOrExchange(ShuttleGui &S)
|
||||
void MacroCommandDialog::PopulateOrExchange(ShuttleGui &S)
|
||||
{
|
||||
S.StartVerticalLay(true);
|
||||
{
|
||||
@ -121,9 +121,9 @@ void BatchCommandDialog::PopulateOrExchange(ShuttleGui &S)
|
||||
Center();
|
||||
}
|
||||
|
||||
void BatchCommandDialog::PopulateCommandList()
|
||||
void MacroCommandDialog::PopulateCommandList()
|
||||
{
|
||||
mCommandNames = BatchCommands::GetAllCommands();
|
||||
mCommandNames = MacroCommands::GetAllCommands();
|
||||
|
||||
mChoices->DeleteAllItems();
|
||||
for (size_t ii = 0, size = mCommandNames.size(); ii < size; ++ii)
|
||||
@ -131,33 +131,33 @@ void BatchCommandDialog::PopulateCommandList()
|
||||
mChoices->InsertItem( ii, std::get<0>( mCommandNames[ii] ) );
|
||||
}
|
||||
|
||||
void BatchCommandDialog::ValidateChoices()
|
||||
void MacroCommandDialog::ValidateChoices()
|
||||
{
|
||||
}
|
||||
|
||||
void BatchCommandDialog::OnChoice(wxCommandEvent & WXUNUSED(event))
|
||||
void MacroCommandDialog::OnChoice(wxCommandEvent & WXUNUSED(event))
|
||||
{
|
||||
}
|
||||
|
||||
void BatchCommandDialog::OnOk(wxCommandEvent & WXUNUSED(event))
|
||||
void MacroCommandDialog::OnOk(wxCommandEvent & WXUNUSED(event))
|
||||
{
|
||||
mSelectedCommand = mInternalCommandName.Strip(wxString::both);
|
||||
mSelectedParameters = mParameters->GetValue().Strip(wxString::trailing);
|
||||
EndModal(true);
|
||||
}
|
||||
|
||||
void BatchCommandDialog::OnCancel(wxCommandEvent & WXUNUSED(event))
|
||||
void MacroCommandDialog::OnCancel(wxCommandEvent & WXUNUSED(event))
|
||||
{
|
||||
EndModal(false);
|
||||
}
|
||||
|
||||
void BatchCommandDialog::OnHelp(wxCommandEvent & WXUNUSED(event))
|
||||
void MacroCommandDialog::OnHelp(wxCommandEvent & WXUNUSED(event))
|
||||
{
|
||||
wxString page = GetHelpPageName();
|
||||
HelpSystem::ShowHelp(this, page, true);
|
||||
}
|
||||
|
||||
void BatchCommandDialog::OnItemSelected(wxListEvent &event)
|
||||
void MacroCommandDialog::OnItemSelected(wxListEvent &event)
|
||||
{
|
||||
const auto &command = mCommandNames[ event.GetIndex() ];
|
||||
|
||||
@ -175,7 +175,7 @@ void BatchCommandDialog::OnItemSelected(wxListEvent &event)
|
||||
mCommand->SetValue(std::get<0> (command));
|
||||
mInternalCommandName = std::get<1>( command );
|
||||
|
||||
wxString params = BatchCommands::GetCurrentParamsFor(mInternalCommandName);
|
||||
wxString params = MacroCommands::GetCurrentParamsFor(mInternalCommandName);
|
||||
if (params.IsEmpty())
|
||||
{
|
||||
params = em.GetDefaultPreset(ID);
|
||||
@ -187,29 +187,29 @@ void BatchCommandDialog::OnItemSelected(wxListEvent &event)
|
||||
mParameters->SetValue(params);
|
||||
}
|
||||
|
||||
void BatchCommandDialog::OnEditParams(wxCommandEvent & WXUNUSED(event))
|
||||
void MacroCommandDialog::OnEditParams(wxCommandEvent & WXUNUSED(event))
|
||||
{
|
||||
wxString command = mInternalCommandName;
|
||||
wxString params = mParameters->GetValue();
|
||||
|
||||
params = BatchCommands::PromptForParamsFor(command, params, this).Trim();
|
||||
params = MacroCommands::PromptForParamsFor(command, params, this).Trim();
|
||||
|
||||
mParameters->SetValue(params);
|
||||
mParameters->Refresh();
|
||||
}
|
||||
|
||||
void BatchCommandDialog::OnUsePreset(wxCommandEvent & WXUNUSED(event))
|
||||
void MacroCommandDialog::OnUsePreset(wxCommandEvent & WXUNUSED(event))
|
||||
{
|
||||
wxString command = mInternalCommandName;
|
||||
wxString params = mParameters->GetValue();
|
||||
|
||||
wxString preset = BatchCommands::PromptForPresetFor(command, params, this).Trim();
|
||||
wxString preset = MacroCommands::PromptForPresetFor(command, params, this).Trim();
|
||||
|
||||
mParameters->SetValue(preset);
|
||||
mParameters->Refresh();
|
||||
}
|
||||
|
||||
void BatchCommandDialog::SetCommandAndParams(const wxString &Command, const wxString &Params)
|
||||
void MacroCommandDialog::SetCommandAndParams(const wxString &Command, const wxString &Params)
|
||||
{
|
||||
auto item = make_iterator_range(mCommandNames).index_if(
|
||||
[&](const CommandName &name){ return Command == std::get<1>( name); }
|
||||
|
@ -9,8 +9,8 @@
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef __AUDACITY_BATCH_COMMAND_DIALOG__
|
||||
#define __AUDACITY_BATCH_COMMAND_DIALOG__
|
||||
#ifndef __AUDACITY_MACRO_COMMAND_DIALOG__
|
||||
#define __AUDACITY_MACRO_COMMAND_DIALOG__
|
||||
|
||||
#include "MemoryX.h"
|
||||
#include <wx/defs.h>
|
||||
@ -37,10 +37,10 @@ class wxListEvent;
|
||||
class wxButton;
|
||||
class ShuttleGui;
|
||||
|
||||
class BatchCommandDialog final : public wxDialogWrapper {
|
||||
class MacroCommandDialog final : public wxDialogWrapper {
|
||||
public:
|
||||
// constructors and destructors
|
||||
BatchCommandDialog(wxWindow *parent, wxWindowID id);
|
||||
MacroCommandDialog(wxWindow *parent, wxWindowID id);
|
||||
void SetCommandAndParams(const wxString &Command, const wxString &Params);
|
||||
public:
|
||||
wxString mSelectedCommand;
|
||||
|
@ -2,16 +2,16 @@
|
||||
|
||||
Audacity: A Digital Audio Editor
|
||||
|
||||
BatchCommands.cpp
|
||||
MacroCommands.cpp
|
||||
|
||||
Dominic Mazzoni
|
||||
James Crook
|
||||
|
||||
********************************************************************//*!
|
||||
|
||||
\class BatchCommands
|
||||
\class MacroCommands
|
||||
\brief Maintains the chain of commands used in batch processing.
|
||||
See also BatchCommandDialog and BatchProcessDialog.
|
||||
See also MacroCommandDialog and ApplyMacroDialog.
|
||||
|
||||
*//*******************************************************************/
|
||||
|
||||
@ -88,51 +88,76 @@ static const std::pair<const wxChar*, const wxChar*> SpecialCommands[] = {
|
||||
// end CLEANSPEECH remnant
|
||||
|
||||
static const wxString MP3Conversion = wxT("MP3 Conversion");
|
||||
static const wxString FadeEnds = wxT("Fade Ends");
|
||||
|
||||
BatchCommands::BatchCommands()
|
||||
MacroCommands::MacroCommands()
|
||||
{
|
||||
mMessage = "";
|
||||
ResetChain();
|
||||
ResetMacro();
|
||||
|
||||
wxArrayString names = GetNames();
|
||||
|
||||
if (names.Index(MP3Conversion) == wxNOT_FOUND) {
|
||||
AddChain(MP3Conversion);
|
||||
RestoreChain(MP3Conversion);
|
||||
WriteChain(MP3Conversion);
|
||||
wxArrayString defaults;
|
||||
defaults.Add( MP3Conversion );
|
||||
defaults.Add( FadeEnds );
|
||||
|
||||
for( size_t i = 0;i<defaults.Count();i++){
|
||||
wxString name = defaults[i];
|
||||
if (names.Index(name) == wxNOT_FOUND) {
|
||||
AddMacro(name);
|
||||
RestoreMacro(name);
|
||||
WriteMacro(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wxString BatchCommands::GetCommand(int index)
|
||||
void MacroCommands::RestoreMacro(const wxString & name)
|
||||
{
|
||||
if (index < 0 || index >= (int)mCommandChain.GetCount()) {
|
||||
// TIDY-ME: Effects change their name with localisation.
|
||||
// Commands (at least currently) don't. Messy.
|
||||
ResetMacro();
|
||||
if (name == MP3Conversion){
|
||||
AddToMacro( wxT("Normalize") );
|
||||
AddToMacro( wxT("ExportMP3") );
|
||||
} else if (name == FadeEnds ){
|
||||
AddToMacro( wxT("Select: Start=\"0\" End=\"1\"") );
|
||||
AddToMacro( wxT("FadeIn") );
|
||||
AddToMacro( wxT("Select: Start=\"0\" End=\"1\" FromEnd=\"1\"") );
|
||||
AddToMacro( wxT("FadeOut") );
|
||||
AddToMacro( wxT("Select: Start=\"0\" End=\"0\"") );
|
||||
}
|
||||
}
|
||||
|
||||
wxString MacroCommands::GetCommand(int index)
|
||||
{
|
||||
if (index < 0 || index >= (int)mCommandMacro.GetCount()) {
|
||||
return wxT("");
|
||||
}
|
||||
|
||||
return mCommandChain[index];
|
||||
return mCommandMacro[index];
|
||||
}
|
||||
|
||||
wxString BatchCommands::GetParams(int index)
|
||||
wxString MacroCommands::GetParams(int index)
|
||||
{
|
||||
if (index < 0 || index >= (int)mParamsChain.GetCount()) {
|
||||
if (index < 0 || index >= (int)mParamsMacro.GetCount()) {
|
||||
return wxT("");
|
||||
}
|
||||
|
||||
return mParamsChain[index];
|
||||
return mParamsMacro[index];
|
||||
}
|
||||
|
||||
int BatchCommands::GetCount()
|
||||
int MacroCommands::GetCount()
|
||||
{
|
||||
return (int)mCommandChain.GetCount();
|
||||
return (int)mCommandMacro.GetCount();
|
||||
}
|
||||
|
||||
bool BatchCommands::ReadChain(const wxString & chain)
|
||||
bool MacroCommands::ReadMacro(const wxString & chain)
|
||||
{
|
||||
// Clear any previous chain
|
||||
ResetChain();
|
||||
ResetMacro();
|
||||
|
||||
// Build the filename
|
||||
wxFileName name(FileNames::ChainDir(), chain, wxT("txt"));
|
||||
wxFileName name(FileNames::MacroDir(), chain, wxT("txt"));
|
||||
|
||||
// Set the file name
|
||||
wxTextFile tf(name.GetFullPath());
|
||||
@ -160,8 +185,8 @@ bool BatchCommands::ReadChain(const wxString & chain)
|
||||
wxString parm = tf[i].Mid(splitAt + 1).Strip(wxString::trailing);
|
||||
|
||||
// Add to lists
|
||||
mCommandChain.Add(cmd);
|
||||
mParamsChain.Add(parm);
|
||||
mCommandMacro.Add(cmd);
|
||||
mParamsMacro.Add(parm);
|
||||
}
|
||||
}
|
||||
|
||||
@ -172,10 +197,10 @@ bool BatchCommands::ReadChain(const wxString & chain)
|
||||
}
|
||||
|
||||
|
||||
bool BatchCommands::WriteChain(const wxString & chain)
|
||||
bool MacroCommands::WriteMacro(const wxString & chain)
|
||||
{
|
||||
// Build the filename
|
||||
wxFileName name(FileNames::ChainDir(), chain, wxT("txt"));
|
||||
wxFileName name(FileNames::MacroDir(), chain, wxT("txt"));
|
||||
|
||||
// Set the file name
|
||||
wxTextFile tf(name.GetFullPath());
|
||||
@ -197,9 +222,9 @@ bool BatchCommands::WriteChain(const wxString & chain)
|
||||
tf.Clear();
|
||||
|
||||
// Copy over the commands
|
||||
int lines = mCommandChain.GetCount();
|
||||
int lines = mCommandMacro.GetCount();
|
||||
for (int i = 0; i < lines; i++) {
|
||||
tf.AddLine(mCommandChain[i] + wxT(":") + mParamsChain[ i ]);
|
||||
tf.AddLine(mCommandMacro[i] + wxT(":") + mParamsMacro[ i ]);
|
||||
}
|
||||
|
||||
// Write the chain
|
||||
@ -211,10 +236,10 @@ bool BatchCommands::WriteChain(const wxString & chain)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool BatchCommands::AddChain(const wxString & chain)
|
||||
bool MacroCommands::AddMacro(const wxString & chain)
|
||||
{
|
||||
// Build the filename
|
||||
wxFileName name(FileNames::ChainDir(), chain, wxT("txt"));
|
||||
wxFileName name(FileNames::MacroDir(), chain, wxT("txt"));
|
||||
|
||||
// Set the file name
|
||||
wxTextFile tf(name.GetFullPath());
|
||||
@ -223,35 +248,27 @@ bool BatchCommands::AddChain(const wxString & chain)
|
||||
return tf.Create();
|
||||
}
|
||||
|
||||
bool BatchCommands::DeleteChain(const wxString & chain)
|
||||
bool MacroCommands::DeleteMacro(const wxString & chain)
|
||||
{
|
||||
// Build the filename
|
||||
wxFileName name(FileNames::ChainDir(), chain, wxT("txt"));
|
||||
wxFileName name(FileNames::MacroDir(), chain, wxT("txt"));
|
||||
|
||||
// Delete it...wxRemoveFile will display errors
|
||||
return wxRemoveFile(name.GetFullPath());
|
||||
}
|
||||
|
||||
bool BatchCommands::RenameChain(const wxString & oldchain, const wxString & newchain)
|
||||
bool MacroCommands::RenameMacro(const wxString & oldchain, const wxString & newchain)
|
||||
{
|
||||
// Build the filenames
|
||||
wxFileName oname(FileNames::ChainDir(), oldchain, wxT("txt"));
|
||||
wxFileName nname(FileNames::ChainDir(), newchain, wxT("txt"));
|
||||
wxFileName oname(FileNames::MacroDir(), oldchain, wxT("txt"));
|
||||
wxFileName nname(FileNames::MacroDir(), newchain, wxT("txt"));
|
||||
|
||||
// Rename it...wxRenameFile will display errors
|
||||
return wxRenameFile(oname.GetFullPath(), nname.GetFullPath());
|
||||
}
|
||||
|
||||
void BatchCommands::SetWavToMp3Chain() // a function per default chain? This is flawed design! MJS
|
||||
{
|
||||
ResetChain();
|
||||
|
||||
AddToChain( wxT("Normalize") );
|
||||
AddToChain( wxT("ExportMP3") );
|
||||
}
|
||||
|
||||
// Gets all commands that are valid for this mode.
|
||||
auto BatchCommands::GetAllCommands() -> CommandNameVector
|
||||
auto MacroCommands::GetAllCommands() -> CommandNameVector
|
||||
{
|
||||
CommandNameVector commands;
|
||||
|
||||
@ -341,7 +358,7 @@ auto BatchCommands::GetAllCommands() -> CommandNameVector
|
||||
return uniqueCommands;
|
||||
}
|
||||
|
||||
wxString BatchCommands::GetCurrentParamsFor(const wxString & command)
|
||||
wxString MacroCommands::GetCurrentParamsFor(const wxString & command)
|
||||
{
|
||||
const PluginID & ID = EffectManager::Get().GetEffectByIdentifier(command);
|
||||
if (ID.empty())
|
||||
@ -352,7 +369,7 @@ wxString BatchCommands::GetCurrentParamsFor(const wxString & command)
|
||||
return EffectManager::Get().GetEffectParameters(ID);
|
||||
}
|
||||
|
||||
wxString BatchCommands::PromptForParamsFor(const wxString & command, const wxString & params, wxWindow *parent)
|
||||
wxString MacroCommands::PromptForParamsFor(const wxString & command, const wxString & params, wxWindow *parent)
|
||||
{
|
||||
const PluginID & ID = EffectManager::Get().GetEffectByIdentifier(command);
|
||||
if (ID.empty())
|
||||
@ -375,7 +392,7 @@ wxString BatchCommands::PromptForParamsFor(const wxString & command, const wxStr
|
||||
return res;
|
||||
}
|
||||
|
||||
wxString BatchCommands::PromptForPresetFor(const wxString & command, const wxString & params, wxWindow *parent)
|
||||
wxString MacroCommands::PromptForPresetFor(const wxString & command, const wxString & params, wxWindow *parent)
|
||||
{
|
||||
const PluginID & ID = EffectManager::Get().GetEffectByIdentifier(command);
|
||||
if (ID.empty())
|
||||
@ -395,7 +412,7 @@ wxString BatchCommands::PromptForPresetFor(const wxString & command, const wxStr
|
||||
return preset;
|
||||
}
|
||||
|
||||
double BatchCommands::GetEndTime()
|
||||
double MacroCommands::GetEndTime()
|
||||
{
|
||||
AudacityProject *project = GetActiveProject();
|
||||
if( project == NULL )
|
||||
@ -414,7 +431,7 @@ double BatchCommands::GetEndTime()
|
||||
return endTime;
|
||||
}
|
||||
|
||||
bool BatchCommands::IsMono()
|
||||
bool MacroCommands::IsMono()
|
||||
{
|
||||
AudacityProject *project = GetActiveProject();
|
||||
if( project == NULL )
|
||||
@ -444,7 +461,7 @@ bool BatchCommands::IsMono()
|
||||
return mono;
|
||||
}
|
||||
|
||||
wxString BatchCommands::BuildCleanFileName(const wxString &fileName, const wxString &extension)
|
||||
wxString MacroCommands::BuildCleanFileName(const wxString &fileName, const wxString &extension)
|
||||
{
|
||||
const wxFileName newFileName{ fileName };
|
||||
wxString justName = newFileName.GetName();
|
||||
@ -493,7 +510,7 @@ wxString BatchCommands::BuildCleanFileName(const wxString &fileName, const wxStr
|
||||
}
|
||||
|
||||
// TODO Move this out of Batch Commands
|
||||
bool BatchCommands::WriteMp3File( const wxString & Name, int bitrate )
|
||||
bool MacroCommands::WriteMp3File( const wxString & Name, int bitrate )
|
||||
{ //check if current project is mono or stereo
|
||||
unsigned numChannels = 2;
|
||||
if (IsMono()) {
|
||||
@ -541,7 +558,7 @@ bool BatchCommands::WriteMp3File( const wxString & Name, int bitrate )
|
||||
// and think again.
|
||||
// ======= IMPORTANT ========
|
||||
// CLEANSPEECH remnant
|
||||
bool BatchCommands::ApplySpecialCommand(int WXUNUSED(iCommand), const wxString & command,const wxString & params)
|
||||
bool MacroCommands::ApplySpecialCommand(int WXUNUSED(iCommand), const wxString & command,const wxString & params)
|
||||
{
|
||||
if (ReportAndSkip(command, params))
|
||||
return true;
|
||||
@ -625,7 +642,7 @@ bool BatchCommands::ApplySpecialCommand(int WXUNUSED(iCommand), const wxString &
|
||||
}
|
||||
// end CLEANSPEECH remnant
|
||||
|
||||
bool BatchCommands::ApplyEffectCommand(const PluginID & ID, const wxString & command, const wxString & params, const CommandContext & Context)
|
||||
bool MacroCommands::ApplyEffectCommand(const PluginID & ID, const wxString & command, const wxString & params, const CommandContext & Context)
|
||||
{
|
||||
//Possibly end processing here, if in batch-debug
|
||||
if( ReportAndSkip(command, params))
|
||||
@ -669,7 +686,7 @@ bool BatchCommands::ApplyEffectCommand(const PluginID & ID, const wxString & com
|
||||
return res;
|
||||
}
|
||||
|
||||
bool BatchCommands::ApplyCommand(const wxString & command, const wxString & params, CommandContext const * pContext)
|
||||
bool MacroCommands::ApplyCommand(const wxString & command, const wxString & params, CommandContext const * pContext)
|
||||
{
|
||||
|
||||
unsigned int i;
|
||||
@ -714,7 +731,7 @@ bool BatchCommands::ApplyCommand(const wxString & command, const wxString & para
|
||||
return false;
|
||||
}
|
||||
|
||||
bool BatchCommands::ApplyCommandInBatchMode(const wxString & command, const wxString ¶ms)
|
||||
bool MacroCommands::ApplyCommandInBatchMode(const wxString & command, const wxString ¶ms)
|
||||
{
|
||||
AudacityProject *project = GetActiveProject();
|
||||
|
||||
@ -728,10 +745,10 @@ bool BatchCommands::ApplyCommandInBatchMode(const wxString & command, const wxSt
|
||||
return ApplyCommand( command, params );
|
||||
}
|
||||
|
||||
// ApplyChain returns true on success, false otherwise.
|
||||
// ApplyMacro returns true on success, false otherwise.
|
||||
// Any error reporting to the user in setting up the chain
|
||||
// has already been done.
|
||||
bool BatchCommands::ApplyChain(const wxString & filename)
|
||||
bool MacroCommands::ApplyMacro(const wxString & filename)
|
||||
{
|
||||
mFileName = filename;
|
||||
|
||||
@ -740,7 +757,7 @@ bool BatchCommands::ApplyChain(const wxString & filename)
|
||||
auto cleanup = finally( [&] {
|
||||
if (!res) {
|
||||
if(proj) {
|
||||
// Chain failed or was cancelled; revert to the previous state
|
||||
// Macro failed or was cancelled; revert to the previous state
|
||||
proj->RollbackState();
|
||||
}
|
||||
}
|
||||
@ -749,20 +766,20 @@ bool BatchCommands::ApplyChain(const wxString & filename)
|
||||
mAbort = false;
|
||||
|
||||
size_t i = 0;
|
||||
for (; i < mCommandChain.GetCount(); i++) {
|
||||
if (!ApplyCommandInBatchMode(mCommandChain[i], mParamsChain[i]) || mAbort)
|
||||
for (; i < mCommandMacro.GetCount(); i++) {
|
||||
if (!ApplyCommandInBatchMode(mCommandMacro[i], mParamsMacro[i]) || mAbort)
|
||||
break;
|
||||
}
|
||||
|
||||
res = (i == mCommandChain.GetCount());
|
||||
res = (i == mCommandMacro.GetCount());
|
||||
if (!res)
|
||||
return false;
|
||||
|
||||
mFileName.Empty();
|
||||
|
||||
// Chain was successfully applied; save the NEW project state
|
||||
// Macro was successfully applied; save the NEW project state
|
||||
wxString longDesc, shortDesc;
|
||||
wxString name = gPrefs->Read(wxT("/Batch/ActiveChain"), wxEmptyString);
|
||||
wxString name = gPrefs->Read(wxT("/Batch/ActiveMacro"), wxEmptyString);
|
||||
if (name.IsEmpty())
|
||||
{
|
||||
/* i18n-hint: active verb in past tense */
|
||||
@ -783,45 +800,45 @@ bool BatchCommands::ApplyChain(const wxString & filename)
|
||||
}
|
||||
|
||||
// AbortBatch() allows a premature terminatation of a batch.
|
||||
void BatchCommands::AbortBatch()
|
||||
void MacroCommands::AbortBatch()
|
||||
{
|
||||
mAbort = true;
|
||||
}
|
||||
|
||||
void BatchCommands::AddToChain(const wxString &command, int before)
|
||||
void MacroCommands::AddToMacro(const wxString &command, int before)
|
||||
{
|
||||
AddToChain(command, GetCurrentParamsFor(command), before);
|
||||
AddToMacro(command, GetCurrentParamsFor(command), before);
|
||||
}
|
||||
|
||||
void BatchCommands::AddToChain(const wxString &command, const wxString ¶ms, int before)
|
||||
void MacroCommands::AddToMacro(const wxString &command, const wxString ¶ms, int before)
|
||||
{
|
||||
if (before == -1) {
|
||||
before = (int)mCommandChain.GetCount();
|
||||
before = (int)mCommandMacro.GetCount();
|
||||
}
|
||||
|
||||
mCommandChain.Insert(command, before);
|
||||
mParamsChain.Insert(params, before);
|
||||
mCommandMacro.Insert(command, before);
|
||||
mParamsMacro.Insert(params, before);
|
||||
}
|
||||
|
||||
void BatchCommands::DeleteFromChain(int index)
|
||||
void MacroCommands::DeleteFromMacro(int index)
|
||||
{
|
||||
if (index < 0 || index >= (int)mCommandChain.GetCount()) {
|
||||
if (index < 0 || index >= (int)mCommandMacro.GetCount()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mCommandChain.RemoveAt(index);
|
||||
mParamsChain.RemoveAt(index);
|
||||
mCommandMacro.RemoveAt(index);
|
||||
mParamsMacro.RemoveAt(index);
|
||||
}
|
||||
|
||||
void BatchCommands::ResetChain()
|
||||
void MacroCommands::ResetMacro()
|
||||
{
|
||||
mCommandChain.Clear();
|
||||
mParamsChain.Clear();
|
||||
mCommandMacro.Clear();
|
||||
mParamsMacro.Clear();
|
||||
}
|
||||
|
||||
// ReportAndSkip() is a diagnostic function that avoids actually
|
||||
// applying the requested effect if in batch-debug mode.
|
||||
bool BatchCommands::ReportAndSkip(const wxString & command, const wxString & params)
|
||||
bool MacroCommands::ReportAndSkip(const wxString & command, const wxString & params)
|
||||
{
|
||||
int bDebug;
|
||||
gPrefs->Read(wxT("/Batch/Debug"), &bDebug, false);
|
||||
@ -842,11 +859,11 @@ bool BatchCommands::ReportAndSkip(const wxString & command, const wxString & par
|
||||
return true;
|
||||
}
|
||||
|
||||
wxArrayString BatchCommands::GetNames()
|
||||
wxArrayString MacroCommands::GetNames()
|
||||
{
|
||||
wxArrayString names;
|
||||
wxArrayString files;
|
||||
wxDir::GetAllFiles(FileNames::ChainDir(), &files, wxT("*.txt"), wxDIR_FILES);
|
||||
wxDir::GetAllFiles(FileNames::MacroDir(), &files, wxT("*.txt"), wxDIR_FILES);
|
||||
size_t i;
|
||||
|
||||
wxFileName ff;
|
||||
@ -858,23 +875,16 @@ wxArrayString BatchCommands::GetNames()
|
||||
return names;
|
||||
}
|
||||
|
||||
bool BatchCommands::IsFixed(const wxString & name)
|
||||
bool MacroCommands::IsFixed(const wxString & name)
|
||||
{
|
||||
if (name == MP3Conversion)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void BatchCommands::RestoreChain(const wxString & name)
|
||||
{
|
||||
// TIDY-ME: Effects change their name with localisation.
|
||||
// Commands (at least currently) don't. Messy.
|
||||
|
||||
if (name == MP3Conversion)
|
||||
SetWavToMp3Chain();
|
||||
}
|
||||
|
||||
void BatchCommands::Split(const wxString & str, wxString & command, wxString & param)
|
||||
void MacroCommands::Split(const wxString & str, wxString & command, wxString & param)
|
||||
{
|
||||
int splitAt;
|
||||
|
||||
@ -896,7 +906,7 @@ void BatchCommands::Split(const wxString & str, wxString & command, wxString & p
|
||||
return;
|
||||
}
|
||||
|
||||
wxString BatchCommands::Join(const wxString & command, const wxString & param)
|
||||
wxString MacroCommands::Join(const wxString & command, const wxString & param)
|
||||
{
|
||||
return command + wxT(": ") + param;
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
Audacity: A Digital Audio Editor
|
||||
|
||||
BatchCommands.h
|
||||
MacroCommands.h
|
||||
|
||||
Dominic Mazzoni
|
||||
James Crook
|
||||
@ -21,12 +21,12 @@
|
||||
class Effect;
|
||||
class CommandContext;
|
||||
|
||||
class BatchCommands final {
|
||||
class MacroCommands final {
|
||||
public:
|
||||
// constructors and destructors
|
||||
BatchCommands();
|
||||
MacroCommands();
|
||||
public:
|
||||
bool ApplyChain(const wxString & filename = wxT(""));
|
||||
bool ApplyMacro(const wxString & filename = wxT(""));
|
||||
bool ApplyCommand( const wxString & command, const wxString & params, CommandContext const * pContext=NULL );
|
||||
bool ApplyCommandInBatchMode(const wxString & command, const wxString ¶ms);
|
||||
bool ApplySpecialCommand(int iCommand, const wxString & command,const wxString & params);
|
||||
@ -43,7 +43,7 @@ class BatchCommands final {
|
||||
// These commands do not depend on the command list.
|
||||
static wxArrayString GetNames();
|
||||
|
||||
// A pair of user-visible name, and internal string identifier
|
||||
// A triple of user-visible name, internal string identifier and type/help string.
|
||||
using CommandName = std::tuple<wxString, wxString, wxString>;
|
||||
using CommandNameVector = std::vector<CommandName>;
|
||||
// Result is sorted by user-visible name
|
||||
@ -54,34 +54,31 @@ class BatchCommands final {
|
||||
static wxString PromptForPresetFor(const wxString & command, const wxString & params, wxWindow *parent);
|
||||
|
||||
// These commands do depend on the command list.
|
||||
void ResetChain();
|
||||
void ResetMacro();
|
||||
|
||||
bool ReadChain(const wxString & chain);
|
||||
bool WriteChain(const wxString & chain);
|
||||
bool AddChain(const wxString & chain);
|
||||
bool DeleteChain(const wxString & name);
|
||||
bool RenameChain(const wxString & oldchain, const wxString & newchain);
|
||||
void RestoreMacro(const wxString & name);
|
||||
bool ReadMacro(const wxString & macro);
|
||||
bool WriteMacro(const wxString & macro);
|
||||
bool AddMacro(const wxString & macro);
|
||||
bool DeleteMacro(const wxString & name);
|
||||
bool RenameMacro(const wxString & oldmacro, const wxString & newmacro);
|
||||
|
||||
void AddToChain(const wxString & command, int before = -1);
|
||||
void AddToChain(const wxString & command, const wxString & params, int before = -1);
|
||||
void DeleteFromChain(int index);
|
||||
void AddToMacro(const wxString & command, int before = -1);
|
||||
void AddToMacro(const wxString & command, const wxString & params, int before = -1);
|
||||
void DeleteFromMacro(int index);
|
||||
wxString GetCommand(int index);
|
||||
wxString GetParams(int index);
|
||||
int GetCount();
|
||||
wxString GetMessage(){ return mMessage;};
|
||||
void AddToMessage(const wxString & msgIn ){ mMessage += msgIn;};
|
||||
|
||||
void SetWavToMp3Chain();
|
||||
|
||||
bool IsFixed(const wxString & name);
|
||||
|
||||
void RestoreChain(const wxString & name);
|
||||
|
||||
void Split(const wxString & str, wxString & command, wxString & param);
|
||||
wxString Join(const wxString & command, const wxString & param);
|
||||
|
||||
wxArrayString mCommandChain;
|
||||
wxArrayString mParamsChain;
|
||||
wxArrayString mCommandMacro;
|
||||
wxArrayString mParamsMacro;
|
||||
bool mAbort;
|
||||
wxString mMessage;
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -9,8 +9,8 @@
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef __AUDACITY_BATCH_PROCESS_DIALOG__
|
||||
#define __AUDACITY_BATCH_PROCESS_DIALOG__
|
||||
#ifndef __AUDACITY_MACROS_WINDOW__
|
||||
#define __AUDACITY_MACROS_WINDOW__
|
||||
|
||||
#include <wx/defs.h>
|
||||
#include <wx/string.h>
|
||||
@ -39,62 +39,73 @@ class wxButton;
|
||||
class wxTextCtrl;
|
||||
class ShuttleGui;
|
||||
|
||||
class BatchProcessDialog : public wxDialogWrapper {
|
||||
class ApplyMacroDialog : public wxDialogWrapper {
|
||||
public:
|
||||
// constructors and destructors
|
||||
BatchProcessDialog(wxWindow * parent, bool bInherited=false);
|
||||
virtual ~BatchProcessDialog();
|
||||
ApplyMacroDialog(wxWindow * parent, bool bInherited=false);
|
||||
virtual ~ApplyMacroDialog();
|
||||
public:
|
||||
virtual void Populate();
|
||||
virtual void PopulateOrExchange( ShuttleGui & S );
|
||||
// Populate methods NOT virtual.
|
||||
void Populate();
|
||||
void PopulateOrExchange( ShuttleGui & S );
|
||||
virtual void OnApplyToProject(wxCommandEvent & event);
|
||||
virtual void OnApplyToFiles(wxCommandEvent & event);
|
||||
virtual void OnCancel(wxCommandEvent & event);
|
||||
virtual void OnHelp(wxCommandEvent & event);
|
||||
|
||||
virtual wxString GetHelpPageName() {return "Tools_Menu#chains_compact_dialog";};
|
||||
virtual wxString GetHelpPageName() {return "Tools_Menu#macros_compact_dialog";};
|
||||
|
||||
void PopulateMacros();
|
||||
void ApplyMacroToProject( int iMacro, bool bHasGui=true );
|
||||
|
||||
|
||||
// These will be reused in the derived class...
|
||||
wxListCtrl *mList;
|
||||
wxListCtrl *mChains;
|
||||
BatchCommands mBatchCommands; /// Provides list of available commands.
|
||||
wxListCtrl *mMacros;
|
||||
MacroCommands mMacroCommands; /// Provides list of available commands.
|
||||
|
||||
wxButton *mOK;
|
||||
wxButton *mCancel;
|
||||
wxTextCtrl *mResults;
|
||||
bool mAbort;
|
||||
bool mbExpanded;
|
||||
wxString mActiveMacro;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
class EditChainsDialog final : public BatchProcessDialog
|
||||
class MacrosWindow final : public ApplyMacroDialog
|
||||
{
|
||||
public:
|
||||
EditChainsDialog(wxWindow * parent);
|
||||
~EditChainsDialog();
|
||||
MacrosWindow(wxWindow * parent, bool bExpanded=true);
|
||||
~MacrosWindow();
|
||||
void UpdateDisplay( bool bExpanded );
|
||||
|
||||
private:
|
||||
void Populate() override;
|
||||
void PopulateOrExchange(ShuttleGui &S) override;
|
||||
void Populate();
|
||||
void PopulateOrExchange(ShuttleGui &S);
|
||||
void OnApplyToProject(wxCommandEvent & event) override;
|
||||
void OnApplyToFiles(wxCommandEvent & event) override;
|
||||
void OnCancel(wxCommandEvent &event) override;
|
||||
|
||||
virtual wxString GetHelpPageName() override {return "Tools_Menu#chains_full_dialog";};
|
||||
virtual wxString GetHelpPageName() override {return
|
||||
mbExpanded ? "Tools_Menu#macross_full_dialog"
|
||||
: "Tools_Menu#macros_compact_dialog";};
|
||||
|
||||
void PopulateChains();
|
||||
void PopulateList();
|
||||
void AddItem(const wxString &command, wxString const ¶ms);
|
||||
bool ChangeOK();
|
||||
void UpdateMenus();
|
||||
|
||||
void OnChainSelected(wxListEvent &event);
|
||||
void OnMacroSelected(wxListEvent &event);
|
||||
void OnListSelected(wxListEvent &event);
|
||||
void OnChainsBeginEdit(wxListEvent &event);
|
||||
void OnChainsEndEdit(wxListEvent &event);
|
||||
void OnMacrosBeginEdit(wxListEvent &event);
|
||||
void OnMacrosEndEdit(wxListEvent &event);
|
||||
void OnAdd(wxCommandEvent &event);
|
||||
void OnRemove(wxCommandEvent &event);
|
||||
void OnRename(wxCommandEvent &event);
|
||||
void OnExpand(wxCommandEvent &event);
|
||||
void OnShrink(wxCommandEvent &event);
|
||||
void OnSize(wxSizeEvent &event);
|
||||
|
||||
void OnCommandActivated(wxListEvent &event);
|
||||
@ -116,18 +127,15 @@ private:
|
||||
void InsertCommandAt(int item);
|
||||
bool SaveChanges();
|
||||
|
||||
// These are already provided by BatchProcessDialog
|
||||
// These are already provided by ApplyMacroDialog
|
||||
//wxListCtrl *mList; /// List of commands in current command chain.
|
||||
//BatchCommands mBatchCommands; /// Provides list of available commands.
|
||||
//wxListCtrl *mChains; /// List of chains.
|
||||
//MacroCommands mMacroCommands; /// Provides list of available commands.
|
||||
//wxListCtrl *mMacros; /// List of chains.
|
||||
|
||||
wxButton *mRemove;
|
||||
wxButton *mRename;
|
||||
wxButton *mDefaults;
|
||||
|
||||
|
||||
wxString mActiveChain;
|
||||
|
||||
int mSelectedCommand;
|
||||
bool mChanged;
|
||||
|
||||
|
@ -190,9 +190,9 @@ wxString FileNames::HtmlHelpDir()
|
||||
#endif
|
||||
}
|
||||
|
||||
wxString FileNames::ChainDir()
|
||||
wxString FileNames::MacroDir()
|
||||
{
|
||||
return FileNames::MkDir( wxFileName( DataDir(), wxT("Chains") ).GetFullPath() );
|
||||
return FileNames::MkDir( wxFileName( DataDir(), wxT("Macros") ).GetFullPath() );
|
||||
}
|
||||
|
||||
wxString FileNames::NRPDir()
|
||||
|
@ -44,7 +44,7 @@ public:
|
||||
static wxString AutoSaveDir();
|
||||
static wxString HtmlHelpDir();
|
||||
static wxString HtmlHelpIndexFile(bool quick);
|
||||
static wxString ChainDir();
|
||||
static wxString MacroDir();
|
||||
static wxString NRPDir();
|
||||
static wxString NRPFile();
|
||||
static wxString PluginRegistry();
|
||||
|
107
src/Menus.cpp
107
src/Menus.cpp
@ -167,6 +167,10 @@ enum {
|
||||
|
||||
#include "commands/CommandContext.h"
|
||||
#include "commands/ScreenshotCommand.h"
|
||||
|
||||
#include "BatchCommands.h"
|
||||
|
||||
|
||||
//
|
||||
// Effects menu arrays
|
||||
//
|
||||
@ -396,15 +400,6 @@ void AudacityProject::CreateMenusAndCommands()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
c->BeginSubMenu(_("C&hains"));
|
||||
c->AddItem(wxT("ApplyChain"), _("Appl&y Chain..."), FN(OnApplyChain),
|
||||
AudioIONotBusyFlag,
|
||||
AudioIONotBusyFlag);
|
||||
c->AddItem(wxT("EditChains"), _("Edit C&hains..."), FN(OnEditChains));
|
||||
c->EndSubMenu();
|
||||
|
||||
c->AddSeparator();
|
||||
|
||||
c->AddItem(wxT("PageSetup"), _("Pa&ge Setup..."), FN(OnPageSetup),
|
||||
AudioIONotBusyFlag | TracksExistFlag,
|
||||
AudioIONotBusyFlag | TracksExistFlag);
|
||||
@ -1186,6 +1181,35 @@ void AudacityProject::CreateMenusAndCommands()
|
||||
|
||||
c->EndMenu();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Tools Menu
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
c->BeginMenu(_("&Tools"));
|
||||
|
||||
#ifdef EXPERIMENTAL_EFFECT_MANAGEMENT
|
||||
c->AddItem(wxT("ManageTools"), _("Add / Remove Plug-ins..."), FN(OnManageTools));
|
||||
//c->AddSeparator();
|
||||
#endif
|
||||
|
||||
//Not needed anymore as ManageMacros does both.
|
||||
//c->AddItem(wxT("ApplyMacro"), _("Appl&y Macro..."), FN(OnApplyMacro),
|
||||
// AudioIONotBusyFlag,
|
||||
// AudioIONotBusyFlag);
|
||||
c->AddItem(wxT("ManageMacros"), _("&Macros..."), FN(OnManageMacros));
|
||||
|
||||
c->AddSeparator();
|
||||
PopulateMacrosMenu( c, AudioIONotBusyFlag );
|
||||
c->AddSeparator();
|
||||
|
||||
PopulateEffectsMenu(c,
|
||||
EffectTypeTool,
|
||||
AudioIONotBusyFlag,
|
||||
AudioIONotBusyFlag);
|
||||
|
||||
c->EndMenu();
|
||||
|
||||
|
||||
#ifdef __WXMAC__
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// poor imitation of the Mac Windows Menu
|
||||
@ -1681,6 +1705,22 @@ void AudacityProject::CreateMenusAndCommands()
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
void AudacityProject::PopulateMacrosMenu( CommandManager* c, CommandFlag flags )
|
||||
{
|
||||
wxArrayString names = MacroCommands::GetNames();
|
||||
int i;
|
||||
|
||||
for (i = 0; i < (int)names.GetCount(); i++) {
|
||||
c->AddItem(wxString::Format("Macro%03i", i ), names[i], FN(OnApplyMacroDirectly),
|
||||
flags,
|
||||
flags);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// The effects come from a plug in list
|
||||
/// This code iterates through the list, adding effects into
|
||||
/// the menu.
|
||||
@ -4596,6 +4636,10 @@ void AudacityProject::OnManageAnalyzers(const CommandContext &WXUNUSED(context)
|
||||
OnManagePluginsMenu(EffectTypeAnalyze);
|
||||
}
|
||||
|
||||
void AudacityProject::OnManageTools(const CommandContext &WXUNUSED(context) )
|
||||
{
|
||||
OnManagePluginsMenu(EffectTypeTool);
|
||||
}
|
||||
|
||||
|
||||
void AudacityProject::OnStereoToMono(const CommandContext &context)
|
||||
@ -6811,6 +6855,38 @@ void AudacityProject::OnShowExtraMenus(const CommandContext &WXUNUSED(context) )
|
||||
RebuildAllMenuBars();
|
||||
}
|
||||
|
||||
void AudacityProject::OnApplyMacroDirectly(const CommandContext &context )
|
||||
{
|
||||
//wxLogDebug( "Macro was: %s", context.parameter);
|
||||
ApplyMacroDialog dlg(this);
|
||||
wxString Name = context.parameter;
|
||||
long item=0;
|
||||
// Take last three letters (of e.g. Macro007) and convert to a number.
|
||||
Name.Mid( Name.Length() - 3 ).ToLong( &item, 10 );
|
||||
dlg.ApplyMacroToProject( item, false );
|
||||
ModifyUndoMenuItems();
|
||||
}
|
||||
|
||||
void AudacityProject::OnApplyMacro(const CommandContext &WXUNUSED(context) )
|
||||
{
|
||||
const bool bExpanded = false;
|
||||
if (!mMacrosWindow)
|
||||
mMacrosWindow = safenew MacrosWindow(this, bExpanded);
|
||||
mMacrosWindow->Show();
|
||||
mMacrosWindow->Raise();
|
||||
mMacrosWindow->UpdateDisplay( bExpanded);
|
||||
}
|
||||
|
||||
void AudacityProject::OnManageMacros(const CommandContext &WXUNUSED(context) )
|
||||
{
|
||||
const bool bExpanded = true;
|
||||
if (!mMacrosWindow)
|
||||
mMacrosWindow = safenew MacrosWindow(this, bExpanded);
|
||||
mMacrosWindow->Show();
|
||||
mMacrosWindow->Raise();
|
||||
mMacrosWindow->UpdateDisplay( bExpanded);
|
||||
}
|
||||
|
||||
void AudacityProject::OnHistory(const CommandContext &WXUNUSED(context) )
|
||||
{
|
||||
if (!mHistoryWindow)
|
||||
@ -6819,7 +6895,6 @@ void AudacityProject::OnHistory(const CommandContext &WXUNUSED(context) )
|
||||
mHistoryWindow->Raise();
|
||||
mHistoryWindow->UpdateDisplay();
|
||||
}
|
||||
|
||||
void AudacityProject::OnKaraoke(const CommandContext &WXUNUSED(context) )
|
||||
{
|
||||
if (!mLyricsWindow)
|
||||
@ -8429,18 +8504,6 @@ void AudacityProject::OnToggleTypeToCreateLabel(const CommandContext &WXUNUSED(c
|
||||
ModifyAllProjectToolbarMenus();
|
||||
}
|
||||
|
||||
void AudacityProject::OnApplyChain(const CommandContext &WXUNUSED(context) )
|
||||
{
|
||||
BatchProcessDialog dlg(this);
|
||||
dlg.ShowModal();
|
||||
ModifyUndoMenuItems();
|
||||
}
|
||||
|
||||
void AudacityProject::OnEditChains(const CommandContext &WXUNUSED(context) )
|
||||
{
|
||||
EditChainsDialog dlg(this);
|
||||
dlg.ShowModal();
|
||||
}
|
||||
|
||||
void AudacityProject::OnRemoveTracks(const CommandContext &WXUNUSED(context) )
|
||||
{
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
private:
|
||||
void CreateMenusAndCommands();
|
||||
|
||||
void PopulateMacrosMenu( CommandManager* c, CommandFlag flags );
|
||||
void PopulateEffectsMenu(CommandManager *c, EffectType type,
|
||||
CommandFlag batchflags, CommandFlag realflags);
|
||||
void AddEffectMenuItems(CommandManager *c,
|
||||
@ -493,8 +493,9 @@ bool DoEffect(const PluginID & ID, const CommandContext & context, int flags);
|
||||
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 OnEditChains(const CommandContext &context );
|
||||
void OnApplyMacro(const CommandContext &context );
|
||||
void OnApplyMacroDirectly(const CommandContext &context );
|
||||
void OnManageMacros(const CommandContext &context );
|
||||
void OnStereoToMono(const CommandContext &context );
|
||||
void OnAudacityCommand(const CommandContext &context );
|
||||
void OnManagePluginsMenu(EffectType Type);
|
||||
@ -502,6 +503,7 @@ static void RebuildAllMenuBars();
|
||||
void OnManageGenerators(const CommandContext &context );
|
||||
void OnManageEffects(const CommandContext &context );
|
||||
void OnManageAnalyzers(const CommandContext &context );
|
||||
void OnManageTools(const CommandContext &context );
|
||||
|
||||
|
||||
|
||||
|
@ -1364,6 +1364,7 @@ void PluginDescriptor::SetImporterExtensions(const wxArrayString & extensions)
|
||||
#define KEY_EFFECTTYPE_ANALYZE wxT("Analyze")
|
||||
#define KEY_EFFECTTYPE_GENERATE wxT("Generate")
|
||||
#define KEY_EFFECTTYPE_PROCESS wxT("Process")
|
||||
#define KEY_EFFECTTYPE_TOOL wxT("Tool")
|
||||
#define KEY_EFFECTTYPE_HIDDEN wxT("Hidden")
|
||||
#define KEY_IMPORTERIDENT wxT("ImporterIdent")
|
||||
#define KEY_IMPORTERFILTER wxT("ImporterFilter")
|
||||
@ -2071,34 +2072,22 @@ void PluginManager::LoadGroup(wxFileConfig *pRegistry, PluginType type)
|
||||
{
|
||||
// Get the effect type and bypass group if not found
|
||||
if (!pRegistry->Read(KEY_EFFECTTYPE, &strVal))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strVal.IsSameAs(KEY_EFFECTTYPE_NONE))
|
||||
{
|
||||
plug.SetEffectType(EffectTypeNone);
|
||||
}
|
||||
else if (strVal.IsSameAs(KEY_EFFECTTYPE_ANALYZE))
|
||||
{
|
||||
plug.SetEffectType(EffectTypeAnalyze);
|
||||
}
|
||||
else if (strVal.IsSameAs(KEY_EFFECTTYPE_GENERATE))
|
||||
{
|
||||
plug.SetEffectType(EffectTypeGenerate);
|
||||
}
|
||||
else if (strVal.IsSameAs(KEY_EFFECTTYPE_PROCESS))
|
||||
{
|
||||
plug.SetEffectType(EffectTypeProcess);
|
||||
}
|
||||
else if (strVal.IsSameAs(KEY_EFFECTTYPE_TOOL))
|
||||
plug.SetEffectType(EffectTypeTool);
|
||||
else if (strVal.IsSameAs(KEY_EFFECTTYPE_HIDDEN))
|
||||
{
|
||||
plug.SetEffectType(EffectTypeHidden);
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get the effect family and bypass group if not found
|
||||
if (!pRegistry->Read(KEY_EFFECTFAMILY, &strVal))
|
||||
@ -2258,25 +2247,18 @@ void PluginManager::SaveGroup(wxFileConfig *pRegistry, PluginType type)
|
||||
EffectType etype = plug.GetEffectType();
|
||||
wxString stype;
|
||||
if (etype == EffectTypeNone)
|
||||
{
|
||||
stype = KEY_EFFECTTYPE_NONE;
|
||||
}
|
||||
else if (etype == EffectTypeAnalyze)
|
||||
{
|
||||
stype = KEY_EFFECTTYPE_ANALYZE;
|
||||
}
|
||||
else if (etype == EffectTypeGenerate)
|
||||
{
|
||||
stype = KEY_EFFECTTYPE_GENERATE;
|
||||
}
|
||||
else if (etype == EffectTypeProcess)
|
||||
{
|
||||
stype = KEY_EFFECTTYPE_PROCESS;
|
||||
}
|
||||
else if (etype == EffectTypeTool)
|
||||
stype = KEY_EFFECTTYPE_TOOL;
|
||||
else if (etype == EffectTypeHidden)
|
||||
{
|
||||
stype = KEY_EFFECTTYPE_HIDDEN;
|
||||
}
|
||||
|
||||
pRegistry->Write(KEY_EFFECTTYPE, stype);
|
||||
pRegistry->Write(KEY_EFFECTFAMILY, plug.GetEffectFamilyId());
|
||||
pRegistry->Write(KEY_EFFECTDEFAULT, plug.IsEffectDefault());
|
||||
|
@ -86,6 +86,7 @@ class TranscriptionToolBar;
|
||||
// windows and frames
|
||||
class AdornedRulerPanel;
|
||||
class HistoryWindow;
|
||||
class MacrosWindow;
|
||||
class LyricsWindow;
|
||||
class MixerBoard;
|
||||
class MixerBoardFrame;
|
||||
@ -679,6 +680,7 @@ private:
|
||||
bool mActive{ true };
|
||||
bool mIconized;
|
||||
|
||||
MacrosWindow *mMacrosWindow{};
|
||||
HistoryWindow *mHistoryWindow{};
|
||||
LyricsWindow* mLyricsWindow{};
|
||||
MixerBoardFrame* mMixerBoardFrame{};
|
||||
|
@ -993,6 +993,15 @@ void ShuttleGuiBase::StartVerticalLay(int iProp)
|
||||
UpdateSizers();
|
||||
}
|
||||
|
||||
void ShuttleGuiBase::StartVerticalLay(int PositionFlags, int iProp)
|
||||
{
|
||||
if( mShuttleMode != eIsCreating )
|
||||
return;
|
||||
miSizerProp=iProp;
|
||||
mpSubSizer = std::make_unique<wxBoxSizer>( wxVERTICAL );
|
||||
UpdateSizersCore( false, PositionFlags | wxALL );
|
||||
}
|
||||
|
||||
void ShuttleGuiBase::EndVerticalLay()
|
||||
{
|
||||
if( mShuttleMode != eIsCreating )
|
||||
|
@ -119,6 +119,8 @@ public:
|
||||
void StartHorizontalLay(int PositionFlags=wxALIGN_CENTRE, int iProp=1);
|
||||
void EndHorizontalLay();
|
||||
void StartVerticalLay(int iProp=1);
|
||||
void StartVerticalLay(int PositionFlags, int iProp);
|
||||
|
||||
void EndVerticalLay();
|
||||
wxScrolledWindow * StartScroller(int iStyle=0);
|
||||
void EndScroller();
|
||||
|
@ -225,7 +225,7 @@ bool AudacityCommand::DoAudacityCommand(wxWindow *parent,
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
// This is used from Chains.
|
||||
// This is used from Macros.
|
||||
bool AudacityCommand::PromptUser(wxWindow *parent)
|
||||
{
|
||||
return ShowInterface(parent, IsBatchProcessing());
|
||||
|
@ -28,8 +28,8 @@ void BatchEvalCommandType::BuildSignature(CommandSignature &signature)
|
||||
signature.AddParameter(wxT("CommandName"), wxT(""), std::move(commandNameValidator));
|
||||
auto paramValidator = make_movable<DefaultValidator>();
|
||||
signature.AddParameter(wxT("ParamString"), wxT(""), std::move(paramValidator));
|
||||
auto chainValidator = make_movable<DefaultValidator>();
|
||||
signature.AddParameter(wxT("ChainName"), wxT(""), std::move(chainValidator));
|
||||
auto macroValidator = make_movable<DefaultValidator>();
|
||||
signature.AddParameter(wxT("MacroName"), wxT(""), std::move(macroValidator));
|
||||
}
|
||||
|
||||
OldStyleCommandPointer BatchEvalCommandType::Create(std::unique_ptr<CommandOutputTargets> && WXUNUSED(target))
|
||||
@ -40,19 +40,19 @@ OldStyleCommandPointer BatchEvalCommandType::Create(std::unique_ptr<CommandOutpu
|
||||
bool BatchEvalCommand::Apply(const CommandContext & context)
|
||||
{
|
||||
|
||||
wxString chainName = GetString(wxT("ChainName"));
|
||||
if (chainName != wxT(""))
|
||||
wxString macroName = GetString(wxT("MacroName"));
|
||||
if (macroName != wxT(""))
|
||||
{
|
||||
BatchCommands batch;
|
||||
batch.ReadChain(chainName);
|
||||
return batch.ApplyChain();
|
||||
MacroCommands batch;
|
||||
batch.ReadMacro(macroName);
|
||||
return batch.ApplyMacro();
|
||||
}
|
||||
|
||||
wxString cmdName = GetString(wxT("CommandName"));
|
||||
wxString cmdParams = GetString(wxT("ParamString"));
|
||||
|
||||
// Create a Batch that will have just one command in it...
|
||||
BatchCommands Batch;
|
||||
MacroCommands Batch;
|
||||
bool bResult = Batch.ApplyCommand(cmdName, cmdParams, &context);
|
||||
// Relay messages, if any.
|
||||
wxString Message = Batch.GetMessage();
|
||||
|
@ -10,10 +10,10 @@
|
||||
******************************************************************//**
|
||||
|
||||
\class BatchEvalCommand
|
||||
\brief Given a string representing a command, pass it to the BatchCommands
|
||||
\brief Given a string representing a command, pass it to the MacroCommands
|
||||
system.
|
||||
|
||||
The eventual aim is to move the code from BatchCommands out into separate
|
||||
The eventual aim is to move the code from MacroCommands out into separate
|
||||
command classes, but until this happens, BatchEvalCommand can act as a 'bridge'
|
||||
to that system.
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
ApplyAndSendResponse, and CommandImplementation classes. These are
|
||||
remnants of Dan Horgans external scripting commands. We now use
|
||||
AudacityCommand and a shuttle system. This allows commands to be used
|
||||
from within chains too, to have settings dialogs, using ShuttleGui and
|
||||
from within macros too, to have settings dialogs, using ShuttleGui and
|
||||
without need for validators.
|
||||
|
||||
Here's the doxygen for the still-remaining going-away classes.
|
||||
@ -36,8 +36,8 @@ We in effect merge the <something>CommandType classes into the
|
||||
<something>Command classes.
|
||||
|
||||
\class BatchEvalCommand
|
||||
\brief Command to make processing of chains available to scripting. It can either
|
||||
make a one command chain, or invoke an existing chain. It will become redundant
|
||||
\brief Command to make processing of macros available to scripting. It can either
|
||||
make a one command macro, or invoke an existing macro. It will become redundant
|
||||
when menu commands are integrated into scripting.
|
||||
|
||||
\class HelpCommand
|
||||
|
@ -2720,7 +2720,7 @@ void EffectDialog::Init()
|
||||
PopulateOrExchange(S);
|
||||
|
||||
long buttons = eOkButton;
|
||||
if (mType != EffectTypeAnalyze)
|
||||
if ((mType != EffectTypeAnalyze) && (mType != EffectTypeTool))
|
||||
{
|
||||
buttons |= eCancelButton;
|
||||
if (mType == EffectTypeProcess)
|
||||
@ -3087,7 +3087,10 @@ bool EffectUIHost::Initialize()
|
||||
mPlayToggleBtn->SetToolTip(_("Start and stop playback"));
|
||||
bs->Add(mPlayToggleBtn, 0, wxALIGN_CENTER | wxTOP | wxBOTTOM, margin);
|
||||
}
|
||||
else if (mEffect && mEffect->GetType() != EffectTypeAnalyze)
|
||||
else if (mEffect &&
|
||||
(mEffect->GetType() != EffectTypeAnalyze) &&
|
||||
(mEffect->GetType() != EffectTypeTool)
|
||||
)
|
||||
{
|
||||
wxASSERT(bar); // To justify safenew
|
||||
mPlayToggleBtn = safenew wxButton(bar, kPlayID, _("&Preview"));
|
||||
@ -3835,7 +3838,7 @@ void EffectUIHost::UpdateControls()
|
||||
}
|
||||
|
||||
mApplyBtn->Enable(!mCapturing);
|
||||
if (mEffect && mEffect->GetType() != EffectTypeAnalyze)
|
||||
if (mEffect && (mEffect->GetType() != EffectTypeAnalyze) && (mEffect->GetType() != EffectTypeTool) )
|
||||
{
|
||||
(!mIsGUI ? mPlayToggleBtn : mPlayBtn)->Enable(!(mCapturing || mDisableTransport));
|
||||
}
|
||||
|
@ -1234,7 +1234,7 @@ EffectType VSTEffect::GetType()
|
||||
{
|
||||
if (mAudioIns == 0 && mAudioOuts == 0 && mMidiIns == 0 && mMidiOuts == 0)
|
||||
{
|
||||
return EffectTypeNone;
|
||||
return EffectTypeTool;
|
||||
}
|
||||
|
||||
if (mAudioIns == 0 && mMidiIns == 0)
|
||||
|
@ -652,7 +652,7 @@ EffectType LadspaEffect::GetType()
|
||||
{
|
||||
if (mAudioIns == 0 && mAudioOuts == 0)
|
||||
{
|
||||
return EffectTypeNone;
|
||||
return EffectTypeTool;
|
||||
}
|
||||
|
||||
if (mAudioIns == 0)
|
||||
|
@ -370,7 +370,7 @@ EffectType LV2Effect::GetType()
|
||||
{
|
||||
if (GetAudioInCount() == 0 && GetAudioOutCount() == 0)
|
||||
{
|
||||
return EffectTypeNone;
|
||||
return EffectTypeTool;
|
||||
}
|
||||
|
||||
if (GetAudioInCount() == 0)
|
||||
|
@ -186,6 +186,12 @@ bool NyquistEffectsModule::AutoRegisterPlugins(PluginManagerInterface & pm)
|
||||
DiscoverPluginsAtPath(NYQUIST_PROMPT_ID, ignoredErrMsg,
|
||||
PluginManagerInterface::DefaultRegistrationCallback);
|
||||
}
|
||||
if (!pm.IsPluginRegistered(NYQUIST_TOOLS_PROMPT_ID))
|
||||
{
|
||||
// No checking of error ?
|
||||
DiscoverPluginsAtPath(NYQUIST_TOOLS_PROMPT_ID, ignoredErrMsg,
|
||||
PluginManagerInterface::DefaultRegistrationCallback);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < WXSIZEOF(kShippedEffects); i++)
|
||||
{
|
||||
@ -213,6 +219,7 @@ wxArrayString NyquistEffectsModule::FindPluginPaths(PluginManagerInterface & pm)
|
||||
|
||||
// Add the Nyquist prompt effect
|
||||
files.Add(NYQUIST_PROMPT_ID);
|
||||
files.Add(NYQUIST_TOOLS_PROMPT_ID);
|
||||
|
||||
// Load .ny plug-ins
|
||||
pm.FindFilesInPathList(wxT("*.ny"), pathList, files);
|
||||
@ -244,10 +251,8 @@ bool NyquistEffectsModule::IsPluginValid(const wxString & path, bool bFast)
|
||||
// Ignores bFast parameter, since checking file exists is fast enough for
|
||||
// the small number of Nyquist plug-ins that we have.
|
||||
bFast;
|
||||
if (path == NYQUIST_PROMPT_ID)
|
||||
{
|
||||
if((path == NYQUIST_PROMPT_ID) || (path == NYQUIST_TOOLS_PROMPT_ID))
|
||||
return true;
|
||||
}
|
||||
|
||||
return wxFileName::FileExists(path);
|
||||
}
|
||||
|
@ -152,7 +152,15 @@ NyquistEffect::NyquistEffect(const wxString &fName)
|
||||
mType = EffectTypeProcess;
|
||||
mOK = true;
|
||||
mIsPrompt = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// Interactive Nyquist
|
||||
if (fName == NYQUIST_TOOLS_PROMPT_ID) {
|
||||
mName = XO("Nyquist Tools Prompt");
|
||||
mType = EffectTypeTool;
|
||||
mOK = true;
|
||||
mIsPrompt = true;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -181,9 +189,9 @@ NyquistEffect::~NyquistEffect()
|
||||
wxString NyquistEffect::GetPath()
|
||||
{
|
||||
if (mIsPrompt)
|
||||
{
|
||||
return NYQUIST_PROMPT_ID;
|
||||
}
|
||||
return (mType == EffectTypeTool) ?
|
||||
NYQUIST_TOOLS_PROMPT_ID :
|
||||
NYQUIST_PROMPT_ID;
|
||||
|
||||
return mFileName.GetFullPath();
|
||||
}
|
||||
@ -191,9 +199,9 @@ wxString NyquistEffect::GetPath()
|
||||
wxString NyquistEffect::GetSymbol()
|
||||
{
|
||||
if (mIsPrompt)
|
||||
{
|
||||
return XO("Nyquist Prompt");
|
||||
}
|
||||
return (mType == EffectTypeTool) ?
|
||||
XO("Nyquist Tools Prompt") :
|
||||
XO("Nyquist Prompt");
|
||||
|
||||
return mName;
|
||||
}
|
||||
@ -1664,6 +1672,9 @@ bool NyquistEffect::Parse(
|
||||
else if (tokens[1] == wxT("analyze")) {
|
||||
mType = EffectTypeAnalyze;
|
||||
}
|
||||
else if (tokens[1] == wxT("tool")) {
|
||||
mType = EffectTypeTool;
|
||||
}
|
||||
if (len >= 3 && tokens[2] == wxT("spectral")) {;
|
||||
mIsSpectral = true;
|
||||
}
|
||||
|
@ -31,6 +31,7 @@
|
||||
#define NYQUISTEFFECTS_FAMILY wxT("Nyquist")
|
||||
|
||||
#define NYQUIST_PROMPT_ID wxT("Nyquist Prompt")
|
||||
#define NYQUIST_TOOLS_PROMPT_ID wxT("Nyquist Tools Prompt")
|
||||
#define NYQUIST_WORKER_ID wxT("Nyquist Worker")
|
||||
|
||||
enum NyqControlType
|
||||
@ -206,7 +207,7 @@ private:
|
||||
bool mExternal;
|
||||
bool mIsSpectral;
|
||||
/** True if the code to execute is obtained interactively from the user via
|
||||
* the "Nyquist Prompt", false for all other effects (lisp code read from
|
||||
* the "Nyquist Prompt", or "Nyquist Tools Prompt", false for all other effects (lisp code read from
|
||||
* files)
|
||||
*/
|
||||
bool mIsPrompt;
|
||||
|
@ -10,7 +10,7 @@
|
||||
*******************************************************************//**
|
||||
|
||||
\class BatchPrefs
|
||||
\brief A PrefsPanel that builds up a chain of effects in BatchCommands
|
||||
\brief A PrefsPanel that builds up a chain of effects in MacroCommands
|
||||
|
||||
*//*******************************************************************/
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user