mirror of
https://github.com/fadden/ciderpress.git
synced 2024-11-23 11:33:58 +00:00
250d1043e3
The original version of CiderPress used a WinHelp help file, built with an application called HelpMatic Pro. This app used a proprietary format, and had no facility for exporting to "raw" HPJ + RTF files, so I decompiled the HLP and imported it into HelpScribble. Using HelpScribble, I cleaned up the help file formatting a little, fixed up the table of contents, and exported as "raw" HtmlHelp (HHP, HHK, HHC, and a whole bunch of HTML). I also split the pop-up help text, which isn't supported by HelpScribble, into a separate text file that Microsoft's HTML Help Workshop understands. I'm checking in the files that HTML Help Workshop needs to generate a CHM, so anyone can update the help text. I'm also checking in the CHM file, rather than adding the help workshop to the build, so that it's not necessary to download and configure the help workshop to build CiderPress. This change adds all of the updated help, but only updates the Help and question mark button actions for one specific dialog. A subsequent change will update the rest of the dialogs. This change is essentially upgrading us from a totally obsolete help system to a nearly-obsolete help system, but the systems are similar enough to make this a useful half-step on the way to something else. The code will centralize help activation in a pair of functions in the main app class, so any future improvements should be more limited in scope. This also adds a build step to copy the CHM to the execution directory.
261 lines
8.7 KiB
C++
261 lines
8.7 KiB
C++
/*
|
|
* CiderPress
|
|
* Copyright (C) 2007 by faddenSoft, LLC. All Rights Reserved.
|
|
* See the file LICENSE for distribution terms.
|
|
*/
|
|
/*
|
|
* Support for disk image conversion dialog
|
|
*/
|
|
#include "StdAfx.h"
|
|
#include "DiskConvertDialog.h"
|
|
|
|
using namespace DiskImgLib;
|
|
|
|
BEGIN_MESSAGE_MAP(DiskConvertDialog, CDialog)
|
|
ON_CONTROL_RANGE(BN_CLICKED, IDC_DISKCONV_DOS, IDC_DISKCONV_DDD, OnChangeRadio)
|
|
ON_WM_HELPINFO()
|
|
ON_COMMAND(IDHELP, OnHelp)
|
|
END_MESSAGE_MAP()
|
|
|
|
|
|
void DiskConvertDialog::Init(const DiskImg* pDiskImg)
|
|
{
|
|
ASSERT(pDiskImg != NULL);
|
|
const int kMagicNibbles = -1234;
|
|
bool hasBlocks = pDiskImg->GetHasBlocks();
|
|
bool hasSectors = pDiskImg->GetHasSectors();
|
|
bool hasNibbles = pDiskImg->GetHasNibbles();
|
|
long diskSizeInSectors;
|
|
|
|
ASSERT(fSizeInBlocks == -1);
|
|
if (hasBlocks) {
|
|
diskSizeInSectors = pDiskImg->GetNumBlocks() * 2;
|
|
fSizeInBlocks = diskSizeInSectors / 2;
|
|
} else if (hasSectors) {
|
|
diskSizeInSectors =
|
|
pDiskImg->GetNumTracks() * pDiskImg->GetNumSectPerTrack();
|
|
if (pDiskImg->GetNumSectPerTrack() != 13)
|
|
fSizeInBlocks = diskSizeInSectors / 2;
|
|
} else {
|
|
ASSERT(hasNibbles);
|
|
diskSizeInSectors = kMagicNibbles;
|
|
}
|
|
|
|
if (diskSizeInSectors >= 8388608) {
|
|
/* no conversions for files 2GB and larger except .PO */
|
|
fDiskDescription.Format(IDS_CDESC_BLOCKS, diskSizeInSectors/4);
|
|
fAllowUnadornedProDOS = true;
|
|
fConvertIdx = kConvProDOSRaw;
|
|
} else if (diskSizeInSectors == 35*16) {
|
|
/* 140K disk image */
|
|
fDiskDescription.LoadString(IDS_CDESC_140K);
|
|
fAllowUnadornedDOS = true;
|
|
fAllowUnadornedProDOS = true;
|
|
fAllowProDOS2MG = true;
|
|
fAllowUnadornedNibble = true;
|
|
fAllowNuFX = true;
|
|
fAllowTrackStar = true;
|
|
fAllowSim2eHDV = true;
|
|
fAllowDDD = true;
|
|
if (hasNibbles)
|
|
fConvertIdx = kConvNibbleRaw;
|
|
else
|
|
fConvertIdx = kConvDOSRaw;
|
|
} else if (diskSizeInSectors == 40*16 &&
|
|
(pDiskImg->GetFileFormat() == DiskImg::kFileFormatTrackStar ||
|
|
pDiskImg->GetFileFormat() == DiskImg::kFileFormatFDI))
|
|
{
|
|
/* 40-track TrackStar or FDI image; allow conversion to 35-track formats */
|
|
fDiskDescription.LoadString(IDS_CDESC_40TRACK);
|
|
ASSERT(pDiskImg->GetHasBlocks());
|
|
fAllowUnadornedDOS = true;
|
|
fAllowUnadornedProDOS = true;
|
|
fAllowProDOS2MG = true;
|
|
fAllowUnadornedNibble = true;
|
|
fAllowNuFX = true;
|
|
fAllowSim2eHDV = true;
|
|
fAllowDDD = true;
|
|
fAllowTrackStar = true;
|
|
fConvertIdx = kConvDOSRaw;
|
|
} else if (diskSizeInSectors == 35*13) {
|
|
/* 13-sector 5.25" floppy */
|
|
fDiskDescription.LoadString(IDS_CDEC_140K_13);
|
|
fAllowUnadornedNibble = true;
|
|
fAllowD13 = true;
|
|
fConvertIdx = kConvNibbleRaw;
|
|
} else if (diskSizeInSectors == kMagicNibbles) {
|
|
/* blob of nibbles with no recognizable format; allow self-convert */
|
|
fDiskDescription.LoadString(IDS_CDEC_RAWNIB);
|
|
if (pDiskImg->GetPhysicalFormat() == DiskImg::kPhysicalFormatNib525_6656)
|
|
{
|
|
fAllowUnadornedNibble = true;
|
|
fConvertIdx = kConvNibbleRaw;
|
|
} else if (pDiskImg->GetPhysicalFormat() == DiskImg::kPhysicalFormatNib525_Var)
|
|
{
|
|
fAllowTrackStar = true;
|
|
fConvertIdx = kConvTrackStar;
|
|
} else if (pDiskImg->GetPhysicalFormat() == DiskImg::kPhysicalFormatNib525_6384)
|
|
{
|
|
/* don't currently allow .nb2 output */
|
|
LOGI(" GLITCH: we don't allow self-convert of .nb2 files");
|
|
ASSERT(false);
|
|
} else {
|
|
/* this should be impossible */
|
|
ASSERT(false);
|
|
}
|
|
} else if (diskSizeInSectors == 3200) {
|
|
/* 800K disk image */
|
|
fDiskDescription.LoadString(IDS_CDESC_800K);
|
|
fAllowUnadornedDOS = true;
|
|
fAllowUnadornedProDOS = true;
|
|
fAllowProDOS2MG = true;
|
|
fAllowDiskCopy42 = true;
|
|
fAllowNuFX = true;
|
|
fAllowSim2eHDV = true;
|
|
fConvertIdx = kConvProDOS2MG;
|
|
} else {
|
|
/* odd-sized disk image; could allow DOS if hasSectors */
|
|
fDiskDescription.Format(IDS_CDESC_BLOCKS, diskSizeInSectors/4);
|
|
fAllowUnadornedProDOS = true;
|
|
fAllowProDOS2MG = true;
|
|
fAllowNuFX = true;
|
|
fAllowSim2eHDV = true;
|
|
fConvertIdx = kConvProDOS2MG;
|
|
}
|
|
}
|
|
|
|
void DiskConvertDialog::Init(int fileCount)
|
|
{
|
|
/* allow everything */
|
|
fAllowUnadornedDOS = fAllowUnadornedProDOS = fAllowProDOS2MG =
|
|
fAllowUnadornedNibble = fAllowD13 = fAllowDiskCopy42 =
|
|
fAllowNuFX = fAllowTrackStar = fAllowSim2eHDV = fAllowDDD = true;
|
|
fConvertIdx = kConvDOSRaw; // default choice == first in list
|
|
fBulkFileCount = fileCount;
|
|
fDiskDescription.Format(L"%d images selected", fBulkFileCount);
|
|
}
|
|
|
|
BOOL DiskConvertDialog::OnInitDialog(void)
|
|
{
|
|
CWnd* pWnd;
|
|
|
|
ASSERT(fConvertIdx != -1); // must call Init before DoModal
|
|
|
|
if (!fAllowUnadornedDOS) {
|
|
pWnd = GetDlgItem(IDC_DISKCONV_DOS);
|
|
pWnd->EnableWindow(FALSE);
|
|
pWnd = GetDlgItem(IDC_DISKCONV_DOS2MG);
|
|
pWnd->EnableWindow(FALSE);
|
|
}
|
|
if (!fAllowUnadornedProDOS) {
|
|
pWnd = GetDlgItem(IDC_DISKCONV_PRODOS);
|
|
pWnd->EnableWindow(FALSE);
|
|
}
|
|
if (!fAllowProDOS2MG) {
|
|
pWnd = GetDlgItem(IDC_DISKCONV_PRODOS2MG);
|
|
pWnd->EnableWindow(FALSE);
|
|
}
|
|
if (!fAllowUnadornedNibble) {
|
|
pWnd = GetDlgItem(IDC_DISKCONV_NIB);
|
|
pWnd->EnableWindow(FALSE);
|
|
pWnd = GetDlgItem(IDC_DISKCONV_NIB2MG);
|
|
pWnd->EnableWindow(FALSE);
|
|
}
|
|
if (!fAllowD13) {
|
|
pWnd = GetDlgItem(IDC_DISKCONV_D13);
|
|
pWnd->EnableWindow(FALSE);
|
|
}
|
|
if (!fAllowDiskCopy42) {
|
|
pWnd = GetDlgItem(IDC_DISKCONV_DC42);
|
|
pWnd->EnableWindow(FALSE);
|
|
}
|
|
if (!fAllowNuFX) {
|
|
pWnd = GetDlgItem(IDC_DISKCONV_SDK);
|
|
pWnd->EnableWindow(FALSE);
|
|
}
|
|
if (!fAllowTrackStar) {
|
|
pWnd = GetDlgItem(IDC_DISKCONV_TRACKSTAR);
|
|
pWnd->EnableWindow(FALSE);
|
|
}
|
|
if (!fAllowSim2eHDV) {
|
|
pWnd = GetDlgItem(IDC_DISKCONV_HDV);
|
|
pWnd->EnableWindow(FALSE);
|
|
}
|
|
if (!fAllowDDD) {
|
|
pWnd = GetDlgItem(IDC_DISKCONV_DDD);
|
|
pWnd->EnableWindow(FALSE);
|
|
}
|
|
|
|
if (fBulkFileCount < 0) {
|
|
pWnd = GetDlgItem(IDC_IMAGE_TYPE);
|
|
pWnd->SetWindowText(fDiskDescription);
|
|
} else {
|
|
CRect rect;
|
|
int right;
|
|
pWnd = GetDlgItem(IDC_IMAGE_TYPE);
|
|
pWnd->GetWindowRect(&rect);
|
|
ScreenToClient(&rect);
|
|
right = rect.right;
|
|
pWnd->DestroyWindow();
|
|
|
|
pWnd = GetDlgItem(IDC_IMAGE_SIZE_TEXT);
|
|
pWnd->GetWindowRect(&rect);
|
|
ScreenToClient(&rect);
|
|
rect.right = right;
|
|
pWnd->MoveWindow(&rect);
|
|
pWnd->SetWindowText(fDiskDescription);
|
|
}
|
|
|
|
OnChangeRadio(0); // set the gzip box
|
|
|
|
CDialog::OnInitDialog();
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
void DiskConvertDialog::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
DDX_Check(pDX, IDC_DISKCONV_GZIP, fAddGzip);
|
|
DDX_Radio(pDX, IDC_DISKCONV_DOS, fConvertIdx);
|
|
|
|
if (pDX->m_bSaveAndValidate) {
|
|
switch (fConvertIdx) {
|
|
case kConvDOSRaw: fExtension = L"do"; break;
|
|
case kConvDOS2MG: fExtension = L"2mg"; break;
|
|
case kConvProDOSRaw: fExtension = L"po"; break;
|
|
case kConvProDOS2MG: fExtension = L"2mg"; break;
|
|
case kConvNibbleRaw: fExtension = L"nib"; break;
|
|
case kConvNibble2MG: fExtension = L"2mg"; break;
|
|
case kConvD13: fExtension = L"d13"; break;
|
|
case kConvDiskCopy42: fExtension = L"dsk"; break;
|
|
case kConvNuFX: fExtension = L"sdk"; break;
|
|
case kConvTrackStar: fExtension = L"app"; break;
|
|
case kConvSim2eHDV: fExtension = L"hdv"; break;
|
|
case kConvDDD: fExtension = L"ddd"; break;
|
|
default:
|
|
fExtension = L"???";
|
|
ASSERT(false);
|
|
break;
|
|
}
|
|
|
|
if (fAddGzip && fConvertIdx != kConvNuFX) {
|
|
fExtension += L".gz";
|
|
}
|
|
|
|
LOGI(" DCD recommending extension '%ls'", (LPCWSTR) fExtension);
|
|
}
|
|
}
|
|
|
|
void DiskConvertDialog::OnChangeRadio(UINT nID)
|
|
{
|
|
CWnd* pGzip = GetDlgItem(IDC_DISKCONV_GZIP);
|
|
ASSERT(pGzip != NULL);
|
|
CButton* pNuFX = (CButton*)GetDlgItem(IDC_DISKCONV_SDK);
|
|
ASSERT(pNuFX != NULL);
|
|
|
|
if (fSizeInBlocks > DiskImgLib::kGzipMax / 512)
|
|
pGzip->EnableWindow(FALSE);
|
|
else
|
|
pGzip->EnableWindow(pNuFX->GetCheck() == BST_UNCHECKED);
|
|
}
|