ciderpress/app/AboutDialog.cpp

209 lines
6.1 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.
*/
/*
* Implementation of our About box.
*/
#include "stdafx.h"
#include "AboutDialog.h"
#include "EnterRegDialog.h"
#include "HelpTopics.h"
#include "MyApp.h"
#include "resource.h"
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
#include "../nufxlib/NufxLib.h"
2007-03-27 17:47:10 +00:00
#include "../diskimg/DiskImg.h"
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
#include "../zlib/zlib.h"
2007-03-27 17:47:10 +00:00
BEGIN_MESSAGE_MAP(AboutDialog, CDialog)
ON_BN_CLICKED(IDC_ABOUT_CREDITS, OnAboutCredits)
//ON_BN_CLICKED(IDC_ABOUT_ENTER_REG, OnEnterReg)
2007-03-27 17:47:10 +00:00
END_MESSAGE_MAP()
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
static const WCHAR kVersionExtra[] =
2007-03-27 17:47:10 +00:00
#ifdef _DEBUG
Large set of changes to restore CiderPress build. CiderPress and MDC now compile, and execute far enough to open their respective "about" boxes, but I doubt they'll do much more than that. * Switch from MBCS to UNICODE APIs Microsoft switched to UTF-16 (by way of UCS-2) a long time ago, and the support for MBCS seems to be getting phased out. So it's time to switch to wide strings. This is a bit awkward for CiderPress because it works with disk and file archives with 8-bit filenames, and I want NufxLib and DiskImgLib to continue to work on Linux (which has largely taken the UTF-8 approach to Unicode). The libraries will continue to work with 8-bit filenames, with CiderPress/MDC doing the conversion at the appropriate point. There were a couple of places where strings from a structure handed back by one of the libraries were used directly in the UI, or vice-versa, which is a problem because we have nowhere to store the result of the conversion. These currently have fixed place-holder "xyzzy" strings. All UI strings are now wide. Various format strings now use "%ls" and "%hs" to explicitly specify wide and narrow. This doesn't play well with gcc, so only the Windows-specific parts use those. * Various updates to vcxproj files The project-file conversion had some cruft that is now largely gone. The build now has a common output directory for the EXEs and libraries, avoiding the old post-build copy steps. * Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots The old "prebuilts" directory is now gone. The libraries are now built as part of building the apps. I added a minimal set of files for zlib, and a full set for nufxlib. The Linux-specific nufxlib goodies are included for the benefit of the Linux utilities, which are currently broken (don't build). * Replace symbols used for include guards Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
L" _DEBUG"
2007-03-27 17:47:10 +00:00
#else
Large set of changes to restore CiderPress build. CiderPress and MDC now compile, and execute far enough to open their respective "about" boxes, but I doubt they'll do much more than that. * Switch from MBCS to UNICODE APIs Microsoft switched to UTF-16 (by way of UCS-2) a long time ago, and the support for MBCS seems to be getting phased out. So it's time to switch to wide strings. This is a bit awkward for CiderPress because it works with disk and file archives with 8-bit filenames, and I want NufxLib and DiskImgLib to continue to work on Linux (which has largely taken the UTF-8 approach to Unicode). The libraries will continue to work with 8-bit filenames, with CiderPress/MDC doing the conversion at the appropriate point. There were a couple of places where strings from a structure handed back by one of the libraries were used directly in the UI, or vice-versa, which is a problem because we have nowhere to store the result of the conversion. These currently have fixed place-holder "xyzzy" strings. All UI strings are now wide. Various format strings now use "%ls" and "%hs" to explicitly specify wide and narrow. This doesn't play well with gcc, so only the Windows-specific parts use those. * Various updates to vcxproj files The project-file conversion had some cruft that is now largely gone. The build now has a common output directory for the EXEs and libraries, avoiding the old post-build copy steps. * Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots The old "prebuilts" directory is now gone. The libraries are now built as part of building the apps. I added a minimal set of files for zlib, and a full set for nufxlib. The Linux-specific nufxlib goodies are included for the benefit of the Linux utilities, which are currently broken (don't build). * Replace symbols used for include guards Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
L""
2007-03-27 17:47:10 +00:00
#endif
#ifdef _DEBUG_LOG
Large set of changes to restore CiderPress build. CiderPress and MDC now compile, and execute far enough to open their respective "about" boxes, but I doubt they'll do much more than that. * Switch from MBCS to UNICODE APIs Microsoft switched to UTF-16 (by way of UCS-2) a long time ago, and the support for MBCS seems to be getting phased out. So it's time to switch to wide strings. This is a bit awkward for CiderPress because it works with disk and file archives with 8-bit filenames, and I want NufxLib and DiskImgLib to continue to work on Linux (which has largely taken the UTF-8 approach to Unicode). The libraries will continue to work with 8-bit filenames, with CiderPress/MDC doing the conversion at the appropriate point. There were a couple of places where strings from a structure handed back by one of the libraries were used directly in the UI, or vice-versa, which is a problem because we have nowhere to store the result of the conversion. These currently have fixed place-holder "xyzzy" strings. All UI strings are now wide. Various format strings now use "%ls" and "%hs" to explicitly specify wide and narrow. This doesn't play well with gcc, so only the Windows-specific parts use those. * Various updates to vcxproj files The project-file conversion had some cruft that is now largely gone. The build now has a common output directory for the EXEs and libraries, avoiding the old post-build copy steps. * Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots The old "prebuilts" directory is now gone. The libraries are now built as part of building the apps. I added a minimal set of files for zlib, and a full set for nufxlib. The Linux-specific nufxlib goodies are included for the benefit of the Linux utilities, which are currently broken (don't build). * Replace symbols used for include guards Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
L" _LOG"
2007-03-27 17:47:10 +00:00
#else
Large set of changes to restore CiderPress build. CiderPress and MDC now compile, and execute far enough to open their respective "about" boxes, but I doubt they'll do much more than that. * Switch from MBCS to UNICODE APIs Microsoft switched to UTF-16 (by way of UCS-2) a long time ago, and the support for MBCS seems to be getting phased out. So it's time to switch to wide strings. This is a bit awkward for CiderPress because it works with disk and file archives with 8-bit filenames, and I want NufxLib and DiskImgLib to continue to work on Linux (which has largely taken the UTF-8 approach to Unicode). The libraries will continue to work with 8-bit filenames, with CiderPress/MDC doing the conversion at the appropriate point. There were a couple of places where strings from a structure handed back by one of the libraries were used directly in the UI, or vice-versa, which is a problem because we have nowhere to store the result of the conversion. These currently have fixed place-holder "xyzzy" strings. All UI strings are now wide. Various format strings now use "%ls" and "%hs" to explicitly specify wide and narrow. This doesn't play well with gcc, so only the Windows-specific parts use those. * Various updates to vcxproj files The project-file conversion had some cruft that is now largely gone. The build now has a common output directory for the EXEs and libraries, avoiding the old post-build copy steps. * Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots The old "prebuilts" directory is now gone. The libraries are now built as part of building the apps. I added a minimal set of files for zlib, and a full set for nufxlib. The Linux-specific nufxlib goodies are included for the benefit of the Linux utilities, which are currently broken (don't build). * Replace symbols used for include guards Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
L""
2007-03-27 17:47:10 +00:00
#endif
;
2007-03-27 17:47:10 +00:00
/*
* Update the static strings with DLL version numbers.
*/
BOOL
AboutDialog::OnInitDialog(void)
{
NuError nerr;
long major, minor, bug;
CString newVersion, tmpStr;
CStatic* pStatic;
//CString versionFmt;
/* CiderPress version string */
pStatic = (CStatic*) GetDlgItem(IDC_CIDERPRESS_VERS_TEXT);
ASSERT(pStatic != nil);
pStatic->GetWindowText(tmpStr);
newVersion.Format(tmpStr,
kAppMajorVersion, kAppMinorVersion, kAppBugVersion,
kAppDevString, kVersionExtra);
pStatic->SetWindowText(newVersion);
/* grab the static text control with the NufxLib version info */
pStatic = (CStatic*) GetDlgItem(IDC_NUFXLIB_VERS_TEXT);
ASSERT(pStatic != nil);
nerr = NuGetVersion(&major, &minor, &bug, NULL, NULL);
ASSERT(nerr == kNuErrNone);
pStatic->GetWindowText(tmpStr);
newVersion.Format(tmpStr, major, minor, bug);
pStatic->SetWindowText(newVersion);
/* grab the static text control with the DiskImg version info */
pStatic = (CStatic*) GetDlgItem(IDC_DISKIMG_VERS_TEXT);
ASSERT(pStatic != nil);
DiskImgLib::Global::GetVersion(&major, &minor, &bug);
pStatic->GetWindowText(tmpStr);
newVersion.Format(tmpStr, major, minor, bug);
pStatic->SetWindowText(newVersion);
/* set the zlib version */
pStatic = (CStatic*) GetDlgItem(IDC_ZLIB_VERS_TEXT);
ASSERT(pStatic != nil);
pStatic->GetWindowText(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
CString zlibVersionStr(zlibVersion());
newVersion.Format(tmpStr, zlibVersionStr);
pStatic->SetWindowText(newVersion);
/* and, finally, the ASPI version */
pStatic = (CStatic*) GetDlgItem(IDC_ASPI_VERS_TEXT);
ASSERT(pStatic != nil);
if (DiskImgLib::Global::GetHasASPI()) {
CString versionStr;
DWORD version = DiskImgLib::Global::GetASPIVersion();
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
versionStr.Format(L"%d.%d.%d.%d",
version & 0x0ff,
(version >> 8) & 0xff,
(version >> 16) & 0xff,
(version >> 24) & 0xff);
pStatic->GetWindowText(tmpStr);
newVersion.Format(tmpStr, versionStr);
} else {
newVersion.LoadString(IDS_ASPI_NOT_LOADED);
}
pStatic->SetWindowText(newVersion);
//ShowRegistrationInfo();
{
CWnd* pWnd = GetDlgItem(IDC_ABOUT_ENTER_REG);
if (pWnd != nil) {
pWnd->EnableWindow(FALSE);
pWnd->ShowWindow(FALSE);
}
}
return CDialog::OnInitDialog();
2007-03-27 17:47:10 +00:00
}
#if 0
/*
* Set the appropriate fields in the dialog box.
*
* This is called during initialization and after new registration data is
* entered successfully.
*/
void
AboutDialog::ShowRegistrationInfo(void)
{
/*
* Pull out the registration info. We shouldn't need to do much in the
* way of validation, since it should have been validated either before
* the program finished initializing or before we wrote the values into
* the registry. It's always possible that somebody went and messed with
* the registry while we were running -- perhaps a different instance of
* CiderPress -- but that should be rare enough that we don't have to
* worry about the occasional ugliness.
*/
const int kDay = 24 * 60 * 60;
CString user, company, reg, versions, expire;
CWnd* pUserWnd;
CWnd* pCompanyWnd;
//CWnd* pExpireWnd;
pUserWnd = GetDlgItem(IDC_REG_USER_NAME);
ASSERT(pUserWnd != nil);
pCompanyWnd = GetDlgItem(IDC_REG_COMPANY_NAME);
ASSERT(pCompanyWnd != nil);
//pExpireWnd = GetDlgItem(IDC_REG_EXPIRES);
//ASSERT(pExpireWnd != nil);
if (gMyApp.fRegistry.GetRegistration(&user, &company, &reg, &versions,
&expire) == 0)
{
if (reg.IsEmpty()) {
/* not registered, show blank stuff */
CString unreg;
unreg.LoadString(IDS_ABOUT_UNREGISTERED);
pUserWnd->SetWindowText(unreg);
pCompanyWnd->SetWindowText("");
/* show expire date */
time_t expireWhen;
expireWhen = atol(expire);
if (expireWhen > 0) {
CString expireStr;
time_t now = time(nil);
expireStr.Format(IDS_REG_EVAL_REM,
((expireWhen - now) + kDay-1) / kDay);
/* leave pUserWnd and pCompanyWnd set to defaults */
pCompanyWnd->SetWindowText(expireStr);
} else {
pCompanyWnd->SetWindowText(_T("Has already expired!"));
}
} else {
/* show registration info */
pUserWnd->SetWindowText(user);
pCompanyWnd->SetWindowText(company);
//pExpireWnd->SetWindowText("");
/* remove "Enter Registration" button */
CWnd* pWnd = GetDlgItem(IDC_ABOUT_ENTER_REG);
if (pWnd != nil) {
pWnd->EnableWindow(FALSE);
}
}
}
2007-03-27 17:47:10 +00:00
}
#endif
/*
* User hit the "Credits" button.
*/
void
AboutDialog::OnAboutCredits(void)
{
WinHelp(HELP_TOPIC_CREDITS, HELP_CONTEXT /*HELP_CONTEXTPOPUP*/);
2007-03-27 17:47:10 +00:00
}
#if 0
/*
* User hit "enter registration" button. Bring up the appropriate dialog.
*/
void
AboutDialog::OnEnterReg(void)
{
if (EnterRegDialog::GetRegInfo(this) == 0) {
ShowRegistrationInfo();
}
2007-03-27 17:47:10 +00:00
}
#endif