2007-03-27 17:47:10 +00:00
|
|
|
/*
|
|
|
|
* CiderPress
|
|
|
|
* Copyright (C) 2007 by faddenSoft, LLC. All Rights Reserved.
|
|
|
|
* See the file LICENSE for distribution terms.
|
|
|
|
*/
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include "ImageFormatDialog.h"
|
|
|
|
#include "../diskimg/DiskImg.h"
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(ImageFormatDialog, CDialog)
|
2014-11-04 00:26:53 +00:00
|
|
|
ON_BN_CLICKED(IDC_DECONF_HELP, OnHelp)
|
|
|
|
ON_WM_HELPINFO()
|
2007-03-27 17:47:10 +00:00
|
|
|
END_MESSAGE_MAP()
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Conversion tables.
|
|
|
|
*
|
|
|
|
* If you add something else, remember to turn off "sort" in the drop list.
|
|
|
|
*
|
|
|
|
* The tables contain only the formats we currently support, and are in the
|
|
|
|
* order in which we want to present them to the user.
|
|
|
|
*
|
|
|
|
* THOUGHT: drop "name" from the tables, and use a DiskImg::ToString lookup
|
|
|
|
* to get the text string. That way we'd be consistent.
|
|
|
|
*/
|
|
|
|
typedef struct ImageFormatDialog::ConvTable {
|
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
|
|
|
int enumval; // a DiskImg::enum type
|
|
|
|
const WCHAR* name;
|
2007-03-27 17:47:10 +00:00
|
|
|
} ConvTable;
|
|
|
|
|
|
|
|
const int kLastEntry = -1;
|
|
|
|
|
|
|
|
/* DiskImg::OuterFormat */
|
|
|
|
static const ConvTable gOuterFormats[] = {
|
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
|
|
|
{ DiskImg::kOuterFormatUnknown, L"Unknown format" },
|
|
|
|
{ DiskImg::kOuterFormatNone, L"(none)" },
|
|
|
|
// { DiskImg::kOuterFormatCompress, L"UNIX compress" },
|
|
|
|
{ DiskImg::kOuterFormatGzip, L"gzip" },
|
|
|
|
// { DiskImg::kOuterFormatBzip2, L"bzip2" },
|
|
|
|
{ DiskImg::kOuterFormatZip, L"Zip archive" },
|
2014-11-18 05:13:13 +00:00
|
|
|
{ kLastEntry, NULL }
|
2007-03-27 17:47:10 +00:00
|
|
|
};
|
|
|
|
/* DiskImg::FileFormat */
|
|
|
|
static const ConvTable gFileFormats[] = {
|
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
|
|
|
{ DiskImg::kFileFormatUnknown, L"Unknown format" },
|
|
|
|
{ DiskImg::kFileFormatUnadorned, L"Unadorned raw data" },
|
|
|
|
{ DiskImg::kFileFormat2MG, L"2MG" },
|
|
|
|
{ DiskImg::kFileFormatNuFX, L"NuFX (ShrinkIt)" },
|
|
|
|
{ DiskImg::kFileFormatDiskCopy42, L"DiskCopy 4.2" },
|
|
|
|
// { DiskImg::kFileFormatDiskCopy60, L"DiskCopy 6.0" },
|
|
|
|
// { DiskImg::kFileFormatDavex, L"Davex volume image" },
|
|
|
|
{ DiskImg::kFileFormatSim2eHDV, L"Sim //e HDV" },
|
|
|
|
{ DiskImg::kFileFormatDDD, L"DDD" },
|
|
|
|
{ DiskImg::kFileFormatTrackStar, L"TrackStar image" },
|
|
|
|
{ DiskImg::kFileFormatFDI, L"FDI image" },
|
|
|
|
// { DiskImg::kFileFormatDDDDeluxe, L"DDDDeluxe" },
|
2014-11-18 05:13:13 +00:00
|
|
|
{ kLastEntry, NULL }
|
2007-03-27 17:47:10 +00:00
|
|
|
};
|
|
|
|
/* DiskImg::PhysicalFormat */
|
|
|
|
static const ConvTable gPhysicalFormats[] = {
|
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
|
|
|
{ DiskImg::kPhysicalFormatUnknown, L"Unknown format" },
|
|
|
|
{ DiskImg::kPhysicalFormatSectors, L"Sectors" },
|
|
|
|
{ DiskImg::kPhysicalFormatNib525_6656, L"Raw nibbles (6656-byte)" },
|
|
|
|
{ DiskImg::kPhysicalFormatNib525_6384, L"Raw nibbles (6384-byte)" },
|
|
|
|
{ DiskImg::kPhysicalFormatNib525_Var, L"Raw nibbles (variable len)" },
|
2014-11-18 05:13:13 +00:00
|
|
|
{ kLastEntry, NULL }
|
2007-03-27 17:47:10 +00:00
|
|
|
};
|
|
|
|
/* DiskImg::SectorOrder */
|
|
|
|
static const ConvTable gSectorOrders[] = {
|
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
|
|
|
{ DiskImg::kSectorOrderUnknown, L"Unknown ordering" },
|
|
|
|
{ DiskImg::kSectorOrderProDOS, L"ProDOS block ordering" },
|
|
|
|
{ DiskImg::kSectorOrderDOS, L"DOS sector ordering" },
|
|
|
|
{ DiskImg::kSectorOrderCPM, L"CP/M block ordering" },
|
|
|
|
{ DiskImg::kSectorOrderPhysical, L"Physical sector ordering" },
|
2014-11-18 05:13:13 +00:00
|
|
|
{ kLastEntry, NULL }
|
2007-03-27 17:47:10 +00:00
|
|
|
};
|
|
|
|
/* DiskImg::FSFormat */
|
|
|
|
static const ConvTable gFSFormats[] = {
|
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
|
|
|
{ DiskImg::kFormatUnknown, L"Unknown filesystem" },
|
|
|
|
{ DiskImg::kFormatGenericDOSOrd, L"Generic DOS sectors" },
|
|
|
|
{ DiskImg::kFormatGenericProDOSOrd, L"Generic ProDOS blocks" },
|
|
|
|
{ DiskImg::kFormatGenericPhysicalOrd, L"Generic raw sectors" },
|
|
|
|
{ DiskImg::kFormatGenericCPMOrd, L"Generic CP/M blocks" },
|
|
|
|
{ DiskImg::kFormatProDOS, L"ProDOS" },
|
|
|
|
{ DiskImg::kFormatDOS33, L"DOS 3.3" },
|
|
|
|
{ DiskImg::kFormatDOS32, L"DOS 3.2" },
|
|
|
|
{ DiskImg::kFormatPascal, L"Pascal" },
|
|
|
|
{ DiskImg::kFormatMacHFS, L"HFS" },
|
|
|
|
// { DiskImg::kFormatMacMFS, L"MFS" },
|
|
|
|
// { DiskImg::kFormatLisa, L"Lisa" },
|
|
|
|
{ DiskImg::kFormatCPM, L"CP/M" },
|
|
|
|
{ DiskImg::kFormatMSDOS, L"MS-DOS FAT" },
|
|
|
|
// { DiskImg::kFormatISO9660, L"ISO-9660" },
|
|
|
|
{ DiskImg::kFormatUNIDOS, L"UNIDOS (400K DOS x2)" },
|
|
|
|
{ DiskImg::kFormatOzDOS, L"OzDOS (400K DOS x2)" },
|
|
|
|
{ DiskImg::kFormatCFFA4, L"CFFA (4 or 6 partitions)" },
|
|
|
|
{ DiskImg::kFormatCFFA8, L"CFFA (8 partitions)" },
|
|
|
|
{ DiskImg::kFormatMacPart, L"Macintosh partitioned disk" },
|
|
|
|
{ DiskImg::kFormatMicroDrive, L"MicroDrive partitioned disk" },
|
|
|
|
{ DiskImg::kFormatFocusDrive, L"FocusDrive partitioned disk" },
|
|
|
|
{ DiskImg::kFormatRDOS33, L"RDOS 3.3 (16-sector)" },
|
|
|
|
{ DiskImg::kFormatRDOS32, L"RDOS 3.2 (13-sector)" },
|
|
|
|
{ DiskImg::kFormatRDOS3, L"RDOS 3 (cracked 13-sector)" },
|
2014-11-18 05:13:13 +00:00
|
|
|
{ kLastEntry, NULL }
|
2007-03-27 17:47:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void ImageFormatDialog::InitializeValues(const DiskImg* pImg)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
fOuterFormat = pImg->GetOuterFormat();
|
|
|
|
fFileFormat = pImg->GetFileFormat();
|
|
|
|
fPhysicalFormat = pImg->GetPhysicalFormat();
|
|
|
|
fSectorOrder = pImg->GetSectorOrder();
|
|
|
|
fFSFormat = pImg->GetFSFormat();
|
|
|
|
|
|
|
|
if (pImg->ShowAsBlocks())
|
|
|
|
fDisplayFormat = kShowAsBlocks;
|
|
|
|
else
|
|
|
|
fDisplayFormat = kShowAsSectors;
|
|
|
|
if (!pImg->GetHasBlocks() && !pImg->GetHasSectors())
|
|
|
|
fDisplayFormat = kShowAsNibbles;
|
|
|
|
|
|
|
|
fHasSectors = pImg->GetHasSectors();
|
|
|
|
fHasBlocks = pImg->GetHasBlocks();
|
|
|
|
fHasNibbles = pImg->GetHasNibbles();
|
|
|
|
|
|
|
|
// "Unknown" formats default to sectors, but sometimes it's block-only
|
|
|
|
if (fDisplayFormat == kShowAsSectors && !fHasSectors)
|
|
|
|
fDisplayFormat = kShowAsBlocks;
|
|
|
|
|
|
|
|
fInitialized = true;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
BOOL ImageFormatDialog::OnInitDialog(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
ASSERT(fInitialized);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
LoadComboBoxes();
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
return CDialog::OnInitDialog(); // do DDX/DDV
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void ImageFormatDialog::LoadComboBoxes(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
CWnd* pWnd;
|
|
|
|
CButton* pButton;
|
|
|
|
|
|
|
|
pWnd = GetDlgItem(IDC_DECONF_SOURCE);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pWnd != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
pWnd->SetWindowText(fFileSource);
|
|
|
|
|
|
|
|
if (fQueryDisplayFormat) {
|
|
|
|
pButton = (CButton*) GetDlgItem(IDC_DECONF_VIEWASSECTORS);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pButton != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
pButton->SetCheck(fDisplayFormat == kShowAsSectors);
|
|
|
|
if (!fHasSectors)
|
|
|
|
pButton->EnableWindow(FALSE);
|
|
|
|
|
|
|
|
pButton = (CButton*) GetDlgItem(IDC_DECONF_VIEWASBLOCKS);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pButton != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
pButton->SetCheck(fDisplayFormat == kShowAsBlocks);
|
|
|
|
if (!fHasBlocks)
|
|
|
|
pButton->EnableWindow(FALSE);
|
|
|
|
|
|
|
|
pButton = (CButton*) GetDlgItem(IDC_DECONF_VIEWASNIBBLES);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pButton != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
pButton->SetCheck(fDisplayFormat == kShowAsNibbles);
|
|
|
|
if (!fHasNibbles)
|
|
|
|
pButton->EnableWindow(FALSE);
|
|
|
|
} else {
|
|
|
|
/* if we don't need to ask, don't show the buttons */
|
|
|
|
pWnd = GetDlgItem(IDC_DECONF_VIEWAS);
|
|
|
|
pWnd->DestroyWindow();
|
|
|
|
pWnd = GetDlgItem(IDC_DECONF_VIEWASBLOCKS);
|
|
|
|
pWnd->DestroyWindow();
|
|
|
|
pWnd = GetDlgItem(IDC_DECONF_VIEWASSECTORS);
|
|
|
|
pWnd->DestroyWindow();
|
|
|
|
pWnd = GetDlgItem(IDC_DECONF_VIEWASNIBBLES);
|
|
|
|
pWnd->DestroyWindow();
|
|
|
|
}
|
|
|
|
|
|
|
|
LoadComboBox(IDC_DECONF_OUTERFORMAT, gOuterFormats, fOuterFormat);
|
|
|
|
LoadComboBox(IDC_DECONF_FILEFORMAT, gFileFormats, fFileFormat);
|
|
|
|
LoadComboBox(IDC_DECONF_PHYSICAL, gPhysicalFormats, fPhysicalFormat);
|
|
|
|
LoadComboBox(IDC_DECONF_SECTORORDER, gSectorOrders, fSectorOrder);
|
|
|
|
LoadComboBox(IDC_DECONF_FSFORMAT, gFSFormats, fFSFormat);
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void ImageFormatDialog::LoadComboBox(int boxID, const ConvTable* pTable,
|
|
|
|
int dflt)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
CComboBox* pCombo;
|
|
|
|
// const ConvTable* pBaseTable = pTable;
|
|
|
|
int current = -1;
|
|
|
|
int idx, idxShift;
|
|
|
|
|
|
|
|
pCombo = (CComboBox*) GetDlgItem(boxID);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pCombo != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
idx = idxShift = 0;
|
|
|
|
while (pTable[idx].enumval != kLastEntry) {
|
|
|
|
/* special-case the generic FS formats */
|
|
|
|
if (pTable == gFSFormats && !fAllowGenericFormats &&
|
|
|
|
DiskImg::IsGenericFormat((DiskImg::FSFormat)pTable[idx].enumval))
|
|
|
|
{
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("LoadComboBox skipping '%ls'", pTable[idx].name);
|
2014-11-04 00:26:53 +00:00
|
|
|
idxShift++;
|
|
|
|
} else {
|
|
|
|
// Note to self: AddString returns the combo box item ID;
|
|
|
|
// should probably use that instead of doing math.
|
|
|
|
pCombo->AddString(pTable[idx].name);
|
|
|
|
pCombo->SetItemData(idx - idxShift, pTable[idx].enumval);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pTable[idx].enumval == dflt)
|
|
|
|
current = idx - idxShift;
|
|
|
|
|
|
|
|
idx++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (current != -1) {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI(" Set default for %d/%d to %d", boxID, dflt, current);
|
2014-11-04 00:26:53 +00:00
|
|
|
pCombo->SetCurSel(current);
|
|
|
|
} else {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI(" No matching default for %d (%d)", boxID, dflt);
|
2014-11-04 00:26:53 +00:00
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
int ImageFormatDialog::ConvComboSel(int boxID, const ConvTable* pTable)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
CComboBox* pCombo;
|
|
|
|
int idx, enumval;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
pCombo = (CComboBox*) GetDlgItem(boxID);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pCombo != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
idx = pCombo->GetCurSel();
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
if (idx < 0) {
|
|
|
|
/* nothing selected?! */
|
|
|
|
ASSERT(false);
|
|
|
|
return 0;
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
// enumval = pTable[idx].enumval;
|
|
|
|
enumval = pCombo->GetItemData(idx);
|
|
|
|
ASSERT(enumval >= 0 && enumval < 100);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
if (pTable != gFSFormats) {
|
|
|
|
ASSERT(enumval == pTable[idx].enumval);
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI(" Returning ev=%d for %d entry '%ls'",
|
2014-11-04 00:26:53 +00:00
|
|
|
enumval, boxID, pTable[idx].name);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
return enumval;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void ImageFormatDialog::OnOK(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
CButton* pButton;
|
|
|
|
|
|
|
|
if (fQueryDisplayFormat) {
|
|
|
|
pButton = (CButton*) GetDlgItem(IDC_DECONF_VIEWASSECTORS);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pButton != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
if (pButton->GetCheck())
|
|
|
|
fDisplayFormat = kShowAsSectors;
|
|
|
|
|
|
|
|
pButton = (CButton*) GetDlgItem(IDC_DECONF_VIEWASBLOCKS);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pButton != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
if (pButton->GetCheck())
|
|
|
|
fDisplayFormat = kShowAsBlocks;
|
|
|
|
|
|
|
|
pButton = (CButton*) GetDlgItem(IDC_DECONF_VIEWASNIBBLES);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pButton != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
if (pButton->GetCheck())
|
|
|
|
fDisplayFormat = kShowAsNibbles;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* outer format, file format, and physical format are immutable */
|
|
|
|
|
|
|
|
fSectorOrder = (DiskImg::SectorOrder)
|
|
|
|
ConvComboSel(IDC_DECONF_SECTORORDER, gSectorOrders);
|
|
|
|
fFSFormat = (DiskImg::FSFormat)
|
|
|
|
ConvComboSel(IDC_DECONF_FSFORMAT, gFSFormats);
|
|
|
|
|
|
|
|
if (fSectorOrder == DiskImg::kSectorOrderUnknown) {
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
MessageBox(L"You must choose a sector ordering.", L"Error",
|
2014-11-04 00:26:53 +00:00
|
|
|
MB_OK | MB_ICONEXCLAMATION);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (fFSFormat == DiskImg::kFormatUnknown &&
|
|
|
|
!fAllowUnknown)
|
|
|
|
{
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
MessageBox(L"You must choose a filesystem format. If not known,"
|
|
|
|
L" use one of the 'generic' entries.",
|
|
|
|
L"Error", MB_OK | MB_ICONEXCLAMATION);
|
2014-11-04 00:26:53 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
CDialog::OnOK();
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|