mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-29 23:19:28 +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/string.h>
|
||||
#include <wx/msgdlg.h>
|
||||
#include <wx/progdlg.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/timer.h>
|
||||
#include <wx/hashmap.h>
|
||||
@ -140,7 +139,8 @@ bool Effect::DoEffect(wxWindow *parent, int flags,
|
||||
bool skipFlag = CheckWhetherSkipEffect();
|
||||
if (skipFlag == false) {
|
||||
mProgress = new ProgressDialog(StripAmpersand(GetEffectName()),
|
||||
GetEffectAction());
|
||||
GetEffectAction(),
|
||||
pdlgHideStopButton);
|
||||
returnVal = Process();
|
||||
delete mProgress;
|
||||
}
|
||||
@ -163,25 +163,19 @@ bool Effect::DoEffect(wxWindow *parent, int flags,
|
||||
bool Effect::TotalProgress(double frac)
|
||||
{
|
||||
int updateResult = mProgress->Update(frac);
|
||||
if (updateResult == eProgressSuccess)
|
||||
return false;
|
||||
return true;
|
||||
return (updateResult != eProgressSuccess);
|
||||
}
|
||||
|
||||
bool Effect::TrackProgress(int whichTrack, double frac)
|
||||
{
|
||||
int updateResult = mProgress->Update(whichTrack + frac, (double) mNumTracks);
|
||||
if (updateResult == eProgressSuccess)
|
||||
return false;
|
||||
return true;
|
||||
return (updateResult != eProgressSuccess);
|
||||
}
|
||||
|
||||
bool Effect::TrackGroupProgress(int whichGroup, double frac)
|
||||
{
|
||||
int updateResult = mProgress->Update(whichGroup + frac, (double) mNumGroups);
|
||||
if (updateResult == eProgressSuccess)
|
||||
return false;
|
||||
return true;
|
||||
return (updateResult != eProgressSuccess);
|
||||
}
|
||||
|
||||
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
|
||||
// was called.
|
||||
mProgress = new ProgressDialog(StripAmpersand(GetEffectName()),
|
||||
_("Preparing preview"));
|
||||
_("Preparing preview"),
|
||||
pdlgHideCancelButton); // Have only "Stop" button.
|
||||
bool bSuccess = Process();
|
||||
delete mProgress;
|
||||
End();
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
#include <set>
|
||||
|
||||
#include <wx/button.h>
|
||||
#include <wx/dynarray.h>
|
||||
#include <wx/intl.h>
|
||||
#include <wx/string.h>
|
||||
@ -135,6 +134,10 @@ class AUDACITY_DLL_API Effect {
|
||||
|
||||
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
|
||||
// shortcut from the string ('E&qualizer' becomes 'Equalizer'). This is
|
||||
// important for sorting.
|
||||
@ -147,11 +150,10 @@ class AUDACITY_DLL_API Effect {
|
||||
// do its processing.
|
||||
//
|
||||
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.
|
||||
Effect();
|
||||
|
||||
//The destructor.
|
||||
virtual ~Effect();
|
||||
|
||||
// Called once each time an effect is called. Perform any initialization;
|
||||
|
@ -62,7 +62,7 @@ void EffectManager::RegisterEffect(Effect *f, int NewFlags)
|
||||
int i;
|
||||
for(i=0; i<len; i++)
|
||||
if (name.CmpNoCase(Effect::StripAmpersand(mEffects[i]->GetEffectName())) < 0) {
|
||||
mEffects.Insert(f, i);
|
||||
mEffects.Insert(f, i);
|
||||
break;
|
||||
}
|
||||
if (i==len)
|
||||
|
@ -46,9 +46,9 @@ bool Generator::Process()
|
||||
//if we can't move clips, and we're generating into an empty space,
|
||||
//make sure there's room.
|
||||
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()))
|
||||
{
|
||||
{
|
||||
wxMessageBox(
|
||||
_("There is not enough room available to generate the audio"),
|
||||
_("Error"), wxICON_STOP);
|
||||
|
Loading…
x
Reference in New Issue
Block a user