mirror of
https://github.com/fadden/ciderpress.git
synced 2025-01-02 00:29:40 +00:00
Simplify
This commit is contained in:
parent
8c34eb1213
commit
0861b7ead4
@ -183,9 +183,8 @@ void DiskArchiveInfoDialog::AddSubVolumes(const DiskFS* pDiskFS,
|
|||||||
/*
|
/*
|
||||||
* Add the current DiskFS.
|
* Add the current DiskFS.
|
||||||
*/
|
*/
|
||||||
CStringA volumeIdA(pDiskFS->GetVolumeID());
|
|
||||||
CString tmpStr(prefix);
|
CString tmpStr(prefix);
|
||||||
tmpStr += Charset::ConvertMORToUNI(volumeIdA);
|
tmpStr += Charset::ConvertMORToUNI(pDiskFS->GetVolumeID());
|
||||||
pCombo->AddString(tmpStr);
|
pCombo->AddString(tmpStr);
|
||||||
pCombo->SetItemData(*pIdx, (unsigned long) pDiskFS);
|
pCombo->SetItemData(*pIdx, (unsigned long) pDiskFS);
|
||||||
(*pIdx)++;
|
(*pIdx)++;
|
||||||
|
@ -892,8 +892,7 @@ CString DiskArchive::GetDescription() const
|
|||||||
CString str = L"Disk Image";
|
CString str = L"Disk Image";
|
||||||
|
|
||||||
if (fpPrimaryDiskFS != NULL && fpPrimaryDiskFS->GetVolumeID() != NULL) {
|
if (fpPrimaryDiskFS != NULL && fpPrimaryDiskFS->GetVolumeID() != NULL) {
|
||||||
CStringA volumeIdA(fpPrimaryDiskFS->GetVolumeID());
|
CString volumeId(Charset::ConvertMORToUNI(fpPrimaryDiskFS->GetVolumeID()));
|
||||||
CString volumeId(Charset::ConvertMORToUNI(volumeIdA));
|
|
||||||
str.Format(L"Disk Image - %ls", (LPCWSTR) volumeId);
|
str.Format(L"Disk Image - %ls", (LPCWSTR) volumeId);
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
@ -1090,12 +1089,11 @@ int DiskArchive::LoadDiskFSContents(DiskFS* pDiskFS, const WCHAR* volName)
|
|||||||
*/
|
*/
|
||||||
pSubVol = pDiskFS->GetNextSubVolume(NULL);
|
pSubVol = pDiskFS->GetNextSubVolume(NULL);
|
||||||
while (pSubVol != NULL) {
|
while (pSubVol != NULL) {
|
||||||
CStringA subVolNameMOR;
|
|
||||||
CString concatSubVolName;
|
CString concatSubVolName;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
subVolNameMOR = pSubVol->GetDiskFS()->GetVolumeName();
|
const char* subVolNameMOR = pSubVol->GetDiskFS()->GetVolumeName();
|
||||||
if (subVolNameMOR.IsEmpty()) {
|
if (subVolNameMOR == NULL) {
|
||||||
subVolNameMOR = "+++"; // call it *something*
|
subVolNameMOR = "+++"; // call it *something*
|
||||||
}
|
}
|
||||||
CString subVolName(Charset::ConvertMORToUNI(subVolNameMOR));
|
CString subVolName(Charset::ConvertMORToUNI(subVolNameMOR));
|
||||||
|
@ -132,8 +132,7 @@ BOOL DiskEditDialog::OnInitDialog(void)
|
|||||||
title += fFileName;
|
title += fFileName;
|
||||||
if (fpDiskFS->GetVolumeID() != NULL) {
|
if (fpDiskFS->GetVolumeID() != NULL) {
|
||||||
title += " (";
|
title += " (";
|
||||||
CStringA volumeIdA(fpDiskFS->GetVolumeID());
|
title += Charset::ConvertMORToUNI(fpDiskFS->GetVolumeID());
|
||||||
title += Charset::ConvertMORToUNI(volumeIdA);
|
|
||||||
title += ")";
|
title += ")";
|
||||||
}
|
}
|
||||||
SetWindowText(title);
|
SetWindowText(title);
|
||||||
@ -280,8 +279,7 @@ void DiskEditDialog::OnSubVolume(void)
|
|||||||
pEditDialog = &blockEdit;
|
pEditDialog = &blockEdit;
|
||||||
else
|
else
|
||||||
pEditDialog = §orEdit;
|
pEditDialog = §orEdit;
|
||||||
CStringA volumeIdA(fpDiskFS->GetVolumeID());
|
CString volumeId(Charset::ConvertMORToUNI(fpDiskFS->GetVolumeID()));
|
||||||
CString volumeId(Charset::ConvertMORToUNI(volumeIdA));
|
|
||||||
pEditDialog->Setup(pSubVol->GetDiskFS(), volumeId);
|
pEditDialog->Setup(pSubVol->GetDiskFS(), volumeId);
|
||||||
pEditDialog->SetPositionShift(8);
|
pEditDialog->SetPositionShift(8);
|
||||||
(void) pEditDialog->DoModal();
|
(void) pEditDialog->DoModal();
|
||||||
|
@ -43,8 +43,7 @@ bool DiskFSTree::AddDiskFS(CTreeCtrl* pTree, HTREEITEM parent,
|
|||||||
pTarget->pDiskFS = pDiskFS;
|
pTarget->pDiskFS = pDiskFS;
|
||||||
pTarget->pFile = NULL; // could also use volume dir for ProDOS
|
pTarget->pFile = NULL; // could also use volume dir for ProDOS
|
||||||
tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM;
|
tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM;
|
||||||
CStringA volumeIdA(pDiskFS->GetVolumeID());
|
CString volumeId(Charset::ConvertMORToUNI(pDiskFS->GetVolumeID()));
|
||||||
CString volumeId(Charset::ConvertMORToUNI(volumeIdA));
|
|
||||||
int index = fStringHolder.Add(volumeId);
|
int index = fStringHolder.Add(volumeId);
|
||||||
tvi.pszText = (LPWSTR)(LPCWSTR) fStringHolder.GetAt(index);
|
tvi.pszText = (LPWSTR)(LPCWSTR) fStringHolder.GetAt(index);
|
||||||
tvi.cchTextMax = 0; // not needed for insertitem
|
tvi.cchTextMax = 0; // not needed for insertitem
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#define kAppMajorVersion 4
|
#define kAppMajorVersion 4
|
||||||
#define kAppMinorVersion 0
|
#define kAppMinorVersion 0
|
||||||
#define kAppBugVersion 0
|
#define kAppBugVersion 0
|
||||||
#define kAppDevString L"b3"
|
#define kAppDevString L"-b3"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Windows application object.
|
* Windows application object.
|
||||||
|
@ -34,8 +34,7 @@ BOOL SubVolumeDialog::OnInitDialog(void)
|
|||||||
DiskFS::SubVolume* pSubVol = fpDiskFS->GetNextSubVolume(NULL);
|
DiskFS::SubVolume* pSubVol = fpDiskFS->GetNextSubVolume(NULL);
|
||||||
ASSERT(pSubVol != NULL); // shouldn't be here otherwise
|
ASSERT(pSubVol != NULL); // shouldn't be here otherwise
|
||||||
while (pSubVol != NULL) {
|
while (pSubVol != NULL) {
|
||||||
CStringA volumeIdA(pSubVol->GetDiskFS()->GetVolumeID());
|
CString volumeId(Charset::ConvertMORToUNI(pSubVol->GetDiskFS()->GetVolumeID()));
|
||||||
CString volumeId(Charset::ConvertMORToUNI(volumeIdA));
|
|
||||||
pListBox->AddString(volumeId); // makes a copy of the string
|
pListBox->AddString(volumeId); // makes a copy of the string
|
||||||
|
|
||||||
pSubVol = fpDiskFS->GetNextSubVolume(pSubVol);
|
pSubVol = fpDiskFS->GetNextSubVolume(pSubVol);
|
||||||
|
@ -334,8 +334,7 @@ void VolumeCopyDialog::AddToList(CListCtrl* pListView, DiskImg* pDiskImg,
|
|||||||
|
|
||||||
long numBlocks = pDiskImg->GetNumBlocks();
|
long numBlocks = pDiskImg->GetNumBlocks();
|
||||||
|
|
||||||
CStringA volNameA = pDiskFS->GetVolumeName();
|
CString volName(Charset::ConvertMORToUNI(pDiskFS->GetVolumeName()));
|
||||||
CString volName(Charset::ConvertMORToUNI(volNameA));
|
|
||||||
CString format = DiskImg::ToString(pDiskImg->GetFSFormat());
|
CString format = DiskImg::ToString(pDiskImg->GetFSFormat());
|
||||||
blocksStr.Format(L"%ld", pDiskImg->GetNumBlocks());
|
blocksStr.Format(L"%ld", pDiskImg->GetNumBlocks());
|
||||||
if (numBlocks > 1024*1024*2)
|
if (numBlocks > 1024*1024*2)
|
||||||
@ -400,8 +399,7 @@ void VolumeCopyDialog::OnCopyToFile(void)
|
|||||||
assert(pSrcImg != NULL);
|
assert(pSrcImg != NULL);
|
||||||
assert(pSrcFS != NULL);
|
assert(pSrcFS != NULL);
|
||||||
|
|
||||||
CStringA srcNameA = pSrcFS->GetVolumeName();
|
CString srcName(Charset::ConvertMORToUNI(pSrcFS->GetVolumeName()));
|
||||||
CString srcName(Charset::ConvertMORToUNI(srcNameA));
|
|
||||||
|
|
||||||
/* force the format to be generic ProDOS-ordered blocks */
|
/* force the format to be generic ProDOS-ordered blocks */
|
||||||
originalFormat = pSrcImg->GetFSFormat();
|
originalFormat = pSrcImg->GetFSFormat();
|
||||||
@ -586,8 +584,7 @@ void VolumeCopyDialog::OnCopyFromFile(void)
|
|||||||
if (!result)
|
if (!result)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CStringA targetNameA = pDstFS->GetVolumeName();
|
CString targetName(Charset::ConvertMORToUNI(pDstFS->GetVolumeName()));
|
||||||
CString targetName(Charset::ConvertMORToUNI(targetNameA));
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -28,14 +28,14 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Simple Mac OS Roman to Unicode string conversion.
|
// Simple Mac OS Roman to Unicode string conversion.
|
||||||
static CString ConvertMORToUNI(const CStringA& strMOR)
|
static CString ConvertMORToUNI(const char* strMOR)
|
||||||
{
|
{
|
||||||
// We know that all MOR characters are represented in Unicode with a
|
// We know that all MOR characters are represented in Unicode with a
|
||||||
// single BMP code point, so we know that strlen(MOR) == wcslen(UNI).
|
// single BMP code point, so we know that strlen(MOR) == wcslen(UNI).
|
||||||
const int len = strMOR.GetLength();
|
const size_t len = strlen(strMOR);
|
||||||
CString strUNI;
|
CString strUNI;
|
||||||
WCHAR* uniBuf = strUNI.GetBuffer(len);
|
WCHAR* uniBuf = strUNI.GetBuffer(len);
|
||||||
for (int i = 0; i < len; i++) {
|
for (size_t i = 0; i < len; i++) {
|
||||||
uniBuf[i] = Charset::ConvertMacRomanToUTF16(strMOR[i]);
|
uniBuf[i] = Charset::ConvertMacRomanToUTF16(strMOR[i]);
|
||||||
}
|
}
|
||||||
strUNI.ReleaseBuffer(len);
|
strUNI.ReleaseBuffer(len);
|
||||||
|
Loading…
Reference in New Issue
Block a user