ciderpress/app/CreateImageDialog.cpp

309 lines
12 KiB
C++
Raw Normal View History

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.
*/
/*
* Support for ConvDiskOptionsDialog.
*/
#include "stdafx.h"
#include "CreateImageDialog.h"
#include "NewDiskSize.h"
#include "HelpTopics.h"
#include "../diskimg/DiskImgDetail.h" // need ProDOS filename validator
2007-03-27 17:47:10 +00:00
BEGIN_MESSAGE_MAP(CreateImageDialog, CDialog)
ON_WM_HELPINFO()
ON_COMMAND(IDHELP, OnHelp)
ON_CONTROL_RANGE(BN_CLICKED, IDC_CREATEFS_DOS32, IDC_CREATEFS_BLANK,
OnFormatChangeRange)
ON_CONTROL_RANGE(BN_CLICKED, IDC_CONVDISK_140K, IDC_CONVDISK_SPECIFY,
OnSizeChangeRange)
2007-03-27 17:47:10 +00:00
END_MESSAGE_MAP()
// TODO: obtain from DiskImgLib header?
const int kProDOSVolNameMax = 15; // longest possible ProDOS volume name
const int kPascalVolNameMax = 7; // longest possible Pascal volume name
const int kHFSVolNameMax = 27; // longest possible HFS volume name
const long kMaxBlankBlocks = 16777216; // 8GB in 512-byte blocks
2007-03-27 17:47:10 +00:00
BOOL CreateImageDialog::OnInitDialog(void)
2007-03-27 17:47:10 +00:00
{
// high bit set in signed short means key is down
if (::GetKeyState(VK_SHIFT) < 0) {
LOGI("Shift key is down, enabling extended options");
fExtendedOpts = true;
}
2007-03-27 17:47:10 +00:00
CEdit* pEdit = (CEdit*) GetDlgItem(IDC_CREATEFSPRODOS_VOLNAME);
2014-11-18 05:13:13 +00:00
ASSERT(pEdit != NULL);
pEdit->SetLimitText(kProDOSVolNameMax);
2007-03-27 17:47:10 +00:00
pEdit = (CEdit*) GetDlgItem(IDC_CREATEFSPASCAL_VOLNAME);
2014-11-18 05:13:13 +00:00
ASSERT(pEdit != NULL);
pEdit->SetLimitText(kPascalVolNameMax);
2007-03-27 17:47:10 +00:00
pEdit = (CEdit*) GetDlgItem(IDC_CREATEFSHFS_VOLNAME);
2014-11-18 05:13:13 +00:00
ASSERT(pEdit != NULL);
pEdit->SetLimitText(kHFSVolNameMax);
2007-03-27 17:47:10 +00:00
pEdit = (CEdit*) GetDlgItem(IDC_CREATEFSDOS_VOLNUM);
2014-11-18 05:13:13 +00:00
ASSERT(pEdit != NULL);
pEdit->SetLimitText(3); // 3 digit volume number
2007-03-27 17:47:10 +00:00
pEdit = (CEdit*) GetDlgItem(IDC_CONVDISK_SPECIFY_EDIT);
2014-11-18 05:13:13 +00:00
ASSERT(pEdit != NULL);
pEdit->EnableWindow(FALSE);
2007-03-27 17:47:10 +00:00
return CDialog::OnInitDialog();
2007-03-27 17:47:10 +00:00
}
void CreateImageDialog::DoDataExchange(CDataExchange* pDX)
2007-03-27 17:47:10 +00:00
{
UINT specifyBlocks = 280;
CString errMsg;
DDX_Radio(pDX, IDC_CONVDISK_140K, fDiskSizeIdx);
DDX_Radio(pDX, IDC_CREATEFS_DOS32, fDiskFormatIdx);
DDX_Check(pDX, IDC_CREATEFSDOS_ALLOCDOS, fAllocTracks_DOS);
DDX_Text(pDX, IDC_CREATEFSDOS_VOLNUM, fDOSVolumeNum);
DDX_Text(pDX, IDC_CREATEFSPRODOS_VOLNAME, fVolName_ProDOS);
DDX_Text(pDX, IDC_CREATEFSPASCAL_VOLNAME, fVolName_Pascal);
DDX_Text(pDX, IDC_CREATEFSHFS_VOLNAME, fVolName_HFS);
DDX_Text(pDX, IDC_CONVDISK_SPECIFY_EDIT, specifyBlocks);
ASSERT(fDiskSizeIdx >= 0 && fDiskSizeIdx < (int)NewDiskSize::GetNumSizeEntries());
if (pDX->m_bSaveAndValidate) {
fNumBlocks = NewDiskSize::GetDiskSizeByIndex(fDiskSizeIdx);
if (fNumBlocks == NewDiskSize::kSpecified)
fNumBlocks = specifyBlocks;
if (fDiskFormatIdx == kFmtDOS32) {
CString tmpStr;
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
tmpStr.Format(L"%d", fDOSVolumeNum);
if (!IsValidVolumeName_DOS(tmpStr))
errMsg.LoadString(IDS_VALID_VOLNAME_DOS);
} else if (fDiskFormatIdx == kFmtDOS33) {
CString tmpStr;
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
tmpStr.Format(L"%d", fDOSVolumeNum);
if (!IsValidVolumeName_DOS(tmpStr))
errMsg.LoadString(IDS_VALID_VOLNAME_DOS);
// only needed in "extended" mode -- this stuff is too painful to
// inflict on the average user
if (fNumBlocks < 18*8 || fNumBlocks > 800 ||
(fNumBlocks <= 400 && (fNumBlocks % 8) != 0) ||
(fNumBlocks > 400 && (fNumBlocks % 16) != 0))
{
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"Specify a size between 144 blocks (18 tracks) and"
L" 800 blocks (50 tracks/32 sectors). The block count"
L" must be a multiple of 8 for 16-sector disks, or a"
L" multiple of 16 for 32-sector disks. 32 sector"
L" formatting starts at 400 blocks. Disks larger than"
L" 400 blocks but less than 800 aren't recognized by"
L" CiderPress.";
}
} else if (fDiskFormatIdx == kFmtProDOS) {
// Max is really 65535, but we allow 65536 for creation of volumes
// that can be copied to CFFA cards.
if (fNumBlocks < 16 || fNumBlocks > 65536) {
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"Specify a size of at least 16 blocks and no more"
L" than 65536 blocks.";
} else if (fVolName_ProDOS.IsEmpty() ||
fVolName_ProDOS.GetLength() > kProDOSVolNameMax)
{
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"You must specify a volume name 1-15 characters long.";
} else {
if (!IsValidVolumeName_ProDOS(fVolName_ProDOS))
errMsg.LoadString(IDS_VALID_VOLNAME_PRODOS);
}
} else if (fDiskFormatIdx == kFmtPascal) {
if (fVolName_Pascal.IsEmpty() ||
fVolName_Pascal.GetLength() > kPascalVolNameMax)
{
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"You must specify a volume name 1-7 characters long.";
} else {
if (!IsValidVolumeName_Pascal(fVolName_Pascal))
errMsg.LoadString(IDS_VALID_VOLNAME_PASCAL);
}
} else if (fDiskFormatIdx == kFmtHFS) {
if (fNumBlocks < 1600 || fNumBlocks > 4194303) {
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"Specify a size of at least 1600 blocks and no more"
L" than 4194303 blocks.";
} else if (fVolName_HFS.IsEmpty() ||
fVolName_HFS.GetLength() > kHFSVolNameMax)
{
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"You must specify a volume name 1-27 characters long.";
} else {
if (!IsValidVolumeName_HFS(fVolName_HFS))
errMsg.LoadString(IDS_VALID_VOLNAME_HFS);
}
} else if (fDiskFormatIdx == kFmtBlank) {
if (fNumBlocks < 1 || fNumBlocks > kMaxBlankBlocks)
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"Specify a size of at least 1 block and no more"
L" than 16777216 blocks.";
} else {
ASSERT(false);
}
} else {
OnFormatChangeRange(IDC_CREATEFS_DOS32 + fDiskFormatIdx);
}
if (!errMsg.IsEmpty()) {
CString appName;
appName.LoadString(IDS_MB_APP_NAME);
MessageBox(errMsg, appName, MB_OK);
pDX->Fail();
}
CDialog::DoDataExchange(pDX);
2007-03-27 17:47:10 +00:00
}
void CreateImageDialog::OnFormatChangeRange(UINT nID)
2007-03-27 17:47:10 +00:00
{
static const struct {
UINT buttonID;
UINT ctrlID;
} kFormatTab[] = {
{ IDC_CREATEFS_DOS32, IDC_CREATEFSDOS_ALLOCDOS },
{ IDC_CREATEFS_DOS32, IDC_CREATEFSDOS_VOLNUM },
{ IDC_CREATEFS_DOS32, IDC_CONVDISK_140K },
{ IDC_CREATEFS_DOS33, IDC_CREATEFSDOS_ALLOCDOS },
{ IDC_CREATEFS_DOS33, IDC_CREATEFSDOS_VOLNUM },
{ IDC_CREATEFS_DOS33, IDC_CONVDISK_140K },
{ IDC_CREATEFS_PRODOS, IDC_CREATEFSPRODOS_VOLNAME },
{ IDC_CREATEFS_PRODOS, IDC_CONVDISK_140K },
{ IDC_CREATEFS_PRODOS, IDC_CONVDISK_800K },
{ IDC_CREATEFS_PRODOS, IDC_CONVDISK_1440K },
{ IDC_CREATEFS_PRODOS, IDC_CONVDISK_5MB },
{ IDC_CREATEFS_PRODOS, IDC_CONVDISK_16MB },
{ IDC_CREATEFS_PRODOS, IDC_CONVDISK_20MB },
{ IDC_CREATEFS_PRODOS, IDC_CONVDISK_32MB },
{ IDC_CREATEFS_PRODOS, IDC_CONVDISK_SPECIFY },
{ IDC_CREATEFS_PASCAL, IDC_CREATEFSPASCAL_VOLNAME },
{ IDC_CREATEFS_PASCAL, IDC_CONVDISK_140K },
{ IDC_CREATEFS_PASCAL, IDC_CONVDISK_800K },
{ IDC_CREATEFS_HFS, IDC_CREATEFSHFS_VOLNAME },
{ IDC_CREATEFS_HFS, IDC_CONVDISK_800K },
{ IDC_CREATEFS_HFS, IDC_CONVDISK_1440K },
{ IDC_CREATEFS_HFS, IDC_CONVDISK_5MB },
{ IDC_CREATEFS_HFS, IDC_CONVDISK_16MB },
{ IDC_CREATEFS_HFS, IDC_CONVDISK_20MB },
{ IDC_CREATEFS_HFS, IDC_CONVDISK_32MB },
{ IDC_CREATEFS_HFS, IDC_CONVDISK_SPECIFY },
{ IDC_CREATEFS_BLANK, IDC_CONVDISK_140K },
{ IDC_CREATEFS_BLANK, IDC_CONVDISK_800K },
{ IDC_CREATEFS_BLANK, IDC_CONVDISK_1440K },
{ IDC_CREATEFS_BLANK, IDC_CONVDISK_5MB },
{ IDC_CREATEFS_BLANK, IDC_CONVDISK_16MB },
{ IDC_CREATEFS_BLANK, IDC_CONVDISK_20MB },
{ IDC_CREATEFS_BLANK, IDC_CONVDISK_32MB },
{ IDC_CREATEFS_BLANK, IDC_CONVDISK_SPECIFY },
};
static const UINT kDetailControls[] = {
IDC_CREATEFSDOS_ALLOCDOS,
IDC_CREATEFSDOS_VOLNUM,
IDC_CREATEFSPRODOS_VOLNAME,
IDC_CREATEFSPASCAL_VOLNAME,
IDC_CREATEFSHFS_VOLNAME
};
int i;
LOGI("OnFormatChangeRange id=%d", nID);
/* reset so 140K is highlighted */
NewDiskSize::EnableButtons_ProDOS(this, 32, 16);
/* disable all buttons */
NewDiskSize::EnableButtons(this, FALSE);
for (i = 0; i < NELEM(kDetailControls); i++) {
CWnd* pWnd = GetDlgItem(kDetailControls[i]);
2014-11-18 05:13:13 +00:00
if (pWnd != NULL)
pWnd->EnableWindow(FALSE);
}
/* re-enable just the ones we like */
for (i = 0; i < NELEM(kFormatTab); i++) {
if (kFormatTab[i].buttonID == nID) {
CWnd* pWnd = GetDlgItem(kFormatTab[i].ctrlID);
2014-11-18 05:13:13 +00:00
ASSERT(pWnd != NULL);
if (pWnd != NULL)
pWnd->EnableWindow(TRUE);
}
}
if (fExtendedOpts && nID != IDC_CREATEFS_DOS32) {
CWnd* pWnd = GetDlgItem(IDC_CONVDISK_SPECIFY);
pWnd->EnableWindow(TRUE);
}
/* make sure 140K is viable; doesn't work for HFS */
CButton* pButton;
pButton = (CButton*) GetDlgItem(IDC_CONVDISK_140K);
if (!pButton->IsWindowEnabled()) {
pButton->SetCheck(BST_UNCHECKED);
pButton = (CButton*) GetDlgItem(IDC_CONVDISK_800K);
pButton->SetCheck(BST_CHECKED);
}
2007-03-27 17:47:10 +00:00
}
void CreateImageDialog::OnSizeChangeRange(UINT nID)
2007-03-27 17:47:10 +00:00
{
LOGI("OnSizeChangeRange id=%d", nID);
CButton* pButton = (CButton*) GetDlgItem(IDC_CONVDISK_SPECIFY);
CEdit* pEdit = (CEdit*) GetDlgItem(IDC_CONVDISK_SPECIFY_EDIT);
pEdit->EnableWindow(pButton->GetCheck() == BST_CHECKED);
CButton* pBlank;
CButton* pHFS;
pBlank = (CButton*) GetDlgItem(IDC_CREATEFS_BLANK);
pHFS = (CButton*) GetDlgItem(IDC_CREATEFS_HFS);
if (pHFS->GetCheck() == BST_CHECKED)
pEdit->SetLimitText(10); // enough for "2147483647"
else if (pBlank->GetCheck() == BST_CHECKED)
pEdit->SetLimitText(8); // enough for "16777216"
else
pEdit->SetLimitText(5); // enough for "65535"
NewDiskSize::UpdateSpecifyEdit(this);
2007-03-27 17:47:10 +00:00
}
bool CreateImageDialog::IsValidVolumeName_DOS(const WCHAR* name)
2007-03-27 17:47:10 +00:00
{
Large set of changes to restore CiderPress build. CiderPress and MDC now compile, and execute far enough to open their respective "about" boxes, but I doubt they'll do much more than that. * Switch from MBCS to UNICODE APIs Microsoft switched to UTF-16 (by way of UCS-2) a long time ago, and the support for MBCS seems to be getting phased out. So it's time to switch to wide strings. This is a bit awkward for CiderPress because it works with disk and file archives with 8-bit filenames, and I want NufxLib and DiskImgLib to continue to work on Linux (which has largely taken the UTF-8 approach to Unicode). The libraries will continue to work with 8-bit filenames, with CiderPress/MDC doing the conversion at the appropriate point. There were a couple of places where strings from a structure handed back by one of the libraries were used directly in the UI, or vice-versa, which is a problem because we have nowhere to store the result of the conversion. These currently have fixed place-holder "xyzzy" strings. All UI strings are now wide. Various format strings now use "%ls" and "%hs" to explicitly specify wide and narrow. This doesn't play well with gcc, so only the Windows-specific parts use those. * Various updates to vcxproj files The project-file conversion had some cruft that is now largely gone. The build now has a common output directory for the EXEs and libraries, avoiding the old post-build copy steps. * Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots The old "prebuilts" directory is now gone. The libraries are now built as part of building the apps. I added a minimal set of files for zlib, and a full set for nufxlib. The Linux-specific nufxlib goodies are included for the benefit of the Linux utilities, which are currently broken (don't build). * Replace symbols used for include guards Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
CStringA nameStr(name);
return DiskImgLib::DiskFSDOS33::IsValidVolumeName(nameStr);
2007-03-27 17:47:10 +00:00
}
bool CreateImageDialog::IsValidVolumeName_ProDOS(const WCHAR* name)
2007-03-27 17:47:10 +00:00
{
Large set of changes to restore CiderPress build. CiderPress and MDC now compile, and execute far enough to open their respective "about" boxes, but I doubt they'll do much more than that. * Switch from MBCS to UNICODE APIs Microsoft switched to UTF-16 (by way of UCS-2) a long time ago, and the support for MBCS seems to be getting phased out. So it's time to switch to wide strings. This is a bit awkward for CiderPress because it works with disk and file archives with 8-bit filenames, and I want NufxLib and DiskImgLib to continue to work on Linux (which has largely taken the UTF-8 approach to Unicode). The libraries will continue to work with 8-bit filenames, with CiderPress/MDC doing the conversion at the appropriate point. There were a couple of places where strings from a structure handed back by one of the libraries were used directly in the UI, or vice-versa, which is a problem because we have nowhere to store the result of the conversion. These currently have fixed place-holder "xyzzy" strings. All UI strings are now wide. Various format strings now use "%ls" and "%hs" to explicitly specify wide and narrow. This doesn't play well with gcc, so only the Windows-specific parts use those. * Various updates to vcxproj files The project-file conversion had some cruft that is now largely gone. The build now has a common output directory for the EXEs and libraries, avoiding the old post-build copy steps. * Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots The old "prebuilts" directory is now gone. The libraries are now built as part of building the apps. I added a minimal set of files for zlib, and a full set for nufxlib. The Linux-specific nufxlib goodies are included for the benefit of the Linux utilities, which are currently broken (don't build). * Replace symbols used for include guards Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
CStringA nameStr(name);
return DiskImgLib::DiskFSProDOS::IsValidVolumeName(nameStr);
2007-03-27 17:47:10 +00:00
}
bool CreateImageDialog::IsValidVolumeName_Pascal(const WCHAR* name)
2007-03-27 17:47:10 +00:00
{
Large set of changes to restore CiderPress build. CiderPress and MDC now compile, and execute far enough to open their respective "about" boxes, but I doubt they'll do much more than that. * Switch from MBCS to UNICODE APIs Microsoft switched to UTF-16 (by way of UCS-2) a long time ago, and the support for MBCS seems to be getting phased out. So it's time to switch to wide strings. This is a bit awkward for CiderPress because it works with disk and file archives with 8-bit filenames, and I want NufxLib and DiskImgLib to continue to work on Linux (which has largely taken the UTF-8 approach to Unicode). The libraries will continue to work with 8-bit filenames, with CiderPress/MDC doing the conversion at the appropriate point. There were a couple of places where strings from a structure handed back by one of the libraries were used directly in the UI, or vice-versa, which is a problem because we have nowhere to store the result of the conversion. These currently have fixed place-holder "xyzzy" strings. All UI strings are now wide. Various format strings now use "%ls" and "%hs" to explicitly specify wide and narrow. This doesn't play well with gcc, so only the Windows-specific parts use those. * Various updates to vcxproj files The project-file conversion had some cruft that is now largely gone. The build now has a common output directory for the EXEs and libraries, avoiding the old post-build copy steps. * Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots The old "prebuilts" directory is now gone. The libraries are now built as part of building the apps. I added a minimal set of files for zlib, and a full set for nufxlib. The Linux-specific nufxlib goodies are included for the benefit of the Linux utilities, which are currently broken (don't build). * Replace symbols used for include guards Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
CStringA nameStr(name);
return DiskImgLib::DiskFSPascal::IsValidVolumeName(nameStr);
2007-03-27 17:47:10 +00:00
}
bool CreateImageDialog::IsValidVolumeName_HFS(const WCHAR* name)
2007-03-27 17:47:10 +00:00
{
Large set of changes to restore CiderPress build. CiderPress and MDC now compile, and execute far enough to open their respective "about" boxes, but I doubt they'll do much more than that. * Switch from MBCS to UNICODE APIs Microsoft switched to UTF-16 (by way of UCS-2) a long time ago, and the support for MBCS seems to be getting phased out. So it's time to switch to wide strings. This is a bit awkward for CiderPress because it works with disk and file archives with 8-bit filenames, and I want NufxLib and DiskImgLib to continue to work on Linux (which has largely taken the UTF-8 approach to Unicode). The libraries will continue to work with 8-bit filenames, with CiderPress/MDC doing the conversion at the appropriate point. There were a couple of places where strings from a structure handed back by one of the libraries were used directly in the UI, or vice-versa, which is a problem because we have nowhere to store the result of the conversion. These currently have fixed place-holder "xyzzy" strings. All UI strings are now wide. Various format strings now use "%ls" and "%hs" to explicitly specify wide and narrow. This doesn't play well with gcc, so only the Windows-specific parts use those. * Various updates to vcxproj files The project-file conversion had some cruft that is now largely gone. The build now has a common output directory for the EXEs and libraries, avoiding the old post-build copy steps. * Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots The old "prebuilts" directory is now gone. The libraries are now built as part of building the apps. I added a minimal set of files for zlib, and a full set for nufxlib. The Linux-specific nufxlib goodies are included for the benefit of the Linux utilities, which are currently broken (don't build). * Replace symbols used for include guards Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
CStringA nameStr(name);
return DiskImgLib::DiskFSHFS::IsValidVolumeName(nameStr);
2007-03-27 17:47:10 +00:00
}
BOOL CreateImageDialog::OnHelpInfo(HELPINFO* lpHelpInfo)
2007-03-27 17:47:10 +00:00
{
WinHelp((DWORD) lpHelpInfo->iCtrlId, HELP_CONTEXTPOPUP);
return TRUE; // yes, we handled it
2007-03-27 17:47:10 +00:00
}
void CreateImageDialog::OnHelp(void)
2007-03-27 17:47:10 +00:00
{
WinHelp(HELP_TOPIC_IMAGE_CREATOR, HELP_CONTEXT);
2007-03-27 17:47:10 +00:00
}