mirror of
https://github.com/AppleWin/AppleWin.git
synced 2026-04-25 19:19:02 +00:00
Change to using Registry's 'Configuration\Slot n' for disk ii image pathnames (was 'Preferences'). Delete Registry's 'Configuration\Slot n' section each time there's a change of card. Add same functionality to conf.ini. LoadConfiguration(): load from the new Slot-n section (or otherwise the old legacy key). Only update Registry's 'Starting Directory' for s6,d1. Update help doc.
This commit is contained in:
@@ -34,10 +34,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
CPageDisk* CPageDisk::ms_this = 0; // reinit'd in ctor
|
||||
|
||||
const TCHAR CPageDisk::m_discchoices[] =
|
||||
TEXT("Authentic Speed\0")
|
||||
TEXT("Enhanced Speed\0");
|
||||
|
||||
const TCHAR CPageDisk::m_defaultDiskOptions[] =
|
||||
TEXT("Select Disk...\0")
|
||||
TEXT("Eject Disk\0");
|
||||
@@ -78,6 +74,12 @@ INT_PTR CPageDisk::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARA
|
||||
// Can use this to ask user to confirm cancel
|
||||
break;
|
||||
case PSN_RESET:
|
||||
// Support 'Cancel' case for Slot-5 DiskII enabled/disabled - needed as the Disk2InterfaceCard object is created on toggling the checkbox. See [*1]
|
||||
if (m_PropertySheetHelper.GetConfigOld().m_Slot[SLOT5] != m_PropertySheetHelper.GetConfigNew().m_Slot[SLOT5])
|
||||
{
|
||||
if (m_PropertySheetHelper.GetConfigOld().m_Slot[SLOT5] == CT_Disk2 || m_PropertySheetHelper.GetConfigNew().m_Slot[SLOT5] == CT_Disk2)
|
||||
m_PropertySheetHelper.SetSlot(SLOT5, m_PropertySheetHelper.GetConfigOld().m_Slot[SLOT5]);
|
||||
}
|
||||
DlgCANCEL(hWnd);
|
||||
break;
|
||||
}
|
||||
@@ -87,17 +89,42 @@ INT_PTR CPageDisk::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARA
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wparam))
|
||||
{
|
||||
case IDC_DISKII_SLOT5_ENABLE:
|
||||
{
|
||||
const BOOL checked = IsDlgButtonChecked(hWnd, IDC_DISKII_SLOT5_ENABLE) ? TRUE : FALSE;
|
||||
m_PropertySheetHelper.GetConfigNew().m_Slot[SLOT5] = checked ? CT_Disk2 : CT_Empty;
|
||||
// NB. Unusual as it creates slot object when checkbox is toggled (instead of after OK)
|
||||
// Needed as we need a Disk2InterfaceCard object so that images can be inserted/ejected [*1]
|
||||
m_PropertySheetHelper.SetSlot(SLOT5, m_PropertySheetHelper.GetConfigNew().m_Slot[SLOT5]);
|
||||
InitOptions(hWnd);
|
||||
EnableFloppyDrive(hWnd, checked, SLOT5);
|
||||
}
|
||||
break;
|
||||
case IDC_COMBO_DISK1:
|
||||
if (HIWORD(wparam) == CBN_SELCHANGE)
|
||||
{
|
||||
HandleFloppyDriveCombo(hWnd, DRIVE_1, LOWORD(wparam));
|
||||
HandleFloppyDriveCombo(hWnd, DRIVE_1, LOWORD(wparam), IDC_COMBO_DISK2, SLOT6);
|
||||
GetFrame().FrameRefreshStatus(DRAW_BUTTON_DRIVES | DRAW_DISK_STATUS);
|
||||
}
|
||||
break;
|
||||
case IDC_COMBO_DISK2:
|
||||
if (HIWORD(wparam) == CBN_SELCHANGE)
|
||||
{
|
||||
HandleFloppyDriveCombo(hWnd, DRIVE_2, LOWORD(wparam));
|
||||
HandleFloppyDriveCombo(hWnd, DRIVE_2, LOWORD(wparam), IDC_COMBO_DISK1, SLOT6);
|
||||
GetFrame().FrameRefreshStatus(DRAW_BUTTON_DRIVES | DRAW_DISK_STATUS);
|
||||
}
|
||||
break;
|
||||
case IDC_COMBO_DISK1_SLOT5:
|
||||
if (HIWORD(wparam) == CBN_SELCHANGE)
|
||||
{
|
||||
HandleFloppyDriveCombo(hWnd, DRIVE_1, LOWORD(wparam), IDC_COMBO_DISK2_SLOT5, SLOT5);
|
||||
GetFrame().FrameRefreshStatus(DRAW_BUTTON_DRIVES | DRAW_DISK_STATUS);
|
||||
}
|
||||
break;
|
||||
case IDC_COMBO_DISK2_SLOT5:
|
||||
if (HIWORD(wparam) == CBN_SELCHANGE)
|
||||
{
|
||||
HandleFloppyDriveCombo(hWnd, DRIVE_2, LOWORD(wparam), IDC_COMBO_DISK1_SLOT5, SLOT5);
|
||||
GetFrame().FrameRefreshStatus(DRAW_BUTTON_DRIVES | DRAW_DISK_STATUS);
|
||||
}
|
||||
break;
|
||||
@@ -130,12 +157,13 @@ INT_PTR CPageDisk::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARA
|
||||
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
m_PropertySheetHelper.FillComboBox(hWnd, IDC_DISKTYPE, m_discchoices, GetCardMgr().GetDisk2CardMgr().GetEnhanceDisk() ? 1 : 0);
|
||||
CheckDlgButton(hWnd, IDC_ENHANCE_DISK_ENABLE, GetCardMgr().GetDisk2CardMgr().GetEnhanceDisk() ? BST_CHECKED : BST_UNCHECKED);
|
||||
|
||||
if (GetCardMgr().QuerySlot(SLOT6) == CT_Disk2)
|
||||
InitComboFloppyDrive(hWnd, SLOT6);
|
||||
const UINT slot = SLOT6;
|
||||
if (GetCardMgr().QuerySlot(slot) == CT_Disk2) // NB. SLOT6 not setup in m_PropertySheetHelper.GetConfigNew().m_Slot[]
|
||||
InitComboFloppyDrive(hWnd, slot);
|
||||
else
|
||||
EnableFloppyDrive(hWnd, FALSE);
|
||||
EnableFloppyDrive(hWnd, FALSE, slot); // disable if slot6 is empty (or has some other card in it)
|
||||
|
||||
InitComboHDD(hWnd, SLOT7);
|
||||
|
||||
@@ -147,7 +175,7 @@ INT_PTR CPageDisk::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARA
|
||||
|
||||
EnableHDD(hWnd, IsDlgButtonChecked(hWnd, IDC_HDD_ENABLE));
|
||||
|
||||
InitOptions(hWnd);
|
||||
InitOptions(hWnd); // init for slot-5
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -161,19 +189,22 @@ void CPageDisk::InitComboFloppyDrive(HWND hWnd, UINT slot)
|
||||
{
|
||||
Disk2InterfaceCard& disk2Card = dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(slot));
|
||||
|
||||
m_PropertySheetHelper.FillComboBox(hWnd, IDC_COMBO_DISK1, m_defaultDiskOptions, -1);
|
||||
m_PropertySheetHelper.FillComboBox(hWnd, IDC_COMBO_DISK2, m_defaultDiskOptions, -1);
|
||||
const UINT idcComboDisk1 = (slot == SLOT6) ? IDC_COMBO_DISK1 : IDC_COMBO_DISK1_SLOT5;
|
||||
const UINT idcComboDisk2 = (slot == SLOT6) ? IDC_COMBO_DISK2 : IDC_COMBO_DISK2_SLOT5;
|
||||
|
||||
m_PropertySheetHelper.FillComboBox(hWnd, idcComboDisk1, m_defaultDiskOptions, -1);
|
||||
m_PropertySheetHelper.FillComboBox(hWnd, idcComboDisk2, m_defaultDiskOptions, -1);
|
||||
|
||||
if (!disk2Card.GetFullName(DRIVE_1).empty())
|
||||
{
|
||||
SendDlgItemMessage(hWnd, IDC_COMBO_DISK1, CB_INSERTSTRING, 0, (LPARAM)disk2Card.GetFullName(DRIVE_1).c_str());
|
||||
SendDlgItemMessage(hWnd, IDC_COMBO_DISK1, CB_SETCURSEL, 0, 0);
|
||||
SendDlgItemMessage(hWnd, idcComboDisk1, CB_INSERTSTRING, 0, (LPARAM)disk2Card.GetFullName(DRIVE_1).c_str());
|
||||
SendDlgItemMessage(hWnd, idcComboDisk1, CB_SETCURSEL, 0, 0);
|
||||
}
|
||||
|
||||
if (!disk2Card.GetFullName(DRIVE_2).empty())
|
||||
{
|
||||
SendDlgItemMessage(hWnd, IDC_COMBO_DISK2, CB_INSERTSTRING, 0, (LPARAM)disk2Card.GetFullName(DRIVE_2).c_str());
|
||||
SendDlgItemMessage(hWnd, IDC_COMBO_DISK2, CB_SETCURSEL, 0, 0);
|
||||
SendDlgItemMessage(hWnd, idcComboDisk2, CB_INSERTSTRING, 0, (LPARAM)disk2Card.GetFullName(DRIVE_2).c_str());
|
||||
SendDlgItemMessage(hWnd, idcComboDisk2, CB_SETCURSEL, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,7 +244,7 @@ void CPageDisk::DlgOK(HWND hWnd)
|
||||
RegSaveString(TEXT(REG_CONFIG), REGVALUE_CIDERPRESSLOC, 1, szFilename);
|
||||
}
|
||||
|
||||
const bool bNewEnhanceDisk = SendDlgItemMessage(hWnd, IDC_DISKTYPE,CB_GETCURSEL, 0, 0) ? true : false;
|
||||
const bool bNewEnhanceDisk = IsDlgButtonChecked(hWnd, IDC_ENHANCE_DISK_ENABLE) ? true : false;
|
||||
if (bNewEnhanceDisk != GetCardMgr().GetDisk2CardMgr().GetEnhanceDisk())
|
||||
{
|
||||
GetCardMgr().GetDisk2CardMgr().SetEnhanceDisk(bNewEnhanceDisk);
|
||||
@@ -231,8 +262,22 @@ void CPageDisk::DlgOK(HWND hWnd)
|
||||
|
||||
void CPageDisk::InitOptions(HWND hWnd)
|
||||
{
|
||||
// Nothing to do:
|
||||
// - no changes made on any other pages affect this page
|
||||
// Changes made on other pages that affect this page:
|
||||
// . slot-5: MB add/removed
|
||||
// . slot-5: DiskII enabled/disabled
|
||||
|
||||
const UINT slot = SLOT5;
|
||||
const SS_CARDTYPE cardInSlot5 = m_PropertySheetHelper.GetConfigNew().m_Slot[slot];
|
||||
|
||||
CheckDlgButton(hWnd, IDC_DISKII_SLOT5_ENABLE, (cardInSlot5 == CT_Disk2) ? BST_CHECKED : BST_UNCHECKED);
|
||||
|
||||
const BOOL enable = (cardInSlot5 == CT_Disk2 || cardInSlot5 == CT_Empty) ? TRUE : FALSE;
|
||||
EnableWindow(GetDlgItem(hWnd, IDC_DISKII_SLOT5_ENABLE), enable);
|
||||
|
||||
if (cardInSlot5 == CT_Disk2)
|
||||
InitComboFloppyDrive(hWnd, slot);
|
||||
else
|
||||
EnableFloppyDrive(hWnd, FALSE, slot); // disable if slot5 is empty (or has some other card in it)
|
||||
}
|
||||
|
||||
void CPageDisk::EnableHDD(HWND hWnd, BOOL bEnable)
|
||||
@@ -242,10 +287,20 @@ void CPageDisk::EnableHDD(HWND hWnd, BOOL bEnable)
|
||||
EnableWindow(GetDlgItem(hWnd, IDC_HDD_SWAP), bEnable);
|
||||
}
|
||||
|
||||
void CPageDisk::EnableFloppyDrive(HWND hWnd, BOOL bEnable)
|
||||
void CPageDisk::EnableFloppyDrive(HWND hWnd, BOOL bEnable, UINT slot)
|
||||
{
|
||||
EnableWindow(GetDlgItem(hWnd, IDC_COMBO_DISK1), bEnable);
|
||||
EnableWindow(GetDlgItem(hWnd, IDC_COMBO_DISK2), bEnable);
|
||||
_ASSERT(slot == SLOT6 || slot == SLOT5);
|
||||
|
||||
if (slot == SLOT6)
|
||||
{
|
||||
EnableWindow(GetDlgItem(hWnd, IDC_COMBO_DISK1), bEnable);
|
||||
EnableWindow(GetDlgItem(hWnd, IDC_COMBO_DISK2), bEnable);
|
||||
}
|
||||
else if (slot == SLOT5)
|
||||
{
|
||||
EnableWindow(GetDlgItem(hWnd, IDC_COMBO_DISK1_SLOT5), bEnable);
|
||||
EnableWindow(GetDlgItem(hWnd, IDC_COMBO_DISK2_SLOT5), bEnable);
|
||||
}
|
||||
}
|
||||
|
||||
void CPageDisk::HandleHDDCombo(HWND hWnd, UINT driveSelected, UINT comboSelected)
|
||||
@@ -296,8 +351,7 @@ void CPageDisk::HandleHDDCombo(HWND hWnd, UINT driveSelected, UINT comboSelected
|
||||
{
|
||||
if (dwComboSelection > 1)
|
||||
{
|
||||
UINT uCommand = (driveSelected == 0) ? IDC_COMBO_HDD1 : IDC_COMBO_HDD2;
|
||||
if (RemovalConfirmation(uCommand))
|
||||
if (RemovalConfirmation(comboSelected))
|
||||
{
|
||||
// Unplug selected disk
|
||||
HD_Unplug(driveSelected);
|
||||
@@ -312,15 +366,17 @@ void CPageDisk::HandleHDDCombo(HWND hWnd, UINT driveSelected, UINT comboSelected
|
||||
}
|
||||
}
|
||||
|
||||
void CPageDisk::HandleFloppyDriveCombo(HWND hWnd, UINT driveSelected, UINT comboSelected)
|
||||
void CPageDisk::HandleFloppyDriveCombo(HWND hWnd, UINT driveSelected, UINT comboSelected, UINT comboOther, UINT slot)
|
||||
{
|
||||
if (GetCardMgr().QuerySlot(SLOT6) != CT_Disk2)
|
||||
_ASSERT(slot == SLOT6 || slot == SLOT5);
|
||||
|
||||
if (m_PropertySheetHelper.GetConfigNew().m_Slot[slot] != CT_Disk2)
|
||||
{
|
||||
_ASSERT(0); // Shouldn't come here, as the combo is disabled
|
||||
return;
|
||||
}
|
||||
|
||||
Disk2InterfaceCard& disk2Card = dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT6));
|
||||
Disk2InterfaceCard& disk2Card = dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(slot));
|
||||
|
||||
// Search from "select floppy drive"
|
||||
DWORD dwOpenDialogIndex = (DWORD)SendDlgItemMessage(hWnd, comboSelected, CB_FINDSTRINGEXACT, -1, (LPARAM)&m_defaultDiskOptions[0]);
|
||||
@@ -330,9 +386,9 @@ void CPageDisk::HandleFloppyDriveCombo(HWND hWnd, UINT driveSelected, UINT combo
|
||||
|
||||
if (dwComboSelection == dwOpenDialogIndex)
|
||||
{
|
||||
EnableFloppyDrive(hWnd, FALSE); // Prevent multiple Selection dialogs to be triggered
|
||||
EnableFloppyDrive(hWnd, FALSE, slot); // Prevent multiple Selection dialogs to be triggered
|
||||
bool bRes = disk2Card.UserSelectNewDiskImage(driveSelected);
|
||||
EnableFloppyDrive(hWnd, TRUE);
|
||||
EnableFloppyDrive(hWnd, TRUE, slot);
|
||||
|
||||
if (!bRes)
|
||||
{
|
||||
@@ -353,8 +409,6 @@ void CPageDisk::HandleFloppyDriveCombo(HWND hWnd, UINT driveSelected, UINT combo
|
||||
SendDlgItemMessage(hWnd, comboSelected, CB_SETCURSEL, 0, 0);
|
||||
|
||||
// If the FD was in the other combo, remove now
|
||||
DWORD comboOther = (comboSelected == IDC_COMBO_DISK1) ? IDC_COMBO_DISK2 : IDC_COMBO_DISK1;
|
||||
|
||||
DWORD duplicated = (DWORD)SendDlgItemMessage(hWnd, comboOther, CB_FINDSTRINGEXACT, -1, (LPARAM)fullname.c_str());
|
||||
if (duplicated != CB_ERR)
|
||||
{
|
||||
@@ -366,8 +420,7 @@ void CPageDisk::HandleFloppyDriveCombo(HWND hWnd, UINT driveSelected, UINT combo
|
||||
{
|
||||
if (dwComboSelection > 1)
|
||||
{
|
||||
UINT uCommand = (driveSelected == 0) ? IDC_COMBO_DISK1 : IDC_COMBO_DISK2;
|
||||
if (RemovalConfirmation(uCommand))
|
||||
if (RemovalConfirmation(comboSelected))
|
||||
{
|
||||
// Eject selected disk
|
||||
disk2Card.EjectDisk(driveSelected);
|
||||
@@ -398,8 +451,21 @@ UINT CPageDisk::RemovalConfirmation(UINT uCommand)
|
||||
TCHAR szText[100];
|
||||
bool bMsgBox = true;
|
||||
|
||||
bool isDisk = false;
|
||||
UINT drive = 0;
|
||||
if (uCommand == IDC_COMBO_DISK1 || uCommand == IDC_COMBO_DISK2)
|
||||
StringCbPrintf(szText, sizeof(szText), "Do you really want to eject the disk in drive-%c ?", '1' + uCommand - IDC_COMBO_DISK1);
|
||||
{
|
||||
isDisk = true;
|
||||
drive = uCommand - IDC_COMBO_DISK1;
|
||||
}
|
||||
else if (uCommand == IDC_COMBO_DISK1_SLOT5 || uCommand == IDC_COMBO_DISK2_SLOT5)
|
||||
{
|
||||
isDisk = true;
|
||||
drive = uCommand - IDC_COMBO_DISK1_SLOT5;
|
||||
}
|
||||
|
||||
if (isDisk)
|
||||
StringCbPrintf(szText, sizeof(szText), "Do you really want to eject the disk in drive-%c ?", '1' + drive);
|
||||
else if (uCommand == IDC_COMBO_HDD1 || uCommand == IDC_COMBO_HDD2)
|
||||
StringCbPrintf(szText, sizeof(szText), "Do you really want to unplug harddisk-%c ?", '1' + uCommand - IDC_COMBO_HDD1);
|
||||
else if (uCommand == IDC_HDD_SWAP)
|
||||
|
||||
Reference in New Issue
Block a user