Added a "Show Log for Details" button to MultiDialog so it does what the comments say, i.e., allows the user to look in the log to see which files are problematic (e.g., orphaned blockfiles.
Tightened up ProjectFSCK messages.
Added comments about remaining (long-standing!) problems in ProjectFSCK.
Reviewed Al's patch for OnPaste (bug 177) and made these changes.
OnPaste method has grown too long and complicated:
Broke out independent sections to new HandleTextPaste and HandlePasteNothingSelected methods.
Made pastedSomething bool (now "bPastedSomething") cumulative, per Al's correction. Previously, if the last clip paste failed, it showed the whole paste failed. Clearly, the philosophy for paste has been that we take what we can get. There were numerous places (and still some) where the paste results were not even checked.
Added a couple of missing checks for bPastedSomething on paste results.
Declarations:
Made declarations clearer about public vs private methods.
Removed declarations of unused/undefined CommandManagerCallback and CommandManagerListCallback methods.
Moved mSel0save and mSel1save member vars closer to the methods that use them.
Comments about what's wrong with the DirManager::ProjectFSCK "Missing Aliased Files" dialog actions and what to do about it. (More to follow!)
Changed PushState for project repair from "Repair" to "Project Repair" to distinguish from Repair effect.
renames for clarity
The only call to Show for HistoryWindow is in AudacityProject::OnHistory, and it always calls HistoryWindow::UpdateDisplay. All HistoryWindow::UpdateDisplay does is check IsShown() and if so, call HistoryWindow::DoUpdate.
Removed the call to HistoryWindow::DoUpdate in the constructor because AudacityProject::OnHistory will get that done.
Removed HistoryWindow::OnShow. No reason to implement it outside the normal wxDialog::Show() mechanism, and all it did was call HistoryWindow::UpdateDisplay (and then AudacityProject::OnHistory would do that again).
Didn't see any other reasons it has been slow, as it's just getting the state names and sizes from the stack, not actually examining anything about the states. It probably doesn't really need to clear the list and repopulate it every time, but let's see if this gives sufficient improvement before adding a lot of mechanisms for tracking exactly what needs to change.
better handling of error conditions in all BuildFromXML methods, per comment:
// BuildFromXML methods should always return a BlockFile, not NULL,
// even if the result is flawed (e.g., refers to nonexistent file),
// as testing will be done in DirManager::ProjectFSCK().
better handling of error conditions in PCMAliasBlockFile::BuildFromXML so that DirManager::ProjectFSCK can report cases of missing PCMAliasBlockFile files on opening projects where missing files were not corrected
code cleanup
naming improvements for clarity (e.g., aliasedFileName instead of aliasedFile for an instance of wxFileName -- it's not an instance of AliasedFile)
parens, not square brackets, for parenthetic phrases
Changed the descriptive static text to show the paragraph about missing files only if any are actually missing.
Added extra updating to enabling "Copy Selected Audio", e.g., for cases were all the aliased files are missing.
Made the dialog dismiss after "Copy Selected Audio" if all non-missing files have been copied in and all that remain are missing files, same as case where there are no missing files and all non-missing have been copied in.
Added extra updating to enabling "Copy All Audio", e.g., disabled when there are missing files in the list -- we cannot copy them.
Changed missing file entries in the list from italicized to prefixed with "MISSING " so screen readers can distinguish.
Was able to make the bug occur after lots of fast clicking around, by double-clicking Preview in Amplify dialog.
The key seems to be the call to wxYield. That function is obsolete, but looking at the documentation for its successor, wxApp::Yield():
"Caution should be exercised, however, since yielding may allow the user to perform actions which are not compatible with the current task. Disabling menu items or whole menus during processing can avoid unwanted reentrance of code: see ::wxSafeYield for a better function."
That sounds like exactly the situations where this has occurred. And the documentation for ::wxSafeYieldsays:
"This function is similar to wxYield, except that it disables the user input to all program windows before calling wxYield and re-enables it again afterwards."
Sounds like what we need. So I went through the code and for all the wxYield and wxGetApp()::Yield occurrences where Audacity is doing some drawing or already in the process of responding to a GUI event, I replaced them with ::wxSafeYield. Replaced all the remaining wxYield calls with calls to wxGetApp()::Yield().
Haven't been able to replicate the bug since these changes. Please test.
Basic problem was in using wxConvUTF8 instead of wxConvFile. I believe wxConvFile should work on all platforms, but if not we can "#ifdef _WIN32" its use.
Also simplified the code by getting rid of the mFileNameChar member. It was used only in ODPCMAliasBlockFile::WriteSummary() so there's no reason to do the conversion from mFileName in so many places -- just do it once, in ODPCMAliasBlockFile::WriteSummary().