1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-04-30 15:49:41 +02:00

(bug 113)

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.
This commit is contained in:
v.audacity 2010-08-17 03:46:58 +00:00
parent af52a83ec1
commit 2ef7a3fd31
5 changed files with 47 additions and 48 deletions

View File

@ -723,21 +723,21 @@ BEGIN_EVENT_TABLE(AudacityApp, wxApp)
END_EVENT_TABLE()
// Backend for OnMRUFile and OnMRUProject
bool AudacityApp::MRUOpen(wxString fileName) {
// Most of the checks below are copied from AudacityProject::ShowFileDialog
bool AudacityApp::MRUOpen(wxString fullPathStr) {
// Most of the checks below are copied from AudacityProject::OpenFiles.
// - some rationalisation might be possible.
AudacityProject *proj = GetActiveProject();
if(!fileName.IsEmpty()) {
if (!fullPathStr.IsEmpty())
{
// verify that the file exists
if(wxFile::Exists(fileName)) {
wxFileName newFileName(fileName);
gPrefs->Write(wxT("/DefaultOpenPath"), wxPathOnly(fileName));
if (wxFile::Exists(fullPathStr))
{
gPrefs->Write(wxT("/DefaultOpenPath"), wxPathOnly(fullPathStr));
// Make sure it isn't already open
wxFileName newFileName(fullPathStr);
size_t numProjects = gAudacityProjects.Count();
for (size_t i = 0; i < numProjects; i++) {
if (newFileName.SameAs(gAudacityProjects[i]->GetFileName())) {
@ -765,12 +765,12 @@ bool AudacityApp::MRUOpen(wxString fileName) {
// This project is clean; it's never been touched. Therefore
// all relevant member variables are in their initial state,
// and it's okay to open a new project inside this window.
proj->OpenFile(fileName);
proj->OpenFile(fullPathStr);
}
else {
// File doesn't exist - remove file from history
wxMessageBox(wxString::Format(_("%s could not be found.\n\nIt has been removed from the list of recent files."),
fileName.c_str()));
fullPathStr.c_str()));
return(false);
}
}
@ -784,9 +784,9 @@ void AudacityApp::OnMRUClear(wxCommandEvent& event)
void AudacityApp::OnMRUFile(wxCommandEvent& event) {
int n = event.GetId() - wxID_FILE1;
wxString fileName = mRecentFiles->GetHistoryFile(n);
wxString fullPathStr = mRecentFiles->GetHistoryFile(n);
bool opened = MRUOpen(fileName);
bool opened = MRUOpen(fullPathStr);
if(!opened) {
mRecentFiles->RemoveFileFromHistory(n);
}
@ -794,13 +794,16 @@ void AudacityApp::OnMRUFile(wxCommandEvent& event) {
#if 0
//FIX-ME: Was this OnMRUProject lost in an edit?? Should we have it back?
//vvvvv I think it was removed on purpose, but I don't know why it's still here.
// Basically, anything from Recent Files is treated as a .aup, until proven otherwise,
// then it tries to Import(). Very questionable handling, imo.
void AudacityApp::OnMRUProject(wxCommandEvent& event) {
AudacityProject *proj = GetActiveProject();
int n = event.GetId() - 6050;//FIX-ME: Use correct ID name.
wxString fileName = proj->GetRecentProjects()->GetHistoryFile(n);
wxString fullPathStr = proj->GetRecentProjects()->GetHistoryFile(n);
bool opened = MRUOpen(fileName);
bool opened = MRUOpen(fullPathStr);
if(!opened) {
proj->GetRecentProjects()->RemoveFileFromHistory(n);
gPrefs->SetPath("/RecentProjects");
@ -1934,13 +1937,3 @@ void AudacityApp::AssociateFileTypes()
}
#endif
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
// arch-tag: 49c2c7b5-6e93-4f33-83ab-ddac56ea598d

View File

@ -1408,8 +1408,8 @@ int DirManager::ProjectFSCK(const bool bForceError, const bool bSilentlyCorrect)
this->FindOrphanBlockFiles(bSilentlyCorrect, fileNameArray, orphanFilePathArray);
BlockHash missingAliasedBlockFileHash; // (.auf) AliasBlockFiles whose aliased files are missing
wxArrayString missingAliasedFilePathArray; // full paths of missing aliased files
this->FindMissingAliasedFiles(bSilentlyCorrect, missingAliasedBlockFileHash, missingAliasedFilePathArray);
BlockHash missingAliasedFilePathHash; // full paths of missing aliased files
this->FindMissingAliasedFiles(bSilentlyCorrect, missingAliasedBlockFileHash, missingAliasedFilePathHash);
BlockHash missingAliasBlockFileHash; // missing (.auf) AliasBlockFiles
this->FindMissingAliasBlockFiles(bSilentlyCorrect, missingAliasBlockFileHash);
@ -1486,8 +1486,8 @@ _("Project check detected %d external audio file(s) ('aliased files') \
\n\nIf you choose the first or second option below, you can try to \
\nfind and restore the missing files to their previous location.");
wxString msg;
msg.Printf(msgA, missingAliasedFilePathArray.GetCount());
msg.Printf(msgA, missingAliasedFilePathHash.size());
const wxChar *buttons[] = {_("Close project immediately with no changes"),
_("Temporarily replace missing audio with silence (this session only)"),
_("Replace missing audio with silence (permanent immediately)"),
@ -1646,29 +1646,38 @@ _("Project check detected %d missing audio data blockfile(s) (.au), \
void DirManager::FindMissingAliasedFiles(
const bool bSilentlyCorrect, // input: same as for ProjectFSCK
BlockHash& missingAliasedBlockFileHash, // output: AliasBlockFiles whose aliased files are missing
wxArrayString& missingAliasedFilePathArray) // output: full paths of missing aliased files
BlockHash& missingAliasedFilePathHash) // output: full paths of missing aliased files
{
BlockHash::iterator iter = mBlockFileHash.begin();
while (iter != mBlockFileHash.end())
{
wxString key = iter->first;
wxString key = iter->first; // file name and extension
BlockFile *b = iter->second;
if (b->IsAlias())
{
wxFileName aliasedFileName = ((AliasBlockFile*)b)->GetAliasedFileName();
//vvvvv First clause should never happen when "replace with silence" works correctly.
if ((aliasedFileName.GetFullPath() != wxEmptyString) &&
wxString aliasedFileFullPath = aliasedFileName.GetFullPath();
//vvvvv wxEmptyString should never happen when "replace with silence" works correctly.
if ((aliasedFileFullPath != wxEmptyString) &&
!aliasedFileName.FileExists())
{
missingAliasedBlockFileHash[key] = b;
missingAliasedFilePathArray.Add(aliasedFileName.GetFullPath());
if (missingAliasedFilePathHash.find(aliasedFileFullPath) ==
missingAliasedFilePathHash.end()) // Add it only once.
missingAliasedFilePathHash[aliasedFileFullPath] = NULL; // Not really using the blocks here.
}
}
iter++;
}
if (!bSilentlyCorrect)
for (size_t i = 0; i < missingAliasedFilePathArray.GetCount(); i++)
wxLogWarning(_("Missing aliased audio file: %s"), missingAliasedFilePathArray[i].c_str());
{
iter = missingAliasedFilePathHash.begin();
while (iter != missingAliasedFilePathHash.end())
{
wxLogWarning(_("Missing aliased audio file: %s"), iter->first.c_str());
iter++;
}
}
}
void DirManager::FindMissingAliasBlockFiles(

View File

@ -121,7 +121,7 @@ class DirManager: public XMLTagHandler {
void FindMissingAliasedFiles(
const bool bSilentlyCorrect, // input: same as for ProjectFSCK
BlockHash& missingAliasedBlockFileHash, // output: (.auf) AliasBlockFiles whose aliased files are missing
wxArrayString& missingAliasedFilePathArray); // output: full paths of missing aliased files
BlockHash& missingAliasedFilePathHash); // output: full paths of missing aliased files
void FindMissingAliasBlockFiles(
const bool bSilentlyCorrect, // input: same as for ProjectFSCK
BlockHash& missingAliasBlockFileHash); // output: missing (.auf) AliasBlockFiles

View File

@ -5482,7 +5482,14 @@ void AudacityProject::OnShowLog()
{
wxLogWindow* pLogger = wxGetApp().mLogger;
pLogger->Show();
pLogger->GetFrame()->Raise();
wxFrame* pLoggerFrame = pLogger->GetFrame();
pLoggerFrame->Raise();
//bool bSuccess = pLoggerFrame->ScrollPages(1);
int width, height;
pLoggerFrame->GetSize(&width, &height);
pLoggerFrame->SetSize(width, 430);
}
void AudacityProject::OnBenchmark()

View File

@ -2314,6 +2314,7 @@ void AudacityProject::OpenFile(wxString fileName, bool addtohistory)
}
}
//FIX-ME: //vvvvv Surely we could be smarter about this, like checking much earlier that this is a .aup file!
if (temp.Mid(0, 6) != wxT("<?xml ")) {
// If it's not XML, try opening it as any other form of audio
Import(fileName);
@ -4537,14 +4538,3 @@ void AudacityProject::HandleTrackSolo(Track *t, const bool alternate)
}
}
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
// arch-tag: da1685fe-8c99-4407-a71b-cf52576ff11a