mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-31 07:59:27 +02:00
Clean up some issues with Effect abstract classes, primarily that the progress dialog had Stop and Cancel buttons that produced exactly the same results, i.e., Cancel, so I removed the Stop button.
This commit is contained in:
parent
b451649e1b
commit
c31e01e980
@ -26,7 +26,6 @@ greater use in future.
|
|||||||
#include <wx/defs.h>
|
#include <wx/defs.h>
|
||||||
#include <wx/string.h>
|
#include <wx/string.h>
|
||||||
#include <wx/msgdlg.h>
|
#include <wx/msgdlg.h>
|
||||||
#include <wx/progdlg.h>
|
|
||||||
#include <wx/sizer.h>
|
#include <wx/sizer.h>
|
||||||
#include <wx/timer.h>
|
#include <wx/timer.h>
|
||||||
#include <wx/hashmap.h>
|
#include <wx/hashmap.h>
|
||||||
@ -140,7 +139,8 @@ bool Effect::DoEffect(wxWindow *parent, int flags,
|
|||||||
bool skipFlag = CheckWhetherSkipEffect();
|
bool skipFlag = CheckWhetherSkipEffect();
|
||||||
if (skipFlag == false) {
|
if (skipFlag == false) {
|
||||||
mProgress = new ProgressDialog(StripAmpersand(GetEffectName()),
|
mProgress = new ProgressDialog(StripAmpersand(GetEffectName()),
|
||||||
GetEffectAction());
|
GetEffectAction(),
|
||||||
|
pdlgHideStopButton);
|
||||||
returnVal = Process();
|
returnVal = Process();
|
||||||
delete mProgress;
|
delete mProgress;
|
||||||
}
|
}
|
||||||
@ -163,25 +163,19 @@ bool Effect::DoEffect(wxWindow *parent, int flags,
|
|||||||
bool Effect::TotalProgress(double frac)
|
bool Effect::TotalProgress(double frac)
|
||||||
{
|
{
|
||||||
int updateResult = mProgress->Update(frac);
|
int updateResult = mProgress->Update(frac);
|
||||||
if (updateResult == eProgressSuccess)
|
return (updateResult != eProgressSuccess);
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Effect::TrackProgress(int whichTrack, double frac)
|
bool Effect::TrackProgress(int whichTrack, double frac)
|
||||||
{
|
{
|
||||||
int updateResult = mProgress->Update(whichTrack + frac, (double) mNumTracks);
|
int updateResult = mProgress->Update(whichTrack + frac, (double) mNumTracks);
|
||||||
if (updateResult == eProgressSuccess)
|
return (updateResult != eProgressSuccess);
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Effect::TrackGroupProgress(int whichGroup, double frac)
|
bool Effect::TrackGroupProgress(int whichGroup, double frac)
|
||||||
{
|
{
|
||||||
int updateResult = mProgress->Update(whichGroup + frac, (double) mNumGroups);
|
int updateResult = mProgress->Update(whichGroup + frac, (double) mNumGroups);
|
||||||
if (updateResult == eProgressSuccess)
|
return (updateResult != eProgressSuccess);
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Effect::GetSamples(WaveTrack *track, sampleCount *start, sampleCount *len)
|
void Effect::GetSamples(WaveTrack *track, sampleCount *start, sampleCount *len)
|
||||||
@ -472,7 +466,8 @@ void Effect::Preview()
|
|||||||
// again, so the state is exactly the way it was before Preview
|
// again, so the state is exactly the way it was before Preview
|
||||||
// was called.
|
// was called.
|
||||||
mProgress = new ProgressDialog(StripAmpersand(GetEffectName()),
|
mProgress = new ProgressDialog(StripAmpersand(GetEffectName()),
|
||||||
_("Preparing preview"));
|
_("Preparing preview"),
|
||||||
|
pdlgHideCancelButton); // Have only "Stop" button.
|
||||||
bool bSuccess = Process();
|
bool bSuccess = Process();
|
||||||
delete mProgress;
|
delete mProgress;
|
||||||
End();
|
End();
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
#include <wx/button.h>
|
|
||||||
#include <wx/dynarray.h>
|
#include <wx/dynarray.h>
|
||||||
#include <wx/intl.h>
|
#include <wx/intl.h>
|
||||||
#include <wx/string.h>
|
#include <wx/string.h>
|
||||||
@ -135,6 +134,10 @@ class AUDACITY_DLL_API Effect {
|
|||||||
|
|
||||||
wxString GetPreviewName();
|
wxString GetPreviewName();
|
||||||
|
|
||||||
|
//ANSWER-ME: Isn't this pointless?
|
||||||
|
// None of the built-in functions has an ampersand in the result of
|
||||||
|
// GetEffectName(), the only strings on which this method is used.
|
||||||
|
// In fact, the example 'E&qualizer' does not exist in the code!
|
||||||
// Strip ampersand ('&' char) from string. This effectively removes the
|
// Strip ampersand ('&' char) from string. This effectively removes the
|
||||||
// shortcut from the string ('E&qualizer' becomes 'Equalizer'). This is
|
// shortcut from the string ('E&qualizer' becomes 'Equalizer'). This is
|
||||||
// important for sorting.
|
// important for sorting.
|
||||||
@ -147,11 +150,10 @@ class AUDACITY_DLL_API Effect {
|
|||||||
// do its processing.
|
// do its processing.
|
||||||
//
|
//
|
||||||
protected:
|
protected:
|
||||||
// The constructor. Called once at the beginning of the program.
|
// The constructor is called once by each subclass at the beginning of the program.
|
||||||
// Avoid allocating memory or doing time-consuming processing here.
|
// Avoid allocating memory or doing time-consuming processing here.
|
||||||
Effect();
|
Effect();
|
||||||
|
|
||||||
//The destructor.
|
|
||||||
virtual ~Effect();
|
virtual ~Effect();
|
||||||
|
|
||||||
// Called once each time an effect is called. Perform any initialization;
|
// Called once each time an effect is called. Perform any initialization;
|
||||||
|
@ -62,7 +62,7 @@ void EffectManager::RegisterEffect(Effect *f, int NewFlags)
|
|||||||
int i;
|
int i;
|
||||||
for(i=0; i<len; i++)
|
for(i=0; i<len; i++)
|
||||||
if (name.CmpNoCase(Effect::StripAmpersand(mEffects[i]->GetEffectName())) < 0) {
|
if (name.CmpNoCase(Effect::StripAmpersand(mEffects[i]->GetEffectName())) < 0) {
|
||||||
mEffects.Insert(f, i);
|
mEffects.Insert(f, i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (i==len)
|
if (i==len)
|
||||||
|
@ -46,9 +46,9 @@ bool Generator::Process()
|
|||||||
//if we can't move clips, and we're generating into an empty space,
|
//if we can't move clips, and we're generating into an empty space,
|
||||||
//make sure there's room.
|
//make sure there's room.
|
||||||
if (!editClipCanMove &&
|
if (!editClipCanMove &&
|
||||||
track->IsEmpty(mT0, mT1+1.0/track->GetRate()) &&
|
track->IsEmpty(mT0, mT1+1.0/track->GetRate()) &&
|
||||||
!track->IsEmpty(mT0, mT0+mDuration-(mT1-mT0)-1.0/track->GetRate()))
|
!track->IsEmpty(mT0, mT0+mDuration-(mT1-mT0)-1.0/track->GetRate()))
|
||||||
{
|
{
|
||||||
wxMessageBox(
|
wxMessageBox(
|
||||||
_("There is not enough room available to generate the audio"),
|
_("There is not enough room available to generate the audio"),
|
||||||
_("Error"), wxICON_STOP);
|
_("Error"), wxICON_STOP);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user