1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-30 15:39:27 +02:00

some progress on bug 113, including rewordings DependencyDialog based on some suggested by Gale

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
This commit is contained in:
v.audacity 2010-07-28 23:06:10 +00:00
parent 92bdf970c5
commit 8f8504b5a6
8 changed files with 158 additions and 139 deletions

View File

@ -537,11 +537,13 @@ AliasBlockFile::AliasBlockFile(wxFileName baseFileName,
mSilentAliasLog=FALSE;
}
AliasBlockFile::AliasBlockFile(wxFileName existingSummaryFile,
wxFileName aliasedFileName, sampleCount aliasStart,
sampleCount aliasLen, int aliasChannel,
AliasBlockFile::AliasBlockFile(wxFileName existingSummaryFileName,
wxFileName aliasedFileName,
sampleCount aliasStart,
sampleCount aliasLen,
int aliasChannel,
float min, float max, float rms):
BlockFile(existingSummaryFile, aliasLen),
BlockFile(existingSummaryFileName, aliasLen),
mAliasedFileName(aliasedFileName),
mAliasStart(aliasStart),
mAliasChannel(aliasChannel)

View File

@ -194,7 +194,7 @@ class AliasBlockFile : public BlockFile
AliasBlockFile(wxFileName baseFileName,
wxFileName aliasedFileName, sampleCount aliasStart,
sampleCount aliasLen, int aliasChannel);
AliasBlockFile(wxFileName existingSummaryFile,
AliasBlockFile(wxFileName existingSummaryFileName,
wxFileName aliasedFileName, sampleCount aliasStart,
sampleCount aliasLen, int aliasChannel,
float min, float max, float RMS);
@ -222,7 +222,7 @@ class AliasBlockFile : public BlockFile
/// Modifies the name of the aliased file.
void ChangeAliasedFile(wxFileName newAliasedFile);
/// Returns TRUE if this is an AliasBlockFile
bool IsAlias() { return true; }
virtual bool IsAlias() { return true; }
protected:
/// Write the summary to disk, using the derived ReadData() to get the data
@ -238,16 +238,3 @@ class AliasBlockFile : public BlockFile
#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: ebcc7075-5983-4092-a316-1f2e2b0bcbc3

View File

@ -258,15 +258,17 @@ public:
private:
void PopulateList();
void OnList(wxListEvent &evt);
void PopulateOrExchange(ShuttleGui & S);
// event handlers
void OnCancel(wxCommandEvent& evt);
void OnCopySelectedFiles(wxCommandEvent &evt);
void OnList(wxListEvent &evt);
void OnNo(wxCommandEvent &evt);
void OnYes(wxCommandEvent &evt);
void PopulateOrExchange(ShuttleGui & S);
void SaveFutureActionChoice();
virtual void OnCancel(wxCommandEvent& evt);
AudacityProject *mProject;
AliasedFileArray *mAliasedFiles;
@ -294,9 +296,9 @@ BEGIN_EVENT_TABLE(DependencyDialog, wxDialog)
EVT_LIST_ITEM_SELECTED(FileListID, DependencyDialog::OnList)
EVT_LIST_ITEM_DESELECTED(FileListID, DependencyDialog::OnList)
EVT_BUTTON(CopySelectedFilesButtonID, DependencyDialog::OnCopySelectedFiles)
EVT_BUTTON(wxID_NO, DependencyDialog::OnNo)
EVT_BUTTON(wxID_YES, DependencyDialog::OnYes)
EVT_BUTTON(wxID_CANCEL, DependencyDialog::OnCancel) // seems to be needed
EVT_BUTTON(wxID_NO, DependencyDialog::OnNo) // mIsSaving ? "Cancel Save" : "Save without Copying"
EVT_BUTTON(wxID_YES, DependencyDialog::OnYes) // "Copy All Files (Safer)"
EVT_BUTTON(wxID_CANCEL, DependencyDialog::OnCancel) // "Cancel Save"
END_EVENT_TABLE()
DependencyDialog::DependencyDialog(wxWindow *parent,
@ -304,7 +306,7 @@ DependencyDialog::DependencyDialog(wxWindow *parent,
AudacityProject *project,
AliasedFileArray *aliasedFiles,
bool isSaving):
wxDialog(parent, id, _("Project depends on other audio files"),
wxDialog(parent, id, _("Project Depends on Other Audio Files"),
wxDefaultPosition, wxDefaultSize,
isSaving ? wxDEFAULT_DIALOG_STYLE & (~wxCLOSE_BOX) :
wxDEFAULT_DIALOG_STYLE), // no close box when saving
@ -323,14 +325,12 @@ DependencyDialog::DependencyDialog(wxWindow *parent,
PopulateOrExchange(S);
}
const wxString kStdMessage =
const wxString kStdMsg =
_("Copying these files into your project will remove this dependency.\
\nThis needs more disk space, but is safer.");
\nThis is safer, but needs more disk space.");
const wxString kMessageForMissingFiles =
_("Copying these files into your project will remove this dependency.\
\nThis needs more disk space, but is safer.\
\n\nFiles shown as MISSING have been moved or deleted and cannot be copied.\
const wxString kExtraMsgForMissingFiles =
_("\n\nFiles shown as MISSING have been moved or deleted and cannot be copied.\
\nRestore them to their original location to be able to copy into project.");
void DependencyDialog::PopulateOrExchange(ShuttleGui& S)
@ -338,23 +338,25 @@ void DependencyDialog::PopulateOrExchange(ShuttleGui& S)
S.SetBorder(5);
S.StartVerticalLay();
{
mMessageStaticText = S.AddVariableText(kStdMessage, false);
mMessageStaticText = S.AddVariableText(kStdMsg, false);
S.StartStatic(_("Project Dependencies"));
{
mFileListCtrl = S.Id(FileListID).AddListControlReportMode();
mFileListCtrl->InsertColumn(0, _("Audio file"));
mFileListCtrl->InsertColumn(0, _("Audio File"));
mFileListCtrl->SetColumnWidth(0, 220);
mFileListCtrl->InsertColumn(1, _("Disk space"));
mFileListCtrl->InsertColumn(1, _("Disk Space"));
mFileListCtrl->SetColumnWidth(1, 120);
PopulateList();
mCopySelectedFilesButton =
S.Id(CopySelectedFilesButtonID).AddButton(
_("Copy Selected Audio Into Project"),
_("Copy Selected Files"),
wxALIGN_LEFT);
mCopySelectedFilesButton->Enable(
mFileListCtrl->GetSelectedItemCount() > 0);
mCopySelectedFilesButton->SetDefault();
mCopySelectedFilesButton->SetFocus();
}
S.EndStatic();
@ -362,11 +364,13 @@ void DependencyDialog::PopulateOrExchange(ShuttleGui& S)
{
if (mIsSaving) {
S.Id(wxID_CANCEL).AddButton(_("Cancel Save"));
S.Id(wxID_NO).AddButton(_("Save without Copying"));
}
S.Id(wxID_NO).AddButton(_("Do Not Copy Any Audio"));
else
S.Id(wxID_NO).AddButton(_("Do Not Copy"));
mCopyAllFilesButton =
S.Id(wxID_YES).AddButton(_("Copy All Audio into Project (Safer)"));
S.Id(wxID_YES).AddButton(_("Copy All Files (Safer)"));
// Enabling mCopyAllFilesButton is also done in PopulateList,
// but at its call above, mCopyAllFilesButton does not yet exist.
@ -380,8 +384,8 @@ void DependencyDialog::PopulateOrExchange(ShuttleGui& S)
{
wxArrayString choices;
choices.Add(_("Ask me"));
choices.Add(_("Always copy all audio (safest)"));
choices.Add(_("Never copy any audio"));
choices.Add(_("Always copy all files (safest)"));
choices.Add(_("Never copy any files"));
mFutureActionChoice =
S.Id(FutureActionChoiceID).AddChoice(
_("Whenever a project depends on other files:"),
@ -423,18 +427,17 @@ void DependencyDialog::PopulateList()
mFileListCtrl->InsertItem(i, _("MISSING ") + fileName.GetFullPath());
mHasMissingFiles = true;
mFileListCtrl->SetItemState(i, 0, wxLIST_STATE_SELECTED); // Deselect.
//mFileListCtrl->SetItemBackgroundColour(i, *wxRED);
//mFileListCtrl->SetItemTextColour(i, *wxWHITE);
mFileListCtrl->SetItemTextColour(i, *wxRED);
//mFileListCtrl->SetItemFont(i, *wxITALIC_FONT);
}
mFileListCtrl->SetItem(i, 1, Internat::FormatSize(byteCount));
mFileListCtrl->SetItemData(i, long(bOriginalExists));
}
mMessageStaticText->SetLabel(mHasMissingFiles ?
kMessageForMissingFiles :
kStdMessage);
wxString msg = kStdMsg;
if (mHasMissingFiles)
msg += kExtraMsgForMissingFiles;
mMessageStaticText->SetLabel(msg);
if (mCopyAllFilesButton)
mCopyAllFilesButton->Enable(!mHasMissingFiles);
}
@ -533,13 +536,18 @@ bool ShowDependencyDialogIfNeeded(AudacityProject *project,
if (aliasedFiles.GetCount() == 0) {
if (!isSaving)
wxMessageBox(
_("Your project is currently self-contained; it does not depend on any external audio files. \
\n\nIf you Undo back to a state where it has external dependencies on imported files, it will no \
longer be self-contained. If you then Save without copying those files in, you may lose data."),
_("Dependency check"),
{
wxString msg =
_("Your project is currently self-contained; it does not depend on any external audio files.");
if (project->GetUndoManager()->UndoAvailable())
msg +=
_("\n\nIf you Undo back to a state where it has external dependencies on imported files, it will no \
longer be self-contained. If you then Save without copying those files in, you may lose data.");
wxMessageBox(msg,
_("Dependency Check"),
wxOK | wxICON_INFORMATION,
project);
}
return true; // Nothing to do.
}

View File

@ -407,12 +407,12 @@ bool DirManager::SetProject(wxString & projPath, wxString & projName,
ProgressDialog *progress = new ProgressDialog(_("Progress"),
_("Saving project data files"));
int total=blockFileHash.size();
int total = mBlockFileHash.size();
int count=0;
BlockHash::iterator i=blockFileHash.begin();
BlockHash::iterator i = mBlockFileHash.begin();
bool success = true;
while(i != blockFileHash.end() && success) {
while(i != mBlockFileHash.end() && success) {
BlockFile *b = i->second;
if (b->IsLocked())
@ -436,8 +436,8 @@ bool DirManager::SetProject(wxString & projPath, wxString & projName,
projFull = oldLoc;
BlockHash::iterator i=blockFileHash.begin();
while(i != blockFileHash.end()) {
BlockHash::iterator i = mBlockFileHash.begin();
while(i != mBlockFileHash.end()) {
BlockFile *b = i->second;
MoveToNewProjectDirectory(b);
@ -464,7 +464,7 @@ bool DirManager::SetProject(wxString & projPath, wxString & projName,
// loading a project; in this latter case, the movement code does
// nothing because SetProject is called before there are any
// blockfiles. Cleanup code trigger is the same
if(blockFileHash.size()>0){
if (mBlockFileHash.size()>0){
// Clean up after ourselves; look for empty directories in the old
// and new project directories. The easiest way to do this is to
// recurse depth-first and rmdir every directory seen in old and
@ -800,7 +800,7 @@ wxFileName DirManager::MakeBlockFileName()
baseFileName.Printf(wxT("e%02x%02x%03x"),topnum,midnum,filenum);
if(blockFileHash.find(baseFileName) == blockFileHash.end()){
if (mBlockFileHash.find(baseFileName) == mBlockFileHash.end()){
// not in the hash, good.
if(AssignFile(ret,baseFileName,TRUE)==FALSE){
@ -832,7 +832,7 @@ BlockFile *DirManager::NewSimpleBlockFile(
new SimpleBlockFile(fileName, sampleData, sampleLen, format,
allowDeferredWrite);
blockFileHash[fileName.GetName()]=newBlockFile;
mBlockFileHash[fileName.GetName()]=newBlockFile;
return newBlockFile;
}
@ -847,7 +847,7 @@ BlockFile *DirManager::NewAliasBlockFile(
new PCMAliasBlockFile(fileName,
aliasedFile, aliasStart, aliasLen, aliasChannel);
blockFileHash[fileName.GetName()]=newBlockFile;
mBlockFileHash[fileName.GetName()]=newBlockFile;
aliasList.Add(aliasedFile);
return newBlockFile;
@ -863,7 +863,7 @@ BlockFile *DirManager::NewODAliasBlockFile(
new ODPCMAliasBlockFile(fileName,
aliasedFile, aliasStart, aliasLen, aliasChannel);
blockFileHash[fileName.GetName()]=newBlockFile;
mBlockFileHash[fileName.GetName()]=newBlockFile;
aliasList.Add(aliasedFile);
return newBlockFile;
@ -879,7 +879,7 @@ BlockFile *DirManager::NewODDecodeBlockFile(
new ODDecodeBlockFile(fileName,
aliasedFile, aliasStart, aliasLen, aliasChannel, decodeType);
blockFileHash[fileName.GetName()]=newBlockFile;
mBlockFileHash[fileName.GetName()]=newBlockFile;
aliasList.Add(aliasedFile); //OD TODO: check to see if we need to remove this when done decoding.
//I don't immediately see a place where alias files remove when a file is closed.
@ -894,12 +894,12 @@ BlockFile *DirManager::CopyBlockFile(BlockFile *b)
if (!b->IsLocked()) {
b->Ref();
//mchinen:July 13 2009 - not sure about this, but it needs to be added to the hash to be able to save if not locked.
//note that this shouldn't hurt blockFileHash's that already contain the filename, since it should just overwrite.
//note that this shouldn't hurt mBlockFileHash's that already contain the filename, since it should just overwrite.
//but it's something to watch out for.
//
// LLL: Except for silent block files which have no filename.
if (!b->GetFileName().GetName().IsEmpty()) {
blockFileHash[b->GetFileName().GetName()]=b;
mBlockFileHash[b->GetFileName().GetName()]=b;
}
return b;
}
@ -933,7 +933,7 @@ BlockFile *DirManager::CopyBlockFile(BlockFile *b)
if (b2 == NULL)
return NULL;
blockFileHash[newFile.GetName()]=b2;
mBlockFileHash[newFile.GetName()]=b2;
aliasList.Add(newFile.GetFullPath());
}
@ -1015,7 +1015,7 @@ bool DirManager::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
//
wxString name = (*mLoadingTarget)->GetFileName().GetName();
BlockFile *retrieved = blockFileHash[name];
BlockFile *retrieved = mBlockFileHash[name];
if (retrieved) {
// Lock it in order to delete it safely, i.e. without having
// it delete the file, too...
@ -1028,7 +1028,7 @@ bool DirManager::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
}
// This is a new object
blockFileHash[name]=*mLoadingTarget;
mBlockFileHash[name]=*mLoadingTarget;
// MakeBlockFileName wasn't used so we must add the directory
// balancing information
BalanceInfoAdd(name);
@ -1184,7 +1184,7 @@ void DirManager::Deref(BlockFile * f)
// and this block is no longer needed. Remove it from the hash
// table.
blockFileHash.erase(theFileName);
mBlockFileHash.erase(theFileName);
BalanceInfoDel(theFileName);
}
@ -1240,16 +1240,14 @@ bool DirManager::EnsureSafeFilename(wxFileName fName)
bool needToRename = false;
wxBusyCursor busy;
BlockHash::iterator it=blockFileHash.begin();
while(it != blockFileHash.end()) {
BlockHash::iterator it = mBlockFileHash.begin();
while(it != mBlockFileHash.end()) {
BlockFile *b = it->second;
// don't worry, we don't rely on this cast unless IsAlias is true
AliasBlockFile *ab = (AliasBlockFile*)b;
if (b->IsAlias() && ab->GetAliasedFile() == fName) {
needToRename = true;
//wxPrintf(_("Changing block %s\n"), b->GetFileName().GetFullName().c_str());
//ab->ChangeAliasedFile(renamedFile);
//ODBlocks access the aliased file on another thread, so we need to pause them before this continues.
ab->LockRead();
@ -1261,8 +1259,6 @@ bool DirManager::EnsureSafeFilename(wxFileName fName)
ODDecodeBlockFile *db = (ODDecodeBlockFile*)b;
if (!b->IsDataAvailable() && db->GetEncodedAudioFilename() == fName) {
needToRename = true;
//wxPrintf(_("Changing block %s\n"), b->GetFileName().GetFullName().c_str());
//ab->ChangeAliasedFile(renamedFile);
//ODBlocks access the aliased file on another thread, so we need to pause them before this continues.
db->LockRead();
@ -1282,8 +1278,8 @@ bool DirManager::EnsureSafeFilename(wxFileName fName)
// just in case!!!
// Put things back where they were
BlockHash::iterator it=blockFileHash.begin();
while(it != blockFileHash.end()) {
BlockHash::iterator it = mBlockFileHash.begin();
while(it != mBlockFileHash.end()) {
BlockFile *b = it->second;
AliasBlockFile *ab = (AliasBlockFile*)b;
ODDecodeBlockFile *db = (ODDecodeBlockFile*)b;
@ -1308,8 +1304,8 @@ bool DirManager::EnsureSafeFilename(wxFileName fName)
else
{
//point the aliases to the new filename.
BlockHash::iterator it=blockFileHash.begin();
while(it != blockFileHash.end()) {
BlockHash::iterator it = mBlockFileHash.begin();
while(it != mBlockFileHash.end()) {
BlockFile *b = it->second;
AliasBlockFile *ab = (AliasBlockFile*)b;
ODDecodeBlockFile *db = (ODDecodeBlockFile*)b;
@ -1363,7 +1359,7 @@ void DirManager::Deref()
// data is regenerated if possible orreplaced with silence, orphaned
// blockfiles are deleted.... but only after user confirm! Note that
// even blockfiles not referenced by the current savefile (but locked
// by history) will be reflected in the blockFileHash, and that's a
// by history) will be reflected in the mBlockFileHash, and that's a
// good thing; this is one reason why we use the hash and not the most
// recent savefile.
@ -1372,7 +1368,7 @@ int DirManager::ProjectFSCK(bool forceerror, bool silentlycorrect, bool bIgnoreN
// get a rough guess of how many blockfiles will be found/processed
// at each step by looking at the size of the blockfile hash
int blockcount=blockFileHash.size();
int blockcount = mBlockFileHash.size();
int ret=0;
int ndx;
@ -1399,7 +1395,7 @@ int DirManager::ProjectFSCK(bool forceerror, bool silentlycorrect, bool bIgnoreN
wxString basename=fullname.GetName();
diskFileHash[basename.c_str()]=0; // just needs to be defined
if ((blockFileHash.find(basename) == blockFileHash.end()) && // is orphaned
if ((mBlockFileHash.find(basename) == mBlockFileHash.end()) && // is orphaned
(!bIgnoreNonAUs || // check only AU, e.g., not an imported ogg or branding jpg
fullname.GetExt().IsSameAs(wxT("au"))))
{
@ -1412,8 +1408,8 @@ int DirManager::ProjectFSCK(bool forceerror, bool silentlycorrect, bool bIgnoreN
}
// enumerate missing alias files
BlockHash::iterator i=blockFileHash.begin();
while(i != blockFileHash.end()) {
BlockHash::iterator i = mBlockFileHash.begin();
while(i != mBlockFileHash.end()) {
wxString key=i->first;
BlockFile *b=i->second;
@ -1437,8 +1433,8 @@ int DirManager::ProjectFSCK(bool forceerror, bool silentlycorrect, bool bIgnoreN
}
// enumerate missing summary blockfiles
i=blockFileHash.begin();
while(i != blockFileHash.end()) {
i = mBlockFileHash.begin();
while(i != mBlockFileHash.end()) {
wxString key=i->first;
BlockFile *b=i->second;
@ -1459,8 +1455,8 @@ int DirManager::ProjectFSCK(bool forceerror, bool silentlycorrect, bool bIgnoreN
}
// enumerate missing data blockfiles
i=blockFileHash.begin();
while(i != blockFileHash.end()) {
i = mBlockFileHash.begin();
while(i != mBlockFileHash.end()) {
wxString key=i->first;
BlockFile *b=i->second;
@ -1502,7 +1498,7 @@ int DirManager::ProjectFSCK(bool forceerror, bool silentlycorrect, bool bIgnoreN
prompt.Printf(promptA,(int)orphanList.GetCount());
const wxChar *buttons[]={_("Delete orphaned files [safe and recommended]"),
const wxChar *buttons[]={_("Delete orphaned files (safe and recommended)"),
_("Continue without deleting; ignore the extra files this session"),
_("Close project immediately with no changes"),NULL};
int action = ShowMultiDialog(prompt,
@ -1537,8 +1533,8 @@ int DirManager::ProjectFSCK(bool forceerror, bool silentlycorrect, bool bIgnoreN
prompt.Printf(promptA,missingAliasFiles.size());
const wxChar *buttons[]={_("Replace missing data with silence [permanent upon save]"),
_("Temporarily replace missing data with silence [this session only]"),
const wxChar *buttons[]={_("Replace missing data with silence (permanent upon save)"),
_("Temporarily replace missing data with silence (this session only)"),
_("Close project immediately with no further changes"),NULL};
action = ShowMultiDialog(prompt,
_("Warning"),
@ -1554,6 +1550,9 @@ int DirManager::ProjectFSCK(bool forceerror, bool silentlycorrect, bool bIgnoreN
if(action==0){
// silence the blockfiles by yanking the filename
//vvvvv But this causes Check Dependencies to show "MISSING" with no filename.
//vvvvv Replace with actual SilentBlockFile, as that's what the user commanded.
//vvvvv Call RemoveDependencies from Dependencies.cpp instead?
wxFileName dummy;
dummy.Clear();
b->ChangeAliasedFile(dummy);
@ -1583,8 +1582,8 @@ int DirManager::ProjectFSCK(bool forceerror, bool silentlycorrect, bool bIgnoreN
prompt.Printf(promptA,missingSummaryList.size());
const wxChar *buttons[]={_("Regenerate summary files [safe and recommended]"),
_("Fill in silence for missing display data [this session only]"),
const wxChar *buttons[]={_("Regenerate summary files (safe and recommended)"),
_("Fill in silence for missing display data (this session only"),
_("Close project immediately with no further changes"),NULL};
action = ShowMultiDialog(prompt,
_("Warning"),
@ -1625,8 +1624,8 @@ int DirManager::ProjectFSCK(bool forceerror, bool silentlycorrect, bool bIgnoreN
prompt.Printf(promptA,missingDataList.size());
const wxChar *buttons[]={_("Replace missing data with silence [permanent immediately]"),
_("Temporarily replace missing data with silence [this session only]"),
const wxChar *buttons[]={_("Replace missing data with silence (permanent immediately)"),
_("Temporarily replace missing data with silence (this session only)"),
_("Close project immediately with no further changes"),NULL};
action = ShowMultiDialog(prompt,
_("Warning"),
@ -1674,7 +1673,7 @@ void DirManager::RemoveOrphanedBlockfiles()
// get a rough guess of how many blockfiles will be found/processed
// at each step by looking at the size of the blockfile hash
int blockcount=blockFileHash.size();
int blockcount = mBlockFileHash.size();
// enumerate *all* files in the project directory
wxArrayString fnameList;
@ -1691,7 +1690,7 @@ void DirManager::RemoveOrphanedBlockfiles()
wxFileName fullname(fnameList[i]);
wxString basename=fullname.GetName();
if(blockFileHash.find(basename) == blockFileHash.end()){
if (mBlockFileHash.find(basename) == mBlockFileHash.end()){
// the blockfile on disk is orphaned
orphanList.Add(fullname.GetFullPath());
}
@ -1720,8 +1719,8 @@ void DirManager::FillBlockfilesCache()
BlockHash::iterator i;
int numNeed = 0;
i = blockFileHash.begin();
while (i != blockFileHash.end())
i = mBlockFileHash.begin();
while (i != mBlockFileHash.end())
{
BlockFile *b = i->second;
if (b->GetNeedFillCache())
@ -1735,9 +1734,9 @@ void DirManager::FillBlockfilesCache()
ProgressDialog progress(_("Caching audio"),
_("Caching audio into memory"));
i = blockFileHash.begin();
i = mBlockFileHash.begin();
int current = 0;
while (i != blockFileHash.end())
while (i != mBlockFileHash.end())
{
BlockFile *b = i->second;
if (b->GetNeedFillCache() && (GetFreeMemory() > lowMem)) {
@ -1756,8 +1755,8 @@ void DirManager::WriteCacheToDisk()
BlockHash::iterator i;
int numNeed = 0;
i = blockFileHash.begin();
while (i != blockFileHash.end())
i = mBlockFileHash.begin();
while (i != mBlockFileHash.end())
{
BlockFile *b = i->second;
if (b->GetNeedWriteCacheToDisk())
@ -1771,9 +1770,9 @@ void DirManager::WriteCacheToDisk()
ProgressDialog progress(_("Saving recorded audio"),
_("Saving recorded audio to disk"));
i = blockFileHash.begin();
i = mBlockFileHash.begin();
int current = 0;
while (i != blockFileHash.end())
while (i != mBlockFileHash.end())
{
BlockFile *b = i->second;
if (b->GetNeedWriteCacheToDisk())

View File

@ -162,7 +162,7 @@ class DirManager: public XMLTagHandler {
int mRef; // MM: Current refcount
BlockHash blockFileHash; // repository for blockfiles
BlockHash mBlockFileHash; // repository for blockfiles
DirHash dirTopPool; // available toplevel dirs
DirHash dirTopFull; // full toplevel dirs
DirHash dirMidPool; // available two-level dirs

View File

@ -767,8 +767,8 @@ bool Sequence::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
if (!wxStrcmp(attr, wxT("maxsamples")))
{
// Dominic, 12/10/2006:
// Let's check that maxsamples is >= 1024 and <= 64 * 1024 * 1024
// - that's a pretty wide range of reasonable values.
// Let's check that maxsamples is >= 1024 and <= 64 * 1024 * 1024
// - that's a pretty wide range of reasonable values.
if ((nValue < 1024) || (nValue > 64 * 1024 * 1024))
{
mErrorOpening = true;

View File

@ -25,29 +25,38 @@
#include "../ondemand/ODManager.h"
PCMAliasBlockFile::PCMAliasBlockFile(wxFileName fileName,
wxFileName aliasedFile, sampleCount aliasStart,
sampleCount aliasLen, int aliasChannel):
AliasBlockFile(fileName, aliasedFile, aliasStart, aliasLen, aliasChannel)
PCMAliasBlockFile::PCMAliasBlockFile(
wxFileName fileName,
wxFileName aliasedFileName,
sampleCount aliasStart,
sampleCount aliasLen, int aliasChannel)
: AliasBlockFile(fileName, aliasedFileName,
aliasStart, aliasLen, aliasChannel)
{
AliasBlockFile::WriteSummary();
}
PCMAliasBlockFile::PCMAliasBlockFile(wxFileName fileName,
wxFileName aliasedFile, sampleCount aliasStart,
sampleCount aliasLen, int aliasChannel,bool writeSummary):
AliasBlockFile(fileName, aliasedFile, aliasStart, aliasLen, aliasChannel)
PCMAliasBlockFile::PCMAliasBlockFile(
wxFileName fileName,
wxFileName aliasedFileName,
sampleCount aliasStart,
sampleCount aliasLen, int aliasChannel,bool writeSummary)
: AliasBlockFile(fileName, aliasedFileName,
aliasStart, aliasLen, aliasChannel)
{
if(writeSummary)
AliasBlockFile::WriteSummary();
}
PCMAliasBlockFile::PCMAliasBlockFile(wxFileName existingFileName,
wxFileName aliasedFile, sampleCount aliasStart,
sampleCount aliasLen, int aliasChannel,
float min, float max, float rms):
AliasBlockFile(existingFileName, aliasedFile, aliasStart, aliasLen,
aliasChannel, min, max, rms)
PCMAliasBlockFile::PCMAliasBlockFile(
wxFileName existingSummaryFileName,
wxFileName aliasedFileName,
sampleCount aliasStart,
sampleCount aliasLen, int aliasChannel,
float min, float max, float rms)
: AliasBlockFile(existingSummaryFileName, aliasedFileName,
aliasStart, aliasLen,
aliasChannel, min, max, rms)
{
}
@ -173,6 +182,7 @@ void PCMAliasBlockFile::SaveXML(XMLWriter &xmlFile)
BlockFile *PCMAliasBlockFile::BuildFromXML(DirManager &dm, const wxChar **attrs)
{
bool bMissingAliasFile = false;
wxFileName summaryFileName;
wxFileName aliasFileName;
int aliasStart=0, aliasLen=0, aliasChannel=0;
@ -209,7 +219,10 @@ BlockFile *PCMAliasBlockFile::BuildFromXML(DirManager &dm, const wxChar **attrs)
// Allow fallback of looking for the file name, located in the data directory.
aliasFileName.Assign(dm.GetProjectDataDir(), strValue);
else
return NULL;
{
aliasFileName.Assign(strValue);
bMissingAliasFile = true;
}
}
else if (XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue))
{ // integer parameters
@ -239,11 +252,33 @@ BlockFile *PCMAliasBlockFile::BuildFromXML(DirManager &dm, const wxChar **attrs)
}
if (!XMLValueChecker::IsGoodFileName(summaryFileName.GetFullName(), summaryFileName.GetPath(wxPATH_GET_VOLUME)) ||
!XMLValueChecker::IsGoodFileName(aliasFileName.GetFullName(), aliasFileName.GetPath(wxPATH_GET_VOLUME)) ||
(aliasLen <= 0) || (aliasLen < 0.0) || !XMLValueChecker::IsValidChannel(aliasChannel) || (rms < 0.0))
if (!XMLValueChecker::IsGoodFileName(
summaryFileName.GetFullName(),
summaryFileName.GetPath(wxPATH_GET_VOLUME)) ||
// Check the aliasFileName validity only if we do not already know file is missing.
(!bMissingAliasFile &&
!XMLValueChecker::IsGoodFileName(
aliasFileName.GetFullName(),
aliasFileName.GetPath(wxPATH_GET_VOLUME))) ||
(aliasStart < 0) || (aliasLen < 0) ||
!XMLValueChecker::IsValidChannel(aliasChannel) ||
(rms < 0.0))
return NULL;
// Even if we know aliasFileName is missing (bMissingAliasFile),
// create a PCMAliasBlockFile, so it gets put on DirManager's
// mBlockFileHash and gets discovered in DirManager::ProjectFSCK(),
// where user will get to decide what to do about it.
// Vaughan, 2010-07-28 (bug 113):
// Previously, the "aliasfile" clause above returned NULL.
// This caused Sequence::HandleXMLEndTag to create a SilentBlockFile,
// but that never got put on DirManager's mBlockFileHash, so
// DirManager::ProjectFSCK() never found the missing files.
// That caused FindDependencies to miss them, too, so a re-opened
// project with missing alias file(s) would show as self-contained,
// among other errors.
//vvv *Not sure whether that "replace missing blockfiles with SilentBlockFiles"
// loop in Sequence::HandleXMLEndTag can now be removed...
return new PCMAliasBlockFile(summaryFileName, aliasFileName,
aliasStart, aliasLen, aliasChannel,
min, max, rms);
@ -254,15 +289,3 @@ void PCMAliasBlockFile::Recover(void)
WriteSummary();
}
// 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: 7afeef28-696c-40c6-9558-c1134ac04a66

View File

@ -88,7 +88,7 @@ void ThemePrefs::PopulateOrExchange(ShuttleGui & S)
S.StartStatic(_("Info"));
{
S.AddFixedText(
_("Themability is an experimental feature.\n\nTo try it out, click \"Save Theme Cache\" then find and modify the images and colors in\nImageCacheVxx.png using an image editor such as the Gimp.\n\nClick \"Load Theme Cache\" to load the changed images and colors back into Audacity.\n\n[Only the control toolbar and the colors on the wavetrack are currently affected, even\nthough the image file shows other icons too.]")
_("Themability is an experimental feature.\n\nTo try it out, click \"Save Theme Cache\" then find and modify the images and colors in\nImageCacheVxx.png using an image editor such as the Gimp.\n\nClick \"Load Theme Cache\" to load the changed images and colors back into Audacity.\n\n(Only the control toolbar and the colors on the wavetrack are currently affected, even\nthough the image file shows other icons too.)")
);
#ifdef __WXDEBUG__