Update of /cvsroot/audacity/audacity-src/src In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv23263/src
Modified Files: Dependencies.cpp Mix.cpp TimerRecordDialog.cpp TimerRecordDialog.h UploadDialog.cpp WaveClip.cpp Log Message: Added eProgress* enum that indicates ProgressDialog->Update() status. Removed eImport* enum. Using new eProgress* instead. Changed all ProgressDialog users to new semantics. Added additional ProgressDialog constructor argument - flags, which allows caller to hide Stop and/or Cancel buttons. FFmpeg importer: another tweak for progress inticator, intended for streams where progress information is not available at some frames. Index: TimerRecordDialog.h =================================================================== RCS file: /cvsroot/audacity/audacity-src/src/TimerRecordDialog.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- TimerRecordDialog.h 24 Dec 2008 00:21:37 -0000 1.2 +++ TimerRecordDialog.h 2 Feb 2009 17:11:04 -0000 1.3 @@ -48,7 +48,7 @@ bool TransferDataFromWindow(); void UpdateDuration(); // Update m_TimeSpan_Duration and ctrl based on m_DateTime_Start and m_DateTime_End. void UpdateEnd(); // Update m_DateTime_End and ctrls based on m_DateTime_Start and m_TimeSpan_Duration. - bool WaitForStart(); + int WaitForStart(); private: wxDateTime m_DateTime_Start; Index: UploadDialog.cpp =================================================================== RCS file: /cvsroot/audacity/audacity-src/src/UploadDialog.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- UploadDialog.cpp 5 Oct 2008 14:43:59 -0000 1.21 +++ UploadDialog.cpp 2 Feb 2009 17:11:04 -0000 1.22 @@ -897,8 +897,9 @@ out->Write(chunk, size); } } - - if (!mProgress->Update(count, iterations, src)) + + int updateResult = mProgress->Update(count, iterations, src); + if (updateResult != eProgressSuccess) { //wxMessageBox("ABORT", _T("FTP Status"), wxOK | wxICON_INFORMATION, NULL); Index: Mix.cpp =================================================================== RCS file: /cvsroot/audacity/audacity-src/src/Mix.cpp,v retrieving revision 1.71 retrieving revision 1.72 diff -u -d -r1.71 -r1.72 --- Mix.cpp 12 Jul 2008 15:25:39 -0000 1.71 +++ Mix.cpp 2 Feb 2009 17:11:04 -0000 1.72 @@ -121,8 +121,8 @@ ProgressDialog *progress = new ProgressDialog(_NoAcc("&Mix and Render"), _("Mixing and rendering tracks")); - bool bCancel = false; - while(!bCancel) { + int updateResult = eProgressSuccess; + while(updateResult == eProgressSuccess) { sampleCount blockLen = mixer->Process(maxBlockLen); if (blockLen == 0) @@ -140,7 +140,7 @@ mixRight->Append(buffer, format, blockLen); } - bCancel = !progress->Update(mixer->MixGetCurrentTime(), totalTime); + updateResult = progress->Update(mixer->MixGetCurrentTime(), totalTime); } delete progress; @@ -148,7 +148,7 @@ mixLeft->Flush(); if (!mono) mixRight->Flush(); - if (bCancel) + if (updateResult == eProgressCancelled || updateResult == eProgressFailed) { delete mixLeft; if (!mono) @@ -175,7 +175,7 @@ delete[] waveArray; delete mixer; - return !bCancel; + return updateResult; } Mixer::Mixer(int numInputTracks, WaveTrack **inputTracks, Index: TimerRecordDialog.cpp =================================================================== RCS file: /cvsroot/audacity/audacity-src/src/TimerRecordDialog.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- TimerRecordDialog.cpp 2 Feb 2009 14:52:23 -0000 1.8 +++ TimerRecordDialog.cpp 2 Feb 2009 17:11:04 -0000 1.9 @@ -204,12 +204,11 @@ this->TransferDataFromWindow(); - bool bDidCancel = false; - bool bDidStop = false; + int updateResult = eProgressSuccess; if (m_DateTime_Start > wxDateTime::UNow()) - bDidCancel = !this->WaitForStart(); + updateResult = this->WaitForStart(); - if (!bDidCancel) + if (updateResult == eProgressSuccess) { // Record for specified time. AudacityProject* pProject = GetActiveProject(); @@ -240,7 +239,8 @@ wxDateTime dateTime_UNow; wxTimeSpan done_TimeSpan; - while (bIsRecording && !bDidCancel && !bDidStop) { + + while (bIsRecording && updateResult == eProgressSuccess) { // sit in this loop during the recording phase, i.e. from rec start to // recording end wxMilliSleep(kTimerInterval); @@ -251,17 +251,14 @@ // remaining_TimeSpan = m_DateTime_End - dateTime_UNow; // strNewMsg = strMsg + _("\nDone: ") + done_TimeSpan.Format() + _(" Remaining: ") + remaining_TimeSpan.Format(); - int iResult = progress.Update(done_TimeSpan.GetSeconds(), + updateResult = progress.Update(done_TimeSpan.GetSeconds(), m_TimeSpan_Duration.GetSeconds()); // , strNewMsg); - if (iResult == 0) - bDidCancel = true; - else if (iResult == 2) - bDidStop = true; bIsRecording = (wxDateTime::UNow() <= m_DateTime_End); } pProject->OnStop(); } - if (bDidCancel) + // Maybe we shouldn't return wxID_CANCEL on failure...? + if (updateResult == eProgressSuccess || updateResult == eProgressFailed) this->EndModal(wxID_CANCEL); else this->EndModal(wxID_OK); @@ -431,7 +428,7 @@ m_pTimeTextCtrl_End->SetTimeValue(wxDateTime_to_AudacityTime(m_DateTime_End)); } -bool TimerRecordDialog::WaitForStart() +int TimerRecordDialog::WaitForStart() { wxString strMsg; /* i18n-hint: A time specification like "Sunday 28th October 2007 15:16:17 GMT" @@ -442,17 +439,17 @@ wxDateTime startWait_DateTime = wxDateTime::UNow(); wxTimeSpan waitDuration = m_DateTime_Start - startWait_DateTime; - bool bDidCancel = false; + int updateResult = eProgressSuccess; bool bIsRecording = false; wxTimeSpan done_TimeSpan; - while (!bDidCancel && !bIsRecording) { + while (updateResult == eProgressSuccess && !bIsRecording) { wxMilliSleep(10); done_TimeSpan = wxDateTime::UNow() - startWait_DateTime; - bDidCancel = !progress.Update(done_TimeSpan.GetSeconds(), + updateResult = progress.Update(done_TimeSpan.GetSeconds(), waitDuration.GetSeconds()); bIsRecording = (m_DateTime_Start <= wxDateTime::UNow()); } - return !bDidCancel; + return updateResult; } Index: Dependencies.cpp =================================================================== RCS file: /cvsroot/audacity/audacity-src/src/Dependencies.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- Dependencies.cpp 5 Aug 2008 02:19:57 -0000 1.13 +++ Dependencies.cpp 2 Feb 2009 17:11:04 -0000 1.14 @@ -156,6 +156,7 @@ BlockArray blocks; GetAllSeqBlocks(project, &blocks); + int updateResult = eProgressSuccess; for(i=0; i<blocks.GetCount(); i++) { BlockFile *f = blocks[i]->f; if (f->IsAlias() && !blockFileHash[f]) { @@ -185,7 +186,9 @@ cancelled = !mProgress->Update(i, fileTotalFrames); if (cancelled) break;*/ - progress->Update(completedBytes, totalBytesToProcess); + updateResult = progress->Update(completedBytes, totalBytesToProcess); + if (updateResult != eProgressSuccess) + break; } } Index: WaveClip.cpp =================================================================== RCS file: /cvsroot/audacity/audacity-src/src/WaveClip.cpp,v retrieving revision 1.46 retrieving revision 1.47 diff -u -d -r1.46 -r1.47 --- WaveClip.cpp 5 Nov 2008 01:06:54 -0000 1.46 +++ WaveClip.cpp 2 Feb 2009 17:11:04 -0000 1.47 @@ -1396,7 +1396,8 @@ if (progress) { - error = !progress->Update(pos, numSamples); + int updateResult = progress->Update(pos, numSamples); + error = (updateResult != eProgressSuccess); if (error) { break; ------------------------------------------------------------------------------ This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword _______________________________________________ Audacity-cvs mailing list Audacity-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/audacity-cvs