Update of /cvsroot/audacity/audacity-src/src
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv11223
Modified Files:
BatchCommandDialog.cpp BatchCommands.cpp BatchCommands.h
Log Message:
Refactor Effect retrieval from BatchCommands to... EffectManager. (Yes, I have
ulterior reasons for bothering with this, but it is better OOP.)
Index: BatchCommands.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/BatchCommands.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- BatchCommands.cpp 4 Jun 2008 19:10:42 -0000 1.31
+++ BatchCommands.cpp 7 Nov 2008 10:01:05 -0000 1.32
@@ -292,29 +292,9 @@
}
-Effect * BatchCommands::GetEffectFromCommandName(wxString inCommand)
-{
- unsigned int i;
- wxString command;
- Effect * f;
- EffectArray * effects = EffectManager::Get().GetEffects( ALL_EFFECTS );
- for(i=0; i<effects->GetCount(); i++) {
- f = (*effects)[i];
- command=f->GetEffectIdentifier();
- if( command.IsSameAs( inCommand ))
- {
- delete effects;
- return f;
- }
- }
- delete effects;
- return NULL;
-}
-
wxString BatchCommands::GetCurrentParamsFor(wxString command)
{
- Effect * f;
- f=GetEffectFromCommandName( command );
+ Effect * f = EffectManager::Get().GetEffectByIdentifier( command );
if( f==NULL )
return wxT("");// effect not found.
ShuttleCli shuttle;
@@ -328,8 +308,7 @@
bool BatchCommands::PromptForParamsFor(wxString command)
{
- Effect * f;
- f=GetEffectFromCommandName( command );
+ Effect * f = EffectManager::Get().GetEffectByIdentifier(command);
if( f==NULL )
return false;
@@ -470,7 +449,7 @@
return WriteMp3File(filename, 56);
} else if (command == wxT("StereoToMono")) {
// StereoToMono is an effect masquerading as a menu item.
- Effect * f = GetEffectFromCommandName(wxT("StereoToMono"));
+ Effect * f =
EffectManager::Get().GetEffectByIdentifier(wxT("StereoToMono"));
if (f != NULL) {
return ApplyEffectCommand(f, command, params);
}
@@ -572,8 +551,7 @@
}
// Test for an effect.
- Effect * f;
- f=GetEffectFromCommandName( command );
+ Effect * f = EffectManager::Get().GetEffectByIdentifier( command );
if( f!=NULL )
return ApplyEffectCommand( f, command, params );
Index: BatchCommandDialog.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/BatchCommandDialog.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- BatchCommandDialog.cpp 5 Oct 2008 15:17:03 -0000 1.13
+++ BatchCommandDialog.cpp 7 Nov 2008 10:01:05 -0000 1.14
@@ -38,7 +38,7 @@
#include "Project.h"
#include "BatchCommandDialog.h"
#include "commands/CommandManager.h"
-#include "effects/Effect.h"
+#include "effects/EffectManager.h"
#include "BatchCommands.h"
#include "ShuttleGui.h"
@@ -169,7 +169,7 @@
mCommand->SetValue( command );
wxString params = BatchCommands::GetCurrentParamsFor( command );
mParameters->SetValue( params );
- Effect * f = BatchCommands::GetEffectFromCommandName( command );
+ Effect * f = EffectManager::Get().GetEffectByIdentifier( command );
mEditParams->Enable( f != NULL );
}
@@ -177,7 +177,7 @@
{
wxString command = mCommand->GetValue();
wxString params = mParameters->GetValue();
- Effect * f = BatchCommands::GetEffectFromCommandName( command );
+ Effect * f = EffectManager::Get().GetEffectByIdentifier( command );
if( f==NULL )
return;
BatchCommands::SetCurrentParametersFor( f, command, params );
Index: BatchCommands.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/BatchCommands.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- BatchCommands.h 7 May 2007 21:05:06 -0000 1.9
+++ BatchCommands.h 7 Nov 2008 10:01:05 -0000 1.10
@@ -41,7 +41,6 @@
// These commands do not depend on the command list.
wxArrayString GetNames();
static bool PromptForParamsFor( wxString command );
- static Effect * GetEffectFromCommandName( wxString command );
static wxString GetCurrentParamsFor( wxString command );
static bool SetCurrentParametersFor( Effect * f, const wxString command,
const wxString params);
static wxArrayString GetAllCommands();
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs