Update progress dialogs

Do the Mac OS Roman conversion in a couple of places.  Fix the
NuFX extraction progress, which got all blinky after the wide char
update.
This commit is contained in:
Andy McFadden 2015-01-15 15:33:12 -08:00
parent 650434f06b
commit b5169033a1
5 changed files with 62 additions and 47 deletions

View File

@ -248,6 +248,10 @@ void ConvDiskOptionsDialog::OnCompute(void)
} else { } else {
/* /*
* Set up the progress window as a modal dialog. * Set up the progress window as a modal dialog.
*
* TODO: there's a weird issue where this un-modals the conversion
* options dialog. While this is running, and after it finishes,
* you can use menu items and perform other actions. Noted on Win7.
*/ */
GenericArchive::XferStatus result; GenericArchive::XferStatus result;

View File

@ -1399,7 +1399,7 @@ NuResult DiskArchive::HandleReplaceExisting(const A2File* pExisting,
ConfirmOverwriteDialog confOvwr; ConfirmOverwriteDialog confOvwr;
confOvwr.fExistingFile = pExisting->GetPathName(); confOvwr.fExistingFile = Charset::ConvertMORToUNI(pExisting->GetPathName());
confOvwr.fExistingFileModWhen = pExisting->GetModWhen(); confOvwr.fExistingFileModWhen = pExisting->GetModWhen();
PathName srcPath(pDetails->GetLocalPathName()); PathName srcPath(pDetails->GetLocalPathName());
@ -1596,7 +1596,7 @@ CString DiskArchive::ProcessFileAddData(DiskFS* pDiskFS, int addOptsConvEOL)
/* really ought to do this separately for each thread */ /* really ought to do this separately for each thread */
SET_PROGRESS_BEGIN(); SET_PROGRESS_BEGIN();
CString pathNameW(parms.pathName); CString pathNameW(Charset::ConvertMORToUNI(parms.pathName));
SET_PROGRESS_UPDATE2(0, pDetails->GetLocalPathName(), pathNameW); SET_PROGRESS_UPDATE2(0, pDetails->GetLocalPathName(), pathNameW);
DIError dierr; DIError dierr;
@ -1604,8 +1604,8 @@ CString DiskArchive::ProcessFileAddData(DiskFS* pDiskFS, int addOptsConvEOL)
rsrcBuf, rsrcLen); rsrcBuf, rsrcLen);
SET_PROGRESS_END(); SET_PROGRESS_END();
if (dierr != kDIErrNone) { if (dierr != kDIErrNone) {
errMsg.Format(L"Unable to add '%hs' to image: %hs.", errMsg.Format(L"Unable to add '%ls' to image: %hs.",
parms.pathName, DiskImgLib::DIStrError(dierr)); (LPCWSTR) pathNameW, DiskImgLib::DIStrError(dierr));
goto bail; goto bail;
} }
delete[] dataBuf; delete[] dataBuf;
@ -2070,24 +2070,24 @@ bool DiskArchive::CreateSubdir(CWnd* pMsgWnd, GenericEntry* pParentEntry,
DIError dierr; DIError dierr;
A2File* pNewFile = NULL; A2File* pNewFile = NULL;
DiskFS::CreateParms parms; DiskFS::CreateParms parms;
CStringA pathName; CStringA pathNameMOR;
time_t now = time(NULL); time_t now = time(NULL);
/* /*
* Create the full path. * Create the full path.
*/ */
if (pFile->IsVolumeDirectory()) { if (pFile->IsVolumeDirectory()) {
pathName = newName; pathNameMOR = newName;
} else { } else {
pathName = pParentEntry->GetPathNameMOR(); pathNameMOR = pParentEntry->GetPathNameMOR();
pathName += pParentEntry->GetFssep(); pathNameMOR += pParentEntry->GetFssep();
pathName += newName; pathNameMOR += newName;
} }
ASSERT(wcschr(newName, pParentEntry->GetFssep()) == NULL); ASSERT(wcschr(newName, pParentEntry->GetFssep()) == NULL);
/* using NufxLib constants; they match with ProDOS */ /* using NufxLib constants; they match with ProDOS */
memset(&parms, 0, sizeof(parms)); memset(&parms, 0, sizeof(parms));
parms.pathName = pathName; parms.pathName = pathNameMOR;
parms.fssep = pParentEntry->GetFssep(); parms.fssep = pParentEntry->GetFssep();
parms.storageType = kNuStorageDirectory; parms.storageType = kNuStorageDirectory;
parms.fileType = 0x0f; // ProDOS DIR parms.fileType = 0x0f; // ProDOS DIR

View File

@ -609,6 +609,45 @@ static const struct {
* =========================================================================== * ===========================================================================
*/ */
void PathProposal::Init(GenericEntry* pEntry)
{
// TODO(Unicode)
//fStoredPathName = Charset::ConvertMORToUNI(pEntry->GetPathNameMOR());
// can't do this yet -- the rest of the extraction path isn't ready
fStoredPathName = pEntry->GetPathNameMOR();
fStoredFssep = pEntry->GetFssep();
//if (fStoredFssep == '\0') // e.g. embedded DOS 3.3 volume
// fStoredFssep = kDefaultStoredFssep;
fFileType = pEntry->GetFileType();
fAuxType = pEntry->GetAuxType();
//fThreadKind set from SelectionEntry
// reset the "output" fields
fLocalPathName = L":HOSED:";
fLocalFssep = ']';
// I expect these to be as-yet unset; check it
ASSERT(!fPreservation);
ASSERT(!fAddExtension);
ASSERT(!fJunkPaths);
}
// init the "add to archive" side
void PathProposal::Init(const WCHAR* localPathName) {
//ASSERT(basePathName[strlen(basePathName)-1] != kLocalFssep);
//fLocalPathName = localPathName + strlen(basePathName)+1;
fLocalPathName = localPathName;
fLocalFssep = kLocalFssep;
// reset the "output" fields
fStoredPathName = L":HOSED:";
fStoredFssep = '[';
fFileType = 0;
fAuxType = 0;
fThreadKind = GenericEntry::kDataThread;
// I expect these to be as-yet unset; check it
ASSERT(!fPreservation);
ASSERT(!fAddExtension);
ASSERT(!fJunkPaths);
}
void PathProposal::ArchiveToLocal(void) void PathProposal::ArchiveToLocal(void)
{ {
WCHAR* pathBuf; WCHAR* pathBuf;

View File

@ -5,6 +5,7 @@
*/ */
/* /*
* File name conversion. * File name conversion.
* TODO: rename to PathProposal.h
*/ */
#ifndef APP_FILENAMECONV_H #ifndef APP_FILENAMECONV_H
#define APP_FILENAMECONV_H #define APP_FILENAMECONV_H
@ -42,41 +43,10 @@ public:
virtual ~PathProposal(void) {} virtual ~PathProposal(void) {}
// init the "extract from archive" side from a GenericEntry struct // init the "extract from archive" side from a GenericEntry struct
void Init(GenericEntry* pEntry) { void Init(GenericEntry* pEntry);
// TODO(Unicode): use Unicode/MOR conversion rather than CP-1252
fStoredPathName = pEntry->GetPathNameMOR();
fStoredFssep = pEntry->GetFssep();
//if (fStoredFssep == '\0') // e.g. embedded DOS 3.3 volume
// fStoredFssep = kDefaultStoredFssep;
fFileType = pEntry->GetFileType();
fAuxType = pEntry->GetAuxType();
//fThreadKind set from SelectionEntry
// reset the "output" fields
fLocalPathName = L":HOSED:";
fLocalFssep = ']';
// I expect these to be as-yet unset; check it
ASSERT(!fPreservation);
ASSERT(!fAddExtension);
ASSERT(!fJunkPaths);
}
// init the "add to archive" side // init the "add to archive" side
void Init(const WCHAR* localPathName) { void Init(const WCHAR* localPathName);
//ASSERT(basePathName[strlen(basePathName)-1] != kLocalFssep);
//fLocalPathName = localPathName + strlen(basePathName)+1;
fLocalPathName = localPathName;
fLocalFssep = kLocalFssep;
// reset the "output" fields
fStoredPathName = L":HOSED:";
fStoredFssep = '[';
fFileType = 0;
fAuxType = 0;
fThreadKind = GenericEntry::kDataThread;
// I expect these to be as-yet unset; check it
ASSERT(!fPreservation);
ASSERT(!fAddExtension);
ASSERT(!fJunkPaths);
}
/* /*
* Convert a pathname pulled out of an archive to something suitable for the * Convert a pathname pulled out of an archive to something suitable for the

View File

@ -14,6 +14,7 @@
#include "AddClashDialog.h" #include "AddClashDialog.h"
#include "Main.h" #include "Main.h"
#include "../nufxlib/NufxLib.h" #include "../nufxlib/NufxLib.h"
#include "../reformat/Charset.h"
/* /*
* NufxLib doesn't currently allow an fssep of '\0', so we use this instead * NufxLib doesn't currently allow an fssep of '\0', so we use this instead
@ -499,6 +500,7 @@ NuResult NufxArchive::NufxErrorMsgHandler(NuArchive*, void* vErrorMessage)
(void) NuGetExtraData(pArchive, (void**) &pThis); (void) NuGetExtraData(pArchive, (void**) &pThis);
ASSERT(pThis != NULL); ASSERT(pThis != NULL);
// TODO(Unicode): NufxLib should be handing us these in UTF-16
oldName = newName = NULL; oldName = newName = NULL;
if (pProgress->operation == kNuOpAdd) { if (pProgress->operation == kNuOpAdd) {
oldName = pProgress->origPathnameUNI; oldName = pProgress->origPathnameUNI;
@ -522,10 +524,11 @@ NuResult NufxArchive::NufxErrorMsgHandler(NuArchive*, void* vErrorMessage)
// oldName == NULL ? "(null)" : oldName, // oldName == NULL ? "(null)" : oldName,
// newName == NULL ? "(null)" : newName); // newName == NULL ? "(null)" : newName);
//status = pMainWin->SetProgressUpdate(perc, oldName, newName);
CString oldNameW(oldName); CString oldNameW(oldName);
CString newNameW(newName); CString newNameW(newName);
status = SET_PROGRESS_UPDATE2(perc, oldNameW, newNameW); status = SET_PROGRESS_UPDATE2(perc,
oldNameW.IsEmpty() ? NULL : (LPCWSTR) oldNameW,
newNameW.IsEmpty() ? NULL : (LPCWSTR) newNameW);
/* check to see if user hit the "cancel" button on the progress dialog */ /* check to see if user hit the "cancel" button on the progress dialog */
if (pProgress->state == kNuProgressAborted) { if (pProgress->state == kNuProgressAborted) {
@ -1313,8 +1316,7 @@ NuResult NufxArchive::HandleReplaceExisting(const NuErrorStatus* pErrorStatus)
ConfirmOverwriteDialog confOvwr; ConfirmOverwriteDialog confOvwr;
PathName path(pErrorStatus->pathnameUNI); PathName path(pErrorStatus->pathnameUNI);
// TODO(Unicode): convert MOR to Unicode confOvwr.fExistingFile = Charset::ConvertMORToUNI(pErrorStatus->pRecord->filenameMOR);
confOvwr.fExistingFile = pErrorStatus->pRecord->filenameMOR;
confOvwr.fExistingFileModWhen = confOvwr.fExistingFileModWhen =
DateTimeToSeconds(&pErrorStatus->pRecord->recModWhen); DateTimeToSeconds(&pErrorStatus->pRecord->recModWhen);
if (pErrorStatus->origPathname != NULL) { if (pErrorStatus->origPathname != NULL) {