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.
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* File actions. These are actually part of MainWindow, but for readability
|
|
|
|
* these are split into their own file.
|
|
|
|
*/
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include "Main.h"
|
|
|
|
#include "ViewFilesDialog.h"
|
|
|
|
#include "ChooseDirDialog.h"
|
|
|
|
#include "AddFilesDialog.h"
|
|
|
|
#include "CreateSubdirDialog.h"
|
|
|
|
#include "ExtractOptionsDialog.h"
|
|
|
|
#include "UseSelectionDialog.h"
|
|
|
|
#include "RecompressOptionsDialog.h"
|
|
|
|
#include "ConvDiskOptionsDialog.h"
|
|
|
|
#include "ConvFileOptionsDialog.h"
|
|
|
|
#include "EditCommentDialog.h"
|
|
|
|
#include "EditPropsDialog.h"
|
|
|
|
#include "RenameVolumeDialog.h"
|
|
|
|
#include "ConfirmOverwriteDialog.h"
|
|
|
|
#include "ImageFormatDialog.h"
|
|
|
|
#include "FileNameConv.h"
|
|
|
|
#include "GenericArchive.h"
|
|
|
|
#include "NufxArchive.h"
|
|
|
|
#include "DiskArchive.h"
|
|
|
|
#include "ChooseAddTargetDialog.h"
|
|
|
|
#include "CassetteDialog.h"
|
|
|
|
#include "BasicImport.h"
|
|
|
|
#include "../diskimg/TwoImg.h"
|
|
|
|
#include <errno.h>
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ==========================================================================
|
2014-11-04 00:26:53 +00:00
|
|
|
* View
|
2007-03-27 17:47:10 +00:00
|
|
|
* ==========================================================================
|
|
|
|
*/
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void MainWindow::OnActionsView(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
HandleView();
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
2014-11-21 21:18:20 +00:00
|
|
|
void MainWindow::OnUpdateActionsView(CCmdUI* pCmdUI)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 05:13:13 +00:00
|
|
|
pCmdUI->Enable(fpContentList != NULL &&
|
2014-11-04 00:26:53 +00:00
|
|
|
fpContentList->GetSelectedCount() > 0);
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void MainWindow::HandleView(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(fpContentList != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
SelectionSet selSet;
|
|
|
|
int threadMask = GenericEntry::kAnyThread | GenericEntry::kAllowDamaged |
|
|
|
|
GenericEntry::kAllowDirectory | GenericEntry::kAllowVolumeDir;
|
|
|
|
selSet.CreateFromSelection(fpContentList, threadMask);
|
|
|
|
selSet.Dump();
|
|
|
|
|
|
|
|
if (selSet.GetNumEntries() == 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
|
|
|
MessageBox(L"Nothing viewable found.",
|
|
|
|
L"No match", MB_OK | MB_ICONEXCLAMATION);
|
2014-11-04 00:26:53 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ViewFilesDialog vfd(this);
|
|
|
|
vfd.SetSelectionSet(&selSet);
|
|
|
|
vfd.SetTextTypeFace(fPreferences.GetPrefString(kPrViewTextTypeFace));
|
|
|
|
vfd.SetTextPointSize(fPreferences.GetPrefLong(kPrViewTextPointSize));
|
|
|
|
vfd.SetNoWrapText(fPreferences.GetPrefBool(kPrNoWrapText));
|
|
|
|
vfd.DoModal();
|
|
|
|
|
|
|
|
// remember which font they used (sticky pref, not in registry)
|
|
|
|
fPreferences.SetPrefString(kPrViewTextTypeFace, vfd.GetTextTypeFace());
|
|
|
|
fPreferences.SetPrefLong(kPrViewTextPointSize, vfd.GetTextPointSize());
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("Preferences: saving view font %d-point '%ls'",
|
2014-11-04 00:26:53 +00:00
|
|
|
fPreferences.GetPrefLong(kPrViewTextPointSize),
|
|
|
|
fPreferences.GetPrefString(kPrViewTextTypeFace));
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ==========================================================================
|
2014-11-04 00:26:53 +00:00
|
|
|
* Open as disk image
|
2007-03-27 17:47:10 +00:00
|
|
|
* ==========================================================================
|
|
|
|
*/
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void MainWindow::OnActionsOpenAsDisk(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(fpContentList != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
ASSERT(fpContentList->GetSelectedCount() == 1);
|
|
|
|
|
|
|
|
GenericEntry* pEntry = GetSelectedItem(fpContentList);
|
|
|
|
if (pEntry->GetHasDiskImage())
|
|
|
|
TmpExtractAndOpen(pEntry, GenericEntry::kDiskImageThread, kModeDiskImage);
|
|
|
|
else
|
|
|
|
TmpExtractAndOpen(pEntry, GenericEntry::kDataThread, kModeDiskImage);
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
2014-11-21 21:18:20 +00:00
|
|
|
void MainWindow::OnUpdateActionsOpenAsDisk(CCmdUI* pCmdUI)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
const int kMinLen = 512 * 7;
|
|
|
|
bool allow = false;
|
|
|
|
|
2014-11-18 05:13:13 +00:00
|
|
|
if (fpContentList != NULL && fpContentList->GetSelectedCount() == 1) {
|
2014-11-04 00:26:53 +00:00
|
|
|
GenericEntry* pEntry = GetSelectedItem(fpContentList);
|
2014-11-18 05:13:13 +00:00
|
|
|
if (pEntry != NULL) {
|
2014-11-04 00:26:53 +00:00
|
|
|
if ((pEntry->GetHasDataFork() || pEntry->GetHasDiskImage()) &&
|
|
|
|
pEntry->GetUncompressedLen() > kMinLen)
|
|
|
|
{
|
|
|
|
allow = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pCmdUI->Enable(allow);
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ==========================================================================
|
2014-11-04 00:26:53 +00:00
|
|
|
* Add Files
|
2007-03-27 17:47:10 +00:00
|
|
|
* ==========================================================================
|
|
|
|
*/
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void MainWindow::OnActionsAddFiles(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("Add files!");
|
2014-11-04 00:26:53 +00:00
|
|
|
AddFilesDialog addFiles(this);
|
2014-11-18 05:13:13 +00:00
|
|
|
DiskImgLib::A2File* pTargetSubdir = NULL;
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Special handling for adding files to disk images.
|
|
|
|
*/
|
|
|
|
if (fpOpenArchive->GetArchiveKind() == GenericArchive::kArchiveDiskImage)
|
|
|
|
{
|
|
|
|
if (!ChooseAddTarget(&pTargetSubdir, &addFiles.fpTargetDiskFS))
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
addFiles.fStoragePrefix = "";
|
|
|
|
addFiles.fIncludeSubfolders =
|
|
|
|
fPreferences.GetPrefBool(kPrAddIncludeSubFolders);
|
|
|
|
addFiles.fStripFolderNames =
|
|
|
|
fPreferences.GetPrefBool(kPrAddStripFolderNames);
|
|
|
|
addFiles.fOverwriteExisting =
|
|
|
|
fPreferences.GetPrefBool(kPrAddOverwriteExisting);
|
|
|
|
addFiles.fTypePreservation =
|
|
|
|
fPreferences.GetPrefLong(kPrAddTypePreservation);
|
|
|
|
addFiles.fConvEOL =
|
|
|
|
fPreferences.GetPrefLong(kPrAddConvEOL);
|
|
|
|
|
|
|
|
/* if they can't convert EOL when adding files, disable the option */
|
|
|
|
if (!fpOpenArchive->GetCapability(GenericArchive::kCapCanConvEOLOnAdd)) {
|
|
|
|
addFiles.fConvEOL = AddFilesDialog::kConvEOLNone;
|
|
|
|
addFiles.fConvEOLEnable = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Disable editing of the storage prefix field. Force pathname
|
|
|
|
* stripping to be on for non-hierarchical filesystems (i.e. everything
|
|
|
|
* but ProDOS and HFS).
|
|
|
|
*/
|
2014-11-18 05:13:13 +00:00
|
|
|
if (addFiles.fpTargetDiskFS != NULL) {
|
2014-11-04 00:26:53 +00:00
|
|
|
DiskImg::FSFormat format;
|
|
|
|
format = addFiles.fpTargetDiskFS->GetDiskImg()->GetFSFormat();
|
|
|
|
|
2014-11-18 05:13:13 +00:00
|
|
|
if (pTargetSubdir != NULL) {
|
2014-11-04 00:26:53 +00:00
|
|
|
ASSERT(!pTargetSubdir->IsVolumeDirectory());
|
|
|
|
addFiles.fStoragePrefix = pTargetSubdir->GetPathName();
|
|
|
|
}
|
|
|
|
|
|
|
|
addFiles.fStripFolderNamesEnable = false;
|
|
|
|
addFiles.fStoragePrefixEnable = false;
|
|
|
|
switch (format) {
|
|
|
|
case DiskImg::kFormatProDOS:
|
|
|
|
case DiskImg::kFormatMacHFS:
|
|
|
|
addFiles.fStripFolderNamesEnable = true;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!addFiles.fStripFolderNamesEnable) {
|
|
|
|
/* if we disabled it, we did so because it's mandatory */
|
|
|
|
addFiles.fStripFolderNames = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
addFiles.m_ofn.lpstrInitialDir = fPreferences.GetPrefString(kPrAddFileFolder);
|
|
|
|
|
2014-12-04 00:10:03 +00:00
|
|
|
LRESULT addResult = addFiles.DoModal();
|
|
|
|
if (addResult == IDOK) {
|
2014-11-04 00:26:53 +00:00
|
|
|
fPreferences.SetPrefBool(kPrAddIncludeSubFolders,
|
|
|
|
addFiles.fIncludeSubfolders != 0);
|
|
|
|
if (addFiles.fStripFolderNamesEnable) {
|
|
|
|
// only update the pref if they had the ability to change it
|
|
|
|
fPreferences.SetPrefBool(kPrAddStripFolderNames,
|
|
|
|
addFiles.fStripFolderNames != 0);
|
|
|
|
}
|
|
|
|
fPreferences.SetPrefBool(kPrAddOverwriteExisting,
|
|
|
|
addFiles.fOverwriteExisting != 0);
|
|
|
|
fPreferences.SetPrefLong(kPrAddTypePreservation,
|
|
|
|
addFiles.fTypePreservation);
|
|
|
|
if (addFiles.fConvEOLEnable)
|
|
|
|
fPreferences.SetPrefLong(kPrAddConvEOL,
|
|
|
|
addFiles.fConvEOL);
|
|
|
|
|
2014-12-04 00:10:03 +00:00
|
|
|
CString saveFolder = addFiles.GetDirectory();
|
2014-11-04 00:26:53 +00:00
|
|
|
fPreferences.SetPrefString(kPrAddFileFolder, saveFolder);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set up a progress dialog and kick things off.
|
|
|
|
*/
|
|
|
|
bool result;
|
|
|
|
fpActionProgress = new ActionProgressDialog;
|
|
|
|
fpActionProgress->Create(ActionProgressDialog::kActionAdd, this);
|
|
|
|
|
|
|
|
//fpContentList->Invalidate(); // don't allow redraws until done
|
|
|
|
result = fpOpenArchive->BulkAdd(fpActionProgress, &addFiles);
|
|
|
|
fpContentList->Reload();
|
|
|
|
|
|
|
|
fpActionProgress->Cleanup(this);
|
2014-11-18 05:13:13 +00:00
|
|
|
fpActionProgress = NULL;
|
2014-11-04 00:26:53 +00:00
|
|
|
if (result)
|
|
|
|
SuccessBeep();
|
|
|
|
} else {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("SFD bailed with Cancel");
|
2014-11-04 00:26:53 +00:00
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
2014-11-21 21:18:20 +00:00
|
|
|
void MainWindow::OnUpdateActionsAddFiles(CCmdUI* pCmdUI)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 05:13:13 +00:00
|
|
|
pCmdUI->Enable(fpContentList != NULL && !fpOpenArchive->IsReadOnly());
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
bool MainWindow::ChooseAddTarget(DiskImgLib::A2File** ppTargetSubdir,
|
2014-11-04 00:26:53 +00:00
|
|
|
DiskImgLib::DiskFS** ppTargetDiskFS)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(ppTargetSubdir != NULL);
|
|
|
|
ASSERT(ppTargetDiskFS != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
2014-11-18 05:13:13 +00:00
|
|
|
*ppTargetSubdir = NULL;
|
|
|
|
*ppTargetDiskFS = NULL;
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
GenericEntry* pEntry = GetSelectedItem(fpContentList);
|
2014-11-18 05:13:13 +00:00
|
|
|
if (pEntry != NULL &&
|
2014-11-04 00:26:53 +00:00
|
|
|
(pEntry->GetRecordKind() == GenericEntry::kRecordKindDirectory ||
|
|
|
|
pEntry->GetRecordKind() == GenericEntry::kRecordKindVolumeDir))
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* They've selected a single subdirectory. Add the files there.
|
|
|
|
*/
|
|
|
|
DiskEntry* pDiskEntry = (DiskEntry*) pEntry;
|
|
|
|
*ppTargetSubdir = pDiskEntry->GetA2File();
|
|
|
|
*ppTargetDiskFS = (*ppTargetSubdir)->GetDiskFS();
|
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* Nothing selected, non-subdir selected, or multiple files
|
|
|
|
* selected. Whatever the case, pop up the choose target dialog.
|
|
|
|
*
|
|
|
|
* This works on DOS 3.3 and Pascal disks, because the absence
|
|
|
|
* of subdirectories means there's only one possible place to
|
|
|
|
* put the files. We could short-circuit this code for anything
|
|
|
|
* but ProDOS and HFS, but we have to be careful about embedded
|
|
|
|
* sub-volumes.
|
|
|
|
*/
|
|
|
|
DiskArchive* pDiskArchive = (DiskArchive*) fpOpenArchive;
|
|
|
|
|
2014-12-05 01:05:48 +00:00
|
|
|
LOGD("Trying ChooseAddTarget");
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
ChooseAddTargetDialog targetDialog(this);
|
|
|
|
targetDialog.fpDiskFS = pDiskArchive->GetDiskFS();
|
|
|
|
if (targetDialog.DoModal() != IDOK)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
*ppTargetSubdir = targetDialog.fpChosenSubdir;
|
|
|
|
*ppTargetDiskFS = targetDialog.fpChosenDiskFS;
|
|
|
|
|
|
|
|
/* make sure the subdir is part of the diskfs */
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(*ppTargetSubdir == NULL ||
|
2014-11-04 00:26:53 +00:00
|
|
|
(*ppTargetSubdir)->GetDiskFS() == *ppTargetDiskFS);
|
|
|
|
}
|
|
|
|
|
2014-11-18 05:13:13 +00:00
|
|
|
if (*ppTargetSubdir != NULL && (*ppTargetSubdir)->IsVolumeDirectory())
|
|
|
|
*ppTargetSubdir = NULL;
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
return true;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ==========================================================================
|
2014-11-04 00:26:53 +00:00
|
|
|
* Add Disks
|
2007-03-27 17:47:10 +00:00
|
|
|
* ==========================================================================
|
|
|
|
*/
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void MainWindow::OnActionsAddDisks(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
DIError dierr;
|
|
|
|
DiskImg img;
|
|
|
|
CString failed, errMsg;
|
|
|
|
CString openFilters, saveFolder;
|
2014-11-23 18:34:57 +00:00
|
|
|
CStringA pathNameA;
|
2014-11-04 00:26:53 +00:00
|
|
|
AddFilesDialog addOpts;
|
|
|
|
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("Add disks!");
|
2014-11-04 00:26:53 +00:00
|
|
|
|
2014-12-16 19:04:31 +00:00
|
|
|
CheckedLoadString(&failed, IDS_FAILED);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
openFilters = kOpenDiskImage;
|
|
|
|
openFilters += kOpenAll;
|
|
|
|
openFilters += kOpenEnd;
|
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
|
|
|
CFileDialog dlg(TRUE, L"dsk", NULL, OFN_FILEMUSTEXIST, openFilters, this);
|
|
|
|
dlg.m_ofn.lpstrTitle = L"Add Disk Image";
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
/* file is always opened read-only */
|
|
|
|
dlg.m_ofn.Flags |= OFN_HIDEREADONLY;
|
|
|
|
dlg.m_ofn.lpstrInitialDir = fPreferences.GetPrefString(kPrAddFileFolder);
|
|
|
|
|
|
|
|
if (dlg.DoModal() != IDOK)
|
|
|
|
goto bail;
|
|
|
|
|
|
|
|
saveFolder = dlg.m_ofn.lpstrFile;
|
|
|
|
saveFolder = saveFolder.Left(dlg.m_ofn.nFileOffset);
|
|
|
|
fPreferences.SetPrefString(kPrAddFileFolder, saveFolder);
|
|
|
|
|
|
|
|
/* open the image file and analyze it */
|
2014-11-23 18:34:57 +00:00
|
|
|
pathNameA = dlg.GetPathName();
|
|
|
|
dierr = img.OpenImage(pathNameA, PathProposal::kLocalFssep, true);
|
2014-11-04 00:26:53 +00:00
|
|
|
if (dierr != kDIErrNone) {
|
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.Format(L"Unable to open disk image: %hs.",
|
2014-11-04 00:26:53 +00:00
|
|
|
DiskImgLib::DIStrError(dierr));
|
|
|
|
MessageBox(errMsg, failed, MB_OK|MB_ICONSTOP);
|
|
|
|
goto bail;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (img.AnalyzeImage() != kDIErrNone) {
|
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.Format(L"The file '%ls' doesn't seem to hold a valid disk image.",
|
2014-11-19 22:54:24 +00:00
|
|
|
(LPCWSTR) dlg.GetPathName());
|
2014-11-04 00:26:53 +00:00
|
|
|
MessageBox(errMsg, failed, MB_OK|MB_ICONSTOP);
|
|
|
|
goto bail;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* if requested (or necessary), verify the format */
|
|
|
|
if (/*img.GetFSFormat() == DiskImg::kFormatUnknown ||*/
|
|
|
|
img.GetSectorOrder() == DiskImg::kSectorOrderUnknown ||
|
|
|
|
fPreferences.GetPrefBool(kPrQueryImageFormat))
|
|
|
|
{
|
|
|
|
ImageFormatDialog imf;
|
|
|
|
|
|
|
|
imf.InitializeValues(&img);
|
|
|
|
imf.fFileSource = dlg.GetPathName();
|
|
|
|
imf.SetQueryDisplayFormat(false);
|
|
|
|
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI(" On entry, sectord=%d format=%d",
|
2014-11-04 00:26:53 +00:00
|
|
|
imf.fSectorOrder, imf.fFSFormat);
|
|
|
|
if (imf.fFSFormat == DiskImg::kFormatUnknown)
|
|
|
|
imf.fFSFormat = DiskImg::kFormatGenericProDOSOrd;
|
|
|
|
|
|
|
|
if (imf.DoModal() != IDOK) {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("User bailed on IMF dialog");
|
2014-11-04 00:26:53 +00:00
|
|
|
goto bail;
|
|
|
|
}
|
|
|
|
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI(" On exit, sectord=%d format=%d",
|
2014-11-04 00:26:53 +00:00
|
|
|
imf.fSectorOrder, imf.fFSFormat);
|
|
|
|
|
|
|
|
if (imf.fSectorOrder != img.GetSectorOrder() ||
|
|
|
|
imf.fFSFormat != img.GetFSFormat())
|
|
|
|
{
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("Initial values overridden, forcing img format");
|
2014-11-04 00:26:53 +00:00
|
|
|
dierr = img.OverrideFormat(img.GetPhysicalFormat(), imf.fFSFormat,
|
|
|
|
imf.fSectorOrder);
|
|
|
|
if (dierr != kDIErrNone) {
|
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.Format(L"Unable to access disk image using selected"
|
|
|
|
L" parameters. Error: %hs.",
|
2014-11-04 00:26:53 +00:00
|
|
|
DiskImgLib::DIStrError(dierr));
|
|
|
|
MessageBox(errMsg, failed, MB_OK | MB_ICONSTOP);
|
|
|
|
goto bail;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We want to read from the image the way that a ProDOS application
|
|
|
|
* would, which means forcing the FSFormat to generic ProDOS ordering.
|
|
|
|
* This way, ProDOS disks load serially, and DOS 3.3 disks load with
|
|
|
|
* their sectors swapped around.
|
|
|
|
*/
|
|
|
|
dierr = img.OverrideFormat(img.GetPhysicalFormat(),
|
|
|
|
DiskImg::kFormatGenericProDOSOrd, img.GetSectorOrder());
|
|
|
|
if (dierr != kDIErrNone) {
|
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.Format(L"Internal error: couldn't switch to generic ProDOS: %hs.",
|
2014-11-04 00:26:53 +00:00
|
|
|
DiskImgLib::DIStrError(dierr));
|
|
|
|
MessageBox(errMsg, failed, MB_OK | MB_ICONSTOP);
|
|
|
|
goto bail;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set up an AddFilesDialog, but don't actually use it as a dialog.
|
|
|
|
* Instead, we just configure the various options appropriately.
|
|
|
|
*/
|
|
|
|
ASSERT(dlg.m_ofn.nFileOffset > 0);
|
2014-12-04 00:10:03 +00:00
|
|
|
{
|
|
|
|
CString directory(dlg.m_ofn.lpstrFile, dlg.m_ofn.nFileOffset - 1);
|
|
|
|
CString file(dlg.m_ofn.lpstrFile + dlg.m_ofn.nFileOffset);
|
|
|
|
LOGD("Stuffing '%ls' '%ls'", (LPCWSTR) directory, (LPCWSTR) file);
|
|
|
|
addOpts.StuffSingleFilename(directory, file);
|
|
|
|
}
|
2014-11-04 00:26:53 +00:00
|
|
|
addOpts.fStoragePrefix = "";
|
|
|
|
addOpts.fIncludeSubfolders = false;
|
|
|
|
addOpts.fStripFolderNames = false;
|
|
|
|
addOpts.fOverwriteExisting = false;
|
|
|
|
addOpts.fTypePreservation = AddFilesDialog::kPreserveTypes;
|
|
|
|
addOpts.fConvEOL = AddFilesDialog::kConvEOLNone;
|
|
|
|
addOpts.fConvEOLEnable = false; // no EOL conversion on disk images!
|
|
|
|
addOpts.fpDiskImg = &img;
|
|
|
|
|
|
|
|
bool result;
|
|
|
|
|
|
|
|
fpActionProgress = new ActionProgressDialog;
|
|
|
|
fpActionProgress->Create(ActionProgressDialog::kActionAddDisk, this);
|
|
|
|
|
|
|
|
//fpContentList->Invalidate(); // don't allow updates until done
|
|
|
|
result = fpOpenArchive->AddDisk(fpActionProgress, &addOpts);
|
|
|
|
fpContentList->Reload();
|
|
|
|
|
|
|
|
fpActionProgress->Cleanup(this);
|
2014-11-18 05:13:13 +00:00
|
|
|
fpActionProgress = NULL;
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
if (result)
|
|
|
|
SuccessBeep();
|
2007-03-27 17:47:10 +00:00
|
|
|
|
|
|
|
bail:
|
2014-11-04 00:26:53 +00:00
|
|
|
return;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
2014-11-21 21:18:20 +00:00
|
|
|
void MainWindow::OnUpdateActionsAddDisks(CCmdUI* pCmdUI)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 05:13:13 +00:00
|
|
|
pCmdUI->Enable(fpContentList != NULL && !fpOpenArchive->IsReadOnly() &&
|
2014-11-04 00:26:53 +00:00
|
|
|
fpOpenArchive->GetCapability(GenericArchive::kCapCanAddDisk));
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ==========================================================================
|
2014-11-04 00:26:53 +00:00
|
|
|
* Create Subdirectory
|
2007-03-27 17:47:10 +00:00
|
|
|
* ==========================================================================
|
|
|
|
*/
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void MainWindow::OnActionsCreateSubdir(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
CreateSubdirDialog csDialog;
|
|
|
|
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(fpContentList != NULL);
|
|
|
|
ASSERT(fpOpenArchive != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
ASSERT(!fpOpenArchive->IsReadOnly());
|
|
|
|
|
|
|
|
GenericEntry* pEntry = GetSelectedItem(fpContentList);
|
2014-11-18 05:13:13 +00:00
|
|
|
if (pEntry == NULL) {
|
2014-11-04 00:26:53 +00:00
|
|
|
// can happen for no selection or multi-selection; should not be here
|
|
|
|
ASSERT(false);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (pEntry->GetRecordKind() != GenericEntry::kRecordKindDirectory &&
|
|
|
|
pEntry->GetRecordKind() != GenericEntry::kRecordKindVolumeDir)
|
|
|
|
{
|
|
|
|
CString errMsg;
|
|
|
|
errMsg = "Please select a subdirectory.";
|
|
|
|
ShowFailureMsg(this, errMsg, IDS_MB_APP_NAME);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-01-09 01:41:53 +00:00
|
|
|
LOGI("Creating subdir in '%ls'", (LPCWSTR) pEntry->GetPathNameUNI());
|
2014-11-04 00:26:53 +00:00
|
|
|
|
2015-01-09 01:41:53 +00:00
|
|
|
csDialog.fBasePath = pEntry->GetPathNameUNI();
|
2014-11-04 00:26:53 +00:00
|
|
|
csDialog.fpArchive = fpOpenArchive;
|
|
|
|
csDialog.fpParentEntry = pEntry;
|
|
|
|
csDialog.fNewName = "New.Subdir";
|
|
|
|
if (csDialog.DoModal() != IDOK)
|
|
|
|
return;
|
|
|
|
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("Creating '%ls'", (LPCWSTR) csDialog.fNewName);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
fpOpenArchive->CreateSubdir(this, pEntry, csDialog.fNewName);
|
|
|
|
fpContentList->Reload();
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
2014-11-21 21:18:20 +00:00
|
|
|
void MainWindow::OnUpdateActionsCreateSubdir(CCmdUI* pCmdUI)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 05:13:13 +00:00
|
|
|
bool enable = fpContentList != NULL && !fpOpenArchive->IsReadOnly() &&
|
2014-11-04 00:26:53 +00:00
|
|
|
fpContentList->GetSelectedCount() == 1 &&
|
|
|
|
fpOpenArchive->GetCapability(GenericArchive::kCapCanCreateSubdir);
|
|
|
|
|
|
|
|
if (enable) {
|
|
|
|
/* second-level check: make sure it's a subdir */
|
|
|
|
GenericEntry* pEntry = GetSelectedItem(fpContentList);
|
2014-11-18 05:13:13 +00:00
|
|
|
if (pEntry == NULL) {
|
2014-11-04 00:26:53 +00:00
|
|
|
ASSERT(false);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (pEntry->GetRecordKind() != GenericEntry::kRecordKindDirectory &&
|
|
|
|
pEntry->GetRecordKind() != GenericEntry::kRecordKindVolumeDir)
|
|
|
|
{
|
|
|
|
enable = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pCmdUI->Enable(enable);
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ==========================================================================
|
2014-11-04 00:26:53 +00:00
|
|
|
* Extract
|
2007-03-27 17:47:10 +00:00
|
|
|
* ==========================================================================
|
|
|
|
*/
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void MainWindow::OnActionsExtract(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(fpContentList != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Ask the user about various options.
|
|
|
|
*/
|
|
|
|
ExtractOptionsDialog extOpts(fpContentList->GetSelectedCount(), this);
|
|
|
|
extOpts.fExtractPath = fPreferences.GetPrefString(kPrExtractFileFolder);
|
|
|
|
extOpts.fConvEOL = fPreferences.GetPrefLong(kPrExtractConvEOL);
|
|
|
|
extOpts.fConvHighASCII = fPreferences.GetPrefBool(kPrExtractConvHighASCII);
|
|
|
|
extOpts.fIncludeDataForks = fPreferences.GetPrefBool(kPrExtractIncludeData);
|
|
|
|
extOpts.fIncludeRsrcForks = fPreferences.GetPrefBool(kPrExtractIncludeRsrc);
|
|
|
|
extOpts.fIncludeDiskImages = fPreferences.GetPrefBool(kPrExtractIncludeDisk);
|
|
|
|
extOpts.fEnableReformat = fPreferences.GetPrefBool(kPrExtractEnableReformat);
|
|
|
|
extOpts.fDiskTo2MG = fPreferences.GetPrefBool(kPrExtractDiskTo2MG);
|
|
|
|
extOpts.fAddTypePreservation = fPreferences.GetPrefBool(kPrExtractAddTypePreservation);
|
|
|
|
extOpts.fAddExtension = fPreferences.GetPrefBool(kPrExtractAddExtension);
|
|
|
|
extOpts.fStripFolderNames = fPreferences.GetPrefBool(kPrExtractStripFolderNames);
|
|
|
|
extOpts.fOverwriteExisting = fPreferences.GetPrefBool(kPrExtractOverwriteExisting);
|
|
|
|
|
|
|
|
if (fpContentList->GetSelectedCount() > 0)
|
|
|
|
extOpts.fFilesToExtract = ExtractOptionsDialog::kExtractSelection;
|
|
|
|
else
|
|
|
|
extOpts.fFilesToExtract = ExtractOptionsDialog::kExtractAll;
|
|
|
|
|
|
|
|
if (extOpts.DoModal() != IDOK)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (extOpts.fExtractPath.Right(1) != "\\")
|
|
|
|
extOpts.fExtractPath += "\\";
|
|
|
|
|
|
|
|
/* push preferences back out */
|
|
|
|
fPreferences.SetPrefString(kPrExtractFileFolder, extOpts.fExtractPath);
|
|
|
|
fPreferences.SetPrefLong(kPrExtractConvEOL, extOpts.fConvEOL);
|
|
|
|
fPreferences.SetPrefBool(kPrExtractConvHighASCII, extOpts.fConvHighASCII != 0);
|
|
|
|
fPreferences.SetPrefBool(kPrExtractIncludeData, extOpts.fIncludeDataForks != 0);
|
|
|
|
fPreferences.SetPrefBool(kPrExtractIncludeRsrc, extOpts.fIncludeRsrcForks != 0);
|
|
|
|
fPreferences.SetPrefBool(kPrExtractIncludeDisk, extOpts.fIncludeDiskImages != 0);
|
|
|
|
fPreferences.SetPrefBool(kPrExtractEnableReformat, extOpts.fEnableReformat != 0);
|
|
|
|
fPreferences.SetPrefBool(kPrExtractDiskTo2MG, extOpts.fDiskTo2MG != 0);
|
|
|
|
fPreferences.SetPrefBool(kPrExtractAddTypePreservation, extOpts.fAddTypePreservation != 0);
|
|
|
|
fPreferences.SetPrefBool(kPrExtractAddExtension, extOpts.fAddExtension != 0);
|
|
|
|
fPreferences.SetPrefBool(kPrExtractStripFolderNames, extOpts.fStripFolderNames != 0);
|
|
|
|
fPreferences.SetPrefBool(kPrExtractOverwriteExisting, extOpts.fOverwriteExisting != 0);
|
|
|
|
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("Requested extract path is '%ls'", (LPCWSTR) extOpts.fExtractPath);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Create a "selection set" of things to display.
|
|
|
|
*/
|
|
|
|
SelectionSet selSet;
|
|
|
|
int threadMask = 0;
|
|
|
|
if (extOpts.fIncludeDataForks)
|
|
|
|
threadMask |= GenericEntry::kDataThread;
|
|
|
|
if (extOpts.fIncludeRsrcForks)
|
|
|
|
threadMask |= GenericEntry::kRsrcThread;
|
|
|
|
if (extOpts.fIncludeDiskImages)
|
|
|
|
threadMask |= GenericEntry::kDiskImageThread;
|
|
|
|
|
|
|
|
if (extOpts.fFilesToExtract == ExtractOptionsDialog::kExtractSelection) {
|
|
|
|
selSet.CreateFromSelection(fpContentList, threadMask);
|
|
|
|
} else {
|
|
|
|
selSet.CreateFromAll(fpContentList, threadMask);
|
|
|
|
}
|
|
|
|
//selSet.Dump();
|
|
|
|
|
|
|
|
if (selSet.GetNumEntries() == 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
|
|
|
MessageBox(L"No files matched the selection criteria.",
|
|
|
|
L"No match", MB_OK | MB_ICONEXCLAMATION);
|
2014-11-04 00:26:53 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set up the progress dialog then do the extraction.
|
|
|
|
*/
|
|
|
|
fpActionProgress = new ActionProgressDialog;
|
|
|
|
fpActionProgress->Create(ActionProgressDialog::kActionExtract, this);
|
|
|
|
DoBulkExtract(&selSet, &extOpts);
|
|
|
|
fpActionProgress->Cleanup(this);
|
2014-11-18 05:13:13 +00:00
|
|
|
fpActionProgress = NULL;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
2014-11-21 21:18:20 +00:00
|
|
|
void MainWindow::OnUpdateActionsExtract(CCmdUI* pCmdUI)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 05:13:13 +00:00
|
|
|
pCmdUI->Enable(fpContentList != NULL);
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void MainWindow::DoBulkExtract(SelectionSet* pSelSet,
|
2014-11-04 00:26:53 +00:00
|
|
|
const ExtractOptionsDialog* pExtOpts)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-21 21:18:20 +00:00
|
|
|
/*
|
|
|
|
* IMPORTANT: since the pActionProgress dialog has the foreground, it's
|
|
|
|
* vital that any MessageBox calls go through that. Otherwise the
|
|
|
|
* progress dialog message handler won't get disabled by MessageBox and
|
|
|
|
* we can end up permanently hiding the dialog. (Could also use
|
|
|
|
* ::MessageBox or ::AfxMessageBox instead.)
|
|
|
|
*/
|
2014-11-18 05:13:13 +00:00
|
|
|
ReformatHolder* pHolder = NULL;
|
2014-11-04 00:26:53 +00:00
|
|
|
bool overwriteExisting, ovwrForAll;
|
|
|
|
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pSelSet != NULL);
|
|
|
|
ASSERT(fpActionProgress != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
pSelSet->IterReset();
|
|
|
|
|
|
|
|
/* set up our "overwrite existing files" logic */
|
|
|
|
overwriteExisting = ovwrForAll = (pExtOpts->fOverwriteExisting != FALSE);
|
|
|
|
|
|
|
|
while (true) {
|
|
|
|
SelectionEntry* pSelEntry;
|
|
|
|
bool result;
|
|
|
|
|
|
|
|
/* make sure we service events */
|
|
|
|
PeekAndPump();
|
|
|
|
|
|
|
|
pSelEntry = pSelSet->IterNext();
|
2014-11-18 05:13:13 +00:00
|
|
|
if (pSelEntry == NULL) {
|
2014-11-04 00:26:53 +00:00
|
|
|
SuccessBeep();
|
|
|
|
break; // out of while (all done!)
|
|
|
|
}
|
|
|
|
|
|
|
|
GenericEntry* pEntry = pSelEntry->GetEntry();
|
|
|
|
if (pEntry->GetDamaged()) {
|
2015-01-09 01:41:53 +00:00
|
|
|
LOGI("Skipping '%ls' due to damage", (LPCWSTR) pEntry->GetPathNameUNI());
|
2014-11-04 00:26:53 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Extract all parts of the file -- including those we don't actually
|
|
|
|
* intend to extract to disk -- and hold them in the ReformatHolder.
|
|
|
|
* Some formats, e.g. GWP, need the resource fork to do formatting,
|
|
|
|
* so it's important to have the resource fork available even if
|
|
|
|
* we're just going to throw it away.
|
|
|
|
*
|
|
|
|
* The selection set should have screened out anything totally
|
|
|
|
* inappropriate, e.g. files with nothing but a resource fork don't
|
|
|
|
* make it into the set if we're not extracting resource forks.
|
|
|
|
*
|
|
|
|
* We only want to reformat files, not disk images, directories,
|
|
|
|
* volume dirs, etc. We have a reformatter for ProDOS directories,
|
|
|
|
* but (a) we don't explicitly extract subdirs, and (b) we'd really
|
|
|
|
* like directories to be directories so we can extract files into
|
|
|
|
* them.
|
|
|
|
*/
|
|
|
|
if (pExtOpts->ShouldTryReformat() &&
|
|
|
|
(pEntry->GetRecordKind() == GenericEntry::kRecordKindFile ||
|
|
|
|
pEntry->GetRecordKind() == GenericEntry::kRecordKindForkedFile))
|
|
|
|
{
|
|
|
|
fpActionProgress->SetArcName(pEntry->GetDisplayName());
|
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
|
|
|
fpActionProgress->SetFileName(L"-");
|
2014-11-04 00:26:53 +00:00
|
|
|
SET_PROGRESS_BEGIN();
|
|
|
|
|
|
|
|
if (GetFileParts(pEntry, &pHolder) == 0) {
|
|
|
|
/*
|
|
|
|
* Use the prefs, but disable generic text conversion, so
|
|
|
|
* that we default to "raw". That way we will use the text
|
|
|
|
* conversion that the user has specified in the "extract"
|
|
|
|
* dialog.
|
|
|
|
*
|
|
|
|
* We might want to just disable any "always"-level
|
|
|
|
* reformatter, but that would require tweaking the reformat
|
|
|
|
* code to return "raw" when nothing applies.
|
|
|
|
*/
|
|
|
|
ConfigureReformatFromPreferences(pHolder);
|
|
|
|
pHolder->SetReformatAllowed(ReformatHolder::kReformatTextEOL_HA,
|
|
|
|
false);
|
|
|
|
|
|
|
|
pHolder->SetSourceAttributes(
|
|
|
|
pEntry->GetFileType(),
|
|
|
|
pEntry->GetAuxType(),
|
|
|
|
ReformatterSourceFormat(pEntry->GetSourceFS()),
|
2015-01-09 01:41:53 +00:00
|
|
|
pEntry->GetFileNameExtensionMOR());
|
2014-11-04 00:26:53 +00:00
|
|
|
pHolder->TestApplicability();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pExtOpts->fIncludeDataForks && pEntry->GetHasDataFork()) {
|
|
|
|
result = ExtractEntry(pEntry, GenericEntry::kDataThread,
|
|
|
|
pHolder, pExtOpts, &overwriteExisting, &ovwrForAll);
|
|
|
|
if (!result)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (pExtOpts->fIncludeRsrcForks && pEntry->GetHasRsrcFork()) {
|
|
|
|
result = ExtractEntry(pEntry, GenericEntry::kRsrcThread,
|
|
|
|
pHolder, pExtOpts, &overwriteExisting, &ovwrForAll);
|
|
|
|
if (!result)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (pExtOpts->fIncludeDiskImages && pEntry->GetHasDiskImage()) {
|
|
|
|
result = ExtractEntry(pEntry, GenericEntry::kDiskImageThread,
|
|
|
|
pHolder, pExtOpts, &overwriteExisting, &ovwrForAll);
|
|
|
|
if (!result)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
delete pHolder;
|
2014-11-18 05:13:13 +00:00
|
|
|
pHolder = NULL;
|
2014-11-04 00:26:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// if they cancelled, delete the "stray"
|
|
|
|
delete pHolder;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
bool MainWindow::ExtractEntry(GenericEntry* pEntry, int thread,
|
2014-11-04 00:26:53 +00:00
|
|
|
ReformatHolder* pHolder, const ExtractOptionsDialog* pExtOpts,
|
|
|
|
bool* pOverwriteExisting, bool* pOvwrForAll)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
/*
|
|
|
|
* This first bit of setup is the same for every file. However, it's
|
|
|
|
* pretty quick, and it's easier to pass "pExtOpts" in than all of
|
|
|
|
* this stuff, so we just do it every time.
|
|
|
|
*/
|
|
|
|
GenericEntry::ConvertEOL convEOL;
|
|
|
|
GenericEntry::ConvertHighASCII convHA;
|
|
|
|
bool convTextByType = false;
|
|
|
|
|
|
|
|
|
|
|
|
/* translate the EOL conversion mode into GenericEntry terms */
|
|
|
|
switch (pExtOpts->fConvEOL) {
|
|
|
|
case ExtractOptionsDialog::kConvEOLNone:
|
|
|
|
convEOL = GenericEntry::kConvertEOLOff;
|
|
|
|
break;
|
|
|
|
case ExtractOptionsDialog::kConvEOLType:
|
|
|
|
convEOL = GenericEntry::kConvertEOLOff;
|
|
|
|
convTextByType = true;
|
|
|
|
break;
|
|
|
|
case ExtractOptionsDialog::kConvEOLAuto:
|
|
|
|
convEOL = GenericEntry::kConvertEOLAuto;
|
|
|
|
break;
|
|
|
|
case ExtractOptionsDialog::kConvEOLAll:
|
|
|
|
convEOL = GenericEntry::kConvertEOLOn;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ASSERT(false);
|
|
|
|
convEOL = GenericEntry::kConvertEOLOff;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (pExtOpts->fConvHighASCII)
|
|
|
|
convHA = GenericEntry::kConvertHAAuto;
|
|
|
|
else
|
|
|
|
convHA = GenericEntry::kConvertHAOff;
|
|
|
|
|
2014-11-18 21:05:15 +00:00
|
|
|
//LOGI(" DBE initial text conversion: eol=%d ha=%d",
|
2014-11-04 00:26:53 +00:00
|
|
|
// convEOL, convHA);
|
|
|
|
|
|
|
|
|
|
|
|
ReformatHolder holder;
|
|
|
|
CString outputPath;
|
|
|
|
CString failed, errMsg;
|
2014-12-16 19:04:31 +00:00
|
|
|
CheckedLoadString(&failed, IDS_FAILED);
|
2014-11-04 00:26:53 +00:00
|
|
|
bool writeFailed = false;
|
|
|
|
bool extractAs2MG = false;
|
2014-11-18 05:13:13 +00:00
|
|
|
char* reformatText = NULL;
|
|
|
|
MyDIBitmap* reformatDib = NULL;
|
2014-11-04 00:26:53 +00:00
|
|
|
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pEntry != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* If we're interested in extracting disk images as 2MG files,
|
|
|
|
* see if we want to handle this one that way.
|
|
|
|
*
|
|
|
|
* If they said "don't extract disk images", the images should
|
|
|
|
* have been culled from the selection set earlier.
|
|
|
|
*/
|
|
|
|
if (pEntry->GetRecordKind() == GenericEntry::kRecordKindDisk) {
|
|
|
|
ASSERT(pExtOpts->fIncludeDiskImages);
|
|
|
|
if (pExtOpts->fDiskTo2MG) {
|
|
|
|
if (pEntry->GetUncompressedLen() > 0 &&
|
|
|
|
(pEntry->GetUncompressedLen() % TwoImgHeader::kBlockSize) == 0)
|
|
|
|
{
|
|
|
|
extractAs2MG = true;
|
|
|
|
} else {
|
2014-11-19 22:54:24 +00:00
|
|
|
LOGI("Not extracting funky image '%ls' as 2MG (len=%I64d)",
|
2015-01-09 01:41:53 +00:00
|
|
|
(LPCWSTR) pEntry->GetPathNameUNI(),
|
|
|
|
pEntry->GetUncompressedLen());
|
2014-11-04 00:26:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Convert the archived pathname to something suitable for the
|
|
|
|
* local machine (i.e. Win32).
|
|
|
|
*/
|
|
|
|
PathProposal pathProp;
|
|
|
|
CString convName, convNameExtd, convNameExtdPlus;
|
|
|
|
pathProp.Init(pEntry);
|
|
|
|
pathProp.fThreadKind = thread;
|
|
|
|
if (pExtOpts->fStripFolderNames)
|
|
|
|
pathProp.fJunkPaths = true;
|
|
|
|
|
|
|
|
pathProp.ArchiveToLocal();
|
|
|
|
convName = pathProp.fLocalPathName;
|
|
|
|
|
|
|
|
/* run it through again, this time with optional type preservation */
|
|
|
|
if (pExtOpts->fAddTypePreservation)
|
|
|
|
pathProp.fPreservation = true;
|
|
|
|
pathProp.ArchiveToLocal();
|
|
|
|
convNameExtd = pathProp.fLocalPathName;
|
|
|
|
|
|
|
|
/* and a 3rd time, also taking additional extensions into account */
|
|
|
|
if (pExtOpts->fAddExtension)
|
|
|
|
pathProp.fAddExtension = true;
|
|
|
|
pathProp.ArchiveToLocal();
|
|
|
|
convNameExtdPlus = pathProp.fLocalPathName;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Prepend the extraction dir to the local pathname. We also add
|
|
|
|
* the sub-volume name (if any), which should already be a valid
|
|
|
|
* Win32 directory name. We can't add it earlier because the fssep
|
|
|
|
* char might be '\0'.
|
|
|
|
*/
|
|
|
|
ASSERT(pExtOpts->fExtractPath.Right(1) == "\\");
|
|
|
|
CString adjustedExtractPath(pExtOpts->fExtractPath);
|
2015-01-09 01:41:53 +00:00
|
|
|
if (!pExtOpts->fStripFolderNames && !pEntry->GetSubVolName().IsEmpty()) {
|
2014-11-04 00:26:53 +00:00
|
|
|
adjustedExtractPath += pEntry->GetSubVolName();
|
|
|
|
adjustedExtractPath += "\\";
|
|
|
|
}
|
|
|
|
outputPath = adjustedExtractPath;
|
|
|
|
outputPath += convNameExtdPlus;
|
|
|
|
|
|
|
|
|
2014-11-18 05:13:13 +00:00
|
|
|
ReformatOutput* pOutput = NULL;
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* If requested, try to reformat this file.
|
|
|
|
*/
|
2014-11-18 05:13:13 +00:00
|
|
|
if (pHolder != NULL) {
|
2014-11-04 00:26:53 +00:00
|
|
|
ReformatHolder::ReformatPart part = ReformatHolder::kPartUnknown;
|
|
|
|
ReformatHolder::ReformatID id;
|
|
|
|
CString title;
|
|
|
|
//int result;
|
|
|
|
|
|
|
|
switch (thread) {
|
|
|
|
case GenericEntry::kDataThread:
|
|
|
|
part = ReformatHolder::kPartData;
|
|
|
|
break;
|
|
|
|
case GenericEntry::kRsrcThread:
|
|
|
|
part = ReformatHolder::kPartRsrc;
|
|
|
|
break;
|
|
|
|
case GenericEntry::kDiskImageThread:
|
|
|
|
part = ReformatHolder::kPartData;
|
|
|
|
break;
|
|
|
|
case GenericEntry::kCommentThread:
|
|
|
|
default:
|
|
|
|
assert(false);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
fpActionProgress->SetFileName(_T("(reformatting)"));
|
|
|
|
id = pHolder->FindBest(part);
|
|
|
|
|
|
|
|
{
|
|
|
|
CWaitCursor waitc;
|
|
|
|
pOutput = pHolder->Apply(part, id);
|
|
|
|
}
|
|
|
|
|
2014-11-18 05:13:13 +00:00
|
|
|
if (pOutput != NULL) {
|
2014-11-04 00:26:53 +00:00
|
|
|
/* use output pathname without preservation */
|
|
|
|
CString tmpPath;
|
|
|
|
bool goodReformat = true;
|
|
|
|
bool noChangePath = false;
|
|
|
|
|
|
|
|
tmpPath = adjustedExtractPath;
|
|
|
|
tmpPath += convName;
|
|
|
|
|
|
|
|
CString lastFour = tmpPath.Right(4);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Tack on a file extension identifying the reformatted
|
|
|
|
* contents. If the filename already has the correct
|
|
|
|
* extension, don't tack it on again.
|
|
|
|
*/
|
|
|
|
switch (pOutput->GetOutputKind()) {
|
|
|
|
case ReformatOutput::kOutputText:
|
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
|
|
|
if (lastFour.CompareNoCase(L".txt") != 0)
|
|
|
|
tmpPath += L".txt";
|
2014-11-04 00:26:53 +00:00
|
|
|
break;
|
|
|
|
case ReformatOutput::kOutputRTF:
|
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
|
|
|
if (lastFour.CompareNoCase(L".rtf") != 0)
|
|
|
|
tmpPath += L".rtf";
|
2014-11-04 00:26:53 +00:00
|
|
|
break;
|
|
|
|
case ReformatOutput::kOutputCSV:
|
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
|
|
|
if (lastFour.CompareNoCase(L".csv") != 0)
|
|
|
|
tmpPath += L".csv";
|
2014-11-04 00:26:53 +00:00
|
|
|
break;
|
|
|
|
case ReformatOutput::kOutputBitmap:
|
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
|
|
|
if (lastFour.CompareNoCase(L".bmp") != 0)
|
|
|
|
tmpPath += L".bmp";
|
2014-11-04 00:26:53 +00:00
|
|
|
break;
|
|
|
|
case ReformatOutput::kOutputRaw:
|
|
|
|
noChangePath = true;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
// kOutputErrorMsg, kOutputUnknown
|
|
|
|
goodReformat = false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (goodReformat) {
|
|
|
|
if (!noChangePath)
|
|
|
|
outputPath = tmpPath;
|
|
|
|
} else {
|
|
|
|
delete pOutput;
|
2014-11-18 05:13:13 +00:00
|
|
|
pOutput = NULL;
|
2014-11-04 00:26:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (extractAs2MG) {
|
|
|
|
/*
|
|
|
|
* Reduce to base name and add 2IMG suffix. Would be nice to keep
|
|
|
|
* the non-extended file type preservation stuff, but right now we
|
|
|
|
* only expect unadorned sectors for that (and so does NuLib2).
|
|
|
|
*/
|
|
|
|
outputPath = adjustedExtractPath;
|
|
|
|
outputPath += convName;
|
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
|
|
|
outputPath += L".2mg";
|
2014-11-04 00:26:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* update the display in case we renamed it */
|
|
|
|
if (outputPath != fpActionProgress->GetFileName()) {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI(" Renamed our output, from '%ls' to '%ls'",
|
2014-11-19 22:54:24 +00:00
|
|
|
(LPCWSTR) fpActionProgress->GetFileName(), (LPCWSTR) outputPath);
|
2014-11-04 00:26:53 +00:00
|
|
|
fpActionProgress->SetFileName(outputPath);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Update the progress meter output filename, and reset the thermometer.
|
|
|
|
*/
|
|
|
|
fpActionProgress->SetArcName(pathProp.fStoredPathName);
|
|
|
|
fpActionProgress->SetFileName(outputPath);
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("Extracting from '%ls' to '%ls'",
|
2014-11-19 22:54:24 +00:00
|
|
|
(LPCWSTR) pathProp.fStoredPathName, (LPCWSTR) outputPath);
|
2014-11-04 00:26:53 +00:00
|
|
|
SET_PROGRESS_BEGIN();
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Open the output file.
|
|
|
|
*
|
|
|
|
* Returns IDCANCEL on failures as well as user cancellation.
|
|
|
|
*/
|
2014-11-18 05:13:13 +00:00
|
|
|
FILE* fp = NULL;
|
2014-11-04 00:26:53 +00:00
|
|
|
int result;
|
|
|
|
result = OpenOutputFile(&outputPath, pathProp, pEntry->GetModWhen(),
|
|
|
|
pOverwriteExisting, pOvwrForAll, &fp);
|
|
|
|
if (result == IDCANCEL) {
|
|
|
|
// no messagebox for this one
|
|
|
|
delete pOutput;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* update the display in case they renamed the file */
|
|
|
|
if (outputPath != fpActionProgress->GetFileName()) {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI(" Detected rename, from '%ls' to '%ls'",
|
2014-11-19 22:54:24 +00:00
|
|
|
(LPCWSTR) fpActionProgress->GetFileName(), (LPCWSTR) outputPath);
|
2014-11-04 00:26:53 +00:00
|
|
|
fpActionProgress->SetFileName(outputPath);
|
|
|
|
}
|
|
|
|
|
2014-11-18 05:13:13 +00:00
|
|
|
if (fp == NULL) {
|
2014-11-04 00:26:53 +00:00
|
|
|
/* looks like they elected to skip extraction of this file */
|
|
|
|
delete pOutput;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//EventPause(500); // DEBUG DEBUG
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Handle "extract as 2MG" by writing a 2MG header to the start
|
|
|
|
* of the file before we hand off to the extraction function.
|
|
|
|
*
|
|
|
|
* NOTE: we're currently assuming that we're extracting an image
|
|
|
|
* in ProDOS sector order. This is a valid assumption so long as
|
|
|
|
* we're only pulling disk images out of ShrinkIt archives.
|
|
|
|
*
|
|
|
|
* We don't currently use the WriteFooter call here, because we're
|
|
|
|
* not adding comments.
|
|
|
|
*/
|
|
|
|
if (extractAs2MG) {
|
|
|
|
TwoImgHeader header;
|
|
|
|
header.InitHeader(TwoImgHeader::kImageFormatProDOS,
|
|
|
|
(long) pEntry->GetUncompressedLen(),
|
|
|
|
(long) (pEntry->GetUncompressedLen() / TwoImgHeader::kBlockSize));
|
|
|
|
int err;
|
|
|
|
ASSERT(ftell(fp) == 0);
|
|
|
|
err = header.WriteHeader(fp);
|
|
|
|
if (err != 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.Format(L"Unable to save 2MG file '%ls': %hs\n",
|
2014-11-19 22:54:24 +00:00
|
|
|
(LPCWSTR) outputPath, strerror(err));
|
2014-11-04 00:26:53 +00:00
|
|
|
fpActionProgress->MessageBox(errMsg, failed,
|
|
|
|
MB_OK | MB_ICONERROR);
|
|
|
|
goto open_file_fail;
|
|
|
|
}
|
|
|
|
ASSERT(ftell(fp) == 64); // size of 2MG header
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* In some cases we want to override the automatic text detection.
|
|
|
|
*
|
|
|
|
* If we're in "auto" mode, force conversion on for DOS/RDOS text files.
|
|
|
|
* This is important when "convHA" is off, because in high-ASCII mode
|
|
|
|
* we might not recognize text files for what they are. We also
|
|
|
|
* consider 0x00 to be binary, which screws up random-access text.
|
|
|
|
*
|
|
|
|
* We don't want to do text conversion on disk images or resource
|
|
|
|
* forks, ever. Turn them off here.
|
|
|
|
*/
|
|
|
|
GenericEntry::ConvertEOL thisConv;
|
|
|
|
thisConv = convEOL;
|
|
|
|
if (thisConv == GenericEntry::kConvertEOLAuto) {
|
|
|
|
if (DiskImg::UsesDOSFileStructure(pEntry->GetSourceFS()) &&
|
|
|
|
pEntry->GetFileType() == kFileTypeTXT)
|
|
|
|
{
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("Switching EOLAuto to EOLOn for DOS text file");
|
2014-11-04 00:26:53 +00:00
|
|
|
thisConv = GenericEntry::kConvertEOLOn;
|
|
|
|
}
|
|
|
|
} else if (convTextByType) {
|
|
|
|
/* force it on or off when in conv-by-type mode */
|
|
|
|
if (pEntry->GetFileType() == kFileTypeTXT ||
|
|
|
|
pEntry->GetFileType() == kFileTypeSRC)
|
|
|
|
{
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("Enabling EOL conv for text file");
|
2014-11-04 00:26:53 +00:00
|
|
|
thisConv = GenericEntry::kConvertEOLOn;
|
|
|
|
} else {
|
|
|
|
ASSERT(thisConv == GenericEntry::kConvertEOLOff);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (thisConv != GenericEntry::kConvertEOLOff &&
|
|
|
|
(thread == GenericEntry::kRsrcThread ||
|
|
|
|
thread == GenericEntry::kDiskImageThread))
|
|
|
|
{
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("Disabling EOL conv for resource fork or disk image");
|
2014-11-04 00:26:53 +00:00
|
|
|
thisConv = GenericEntry::kConvertEOLOff;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Extract the contents to the file.
|
|
|
|
*
|
|
|
|
* In some cases, notably when the file size exceeds the limit of
|
|
|
|
* the reformatter, we will be trying to reformat but won't have
|
|
|
|
* loaded the original data. In such cases we fall through to the
|
|
|
|
* normal extraction mode, because we threw out pOutput above when
|
|
|
|
* the result was kOutputErrorMsg.
|
|
|
|
*
|
|
|
|
* (Could also be due to extraction failure, e.g. bad CRC.)
|
|
|
|
*/
|
2014-11-18 05:13:13 +00:00
|
|
|
if (pOutput != NULL) {
|
2014-11-04 00:26:53 +00:00
|
|
|
/*
|
|
|
|
* We have the data in our buffer. Write it out. No need
|
|
|
|
* to tweak the progress updater, which already shows 100%.
|
|
|
|
*
|
|
|
|
* There are four possibilities:
|
|
|
|
* - Valid text/rtf/csv converted text. Write reformatted.
|
|
|
|
* - Valid bitmap converted. Write bitmap.
|
|
|
|
* - No reformatter found, type is "raw". Write raw. (Note
|
|
|
|
* this may be zero bytes long for an empty file.)
|
|
|
|
* - Error message encoded in result. Should not be here!
|
|
|
|
*/
|
|
|
|
if (pOutput->GetOutputKind() == ReformatOutput::kOutputText ||
|
|
|
|
pOutput->GetOutputKind() == ReformatOutput::kOutputRTF ||
|
|
|
|
pOutput->GetOutputKind() == ReformatOutput::kOutputCSV)
|
|
|
|
{
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI(" Writing text, RTF, CSV, or raw");
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pOutput->GetTextBuf() != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
int err = 0;
|
|
|
|
if (fwrite(pOutput->GetTextBuf(),
|
|
|
|
pOutput->GetTextLen(), 1, fp) != 1)
|
|
|
|
err = errno;
|
|
|
|
if (err != 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.Format(L"Unable to save reformatted file '%ls': %hs\n",
|
2014-11-19 22:54:24 +00:00
|
|
|
(LPCWSTR) outputPath, strerror(err));
|
2014-11-04 00:26:53 +00:00
|
|
|
fpActionProgress->MessageBox(errMsg, failed,
|
|
|
|
MB_OK | MB_ICONERROR);
|
|
|
|
writeFailed = true;
|
|
|
|
} else {
|
|
|
|
SET_PROGRESS_UPDATE(100);
|
|
|
|
}
|
|
|
|
} else if (pOutput->GetOutputKind() == ReformatOutput::kOutputBitmap) {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI(" Writing bitmap");
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pOutput->GetDIB() != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
int err = pOutput->GetDIB()->WriteToFile(fp);
|
|
|
|
if (err != 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.Format(L"Unable to save bitmap '%ls': %hs\n",
|
2014-11-19 22:54:24 +00:00
|
|
|
(LPCWSTR) outputPath, strerror(err));
|
2014-11-04 00:26:53 +00:00
|
|
|
fpActionProgress->MessageBox(errMsg, failed,
|
|
|
|
MB_OK | MB_ICONERROR);
|
|
|
|
writeFailed = true;
|
|
|
|
} else {
|
|
|
|
SET_PROGRESS_UPDATE(100);
|
|
|
|
}
|
|
|
|
} else if (pOutput->GetOutputKind() == ReformatOutput::kOutputRaw) {
|
|
|
|
/*
|
|
|
|
* Send raw data through the text conversion configured in the
|
|
|
|
* extract files dialog. Any file for which no dedicated
|
|
|
|
* reformatter could be found ends up here.
|
|
|
|
*
|
|
|
|
* We could just send it through to the generic non-reformatter
|
|
|
|
* case, but that would require reading the file twice.
|
|
|
|
*/
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI(" Writing un-reformatted data (%ld bytes)",
|
2014-11-04 00:26:53 +00:00
|
|
|
pOutput->GetTextLen());
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pOutput->GetTextBuf() != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
bool lastCR = false;
|
|
|
|
GenericEntry::ConvertHighASCII thisConvHA = convHA;
|
|
|
|
int err;
|
|
|
|
err = GenericEntry::WriteConvert(fp, pOutput->GetTextBuf(),
|
|
|
|
pOutput->GetTextLen(), &thisConv, &thisConvHA, &lastCR);
|
|
|
|
if (err != 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.Format(L"Unable to write file '%ls': %hs\n",
|
2014-11-19 22:54:24 +00:00
|
|
|
(LPCWSTR) outputPath, strerror(err));
|
2014-11-04 00:26:53 +00:00
|
|
|
fpActionProgress->MessageBox(errMsg, failed,
|
|
|
|
MB_OK | MB_ICONERROR);
|
|
|
|
writeFailed = true;
|
|
|
|
} else {
|
|
|
|
SET_PROGRESS_UPDATE(100);
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
/* something failed, and we don't have the file */
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("How'd we get here?");
|
2014-11-04 00:26:53 +00:00
|
|
|
ASSERT(false);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* We don't have the data, probably because we aren't using file
|
|
|
|
* reformatters. Use the GenericEntry extraction routine to copy
|
|
|
|
* the data directly into the file.
|
|
|
|
*
|
|
|
|
* We also get here if the file has a length of zero.
|
|
|
|
*/
|
|
|
|
CString msg;
|
|
|
|
int result;
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(fpActionProgress != NULL);
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("Extracting '%ls', requesting thisConv=%d, convHA=%d",
|
2014-11-19 22:54:24 +00:00
|
|
|
(LPCWSTR) outputPath, thisConv, convHA);
|
2014-11-04 00:26:53 +00:00
|
|
|
result = pEntry->ExtractThreadToFile(thread, fp,
|
|
|
|
thisConv, convHA, &msg);
|
|
|
|
if (result != IDOK) {
|
|
|
|
if (result == IDCANCEL) {
|
|
|
|
CString msg;
|
2014-12-16 19:04:31 +00:00
|
|
|
CheckedLoadString(&msg, IDS_OPERATION_CANCELLED);
|
2014-11-04 00:26:53 +00:00
|
|
|
fpActionProgress->MessageBox(msg,
|
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"CiderPress", MB_OK | MB_ICONEXCLAMATION);
|
2014-11-04 00:26:53 +00:00
|
|
|
} else {
|
2014-11-19 22:54:24 +00:00
|
|
|
LOGI(" FAILED on '%ls': %ls",
|
|
|
|
(LPCWSTR) outputPath, (LPCWSTR) msg);
|
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.Format(L"Unable to extract file '%ls': %ls\n",
|
2014-11-19 22:54:24 +00:00
|
|
|
(LPCWSTR) outputPath, (LPCWSTR) msg);
|
2014-11-04 00:26:53 +00:00
|
|
|
fpActionProgress->MessageBox(errMsg, failed,
|
|
|
|
MB_OK | MB_ICONERROR);
|
|
|
|
}
|
|
|
|
writeFailed = true;
|
|
|
|
}
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
|
|
|
|
open_file_fail:
|
2014-11-04 00:26:53 +00:00
|
|
|
delete pOutput;
|
|
|
|
|
|
|
|
fclose(fp);
|
|
|
|
if (writeFailed) {
|
|
|
|
// clean up
|
|
|
|
::DeleteFile(outputPath);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Fix the modification date.
|
|
|
|
*/
|
|
|
|
PathName datePath(outputPath);
|
|
|
|
datePath.SetModWhen(pEntry->GetModWhen());
|
|
|
|
// datePath.SetAccess(pEntry->GetAccess());
|
|
|
|
|
|
|
|
return true;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
int MainWindow::OpenOutputFile(CString* pOutputPath, const PathProposal& pathProp,
|
2014-11-04 00:26:53 +00:00
|
|
|
time_t arcFileModWhen, bool* pOverwriteExisting, bool* pOvwrForAll,
|
|
|
|
FILE** pFp)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
const int kUserCancel = -2; // must not conflict with errno values
|
|
|
|
CString failed;
|
|
|
|
CString msg;
|
|
|
|
int err = 0;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-12-16 19:04:31 +00:00
|
|
|
CheckedLoadString(&failed, IDS_FAILED);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-18 05:13:13 +00:00
|
|
|
*pFp = NULL;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
|
|
|
did_rename:
|
2014-11-04 00:26:53 +00:00
|
|
|
PathName path(*pOutputPath);
|
|
|
|
if (path.Exists()) {
|
|
|
|
if (*pOverwriteExisting) {
|
2007-03-27 17:47:10 +00:00
|
|
|
do_overwrite:
|
2014-11-04 00:26:53 +00:00
|
|
|
/* delete existing */
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI(" Deleting existing '%ls'", (LPCWSTR) *pOutputPath);
|
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
|
|
|
if (::_wunlink(*pOutputPath) != 0) {
|
2014-11-04 00:26:53 +00:00
|
|
|
err = errno;
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI(" Failed deleting '%ls', err=%d",
|
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
|
|
|
(LPCWSTR)*pOutputPath, err);
|
2014-11-04 00:26:53 +00:00
|
|
|
if (err == ENOENT) {
|
|
|
|
/* user might have removed it while dialog was up */
|
|
|
|
err = 0;
|
|
|
|
} else {
|
|
|
|
/* unable to delete, we'd better bail out */
|
|
|
|
goto bail;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (*pOvwrForAll) {
|
|
|
|
/* never overwrite */
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI(" Skipping '%ls'", (LPCWSTR) *pOutputPath);
|
2014-11-04 00:26:53 +00:00
|
|
|
goto bail;
|
|
|
|
} else {
|
|
|
|
/* no firm policy, ask the user */
|
|
|
|
ConfirmOverwriteDialog confOvwr;
|
|
|
|
PathName path(*pOutputPath);
|
|
|
|
|
|
|
|
confOvwr.fExistingFile = *pOutputPath;
|
|
|
|
confOvwr.fExistingFileModWhen = path.GetModWhen();
|
|
|
|
confOvwr.fNewFileSource = pathProp.fStoredPathName;
|
|
|
|
confOvwr.fNewFileModWhen = arcFileModWhen;
|
|
|
|
if (confOvwr.DoModal() == IDCANCEL) {
|
|
|
|
err = kUserCancel;
|
|
|
|
goto bail;
|
|
|
|
}
|
|
|
|
if (confOvwr.fResultRename) {
|
|
|
|
*pOutputPath = confOvwr.fExistingFile;
|
|
|
|
goto did_rename;
|
|
|
|
}
|
|
|
|
if (confOvwr.fResultApplyToAll) {
|
|
|
|
*pOvwrForAll = confOvwr.fResultApplyToAll;
|
|
|
|
*pOverwriteExisting = confOvwr.fResultOverwrite;
|
|
|
|
}
|
|
|
|
if (confOvwr.fResultOverwrite)
|
|
|
|
goto do_overwrite;
|
|
|
|
else
|
|
|
|
goto bail;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/* create the subdirectories, if necessary */
|
|
|
|
err = path.CreatePathIFN();
|
|
|
|
if (err != 0)
|
|
|
|
goto bail;
|
|
|
|
|
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
|
|
|
*pFp = _wfopen(*pOutputPath, L"wb");
|
2014-11-18 05:13:13 +00:00
|
|
|
if (*pFp == NULL)
|
2014-11-04 00:26:53 +00:00
|
|
|
err = errno ? errno : -1;
|
|
|
|
/* fall through with error */
|
2007-03-27 17:47:10 +00:00
|
|
|
|
|
|
|
bail:
|
2014-11-04 00:26:53 +00:00
|
|
|
/* if we failed, tell the user why */
|
|
|
|
if (err == ENOTDIR) {
|
|
|
|
/* part of the output path exists, but isn't a directory */
|
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
|
|
|
msg.Format(L"Unable to create folders for '%ls': part of the path "
|
|
|
|
L"already exists but is not a folder.\n",
|
2014-11-19 22:54:24 +00:00
|
|
|
(LPCWSTR) *pOutputPath);
|
2014-11-04 00:26:53 +00:00
|
|
|
fpActionProgress->MessageBox(msg, failed, MB_OK | MB_ICONERROR);
|
|
|
|
return IDCANCEL;
|
|
|
|
} else if (err == EINVAL) {
|
|
|
|
/* invalid argument; assume it's an invalid filename */
|
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
|
|
|
msg.Format(L"Unable to create file '%ls': invalid filename.\n",
|
2014-11-19 22:54:24 +00:00
|
|
|
(LPCWSTR) *pOutputPath);
|
2014-11-04 00:26:53 +00:00
|
|
|
fpActionProgress->MessageBox(msg, failed, MB_OK | MB_ICONERROR);
|
|
|
|
return IDCANCEL;
|
|
|
|
} else if (err == kUserCancel) {
|
|
|
|
/* user elected to cancel */
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("Cancelling due to user request");
|
2014-11-04 00:26:53 +00:00
|
|
|
return IDCANCEL;
|
|
|
|
} else if (err != 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
|
|
|
msg.Format(L"Unable to create file '%ls': %hs\n",
|
2014-11-19 22:54:24 +00:00
|
|
|
(LPCWSTR) *pOutputPath, strerror(err));
|
2014-11-04 00:26:53 +00:00
|
|
|
fpActionProgress->MessageBox(msg, failed, MB_OK | MB_ICONERROR);
|
|
|
|
return IDCANCEL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return IDOK;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ==========================================================================
|
2014-11-04 00:26:53 +00:00
|
|
|
* Test
|
2007-03-27 17:47:10 +00:00
|
|
|
* ==========================================================================
|
|
|
|
*/
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void MainWindow::OnActionsTest(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(fpContentList != NULL);
|
|
|
|
ASSERT(fpOpenArchive != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Ask the user about various options.
|
|
|
|
*/
|
|
|
|
UseSelectionDialog selOpts(fpContentList->GetSelectedCount(), this);
|
|
|
|
selOpts.Setup(IDS_TEST_TITLE, IDS_TEST_OK, IDS_TEST_SELECTED_COUNT,
|
|
|
|
IDS_TEST_SELECTED_COUNTS_FMT, IDS_TEST_ALL_FILES);
|
|
|
|
if (fpContentList->GetSelectedCount() > 0)
|
|
|
|
selOpts.fFilesToAction = UseSelectionDialog::kActionSelection;
|
|
|
|
else
|
|
|
|
selOpts.fFilesToAction = UseSelectionDialog::kActionAll;
|
|
|
|
|
|
|
|
if (selOpts.DoModal() != IDOK) {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("Test cancelled");
|
2014-11-04 00:26:53 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Create a "selection set" of things to test.
|
|
|
|
*
|
|
|
|
* We don't currently test directories, because we don't currently
|
|
|
|
* allow testing anything that has a directory (NuFX doesn't store
|
|
|
|
* them explicitly). We could probably add them to the threadMask.
|
|
|
|
*/
|
|
|
|
SelectionSet selSet;
|
|
|
|
int threadMask = GenericEntry::kAnyThread;
|
|
|
|
|
|
|
|
if (selOpts.fFilesToAction == UseSelectionDialog::kActionSelection) {
|
|
|
|
selSet.CreateFromSelection(fpContentList, threadMask);
|
|
|
|
} else {
|
|
|
|
selSet.CreateFromAll(fpContentList, threadMask);
|
|
|
|
}
|
|
|
|
//selSet.Dump();
|
|
|
|
|
|
|
|
if (selSet.GetNumEntries() == 0) {
|
|
|
|
/* should be impossible */
|
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"No files matched the selection criteria.",
|
|
|
|
L"No match", MB_OK|MB_ICONEXCLAMATION);
|
2014-11-04 00:26:53 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set up the progress window.
|
|
|
|
*/
|
|
|
|
bool result;
|
|
|
|
|
|
|
|
fpActionProgress = new ActionProgressDialog;
|
|
|
|
fpActionProgress->Create(ActionProgressDialog::kActionTest, this);
|
|
|
|
|
|
|
|
result = fpOpenArchive->TestSelection(fpActionProgress, &selSet);
|
|
|
|
|
|
|
|
fpActionProgress->Cleanup(this);
|
2014-11-18 05:13:13 +00:00
|
|
|
fpActionProgress = NULL;
|
2014-11-04 00:26:53 +00:00
|
|
|
//if (result)
|
|
|
|
// SuccessBeep();
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
void
|
|
|
|
MainWindow::OnUpdateActionsTest(CCmdUI* pCmdUI)
|
|
|
|
{
|
2014-11-18 05:13:13 +00:00
|
|
|
pCmdUI->Enable(fpContentList != NULL && fpContentList->GetItemCount() > 0
|
2014-11-04 00:26:53 +00:00
|
|
|
&& fpOpenArchive->GetCapability(GenericArchive::kCapCanTest));
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ==========================================================================
|
2014-11-04 00:26:53 +00:00
|
|
|
* Delete
|
2007-03-27 17:47:10 +00:00
|
|
|
* ==========================================================================
|
|
|
|
*/
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void MainWindow::OnActionsDelete(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(fpContentList != NULL);
|
|
|
|
ASSERT(fpOpenArchive != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
ASSERT(!fpOpenArchive->IsReadOnly());
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We handle deletions specially. If they have selected any
|
|
|
|
* subdirectories, we recursively select the files in those subdirs
|
|
|
|
* as well. We want to do it early so that the "#of files to delete"
|
|
|
|
* display accurately reflects what we're about to do.
|
|
|
|
*/
|
|
|
|
fpContentList->SelectSubdirContents();
|
2007-03-27 17:47:10 +00:00
|
|
|
|
|
|
|
#if 0
|
2014-11-04 00:26:53 +00:00
|
|
|
/*
|
|
|
|
* Ask the user about various options.
|
|
|
|
*/
|
|
|
|
UseSelectionDialog delOpts(fpContentList->GetSelectedCount(), this);
|
|
|
|
delOpts.Setup(IDS_DEL_TITLE, IDS_DEL_OK, IDS_DEL_SELECTED_COUNT,
|
|
|
|
IDS_DEL_SELECTED_COUNTS_FMT, IDS_DEL_ALL_FILES);
|
|
|
|
if (fpContentList->GetSelectedCount() > 0)
|
|
|
|
delOpts.fFilesToAction = UseSelectionDialog::kActionSelection;
|
|
|
|
else
|
|
|
|
delOpts.fFilesToAction = UseSelectionDialog::kActionAll;
|
|
|
|
|
|
|
|
if (delOpts.DoModal() != IDOK) {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("Delete cancelled");
|
2014-11-04 00:26:53 +00:00
|
|
|
return;
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
#endif
|
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
/*
|
|
|
|
* Create a "selection set" of things to delete.
|
|
|
|
*
|
|
|
|
* We can't delete volume directories, so they're not included.
|
|
|
|
*/
|
|
|
|
SelectionSet selSet;
|
|
|
|
int threadMask = GenericEntry::kAnyThread |
|
|
|
|
GenericEntry::kAllowDirectory /*| GenericEntry::kAllowVolumeDir*/;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
|
|
|
#if 0
|
2014-11-04 00:26:53 +00:00
|
|
|
if (delOpts.fFilesToAction == UseSelectionDialog::kActionSelection) {
|
|
|
|
selSet.CreateFromSelection(fpContentList, threadMask);
|
|
|
|
} else {
|
|
|
|
CString appName;
|
|
|
|
UINT response;
|
|
|
|
appName.LoadString(IDS_MB_APP_NAME);
|
|
|
|
response = MessageBox("Are you sure you want to delete everything?",
|
|
|
|
appName, MB_OKCANCEL | MB_ICONEXCLAMATION);
|
|
|
|
if (response == IDCANCEL)
|
|
|
|
return;
|
|
|
|
selSet.CreateFromAll(fpContentList, threadMask);
|
|
|
|
}
|
|
|
|
//selSet.Dump();
|
2007-03-27 17:47:10 +00:00
|
|
|
#endif
|
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
selSet.CreateFromSelection(fpContentList, threadMask);
|
|
|
|
if (selSet.GetNumEntries() == 0) {
|
|
|
|
/* can happen if they selected volume dir only */
|
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"Nothing to delete.",
|
|
|
|
L"No match", MB_OK | MB_ICONEXCLAMATION);
|
2014-11-04 00:26:53 +00:00
|
|
|
return;
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
CString appName, msg;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-12-16 19:04:31 +00:00
|
|
|
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
|
|
|
msg.Format(L"Delete %d file%ls?", selSet.GetNumEntries(),
|
|
|
|
selSet.GetNumEntries() == 1 ? L"" : L"s");
|
2014-11-04 00:26:53 +00:00
|
|
|
if (MessageBox(msg, appName, MB_OKCANCEL | MB_ICONQUESTION) != IDOK)
|
|
|
|
return;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
bool result;
|
|
|
|
fpActionProgress = new ActionProgressDialog;
|
|
|
|
fpActionProgress->Create(ActionProgressDialog::kActionDelete, this);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
//fpContentList->Invalidate(); // don't allow updates until done
|
|
|
|
result = fpOpenArchive->DeleteSelection(fpActionProgress, &selSet);
|
|
|
|
fpContentList->Reload();
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
fpActionProgress->Cleanup(this);
|
2014-11-18 05:13:13 +00:00
|
|
|
fpActionProgress = NULL;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
if (result)
|
|
|
|
SuccessBeep();
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
2014-11-21 21:18:20 +00:00
|
|
|
void MainWindow::OnUpdateActionsDelete(CCmdUI* pCmdUI)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 05:13:13 +00:00
|
|
|
pCmdUI->Enable(fpContentList != NULL && !fpOpenArchive->IsReadOnly()
|
2014-11-04 00:26:53 +00:00
|
|
|
&& fpContentList->GetSelectedCount() > 0);
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ==========================================================================
|
2014-11-04 00:26:53 +00:00
|
|
|
* Rename
|
2007-03-27 17:47:10 +00:00
|
|
|
* ==========================================================================
|
|
|
|
*/
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void MainWindow::OnActionsRename(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(fpContentList != NULL);
|
|
|
|
ASSERT(fpOpenArchive != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
ASSERT(!fpOpenArchive->IsReadOnly());
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Create a "selection set" of entries to rename. We always go by
|
|
|
|
* the selection, so there's no need to present a "all or some?" dialog.
|
|
|
|
*
|
|
|
|
* Renaming the volume dir is not done from here, so we don't include
|
|
|
|
* it in the set. We could theoretically allow renaming of "damaged"
|
|
|
|
* files, since most of the time the damage is in the file structure
|
|
|
|
* not the directory, but the disk will be read-only anyway so there's
|
|
|
|
* no point.
|
|
|
|
*/
|
|
|
|
SelectionSet selSet;
|
|
|
|
int threadMask = GenericEntry::kAnyThread | GenericEntry::kAllowDirectory;
|
|
|
|
|
|
|
|
selSet.CreateFromSelection(fpContentList, threadMask);
|
|
|
|
//selSet.Dump();
|
|
|
|
|
|
|
|
if (selSet.GetNumEntries() == 0) {
|
|
|
|
/* should be impossible */
|
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"No files matched the selection criteria.",
|
|
|
|
L"No match", MB_OK | MB_ICONEXCLAMATION);
|
2014-11-04 00:26:53 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
//fpContentList->Invalidate(); // this might be unnecessary
|
|
|
|
fpOpenArchive->RenameSelection(this, &selSet);
|
|
|
|
fpContentList->Reload();
|
|
|
|
|
|
|
|
// user interaction on each step, so skip the SuccessBeep
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
2014-11-21 21:18:20 +00:00
|
|
|
void MainWindow::OnUpdateActionsRename(CCmdUI* pCmdUI)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 05:13:13 +00:00
|
|
|
pCmdUI->Enable(fpContentList != NULL && !fpOpenArchive->IsReadOnly()
|
2014-11-04 00:26:53 +00:00
|
|
|
&& fpContentList->GetSelectedCount() > 0);
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ==========================================================================
|
2014-11-04 00:26:53 +00:00
|
|
|
* Edit Comment
|
2007-03-27 17:47:10 +00:00
|
|
|
* ==========================================================================
|
|
|
|
*/
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void MainWindow::OnActionsEditComment(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(fpContentList != NULL);
|
|
|
|
ASSERT(fpOpenArchive != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
ASSERT(!fpOpenArchive->IsReadOnly());
|
|
|
|
|
|
|
|
EditCommentDialog editDlg(this);
|
|
|
|
CString oldComment;
|
|
|
|
|
|
|
|
GenericEntry* pEntry = GetSelectedItem(fpContentList);
|
2014-11-18 05:13:13 +00:00
|
|
|
if (pEntry == NULL) {
|
2014-11-04 00:26:53 +00:00
|
|
|
ASSERT(false);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!pEntry->GetHasComment()) {
|
|
|
|
CString question, title;
|
|
|
|
int result;
|
|
|
|
|
2014-12-16 19:04:31 +00:00
|
|
|
CheckedLoadString(&question, IDS_NO_COMMENT_ADD);
|
|
|
|
CheckedLoadString(&title, IDS_EDIT_COMMENT);
|
2014-11-04 00:26:53 +00:00
|
|
|
result = MessageBox(question, title, MB_OKCANCEL | MB_ICONQUESTION);
|
|
|
|
if (result == IDCANCEL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
editDlg.fComment = "";
|
|
|
|
editDlg.fNewComment = true;
|
|
|
|
} else {
|
|
|
|
fpOpenArchive->GetComment(this, pEntry, &editDlg.fComment);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int result;
|
|
|
|
result = editDlg.DoModal();
|
|
|
|
if (result == IDOK) {
|
|
|
|
//fpContentList->Invalidate(); // probably unnecessary
|
|
|
|
fpOpenArchive->SetComment(this, pEntry, editDlg.fComment);
|
|
|
|
fpContentList->Reload();
|
|
|
|
} else if (result == EditCommentDialog::kDeleteCommentID) {
|
|
|
|
//fpContentList->Invalidate(); // possibly unnecessary
|
|
|
|
fpOpenArchive->DeleteComment(this, pEntry);
|
|
|
|
fpContentList->Reload();
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
2014-11-21 21:18:20 +00:00
|
|
|
void MainWindow::OnUpdateActionsEditComment(CCmdUI* pCmdUI)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 05:13:13 +00:00
|
|
|
pCmdUI->Enable(fpContentList != NULL && !fpOpenArchive->IsReadOnly() &&
|
2014-11-04 00:26:53 +00:00
|
|
|
fpContentList->GetSelectedCount() == 1 &&
|
|
|
|
fpOpenArchive->GetCapability(GenericArchive::kCapCanEditComment));
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ==========================================================================
|
2014-11-04 00:26:53 +00:00
|
|
|
* Edit Properties
|
2007-03-27 17:47:10 +00:00
|
|
|
* ==========================================================================
|
|
|
|
*/
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void MainWindow::OnActionsEditProps(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(fpContentList != NULL);
|
|
|
|
ASSERT(fpOpenArchive != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
EditPropsDialog propsDlg(this);
|
|
|
|
CString oldComment;
|
|
|
|
|
|
|
|
GenericEntry* pEntry = GetSelectedItem(fpContentList);
|
2014-11-18 05:13:13 +00:00
|
|
|
if (pEntry == NULL) {
|
2014-11-04 00:26:53 +00:00
|
|
|
ASSERT(false);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
propsDlg.InitProps(pEntry);
|
|
|
|
if (fpOpenArchive->IsReadOnly())
|
|
|
|
propsDlg.fReadOnly = true;
|
|
|
|
else if (pEntry->GetRecordKind() == GenericEntry::kRecordKindVolumeDir)
|
|
|
|
propsDlg.fReadOnly = true;
|
|
|
|
|
|
|
|
int result;
|
|
|
|
result = propsDlg.DoModal();
|
|
|
|
if (result == IDOK && !propsDlg.fReadOnly) {
|
|
|
|
(void) fpOpenArchive->SetProps(this, pEntry, &propsDlg.fProps);
|
|
|
|
|
|
|
|
// only needed if underlying archive reloads
|
|
|
|
fpContentList->Reload(true);
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
2014-11-21 21:18:20 +00:00
|
|
|
void MainWindow::OnUpdateActionsEditProps(CCmdUI* pCmdUI)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
// allow it in read-only mode, so we can view the props
|
2014-11-18 05:13:13 +00:00
|
|
|
pCmdUI->Enable(fpContentList != NULL &&
|
2014-11-04 00:26:53 +00:00
|
|
|
fpContentList->GetSelectedCount() == 1);
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ==========================================================================
|
2014-11-04 00:26:53 +00:00
|
|
|
* Rename Volume
|
2007-03-27 17:47:10 +00:00
|
|
|
* ==========================================================================
|
|
|
|
*/
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void MainWindow::OnActionsRenameVolume(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
RenameVolumeDialog rvDialog;
|
|
|
|
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(fpContentList != NULL);
|
|
|
|
ASSERT(fpOpenArchive != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
ASSERT(!fpOpenArchive->IsReadOnly());
|
|
|
|
|
|
|
|
/* only know how to deal with disk images */
|
|
|
|
if (fpOpenArchive->GetArchiveKind() != GenericArchive::kArchiveDiskImage) {
|
|
|
|
ASSERT(false);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
DiskImgLib::DiskFS* pDiskFS;
|
|
|
|
|
|
|
|
pDiskFS = ((DiskArchive*) fpOpenArchive)->GetDiskFS();
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pDiskFS != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
rvDialog.fpArchive = (DiskArchive*) fpOpenArchive;
|
|
|
|
if (rvDialog.DoModal() != IDOK)
|
|
|
|
return;
|
|
|
|
|
2014-11-18 21:05:15 +00:00
|
|
|
//LOGI("Creating '%s'", rvDialog.fNewName);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
/* rename the chosen disk to the specified name */
|
|
|
|
bool result;
|
|
|
|
result = fpOpenArchive->RenameVolume(this, rvDialog.fpChosenDiskFS,
|
|
|
|
rvDialog.fNewName);
|
|
|
|
if (!result) {
|
2014-12-05 01:05:48 +00:00
|
|
|
LOGW("RenameVolume FAILED");
|
2014-11-04 00:26:53 +00:00
|
|
|
/* keep going -- reload just in case something partially happened */
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We need to do two things: reload the content list, because the
|
|
|
|
* underlying DiskArchive got reloaded, and update the title bar. We
|
|
|
|
* put the "volume ID" in the title, and we most likely just changed it.
|
|
|
|
*
|
|
|
|
* SetCPTitle invokes fpOpenArchive->GetDescription(), which pulls the
|
|
|
|
* volume ID out of the primary DiskFS.
|
|
|
|
*/
|
|
|
|
fpContentList->Reload();
|
|
|
|
SetCPTitle(fOpenArchivePathName, fpOpenArchive);
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
2014-11-21 21:18:20 +00:00
|
|
|
void MainWindow::OnUpdateActionsRenameVolume(CCmdUI* pCmdUI)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 05:13:13 +00:00
|
|
|
pCmdUI->Enable(fpContentList != NULL && !fpOpenArchive->IsReadOnly() &&
|
2014-11-04 00:26:53 +00:00
|
|
|
fpOpenArchive->GetCapability(GenericArchive::kCapCanRenameVolume));
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ==========================================================================
|
2014-11-04 00:26:53 +00:00
|
|
|
* Recompress
|
2007-03-27 17:47:10 +00:00
|
|
|
* ==========================================================================
|
|
|
|
*/
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void MainWindow::OnActionsRecompress(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(fpContentList != NULL);
|
|
|
|
ASSERT(fpOpenArchive != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Ask the user about various options.
|
|
|
|
*/
|
|
|
|
RecompressOptionsDialog selOpts(fpContentList->GetSelectedCount(), this);
|
|
|
|
selOpts.Setup(IDS_RECOMP_TITLE, IDS_RECOMP_OK, IDS_RECOMP_SELECTED_COUNT,
|
|
|
|
IDS_RECOMP_SELECTED_COUNTS_FMT, IDS_RECOMP_ALL_FILES);
|
|
|
|
if (fpContentList->GetSelectedCount() > 0)
|
|
|
|
selOpts.fFilesToAction = UseSelectionDialog::kActionSelection;
|
|
|
|
else
|
|
|
|
selOpts.fFilesToAction = UseSelectionDialog::kActionAll;
|
|
|
|
|
|
|
|
selOpts.fCompressionType = fPreferences.GetPrefLong(kPrCompressionType);
|
|
|
|
|
|
|
|
if (selOpts.DoModal() != IDOK) {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("Recompress cancelled");
|
2014-11-04 00:26:53 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Create a "selection set" of data forks, resource forks, and disk
|
|
|
|
* images. If an entry has nothing but a comment, ignore it.
|
|
|
|
*/
|
|
|
|
SelectionSet selSet;
|
|
|
|
int threadMask = GenericEntry::kDataThread | GenericEntry::kRsrcThread |
|
|
|
|
GenericEntry::kDiskImageThread;
|
|
|
|
|
|
|
|
if (selOpts.fFilesToAction == UseSelectionDialog::kActionSelection) {
|
|
|
|
selSet.CreateFromSelection(fpContentList, threadMask);
|
|
|
|
} else {
|
|
|
|
selSet.CreateFromAll(fpContentList, threadMask);
|
|
|
|
}
|
|
|
|
//selSet.Dump();
|
|
|
|
|
|
|
|
if (selSet.GetNumEntries() == 0) {
|
|
|
|
/* should be impossible */
|
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"No files matched the selection criteria.",
|
|
|
|
L"No match", MB_OK|MB_ICONEXCLAMATION);
|
2014-11-04 00:26:53 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
LONGLONG beforeUncomp, beforeComp;
|
|
|
|
LONGLONG afterUncomp, afterComp;
|
|
|
|
CalcTotalSize(&beforeUncomp, &beforeComp);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set up the progress window.
|
|
|
|
*/
|
|
|
|
int result;
|
|
|
|
|
|
|
|
fpActionProgress = new ActionProgressDialog;
|
|
|
|
fpActionProgress->Create(ActionProgressDialog::kActionRecompress, this);
|
|
|
|
|
|
|
|
//fpContentList->Invalidate(); // possibly unnecessary
|
|
|
|
result = fpOpenArchive->RecompressSelection(fpActionProgress, &selSet,
|
|
|
|
&selOpts);
|
|
|
|
fpContentList->Reload();
|
|
|
|
|
|
|
|
fpActionProgress->Cleanup(this);
|
2014-11-18 05:13:13 +00:00
|
|
|
fpActionProgress = NULL;
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
if (result) {
|
|
|
|
CString msg, appName;
|
|
|
|
|
|
|
|
CalcTotalSize(&afterUncomp, &afterComp);
|
|
|
|
ASSERT(beforeUncomp == afterUncomp);
|
|
|
|
|
2014-12-16 19:04:31 +00:00
|
|
|
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
|
|
|
msg.Format(L"Total uncompressed size of all files:\t%.1fK\r\n"
|
|
|
|
L"Total size before recompress:\t\t%.1fK\r\n"
|
|
|
|
L"Total size after recompress:\t\t%.1fK\r\n"
|
|
|
|
L"Overall reduction:\t\t\t%.1fK",
|
2014-11-04 00:26:53 +00:00
|
|
|
beforeUncomp / 1024.0, beforeComp / 1024.0, afterComp / 1024.0,
|
|
|
|
(beforeComp - afterComp) / 1024.0);
|
|
|
|
MessageBox(msg, appName, MB_OK|MB_ICONINFORMATION);
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
2014-11-21 21:18:20 +00:00
|
|
|
void MainWindow::OnUpdateActionsRecompress(CCmdUI* pCmdUI)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 05:13:13 +00:00
|
|
|
pCmdUI->Enable(fpContentList != NULL && !fpOpenArchive->IsReadOnly() &&
|
2014-11-04 00:26:53 +00:00
|
|
|
fpContentList->GetItemCount() > 0 &&
|
|
|
|
fpOpenArchive->GetCapability(GenericArchive::kCapCanRecompress));
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void MainWindow::CalcTotalSize(LONGLONG* pUncomp, LONGLONG* pComp) const
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
GenericEntry* pEntry = fpOpenArchive->GetEntries();
|
|
|
|
LONGLONG uncomp = 0, comp = 0;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-18 05:13:13 +00:00
|
|
|
while (pEntry != NULL) {
|
2014-11-04 00:26:53 +00:00
|
|
|
uncomp += pEntry->GetUncompressedLen();
|
|
|
|
comp += pEntry->GetCompressedLen();
|
|
|
|
pEntry = pEntry->GetNext();
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
*pUncomp = uncomp;
|
|
|
|
*pComp = comp;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ==========================================================================
|
2014-11-04 00:26:53 +00:00
|
|
|
* Convert to disk archive
|
2007-03-27 17:47:10 +00:00
|
|
|
* ==========================================================================
|
|
|
|
*/
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void MainWindow::OnActionsConvDisk(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(fpContentList != NULL);
|
|
|
|
ASSERT(fpOpenArchive != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Ask the user about various options.
|
|
|
|
*/
|
|
|
|
ConvDiskOptionsDialog selOpts(fpContentList->GetSelectedCount(), this);
|
|
|
|
selOpts.Setup(IDS_CONVDISK_TITLE, IDS_CONVDISK_OK, IDS_CONVDISK_SELECTED_COUNT,
|
|
|
|
IDS_CONVDISK_SELECTED_COUNTS_FMT, IDS_CONVDISK_ALL_FILES);
|
|
|
|
if (fpContentList->GetSelectedCount() > 0)
|
|
|
|
selOpts.fFilesToAction = UseSelectionDialog::kActionSelection;
|
|
|
|
else
|
|
|
|
selOpts.fFilesToAction = UseSelectionDialog::kActionAll;
|
|
|
|
|
|
|
|
//selOpts.fAllowLower =
|
|
|
|
// fPreferences.GetPrefBool(kPrConvDiskAllowLower);
|
|
|
|
//selOpts.fSparseAlloc =
|
|
|
|
// fPreferences.GetPrefBool(kPrConvDiskAllocSparse);
|
|
|
|
|
|
|
|
if (selOpts.DoModal() != IDOK) {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("ConvDisk cancelled");
|
2014-11-04 00:26:53 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ASSERT(selOpts.fNumBlocks > 0);
|
|
|
|
|
|
|
|
//fPreferences.SetPrefBool(kPrConvDiskAllowLower,
|
|
|
|
// selOpts.fAllowLower != 0);
|
|
|
|
//fPreferences.SetPrefBool(kPrConvDiskAllocSparse,
|
|
|
|
// selOpts.fSparseAlloc != 0);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Create a "selection set" of data forks, resource forks, and
|
|
|
|
* disk images. We don't want comment threads, but we can ignore
|
|
|
|
* them later.
|
|
|
|
*/
|
|
|
|
SelectionSet selSet;
|
|
|
|
int threadMask = GenericEntry::kAnyThread;
|
|
|
|
|
|
|
|
if (selOpts.fFilesToAction == UseSelectionDialog::kActionSelection) {
|
|
|
|
selSet.CreateFromSelection(fpContentList, threadMask);
|
|
|
|
} else {
|
|
|
|
selSet.CreateFromAll(fpContentList, threadMask);
|
|
|
|
}
|
|
|
|
//selSet.Dump();
|
|
|
|
|
|
|
|
if (selSet.GetNumEntries() == 0) {
|
|
|
|
/* should be impossible */
|
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"No files matched the selection criteria.",
|
|
|
|
L"No match", MB_OK|MB_ICONEXCLAMATION);
|
2014-11-04 00:26:53 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
XferFileOptions xferOpts;
|
|
|
|
//xferOpts.fAllowLowerCase =
|
|
|
|
// fPreferences.GetPrefBool(kPrProDOSAllowLower) != 0;
|
|
|
|
//xferOpts.fUseSparseBlocks =
|
|
|
|
// fPreferences.GetPrefBool(kPrProDOSUseSparse) != 0;
|
|
|
|
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("New volume name will be '%ls'", (LPCWSTR) selOpts.fVolName);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Create a new disk image.
|
|
|
|
*/
|
|
|
|
CString filename, saveFolder, errStr;
|
|
|
|
|
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
|
|
|
CFileDialog dlg(FALSE, L"po", NULL,
|
2014-11-04 00:26:53 +00:00
|
|
|
OFN_OVERWRITEPROMPT|OFN_NOREADONLYRETURN|OFN_HIDEREADONLY,
|
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"Disk Images (*.po)|*.po||", this);
|
2014-11-04 00:26:53 +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
|
|
|
dlg.m_ofn.lpstrTitle = L"New Disk Image (.PO)";
|
2014-11-04 00:26:53 +00:00
|
|
|
dlg.m_ofn.lpstrInitialDir = fPreferences.GetPrefString(kPrOpenArchiveFolder);
|
|
|
|
|
|
|
|
if (dlg.DoModal() != IDOK) {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI(" User cancelled xfer from image create dialog");
|
2014-11-04 00:26:53 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
saveFolder = dlg.m_ofn.lpstrFile;
|
|
|
|
saveFolder = saveFolder.Left(dlg.m_ofn.nFileOffset);
|
|
|
|
fPreferences.SetPrefString(kPrOpenArchiveFolder, saveFolder);
|
|
|
|
|
|
|
|
filename = dlg.GetPathName();
|
2014-11-19 22:54:24 +00:00
|
|
|
LOGI(" Will xfer to file '%ls'", (LPCWSTR) filename);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
/* remove file if it already exists */
|
|
|
|
CString errMsg;
|
|
|
|
errMsg = RemoveFile(filename);
|
|
|
|
if (!errMsg.IsEmpty()) {
|
|
|
|
ShowFailureMsg(this, errMsg, IDS_FAILED);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
DiskArchive::NewOptions options;
|
|
|
|
memset(&options, 0, sizeof(options));
|
|
|
|
options.base.format = DiskImg::kFormatProDOS;
|
|
|
|
options.base.sectorOrder = DiskImg::kSectorOrderProDOS;
|
|
|
|
options.prodos.volName = selOpts.fVolName;
|
|
|
|
options.prodos.numBlocks = selOpts.fNumBlocks;
|
|
|
|
|
|
|
|
xferOpts.fTarget = new DiskArchive;
|
|
|
|
errStr = xferOpts.fTarget->New(filename, &options);
|
|
|
|
if (!errStr.IsEmpty()) {
|
|
|
|
ShowFailureMsg(this, errStr, IDS_FAILED);
|
|
|
|
delete xferOpts.fTarget;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set up the progress window.
|
|
|
|
*/
|
|
|
|
GenericArchive::XferStatus result;
|
|
|
|
|
|
|
|
fpActionProgress = new ActionProgressDialog;
|
|
|
|
fpActionProgress->Create(ActionProgressDialog::kActionConvDisk, this);
|
|
|
|
|
|
|
|
result = fpOpenArchive->XferSelection(fpActionProgress, &selSet,
|
|
|
|
fpActionProgress, &xferOpts);
|
|
|
|
|
|
|
|
fpActionProgress->Cleanup(this);
|
2014-11-18 05:13:13 +00:00
|
|
|
fpActionProgress = NULL;
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
if (result == GenericArchive::kXferOK)
|
|
|
|
SuccessBeep();
|
|
|
|
|
|
|
|
/* clean up */
|
|
|
|
delete xferOpts.fTarget;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
2014-11-21 21:18:20 +00:00
|
|
|
void MainWindow::OnUpdateActionsConvDisk(CCmdUI* pCmdUI)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
/* right now, only NufxArchive has the Xfer stuff implemented */
|
2014-11-18 05:13:13 +00:00
|
|
|
pCmdUI->Enable(fpContentList != NULL &&
|
2014-11-04 00:26:53 +00:00
|
|
|
fpContentList->GetItemCount() > 0 &&
|
|
|
|
fpOpenArchive->GetArchiveKind() == GenericArchive::kArchiveNuFX);
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ==========================================================================
|
2014-12-05 01:05:48 +00:00
|
|
|
* Convert disk image to NuFX file archive
|
2007-03-27 17:47:10 +00:00
|
|
|
* ==========================================================================
|
|
|
|
*/
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void MainWindow::OnActionsConvFile(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(fpContentList != NULL);
|
|
|
|
ASSERT(fpOpenArchive != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Ask the user about various options.
|
|
|
|
*/
|
|
|
|
ConvFileOptionsDialog selOpts(fpContentList->GetSelectedCount(), this);
|
|
|
|
selOpts.Setup(IDS_CONVFILE_TITLE, IDS_CONVFILE_OK, IDS_CONVFILE_SELECTED_COUNT,
|
|
|
|
IDS_CONVFILE_SELECTED_COUNTS_FMT, IDS_CONVFILE_ALL_FILES);
|
|
|
|
if (fpContentList->GetSelectedCount() > 0)
|
|
|
|
selOpts.fFilesToAction = UseSelectionDialog::kActionSelection;
|
|
|
|
else
|
|
|
|
selOpts.fFilesToAction = UseSelectionDialog::kActionAll;
|
|
|
|
|
|
|
|
//selOpts.fConvDOSText =
|
|
|
|
// fPreferences.GetPrefBool(kPrConvFileConvDOSText);
|
|
|
|
//selOpts.fConvPascalText =
|
|
|
|
// fPreferences.GetPrefBool(kPrConvFileConvPascalText);
|
|
|
|
selOpts.fPreserveEmptyFolders =
|
|
|
|
fPreferences.GetPrefBool(kPrConvFileEmptyFolders);
|
|
|
|
|
|
|
|
if (selOpts.DoModal() != IDOK) {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("ConvFile cancelled");
|
2014-11-04 00:26:53 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
//fPreferences.SetPrefBool(kPrConvFileConvDOSText,
|
|
|
|
// selOpts.fConvDOSText != 0);
|
|
|
|
//fPreferences.SetPrefBool(kPrConvFileConvPascalText,
|
|
|
|
// selOpts.fConvPascalText != 0);
|
|
|
|
fPreferences.SetPrefBool(kPrConvFileEmptyFolders,
|
|
|
|
selOpts.fPreserveEmptyFolders != 0);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Create a "selection set" of data forks, resource forks, and
|
|
|
|
* directories. There are no comments or disk images on a disk image,
|
|
|
|
* so we just request "any" thread.
|
|
|
|
*
|
|
|
|
* We only need to explicitly include directories if "preserve
|
|
|
|
* empty folders" is set.
|
|
|
|
*/
|
|
|
|
SelectionSet selSet;
|
|
|
|
int threadMask = GenericEntry::kAnyThread;
|
|
|
|
if (selOpts.fPreserveEmptyFolders)
|
|
|
|
threadMask |= GenericEntry::kAllowDirectory;
|
|
|
|
|
|
|
|
if (selOpts.fFilesToAction == UseSelectionDialog::kActionSelection) {
|
|
|
|
selSet.CreateFromSelection(fpContentList, threadMask);
|
|
|
|
} else {
|
|
|
|
selSet.CreateFromAll(fpContentList, threadMask);
|
|
|
|
}
|
|
|
|
//selSet.Dump();
|
|
|
|
|
|
|
|
if (selSet.GetNumEntries() == 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
|
|
|
MessageBox(L"No files matched the selection criteria.",
|
|
|
|
L"No match", MB_OK|MB_ICONEXCLAMATION);
|
2014-11-04 00:26:53 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
XferFileOptions xferOpts;
|
|
|
|
//xferOpts.fConvDOSText = (selOpts.fConvDOSText != 0);
|
|
|
|
//xferOpts.fConvPascalText = (selOpts.fConvPascalText != 0);
|
|
|
|
xferOpts.fPreserveEmptyFolders = (selOpts.fPreserveEmptyFolders != 0);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Create a new NuFX archive.
|
|
|
|
*/
|
|
|
|
CString filename, saveFolder, errStr;
|
|
|
|
|
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
|
|
|
CFileDialog dlg(FALSE, L"shk", NULL,
|
2014-11-04 00:26:53 +00:00
|
|
|
OFN_OVERWRITEPROMPT|OFN_NOREADONLYRETURN|OFN_HIDEREADONLY,
|
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"ShrinkIt Archives (*.shk)|*.shk||", this);
|
2014-11-04 00:26:53 +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
|
|
|
dlg.m_ofn.lpstrTitle = L"New Archive";
|
2014-11-04 00:26:53 +00:00
|
|
|
dlg.m_ofn.lpstrInitialDir = fPreferences.GetPrefString(kPrOpenArchiveFolder);
|
|
|
|
|
|
|
|
if (dlg.DoModal() != IDOK) {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI(" User cancelled xfer from archive create dialog");
|
2014-11-04 00:26:53 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
saveFolder = dlg.m_ofn.lpstrFile;
|
|
|
|
saveFolder = saveFolder.Left(dlg.m_ofn.nFileOffset);
|
|
|
|
fPreferences.SetPrefString(kPrOpenArchiveFolder, saveFolder);
|
|
|
|
|
|
|
|
filename = dlg.GetPathName();
|
2014-12-05 01:05:48 +00:00
|
|
|
LOGD(" Will xfer to file '%ls'", (LPCWSTR) filename);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
/* remove file if it already exists */
|
|
|
|
CString errMsg;
|
|
|
|
errMsg = RemoveFile(filename);
|
|
|
|
if (!errMsg.IsEmpty()) {
|
|
|
|
ShowFailureMsg(this, errMsg, IDS_FAILED);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
xferOpts.fTarget = new NufxArchive;
|
2014-11-18 05:13:13 +00:00
|
|
|
errStr = xferOpts.fTarget->New(filename, NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
if (!errStr.IsEmpty()) {
|
|
|
|
ShowFailureMsg(this, errStr, IDS_FAILED);
|
|
|
|
delete xferOpts.fTarget;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set up the progress window.
|
|
|
|
*/
|
|
|
|
GenericArchive::XferStatus result;
|
|
|
|
|
|
|
|
fpActionProgress = new ActionProgressDialog;
|
|
|
|
fpActionProgress->Create(ActionProgressDialog::kActionConvFile, this);
|
|
|
|
|
|
|
|
result = fpOpenArchive->XferSelection(fpActionProgress, &selSet,
|
|
|
|
fpActionProgress, &xferOpts);
|
|
|
|
|
|
|
|
fpActionProgress->Cleanup(this);
|
2014-11-18 05:13:13 +00:00
|
|
|
fpActionProgress = NULL;
|
2014-11-04 00:26:53 +00:00
|
|
|
if (result == GenericArchive::kXferOK)
|
|
|
|
SuccessBeep();
|
|
|
|
|
|
|
|
/* clean up */
|
|
|
|
delete xferOpts.fTarget;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
2014-11-21 21:18:20 +00:00
|
|
|
void MainWindow::OnUpdateActionsConvFile(CCmdUI* pCmdUI)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 05:13:13 +00:00
|
|
|
pCmdUI->Enable(fpContentList != NULL &&
|
2014-11-04 00:26:53 +00:00
|
|
|
fpContentList->GetItemCount() > 0 &&
|
|
|
|
fpOpenArchive->GetArchiveKind() == GenericArchive::kArchiveDiskImage);
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ==========================================================================
|
2014-11-04 00:26:53 +00:00
|
|
|
* Cassette WAV conversions
|
2007-03-27 17:47:10 +00:00
|
|
|
* ==========================================================================
|
|
|
|
*/
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void MainWindow::OnActionsConvToWav(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
// do this someday
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("Convert TO wav");
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
2014-11-21 21:18:20 +00:00
|
|
|
void MainWindow::OnUpdateActionsConvToWav(CCmdUI* pCmdUI)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
BOOL enable = false;
|
|
|
|
|
2014-11-18 05:13:13 +00:00
|
|
|
if (fpContentList != NULL && fpContentList->GetSelectedCount() == 1) {
|
2014-11-04 00:26:53 +00:00
|
|
|
/* only BAS, INT, and BIN shorter than 64K */
|
|
|
|
GenericEntry* pEntry = GetSelectedItem(fpContentList);
|
|
|
|
|
|
|
|
if ((pEntry->GetFileType() == kFileTypeBAS ||
|
|
|
|
pEntry->GetFileType() == kFileTypeINT ||
|
|
|
|
pEntry->GetFileType() == kFileTypeBIN) &&
|
|
|
|
pEntry->GetDataForkLen() < 65536 &&
|
|
|
|
pEntry->GetRecordKind() == GenericEntry::kRecordKindFile)
|
|
|
|
{
|
|
|
|
enable = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pCmdUI->Enable(enable);
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void MainWindow::OnActionsConvFromWav(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
CassetteDialog dlg;
|
|
|
|
CString fileName, saveFolder;
|
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
|
|
|
CFileDialog fileDlg(TRUE, L"wav", NULL, OFN_FILEMUSTEXIST|OFN_HIDEREADONLY,
|
|
|
|
L"Sound Files (*.wav)|*.wav||", this);
|
|
|
|
fileDlg.m_ofn.lpstrTitle = L"Open Sound File";
|
2014-11-04 00:26:53 +00:00
|
|
|
fileDlg.m_ofn.lpstrInitialDir = fPreferences.GetPrefString(kPrOpenWAVFolder);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
if (fileDlg.DoModal() != IDOK)
|
|
|
|
goto bail;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
saveFolder = fileDlg.m_ofn.lpstrFile;
|
|
|
|
saveFolder = saveFolder.Left(fileDlg.m_ofn.nFileOffset);
|
|
|
|
fPreferences.SetPrefString(kPrOpenWAVFolder, saveFolder);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
fileName = fileDlg.GetPathName();
|
2014-11-19 22:54:24 +00:00
|
|
|
LOGI("Opening WAV file '%ls'", (LPCWSTR) fileName);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
dlg.fFileName = fileName;
|
|
|
|
// pass in fpOpenArchive?
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
dlg.DoModal();
|
|
|
|
if (dlg.IsDirty()) {
|
2014-11-18 05:13:13 +00:00
|
|
|
assert(fpContentList != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
fpContentList->Reload();
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
|
|
|
|
bail:
|
2014-11-04 00:26:53 +00:00
|
|
|
return;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
2014-11-21 21:18:20 +00:00
|
|
|
void MainWindow::OnUpdateActionsConvFromWav(CCmdUI* pCmdUI)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 05:13:13 +00:00
|
|
|
pCmdUI->Enable(fpContentList != NULL && !fpOpenArchive->IsReadOnly());
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2015-01-05 05:04:01 +00:00
|
|
|
/*static*/ bool MainWindow::SaveToArchive(GenericArchive::LocalFileDetails* pDetails,
|
|
|
|
const uint8_t* dataBufIn, long dataLen,
|
|
|
|
const uint8_t* rsrcBufIn, long rsrcLen,
|
|
|
|
CString* pErrMsg, CWnd* pDialog)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
MainWindow* pMain = GET_MAIN_WINDOW();
|
|
|
|
GenericArchive* pArchive = pMain->GetOpenArchive();
|
2014-11-18 05:13:13 +00:00
|
|
|
DiskImgLib::A2File* pTargetSubdir = NULL;
|
2014-11-04 00:26:53 +00:00
|
|
|
XferFileOptions xferOpts;
|
|
|
|
CString storagePrefix;
|
2015-01-05 05:04:01 +00:00
|
|
|
uint8_t* dataBuf = NULL;
|
|
|
|
uint8_t* rsrcBuf = NULL;
|
2014-11-04 00:26:53 +00:00
|
|
|
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pArchive != NULL);
|
2015-01-05 05:04:01 +00:00
|
|
|
ASSERT(pErrMsg->IsEmpty());
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Make a copy of the data for XferFile.
|
|
|
|
*/
|
|
|
|
if (dataLen >= 0) {
|
|
|
|
if (dataLen == 0)
|
|
|
|
dataBuf = new unsigned char[1];
|
|
|
|
else
|
|
|
|
dataBuf = new unsigned char[dataLen];
|
2014-11-18 05:13:13 +00:00
|
|
|
if (dataBuf == NULL) {
|
2015-01-05 05:04:01 +00:00
|
|
|
pErrMsg->Format(L"Unable to allocate %ld bytes", dataLen);
|
2014-11-04 00:26:53 +00:00
|
|
|
goto bail;
|
|
|
|
}
|
|
|
|
memcpy(dataBuf, dataBufIn, dataLen);
|
|
|
|
}
|
|
|
|
if (rsrcLen >= 0) {
|
|
|
|
assert(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Figure out where we want to put the files. For a disk archive
|
|
|
|
* this can be complicated.
|
|
|
|
*
|
|
|
|
* The target DiskFS (which could be a sub-volume) gets tucked into
|
|
|
|
* the xferOpts.
|
|
|
|
*/
|
|
|
|
if (pArchive->GetArchiveKind() == GenericArchive::kArchiveDiskImage) {
|
|
|
|
if (!pMain->ChooseAddTarget(&pTargetSubdir, &xferOpts.fpTargetFS))
|
|
|
|
goto bail;
|
|
|
|
} else if (pArchive->GetArchiveKind() == GenericArchive::kArchiveNuFX) {
|
|
|
|
// Always use ':' separator for SHK; this is a matter of
|
|
|
|
// convenience, so they can specify a full path.
|
|
|
|
//details.storageName.Replace(':', '_');
|
2015-01-05 05:04:01 +00:00
|
|
|
pDetails->SetFssep(':');
|
2014-11-04 00:26:53 +00:00
|
|
|
}
|
2014-11-18 05:13:13 +00:00
|
|
|
if (pTargetSubdir != NULL) {
|
2014-11-04 00:26:53 +00:00
|
|
|
storagePrefix = pTargetSubdir->GetPathName();
|
2014-11-19 22:54:24 +00:00
|
|
|
LOGD(" using storagePrefix '%ls'", (LPCWSTR) storagePrefix);
|
2014-11-04 00:26:53 +00:00
|
|
|
}
|
|
|
|
if (!storagePrefix.IsEmpty()) {
|
|
|
|
CString tmpStr, tmpFileName;
|
2015-01-05 05:04:01 +00:00
|
|
|
tmpFileName = pDetails->GetStrippedLocalPathName();
|
2014-11-04 00:26:53 +00:00
|
|
|
tmpFileName.Replace(':', '_'); // strip any ':'s in the name
|
2015-01-05 05:04:01 +00:00
|
|
|
pDetails->SetFssep(':');
|
2014-11-04 00:26:53 +00:00
|
|
|
tmpStr = storagePrefix;
|
|
|
|
tmpStr += ':';
|
|
|
|
tmpStr += tmpFileName;
|
2015-01-05 05:04:01 +00:00
|
|
|
pDetails->SetStrippedLocalPathName(tmpStr);
|
2014-11-04 00:26:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Handle the transfer.
|
|
|
|
*
|
|
|
|
* On success, XferFile will null out our dataBuf and rsrcBuf pointers.
|
|
|
|
*/
|
|
|
|
pArchive->XferPrepare(&xferOpts);
|
|
|
|
|
2015-01-05 05:04:01 +00:00
|
|
|
*pErrMsg = pArchive->XferFile(pDetails, &dataBuf, dataLen,
|
2014-11-04 00:26:53 +00:00
|
|
|
&rsrcBuf, rsrcLen);
|
|
|
|
delete[] dataBuf;
|
|
|
|
delete[] rsrcBuf;
|
|
|
|
|
2015-01-05 05:04:01 +00:00
|
|
|
if (pErrMsg->IsEmpty())
|
2014-11-04 00:26:53 +00:00
|
|
|
pArchive->XferFinish(pDialog);
|
|
|
|
else
|
|
|
|
pArchive->XferAbort(pDialog);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
|
|
|
bail:
|
2015-01-05 05:04:01 +00:00
|
|
|
return (pErrMsg->IsEmpty() != 0);
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ==========================================================================
|
2014-11-04 00:26:53 +00:00
|
|
|
* Import BASIC programs from a text file
|
2007-03-27 17:47:10 +00:00
|
|
|
* ==========================================================================
|
|
|
|
*/
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void MainWindow::OnActionsImportBAS(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
ImportBASDialog dlg;
|
|
|
|
CString fileName, saveFolder;
|
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
|
|
|
CFileDialog fileDlg(TRUE, L"txt", NULL, OFN_FILEMUSTEXIST | OFN_HIDEREADONLY,
|
|
|
|
L"Text files (*.txt)|*.txt||", this);
|
|
|
|
fileDlg.m_ofn.lpstrTitle = L"Open Text File";
|
2014-11-04 00:26:53 +00:00
|
|
|
fileDlg.m_ofn.lpstrInitialDir = fPreferences.GetPrefString(kPrAddFileFolder);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
if (fileDlg.DoModal() != IDOK)
|
|
|
|
goto bail;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
saveFolder = fileDlg.m_ofn.lpstrFile;
|
|
|
|
saveFolder = saveFolder.Left(fileDlg.m_ofn.nFileOffset);
|
|
|
|
fPreferences.SetPrefString(kPrAddFileFolder, saveFolder);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
fileName = fileDlg.GetPathName();
|
2014-11-19 22:54:24 +00:00
|
|
|
LOGI("Opening TXT file '%ls'", (LPCWSTR) fileName);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
dlg.SetFileName(fileName);
|
2014-11-04 00:26:53 +00:00
|
|
|
// pass in fpOpenArchive?
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
dlg.DoModal();
|
|
|
|
if (dlg.IsDirty()) {
|
2014-11-18 05:13:13 +00:00
|
|
|
assert(fpContentList != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
fpContentList->Reload();
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
|
|
|
|
bail:
|
2014-11-04 00:26:53 +00:00
|
|
|
return;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
2014-11-21 21:18:20 +00:00
|
|
|
void MainWindow::OnUpdateActionsImportBAS(CCmdUI* pCmdUI)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 05:13:13 +00:00
|
|
|
pCmdUI->Enable(fpContentList != NULL && !fpOpenArchive->IsReadOnly());
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ==========================================================================
|
2014-11-04 00:26:53 +00:00
|
|
|
* Multiple file handling
|
2007-03-27 17:47:10 +00:00
|
|
|
* ==========================================================================
|
|
|
|
*/
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
int MainWindow::GetFileParts(const GenericEntry* pEntry,
|
2014-11-04 00:26:53 +00:00
|
|
|
ReformatHolder** ppHolder) const
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
ReformatHolder* pHolder = new ReformatHolder;
|
|
|
|
CString errMsg;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-18 05:13:13 +00:00
|
|
|
if (pHolder == NULL)
|
2014-11-04 00:26:53 +00:00
|
|
|
return -1;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
if (pEntry->GetHasDataFork())
|
|
|
|
GetFilePart(pEntry, GenericEntry::kDataThread, pHolder);
|
|
|
|
if (pEntry->GetHasRsrcFork())
|
|
|
|
GetFilePart(pEntry, GenericEntry::kRsrcThread, pHolder);
|
|
|
|
if (pEntry->GetHasComment())
|
|
|
|
GetFilePart(pEntry, GenericEntry::kCommentThread, pHolder);
|
|
|
|
if (pEntry->GetHasDiskImage())
|
|
|
|
GetFilePart(pEntry, GenericEntry::kDiskImageThread, pHolder);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
*ppHolder = pHolder;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
return 0;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void MainWindow::GetFilePart(const GenericEntry* pEntry, int whichThread,
|
2014-11-04 00:26:53 +00:00
|
|
|
ReformatHolder* pHolder) const
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
CString errMsg;
|
|
|
|
ReformatHolder::ReformatPart part;
|
2014-11-18 05:13:13 +00:00
|
|
|
char* buf = NULL;
|
2014-11-04 00:26:53 +00:00
|
|
|
long len = 0;
|
|
|
|
di_off_t threadLen;
|
|
|
|
int result;
|
|
|
|
|
|
|
|
switch (whichThread) {
|
|
|
|
case GenericEntry::kDataThread:
|
|
|
|
part = ReformatHolder::kPartData;
|
|
|
|
threadLen = pEntry->GetDataForkLen();
|
|
|
|
break;
|
|
|
|
case GenericEntry::kRsrcThread:
|
|
|
|
part = ReformatHolder::kPartRsrc;
|
|
|
|
threadLen = pEntry->GetRsrcForkLen();
|
|
|
|
break;
|
|
|
|
case GenericEntry::kCommentThread:
|
|
|
|
part = ReformatHolder::kPartCmmt;
|
|
|
|
threadLen = -1; // no comment len getter; assume it's small
|
|
|
|
break;
|
|
|
|
case GenericEntry::kDiskImageThread:
|
|
|
|
part = ReformatHolder::kPartData; // put disks into data thread
|
|
|
|
threadLen = pEntry->GetDataForkLen();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ASSERT(false);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (threadLen > fPreferences.GetPrefLong(kPrMaxViewFileSize)) {
|
|
|
|
errMsg.Format(
|
2015-01-16 23:15:40 +00:00
|
|
|
L"[File size (%I64d KBytes) exceeds file viewer maximum (%ld KBytes). "
|
|
|
|
L"The limit can be adjusted in the file viewer preferences.]\n",
|
2014-11-04 00:26:53 +00:00
|
|
|
((LONGLONG) threadLen + 1023) / 1024,
|
|
|
|
(fPreferences.GetPrefLong(kPrMaxViewFileSize) + 1023) / 1024);
|
|
|
|
pHolder->SetErrorMsg(part, errMsg);
|
|
|
|
goto bail;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
result = pEntry->ExtractThreadToBuffer(whichThread, &buf, &len, &errMsg);
|
|
|
|
|
|
|
|
if (result == IDOK) {
|
|
|
|
/* on success, ETTB guarantees a buffer, even for zero-len file */
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(buf != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
pHolder->SetSourceBuf(part, (unsigned char*) buf, len);
|
|
|
|
} else if (result == IDCANCEL) {
|
|
|
|
/* not expected */
|
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"Cancelled!";
|
2014-11-04 00:26:53 +00:00
|
|
|
pHolder->SetErrorMsg(part, errMsg);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(buf == NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
} else {
|
|
|
|
/* transfer error message to ReformatHolder buffer */
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("Got error message from ExtractThread: '%ls'",
|
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
|
|
|
(LPCWSTR) errMsg);
|
2014-11-04 00:26:53 +00:00
|
|
|
pHolder->SetErrorMsg(part, errMsg);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(buf == NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
|
|
|
|
bail:
|
2014-11-04 00:26:53 +00:00
|
|
|
return;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|