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.
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* Dialog that allows copying volumes or sub-volumes to and from files on
|
|
|
|
* disk.
|
|
|
|
*
|
|
|
|
* NOTE: we probably shouldn't allow copying volumes that start at block 0
|
|
|
|
* and are equal to the DiskImgLib limit on sizes (e.g. 8GB). We'd be
|
|
|
|
* copying a partial volume, which doesn't make sense.
|
|
|
|
*/
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include "VolumeCopyDialog.h"
|
|
|
|
#include "Main.h"
|
2015-01-15 18:48:35 +00:00
|
|
|
#include "../reformat/Charset.h"
|
2007-03-27 17:47:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(VolumeCopyDialog, CDialog)
|
2014-11-04 00:26:53 +00:00
|
|
|
ON_COMMAND(IDHELP, OnHelp)
|
|
|
|
ON_COMMAND(IDC_VOLUEMCOPYSEL_TOFILE, OnCopyToFile)
|
|
|
|
ON_COMMAND(IDC_VOLUEMCOPYSEL_FROMFILE, OnCopyFromFile)
|
|
|
|
ON_NOTIFY(LVN_ITEMCHANGED, IDC_VOLUMECOPYSEL_LIST, OnListChange)
|
|
|
|
ON_MESSAGE(WMU_DIALOG_READY, OnDialogReady)
|
2007-03-27 17:47:10 +00:00
|
|
|
END_MESSAGE_MAP()
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Sub-class the generic libutil CancelDialog class.
|
|
|
|
*/
|
|
|
|
class VolumeXferProgressDialog : public ProgressCancelDialog {
|
|
|
|
public:
|
2014-11-04 00:26:53 +00:00
|
|
|
BOOL Create(CWnd* pParentWnd = NULL) {
|
|
|
|
fAbortOperation = false;
|
|
|
|
return ProgressCancelDialog::Create(&fAbortOperation,
|
|
|
|
IDD_VOLUMECOPYPROG, IDC_VOLUMECOPYPROG_PROGRESS, pParentWnd);
|
|
|
|
}
|
|
|
|
|
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 SetCurrentFiles(const WCHAR* fromName, const WCHAR* toName) {
|
2014-11-04 00:26:53 +00:00
|
|
|
CWnd* pWnd = GetDlgItem(IDC_VOLUMECOPYPROG_FROM);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pWnd != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
pWnd->SetWindowText(fromName);
|
|
|
|
pWnd = GetDlgItem(IDC_VOLUMECOPYPROG_TO);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pWnd != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
pWnd->SetWindowText(toName);
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
|
|
|
|
private:
|
2014-11-21 21:18:20 +00:00
|
|
|
void OnOK(void) override {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("Ignoring VolumeXferProgressDialog OnOK");
|
2014-11-04 00:26:53 +00:00
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
MainWindow* GetMainWindow(void) const {
|
|
|
|
return (MainWindow*)::AfxGetMainWnd();
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
bool fAbortOperation;
|
2007-03-27 17:47:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
BOOL VolumeCopyDialog::OnInitDialog(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-21 21:18:20 +00:00
|
|
|
/*
|
|
|
|
* Scan the source image.
|
|
|
|
*/
|
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
CRect rect;
|
|
|
|
|
|
|
|
//this->GetWindowRect(&rect);
|
2014-11-18 21:05:15 +00:00
|
|
|
//LOGI("RECT is %d, %d, %d, %d", rect.left, rect.top, rect.bottom, rect.right);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(fpDiskImg != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
ScanDiskInfo(false);
|
|
|
|
|
|
|
|
CDialog::OnInitDialog(); // does DDX init
|
|
|
|
|
|
|
|
CButton* pButton;
|
|
|
|
pButton = (CButton*) GetDlgItem(IDC_VOLUEMCOPYSEL_FROMFILE);
|
|
|
|
pButton->EnableWindow(FALSE);
|
|
|
|
pButton = (CButton*) GetDlgItem(IDC_VOLUEMCOPYSEL_TOFILE);
|
|
|
|
pButton->EnableWindow(FALSE);
|
|
|
|
|
|
|
|
CString newTitle;
|
|
|
|
GetWindowText(newTitle);
|
|
|
|
newTitle += " - ";
|
|
|
|
newTitle += fPathName;
|
|
|
|
SetWindowText(newTitle);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Prep the listview control.
|
|
|
|
*
|
|
|
|
* Columns:
|
|
|
|
* [icon] Volume name | Format | Size (MB/GB) | Block count
|
|
|
|
*/
|
|
|
|
CListCtrl* pListView = (CListCtrl*) GetDlgItem(IDC_VOLUMECOPYSEL_LIST);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pListView != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
ListView_SetExtendedListViewStyleEx(pListView->m_hWnd,
|
|
|
|
LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT);
|
|
|
|
|
|
|
|
int width1, width2, width3;
|
|
|
|
//CRect rect;
|
|
|
|
|
|
|
|
pListView->GetClientRect(&rect);
|
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
|
|
|
width1 = pListView->GetStringWidth(L"XXVolume NameXXmmmmm");
|
|
|
|
width2 = pListView->GetStringWidth(L"XXFormatXXmmmmmmmmmm");
|
|
|
|
width3 = pListView->GetStringWidth(L"XXSizeXXmmm");
|
2014-11-04 00:26:53 +00:00
|
|
|
//width4 = pListView->GetStringWidth("XXBlock CountXX");
|
|
|
|
|
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
|
|
|
pListView->InsertColumn(0, L"Volume Name", LVCFMT_LEFT, width1);
|
|
|
|
pListView->InsertColumn(1, L"Format", LVCFMT_LEFT, width2);
|
|
|
|
pListView->InsertColumn(2, L"Size", LVCFMT_LEFT, width3);
|
|
|
|
pListView->InsertColumn(3, L"Block Count", LVCFMT_LEFT,
|
2014-11-04 00:26:53 +00:00
|
|
|
rect.Width() - (width1+width2+width3)
|
|
|
|
- ::GetSystemMetrics(SM_CXVSCROLL) );
|
|
|
|
|
|
|
|
/* add images for list; this MUST be loaded before header images */
|
|
|
|
LoadListImages();
|
|
|
|
pListView->SetImageList(&fListImageList, LVSIL_SMALL);
|
|
|
|
|
|
|
|
LoadList();
|
|
|
|
|
|
|
|
CenterWindow();
|
|
|
|
|
|
|
|
int cc = PostMessage(WMU_DIALOG_READY, 0, 0);
|
|
|
|
ASSERT(cc != 0);
|
|
|
|
|
|
|
|
return TRUE;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void VolumeCopyDialog::OnOK(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-21 21:18:20 +00:00
|
|
|
/*
|
|
|
|
* We need to make sure we throw out the DiskFS we created before the modal
|
|
|
|
* dialog exits. This is necessary because we rely on an external DiskImg,
|
|
|
|
* and create DiskFS objects that point to it.
|
|
|
|
*/
|
2014-11-04 00:26:53 +00:00
|
|
|
Cleanup();
|
|
|
|
CDialog::OnOK();
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
2014-11-21 21:18:20 +00:00
|
|
|
|
|
|
|
void VolumeCopyDialog::OnCancel(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
Cleanup();
|
|
|
|
CDialog::OnCancel();
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
2014-11-21 21:18:20 +00:00
|
|
|
|
|
|
|
void VolumeCopyDialog::Cleanup(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-21 21:18:20 +00:00
|
|
|
LOGD(" VolumeCopyDialog is done, cleaning up DiskFS");
|
2014-11-04 00:26:53 +00:00
|
|
|
delete fpDiskFS;
|
2014-11-18 05:13:13 +00:00
|
|
|
fpDiskFS = NULL;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void VolumeCopyDialog::OnListChange(NMHDR*, LRESULT* pResult)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
//CRect rect;
|
|
|
|
//this->GetWindowRect(&rect);
|
2014-11-18 21:05:15 +00:00
|
|
|
//LOGI("RECT is %d, %d, %d, %d", rect.left, rect.top, rect.bottom, rect.right);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
CListCtrl* pListView = (CListCtrl*) GetDlgItem(IDC_VOLUMECOPYSEL_LIST);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pListView != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
CButton* pButton;
|
|
|
|
UINT selectedCount;
|
|
|
|
|
|
|
|
selectedCount = pListView->GetSelectedCount();
|
|
|
|
|
|
|
|
pButton = (CButton*) GetDlgItem(IDC_VOLUEMCOPYSEL_TOFILE);
|
|
|
|
pButton->EnableWindow(selectedCount != 0);
|
|
|
|
|
|
|
|
if (!fpDiskImg->GetReadOnly()) {
|
|
|
|
pButton = (CButton*) GetDlgItem(IDC_VOLUEMCOPYSEL_FROMFILE);
|
|
|
|
pButton->EnableWindow(selectedCount != 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
*pResult = 0;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void VolumeCopyDialog::ScanDiskInfo(bool scanTop)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-21 21:18:20 +00:00
|
|
|
/*
|
|
|
|
* The top-level disk image should already have been analyzed and the
|
|
|
|
* format overridden (if necessary). We don't want to do it in here the
|
|
|
|
* first time around because the "override" dialog screws up placement
|
|
|
|
* of our dialog box. I guess opening windows from inside OnInitDialog
|
|
|
|
* isn't expected. Annoying. [Um, maybe we could call CenterWindow??
|
|
|
|
* Actually, now I'm a little concerned about modal dialogs coming and
|
|
|
|
* going while we're in OnInitDialog, because MainWindow is disabled and
|
|
|
|
* we're not yet enabled. ++ATM]
|
|
|
|
*/
|
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
const Preferences* pPreferences = GET_PREFERENCES();
|
|
|
|
MainWindow* pMain = (MainWindow*)::AfxGetMainWnd();
|
|
|
|
DIError dierr;
|
|
|
|
CString errMsg, failed;
|
|
|
|
|
2014-11-18 05:13:13 +00:00
|
|
|
assert(fpDiskImg != NULL);
|
|
|
|
assert(fpDiskFS == NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
if (scanTop) {
|
|
|
|
DiskImg::FSFormat oldFormat;
|
|
|
|
oldFormat = fpDiskImg->GetFSFormat();
|
|
|
|
|
|
|
|
/* check to see if the top-level FS has changed */
|
|
|
|
fpDiskImg->AnalyzeImageFS();
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If requested (or necessary), verify the format. We only do this
|
|
|
|
* if we think the format has changed. This is possible, e.g. if
|
|
|
|
* somebody drops an MS-DOS volume into the first partition of a
|
|
|
|
* CFFA disk.
|
|
|
|
*/
|
|
|
|
if (oldFormat != fpDiskImg->GetFSFormat() &&
|
|
|
|
(fpDiskImg->GetFSFormat() == DiskImg::kFormatUnknown ||
|
|
|
|
fpDiskImg->GetSectorOrder() == DiskImg::kSectorOrderUnknown ||
|
|
|
|
pPreferences->GetPrefBool(kPrQueryImageFormat)))
|
|
|
|
{
|
|
|
|
// ignore them if they hit "cancel"
|
|
|
|
(void) pMain->TryDiskImgOverride(fpDiskImg, fPathName,
|
2014-11-18 05:13:13 +00:00
|
|
|
DiskImg::kFormatUnknown, NULL, true, &errMsg);
|
2014-11-04 00:26:53 +00:00
|
|
|
if (!errMsg.IsEmpty()) {
|
|
|
|
ShowFailureMsg(this, errMsg, IDS_FAILED);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Creating the "busy" window here is problematic, because we get called
|
|
|
|
* from OnInitDialog, at which point our window isn't yet established.
|
|
|
|
* Since we're modal, we disabled MainWindow, which means that when the
|
|
|
|
* "busy" box goes away there's no CiderPress window to take control. As
|
|
|
|
* a result we get a nasty flash.
|
|
|
|
*
|
|
|
|
* The only way around this is to defer the destruction of the modeless
|
|
|
|
* dialog until after we become visible.
|
|
|
|
*/
|
|
|
|
bool deferDestroy = false;
|
|
|
|
if (!IsWindowVisible() || !IsWindowEnabled()) {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI(" Deferring destroy on wait dialog");
|
2014-11-04 00:26:53 +00:00
|
|
|
deferDestroy = true;
|
|
|
|
} else {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI(" Not deferring destroy on wait dialog");
|
2014-11-04 00:26:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fpWaitDlg = new ExclusiveModelessDialog;
|
|
|
|
fpWaitDlg->Create(IDD_LOADING, this);
|
|
|
|
fpWaitDlg->CenterWindow(pMain);
|
|
|
|
pMain->PeekAndPump();
|
|
|
|
|
|
|
|
CWaitCursor waitc;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Create an appropriate DiskFS object. We only need to do this to get
|
|
|
|
* the sub-volume info, which is unfortunate since it can be slow.
|
|
|
|
*/
|
|
|
|
fpDiskFS = fpDiskImg->OpenAppropriateDiskFS(true);
|
2014-11-18 05:13:13 +00:00
|
|
|
if (fpDiskFS == NULL) {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("HEY: OpenAppropriateDiskFS failed!");
|
2014-11-04 00:26:53 +00:00
|
|
|
/* this is fatal, but there's no easy way to die */
|
|
|
|
/* (could we do a DestroyWindow from here?) */
|
|
|
|
/* at any rate, with "allowUnknown" set, this shouldn't happen */
|
|
|
|
} else {
|
|
|
|
fpDiskFS->SetScanForSubVolumes(DiskFS::kScanSubContainerOnly);
|
|
|
|
|
|
|
|
dierr = fpDiskFS->Initialize(fpDiskImg, DiskFS::kInitFull);
|
|
|
|
if (dierr != kDIErrNone) {
|
|
|
|
CString appName, msg;
|
2014-12-16 19:04:31 +00:00
|
|
|
CheckedLoadString(&appName, IDS_MB_APP_NAME);
|
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
|
|
|
msg.Format(L"Warning: error during disk scan: %hs.",
|
2014-11-04 00:26:53 +00:00
|
|
|
DiskImgLib::DIStrError(dierr));
|
|
|
|
fpWaitDlg->MessageBox(msg, appName, MB_OK | MB_ICONEXCLAMATION);
|
|
|
|
/* keep going */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-11-18 05:13:13 +00:00
|
|
|
if (!deferDestroy && fpWaitDlg != NULL) {
|
2014-11-04 00:26:53 +00:00
|
|
|
fpWaitDlg->DestroyWindow();
|
2014-11-18 05:13:13 +00:00
|
|
|
fpWaitDlg = NULL;
|
2014-11-04 00:26:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
LONG VolumeCopyDialog::OnDialogReady(UINT, LONG)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 05:13:13 +00:00
|
|
|
if (fpWaitDlg != NULL) {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("OnDialogReady found active window, destroying");
|
2014-11-04 00:26:53 +00:00
|
|
|
fpWaitDlg->DestroyWindow();
|
2014-11-18 05:13:13 +00:00
|
|
|
fpWaitDlg = NULL;
|
2014-11-04 00:26:53 +00:00
|
|
|
}
|
|
|
|
return 0;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void VolumeCopyDialog::LoadList(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
CListCtrl* pListView = (CListCtrl*) GetDlgItem(IDC_VOLUMECOPYSEL_LIST);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pListView != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
int itemIndex = 0;
|
|
|
|
|
|
|
|
CString unknown = "(unknown)";
|
|
|
|
|
|
|
|
pListView->DeleteAllItems();
|
2014-11-18 05:13:13 +00:00
|
|
|
if (fpDiskFS == NULL) {
|
2014-11-04 00:26:53 +00:00
|
|
|
/* can only happen if imported volume is unrecognizeable */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
AddToList(pListView, fpDiskImg, fpDiskFS, &itemIndex);
|
|
|
|
|
|
|
|
DiskImgLib::DiskFS::SubVolume* pSubVolume;
|
2014-11-18 05:13:13 +00:00
|
|
|
pSubVolume = fpDiskFS->GetNextSubVolume(NULL);
|
|
|
|
while (pSubVolume != NULL) {
|
|
|
|
if (pSubVolume->GetDiskFS() == NULL) {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("WARNING: sub-volume DiskFS is NULL?!");
|
2014-11-04 00:26:53 +00:00
|
|
|
assert(false);
|
|
|
|
} else {
|
|
|
|
AddToList(pListView, pSubVolume->GetDiskImg(),
|
|
|
|
pSubVolume->GetDiskFS(), &itemIndex);
|
|
|
|
}
|
|
|
|
pSubVolume = fpDiskFS->GetNextSubVolume(pSubVolume);
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void VolumeCopyDialog::AddToList(CListCtrl* pListView, DiskImg* pDiskImg,
|
2014-11-04 00:26:53 +00:00
|
|
|
DiskFS* pDiskFS, int* pIndex)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2015-01-15 18:48:35 +00:00
|
|
|
CString sizeStr, blocksStr;
|
2014-11-04 00:26:53 +00:00
|
|
|
|
2014-11-18 05:13:13 +00:00
|
|
|
assert(pListView != NULL);
|
|
|
|
assert(pDiskImg != NULL);
|
|
|
|
assert(pDiskFS != NULL);
|
|
|
|
assert(pIndex != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
2015-01-15 18:48:35 +00:00
|
|
|
long numBlocks = pDiskImg->GetNumBlocks();
|
2014-11-04 00:26:53 +00:00
|
|
|
|
2015-01-15 22:21:01 +00:00
|
|
|
CString volName(Charset::ConvertMORToUNI(pDiskFS->GetVolumeName()));
|
2015-01-15 18:48:35 +00:00
|
|
|
CString format = DiskImg::ToString(pDiskImg->GetFSFormat());
|
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
|
|
|
blocksStr.Format(L"%ld", pDiskImg->GetNumBlocks());
|
2014-11-04 00:26:53 +00:00
|
|
|
if (numBlocks > 1024*1024*2)
|
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"%.2fGB", (double) numBlocks / (1024.0*1024.0*2.0));
|
2014-11-04 00:26:53 +00:00
|
|
|
else if (numBlocks > 1024*2)
|
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"%.2fMB", (double) numBlocks / (1024.0*2.0));
|
2014-11-04 00:26:53 +00:00
|
|
|
else
|
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"%.2fKB", (double) numBlocks / 2.0);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
/* add entry; first entry is the whole volume */
|
|
|
|
pListView->InsertItem(*pIndex, volName,
|
|
|
|
*pIndex == 0 ? kListIconVolume : kListIconSubVolume);
|
|
|
|
pListView->SetItemText(*pIndex, 1, format);
|
|
|
|
pListView->SetItemText(*pIndex, 2, sizeStr);
|
|
|
|
pListView->SetItemText(*pIndex, 3, blocksStr);
|
|
|
|
pListView->SetItemData(*pIndex, (DWORD) pDiskFS);
|
|
|
|
(*pIndex)++;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
bool VolumeCopyDialog::GetSelectedDisk(DiskImg** ppDiskImg, DiskFS** ppDiskFS)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
CListCtrl* pListView = (CListCtrl*) GetDlgItem(IDC_VOLUMECOPYSEL_LIST);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pListView != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(ppDiskImg != NULL);
|
|
|
|
ASSERT(ppDiskFS != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
if (pListView->GetSelectedCount() != 1)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
POSITION posn;
|
|
|
|
posn = pListView->GetFirstSelectedItemPosition();
|
2014-11-18 05:13:13 +00:00
|
|
|
if (posn == NULL) {
|
2014-11-04 00:26:53 +00:00
|
|
|
ASSERT(false);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
int num = pListView->GetNextSelectedItem(posn);
|
|
|
|
DWORD data = pListView->GetItemData(num);
|
|
|
|
|
|
|
|
*ppDiskFS = (DiskFS*) data;
|
2014-11-18 05:13:13 +00:00
|
|
|
assert(*ppDiskFS != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
*ppDiskImg = (*ppDiskFS)->GetDiskImg();
|
|
|
|
return true;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void VolumeCopyDialog::OnCopyToFile(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 05:13:13 +00:00
|
|
|
VolumeXferProgressDialog* pProgressDialog = NULL;
|
2014-11-04 00:26:53 +00:00
|
|
|
Preferences* pPreferences = GET_PREFERENCES_WR();
|
|
|
|
MainWindow* pMain = (MainWindow*)::AfxGetMainWnd();
|
|
|
|
DiskImg::FSFormat originalFormat = DiskImg::kFormatUnknown;
|
2014-11-18 05:13:13 +00:00
|
|
|
DiskImg* pSrcImg = NULL;
|
|
|
|
DiskFS* pSrcFS = NULL;
|
2014-11-04 00:26:53 +00:00
|
|
|
DiskImg dstImg;
|
|
|
|
DIError dierr;
|
2015-01-15 18:48:35 +00:00
|
|
|
CString errMsg, saveName, msg;
|
2014-11-04 00:26:53 +00:00
|
|
|
int result;
|
|
|
|
|
|
|
|
result = GetSelectedDisk(&pSrcImg, &pSrcFS);
|
|
|
|
if (!result)
|
|
|
|
return;
|
2014-11-18 05:13:13 +00:00
|
|
|
assert(pSrcImg != NULL);
|
|
|
|
assert(pSrcFS != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
2015-01-15 22:21:01 +00:00
|
|
|
CString srcName(Charset::ConvertMORToUNI(pSrcFS->GetVolumeName()));
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
/* force the format to be generic ProDOS-ordered blocks */
|
|
|
|
originalFormat = pSrcImg->GetFSFormat();
|
|
|
|
dierr = pSrcImg->OverrideFormat(pSrcImg->GetPhysicalFormat(),
|
|
|
|
DiskImg::kFormatGenericProDOSOrd, pSrcImg->GetSectorOrder());
|
|
|
|
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
|
|
|
errMsg.Format(L"Internal error: couldn't switch to generic ProDOS: %hs.",
|
2014-11-04 00:26:53 +00:00
|
|
|
DiskImgLib::DIStrError(dierr));
|
|
|
|
ShowFailureMsg(this, errMsg, IDS_FAILED);
|
|
|
|
goto bail;
|
|
|
|
}
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("Logical volume '%ls' has %d 512-byte blocks",
|
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
|
|
|
(LPCWSTR) srcName, pSrcImg->GetNumBlocks());
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Select file to write blocks to.
|
|
|
|
*/
|
|
|
|
{
|
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
|
|
|
CFileDialog saveDlg(FALSE, L"po", NULL,
|
2014-11-04 00:26:53 +00:00
|
|
|
OFN_OVERWRITEPROMPT|OFN_NOREADONLYRETURN|OFN_HIDEREADONLY,
|
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"All Files (*.*)|*.*||", this);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
CString saveFolder;
|
|
|
|
|
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
|
|
|
saveDlg.m_ofn.lpstrTitle = L"New disk image (.po)";
|
2014-11-04 00:26:53 +00:00
|
|
|
saveDlg.m_ofn.lpstrInitialDir =
|
|
|
|
pPreferences->GetPrefString(kPrOpenArchiveFolder);
|
|
|
|
|
|
|
|
if (saveDlg.DoModal() != IDOK) {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI(" User bailed out of image save dialog");
|
2014-11-04 00:26:53 +00:00
|
|
|
goto bail;
|
|
|
|
}
|
|
|
|
|
|
|
|
saveFolder = saveDlg.m_ofn.lpstrFile;
|
|
|
|
saveFolder = saveFolder.Left(saveDlg.m_ofn.nFileOffset);
|
|
|
|
pPreferences->SetPrefString(kPrOpenArchiveFolder, saveFolder);
|
|
|
|
|
|
|
|
saveName = saveDlg.GetPathName();
|
|
|
|
}
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("File will be saved to '%ls'", (LPCWSTR) saveName);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
/* DiskImgLib does not like it if file already exists */
|
|
|
|
errMsg = pMain->RemoveFile(saveName);
|
|
|
|
if (!errMsg.IsEmpty()) {
|
|
|
|
ShowFailureMsg(this, errMsg, IDS_FAILED);
|
|
|
|
goto bail;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Create a block image with the expected number of blocks.
|
|
|
|
*/
|
|
|
|
int dstNumBlocks;
|
|
|
|
dstNumBlocks = pSrcImg->GetNumBlocks();
|
|
|
|
|
|
|
|
{
|
|
|
|
ExclusiveModelessDialog* pWaitDlg = new ExclusiveModelessDialog;
|
|
|
|
pWaitDlg->Create(IDD_FORMATTING, this);
|
|
|
|
pWaitDlg->CenterWindow(pMain);
|
|
|
|
pMain->PeekAndPump(); // redraw
|
|
|
|
CWaitCursor waitc;
|
|
|
|
|
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 saveNameA(saveName);
|
2014-11-18 05:13:13 +00:00
|
|
|
dierr = dstImg.CreateImage(saveNameA, NULL,
|
2014-11-04 00:26:53 +00:00
|
|
|
DiskImg::kOuterFormatNone,
|
|
|
|
DiskImg::kFileFormatUnadorned,
|
|
|
|
DiskImg::kPhysicalFormatSectors,
|
2014-11-18 05:13:13 +00:00
|
|
|
NULL,
|
2014-11-04 00:26:53 +00:00
|
|
|
DiskImg::kSectorOrderProDOS,
|
|
|
|
DiskImg::kFormatGenericProDOSOrd,
|
|
|
|
dstNumBlocks,
|
|
|
|
true /* don't need to erase contents */);
|
|
|
|
|
|
|
|
pWaitDlg->DestroyWindow();
|
|
|
|
//pMain->PeekAndPump(); // redraw
|
|
|
|
}
|
|
|
|
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
|
|
|
errMsg.Format(L"Couldn't create disk image: %hs.",
|
2014-11-04 00:26:53 +00:00
|
|
|
DiskImgLib::DIStrError(dierr));
|
|
|
|
ShowFailureMsg(this, errMsg, IDS_FAILED);
|
|
|
|
goto bail;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* initialize cancel dialog, and disable main window */
|
|
|
|
pProgressDialog = new VolumeXferProgressDialog;
|
|
|
|
EnableWindow(FALSE);
|
|
|
|
if (pProgressDialog->Create(this) == FALSE) {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("Progress dialog init failed?!");
|
2014-11-04 00:26:53 +00:00
|
|
|
ASSERT(false);
|
|
|
|
goto bail;
|
|
|
|
}
|
|
|
|
pProgressDialog->SetCurrentFiles(srcName, saveName);
|
|
|
|
|
|
|
|
time_t startWhen, endWhen;
|
2014-11-18 05:13:13 +00:00
|
|
|
startWhen = time(NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Do the actual block copy.
|
|
|
|
*/
|
|
|
|
dierr = pMain->CopyDiskImage(&dstImg, pSrcImg, false, false, pProgressDialog);
|
|
|
|
if (dierr != kDIErrNone) {
|
|
|
|
if (dierr == kDIErrCancelled) {
|
2014-12-16 19:04:31 +00:00
|
|
|
CheckedLoadString(&errMsg, IDS_OPERATION_CANCELLED);
|
2014-11-04 00:26:53 +00:00
|
|
|
ShowFailureMsg(pProgressDialog, errMsg, IDS_CANCELLED);
|
|
|
|
// remove the partially-written file
|
|
|
|
dstImg.CloseImage();
|
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(saveName);
|
2014-11-04 00:26:53 +00:00
|
|
|
} else {
|
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
|
|
|
errMsg.Format(L"Copy failed: %hs.", DiskImgLib::DIStrError(dierr));
|
2014-11-04 00:26:53 +00:00
|
|
|
ShowFailureMsg(pProgressDialog, errMsg, IDS_FAILED);
|
|
|
|
}
|
|
|
|
goto bail;
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
|
|
|
|
dierr = dstImg.CloseImage();
|
|
|
|
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
|
|
|
errMsg.Format(L"ERROR: dstImg close failed (err=%d)\n", dierr);
|
2014-11-04 00:26:53 +00:00
|
|
|
ShowFailureMsg(pProgressDialog, errMsg, IDS_FAILED);
|
|
|
|
goto bail;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* put elapsed time in the debug log */
|
2014-11-18 05:13:13 +00:00
|
|
|
endWhen = time(NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
float elapsed;
|
|
|
|
if (endWhen == startWhen)
|
|
|
|
elapsed = 1.0;
|
|
|
|
else
|
|
|
|
elapsed = (float) (endWhen - startWhen);
|
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
|
|
|
msg.Format(L"Copied %ld blocks in %ld seconds (%.2fKB/sec)",
|
2014-11-19 22:54:24 +00:00
|
|
|
pSrcImg->GetNumBlocks(), (long) (endWhen - startWhen),
|
2014-11-04 00:26:53 +00:00
|
|
|
(pSrcImg->GetNumBlocks() / 2.0) / elapsed);
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("%ls", (LPCWSTR) msg);
|
2007-03-27 17:47:10 +00:00
|
|
|
#ifdef _DEBUG
|
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
|
|
|
pProgressDialog->MessageBox(msg, L"DEBUG: elapsed time", MB_OK);
|
2007-03-27 17:47:10 +00:00
|
|
|
#endif
|
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
pMain->SuccessBeep();
|
2007-03-27 17:47:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
bail:
|
2014-11-04 00:26:53 +00:00
|
|
|
// restore the dialog window to prominence
|
|
|
|
EnableWindow(TRUE);
|
|
|
|
//SetActiveWindow();
|
2014-11-18 05:13:13 +00:00
|
|
|
if (pProgressDialog != NULL)
|
2014-11-04 00:26:53 +00:00
|
|
|
pProgressDialog->DestroyWindow();
|
|
|
|
|
|
|
|
/* un-override the source disk */
|
|
|
|
if (originalFormat != DiskImg::kFormatUnknown) {
|
|
|
|
dierr = pSrcImg->OverrideFormat(pSrcImg->GetPhysicalFormat(),
|
|
|
|
originalFormat, pSrcImg->GetSectorOrder());
|
|
|
|
if (dierr != kDIErrNone) {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("ERROR: couldn't un-override source image (dierr=%d)", dierr);
|
2014-11-04 00:26:53 +00:00
|
|
|
// not much else to do; should be okay
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void VolumeCopyDialog::OnCopyFromFile(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 05:13:13 +00:00
|
|
|
VolumeXferProgressDialog* pProgressDialog = NULL;
|
2014-11-04 00:26:53 +00:00
|
|
|
Preferences* pPreferences = GET_PREFERENCES_WR();
|
|
|
|
MainWindow* pMain = (MainWindow*)::AfxGetMainWnd();
|
|
|
|
//DiskImg::FSFormat originalFormat = DiskImg::kFormatUnknown;
|
|
|
|
CString openFilters;
|
2015-01-15 18:48:35 +00:00
|
|
|
CString loadName, errMsg, warning;
|
2014-11-18 05:13:13 +00:00
|
|
|
DiskImg* pDstImg = NULL;
|
|
|
|
DiskFS* pDstFS = NULL;
|
2014-11-04 00:26:53 +00:00
|
|
|
DiskImg srcImg;
|
|
|
|
DIError dierr;
|
|
|
|
int result;
|
|
|
|
bool needReload = false;
|
|
|
|
bool isPartial = false;
|
|
|
|
|
2014-12-16 19:04:31 +00:00
|
|
|
CheckedLoadString(&warning, IDS_WARNING);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Get the DiskImg and DiskFS pointers for the selected partition out of
|
|
|
|
* the control. The storage for these is part of fpDiskFS, which holds
|
|
|
|
* the tree of subvolumes.
|
|
|
|
*/
|
|
|
|
result = GetSelectedDisk(&pDstImg, &pDstFS);
|
|
|
|
if (!result)
|
|
|
|
return;
|
|
|
|
|
2015-01-15 22:21:01 +00:00
|
|
|
CString targetName(Charset::ConvertMORToUNI(pDstFS->GetVolumeName()));
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Select the image to copy from.
|
|
|
|
*/
|
|
|
|
openFilters = MainWindow::kOpenDiskImage;
|
|
|
|
openFilters += MainWindow::kOpenAll;
|
|
|
|
openFilters += MainWindow::kOpenEnd;
|
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
|
|
|
CFileDialog dlg(TRUE, L"dsk", NULL, OFN_FILEMUSTEXIST, openFilters, this);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
/* source file gets opened read-only */
|
|
|
|
dlg.m_ofn.Flags |= OFN_HIDEREADONLY;
|
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
|
|
|
dlg.m_ofn.lpstrTitle = L"Select image to copy from";
|
2014-11-04 00:26:53 +00:00
|
|
|
dlg.m_ofn.lpstrInitialDir = pPreferences->GetPrefString(kPrOpenArchiveFolder);
|
|
|
|
|
|
|
|
if (dlg.DoModal() != IDOK)
|
|
|
|
goto bail;
|
|
|
|
loadName = dlg.GetPathName();
|
|
|
|
|
|
|
|
{
|
|
|
|
CWaitCursor waitc;
|
|
|
|
CString saveFolder;
|
|
|
|
|
|
|
|
/* open the image file and analyze it */
|
2014-11-23 18:34:57 +00:00
|
|
|
CStringA loadNameA(loadName);
|
|
|
|
dierr = srcImg.OpenImage(loadNameA, PathProposal::kLocalFssep, true);
|
2014-11-04 00:26:53 +00:00
|
|
|
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
|
|
|
errMsg.Format(L"Unable to open disk image: %hs.",
|
2014-11-04 00:26:53 +00:00
|
|
|
DiskImgLib::DIStrError(dierr));
|
|
|
|
ShowFailureMsg(this, errMsg, IDS_FAILED);
|
|
|
|
goto bail;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (srcImg.AnalyzeImage() != 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
|
|
|
errMsg.Format(L"The file '%ls' doesn't seem to hold a valid disk image.",
|
|
|
|
(LPCWSTR) loadName);
|
2014-11-04 00:26:53 +00:00
|
|
|
ShowFailureMsg(this, errMsg, IDS_FAILED);
|
|
|
|
goto bail;
|
|
|
|
}
|
|
|
|
|
|
|
|
// save our folder choice in the preferences file
|
|
|
|
saveFolder = dlg.m_ofn.lpstrFile;
|
|
|
|
saveFolder = saveFolder.Left(dlg.m_ofn.nFileOffset);
|
|
|
|
pPreferences->SetPrefString(kPrOpenArchiveFolder, saveFolder);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Require that the input be block-addressable. This isn't really the
|
|
|
|
* right test, because it's conceivable that somebody would want to put
|
|
|
|
* a nibble image onto a disk volume. I can't think of a good reason
|
|
|
|
* to do this -- you can't just splat a fixed-track-length .NIB file
|
|
|
|
* onto a 5.25" disk, assuming you could get the drive to work on a PC
|
|
|
|
* in the first place -- so I'm going to take the simple way out. The
|
|
|
|
* right test is to verify that the EOF on the input is the same as the
|
|
|
|
* EOF on the output.
|
|
|
|
*/
|
|
|
|
if (!srcImg.GetHasBlocks()) {
|
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
|
|
|
errMsg = L"The disk image must be block-oriented. Nibble images"
|
|
|
|
L" cannot be copied.";
|
2014-11-04 00:26:53 +00:00
|
|
|
ShowFailureMsg(this, errMsg, IDS_FAILED);
|
|
|
|
goto bail;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* force source volume to generic ProDOS blocks */
|
|
|
|
dierr = srcImg.OverrideFormat(srcImg.GetPhysicalFormat(),
|
|
|
|
DiskImg::kFormatGenericProDOSOrd, srcImg.GetSectorOrder());
|
|
|
|
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
|
|
|
errMsg.Format(L"Internal error: couldn't switch source to generic ProDOS: %hs.",
|
2014-11-04 00:26:53 +00:00
|
|
|
DiskImgLib::DIStrError(dierr));
|
|
|
|
ShowFailureMsg(this, errMsg, IDS_FAILED);
|
|
|
|
goto bail;
|
|
|
|
}
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("Source image '%ls' has %d 512-byte blocks",
|
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
|
|
|
(LPCWSTR) loadName, srcImg.GetNumBlocks());
|
2014-11-04 00:26:53 +00:00
|
|
|
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("Target volume has %d 512-byte blocks", pDstImg->GetNumBlocks());
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
if (srcImg.GetNumBlocks() > pDstImg->GetNumBlocks()) {
|
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
|
|
|
errMsg.Format(L"Error: the disk image file has %ld blocks, but the"
|
|
|
|
L" target volume holds %ld blocks. The target must"
|
|
|
|
L" have more space than the input file.",
|
2014-11-04 00:26:53 +00:00
|
|
|
srcImg.GetNumBlocks(), pDstImg->GetNumBlocks());
|
|
|
|
ShowFailureMsg(this, errMsg, IDS_FAILED);
|
|
|
|
goto bail;
|
|
|
|
}
|
|
|
|
if (pDstImg->GetNumBlocks() >= DiskImgLib::kVolumeMaxBlocks) {
|
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
|
|
|
// TODO: re-evaluate this limitation
|
|
|
|
errMsg.Format(L"Error: for safety reasons, copying disk images to"
|
|
|
|
L" larger volumes is not supported when the target"
|
|
|
|
L" is 8GB or larger.");
|
2014-11-04 00:26:53 +00:00
|
|
|
ShowFailureMsg(this, errMsg, IDS_FAILED);
|
|
|
|
goto bail;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (srcImg.GetNumBlocks() != pDstImg->GetNumBlocks()) {
|
2014-12-16 19:04:31 +00:00
|
|
|
//errMsg.LoadString(IDS_WARNING);
|
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
|
|
|
errMsg.Format(L"The disk image file has %ld blocks, but the target"
|
|
|
|
L" volume holds %ld blocks. The leftover space may be"
|
|
|
|
L" wasted, and non-ProDOS volumes may not be identified"
|
|
|
|
L" correctly. Do you wish to continue?",
|
2014-11-04 00:26:53 +00:00
|
|
|
srcImg.GetNumBlocks(), pDstImg->GetNumBlocks());
|
|
|
|
result = MessageBox(errMsg, warning, MB_OKCANCEL | MB_ICONQUESTION);
|
|
|
|
if (result != IDOK) {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("User chickened out of oversized disk copy");
|
2014-11-04 00:26:53 +00:00
|
|
|
goto bail;
|
|
|
|
}
|
|
|
|
isPartial = true;
|
|
|
|
}
|
|
|
|
|
2014-12-16 19:04:31 +00:00
|
|
|
//errMsg.LoadString(IDS_WARNING);
|
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
|
|
|
errMsg.Format(L"You are about to overwrite volume %ls with the"
|
|
|
|
L" contents of '%ls'. This will destroy all data on"
|
|
|
|
L" %ls. Are you sure you wish to continue?",
|
|
|
|
(LPCWSTR) targetName, (LPCWSTR) loadName, (LPCWSTR) targetName);
|
2014-11-04 00:26:53 +00:00
|
|
|
result = MessageBox(errMsg, warning, MB_OKCANCEL | MB_ICONEXCLAMATION);
|
|
|
|
if (result != IDOK) {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("User chickened out of disk copy");
|
2014-11-04 00:26:53 +00:00
|
|
|
goto bail;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* force the target disk image to be generic ProDOS-ordered blocks */
|
|
|
|
dierr = pDstImg->OverrideFormat(pDstImg->GetPhysicalFormat(),
|
|
|
|
DiskImg::kFormatGenericProDOSOrd, pDstImg->GetSectorOrder());
|
|
|
|
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
|
|
|
errMsg.Format(L"Internal error: couldn't switch target to generic ProDOS: %hs.",
|
2014-11-04 00:26:53 +00:00
|
|
|
DiskImgLib::DIStrError(dierr));
|
|
|
|
ShowFailureMsg(this, errMsg, IDS_FAILED);
|
|
|
|
goto bail;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* from here on out, before we exit we must re-analyze this volume */
|
|
|
|
needReload = true;
|
|
|
|
|
|
|
|
// redraw main to erase previous dialog
|
|
|
|
pMain->PeekAndPump();
|
|
|
|
|
|
|
|
/* initialize cancel dialog, and disable dialog */
|
|
|
|
pProgressDialog = new VolumeXferProgressDialog;
|
|
|
|
EnableWindow(FALSE);
|
|
|
|
if (pProgressDialog->Create(this) == FALSE) {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("Progress dialog init failed?!");
|
2014-11-04 00:26:53 +00:00
|
|
|
ASSERT(false);
|
|
|
|
return;
|
|
|
|
}
|
2014-11-18 05:13:13 +00:00
|
|
|
// if (pDstFS == NULL)
|
2014-11-04 00:26:53 +00:00
|
|
|
// pProgressDialog->SetCurrentFiles(loadName, "target");
|
|
|
|
// else
|
|
|
|
pProgressDialog->SetCurrentFiles(loadName, targetName);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We want to delete fpDiskFS now, but we can't because it's holding the
|
|
|
|
* storage for the DiskImg/DiskFS pointers in the subvolume list. We
|
|
|
|
* flush it to ensure that it won't try to write to the disk after the
|
|
|
|
* copy completes.
|
|
|
|
*/
|
|
|
|
fpDiskFS->Flush(DiskImg::kFlushAll);
|
|
|
|
|
|
|
|
time_t startWhen, endWhen;
|
2014-11-18 05:13:13 +00:00
|
|
|
startWhen = time(NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Do the actual block copy.
|
|
|
|
*/
|
|
|
|
dierr = pMain->CopyDiskImage(pDstImg, &srcImg, false, isPartial,
|
|
|
|
pProgressDialog);
|
|
|
|
if (dierr != kDIErrNone) {
|
|
|
|
if (dierr == kDIErrCancelled) {
|
2014-12-16 19:04:31 +00:00
|
|
|
CheckedLoadString(&errMsg, IDS_OPERATION_CANCELLED);
|
2014-11-04 00:26:53 +00:00
|
|
|
ShowFailureMsg(pProgressDialog, errMsg, IDS_CANCELLED);
|
|
|
|
} else {
|
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
|
|
|
errMsg.Format(L"Copy failed: %hs.", DiskImgLib::DIStrError(dierr));
|
2014-11-04 00:26:53 +00:00
|
|
|
ShowFailureMsg(pProgressDialog, errMsg, IDS_FAILED);
|
|
|
|
}
|
|
|
|
goto bail;
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
|
|
|
|
dierr = srcImg.CloseImage();
|
|
|
|
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
|
|
|
errMsg.Format(L"ERROR: srcImg close failed (err=%d)\n", dierr);
|
2014-11-04 00:26:53 +00:00
|
|
|
ShowFailureMsg(pProgressDialog, errMsg, IDS_FAILED);
|
|
|
|
goto bail;
|
|
|
|
}
|
|
|
|
|
2014-11-18 05:13:13 +00:00
|
|
|
endWhen = time(NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
float elapsed;
|
|
|
|
if (endWhen == startWhen)
|
|
|
|
elapsed = 1.0;
|
|
|
|
else
|
|
|
|
elapsed = (float) (endWhen - startWhen);
|
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
|
|
|
errMsg.Format(L"Copied %ld blocks in %ld seconds (%.2fKB/sec)",
|
2014-11-19 22:54:24 +00:00
|
|
|
srcImg.GetNumBlocks(), (long) (endWhen - startWhen),
|
2014-11-04 00:26:53 +00:00
|
|
|
(srcImg.GetNumBlocks() / 2.0) / elapsed);
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("%ls", (LPCWSTR) errMsg);
|
2007-03-27 17:47:10 +00:00
|
|
|
#ifdef _DEBUG
|
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
|
|
|
pProgressDialog->MessageBox(errMsg, L"DEBUG: elapsed time", MB_OK);
|
2007-03-27 17:47:10 +00:00
|
|
|
#endif
|
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
pMain->SuccessBeep();
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
/*
|
|
|
|
* If a DiskFS insists on privately caching stuff (e.g. libhfs), we could
|
|
|
|
* end up corrupting the image we just wrote. We use SetAllReadOnly() to
|
|
|
|
* ensure that nothing will be written before we delete the DiskFS.
|
|
|
|
*/
|
|
|
|
assert(!fpDiskImg->GetReadOnly());
|
|
|
|
fpDiskFS->SetAllReadOnly(true);
|
|
|
|
delete fpDiskFS;
|
2014-11-18 05:13:13 +00:00
|
|
|
fpDiskFS = NULL;
|
2014-11-04 00:26:53 +00:00
|
|
|
assert(fpDiskImg->GetReadOnly());
|
|
|
|
fpDiskImg->SetReadOnly(false);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
|
|
|
bail:
|
2014-11-04 00:26:53 +00:00
|
|
|
// restore the dialog window to prominence
|
|
|
|
EnableWindow(TRUE);
|
|
|
|
//SetActiveWindow();
|
2014-11-18 05:13:13 +00:00
|
|
|
if (pProgressDialog != NULL)
|
2014-11-04 00:26:53 +00:00
|
|
|
pProgressDialog->DestroyWindow();
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Force a reload. We need to reload the disk information, then reload
|
|
|
|
* the list contents.
|
|
|
|
*
|
|
|
|
* By design, anything that would require un-overriding the format of
|
|
|
|
* the target DiskImg requires reloading it completely. Sort of heavy-
|
|
|
|
* handed, but it's reliable.
|
|
|
|
*/
|
|
|
|
if (needReload) {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("RELOAD dialog");
|
2014-11-04 00:26:53 +00:00
|
|
|
ScanDiskInfo(true); // reopens fpDiskFS
|
|
|
|
LoadList();
|
|
|
|
|
|
|
|
/* will we need to reopen the currently-open file list archive? */
|
|
|
|
if (pMain->IsOpenPathName(fPathName))
|
|
|
|
pMain->SetReopenFlag();
|
|
|
|
}
|
|
|
|
return;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|