I refactored the code into AudacityApp with a new timer. This is provisional pending discussion - if it is decided that it should go somewhere else I will move it.
This is a workaround for the portaudio issue where changing the default device in xp will corrupt the portaudio device indecies.
This combined with the portmixer fix (earlier today) should address bug 29.
// but we can't make the AddItem flags and mask have both, because they'd both have to be true for the
// command to be enabled.
// If user has Undone the entire stack, RedoAvailableFlag is on but UndoAvailableFlag is off.
// If user has done things but not Undone anything, RedoAvailableFlag is off but UndoAvailableFlag is on.
// So in either of those cases, (AudioIONotBusyFlag | UndoAvailableFlag | RedoAvailableFlag) mask
// would fail.
// The only way to fix this in the current architecture is to hack in special cases for RedoAvailableFlag
// in AudacityProject::UpdateMenus() (ugly) and CommandManager::HandleCommandEntry() (*really* ugly --
// shouldn't know about particular command names and flags).
// So for now, enable the command regardless of stack. It will just show empty (except for Created Project) sometimes.
// FOR REDESIGN, clearly there are some limitations with the flags/mask bitmaps.
If the Meter Toolbar was monitoring input, PrefsDialog can be opened, but then PrefsDialog::OnOK() needs to StopStream() or AudioIO::HandleDeviceChange() will no-op. We could instead disable the Preferences command while monitoring, i.e., set AudioIONotBusyFlag/AudioIOBusyFlag according to monitoring, as well as gAudioIO->IsAudioTokenActive(). Instead allow it because unlike recording, for example, monitoring is not clearly something that should prohibit opening prefs.
This may have been some of the occasions of bug 29, where user changed device while monitoring, but the AudioIO::HandleDeviceChange() code did not actually change the device, so it look like the user had specificied the motherboard/sound card default device, but Audacity was still using the USB device.
// TO-DO: We *could* be smarter in this method and call HandleDeviceChange()
// only when the device choices actually changed. True of lots of prefs!
// As is, we always stop monitoring and handle the device change.
In AudacityProject::GetUpdateFlags(), don't need to check (GetAudioIOToken() == 0) alternative because gAudioIO->IsAudioTokenActive() checks that it's greater than zero.
In AudioIO.cpp, cleaned up some logic and encapsulation of boolean methods.
Ed Musgrove's patch to fix cases where the bug currently occurs.
This does not completely fix the bug, because users can still set modifier keys in the wrong order so they would be two separate entries in CommandManager::mCommandKeyHash, but KeyEventToKeyString() will put them in the expected order, so the version in the expected order will always be the one CommandManager::HandleKey() uses.
EXPERIMENTAL_LINKING -> EXPERIMENTAL_SYNC_LOCK
Restore some "border" lines in TrackInfo.
Get rid of unused DEFINE_COLOUR( clrTrackInfoSyncLockSel...).
Clean out some undocumented commented-out code. Add/remove some comments.
DirManager::ProjectFSCK (project check):
Made the enumerations interleaved with handling, because,
for example, user choosing to replace missing aliased block files with silence
needs to put in SilentBlockFiles and delete the corresponding auf files,
so those would then not be cumulated in missingAliasBlockFileHash.
We still do the FindX methods outside the conditionals,
so the log always shows all found errors.
Moved check for orphan files to last, so user first has a chance to get
messages about missing files that user may have mistakenly renamed
(and the renamed ones would appear to be orphans).
Re-ordered user choices for orphan files dialog to safest-to-boldest.
Changed FSCKstatus_CLOSEREQ and FSCKstatus_CHANGED to be integers rather
than binary flags. They were never returned with both in the result, nor used that way.
Made the project check log warnings use full paths instead of just file names.
Removed close box and system menu from MultiDialog, so that project check dialogs cannot just be closed. User has to decide on one of the choices.
Fixed some handling in AudacityProject::OnShowLog(). If the log was already showing before MultiDialog came up, it froze because it was not re-enabled.
More comments about things to fix (FIX-ME items this time).
Made AudacityProject::OnShowLog make the log window taller so more likely to show the bottom. The implementation of wxLogWindow makes it hard/impossible to scroll to the bottom.
Fix error of duplicate reports of missing aliased files.
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.