2007-03-27 17:47:10 +00:00
|
|
|
/*
|
|
|
|
* CiderPress
|
|
|
|
* Copyright (C) 2007 by faddenSoft, LLC. All Rights Reserved.
|
|
|
|
* See the file LICENSE for distribution terms.
|
|
|
|
*/
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include "ConvDiskOptionsDialog.h"
|
|
|
|
#include "NufxArchive.h"
|
|
|
|
#include "Main.h"
|
|
|
|
#include "ActionProgressDialog.h"
|
|
|
|
#include "DiskArchive.h"
|
|
|
|
#include "NewDiskSize.h"
|
2014-11-04 00:26:53 +00:00
|
|
|
#include "../diskimg/DiskImgDetail.h" // need ProDOS filename validator
|
2007-03-27 17:47:10 +00:00
|
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(ConvDiskOptionsDialog, CDialog)
|
2014-11-04 00:26:53 +00:00
|
|
|
ON_WM_HELPINFO()
|
|
|
|
ON_BN_CLICKED(IDC_CONVDISK_COMPUTE, OnCompute)
|
|
|
|
ON_BN_CLICKED(IDC_USE_SELECTED, ResetSizeControls)
|
|
|
|
ON_BN_CLICKED(IDC_USE_ALL, ResetSizeControls)
|
|
|
|
//ON_BN_CLICKED(IDC_CONVDISK_SPARSE, ResetSizeControls)
|
|
|
|
ON_CONTROL_RANGE(BN_CLICKED, IDC_CONVDISK_140K, IDC_CONVDISK_SPECIFY,
|
|
|
|
OnRadioChangeRange)
|
2007-03-27 17:47:10 +00:00
|
|
|
END_MESSAGE_MAP()
|
|
|
|
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
// TODO: get this from DiskImgLib header?
|
2014-11-04 00:26:53 +00:00
|
|
|
const int kProDOSVolNameMax = 15; // longest possible ProDOS volume name
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
BOOL ConvDiskOptionsDialog::OnInitDialog(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
CEdit* pEdit = (CEdit*) GetDlgItem(IDC_CONVDISK_VOLNAME);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pEdit != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
pEdit->SetLimitText(kProDOSVolNameMax);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
ResetSizeControls();
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
pEdit = (CEdit*) GetDlgItem(IDC_CONVDISK_SPECIFY_EDIT);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pEdit != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
pEdit->SetLimitText(5); // enough for "65535"
|
|
|
|
pEdit->EnableWindow(FALSE);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
return UseSelectionDialog::OnInitDialog();
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void ConvDiskOptionsDialog::DoDataExchange(CDataExchange* pDX)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
UINT specifyBlocks = 280;
|
|
|
|
CString errMsg;
|
|
|
|
|
|
|
|
DDX_Radio(pDX, IDC_CONVDISK_140K, fDiskSizeIdx);
|
|
|
|
//DDX_Check(pDX, IDC_CONVDISK_ALLOWLOWER, fAllowLower);
|
|
|
|
//DDX_Check(pDX, IDC_CONVDISK_SPARSE, fSparseAlloc);
|
|
|
|
DDX_Text(pDX, IDC_CONVDISK_VOLNAME, fVolName);
|
|
|
|
DDX_Text(pDX, IDC_CONVDISK_SPECIFY_EDIT, specifyBlocks);
|
|
|
|
|
|
|
|
ASSERT(fDiskSizeIdx >= 0 && fDiskSizeIdx < (int)NewDiskSize::GetNumSizeEntries());
|
|
|
|
|
|
|
|
if (pDX->m_bSaveAndValidate) {
|
|
|
|
|
|
|
|
fNumBlocks = NewDiskSize::GetDiskSizeByIndex(fDiskSizeIdx);
|
|
|
|
if (fNumBlocks == NewDiskSize::kSpecified) {
|
|
|
|
fNumBlocks = specifyBlocks;
|
|
|
|
|
|
|
|
// Max is really 65535, but we allow 65536 for creation of volumes
|
|
|
|
// that can be copied to CFFA cards.
|
|
|
|
if (specifyBlocks < 16 || specifyBlocks > 65536)
|
|
|
|
errMsg = "Specify a size of at least 16 blocks and no more"
|
|
|
|
" than 65536 blocks.";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (fVolName.IsEmpty() || fVolName.GetLength() > kProDOSVolNameMax) {
|
|
|
|
errMsg = "You must specify a volume name 1-15 characters long.";
|
|
|
|
} else {
|
|
|
|
if (!IsValidVolumeName_ProDOS(fVolName))
|
|
|
|
errMsg.LoadString(IDS_VALID_VOLNAME_PRODOS);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!errMsg.IsEmpty()) {
|
|
|
|
CString appName;
|
|
|
|
appName.LoadString(IDS_MB_APP_NAME);
|
|
|
|
MessageBox(errMsg, appName, MB_OK);
|
|
|
|
pDX->Fail();
|
|
|
|
}
|
|
|
|
|
|
|
|
UseSelectionDialog::DoDataExchange(pDX);
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void ConvDiskOptionsDialog::OnRadioChangeRange(UINT nID)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("OnChangeRange id=%d", nID);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
CButton* pButton = (CButton*) GetDlgItem(IDC_CONVDISK_SPECIFY);
|
|
|
|
CEdit* pEdit = (CEdit*) GetDlgItem(IDC_CONVDISK_SPECIFY_EDIT);
|
|
|
|
pEdit->EnableWindow(pButton->GetCheck() == BST_CHECKED);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
NewDiskSize::UpdateSpecifyEdit(this);
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
bool ConvDiskOptionsDialog::IsValidVolumeName_ProDOS(const WCHAR* name)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
CStringA nameA(name);
|
|
|
|
return DiskImgLib::DiskFSProDOS::IsValidVolumeName(nameA);
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void ConvDiskOptionsDialog::ResetSizeControls(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
CWnd* pWnd;
|
|
|
|
CString spaceReq;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("Resetting size controls");
|
2014-11-04 00:26:53 +00:00
|
|
|
spaceReq.Format(IDS_CONVDISK_SPACEREQ, "(unknown)");
|
|
|
|
pWnd = GetDlgItem(IDC_CONVDISK_SPACEREQ);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pWnd != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
pWnd->SetWindowText(spaceReq);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
|
|
|
#if 0
|
2014-11-04 00:26:53 +00:00
|
|
|
int i;
|
|
|
|
for (i = 0; i < NELEM(gDiskSizes); i++) {
|
|
|
|
pWnd = GetDlgItem(gDiskSizes[i].ctrlID);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pWnd != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
pWnd->EnableWindow(TRUE);
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
#endif
|
2014-11-04 00:26:53 +00:00
|
|
|
NewDiskSize::EnableButtons(this);
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void ConvDiskOptionsDialog::LimitSizeControls(long totalBlocks, long blocksUsed)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("LimitSizeControls %ld %ld", totalBlocks, blocksUsed);
|
|
|
|
LOGI("Full volume requires %ld bitmap blocks",
|
2014-11-04 00:26:53 +00:00
|
|
|
NewDiskSize::GetNumBitmapBlocks_ProDOS(totalBlocks));
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
CWnd* pWnd;
|
|
|
|
long usedWithoutBitmap =
|
|
|
|
blocksUsed - NewDiskSize::GetNumBitmapBlocks_ProDOS(totalBlocks);
|
|
|
|
long sizeInK = usedWithoutBitmap / 2;
|
|
|
|
CString sizeStr, spaceReq;
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
sizeStr.Format(L"%dK", sizeInK);
|
2014-11-04 00:26:53 +00:00
|
|
|
spaceReq.Format(IDS_CONVDISK_SPACEREQ, sizeStr);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
pWnd = GetDlgItem(IDC_CONVDISK_SPACEREQ);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pWnd != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
pWnd->SetWindowText(spaceReq);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
NewDiskSize::EnableButtons_ProDOS(this, totalBlocks, blocksUsed);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
|
|
|
#if 0
|
2014-11-04 00:26:53 +00:00
|
|
|
bool first = true;
|
|
|
|
for (int i = 0; i < NELEM(gDiskSizes); i++) {
|
|
|
|
if (gDiskSizes[i].blocks == -1)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
CButton* pButton;
|
|
|
|
pButton = (CButton*) GetDlgItem(gDiskSizes[i].ctrlID);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pButton != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
if (usedWithoutBitmap + GetNumBitmapBlocks(gDiskSizes[i].blocks) <=
|
|
|
|
gDiskSizes[i].blocks)
|
|
|
|
{
|
|
|
|
pButton->EnableWindow(TRUE);
|
|
|
|
if (first) {
|
|
|
|
pButton->SetCheck(BST_CHECKED);
|
|
|
|
first = false;
|
|
|
|
} else {
|
|
|
|
pButton->SetCheck(BST_UNCHECKED);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
pButton->EnableWindow(FALSE);
|
|
|
|
pButton->SetCheck(BST_UNCHECKED);
|
|
|
|
}
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void ConvDiskOptionsDialog::OnCompute(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
MainWindow* pMain = (MainWindow*)::AfxGetMainWnd();
|
|
|
|
const Preferences* pPreferences = GET_PREFERENCES();
|
|
|
|
|
|
|
|
if (UpdateData() == FALSE)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Create a "selection set" of data forks, resource forks, and
|
|
|
|
* disk images. We don't want comment threads. We can filter all that
|
|
|
|
* out later, though, so we just specify "any".
|
|
|
|
*/
|
|
|
|
SelectionSet selSet;
|
|
|
|
int threadMask = GenericEntry::kAnyThread;
|
|
|
|
|
|
|
|
if (fFilesToAction == UseSelectionDialog::kActionSelection) {
|
|
|
|
selSet.CreateFromSelection(pMain->GetContentList(), threadMask);
|
|
|
|
} else {
|
|
|
|
selSet.CreateFromAll(pMain->GetContentList(), threadMask);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (selSet.GetNumEntries() == 0) {
|
|
|
|
/* should be impossible */
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
MessageBox(L"No files matched the selection criteria.",
|
|
|
|
L"No match", MB_OK|MB_ICONEXCLAMATION);
|
2014-11-04 00:26:53 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
XferFileOptions xferOpts;
|
|
|
|
//xferOpts.fAllowLowerCase =
|
|
|
|
// pPreferences->GetPrefBool(kPrProDOSAllowLower) != 0;
|
|
|
|
//xferOpts.fUseSparseBlocks =
|
|
|
|
// pPreferences->GetPrefBool(kPrProDOSUseSparse) != 0;
|
|
|
|
|
2014-11-19 22:54:24 +00:00
|
|
|
LOGI("New volume name will be '%ls'", (LPCWSTR) fVolName);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Create a new disk image file.
|
|
|
|
*/
|
|
|
|
CString errStr;
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
WCHAR nameBuf[MAX_PATH];
|
2014-11-04 00:26:53 +00:00
|
|
|
UINT unique;
|
|
|
|
unique = GetTempFileName(pMain->GetPreferences()->GetPrefString(kPrTempPath),
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
L"CPdisk", 0, nameBuf);
|
2014-11-04 00:26:53 +00:00
|
|
|
if (unique == 0) {
|
|
|
|
DWORD dwerr = ::GetLastError();
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
errStr.Format(L"GetTempFileName failed on '%ls' (err=0x%08lx)\n",
|
2014-11-04 00:26:53 +00:00
|
|
|
pMain->GetPreferences()->GetPrefString(kPrTempPath), dwerr);
|
|
|
|
ShowFailureMsg(this, errStr, IDS_FAILED);
|
|
|
|
return;
|
|
|
|
}
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI(" Will xfer to file '%ls'", nameBuf);
|
2014-11-04 00:26:53 +00:00
|
|
|
// annoying -- DiskArchive insists on creating it
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
(void) _wunlink(nameBuf);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
DiskArchive::NewOptions options;
|
|
|
|
memset(&options, 0, sizeof(options));
|
|
|
|
options.base.format = DiskImg::kFormatProDOS;
|
|
|
|
options.base.sectorOrder = DiskImg::kSectorOrderProDOS;
|
|
|
|
options.prodos.volName = fVolName;
|
|
|
|
options.prodos.numBlocks = 65535;
|
|
|
|
|
|
|
|
xferOpts.fTarget = new DiskArchive;
|
|
|
|
|
|
|
|
{
|
|
|
|
CWaitCursor waitc;
|
|
|
|
errStr = xferOpts.fTarget->New(nameBuf, &options);
|
|
|
|
}
|
|
|
|
if (!errStr.IsEmpty()) {
|
|
|
|
ShowFailureMsg(this, errStr, IDS_FAILED);
|
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* Set up the progress window as a modal dialog.
|
|
|
|
*/
|
|
|
|
GenericArchive::XferStatus result;
|
|
|
|
|
|
|
|
ActionProgressDialog* pActionProgress = new ActionProgressDialog;
|
|
|
|
pMain->SetActionProgressDialog(pActionProgress);
|
|
|
|
pActionProgress->Create(ActionProgressDialog::kActionConvFile, this);
|
|
|
|
pMain->PeekAndPump();
|
|
|
|
result = pMain->GetOpenArchive()->XferSelection(pActionProgress, &selSet,
|
|
|
|
pActionProgress, &xferOpts);
|
|
|
|
pActionProgress->Cleanup(this);
|
2014-11-18 05:13:13 +00:00
|
|
|
pMain->SetActionProgressDialog(NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
if (result == GenericArchive::kXferOK) {
|
|
|
|
DiskFS* pDiskFS;
|
|
|
|
long totalBlocks, freeBlocks;
|
|
|
|
int unitSize;
|
|
|
|
DIError dierr;
|
|
|
|
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("SUCCESS");
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
pDiskFS = ((DiskArchive*) xferOpts.fTarget)->GetDiskFS();
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pDiskFS != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
dierr = pDiskFS->GetFreeSpaceCount(&totalBlocks, &freeBlocks,
|
|
|
|
&unitSize);
|
|
|
|
if (dierr != kDIErrNone) {
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
errStr.Format(L"Unable to get free space count: %hs.\n",
|
2014-11-04 00:26:53 +00:00
|
|
|
DiskImgLib::DIStrError(dierr));
|
|
|
|
ShowFailureMsg(this, errStr, IDS_FAILED);
|
|
|
|
} else {
|
|
|
|
ASSERT(totalBlocks >= freeBlocks);
|
|
|
|
ASSERT(unitSize == DiskImgLib::kBlockSize);
|
|
|
|
LimitSizeControls(totalBlocks, totalBlocks - freeBlocks);
|
|
|
|
}
|
|
|
|
} else if (result == GenericArchive::kXferCancelled) {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("CANCEL - cancel button hit");
|
2014-11-04 00:26:53 +00:00
|
|
|
ResetSizeControls();
|
|
|
|
} else {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("FAILURE (result=%d)", result);
|
2014-11-04 00:26:53 +00:00
|
|
|
ResetSizeControls();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// debug
|
|
|
|
((DiskArchive*) (xferOpts.fTarget))->GetDiskFS()->DumpFileList();
|
|
|
|
|
|
|
|
/* clean up */
|
|
|
|
delete xferOpts.fTarget;
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
(void) _wunlink(nameBuf);
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|