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.
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* Disk editor implementation.
|
|
|
|
*
|
|
|
|
* Note to self: it should be possible to open an image in "nibble" mode,
|
|
|
|
* switch to one of the various "sector" modes, and maybe even try out a
|
|
|
|
* "block" mode for a while. Locking the editor into one particular mode
|
|
|
|
* makes for a cumbersome interface when dealing with certain kinds of disks.
|
|
|
|
* It should also be possible to configure the "custom" NibbleDescr and then
|
|
|
|
* re-analyze the disk, possibly transferring the customization over to
|
|
|
|
* the main file listing. (Perhaps the customization affects a global slot?
|
|
|
|
* Probably want more than one set of custom nibble values, with the config
|
|
|
|
* dialog accessible from main menu and from within disk editor.)
|
|
|
|
*
|
|
|
|
* A track copier would be neat too.
|
|
|
|
*/
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include "SubVolumeDialog.h"
|
|
|
|
#include "DEFileDialog.h"
|
|
|
|
#include "DiskEditDialog.h"
|
Volume name and font fixes
More volume name MOR conversions. I think I got them all.
This also switches the "archive info", "add files", and "extract
files" dialogs to use the System Font. We were using "MS Sans
Serif" before, which looks a bit ratty on Windows 7 because it
doesn't take advantage of ClearType. (Apparently the ClearType
version is "Microsoft Sans Serif", though when you set the "use
system font" boolean to true it changes the font name to "MS Shell
Dlg".) The old font also seems to be missing certain glyphs, e.g.
my HFS volume name had 'TM' in it, but that just showed up as a box
(which is why, in case you were wondering, these changes ended up
together).
The new font seems to work equally well on WinXP, so I may enable
it for all dialogs in a follow-up change. As far as I can tell it
has the same font metrics -- I haven't seen anything weird looking
in the dialogs I've updated so far.
Also, bumped the version to 4.0.0-b3.
2015-01-15 19:25:26 +00:00
|
|
|
#include "../reformat/Charset.h"
|
2007-03-27 17:47:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ===========================================================================
|
2014-11-04 00:26:53 +00:00
|
|
|
* DiskEditDialog (base class)
|
2007-03-27 17:47:10 +00:00
|
|
|
* ===========================================================================
|
|
|
|
*/
|
|
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(DiskEditDialog, CDialog)
|
2014-11-04 00:26:53 +00:00
|
|
|
ON_BN_CLICKED(IDC_DISKEDIT_DONE, OnDone)
|
|
|
|
ON_BN_CLICKED(IDC_DISKEDIT_HEX, OnHexMode)
|
|
|
|
ON_BN_CLICKED(IDC_DISKEDIT_DOREAD, OnDoRead)
|
|
|
|
ON_BN_CLICKED(IDC_DISKEDIT_DOWRITE, OnDoWrite)
|
|
|
|
ON_BN_CLICKED(IDC_DISKEDIT_PREV, OnReadPrev)
|
|
|
|
ON_BN_CLICKED(IDC_DISKEDIT_NEXT, OnReadNext)
|
|
|
|
ON_BN_CLICKED(IDC_DISKEDIT_SUBVOLUME, OnSubVolume)
|
|
|
|
ON_BN_CLICKED(IDC_DISKEDIT_OPENFILE, OnOpenFile)
|
|
|
|
ON_BN_CLICKED(IDHELP, OnHelp)
|
|
|
|
ON_CBN_SELCHANGE(IDC_DISKEDIT_NIBBLE_PARMS, OnNibbleParms)
|
|
|
|
ON_WM_HELPINFO()
|
2007-03-27 17:47:10 +00:00
|
|
|
END_MESSAGE_MAP()
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
BOOL DiskEditDialog::OnInitDialog(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
ASSERT(!fFileName.IsEmpty());
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(fpDiskFS != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Disable the write button.
|
|
|
|
*/
|
|
|
|
if (fReadOnly) {
|
|
|
|
CButton* pButton = (CButton*) GetDlgItem(IDC_DISKEDIT_DOWRITE);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pButton != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
pButton->EnableWindow(FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Use modified spin controls so we're not limited to 16 bits.
|
|
|
|
*/
|
|
|
|
ReplaceSpinCtrl(&fTrackSpinner, IDC_DISKEDIT_TRACKSPIN,
|
|
|
|
IDC_DISKEDIT_TRACK);
|
|
|
|
ReplaceSpinCtrl(&fSectorSpinner, IDC_DISKEDIT_SECTORSPIN,
|
|
|
|
IDC_DISKEDIT_SECTOR);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Configure the RichEdit control.
|
|
|
|
*/
|
|
|
|
CRichEditCtrl* pEdit = (CRichEditCtrl*) GetDlgItem(IDC_DISKEDIT_EDIT);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pEdit != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
/* set the font to 10-point Courier New */
|
|
|
|
CHARFORMAT cf;
|
|
|
|
cf.cbSize = sizeof(CHARFORMAT);
|
|
|
|
cf.dwMask = CFM_FACE | CFM_SIZE;
|
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
|
|
|
wcscpy(cf.szFaceName, L"Courier New");
|
2014-11-04 00:26:53 +00:00
|
|
|
cf.yHeight = 10 * 20; // point size in twips
|
|
|
|
BOOL cc = pEdit->SetDefaultCharFormat(cf);
|
|
|
|
if (cc == FALSE) {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("SetDefaultCharFormat failed?");
|
2014-11-04 00:26:53 +00:00
|
|
|
ASSERT(FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* set to read-only */
|
|
|
|
pEdit->SetReadOnly();
|
|
|
|
/* retain the selection even if we lose focus [can't do this in OnInit] */
|
|
|
|
pEdit->SetOptions(ECOOP_OR, ECO_SAVESEL);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Disable the sub-volume and/or file open buttons if the DiskFS doesn't
|
|
|
|
* have the appropriate stuff inside.
|
|
|
|
*/
|
2014-11-18 05:13:13 +00:00
|
|
|
if (fpDiskFS->GetNextFile(NULL) == NULL) {
|
2014-11-04 00:26:53 +00:00
|
|
|
CWnd* pWnd = GetDlgItem(IDC_DISKEDIT_OPENFILE);
|
|
|
|
pWnd->EnableWindow(FALSE);
|
|
|
|
}
|
2014-11-18 05:13:13 +00:00
|
|
|
if (fpDiskFS->GetNextSubVolume(NULL) == NULL) {
|
2014-11-04 00:26:53 +00:00
|
|
|
CWnd* pWnd = GetDlgItem(IDC_DISKEDIT_SUBVOLUME);
|
|
|
|
pWnd->EnableWindow(FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Configure the nibble parm drop-list in an appropriate fashion.
|
|
|
|
*/
|
|
|
|
InitNibbleParmList();
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If this is a sub-volume edit window, pop us up slightly offset from the
|
|
|
|
* parent window so the user can see that there's more than one thing
|
|
|
|
* open.
|
|
|
|
*/
|
|
|
|
if (fPositionShift != 0) {
|
|
|
|
CRect rect;
|
|
|
|
GetWindowRect(&rect);
|
|
|
|
rect.top += fPositionShift;
|
|
|
|
rect.left += fPositionShift;
|
|
|
|
rect.bottom += fPositionShift;
|
|
|
|
rect.right += fPositionShift;
|
|
|
|
MoveWindow(&rect);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set the window title.
|
|
|
|
*/
|
|
|
|
CString title("Disk Viewer - ");
|
|
|
|
title += fFileName;
|
2014-11-18 05:13:13 +00:00
|
|
|
if (fpDiskFS->GetVolumeID() != NULL) {
|
2014-11-04 00:26:53 +00:00
|
|
|
title += " (";
|
2015-01-15 22:21:01 +00:00
|
|
|
title += Charset::ConvertMORToUNI(fpDiskFS->GetVolumeID());
|
2014-11-04 00:26:53 +00:00
|
|
|
title += ")";
|
|
|
|
}
|
|
|
|
SetWindowText(title);
|
|
|
|
|
|
|
|
return TRUE;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void DiskEditDialog::InitNibbleParmList(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(fpDiskFS != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
DiskImg* pDiskImg = fpDiskFS->GetDiskImg();
|
|
|
|
CComboBox* pCombo;
|
|
|
|
|
|
|
|
pCombo = (CComboBox*) GetDlgItem(IDC_DISKEDIT_NIBBLE_PARMS);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pCombo != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
if (pDiskImg->GetHasNibbles()) {
|
|
|
|
const DiskImg::NibbleDescr* pTable;
|
|
|
|
const DiskImg::NibbleDescr* pCurrent;
|
|
|
|
int i, count;
|
|
|
|
|
|
|
|
pTable = pDiskImg->GetNibbleDescrTable(&count);
|
2014-11-18 05:13:13 +00:00
|
|
|
if (pTable == NULL || count <= 0) {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("WHOOPS: nibble parm got table=0x%08lx, count=%d",
|
2014-11-04 00:26:53 +00:00
|
|
|
(long) pTable, count);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
pCurrent = pDiskImg->GetNibbleDescr();
|
|
|
|
|
|
|
|
/* configure the selection to match the disk analysis */
|
|
|
|
int dflt = -1;
|
2014-11-18 05:13:13 +00:00
|
|
|
if (pCurrent != NULL) {
|
2014-11-04 00:26:53 +00:00
|
|
|
for (i = 0; i < count; i++) {
|
|
|
|
if (memcmp(&pTable[i], pCurrent, sizeof(*pCurrent)) == 0) {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI(" NibbleParm match on entry %d", i);
|
2014-11-04 00:26:53 +00:00
|
|
|
dflt = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dflt == -1) {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI(" GLITCH: no match on nibble descr in table?!");
|
2014-11-04 00:26:53 +00:00
|
|
|
dflt = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < count; i++) {
|
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 (pTable[i].numSectors > 0) {
|
|
|
|
CString description(pTable[i].description);
|
|
|
|
pCombo->AddString(description);
|
|
|
|
} else {
|
2014-11-04 00:26:53 +00:00
|
|
|
/* only expecting this on the last, "custom" entry */
|
|
|
|
ASSERT(i == count-1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pCombo->SetCurSel(dflt);
|
|
|
|
} else {
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
pCombo->AddString(L"Nibble Parms");
|
2014-11-04 00:26:53 +00:00
|
|
|
pCombo->SetCurSel(0);
|
|
|
|
pCombo->EnableWindow(FALSE);
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
int DiskEditDialog::ReplaceSpinCtrl(MySpinCtrl* pNewSpin, int idSpin, int idEdit)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
CSpinButtonCtrl* pSpin;
|
|
|
|
// CRect rect;
|
|
|
|
DWORD style;
|
|
|
|
|
|
|
|
pSpin = (CSpinButtonCtrl*)GetDlgItem(idSpin);
|
2014-11-18 05:13:13 +00:00
|
|
|
if (pSpin == NULL)
|
2014-11-04 00:26:53 +00:00
|
|
|
return -1;
|
|
|
|
// pSpin->GetWindowRect(&rect);
|
|
|
|
// ScreenToClient(&rect);
|
|
|
|
style = pSpin->GetStyle();
|
|
|
|
style &= ~(UDS_SETBUDDYINT);
|
|
|
|
//style |= UDS_AUTOBUDDY;
|
|
|
|
ASSERT(!(style & UDS_AUTOBUDDY));
|
|
|
|
pSpin->DestroyWindow();
|
|
|
|
pNewSpin->Create(style, CRect(0,0,0,0), this, idSpin);
|
|
|
|
pNewSpin->SetBuddy(GetDlgItem(idEdit));
|
|
|
|
|
|
|
|
return 0;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
BOOL DiskEditDialog::PreTranslateMessage(MSG* pMsg)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
if (pMsg->message == WM_KEYDOWN &&
|
2007-03-27 17:47:10 +00:00
|
|
|
pMsg->wParam == VK_RETURN)
|
2014-11-04 00:26:53 +00:00
|
|
|
{
|
2014-11-18 21:05:15 +00:00
|
|
|
//LOGI("RETURN!");
|
2014-11-04 00:26:53 +00:00
|
|
|
LoadData();
|
|
|
|
return TRUE;
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
return CDialog::PreTranslateMessage(pMsg);
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void DiskEditDialog::OnDone(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("DiskEditDialog OnDone");
|
2014-11-04 00:26:53 +00:00
|
|
|
EndDialog(IDOK);
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void DiskEditDialog::OnHexMode(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
int base;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
CButton* pButton = (CButton*) GetDlgItem(IDC_DISKEDIT_HEX);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pButton != NULL);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
if (pButton->GetCheck() == 0)
|
|
|
|
base = 10;
|
|
|
|
else
|
|
|
|
base = 16;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
SetSpinMode(IDC_DISKEDIT_TRACKSPIN, base);
|
|
|
|
SetSpinMode(IDC_DISKEDIT_SECTORSPIN, base);
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void DiskEditDialog::OnSubVolume(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
SubVolumeDialog subv(this);
|
|
|
|
bool showAsBlocks;
|
|
|
|
|
|
|
|
subv.Setup(fpDiskFS);
|
|
|
|
if (subv.DoModal() == IDOK) {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("SELECTED subv %d", subv.fListBoxIndex);
|
2014-11-18 05:13:13 +00:00
|
|
|
DiskFS::SubVolume* pSubVol = fpDiskFS->GetNextSubVolume(NULL);
|
|
|
|
if (pSubVol == NULL)
|
2014-11-04 00:26:53 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
while (subv.fListBoxIndex-- > 0) {
|
|
|
|
pSubVol = fpDiskFS->GetNextSubVolume(pSubVol);
|
|
|
|
}
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pSubVol != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
BlockEditDialog blockEdit;
|
|
|
|
SectorEditDialog sectorEdit;
|
|
|
|
DiskEditDialog* pEditDialog;
|
|
|
|
|
|
|
|
showAsBlocks = pSubVol->GetDiskImg()->ShowAsBlocks();
|
|
|
|
if (showAsBlocks)
|
|
|
|
pEditDialog = &blockEdit;
|
|
|
|
else
|
|
|
|
pEditDialog = §orEdit;
|
2015-01-15 22:21:01 +00:00
|
|
|
CString volumeId(Charset::ConvertMORToUNI(fpDiskFS->GetVolumeID()));
|
Volume name and font fixes
More volume name MOR conversions. I think I got them all.
This also switches the "archive info", "add files", and "extract
files" dialogs to use the System Font. We were using "MS Sans
Serif" before, which looks a bit ratty on Windows 7 because it
doesn't take advantage of ClearType. (Apparently the ClearType
version is "Microsoft Sans Serif", though when you set the "use
system font" boolean to true it changes the font name to "MS Shell
Dlg".) The old font also seems to be missing certain glyphs, e.g.
my HFS volume name had 'TM' in it, but that just showed up as a box
(which is why, in case you were wondering, these changes ended up
together).
The new font seems to work equally well on WinXP, so I may enable
it for all dialogs in a follow-up change. As far as I can tell it
has the same font metrics -- I haven't seen anything weird looking
in the dialogs I've updated so far.
Also, bumped the version to 4.0.0-b3.
2015-01-15 19:25:26 +00:00
|
|
|
pEditDialog->Setup(pSubVol->GetDiskFS(), volumeId);
|
2014-11-04 00:26:53 +00:00
|
|
|
pEditDialog->SetPositionShift(8);
|
|
|
|
(void) pEditDialog->DoModal();
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void DiskEditDialog::SetSpinMode(int id, int base)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
CString valStr;
|
|
|
|
|
|
|
|
ASSERT(base == 10 || base == 16);
|
|
|
|
|
|
|
|
MySpinCtrl* pSpin = (MySpinCtrl*) GetDlgItem(id);
|
2014-11-18 05:13:13 +00:00
|
|
|
if (pSpin == NULL) {
|
2014-11-04 00:26:53 +00:00
|
|
|
// expected behavior in "block" mode for sector button
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("Couldn't find spin button %d", id);
|
2014-11-04 00:26:53 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
long val = pSpin->GetPos();
|
|
|
|
if (val & 0xff000000) {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("NOTE: hex transition while value is invalid");
|
2014-11-04 00:26:53 +00:00
|
|
|
val = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (base == 10)
|
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
|
|
|
valStr.Format(L"%d", val);
|
2014-11-04 00:26:53 +00:00
|
|
|
else
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
valStr.Format(L"%X", val);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
pSpin->SetBase(base);
|
|
|
|
pSpin->GetBuddy()->SetWindowText(valStr);
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("Set spin button base to %d val=%d", base, val);
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
int DiskEditDialog::ReadSpinner(int id, long* pVal)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
MySpinCtrl* pSpin = (MySpinCtrl*) GetDlgItem(id);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pSpin != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
long val = pSpin->GetPos();
|
|
|
|
if (val & 0xff000000) {
|
|
|
|
/* error */
|
2014-12-16 19:04:31 +00:00
|
|
|
CString msg, err;
|
|
|
|
|
|
|
|
CheckedLoadString(&err, IDS_ERROR);
|
2014-11-04 00:26:53 +00:00
|
|
|
int lower, upper;
|
|
|
|
pSpin->GetRange32(lower, upper);
|
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"Please enter a value between %d and %d (0x%x and 0x%x).",
|
2014-11-04 00:26:53 +00:00
|
|
|
lower, upper, lower, upper);
|
|
|
|
MessageBox(msg, err, MB_OK|MB_ICONEXCLAMATION);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
*pVal = val;
|
|
|
|
return 0;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void DiskEditDialog::SetSpinner(int id, long val)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
MySpinCtrl* pSpin = (MySpinCtrl*) GetDlgItem(id);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pSpin != NULL);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
/* sanity check */
|
|
|
|
int lower, upper;
|
|
|
|
pSpin->GetRange32(lower, upper);
|
|
|
|
ASSERT(val >= lower && val <= upper);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
pSpin->SetPos(val);
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void DiskEditDialog::DisplayData(const uint8_t* srcBuf, int size)
|
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
|
|
|
WCHAR textBuf[80 * 16 * 2];
|
|
|
|
WCHAR* cp;
|
2014-11-04 00:26:53 +00:00
|
|
|
int i, j;
|
|
|
|
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(srcBuf != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
ASSERT(size == kSectorSize || size == kBlockSize);
|
|
|
|
|
|
|
|
CRichEditCtrl* pEdit = (CRichEditCtrl*)GetDlgItem(IDC_DISKEDIT_EDIT);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pEdit != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* If we have an alert message, show that instead.
|
|
|
|
*/
|
|
|
|
if (!fAlertMsg.IsEmpty()) {
|
|
|
|
const int kWidth = 72;
|
|
|
|
int indent = (kWidth/2) - (fAlertMsg.GetLength() / 2);
|
|
|
|
if (indent < 0)
|
|
|
|
indent = 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
|
|
|
CString msg = L" "
|
|
|
|
L" ";
|
2014-11-04 00:26:53 +00:00
|
|
|
ASSERT(msg.GetLength() == kWidth);
|
|
|
|
msg = msg.Left(indent);
|
|
|
|
msg += fAlertMsg;
|
|
|
|
for (i = 0; i < (size / 16)-2; i += 2) {
|
|
|
|
textBuf[i] = '\r';
|
|
|
|
textBuf[i+1] = '\n';
|
|
|
|
}
|
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
|
|
|
wcscpy(&textBuf[i], msg);
|
2014-11-04 00:26:53 +00:00
|
|
|
pEdit->SetWindowText(textBuf);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* No alert, do the usual thing.
|
|
|
|
*/
|
|
|
|
cp = textBuf;
|
|
|
|
for (i = 0; i < size/16; i++) {
|
|
|
|
if (size == kSectorSize) {
|
|
|
|
/* two-nybble addr */
|
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
|
|
|
wsprintf(cp, L" %02x: %02x %02x %02x %02x %02x %02x %02x %02x "
|
|
|
|
L"%02x %02x %02x %02x %02x %02x %02x %02x ",
|
2014-11-04 00:26:53 +00:00
|
|
|
i * 16,
|
|
|
|
srcBuf[0], srcBuf[1], srcBuf[2], srcBuf[3],
|
|
|
|
srcBuf[4], srcBuf[5], srcBuf[6], srcBuf[7],
|
|
|
|
srcBuf[8], srcBuf[9], srcBuf[10], srcBuf[11],
|
|
|
|
srcBuf[12], srcBuf[13], srcBuf[14], srcBuf[15]);
|
|
|
|
} else {
|
|
|
|
/* three-nybble addr */
|
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
|
|
|
wsprintf(cp, L"%03x: %02x %02x %02x %02x %02x %02x %02x %02x "
|
|
|
|
L"%02x %02x %02x %02x %02x %02x %02x %02x ",
|
2014-11-04 00:26:53 +00:00
|
|
|
i * 16,
|
|
|
|
srcBuf[0], srcBuf[1], srcBuf[2], srcBuf[3],
|
|
|
|
srcBuf[4], srcBuf[5], srcBuf[6], srcBuf[7],
|
|
|
|
srcBuf[8], srcBuf[9], srcBuf[10], srcBuf[11],
|
|
|
|
srcBuf[12], srcBuf[13], srcBuf[14], srcBuf[15]);
|
|
|
|
}
|
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
|
|
|
ASSERT(wcslen(cp) == 54);
|
2014-11-04 00:26:53 +00:00
|
|
|
cp += 54; // strlen(cp)
|
|
|
|
for (j = 0; j < 16; j++)
|
|
|
|
*cp++ = PrintableChar(srcBuf[j]);
|
|
|
|
|
|
|
|
*cp++ = '\r';
|
|
|
|
*cp++ = '\n';
|
|
|
|
|
|
|
|
srcBuf += 16;
|
|
|
|
}
|
|
|
|
/* kill the last EOL, so the cursor doesn't move past that line */
|
|
|
|
cp--;
|
|
|
|
*cp = '\0';
|
|
|
|
|
|
|
|
pEdit->SetWindowText(textBuf);
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void DiskEditDialog::DisplayNibbleData(const unsigned char* srcBuf, int size)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(srcBuf != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
ASSERT(size > 0);
|
|
|
|
ASSERT(fAlertMsg.IsEmpty());
|
|
|
|
|
|
|
|
int bufSize = ((size+15) / 16) * 80;
|
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
|
|
|
WCHAR* textBuf = new WCHAR[bufSize];
|
|
|
|
WCHAR* cp;
|
2014-11-04 00:26:53 +00:00
|
|
|
int i;
|
|
|
|
|
2014-11-18 05:13:13 +00:00
|
|
|
if (textBuf == NULL)
|
2014-11-04 00:26:53 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
cp = textBuf;
|
|
|
|
for (i = 0; size > 0; i++) {
|
|
|
|
if (size >= 16) {
|
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
|
|
|
wsprintf(cp, L"%04x: %02x %02x %02x %02x %02x %02x %02x %02x "
|
|
|
|
L"%02x %02x %02x %02x %02x %02x %02x %02x",
|
2014-11-04 00:26:53 +00:00
|
|
|
i * 16,
|
|
|
|
srcBuf[0], srcBuf[1], srcBuf[2], srcBuf[3],
|
|
|
|
srcBuf[4], srcBuf[5], srcBuf[6], srcBuf[7],
|
|
|
|
srcBuf[8], srcBuf[9], srcBuf[10], srcBuf[11],
|
|
|
|
srcBuf[12], srcBuf[13], srcBuf[14], srcBuf[15]);
|
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
|
|
|
ASSERT(wcslen(cp) == 53);
|
2014-11-04 00:26:53 +00:00
|
|
|
cp += 53; // strlen(cp)
|
|
|
|
} else {
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
wsprintf(cp, L"%04x:", i * 16);
|
2014-11-04 00:26:53 +00:00
|
|
|
cp += 5;
|
|
|
|
for (int j = 0; j < size; j++) {
|
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
|
|
|
wsprintf(cp, L" %02x", srcBuf[j]);
|
2014-11-04 00:26:53 +00:00
|
|
|
cp += 3;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
*cp++ = '\r';
|
|
|
|
*cp++ = '\n';
|
|
|
|
|
|
|
|
srcBuf += 16;
|
|
|
|
size -= 16;
|
|
|
|
}
|
|
|
|
/* kill the last EOL, so the cursor doesn't move past that line */
|
|
|
|
cp--;
|
|
|
|
*cp = '\0';
|
|
|
|
|
|
|
|
CRichEditCtrl* pEdit = (CRichEditCtrl*)GetDlgItem(IDC_DISKEDIT_EDIT);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pEdit != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
pEdit->SetWindowText(textBuf);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Handle resize of edit box. We have to do this late or the scroll bar
|
|
|
|
* won't appear under Win98. (Whatever.)
|
|
|
|
*/
|
|
|
|
if (fFirstResize) {
|
|
|
|
fFirstResize = false;
|
|
|
|
|
|
|
|
const int kStretchHeight = 249;
|
|
|
|
CRect rect;
|
|
|
|
|
|
|
|
GetWindowRect(&rect);
|
|
|
|
|
|
|
|
CRect inner;
|
|
|
|
pEdit->GetRect(&inner);
|
|
|
|
inner.bottom += kStretchHeight;
|
|
|
|
pEdit->GetWindowRect(&rect);
|
|
|
|
ScreenToClient(&rect);
|
|
|
|
rect.bottom += kStretchHeight;
|
|
|
|
pEdit->MoveWindow(&rect);
|
|
|
|
pEdit->SetRect(&inner);
|
|
|
|
}
|
|
|
|
|
|
|
|
delete[] textBuf;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
DIError DiskEditDialog::OpenFile(const WCHAR* fileName, bool openRsrc,
|
|
|
|
A2File** ppFile, A2FileDescr** ppOpenFile)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
A2File* pFile;
|
2014-11-18 05:13:13 +00:00
|
|
|
A2FileDescr* pOpenFile = NULL;
|
2014-11-04 00:26:53 +00:00
|
|
|
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI(" OpenFile '%ls' rsrc=%d", fileName, openRsrc);
|
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
|
|
|
CStringA fileNameA(fileName);
|
|
|
|
pFile = fpDiskFS->GetFileByName(fileNameA);
|
2014-11-18 05:13:13 +00:00
|
|
|
if (pFile == NULL) {
|
2014-11-04 00:26:53 +00:00
|
|
|
CString msg, failed;
|
|
|
|
|
|
|
|
msg.Format(IDS_DEFILE_FIND_FAILED, fileName);
|
2014-12-16 19:04:31 +00:00
|
|
|
CheckedLoadString(&failed, IDS_FAILED);
|
2014-11-04 00:26:53 +00:00
|
|
|
MessageBox(msg, failed, MB_OK | MB_ICONSTOP);
|
|
|
|
return kDIErrFileNotFound;
|
|
|
|
}
|
|
|
|
|
|
|
|
DIError dierr;
|
|
|
|
dierr = pFile->Open(&pOpenFile, true, openRsrc);
|
|
|
|
if (dierr != kDIErrNone) {
|
|
|
|
CString msg, failed;
|
|
|
|
|
|
|
|
msg.Format(IDS_DEFILE_OPEN_FAILED, fileName,
|
|
|
|
DiskImgLib::DIStrError(dierr));
|
2014-12-16 19:04:31 +00:00
|
|
|
CheckedLoadString(&failed, IDS_FAILED);
|
2014-11-04 00:26:53 +00:00
|
|
|
MessageBox(msg, failed, MB_OK | MB_ICONSTOP);
|
|
|
|
return dierr;
|
|
|
|
}
|
|
|
|
|
|
|
|
*ppFile = pFile;
|
|
|
|
*ppOpenFile = pOpenFile;
|
|
|
|
|
|
|
|
return kDIErrNone;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void DiskEditDialog::OnNibbleParms(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
DiskImg* pDiskImg = fpDiskFS->GetDiskImg();
|
|
|
|
CComboBox* pCombo;
|
|
|
|
int sel;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pDiskImg != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
ASSERT(pDiskImg->GetHasNibbles());
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
pCombo = (CComboBox*) GetDlgItem(IDC_DISKEDIT_NIBBLE_PARMS);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pCombo != NULL);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
sel = pCombo->GetCurSel();
|
|
|
|
if (sel == CB_ERR)
|
|
|
|
return;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI(" OnNibbleParms: entry %d now selected", sel);
|
2014-11-04 00:26:53 +00:00
|
|
|
const DiskImg::NibbleDescr* pNibbleTable;
|
|
|
|
int count;
|
|
|
|
pNibbleTable = pDiskImg->GetNibbleDescrTable(&count);
|
|
|
|
ASSERT(sel < count);
|
|
|
|
pDiskImg->SetNibbleDescr(sel);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
LoadData();
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
/*
|
|
|
|
* Make a "sparse" block in a file obvious by filling it with the word
|
|
|
|
* "sparse".
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
DiskEditDialog::FillWithPattern(unsigned char* buf, int size,
|
2014-11-04 00:26:53 +00:00
|
|
|
const char* pattern)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
const char* cp;
|
|
|
|
unsigned char* ucp;
|
|
|
|
|
|
|
|
ucp = buf;
|
|
|
|
cp = pattern;
|
|
|
|
while (ucp < buf+size) {
|
|
|
|
*ucp++ = *cp++;
|
|
|
|
if (*cp == '\0')
|
|
|
|
cp = pattern;
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ===========================================================================
|
2014-11-04 00:26:53 +00:00
|
|
|
* SectorEditDialog
|
2007-03-27 17:47:10 +00:00
|
|
|
* ===========================================================================
|
|
|
|
*/
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
BOOL SectorEditDialog::OnInitDialog(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
/*
|
|
|
|
* Do base-class construction.
|
|
|
|
*/
|
|
|
|
DiskEditDialog::OnInitDialog();
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Change track/sector text.
|
|
|
|
*/
|
|
|
|
CString trackStr;
|
|
|
|
CWnd* pWnd;
|
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
|
|
|
trackStr.Format(L"Track (%d):", fpDiskFS->GetDiskImg()->GetNumTracks());
|
2014-11-04 00:26:53 +00:00
|
|
|
pWnd = GetDlgItem(IDC_STEXT_TRACK);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pWnd != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
pWnd->SetWindowText(trackStr);
|
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
|
|
|
trackStr.Format(L"Sector (%d):", fpDiskFS->GetDiskImg()->GetNumSectPerTrack());
|
2014-11-04 00:26:53 +00:00
|
|
|
pWnd = GetDlgItem(IDC_STEXT_SECTOR);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pWnd != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
pWnd->SetWindowText(trackStr);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Configure the spin buttons.
|
|
|
|
*/
|
|
|
|
MySpinCtrl* pSpin;
|
|
|
|
pSpin = (MySpinCtrl*)GetDlgItem(IDC_DISKEDIT_TRACKSPIN);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pSpin != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
pSpin->SetRange32(0, fpDiskFS->GetDiskImg()->GetNumTracks()-1);
|
|
|
|
pSpin->SetPos(0);
|
|
|
|
pSpin = (MySpinCtrl*)GetDlgItem(IDC_DISKEDIT_SECTORSPIN);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pSpin != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
pSpin->SetRange32(0, fpDiskFS->GetDiskImg()->GetNumSectPerTrack()-1);
|
|
|
|
pSpin->SetPos(0);
|
|
|
|
|
|
|
|
/* give us something to look at */
|
|
|
|
LoadData();
|
|
|
|
|
|
|
|
return TRUE;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
int SectorEditDialog::LoadData(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 21:05:15 +00:00
|
|
|
//LOGI("SED LoadData");
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(fpDiskFS != NULL);
|
|
|
|
ASSERT(fpDiskFS->GetDiskImg() != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
if (ReadSpinner(IDC_DISKEDIT_TRACKSPIN, &fTrack) != 0)
|
|
|
|
return -1;
|
|
|
|
if (ReadSpinner(IDC_DISKEDIT_SECTORSPIN, &fSector) != 0)
|
|
|
|
return -1;
|
|
|
|
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("LoadData reading t=%d s=%d", fTrack, fSector);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
fAlertMsg = "";
|
|
|
|
DIError dierr;
|
|
|
|
dierr = fpDiskFS->GetDiskImg()->ReadTrackSector(fTrack, fSector, fSectorData);
|
|
|
|
if (dierr != kDIErrNone) {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("SED sector read failed: %hs", DiskImgLib::DIStrError(dierr));
|
2014-11-04 00:26:53 +00:00
|
|
|
//CString msg;
|
|
|
|
//CString err;
|
|
|
|
//err.LoadString(IDS_ERROR);
|
|
|
|
//msg.Format(IDS_DISKEDIT_NOREADTS, fTrack, fSector);
|
|
|
|
//MessageBox(msg, err, MB_OK|MB_ICONSTOP);
|
2014-12-16 19:04:31 +00:00
|
|
|
CheckedLoadString(&fAlertMsg, IDS_DISKEDITMSG_BADSECTOR);
|
2014-11-04 00:26:53 +00:00
|
|
|
//return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
DisplayData();
|
|
|
|
|
|
|
|
return 0;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void SectorEditDialog::OnDoRead(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
LoadData();
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void SectorEditDialog::OnDoWrite(void)
|
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
|
|
|
MessageBox(L"Write!");
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void SectorEditDialog::OnReadPrev(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
if (fTrack == 0 && fSector == 0)
|
|
|
|
return;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
if (fSector == 0) {
|
|
|
|
fSector = fpDiskFS->GetDiskImg()->GetNumSectPerTrack() -1;
|
|
|
|
fTrack--;
|
|
|
|
} else {
|
|
|
|
fSector--;
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
SetSpinner(IDC_DISKEDIT_TRACKSPIN, fTrack);
|
|
|
|
SetSpinner(IDC_DISKEDIT_SECTORSPIN, fSector);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
LoadData();
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void SectorEditDialog::OnReadNext(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
int numTracks = fpDiskFS->GetDiskImg()->GetNumTracks();
|
|
|
|
int numSects = fpDiskFS->GetDiskImg()->GetNumSectPerTrack();
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
if (fTrack == numTracks-1 && fSector == numSects-1)
|
|
|
|
return;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
if (fSector == numSects-1) {
|
|
|
|
fSector = 0;
|
|
|
|
fTrack++;
|
|
|
|
} else {
|
|
|
|
fSector++;
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
SetSpinner(IDC_DISKEDIT_TRACKSPIN, fTrack);
|
|
|
|
SetSpinner(IDC_DISKEDIT_SECTORSPIN, fSector);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
LoadData();
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void SectorEditDialog::OnOpenFile(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
DEFileDialog fileDialog(this);
|
|
|
|
|
|
|
|
if (fileDialog.DoModal() == IDOK) {
|
|
|
|
SectorFileEditDialog fileEdit(this, this);
|
|
|
|
A2File* pFile;
|
2014-11-18 05:13:13 +00:00
|
|
|
A2FileDescr* pOpenFile = NULL;
|
2014-11-04 00:26:53 +00:00
|
|
|
DIError dierr;
|
|
|
|
|
|
|
|
dierr = OpenFile(fileDialog.fName, fileDialog.fOpenRsrcFork != 0,
|
|
|
|
&pFile, &pOpenFile);
|
|
|
|
if (dierr != kDIErrNone)
|
|
|
|
return;
|
|
|
|
|
|
|
|
fileEdit.SetupFile(fileDialog.fName, fileDialog.fOpenRsrcFork != 0,
|
|
|
|
pFile, pOpenFile);
|
|
|
|
fileEdit.SetPositionShift(8);
|
|
|
|
(void) fileEdit.DoModal();
|
|
|
|
|
|
|
|
pOpenFile->Close();
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ===========================================================================
|
2014-11-04 00:26:53 +00:00
|
|
|
* SectorFileEditDialog
|
2007-03-27 17:47:10 +00:00
|
|
|
* ===========================================================================
|
|
|
|
*/
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
BOOL SectorFileEditDialog::OnInitDialog(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
BOOL retval;
|
|
|
|
|
|
|
|
/* do base class first */
|
|
|
|
retval = SectorEditDialog::OnInitDialog();
|
|
|
|
|
|
|
|
/* disable direct entry of tracks and sectors */
|
|
|
|
CWnd* pWnd;
|
|
|
|
pWnd = GetDlgItem(IDC_DISKEDIT_TRACKSPIN);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pWnd != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
pWnd->EnableWindow(FALSE);
|
|
|
|
pWnd = GetDlgItem(IDC_DISKEDIT_SECTORSPIN);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pWnd != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
pWnd->EnableWindow(FALSE);
|
|
|
|
|
|
|
|
/* disallow opening of sub-volumes and files */
|
|
|
|
pWnd = GetDlgItem(IDC_DISKEDIT_OPENFILE);
|
|
|
|
pWnd->EnableWindow(FALSE);
|
|
|
|
pWnd = GetDlgItem(IDC_DISKEDIT_SUBVOLUME);
|
|
|
|
pWnd->EnableWindow(FALSE);
|
|
|
|
|
|
|
|
CEdit* pEdit;
|
|
|
|
pEdit = (CEdit*) GetDlgItem(IDC_DISKEDIT_TRACK);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pEdit != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
pEdit->SetReadOnly(TRUE);
|
|
|
|
pEdit = (CEdit*) GetDlgItem(IDC_DISKEDIT_SECTOR);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pEdit != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
pEdit->SetReadOnly(TRUE);
|
|
|
|
|
|
|
|
/* set the window title */
|
|
|
|
CString title;
|
|
|
|
CString rsrcIndic;
|
2014-12-16 19:04:31 +00:00
|
|
|
CheckedLoadString(&rsrcIndic, IDS_INDIC_RSRC);
|
2014-11-19 22:54:24 +00:00
|
|
|
title.Format(L"Disk Viewer - %hs%ls (%I64d bytes)",
|
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
|
|
|
(LPCSTR) fpFile->GetPathName(), // use fpFile version to get case
|
2014-11-19 22:54:24 +00:00
|
|
|
fOpenRsrcFork ? (LPCWSTR)rsrcIndic : L"", (LONGLONG) fLength);
|
2014-11-04 00:26:53 +00:00
|
|
|
SetWindowText(title);
|
|
|
|
|
|
|
|
return retval;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
int SectorFileEditDialog::LoadData(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(fpDiskFS != NULL);
|
|
|
|
ASSERT(fpDiskFS->GetDiskImg() != NULL);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
DIError dierr;
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("SFED LoadData reading index=%d", fSectorIdx);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
|
|
|
#if 0
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("LoadData reading offset=%d", fOffset);
|
2014-11-04 00:26:53 +00:00
|
|
|
size_t actual = 0;
|
|
|
|
dierr = fpFile->Seek(fOffset, EmbeddedFD::kSeekSet);
|
|
|
|
if (dierr == kDIErrNone) {
|
|
|
|
dierr = fpFile->Read(fSectorData, 1 /*kSectorSize*/, &actual);
|
|
|
|
}
|
|
|
|
if (dierr != kDIErrNone) {
|
|
|
|
CString msg, failed;
|
|
|
|
failed.LoadString(IDS_FAILED);
|
|
|
|
msg.Format(IDS_DISKEDIT_FIRDFAILED, DiskImg::DIStrError(dierr));
|
|
|
|
MessageBox(msg, failed, MB_OK);
|
|
|
|
// TO DO: mark contents as invalid, so editing fails
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (actual != kSectorSize) {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI(" SFED partial read of %d bytes", actual);
|
2014-11-04 00:26:53 +00:00
|
|
|
ASSERT(actual < kSectorSize && actual >= 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We've read the data, but we can't use it. We're a sector editor,
|
|
|
|
* not a file editor, and we need to get the actual sector data without
|
|
|
|
* EOF trimming or CP/M 0xe5 removal.
|
|
|
|
*/
|
|
|
|
fpFile->GetLastLocationRead(&fTrack, &fSector);
|
|
|
|
if (fTrack == A2File::kLastWasSparse && fSector == A2File::kLastWasSparse)
|
|
|
|
|
|
|
|
;
|
2007-03-27 17:47:10 +00:00
|
|
|
#endif
|
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
fAlertMsg = "";
|
|
|
|
|
|
|
|
dierr = fpOpenFile->GetStorage(fSectorIdx, &fTrack, &fSector);
|
|
|
|
if (dierr == kDIErrInvalidIndex && fSectorIdx == 0) {
|
|
|
|
// no first sector; should only happen on CP/M
|
|
|
|
//FillWithPattern(fSectorData, sizeof(fSectorData), _T("EMPTY "));
|
2014-12-16 19:04:31 +00:00
|
|
|
CheckedLoadString(&fAlertMsg, IDS_DISKEDITMSG_EMPTY);
|
2014-11-04 00:26:53 +00:00
|
|
|
} else if (dierr != kDIErrNone) {
|
|
|
|
CString msg, failed;
|
2014-12-16 19:04:31 +00:00
|
|
|
CheckedLoadString(&failed, IDS_FAILED);
|
2014-11-04 00:26:53 +00:00
|
|
|
msg.Format(IDS_DISKEDIT_FIRDFAILED, DiskImgLib::DIStrError(dierr));
|
|
|
|
MessageBox(msg, failed, MB_OK);
|
2014-12-16 19:04:31 +00:00
|
|
|
CheckedLoadString(&fAlertMsg, IDS_FAILED);
|
2014-11-04 00:26:53 +00:00
|
|
|
// TO DO: mark contents as invalid, so editing fails
|
|
|
|
return -1;
|
|
|
|
} else {
|
|
|
|
if (fTrack == 0 && fSector == 0) {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("LoadData Sparse sector");
|
2014-11-04 00:26:53 +00:00
|
|
|
//FillWithPattern(fSectorData, sizeof(fSectorData), _T("SPARSE "));
|
|
|
|
fAlertMsg.Format(IDS_DISKEDITMSG_SPARSE, fSectorIdx);
|
|
|
|
} else {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("LoadData reading T=%d S=%d", fTrack, fSector);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
dierr = fpDiskFS->GetDiskImg()->ReadTrackSector(fTrack, fSector,
|
|
|
|
fSectorData);
|
|
|
|
if (dierr != kDIErrNone) {
|
|
|
|
//CString msg;
|
|
|
|
//CString err;
|
|
|
|
//err.LoadString(IDS_ERROR);
|
|
|
|
//msg.Format(IDS_DISKEDIT_NOREADTS, fTrack, fSector);
|
|
|
|
//MessageBox(msg, err, MB_OK|MB_ICONSTOP);
|
2014-12-16 19:04:31 +00:00
|
|
|
CheckedLoadString(&fAlertMsg, IDS_DISKEDITMSG_BADSECTOR);
|
2014-11-04 00:26:53 +00:00
|
|
|
//return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SetSpinner(IDC_DISKEDIT_TRACKSPIN, fTrack);
|
|
|
|
SetSpinner(IDC_DISKEDIT_SECTORSPIN, fSector);
|
|
|
|
|
|
|
|
CWnd* pWnd;
|
|
|
|
pWnd = GetDlgItem(IDC_DISKEDIT_PREV);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pWnd != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
pWnd->EnableWindow(fSectorIdx > 0);
|
2014-11-18 05:13:13 +00:00
|
|
|
if (!pWnd->IsWindowEnabled() && GetFocus() == NULL)
|
2014-11-04 00:26:53 +00:00
|
|
|
GetDlgItem(IDC_DISKEDIT_NEXT)->SetFocus();
|
|
|
|
|
|
|
|
pWnd = GetDlgItem(IDC_DISKEDIT_NEXT);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pWnd != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
pWnd->EnableWindow(fSectorIdx+1 < fpOpenFile->GetSectorCount());
|
2014-11-18 05:13:13 +00:00
|
|
|
if (!pWnd->IsWindowEnabled() && GetFocus() == NULL)
|
2014-11-04 00:26:53 +00:00
|
|
|
GetDlgItem(IDC_DISKEDIT_PREV)->SetFocus();
|
|
|
|
|
|
|
|
DisplayData();
|
|
|
|
|
|
|
|
return 0;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void SectorFileEditDialog::OnReadPrev(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
if (fSectorIdx == 0)
|
|
|
|
return;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
fSectorIdx--;
|
|
|
|
ASSERT(fSectorIdx >= 0);
|
|
|
|
LoadData();
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void SectorFileEditDialog::OnReadNext(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
if (fSectorIdx+1 >= fpOpenFile->GetSectorCount())
|
|
|
|
return;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
fSectorIdx++;
|
|
|
|
ASSERT(fSectorIdx < fpOpenFile->GetSectorCount());
|
|
|
|
LoadData();
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ===========================================================================
|
2014-11-04 00:26:53 +00:00
|
|
|
* BlockEditDialog
|
2007-03-27 17:47:10 +00:00
|
|
|
* ===========================================================================
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Rearrange the DiskEdit dialog (which defaults to SectorEdit mode) to
|
|
|
|
* accommodate block editing.
|
|
|
|
*/
|
2014-11-21 21:18:20 +00:00
|
|
|
BOOL BlockEditDialog::OnInitDialog(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
/*
|
|
|
|
* Get rid of the "sector" input item, and change the "track" input
|
|
|
|
* item to accept blocks instead.
|
|
|
|
*/
|
|
|
|
CWnd* pWnd;
|
|
|
|
|
|
|
|
pWnd = GetDlgItem(IDC_STEXT_SECTOR);
|
|
|
|
pWnd->DestroyWindow();
|
|
|
|
pWnd = GetDlgItem(IDC_DISKEDIT_SECTOR);
|
|
|
|
pWnd->DestroyWindow();
|
|
|
|
pWnd = GetDlgItem(IDC_DISKEDIT_SECTORSPIN);
|
|
|
|
pWnd->DestroyWindow();
|
|
|
|
|
|
|
|
CString blockStr;
|
|
|
|
//blockStr.LoadString(IDS_BLOCK);
|
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
|
|
|
blockStr.Format(L"Block (%d):", fpDiskFS->GetDiskImg()->GetNumBlocks());
|
2014-11-04 00:26:53 +00:00
|
|
|
pWnd = GetDlgItem(IDC_STEXT_TRACK);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pWnd != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
pWnd->SetWindowText(blockStr);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Increase the size of the window to accommodate the larger block size.
|
|
|
|
*/
|
|
|
|
const int kStretchHeight = 250;
|
|
|
|
CRect rect;
|
|
|
|
|
|
|
|
GetWindowRect(&rect);
|
|
|
|
rect.bottom += kStretchHeight;
|
|
|
|
MoveWindow(&rect);
|
|
|
|
|
|
|
|
CRichEditCtrl* pEdit = (CRichEditCtrl*)GetDlgItem(IDC_DISKEDIT_EDIT);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pEdit != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
CRect inner;
|
|
|
|
pEdit->GetRect(&inner);
|
|
|
|
inner.bottom += kStretchHeight;
|
|
|
|
pEdit->GetWindowRect(&rect);
|
|
|
|
ScreenToClient(&rect);
|
|
|
|
rect.bottom += kStretchHeight;
|
|
|
|
pEdit->MoveWindow(&rect);
|
|
|
|
pEdit->SetRect(&inner);
|
|
|
|
|
|
|
|
MoveControl(this, IDC_DISKEDIT_DONE, 0, kStretchHeight);
|
|
|
|
MoveControl(this, IDC_DISKEDIT_OPENFILE, 0, kStretchHeight);
|
|
|
|
MoveControl(this, IDC_DISKEDIT_SUBVOLUME, 0, kStretchHeight);
|
|
|
|
MoveControl(this, IDHELP, 0, kStretchHeight);
|
|
|
|
MoveControl(this, IDC_DISKEDIT_NIBBLE_PARMS, 0, kStretchHeight);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Do base-class construction.
|
|
|
|
*/
|
|
|
|
DiskEditDialog::OnInitDialog();
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Configure the spin button. We use the "track" spin button for blocks.
|
|
|
|
*/
|
|
|
|
MySpinCtrl* pSpin;
|
|
|
|
pSpin = (MySpinCtrl*)GetDlgItem(IDC_DISKEDIT_TRACKSPIN);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pSpin != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
pSpin->SetRange32(0, fpDiskFS->GetDiskImg()->GetNumBlocks()-1);
|
|
|
|
pSpin->SetPos(0);
|
|
|
|
|
|
|
|
/* give us something to look at */
|
|
|
|
if (LoadData() != 0) {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("WHOOPS: LoadData() failed, but we're in OnInitDialog");
|
2014-11-04 00:26:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
/*
|
|
|
|
* Move a control so it maintains its same position relative to the bottom
|
|
|
|
* and right edges.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
BlockEditDialog::MoveControl(int id, int deltaX, int deltaY)
|
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
CWnd* pWnd;
|
|
|
|
CRect rect;
|
|
|
|
|
|
|
|
pWnd = GetDlgItem(id);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pWnd != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
pWnd->GetWindowRect(&rect);
|
|
|
|
ScreenToClient(&rect);
|
|
|
|
rect.left += deltaX;
|
|
|
|
rect.right += deltaX;
|
|
|
|
rect.top += deltaY;
|
|
|
|
rect.bottom += deltaY;
|
|
|
|
pWnd->MoveWindow(&rect, TRUE);
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
int BlockEditDialog::LoadData(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 21:05:15 +00:00
|
|
|
//LOGI("BED LoadData");
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(fpDiskFS != NULL);
|
|
|
|
ASSERT(fpDiskFS->GetDiskImg() != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
if (ReadSpinner(IDC_DISKEDIT_TRACKSPIN, &fBlock) != 0)
|
|
|
|
return -1;
|
|
|
|
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("LoadData reading block=%d", fBlock);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
fAlertMsg = "";
|
|
|
|
DIError dierr;
|
|
|
|
dierr = fpDiskFS->GetDiskImg()->ReadBlock(fBlock, fBlockData);
|
|
|
|
if (dierr != kDIErrNone) {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("BED block read failed: %hs", DiskImgLib::DIStrError(dierr));
|
2014-11-04 00:26:53 +00:00
|
|
|
//CString msg;
|
|
|
|
//CString err;
|
|
|
|
//err.LoadString(IDS_ERROR);
|
|
|
|
//msg.Format(IDS_DISKEDIT_NOREADBLOCK, fBlock);
|
|
|
|
//MessageBox(msg, err, MB_OK|MB_ICONSTOP);
|
2014-12-16 19:04:31 +00:00
|
|
|
CheckedLoadString(&fAlertMsg, IDS_DISKEDITMSG_BADBLOCK);
|
2014-11-04 00:26:53 +00:00
|
|
|
//return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
DisplayData();
|
|
|
|
|
|
|
|
return 0;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void BlockEditDialog::OnDoRead(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
LoadData();
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void BlockEditDialog::OnDoWrite(void)
|
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
|
|
|
MessageBox(L"Write!");
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void BlockEditDialog::OnReadPrev(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
if (fBlock == 0)
|
|
|
|
return;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
fBlock--;
|
|
|
|
SetSpinner(IDC_DISKEDIT_TRACKSPIN, fBlock);
|
|
|
|
LoadData();
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
BlockEditDialog::OnReadNext(void)
|
|
|
|
{
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(fpDiskFS != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
if (fBlock == fpDiskFS->GetDiskImg()->GetNumBlocks() - 1)
|
|
|
|
return;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
fBlock++;
|
|
|
|
SetSpinner(IDC_DISKEDIT_TRACKSPIN, fBlock);
|
|
|
|
LoadData();
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void BlockEditDialog::OnOpenFile(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
DEFileDialog fileDialog(this);
|
|
|
|
|
|
|
|
if (fileDialog.DoModal() == IDOK) {
|
|
|
|
BlockFileEditDialog fileEdit(this, this);
|
|
|
|
A2File* pFile;
|
2014-11-18 05:13:13 +00:00
|
|
|
A2FileDescr* pOpenFile = NULL;
|
2014-11-04 00:26:53 +00:00
|
|
|
DIError dierr;
|
|
|
|
|
|
|
|
dierr = OpenFile(fileDialog.fName, fileDialog.fOpenRsrcFork != 0,
|
|
|
|
&pFile, &pOpenFile);
|
|
|
|
if (dierr != kDIErrNone)
|
|
|
|
return;
|
|
|
|
|
|
|
|
fileEdit.SetupFile(fileDialog.fName, fileDialog.fOpenRsrcFork != 0,
|
|
|
|
pFile, pOpenFile);
|
|
|
|
fileEdit.SetPositionShift(8);
|
|
|
|
(void) fileEdit.DoModal();
|
|
|
|
|
|
|
|
pOpenFile->Close();
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ===========================================================================
|
2014-11-04 00:26:53 +00:00
|
|
|
* BlockFileEditDialog
|
2007-03-27 17:47:10 +00:00
|
|
|
* ===========================================================================
|
|
|
|
*/
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
BOOL BlockFileEditDialog::OnInitDialog(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
BOOL retval;
|
|
|
|
|
|
|
|
/* do base class first */
|
|
|
|
retval = BlockEditDialog::OnInitDialog();
|
|
|
|
|
|
|
|
/* disable direct entry of tracks and Blocks */
|
|
|
|
CWnd* pWnd;
|
|
|
|
pWnd = GetDlgItem(IDC_DISKEDIT_TRACKSPIN);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pWnd != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
pWnd->EnableWindow(FALSE);
|
|
|
|
|
|
|
|
/* disallow opening of sub-volumes and files */
|
|
|
|
pWnd = GetDlgItem(IDC_DISKEDIT_OPENFILE);
|
|
|
|
pWnd->EnableWindow(FALSE);
|
|
|
|
pWnd = GetDlgItem(IDC_DISKEDIT_SUBVOLUME);
|
|
|
|
pWnd->EnableWindow(FALSE);
|
|
|
|
|
|
|
|
CEdit* pEdit;
|
|
|
|
pEdit = (CEdit*) GetDlgItem(IDC_DISKEDIT_TRACK);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pEdit != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
pEdit->SetReadOnly(TRUE);
|
|
|
|
|
|
|
|
/* set the window title */
|
|
|
|
CString title;
|
|
|
|
CString rsrcIndic;
|
2014-12-16 19:04:31 +00:00
|
|
|
CheckedLoadString(&rsrcIndic, IDS_INDIC_RSRC);
|
2014-11-19 22:54:24 +00:00
|
|
|
title.Format(L"Disk Viewer - %hs%ls (%I64d bytes)",
|
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
|
|
|
(LPCSTR) fpFile->GetPathName(), // use fpFile version to get case
|
2014-11-19 22:54:24 +00:00
|
|
|
fOpenRsrcFork ? (LPCWSTR)rsrcIndic : L"", (LONGLONG) fLength);
|
2014-11-04 00:26:53 +00:00
|
|
|
SetWindowText(title);
|
|
|
|
|
|
|
|
return retval;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
int BlockFileEditDialog::LoadData(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(fpDiskFS != NULL);
|
|
|
|
ASSERT(fpDiskFS->GetDiskImg() != NULL);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
DIError dierr;
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("BFED LoadData reading index=%d", fBlockIdx);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
|
|
|
#if 0
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("LoadData reading offset=%d", fOffset);
|
2014-11-04 00:26:53 +00:00
|
|
|
size_t actual = 0;
|
|
|
|
dierr = fpFile->Seek(fOffset, EmbeddedFD::kSeekSet);
|
|
|
|
if (dierr == kDIErrNone) {
|
|
|
|
dierr = fpFile->Read(fBlockData, 1 /*kBlockSize*/, &actual);
|
|
|
|
}
|
|
|
|
if (dierr != kDIErrNone) {
|
|
|
|
CString msg, failed;
|
|
|
|
failed.LoadString(IDS_FAILED);
|
|
|
|
msg.Format(IDS_DISKEDIT_FIRDFAILED, DiskImg::DIStrError(dierr));
|
|
|
|
MessageBox(msg, failed, MB_OK);
|
|
|
|
// TO DO: mark contents as invalid, so editing fails
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (actual != kBlockSize) {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI(" BFED partial read of %d bytes", actual);
|
2014-11-04 00:26:53 +00:00
|
|
|
ASSERT(actual < kBlockSize && actual >= 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We've read the data, but we can't use it. We're a Block editor,
|
|
|
|
* not a file editor, and we need to get the actual Block data without
|
|
|
|
* EOF trimming or CP/M 0xe5 removal.
|
|
|
|
*/
|
|
|
|
fpFile->GetLastLocationRead(&fBlock);
|
|
|
|
if (fBlock == A2File::kLastWasSparse)
|
|
|
|
;
|
2007-03-27 17:47:10 +00:00
|
|
|
#endif
|
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
fAlertMsg = "";
|
|
|
|
|
|
|
|
dierr = fpOpenFile->GetStorage(fBlockIdx, &fBlock);
|
|
|
|
if (dierr == kDIErrInvalidIndex && fBlockIdx == 0) {
|
|
|
|
// no first sector; should only happen on CP/M
|
|
|
|
//FillWithPattern(fBlockData, sizeof(fBlockData), _T("EMPTY "));
|
2014-12-16 19:04:31 +00:00
|
|
|
CheckedLoadString(&fAlertMsg, IDS_DISKEDITMSG_EMPTY);
|
2014-11-04 00:26:53 +00:00
|
|
|
} else if (dierr != kDIErrNone) {
|
|
|
|
CString msg, failed;
|
2014-12-16 19:04:31 +00:00
|
|
|
CheckedLoadString(&failed, IDS_FAILED);
|
2014-11-04 00:26:53 +00:00
|
|
|
msg.Format(IDS_DISKEDIT_FIRDFAILED, DiskImgLib::DIStrError(dierr));
|
|
|
|
MessageBox(msg, failed, MB_OK);
|
2014-12-16 19:04:31 +00:00
|
|
|
CheckedLoadString(&fAlertMsg, IDS_FAILED);
|
2014-11-04 00:26:53 +00:00
|
|
|
// TO DO: mark contents as invalid, so editing fails
|
|
|
|
return -1;
|
|
|
|
} else {
|
|
|
|
if (fBlock == 0) {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("LoadData Sparse block");
|
2014-11-04 00:26:53 +00:00
|
|
|
//FillWithPattern(fBlockData, sizeof(fBlockData), _T("SPARSE "));
|
|
|
|
fAlertMsg.Format(IDS_DISKEDITMSG_SPARSE, fBlockIdx);
|
|
|
|
} else {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("LoadData reading B=%d", fBlock);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
dierr = fpDiskFS->GetDiskImg()->ReadBlock(fBlock, fBlockData);
|
|
|
|
if (dierr != kDIErrNone) {
|
|
|
|
//CString msg;
|
|
|
|
//CString err;
|
|
|
|
//err.LoadString(IDS_ERROR);
|
|
|
|
//msg.Format(IDS_DISKEDIT_NOREADBLOCK, fBlock);
|
|
|
|
//MessageBox(msg, err, MB_OK|MB_ICONSTOP);
|
2014-12-16 19:04:31 +00:00
|
|
|
CheckedLoadString(&fAlertMsg, IDS_DISKEDITMSG_BADBLOCK);
|
2014-11-04 00:26:53 +00:00
|
|
|
//return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SetSpinner(IDC_DISKEDIT_TRACKSPIN, fBlock);
|
|
|
|
|
|
|
|
CWnd* pWnd;
|
|
|
|
pWnd = GetDlgItem(IDC_DISKEDIT_PREV);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pWnd != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
pWnd->EnableWindow(fBlockIdx > 0);
|
2014-11-18 05:13:13 +00:00
|
|
|
if (!pWnd->IsWindowEnabled() && GetFocus() == NULL)
|
2014-11-04 00:26:53 +00:00
|
|
|
GetDlgItem(IDC_DISKEDIT_NEXT)->SetFocus();
|
|
|
|
|
|
|
|
pWnd = GetDlgItem(IDC_DISKEDIT_NEXT);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pWnd != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
pWnd->EnableWindow(fBlockIdx+1 < fpOpenFile->GetBlockCount());
|
2014-11-18 05:13:13 +00:00
|
|
|
if (!pWnd->IsWindowEnabled() && GetFocus() == NULL)
|
2014-11-04 00:26:53 +00:00
|
|
|
GetDlgItem(IDC_DISKEDIT_PREV)->SetFocus();
|
|
|
|
|
|
|
|
DisplayData();
|
|
|
|
|
|
|
|
return 0;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void BlockFileEditDialog::OnReadPrev(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
if (fBlockIdx == 0)
|
|
|
|
return;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
fBlockIdx--;
|
|
|
|
ASSERT(fBlockIdx >= 0);
|
|
|
|
LoadData();
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void BlockFileEditDialog::OnReadNext(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
if (fBlockIdx+1 >= fpOpenFile->GetBlockCount())
|
|
|
|
return;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
fBlockIdx++;
|
|
|
|
ASSERT(fBlockIdx < fpOpenFile->GetBlockCount());
|
|
|
|
LoadData();
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ===========================================================================
|
2014-11-04 00:26:53 +00:00
|
|
|
* NibbleEditDialog
|
2007-03-27 17:47:10 +00:00
|
|
|
* ===========================================================================
|
|
|
|
*/
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
BOOL NibbleEditDialog::OnInitDialog(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
/*
|
|
|
|
* Get rid of the "sector" input item.
|
|
|
|
*/
|
|
|
|
CWnd* pWnd;
|
|
|
|
|
|
|
|
pWnd = GetDlgItem(IDC_STEXT_SECTOR);
|
|
|
|
pWnd->DestroyWindow();
|
|
|
|
pWnd = GetDlgItem(IDC_DISKEDIT_SECTOR);
|
|
|
|
pWnd->DestroyWindow();
|
|
|
|
pWnd = GetDlgItem(IDC_DISKEDIT_SECTORSPIN);
|
|
|
|
pWnd->DestroyWindow();
|
|
|
|
|
|
|
|
CString trackStr;
|
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
|
|
|
trackStr.Format(L"Track (%d):", fpDiskFS->GetDiskImg()->GetNumTracks());
|
2014-11-04 00:26:53 +00:00
|
|
|
pWnd = GetDlgItem(IDC_STEXT_TRACK);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pWnd != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
pWnd->SetWindowText(trackStr);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Increase the size of the window so it's the same height as blocks.
|
|
|
|
*
|
|
|
|
* NOTE: using a pixel constant is probably bad. We want to use something
|
|
|
|
* like GetTextMetrics, but I'm not sure how to get that without a
|
|
|
|
* device context.
|
|
|
|
*/
|
|
|
|
CRichEditCtrl* pEdit = (CRichEditCtrl*)GetDlgItem(IDC_DISKEDIT_EDIT);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pEdit != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
const int kStretchHeight = 249;
|
|
|
|
CRect rect;
|
|
|
|
|
|
|
|
GetWindowRect(&rect);
|
|
|
|
rect.bottom += kStretchHeight;
|
|
|
|
MoveWindow(&rect);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Must postpone resize of edit ctrl until after data has been loaded, or
|
|
|
|
* scroll bars fail to appear under Win98. Makes no sense whatsoever, but
|
|
|
|
* that's Windows for you.
|
|
|
|
*/
|
2007-03-27 17:47:10 +00:00
|
|
|
#if 0
|
2014-11-04 00:26:53 +00:00
|
|
|
CRect inner;
|
|
|
|
pEdit->GetRect(&inner);
|
|
|
|
inner.bottom += kStretchHeight;
|
|
|
|
pEdit->GetWindowRect(&rect);
|
|
|
|
ScreenToClient(&rect);
|
|
|
|
rect.bottom += kStretchHeight;
|
|
|
|
pEdit->MoveWindow(&rect);
|
|
|
|
pEdit->SetRect(&inner);
|
2007-03-27 17:47:10 +00:00
|
|
|
#endif
|
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
/* show the scroll bar */
|
|
|
|
pEdit->ShowScrollBar(SB_VERT);
|
|
|
|
|
|
|
|
MoveControl(this, IDC_DISKEDIT_DONE, 0, kStretchHeight);
|
|
|
|
MoveControl(this, IDC_DISKEDIT_OPENFILE, 0, kStretchHeight);
|
|
|
|
MoveControl(this, IDC_DISKEDIT_SUBVOLUME, 0, kStretchHeight);
|
|
|
|
MoveControl(this, IDHELP, 0, kStretchHeight);
|
|
|
|
MoveControl(this, IDC_DISKEDIT_NIBBLE_PARMS, 0, kStretchHeight);
|
|
|
|
|
|
|
|
/* disable opening of files and sub-volumes */
|
|
|
|
pWnd = GetDlgItem(IDC_DISKEDIT_OPENFILE);
|
|
|
|
pWnd->EnableWindow(FALSE);
|
|
|
|
pWnd = GetDlgItem(IDC_DISKEDIT_SUBVOLUME);
|
|
|
|
pWnd->EnableWindow(FALSE);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Do base-class construction.
|
|
|
|
*/
|
|
|
|
DiskEditDialog::OnInitDialog();
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This currently has no effect on the nibble editor. Someday we may
|
|
|
|
* want to highlight and/or decode address fields.
|
|
|
|
*/
|
|
|
|
pWnd = GetDlgItem(IDC_DISKEDIT_NIBBLE_PARMS);
|
|
|
|
pWnd->EnableWindow(FALSE);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Configure the track spin button.
|
|
|
|
*/
|
|
|
|
MySpinCtrl* pSpin;
|
|
|
|
pSpin = (MySpinCtrl*)GetDlgItem(IDC_DISKEDIT_TRACKSPIN);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pSpin != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
pSpin->SetRange32(0, fpDiskFS->GetDiskImg()->GetNumTracks()-1);
|
|
|
|
pSpin->SetPos(0);
|
|
|
|
|
|
|
|
/* give us something to look at */
|
|
|
|
LoadData();
|
|
|
|
|
|
|
|
return TRUE;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
int NibbleEditDialog::LoadData(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 21:05:15 +00:00
|
|
|
//LOGI("BED LoadData");
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(fpDiskFS != NULL);
|
|
|
|
ASSERT(fpDiskFS->GetDiskImg() != NULL);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
if (ReadSpinner(IDC_DISKEDIT_TRACKSPIN, &fTrack) != 0)
|
|
|
|
return -1;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("LoadData reading track=%d", fTrack);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
fAlertMsg = "";
|
|
|
|
DIError dierr;
|
|
|
|
dierr = fpDiskFS->GetDiskImg()->ReadNibbleTrack(fTrack, fNibbleData,
|
|
|
|
&fNibbleDataLen);
|
|
|
|
if (dierr != kDIErrNone) {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("NED track read failed: %hs", DiskImgLib::DIStrError(dierr));
|
2014-12-16 19:04:31 +00:00
|
|
|
CheckedLoadString(&fAlertMsg, IDS_DISKEDITMSG_BADTRACK);
|
2014-11-04 00:26:53 +00:00
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
DisplayData();
|
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 NibbleEditDialog::OnDoRead(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
LoadData();
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void NibbleEditDialog::OnDoWrite(void)
|
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
|
|
|
MessageBox(L"Write!");
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void NibbleEditDialog::OnReadPrev(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
if (fTrack == 0)
|
|
|
|
return;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
fTrack--;
|
|
|
|
SetSpinner(IDC_DISKEDIT_TRACKSPIN, fTrack);
|
|
|
|
LoadData();
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void NibbleEditDialog::OnReadNext(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(fpDiskFS != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
if (fTrack == fpDiskFS->GetDiskImg()->GetNumTracks() - 1)
|
|
|
|
return;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
fTrack++;
|
|
|
|
SetSpinner(IDC_DISKEDIT_TRACKSPIN, fTrack);
|
|
|
|
LoadData();
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|