ciderpress/app/PrefsDialog.cpp

512 lines
16 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.
*/
#include "stdafx.h"
#include "PrefsDialog.h"
#include "ChooseDirDialog.h"
#ifdef CAN_UPDATE_FILE_ASSOC
2007-03-27 17:47:10 +00:00
#include "EditAssocDialog.h"
#endif
2007-03-27 17:47:10 +00:00
#include "Main.h"
#include "NufxArchive.h"
#include "resource.h"
#include <afxpriv.h> // need WM_COMMANDHELP
2007-03-27 17:47:10 +00:00
/*
* ===========================================================================
* PrefsGeneralPage
2007-03-27 17:47:10 +00:00
* ===========================================================================
*/
BEGIN_MESSAGE_MAP(PrefsGeneralPage, CPropertyPage)
ON_CONTROL_RANGE(BN_CLICKED, IDC_COL_PATHNAME, IDC_COL_ACCESS, OnChangeRange)
ON_BN_CLICKED(IDC_PREF_SHRINKIT_COMPAT, OnChange)
ON_BN_CLICKED(IDC_PREF_REDUCE_SHK_ERROR_CHECKS, OnChange)
ON_BN_CLICKED(IDC_PREF_SHK_BAD_MAC, OnChange)
ON_BN_CLICKED(IDC_PREF_COERCE_DOS, OnChange)
ON_BN_CLICKED(IDC_PREF_SPACES_TO_UNDER, OnChange)
ON_BN_CLICKED(IDC_PREF_PASTE_JUNKPATHS, OnChange)
ON_BN_CLICKED(IDC_PREF_SUCCESS_BEEP, OnChange)
ON_BN_CLICKED(IDC_COL_DEFAULTS, OnDefaults)
#ifdef CAN_UPDATE_FILE_ASSOC
ON_BN_CLICKED(IDC_PREF_ASSOCIATIONS, OnAssociations)
#endif
ON_MESSAGE(WM_HELP, OnHelpInfo)
ON_MESSAGE(WM_COMMANDHELP, OnCommandHelp)
2007-03-27 17:47:10 +00:00
END_MESSAGE_MAP()
void PrefsGeneralPage::OnChange(void)
2007-03-27 17:47:10 +00:00
{
/*
* They clicked on a checkbox, just mark the page as dirty so the "apply"
* button will be enabled.
*/
SetModified(TRUE);
2007-03-27 17:47:10 +00:00
}
void PrefsGeneralPage::OnChangeRange(UINT nID)
2007-03-27 17:47:10 +00:00
{
SetModified(TRUE);
2007-03-27 17:47:10 +00:00
}
void PrefsGeneralPage::OnDefaults(void)
2007-03-27 17:47:10 +00:00
{
/*
* Since we don't actually set column widths here, we need to tell the main
* window that the defaults button was pushed. It needs to reset all column
* widths to defaults, and then take into account any checking and un-checking
* that was done after "defaults" was pushed.
*/
LOGD("OnDefaults");
2007-03-27 17:47:10 +00:00
CButton* pButton;
2007-03-27 17:47:10 +00:00
fDefaultsPushed = true;
2007-03-27 17:47:10 +00:00
ASSERT(IDC_COL_ACCESS == IDC_COL_PATHNAME + (kNumVisibleColumns-1));
2007-03-27 17:47:10 +00:00
/* assumes that the controls are numbered sequentially */
for (int i = 0; i < kNumVisibleColumns; i++) {
pButton = (CButton*) GetDlgItem(IDC_COL_PATHNAME+i);
2014-11-18 05:13:13 +00:00
ASSERT(pButton != NULL);
pButton->SetCheck(1); // 0=unchecked, 1=checked, 2=indeterminate
}
2007-03-27 17:47:10 +00:00
SetModified(TRUE);
2007-03-27 17:47:10 +00:00
}
#ifdef CAN_UPDATE_FILE_ASSOC
void PrefsGeneralPage::OnAssociations(void)
2007-03-27 17:47:10 +00:00
{
EditAssocDialog assocDlg;
2007-03-27 17:47:10 +00:00
assocDlg.fOurAssociations = fOurAssociations;
2014-11-18 05:13:13 +00:00
fOurAssociations = NULL;
2007-03-27 17:47:10 +00:00
if (assocDlg.DoModal() == IDOK) {
/*
* Make a copy of the changes and mark us as modified so
* the Apply/Cancel buttons behave as expected. (We don't make
* a copy so much as steal the data from the dialog object.)
*/
delete[] fOurAssociations;
fOurAssociations = assocDlg.fOurAssociations;
2014-11-18 05:13:13 +00:00
assocDlg.fOurAssociations = NULL;
SetModified(TRUE);
}
2007-03-27 17:47:10 +00:00
}
#endif
2007-03-27 17:47:10 +00:00
void PrefsGeneralPage::DoDataExchange(CDataExchange* pDX)
2007-03-27 17:47:10 +00:00
{
/*
* The various column checkboxes are independent. We still do the xfer
* for "pathname" even though it's disabled.
*/
fReady = true;
2007-03-27 17:47:10 +00:00
ASSERT(NELEM(fColumn) == 9);
DDX_Check(pDX, IDC_COL_PATHNAME, fColumn[0]);
DDX_Check(pDX, IDC_COL_TYPE, fColumn[1]);
DDX_Check(pDX, IDC_COL_AUXTYPE, fColumn[2]);
DDX_Check(pDX, IDC_COL_MODDATE, fColumn[3]);
DDX_Check(pDX, IDC_COL_FORMAT, fColumn[4]);
DDX_Check(pDX, IDC_COL_SIZE, fColumn[5]);
DDX_Check(pDX, IDC_COL_RATIO, fColumn[6]);
DDX_Check(pDX, IDC_COL_PACKED, fColumn[7]);
DDX_Check(pDX, IDC_COL_ACCESS, fColumn[8]);
2007-03-27 17:47:10 +00:00
DDX_Check(pDX, IDC_PREF_SHRINKIT_COMPAT, fMimicShrinkIt);
DDX_Check(pDX, IDC_PREF_SHK_BAD_MAC, fBadMacSHK);
DDX_Check(pDX, IDC_PREF_REDUCE_SHK_ERROR_CHECKS, fReduceSHKErrorChecks);
DDX_Check(pDX, IDC_PREF_COERCE_DOS, fCoerceDOSFilenames);
DDX_Check(pDX, IDC_PREF_SPACES_TO_UNDER, fSpacesToUnder);
DDX_Check(pDX, IDC_PREF_PASTE_JUNKPATHS, fPasteJunkPaths);
DDX_Check(pDX, IDC_PREF_SUCCESS_BEEP, fBeepOnSuccess);
2007-03-27 17:47:10 +00:00
}
/*
* ===========================================================================
* PrefsDiskImagePage
2007-03-27 17:47:10 +00:00
* ===========================================================================
*/
BEGIN_MESSAGE_MAP(PrefsDiskImagePage, CPropertyPage)
ON_BN_CLICKED(IDC_PDISK_CONFIRM_FORMAT, OnChange)
ON_BN_CLICKED(IDC_PDISK_OPENVOL_RO, OnChange)
ON_BN_CLICKED(IDC_PDISK_OPENVOL_PHYS0, OnChange)
ON_BN_CLICKED(IDC_PDISK_PRODOS_ALLOWLOWER, OnChange)
ON_BN_CLICKED(IDC_PDISK_PRODOS_USESPARSE, OnChange)
ON_MESSAGE(WM_HELP, OnHelpInfo)
ON_MESSAGE(WM_COMMANDHELP, OnCommandHelp)
2007-03-27 17:47:10 +00:00
END_MESSAGE_MAP()
BOOL PrefsDiskImagePage::OnInitDialog(void)
2007-03-27 17:47:10 +00:00
{
//LOGI("OnInit!");
return CPropertyPage::OnInitDialog();
2007-03-27 17:47:10 +00:00
}
void PrefsDiskImagePage::OnChange(void)
2007-03-27 17:47:10 +00:00
{
LOGD("OnChange");
SetModified(TRUE); // enable the "apply" button
2007-03-27 17:47:10 +00:00
}
//void PrefsDiskImagePage::OnChangeRange(UINT nID)
2007-03-27 17:47:10 +00:00
//{
// LOGD("OnChangeRange id=%d", nID);
// SetModified(TRUE);
2007-03-27 17:47:10 +00:00
//}
void PrefsDiskImagePage::DoDataExchange(CDataExchange* pDX)
2007-03-27 17:47:10 +00:00
{
fReady = true;
DDX_Check(pDX, IDC_PDISK_CONFIRM_FORMAT, fQueryImageFormat);
DDX_Check(pDX, IDC_PDISK_OPENVOL_RO, fOpenVolumeRO);
DDX_Check(pDX, IDC_PDISK_OPENVOL_PHYS0, fOpenVolumePhys0);
DDX_Check(pDX, IDC_PDISK_PRODOS_ALLOWLOWER, fProDOSAllowLower);
DDX_Check(pDX, IDC_PDISK_PRODOS_USESPARSE, fProDOSUseSparse);
2007-03-27 17:47:10 +00:00
}
/*
* ===========================================================================
* PrefsCompressionPage
2007-03-27 17:47:10 +00:00
* ===========================================================================
*/
BEGIN_MESSAGE_MAP(PrefsCompressionPage, CPropertyPage)
ON_CONTROL_RANGE(BN_CLICKED, IDC_DEFC_UNCOMPRESSED, IDC_DEFC_BZIP2, OnChangeRange)
ON_MESSAGE(WM_HELP, OnHelpInfo)
ON_MESSAGE(WM_COMMANDHELP, OnCommandHelp)
2007-03-27 17:47:10 +00:00
END_MESSAGE_MAP()
BOOL PrefsCompressionPage::OnInitDialog(void)
2007-03-27 17:47:10 +00:00
{
if (!NufxArchive::IsCompressionSupported(kNuThreadFormatHuffmanSQ)) {
DisableWnd(IDC_DEFC_SQUEEZE);
if (fCompressType == kNuThreadFormatHuffmanSQ)
fCompressType = kNuThreadFormatUncompressed;
}
if (!NufxArchive::IsCompressionSupported(kNuThreadFormatLZW1)) {
DisableWnd(IDC_DEFC_LZW1);
if (fCompressType == kNuThreadFormatLZW1)
fCompressType = kNuThreadFormatUncompressed;
}
if (!NufxArchive::IsCompressionSupported(kNuThreadFormatLZW2)) {
DisableWnd(IDC_DEFC_LZW2);
if (fCompressType == kNuThreadFormatLZW2) {
fCompressType = kNuThreadFormatUncompressed;
}
}
if (!NufxArchive::IsCompressionSupported(kNuThreadFormatLZC12)) {
DisableWnd(IDC_DEFC_LZC12);
if (fCompressType == kNuThreadFormatLZC12)
fCompressType = kNuThreadFormatUncompressed;
}
if (!NufxArchive::IsCompressionSupported(kNuThreadFormatLZC16)) {
DisableWnd(IDC_DEFC_LZC16);
if (fCompressType == kNuThreadFormatLZC16)
fCompressType = kNuThreadFormatUncompressed;
}
if (!NufxArchive::IsCompressionSupported(kNuThreadFormatDeflate)) {
DisableWnd(IDC_DEFC_DEFLATE);
if (fCompressType == kNuThreadFormatDeflate)
fCompressType = kNuThreadFormatUncompressed;
}
if (!NufxArchive::IsCompressionSupported(kNuThreadFormatBzip2)) {
DisableWnd(IDC_DEFC_BZIP2);
if (fCompressType == kNuThreadFormatBzip2)
fCompressType = kNuThreadFormatUncompressed;
}
/* now invoke DoDataExchange with our modified fCompressType */
return CPropertyPage::OnInitDialog();
2007-03-27 17:47:10 +00:00
}
void PrefsCompressionPage::DisableWnd(int id)
2007-03-27 17:47:10 +00:00
{
CWnd* pWnd;
pWnd = GetDlgItem(id);
2014-11-18 05:13:13 +00:00
if (pWnd == NULL) {
ASSERT(false);
return;
}
pWnd->EnableWindow(FALSE);
2007-03-27 17:47:10 +00:00
}
void PrefsCompressionPage::OnChangeRange(UINT nID)
2007-03-27 17:47:10 +00:00
{
SetModified(TRUE); // enable the "apply" button
2007-03-27 17:47:10 +00:00
}
void PrefsCompressionPage::DoDataExchange(CDataExchange* pDX)
2007-03-27 17:47:10 +00:00
{
/*
* Compression types match the NuThreadFormat enum in NufxLib.h, starting
* with IDC_DEFC_UNCOMPRESSED.
*/
LOGV("OnInit comp!");
fReady = true;
DDX_Radio(pDX, IDC_DEFC_UNCOMPRESSED, fCompressType);
2007-03-27 17:47:10 +00:00
}
/*
* ===========================================================================
* PrefsFviewPage
2007-03-27 17:47:10 +00:00
* ===========================================================================
*/
BEGIN_MESSAGE_MAP(PrefsFviewPage, CPropertyPage)
ON_CONTROL_RANGE(BN_CLICKED, IDC_PVIEW_NOWRAP_TEXT, IDC_PVIEW_HIRES_BW, OnChangeRange)
ON_CONTROL_RANGE(BN_CLICKED, IDC_PVIEW_HITEXT, IDC_PVIEW_TEXT8, OnChangeRange)
ON_EN_CHANGE(IDC_PVIEW_SIZE_EDIT, OnChange)
ON_CBN_SELCHANGE(IDC_PVIEW_DHR_CONV_COMBO, OnChange)
ON_MESSAGE(WM_HELP, OnHelpInfo)
ON_MESSAGE(WM_COMMANDHELP, OnCommandHelp)
2007-03-27 17:47:10 +00:00
END_MESSAGE_MAP()
BOOL PrefsFviewPage::OnInitDialog(void)
2007-03-27 17:47:10 +00:00
{
CSpinButtonCtrl* pSpin;
2007-03-27 17:47:10 +00:00
LOGV("Configuring spin");
2007-03-27 17:47:10 +00:00
pSpin = (CSpinButtonCtrl*) GetDlgItem(IDC_PVIEW_SIZE_SPIN);
2014-11-18 05:13:13 +00:00
ASSERT(pSpin != NULL);
2007-03-27 17:47:10 +00:00
UDACCEL uda;
uda.nSec = 0;
uda.nInc = 64;
pSpin->SetRange(1, 32767);
pSpin->SetAccel(1, &uda);
LOGD("OnInit done!");
2007-03-27 17:47:10 +00:00
return CPropertyPage::OnInitDialog();
2007-03-27 17:47:10 +00:00
}
void PrefsFviewPage::OnChange(void)
2007-03-27 17:47:10 +00:00
{
LOGD("OnChange");
SetModified(TRUE); // enable the "apply" button
2007-03-27 17:47:10 +00:00
}
void PrefsFviewPage::OnChangeRange(UINT nID)
2007-03-27 17:47:10 +00:00
{
LOGD("OnChangeRange id=%d", nID);
SetModified(TRUE);
2007-03-27 17:47:10 +00:00
}
void PrefsFviewPage::DoDataExchange(CDataExchange* pDX)
2007-03-27 17:47:10 +00:00
{
fReady = true;
//DDX_Check(pDX, IDC_PVIEW_EOL_RAW, fEOLConvRaw);
DDX_Check(pDX, IDC_PVIEW_NOWRAP_TEXT, fNoWrapText);
DDX_Check(pDX, IDC_PVIEW_BOLD_HEXDUMP, fHighlightHexDump);
DDX_Check(pDX, IDC_PVIEW_BOLD_BASIC, fHighlightBASIC);
DDX_Check(pDX, IDC_PVIEW_DISASM_ONEBYTEBRKCOP, fConvDisasmOneByteBrkCop);
DDX_Check(pDX, IDC_PVIEW_HIRES_BW, fConvHiResBlackWhite);
DDX_CBIndex(pDX, IDC_PVIEW_DHR_CONV_COMBO, fConvDHRAlgorithm);
DDX_Check(pDX, IDC_PVIEW_HITEXT, fConvTextEOL_HA);
DDX_Check(pDX, IDC_PVIEW_CPMTEXT, fConvCPMText);
DDX_Check(pDX, IDC_PVIEW_PASCALTEXT, fConvPascalText);
DDX_Check(pDX, IDC_PVIEW_PASCALCODE, fConvPascalCode);
DDX_Check(pDX, IDC_PVIEW_APPLESOFT, fConvApplesoft);
DDX_Check(pDX, IDC_PVIEW_INTEGER, fConvInteger);
DDX_Check(pDX, IDC_PVIEW_GWP, fConvGWP);
DDX_Check(pDX, IDC_PVIEW_TEXT8, fConvText8);
DDX_Check(pDX, IDC_PVIEW_AWP, fConvAWP);
DDX_Check(pDX, IDC_PVIEW_ADB, fConvADB);
DDX_Check(pDX, IDC_PVIEW_ASP, fConvASP);
DDX_Check(pDX, IDC_PVIEW_SCASSEM, fConvSCAssem);
DDX_Check(pDX, IDC_PVIEW_DISASM, fConvDisasm);
DDX_Check(pDX, IDC_PVIEW_HIRES, fConvHiRes);
DDX_Check(pDX, IDC_PVIEW_DHR, fConvDHR);
DDX_Check(pDX, IDC_PVIEW_SHR, fConvSHR);
DDX_Check(pDX, IDC_PVIEW_PRINTSHOP, fConvPrintShop);
DDX_Check(pDX, IDC_PVIEW_MACPAINT, fConvMacPaint);
DDX_Check(pDX, IDC_PVIEW_PRODOSFOLDER, fConvProDOSFolder);
DDX_Check(pDX, IDC_PVIEW_RESOURCES, fConvResources);
DDX_Check(pDX, IDC_PVIEW_RELAX_GFX, fRelaxGfxTypeCheck);
DDX_Text(pDX, IDC_PVIEW_SIZE_EDIT, fMaxViewFileSizeKB);
DDV_MinMaxUInt(pDX, fMaxViewFileSizeKB, 1, 32767);
2007-03-27 17:47:10 +00:00
}
/*
* ===========================================================================
* PrefsFilesPage
2007-03-27 17:47:10 +00:00
* ===========================================================================
*/
BEGIN_MESSAGE_MAP(PrefsFilesPage, CPropertyPage)
ON_EN_CHANGE(IDC_PREF_TEMP_FOLDER, OnChange)
ON_EN_CHANGE(IDC_PREF_EXTVIEWER_EXTS, OnChange)
ON_BN_CLICKED(IDC_PREF_CHOOSE_TEMP_FOLDER, OnChooseFolder)
ON_MESSAGE(WM_HELP, OnHelpInfo)
ON_MESSAGE(WM_COMMANDHELP, OnCommandHelp)
2007-03-27 17:47:10 +00:00
END_MESSAGE_MAP()
BOOL PrefsFilesPage::OnInitDialog(void)
2007-03-27 17:47:10 +00:00
{
fChooseFolderButton.ReplaceDlgCtrl(this, IDC_PREF_CHOOSE_TEMP_FOLDER);
fChooseFolderButton.SetBitmapID(IDB_CHOOSE_FOLDER);
2007-03-27 17:47:10 +00:00
return CPropertyPage::OnInitDialog();
2007-03-27 17:47:10 +00:00
}
void PrefsFilesPage::OnChange(void)
2007-03-27 17:47:10 +00:00
{
SetModified(TRUE); // enable the "apply" button
2007-03-27 17:47:10 +00:00
}
void PrefsFilesPage::DoDataExchange(CDataExchange* pDX)
2007-03-27 17:47:10 +00:00
{
fReady = true;
DDX_Text(pDX, IDC_PREF_TEMP_FOLDER, fTempPath);
DDX_Text(pDX, IDC_PREF_EXTVIEWER_EXTS, fExtViewerExts);
2007-03-27 17:47:10 +00:00
/* validate the path field */
if (pDX->m_bSaveAndValidate) {
if (fTempPath.IsEmpty()) {
CString appName;
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
MessageBox(L"You must specify a path for temp files",
appName, MB_OK);
pDX->Fail();
}
2007-03-27 17:47:10 +00:00
// we *could* try to validate the path here...
}
2007-03-27 17:47:10 +00:00
}
void PrefsFilesPage::OnChooseFolder(void)
2007-03-27 17:47:10 +00:00
{
/*
* They want to choose the folder from a menu hierarchy. Show them a list.
*/
ChooseDirDialog chooseDir(this);
CWnd* pEditWnd;
CString editPath;
2007-03-27 17:47:10 +00:00
/* get the currently-showing text from the edit field */
pEditWnd = GetDlgItem(IDC_PREF_TEMP_FOLDER);
2014-11-18 05:13:13 +00:00
ASSERT(pEditWnd != NULL);
pEditWnd->GetWindowText(editPath);
2007-03-27 17:47:10 +00:00
chooseDir.SetPathName(editPath);
if (chooseDir.DoModal() == IDOK) {
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
const WCHAR* ccp = chooseDir.GetPathName();
LOGD("New temp path chosen = '%ls'", ccp);
2007-03-27 17:47:10 +00:00
pEditWnd->SetWindowText(ccp);
2007-03-27 17:47:10 +00:00
// activate the "apply" button
OnChange();
}
2007-03-27 17:47:10 +00:00
}
/*
* ===========================================================================
* PrefsSheet
2007-03-27 17:47:10 +00:00
* ===========================================================================
*/
BEGIN_MESSAGE_MAP(PrefsSheet, CPropertySheet)
ON_WM_NCCREATE()
ON_BN_CLICKED(ID_APPLY_NOW, OnApplyNow)
ON_COMMAND(ID_HELP, OnIDHelp)
ON_MESSAGE(WM_HELP, OnHelpInfo)
2007-03-27 17:47:10 +00:00
END_MESSAGE_MAP()
PrefsSheet::PrefsSheet(CWnd* 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
CPropertySheet(L"Preferences", pParentWnd)
2007-03-27 17:47:10 +00:00
{
AddPage(&fGeneralPage);
AddPage(&fDiskImagePage);
AddPage(&fFviewPage);
AddPage(&fCompressionPage);
AddPage(&fFilesPage);
2007-03-27 17:47:10 +00:00
/* this happens automatically with appropriate ID_HELP handlers */
//m_psh.dwFlags |= PSH_HASHELP;
2007-03-27 17:47:10 +00:00
}
BOOL PrefsSheet::OnNcCreate(LPCREATESTRUCT cs)
2007-03-27 17:47:10 +00:00
{
LOGV("PrefsSheet OnNcCreate");
BOOL val = CPropertySheet::OnNcCreate(cs);
ModifyStyleEx(0, WS_EX_CONTEXTHELP);
return val;
2007-03-27 17:47:10 +00:00
}
void PrefsSheet::OnApplyNow(void)
2007-03-27 17:47:10 +00:00
{
BOOL result;
if (fGeneralPage.fReady) {
//LOGI("Apply to general?");
result = fGeneralPage.UpdateData(TRUE);
if (!result)
return;
}
if (fDiskImagePage.fReady) {
//LOGI("Apply to disk images?");
result = fDiskImagePage.UpdateData(TRUE);
if (!result)
return;
}
if (fCompressionPage.fReady) {
//LOGI("Apply to compression?");
result = fCompressionPage.UpdateData(TRUE);
if (!result)
return;
}
if (fFviewPage.fReady) {
//LOGI("Apply to fview?");
result = fFviewPage.UpdateData(TRUE);
if (!result)
return;
}
if (fFilesPage.fReady) {
//LOGI("Apply to fview?");
result = fFilesPage.UpdateData(TRUE);
if (!result)
return;
}
/* reset all to "unmodified" state */
LOGD("All 'applies' were successful");
((MainWindow*) AfxGetMainWnd())->ApplyNow(this);
fGeneralPage.SetModified(FALSE);
fGeneralPage.fDefaultsPushed = false;
fDiskImagePage.SetModified(FALSE);
fCompressionPage.SetModified(FALSE);
fFviewPage.SetModified(FALSE);
fFilesPage.SetModified(FALSE);
2007-03-27 17:47:10 +00:00
}
void PrefsSheet::OnIDHelp(void)
2007-03-27 17:47:10 +00:00
{
LOGD("PrefsSheet OnIDHelp");
2007-03-27 17:47:10 +00:00
SendMessage(WM_COMMANDHELP);
}