bool Effect::TotalProgress(double frac) { if (!mProgress && wxGetElapsedTime(false) > 500) { mProgress = new wxProgressDialog(GetEffectName(), GetEffectAction(), 1000, mParent, wxPD_CAN_ABORT | wxPD_REMAINING_TIME | wxPD_AUTO_HIDE); } bool cancelling = false; if (mProgress) { cancelling = !mProgress->Update((int)(frac*1000 + 0.5)); } return cancelling; }
bool Effect::DoEffect(wxWindow *parent, int flags, double projectRate, TrackList *list, TrackFactory *factory, double *t0, double *t1, wxString params) { wxASSERT(*t0 <= *t1); if (mOutputTracks) { delete mOutputTracks; mOutputTracks = NULL; } mFactory = factory; mProjectRate = projectRate; mParent = parent; mTracks = list; mT0 = *t0; mT1 = *t1; CountWaveTracks(); // Note: Init may read parameters from preferences if (!Init()) return false; // If a parameter string was provided, it overrides any remembered settings // (but if the user is to be prompted, that takes priority) if (!params.IsEmpty()) { ShuttleCli shuttle; shuttle.mParams = params; shuttle.mbStoreInClient=true; if( !TransferParameters( shuttle )) { wxMessageBox( wxString::Format( _("Could not set parameters of effect %s\n to %s."), GetEffectName().c_str(), params.c_str() ) ); return false; } } // Don't prompt user if we are dealing with a // effect that is already configured, e.g. repeating // the last effect on a different selection. if( (flags & CONFIGURED_EFFECT) == 0) { if (!PromptUser()) return false; } bool returnVal = true; bool skipFlag = CheckWhetherSkipEffect(); if (skipFlag == false) { mProgress = new ProgressDialog(StripAmpersand(GetEffectName()), GetEffectAction(), pdlgHideStopButton); returnVal = Process(); delete mProgress; } End(); if (mOutputTracks) { delete mOutputTracks; mOutputTracks = NULL; } if (returnVal) { *t0 = mT0; *t1 = mT1; } return returnVal; }