mirror of
https://github.com/AppleWin/AppleWin.git
synced 2024-05-28 17:41:37 +00:00
PropertySheet:
. allow multiple HW changes, and for them to be cancelled + the old config reinstated. . still 1 "afterclose" msg, but this is OK.
This commit is contained in:
parent
5478c4c9ed
commit
a620b1b6b6
|
@ -841,6 +841,14 @@
|
|||
<Filter
|
||||
Name="Configuration"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\source\Configuration\Config.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\Configuration\IPropertySheet.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\Configuration\IPropertySheetPage.h"
|
||||
>
|
||||
|
|
|
@ -82,7 +82,7 @@ FILE* g_fh = NULL;
|
|||
bool g_bDisableDirectSound = false;
|
||||
bool g_bDisableDirectSoundMockingboard = false;
|
||||
|
||||
CPropertySheet sg_PropertySheet;
|
||||
IPropertySheet& sg_PropertySheet = * new CPropertySheet;
|
||||
CSuperSerialCard sg_SSC;
|
||||
CMouseInterface sg_Mouse;
|
||||
|
||||
|
|
|
@ -54,4 +54,6 @@ extern eCPU g_ActiveCPU;
|
|||
#ifdef USE_SPEECH_API
|
||||
class CSpeech;
|
||||
extern CSpeech g_Speech;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
extern __interface IPropertySheet& sg_PropertySheet;
|
||||
|
|
|
@ -174,6 +174,16 @@ enum eApple2Type {
|
|||
A2TYPE_MAX
|
||||
};
|
||||
|
||||
inline bool IsApple2(eApple2Type type)
|
||||
{
|
||||
return (type & (APPLE2E_MASK|APPLE2C_MASK)) == 0;
|
||||
}
|
||||
|
||||
inline bool IsClone(eApple2Type type)
|
||||
{
|
||||
return (type & APPLECLONE_MASK) != 0;
|
||||
}
|
||||
|
||||
enum eBUTTON {BUTTON0=0, BUTTON1};
|
||||
|
||||
enum eBUTTONSTATE {BUTTON_UP=0, BUTTON_DOWN};
|
||||
|
|
56
AppleWin/source/Configuration/Config.h
Normal file
56
AppleWin/source/Configuration/Config.h
Normal file
|
@ -0,0 +1,56 @@
|
|||
#pragma once
|
||||
|
||||
#include "..\HardDisk.h"
|
||||
|
||||
class CConfigNeedingRestart
|
||||
{
|
||||
public:
|
||||
CConfigNeedingRestart(UINT bEnableTheFreezesF8Rom = false) :
|
||||
m_Apple2Type(g_Apple2Type),
|
||||
m_bEnhanceDisk(enhancedisk),
|
||||
m_bDoBenchmark(false),
|
||||
m_uSaveLoadStateMsg(0)
|
||||
{
|
||||
m_bEnableHDD = HD_CardIsEnabled();
|
||||
m_bEnableTheFreezesF8Rom = bEnableTheFreezesF8Rom;
|
||||
memset(&m_Slot, 0, sizeof(m_Slot));
|
||||
m_Slot[4] = g_Slot4;
|
||||
m_Slot[5] = g_Slot5;
|
||||
}
|
||||
|
||||
const CConfigNeedingRestart& operator= (const CConfigNeedingRestart& other)
|
||||
{
|
||||
m_Apple2Type = other.m_Apple2Type;
|
||||
memcpy(m_Slot, other.m_Slot, sizeof(m_Slot));
|
||||
m_bEnhanceDisk = other.m_bEnhanceDisk;
|
||||
m_bEnableHDD = other.m_bEnableHDD;
|
||||
m_bEnableTheFreezesF8Rom = other.m_bEnableTheFreezesF8Rom;
|
||||
m_bDoBenchmark = other.m_bDoBenchmark;
|
||||
m_uSaveLoadStateMsg = other.m_uSaveLoadStateMsg;
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool operator== (const CConfigNeedingRestart& other) const
|
||||
{
|
||||
return m_Apple2Type == other.m_Apple2Type &&
|
||||
memcmp(m_Slot, other.m_Slot, sizeof(m_Slot)) == 0 &&
|
||||
m_bEnhanceDisk == other.m_bEnhanceDisk &&
|
||||
m_bEnableHDD == other.m_bEnableHDD &&
|
||||
m_bEnableTheFreezesF8Rom == other.m_bEnableTheFreezesF8Rom &&
|
||||
m_bDoBenchmark == other.m_bDoBenchmark &&
|
||||
m_uSaveLoadStateMsg == other.m_uSaveLoadStateMsg;
|
||||
}
|
||||
|
||||
bool operator!= (const CConfigNeedingRestart& other) const
|
||||
{
|
||||
return !operator==(other);
|
||||
}
|
||||
|
||||
eApple2Type m_Apple2Type;
|
||||
SS_CARDTYPE m_Slot[NUM_SLOTS]; // 0..7
|
||||
BOOL m_bEnhanceDisk;
|
||||
bool m_bEnableHDD;
|
||||
UINT m_bEnableTheFreezesF8Rom;
|
||||
bool m_bDoBenchmark;
|
||||
UINT m_uSaveLoadStateMsg;
|
||||
};
|
17
AppleWin/source/Configuration/IPropertySheet.h
Normal file
17
AppleWin/source/Configuration/IPropertySheet.h
Normal file
|
@ -0,0 +1,17 @@
|
|||
#pragma once
|
||||
|
||||
__interface IPropertySheet
|
||||
{
|
||||
void Init(void);
|
||||
DWORD GetVolumeMax(void); // TODO:TC: Move out of here
|
||||
bool SaveStateSelectImage(HWND hWindow, bool bSave); // TODO:TC: Move out of here
|
||||
|
||||
UINT GetScrollLockToggle(void);
|
||||
void SetScrollLockToggle(UINT uValue);
|
||||
UINT GetMouseShowCrosshair(void);
|
||||
void SetMouseShowCrosshair(UINT uValue);
|
||||
UINT GetMouseRestrictToWindow(void);
|
||||
void SetMouseRestrictToWindow(UINT uValue);
|
||||
UINT GetTheFreezesF8Rom(void);
|
||||
void SetTheFreezesF8Rom(UINT uValue);
|
||||
};
|
|
@ -2,10 +2,6 @@
|
|||
|
||||
class IPropertySheetPage
|
||||
{
|
||||
public:
|
||||
IPropertySheetPage(){}
|
||||
virtual ~IPropertySheetPage(){}
|
||||
|
||||
protected:
|
||||
virtual BOOL DlgProcInternal(HWND window, UINT message, WPARAM wparam, LPARAM lparam) = 0;
|
||||
virtual void DlgOK(HWND window) = 0;
|
||||
|
|
|
@ -12,13 +12,13 @@ const TCHAR CPageAdvanced::m_CloneChoices[] =
|
|||
TEXT("Pravets 8A\0"); // Bulgarian
|
||||
|
||||
|
||||
BOOL CALLBACK CPageAdvanced::DlgProc(HWND window, UINT message, WPARAM wparam, LPARAM lparam)
|
||||
BOOL CALLBACK CPageAdvanced::DlgProc(HWND hWnd, UINT message, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
// Switch from static func to our instance
|
||||
return CPageAdvanced::ms_this->DlgProcInternal(window, message, wparam, lparam);
|
||||
return CPageAdvanced::ms_this->DlgProcInternal(hWnd, message, wparam, lparam);
|
||||
}
|
||||
|
||||
BOOL CPageAdvanced::DlgProcInternal(HWND window, UINT message, WPARAM wparam, LPARAM lparam)
|
||||
BOOL CPageAdvanced::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
switch (message)
|
||||
{
|
||||
|
@ -31,21 +31,20 @@ BOOL CPageAdvanced::DlgProcInternal(HWND window, UINT message, WPARAM wparam, LP
|
|||
case PSN_SETACTIVE:
|
||||
// About to become the active page
|
||||
m_PropertySheetHelper.SetLastPage(m_Page);
|
||||
InitFreezeDlgButton(window);
|
||||
InitCloneDropdownMenu(window);
|
||||
InitOptions(hWnd);
|
||||
break;
|
||||
case PSN_KILLACTIVE:
|
||||
SetWindowLong(window, DWL_MSGRESULT, FALSE); // Changes are valid
|
||||
SetWindowLong(hWnd, DWL_MSGRESULT, FALSE); // Changes are valid
|
||||
break;
|
||||
case PSN_APPLY:
|
||||
DlgOK(window);
|
||||
SetWindowLong(window, DWL_MSGRESULT, PSNRET_NOERROR); // Changes are valid
|
||||
DlgOK(hWnd);
|
||||
SetWindowLong(hWnd, DWL_MSGRESULT, PSNRET_NOERROR); // Changes are valid
|
||||
break;
|
||||
case PSN_QUERYCANCEL:
|
||||
// Can use this to ask user to confirm cancel
|
||||
break;
|
||||
case PSN_RESET:
|
||||
DlgCANCEL(window);
|
||||
DlgCANCEL(hWnd);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -57,72 +56,64 @@ BOOL CPageAdvanced::DlgProcInternal(HWND window, UINT message, WPARAM wparam, LP
|
|||
case IDC_SAVESTATE_FILENAME:
|
||||
break;
|
||||
case IDC_SAVESTATE_BROWSE:
|
||||
if(m_PropertySheetHelper.SaveStateSelectImage(window, TEXT("Select Save State file"), true))
|
||||
SendDlgItemMessage(window, IDC_SAVESTATE_FILENAME, WM_SETTEXT, 0, (LPARAM)m_PropertySheetHelper.GetSSNewFilename());
|
||||
if(m_PropertySheetHelper.SaveStateSelectImage(hWnd, TEXT("Select Save State file"), true))
|
||||
SendDlgItemMessage(hWnd, IDC_SAVESTATE_FILENAME, WM_SETTEXT, 0, (LPARAM)m_PropertySheetHelper.GetSSNewFilename());
|
||||
break;
|
||||
case IDC_PRINTER_DUMP_FILENAME_BROWSE:
|
||||
{
|
||||
string strPrinterDumpLoc = m_PropertySheetHelper.BrowseToFile(window, TEXT("Select printer dump file"), REGVALUE_PRINTER_FILENAME, TEXT("Text files (*.txt)\0*.txt\0") TEXT("All Files\0*.*\0"));
|
||||
SendDlgItemMessage(window, IDC_PRINTER_DUMP_FILENAME, WM_SETTEXT, 0, (LPARAM)strPrinterDumpLoc.c_str());
|
||||
string strPrinterDumpLoc = m_PropertySheetHelper.BrowseToFile(hWnd, TEXT("Select printer dump file"), REGVALUE_PRINTER_FILENAME, TEXT("Text files (*.txt)\0*.txt\0") TEXT("All Files\0*.*\0"));
|
||||
SendDlgItemMessage(hWnd, IDC_PRINTER_DUMP_FILENAME, WM_SETTEXT, 0, (LPARAM)strPrinterDumpLoc.c_str());
|
||||
}
|
||||
break;
|
||||
case IDC_SAVESTATE_ON_EXIT:
|
||||
break;
|
||||
case IDC_SAVESTATE:
|
||||
m_uAfterClose = WM_USER_SAVESTATE;
|
||||
m_PropertySheetHelper.GetConfigNew().m_uSaveLoadStateMsg = WM_USER_SAVESTATE;
|
||||
break;
|
||||
case IDC_LOADSTATE:
|
||||
m_uAfterClose = WM_USER_LOADSTATE;
|
||||
m_PropertySheetHelper.GetConfigNew().m_uSaveLoadStateMsg = WM_USER_LOADSTATE;
|
||||
break;
|
||||
|
||||
//
|
||||
//
|
||||
|
||||
case IDC_THE_FREEZES_F8_ROM_FW:
|
||||
{
|
||||
UINT uNewState = IsDlgButtonChecked(window, IDC_THE_FREEZES_F8_ROM_FW) ? 1 : 0;
|
||||
LPCSTR pMsg = TEXT("The emulator needs to restart as the ROM configuration has changed.\n")
|
||||
TEXT("Would you like to restart the emulator now?");
|
||||
if ( (MessageBox(window,
|
||||
pMsg,
|
||||
TEXT("Configuration"),
|
||||
MB_ICONQUESTION | MB_OKCANCEL | MB_SETFOREGROUND) == IDOK)
|
||||
&& m_PropertySheetHelper.IsOkToRestart(window) )
|
||||
{
|
||||
m_uTheFreezesF8Rom = uNewState;
|
||||
m_uAfterClose = WM_USER_RESTART;
|
||||
PropSheet_PressButton(GetParent(window), PSBTN_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
CheckDlgButton(window, IDC_THE_FREEZES_F8_ROM_FW, m_uTheFreezesF8Rom ? BST_CHECKED : BST_UNCHECKED);
|
||||
}
|
||||
const UINT uNewState = IsDlgButtonChecked(hWnd, IDC_THE_FREEZES_F8_ROM_FW) ? 1 : 0;
|
||||
m_PropertySheetHelper.GetConfigNew().m_bEnableTheFreezesF8Rom = uNewState;
|
||||
}
|
||||
break;
|
||||
|
||||
case IDC_CLONETYPE:
|
||||
if(HIWORD(wparam) == CBN_SELCHANGE)
|
||||
{
|
||||
const DWORD NewCloneMenuItem = (DWORD) SendDlgItemMessage(hWnd, IDC_CLONETYPE, CB_GETCURSEL, 0, 0);
|
||||
const eApple2Type NewCloneType = GetCloneType(NewCloneMenuItem);
|
||||
m_PropertySheetHelper.GetConfigNew().m_Apple2Type = NewCloneType;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_INITDIALOG: //Init advanced settings dialog
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
SendDlgItemMessage(window,IDC_SAVESTATE_FILENAME,WM_SETTEXT,0,(LPARAM)Snapshot_GetFilename());
|
||||
SendDlgItemMessage(hWnd,IDC_SAVESTATE_FILENAME,WM_SETTEXT,0,(LPARAM)Snapshot_GetFilename());
|
||||
|
||||
CheckDlgButton(window, IDC_SAVESTATE_ON_EXIT, g_bSaveStateOnExit ? BST_CHECKED : BST_UNCHECKED);
|
||||
CheckDlgButton(window, IDC_DUMPTOPRINTER, g_bDumpToPrinter ? BST_CHECKED : BST_UNCHECKED);
|
||||
CheckDlgButton(window, IDC_PRINTER_CONVERT_ENCODING, g_bConvertEncoding ? BST_CHECKED : BST_UNCHECKED);
|
||||
CheckDlgButton(window, IDC_PRINTER_FILTER_UNPRINTABLE, g_bFilterUnprintable ? BST_CHECKED : BST_UNCHECKED);
|
||||
CheckDlgButton(window, IDC_PRINTER_APPEND, g_bPrinterAppend ? BST_CHECKED : BST_UNCHECKED);
|
||||
SendDlgItemMessage(window, IDC_SPIN_PRINTER_IDLE, UDM_SETRANGE, 0, MAKELONG(999,0));
|
||||
SendDlgItemMessage(window, IDC_SPIN_PRINTER_IDLE, UDM_SETPOS, 0, MAKELONG(Printer_GetIdleLimit (),0));
|
||||
SendDlgItemMessage(window, IDC_PRINTER_DUMP_FILENAME, WM_SETTEXT, 0, (LPARAM)Printer_GetFilename());
|
||||
CheckDlgButton(hWnd, IDC_SAVESTATE_ON_EXIT, g_bSaveStateOnExit ? BST_CHECKED : BST_UNCHECKED);
|
||||
CheckDlgButton(hWnd, IDC_DUMPTOPRINTER, g_bDumpToPrinter ? BST_CHECKED : BST_UNCHECKED);
|
||||
CheckDlgButton(hWnd, IDC_PRINTER_CONVERT_ENCODING, g_bConvertEncoding ? BST_CHECKED : BST_UNCHECKED);
|
||||
CheckDlgButton(hWnd, IDC_PRINTER_FILTER_UNPRINTABLE, g_bFilterUnprintable ? BST_CHECKED : BST_UNCHECKED);
|
||||
CheckDlgButton(hWnd, IDC_PRINTER_APPEND, g_bPrinterAppend ? BST_CHECKED : BST_UNCHECKED);
|
||||
SendDlgItemMessage(hWnd, IDC_SPIN_PRINTER_IDLE, UDM_SETRANGE, 0, MAKELONG(999,0));
|
||||
SendDlgItemMessage(hWnd, IDC_SPIN_PRINTER_IDLE, UDM_SETPOS, 0, MAKELONG(Printer_GetIdleLimit (),0));
|
||||
SendDlgItemMessage(hWnd, IDC_PRINTER_DUMP_FILENAME, WM_SETTEXT, 0, (LPARAM)Printer_GetFilename());
|
||||
|
||||
InitFreezeDlgButton(window);
|
||||
InitCloneDropdownMenu(window);
|
||||
InitOptions(hWnd);
|
||||
|
||||
m_PropertySheetHelper.ClearSSNewDirectory();
|
||||
|
||||
// Need to specific cmd-line switch: -printer-real to enable this control
|
||||
EnableWindow(GetDlgItem(window, IDC_DUMPTOPRINTER), g_bEnableDumpToRealPrinter ? TRUE : FALSE);
|
||||
// Need to specify cmd-line switch: -printer-real to enable this control
|
||||
EnableWindow(GetDlgItem(hWnd, IDC_DUMPTOPRINTER), g_bEnableDumpToRealPrinter ? TRUE : FALSE);
|
||||
|
||||
m_uAfterClose = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -130,7 +121,7 @@ BOOL CPageAdvanced::DlgProcInternal(HWND window, UINT message, WPARAM wparam, LP
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
void CPageAdvanced::DlgOK(HWND window)
|
||||
void CPageAdvanced::DlgOK(HWND hWnd)
|
||||
{
|
||||
// Update save-state filename
|
||||
{
|
||||
|
@ -138,9 +129,9 @@ void CPageAdvanced::DlgOK(HWND window)
|
|||
memset(szFilename, 0, sizeof(szFilename));
|
||||
* (USHORT*) szFilename = sizeof(szFilename);
|
||||
|
||||
UINT nLineLength = SendDlgItemMessage(window, IDC_SAVESTATE_FILENAME, EM_LINELENGTH, 0, 0);
|
||||
UINT nLineLength = SendDlgItemMessage(hWnd, IDC_SAVESTATE_FILENAME, EM_LINELENGTH, 0, 0);
|
||||
|
||||
SendDlgItemMessage(window, IDC_SAVESTATE_FILENAME, EM_GETLINE, 0, (LPARAM)szFilename);
|
||||
SendDlgItemMessage(hWnd, IDC_SAVESTATE_FILENAME, EM_GETLINE, 0, (LPARAM)szFilename);
|
||||
|
||||
nLineLength = nLineLength > sizeof(szFilename)-1 ? sizeof(szFilename)-1 : nLineLength;
|
||||
szFilename[nLineLength] = 0x00;
|
||||
|
@ -154,9 +145,9 @@ void CPageAdvanced::DlgOK(HWND window)
|
|||
memset(szFilename, 0, sizeof(szFilename));
|
||||
* (USHORT*) szFilename = sizeof(szFilename);
|
||||
|
||||
UINT nLineLength = SendDlgItemMessage(window, IDC_PRINTER_DUMP_FILENAME, EM_LINELENGTH, 0, 0);
|
||||
UINT nLineLength = SendDlgItemMessage(hWnd, IDC_PRINTER_DUMP_FILENAME, EM_LINELENGTH, 0, 0);
|
||||
|
||||
SendDlgItemMessage(window, IDC_PRINTER_DUMP_FILENAME, EM_GETLINE, 0, (LPARAM)szFilename);
|
||||
SendDlgItemMessage(hWnd, IDC_PRINTER_DUMP_FILENAME, EM_GETLINE, 0, (LPARAM)szFilename);
|
||||
|
||||
nLineLength = nLineLength > sizeof(szFilename)-1 ? sizeof(szFilename)-1 : nLineLength;
|
||||
szFilename[nLineLength] = 0x00;
|
||||
|
@ -165,62 +156,33 @@ void CPageAdvanced::DlgOK(HWND window)
|
|||
RegSaveString(TEXT(REG_CONFIG), REGVALUE_PRINTER_FILENAME, 1, Printer_GetFilename());
|
||||
}
|
||||
|
||||
g_bSaveStateOnExit = IsDlgButtonChecked(window, IDC_SAVESTATE_ON_EXIT) ? true : false;
|
||||
g_bSaveStateOnExit = IsDlgButtonChecked(hWnd, IDC_SAVESTATE_ON_EXIT) ? true : false;
|
||||
REGSAVE(TEXT(REGVALUE_SAVE_STATE_ON_EXIT), g_bSaveStateOnExit ? 1 : 0);
|
||||
|
||||
g_bDumpToPrinter = IsDlgButtonChecked(window, IDC_DUMPTOPRINTER ) ? true : false;
|
||||
g_bDumpToPrinter = IsDlgButtonChecked(hWnd, IDC_DUMPTOPRINTER ) ? true : false;
|
||||
REGSAVE(TEXT(REGVALUE_DUMP_TO_PRINTER), g_bDumpToPrinter ? 1 : 0);
|
||||
|
||||
g_bConvertEncoding = IsDlgButtonChecked(window, IDC_PRINTER_CONVERT_ENCODING ) ? true : false;
|
||||
g_bConvertEncoding = IsDlgButtonChecked(hWnd, IDC_PRINTER_CONVERT_ENCODING ) ? true : false;
|
||||
REGSAVE(TEXT(REGVALUE_CONVERT_ENCODING), g_bConvertEncoding ? 1 : 0);
|
||||
|
||||
g_bFilterUnprintable = IsDlgButtonChecked(window, IDC_PRINTER_FILTER_UNPRINTABLE ) ? true : false;
|
||||
g_bFilterUnprintable = IsDlgButtonChecked(hWnd, IDC_PRINTER_FILTER_UNPRINTABLE ) ? true : false;
|
||||
REGSAVE(TEXT(REGVALUE_FILTER_UNPRINTABLE), g_bFilterUnprintable ? 1 : 0);
|
||||
|
||||
g_bPrinterAppend = IsDlgButtonChecked(window, IDC_PRINTER_APPEND) ? true : false;
|
||||
g_bPrinterAppend = IsDlgButtonChecked(hWnd, IDC_PRINTER_APPEND) ? true : false;
|
||||
REGSAVE(TEXT(REGVALUE_PRINTER_APPEND), g_bPrinterAppend ? 1 : 0);
|
||||
|
||||
//
|
||||
|
||||
REGSAVE(TEXT(REGVALUE_THE_FREEZES_F8_ROM),m_uTheFreezesF8Rom); // NB. Can also be disabled on Config page (when Apple2Type changes)
|
||||
|
||||
Printer_SetIdleLimit((short)SendDlgItemMessage(window, IDC_SPIN_PRINTER_IDLE , UDM_GETPOS, 0, 0));
|
||||
Printer_SetIdleLimit((short)SendDlgItemMessage(hWnd, IDC_SPIN_PRINTER_IDLE , UDM_GETPOS, 0, 0));
|
||||
REGSAVE(TEXT(REGVALUE_PRINTER_IDLE_LIMIT),Printer_GetIdleLimit());
|
||||
|
||||
const DWORD NewCloneMenuItem = (DWORD) SendDlgItemMessage(window, IDC_CLONETYPE, CB_GETCURSEL, 0, 0);
|
||||
const eApple2Type NewCloneType = GetCloneType(NewCloneMenuItem);
|
||||
m_PropertySheetHelper.PostMsgAfterClose(hWnd, m_Page);
|
||||
}
|
||||
|
||||
// Get 2 identical msg-boxs:
|
||||
// . Config tab: Change to 'Clone'
|
||||
// . Advanced tab: Change clone type, then OK
|
||||
// . ConfigDlg_OK() msgbox asks "restart now?", click OK
|
||||
// . AdvancedDlg_OK() msgbox asks "restart now?
|
||||
if (IS_CLONE() || (m_PropertySheetHelper.GetUIControlCloneDropdownMenu() == UI_ENABLE))
|
||||
{
|
||||
if (NewCloneType != g_Apple2Type)
|
||||
{
|
||||
if ((m_uAfterClose == WM_USER_RESTART) || // Eg. Changing 'Freeze ROM' & user has already OK'd the restart for this
|
||||
((MessageBox(window,
|
||||
TEXT(
|
||||
"You have changed the emulated computer "
|
||||
"type. This change will not take effect "
|
||||
"until the next time you restart the "
|
||||
"emulator.\n\n"
|
||||
"Would you like to restart the emulator now?"),
|
||||
TEXT("Configuration"),
|
||||
MB_ICONQUESTION | MB_OKCANCEL | MB_SETFOREGROUND) == IDOK)
|
||||
&& m_PropertySheetHelper.IsOkToRestart(window)) )
|
||||
{
|
||||
m_uAfterClose = WM_USER_RESTART;
|
||||
m_PropertySheetHelper.SaveComputerType(NewCloneType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (g_Apple2Type > A2TYPE_APPLE2PLUS)
|
||||
m_uTheFreezesF8Rom = 0;
|
||||
|
||||
m_PropertySheetHelper.PostMsgAfterClose(m_Page, m_uAfterClose);
|
||||
void CPageAdvanced::InitOptions(HWND hWnd)
|
||||
{
|
||||
InitFreezeDlgButton(hWnd);
|
||||
InitCloneDropdownMenu(hWnd);
|
||||
}
|
||||
|
||||
// Advanced->Clone: Menu item to eApple2Type
|
||||
|
@ -237,34 +199,33 @@ eApple2Type CPageAdvanced::GetCloneType(DWORD NewMenuItem)
|
|||
|
||||
int CPageAdvanced::GetCloneMenuItem(void)
|
||||
{
|
||||
if (!IS_CLONE())
|
||||
const eApple2Type type = m_PropertySheetHelper.GetConfigNew().m_Apple2Type;
|
||||
const bool bIsClone = IsClone(type);
|
||||
if (!bIsClone)
|
||||
return MENUITEM_CLONEMIN;
|
||||
|
||||
int nMenuItem = g_Apple2Type - A2TYPE_PRAVETS;
|
||||
int nMenuItem = type - A2TYPE_PRAVETS;
|
||||
if (nMenuItem < 0 || nMenuItem >= MENUITEM_CLONEMAX)
|
||||
return MENUITEM_CLONEMIN;
|
||||
|
||||
return nMenuItem;
|
||||
}
|
||||
|
||||
void CPageAdvanced::InitFreezeDlgButton(HWND window)
|
||||
void CPageAdvanced::InitFreezeDlgButton(HWND hWnd)
|
||||
{
|
||||
if (m_PropertySheetHelper.GetUIControlFreezeDlgButton() == UI_UNDEFINED)
|
||||
EnableWindow(GetDlgItem(window, IDC_THE_FREEZES_F8_ROM_FW), IS_APPLE2 ? TRUE : FALSE);
|
||||
else
|
||||
EnableWindow(GetDlgItem(window, IDC_THE_FREEZES_F8_ROM_FW), (m_PropertySheetHelper.GetUIControlFreezeDlgButton() == UI_ENABLE) ? TRUE : FALSE);
|
||||
const bool bIsApple2 = IsApple2( m_PropertySheetHelper.GetConfigNew().m_Apple2Type );
|
||||
EnableWindow(GetDlgItem(hWnd, IDC_THE_FREEZES_F8_ROM_FW), bIsApple2 ? TRUE : FALSE);
|
||||
|
||||
CheckDlgButton(window, IDC_THE_FREEZES_F8_ROM_FW, m_uTheFreezesF8Rom ? BST_CHECKED : BST_UNCHECKED);
|
||||
const UINT CheckTheFreezesRom = m_PropertySheetHelper.GetConfigNew().m_bEnableTheFreezesF8Rom ? BST_CHECKED : BST_UNCHECKED;
|
||||
CheckDlgButton(hWnd, IDC_THE_FREEZES_F8_ROM_FW, CheckTheFreezesRom);
|
||||
}
|
||||
|
||||
void CPageAdvanced::InitCloneDropdownMenu(HWND window)
|
||||
void CPageAdvanced::InitCloneDropdownMenu(HWND hWnd)
|
||||
{
|
||||
// Set clone menu choice (ok even if it's not a clone)
|
||||
int nCurrentChoice = GetCloneMenuItem();
|
||||
m_PropertySheetHelper.FillComboBox(window, IDC_CLONETYPE, m_CloneChoices, nCurrentChoice);
|
||||
const int nCurrentChoice = GetCloneMenuItem();
|
||||
m_PropertySheetHelper.FillComboBox(hWnd, IDC_CLONETYPE, m_CloneChoices, nCurrentChoice);
|
||||
|
||||
if (m_PropertySheetHelper.GetUIControlCloneDropdownMenu() == UI_UNDEFINED)
|
||||
EnableWindow(GetDlgItem(window, IDC_CLONETYPE), IS_CLONE() ? TRUE : FALSE);
|
||||
else
|
||||
EnableWindow(GetDlgItem(window, IDC_CLONETYPE), (IS_CLONE() || (m_PropertySheetHelper.GetUIControlCloneDropdownMenu() == UI_ENABLE)) ? TRUE : FALSE);
|
||||
const bool bIsClone = IsClone( m_PropertySheetHelper.GetConfigNew().m_Apple2Type );
|
||||
EnableWindow(GetDlgItem(hWnd, IDC_CLONETYPE), bIsClone ? TRUE : FALSE);
|
||||
}
|
||||
|
|
|
@ -4,41 +4,40 @@
|
|||
#include "PropertySheetDefs.h"
|
||||
class CPropertySheetHelper;
|
||||
|
||||
class CPageAdvanced : public IPropertySheetPage
|
||||
class CPageAdvanced : private IPropertySheetPage
|
||||
{
|
||||
public:
|
||||
CPageAdvanced(CPropertySheetHelper& PropertySheetHelper) :
|
||||
m_Page(PG_ADVANCED),
|
||||
m_PropertySheetHelper(PropertySheetHelper),
|
||||
m_uAfterClose(0),
|
||||
m_uTheFreezesF8Rom(0)
|
||||
{
|
||||
CPageAdvanced::ms_this = this;
|
||||
}
|
||||
virtual ~CPageAdvanced(){}
|
||||
|
||||
static BOOL CALLBACK DlgProc(HWND window, UINT message, WPARAM wparam, LPARAM lparam);
|
||||
static BOOL CALLBACK DlgProc(HWND hWnd, UINT message, WPARAM wparam, LPARAM lparam);
|
||||
|
||||
UINT GetTheFreezesF8Rom(void){ return m_uTheFreezesF8Rom; }
|
||||
void SetTheFreezesF8Rom(UINT uValue){ m_uTheFreezesF8Rom = uValue; }
|
||||
|
||||
protected:
|
||||
// IPropertySheetPage
|
||||
virtual BOOL DlgProcInternal(HWND window, UINT message, WPARAM wparam, LPARAM lparam);
|
||||
virtual void DlgOK(HWND window);
|
||||
virtual void DlgCANCEL(HWND window){}
|
||||
virtual BOOL DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARAM lparam);
|
||||
virtual void DlgOK(HWND hWnd);
|
||||
virtual void DlgCANCEL(HWND hWnd){}
|
||||
|
||||
private:
|
||||
void InitOptions(HWND hWnd);
|
||||
eApple2Type GetCloneType(DWORD NewMenuItem);
|
||||
int GetCloneMenuItem(void);
|
||||
void InitFreezeDlgButton(HWND window);
|
||||
void InitCloneDropdownMenu(HWND window);
|
||||
void InitFreezeDlgButton(HWND hWnd);
|
||||
void InitCloneDropdownMenu(HWND hWnd);
|
||||
|
||||
static CPageAdvanced* ms_this;
|
||||
static const TCHAR m_CloneChoices[];
|
||||
|
||||
const PAGETYPE m_Page;
|
||||
CPropertySheetHelper& m_PropertySheetHelper;
|
||||
UINT m_uAfterClose;
|
||||
UINT m_uTheFreezesF8Rom;
|
||||
};
|
||||
|
|
|
@ -13,13 +13,13 @@ const TCHAR CPageConfig::m_ComputerChoices[] =
|
|||
TEXT("Enhanced Apple //e\0")
|
||||
TEXT("Clone\0");
|
||||
|
||||
BOOL CALLBACK CPageConfig::DlgProc(HWND window, UINT message, WPARAM wparam, LPARAM lparam)
|
||||
BOOL CALLBACK CPageConfig::DlgProc(HWND hWnd, UINT message, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
// Switch from static func to our instance
|
||||
return CPageConfig::ms_this->DlgProcInternal(window, message, wparam, lparam);
|
||||
return CPageConfig::ms_this->DlgProcInternal(hWnd, message, wparam, lparam);
|
||||
}
|
||||
|
||||
BOOL CPageConfig::DlgProcInternal(HWND window, UINT message, WPARAM wparam, LPARAM lparam)
|
||||
BOOL CPageConfig::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
switch (message)
|
||||
{
|
||||
|
@ -32,25 +32,24 @@ BOOL CPageConfig::DlgProcInternal(HWND window, UINT message, WPARAM wparam, LPAR
|
|||
case PSN_SETACTIVE:
|
||||
// About to become the active page
|
||||
m_PropertySheetHelper.SetLastPage(m_Page);
|
||||
InitOptions(hWnd);
|
||||
break;
|
||||
case PSN_KILLACTIVE:
|
||||
// About to stop being active page
|
||||
{
|
||||
DWORD NewComputerMenuItem = (DWORD) SendDlgItemMessage(window, IDC_COMPUTER, CB_GETCURSEL, 0, 0);
|
||||
m_PropertySheetHelper.SetUIControlFreezeDlgButton( GetApple2Type(NewComputerMenuItem) <= A2TYPE_APPLE2PLUS ? UI_ENABLE : UI_DISABLE );
|
||||
m_PropertySheetHelper.SetUIControlCloneDropdownMenu( GetApple2Type(NewComputerMenuItem) == A2TYPE_CLONE ? UI_ENABLE : UI_DISABLE );
|
||||
SetWindowLong(window, DWL_MSGRESULT, FALSE); // Changes are valid
|
||||
DWORD NewComputerMenuItem = (DWORD) SendDlgItemMessage(hWnd, IDC_COMPUTER, CB_GETCURSEL, 0, 0);
|
||||
SetWindowLong(hWnd, DWL_MSGRESULT, FALSE); // Changes are valid
|
||||
}
|
||||
break;
|
||||
case PSN_APPLY:
|
||||
DlgOK(window);
|
||||
SetWindowLong(window, DWL_MSGRESULT, PSNRET_NOERROR); // Changes are valid
|
||||
DlgOK(hWnd);
|
||||
SetWindowLong(hWnd, DWL_MSGRESULT, PSNRET_NOERROR); // Changes are valid
|
||||
break;
|
||||
case PSN_QUERYCANCEL:
|
||||
// Can use this to ask user to confirm cancel
|
||||
break;
|
||||
case PSN_RESET:
|
||||
DlgCANCEL(window);
|
||||
DlgCANCEL(hWnd);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -60,27 +59,27 @@ BOOL CPageConfig::DlgProcInternal(HWND window, UINT message, WPARAM wparam, LPAR
|
|||
switch (LOWORD(wparam))
|
||||
{
|
||||
case IDC_AUTHENTIC_SPEED: // Authentic Machine Speed
|
||||
SendDlgItemMessage(window,IDC_SLIDER_CPU_SPEED,TBM_SETPOS,1,SPEED_NORMAL);
|
||||
EnableTrackbar(window,0);
|
||||
SendDlgItemMessage(hWnd,IDC_SLIDER_CPU_SPEED,TBM_SETPOS,1,SPEED_NORMAL);
|
||||
EnableTrackbar(hWnd,0);
|
||||
break;
|
||||
|
||||
case IDC_CUSTOM_SPEED: // Select Custom Speed
|
||||
SetFocus(GetDlgItem(window,IDC_SLIDER_CPU_SPEED));
|
||||
EnableTrackbar(window,1);
|
||||
SetFocus(GetDlgItem(hWnd,IDC_SLIDER_CPU_SPEED));
|
||||
EnableTrackbar(hWnd,1);
|
||||
break;
|
||||
|
||||
case IDC_SLIDER_CPU_SPEED: // CPU speed slider
|
||||
CheckRadioButton(window,IDC_AUTHENTIC_SPEED,IDC_CUSTOM_SPEED,IDC_CUSTOM_SPEED);
|
||||
EnableTrackbar(window,1);
|
||||
CheckRadioButton(hWnd,IDC_AUTHENTIC_SPEED,IDC_CUSTOM_SPEED,IDC_CUSTOM_SPEED);
|
||||
EnableTrackbar(hWnd,1);
|
||||
break;
|
||||
|
||||
case IDC_BENCHMARK:
|
||||
m_uAfterClose = WM_USER_BENCHMARK;
|
||||
PropSheet_PressButton(GetParent(window), PSBTN_OK);
|
||||
m_PropertySheetHelper.GetConfigNew().m_bDoBenchmark = true;
|
||||
PropSheet_PressButton(GetParent(hWnd), PSBTN_OK);
|
||||
break;
|
||||
|
||||
case IDC_ETHERNET:
|
||||
ui_tfe_settings_dialog(window);
|
||||
ui_tfe_settings_dialog(hWnd);
|
||||
break;
|
||||
|
||||
case IDC_MONOCOLOR:
|
||||
|
@ -88,20 +87,28 @@ BOOL CPageConfig::DlgProcInternal(HWND window, UINT message, WPARAM wparam, LPAR
|
|||
break;
|
||||
|
||||
case IDC_CHECK_HALF_SCAN_LINES:
|
||||
g_uHalfScanLines = IsDlgButtonChecked(window, IDC_CHECK_HALF_SCAN_LINES) ? 1 : 0;
|
||||
g_uHalfScanLines = IsDlgButtonChecked(hWnd, IDC_CHECK_HALF_SCAN_LINES) ? 1 : 0;
|
||||
|
||||
case IDC_COMPUTER:
|
||||
if(HIWORD(wparam) == CBN_SELCHANGE)
|
||||
{
|
||||
const DWORD NewComputerMenuItem = (DWORD) SendDlgItemMessage(hWnd, IDC_COMPUTER, CB_GETCURSEL, 0, 0);
|
||||
const eApple2Type NewApple2Type = GetApple2Type(NewComputerMenuItem);
|
||||
m_PropertySheetHelper.GetConfigNew().m_Apple2Type = NewApple2Type;
|
||||
}
|
||||
break;
|
||||
|
||||
#if 0
|
||||
case IDC_RECALIBRATE:
|
||||
RegSaveValue(TEXT(""),TEXT("RunningOnOS"),0,0);
|
||||
if (MessageBox(window,
|
||||
if (MessageBox(hWnd,
|
||||
TEXT("The emulator has been set to recalibrate ")
|
||||
TEXT("itself the next time it is started.\n\n")
|
||||
TEXT("Would you like to restart the emulator now?"),
|
||||
TEXT("Configuration"),
|
||||
TEXT(REG_CONFIG),
|
||||
MB_ICONQUESTION | MB_OKCANCEL | MB_SETFOREGROUND) == IDOK)
|
||||
{
|
||||
m_uAfterClose = WM_USER_RESTART;
|
||||
PropSheet_PressButton(GetParent(window), PSBTN_OK);
|
||||
PropSheet_PressButton(GetParent(hWnd), PSBTN_OK);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
@ -109,15 +116,15 @@ BOOL CPageConfig::DlgProcInternal(HWND window, UINT message, WPARAM wparam, LPAR
|
|||
break; // WM_COMMAND
|
||||
|
||||
case WM_HSCROLL:
|
||||
CheckRadioButton(window, IDC_AUTHENTIC_SPEED, IDC_CUSTOM_SPEED, IDC_CUSTOM_SPEED); // FirstButton, LastButton, CheckButton
|
||||
CheckRadioButton(hWnd, IDC_AUTHENTIC_SPEED, IDC_CUSTOM_SPEED, IDC_CUSTOM_SPEED); // FirstButton, LastButton, CheckButton
|
||||
break;
|
||||
|
||||
case WM_INITDIALOG: //Init general settings dialog
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
// Convert Apple2 type to menu item
|
||||
{
|
||||
int nCurrentChoice = 0;
|
||||
switch (g_Apple2Type)
|
||||
switch (m_PropertySheetHelper.GetConfigNew().m_Apple2Type)
|
||||
{
|
||||
case A2TYPE_APPLE2: nCurrentChoice = MENUITEM_IIORIGINAL; break;
|
||||
case A2TYPE_APPLE2PLUS: nCurrentChoice = MENUITEM_IIPLUS; break;
|
||||
|
@ -128,19 +135,19 @@ BOOL CPageConfig::DlgProcInternal(HWND window, UINT message, WPARAM wparam, LPAR
|
|||
case A2TYPE_PRAVETS8A: nCurrentChoice = MENUITEM_CLONE; break;
|
||||
}
|
||||
|
||||
m_PropertySheetHelper.FillComboBox(window, IDC_COMPUTER, m_ComputerChoices, nCurrentChoice);
|
||||
m_PropertySheetHelper.FillComboBox(hWnd, IDC_COMPUTER, m_ComputerChoices, nCurrentChoice);
|
||||
}
|
||||
|
||||
m_PropertySheetHelper.FillComboBox(window,IDC_VIDEOTYPE,g_aVideoChoices,g_eVideoType);
|
||||
CheckDlgButton(window, IDC_CHECK_HALF_SCAN_LINES, g_uHalfScanLines ? BST_CHECKED : BST_UNCHECKED);
|
||||
m_PropertySheetHelper.FillComboBox(hWnd,IDC_VIDEOTYPE,g_aVideoChoices,g_eVideoType);
|
||||
CheckDlgButton(hWnd, IDC_CHECK_HALF_SCAN_LINES, g_uHalfScanLines ? BST_CHECKED : BST_UNCHECKED);
|
||||
|
||||
m_PropertySheetHelper.FillComboBox(window,IDC_SERIALPORT, sg_SSC.GetSerialPortChoices(), sg_SSC.GetSerialPort());
|
||||
EnableWindow(GetDlgItem(window, IDC_SERIALPORT), !sg_SSC.IsActive() ? TRUE : FALSE);
|
||||
m_PropertySheetHelper.FillComboBox(hWnd,IDC_SERIALPORT, sg_SSC.GetSerialPortChoices(), sg_SSC.GetSerialPort());
|
||||
EnableWindow(GetDlgItem(hWnd, IDC_SERIALPORT), !sg_SSC.IsActive() ? TRUE : FALSE);
|
||||
|
||||
SendDlgItemMessage(window,IDC_SLIDER_CPU_SPEED,TBM_SETRANGE,1,MAKELONG(0,40));
|
||||
SendDlgItemMessage(window,IDC_SLIDER_CPU_SPEED,TBM_SETPAGESIZE,0,5);
|
||||
SendDlgItemMessage(window,IDC_SLIDER_CPU_SPEED,TBM_SETTICFREQ,10,0);
|
||||
SendDlgItemMessage(window,IDC_SLIDER_CPU_SPEED,TBM_SETPOS,1,g_dwSpeed);
|
||||
SendDlgItemMessage(hWnd,IDC_SLIDER_CPU_SPEED,TBM_SETRANGE,1,MAKELONG(0,40));
|
||||
SendDlgItemMessage(hWnd,IDC_SLIDER_CPU_SPEED,TBM_SETPAGESIZE,0,5);
|
||||
SendDlgItemMessage(hWnd,IDC_SLIDER_CPU_SPEED,TBM_SETTICFREQ,10,0);
|
||||
SendDlgItemMessage(hWnd,IDC_SLIDER_CPU_SPEED,TBM_SETPOS,1,g_dwSpeed);
|
||||
|
||||
{
|
||||
BOOL bCustom = TRUE;
|
||||
|
@ -149,68 +156,45 @@ BOOL CPageConfig::DlgProcInternal(HWND window, UINT message, WPARAM wparam, LPAR
|
|||
bCustom = FALSE;
|
||||
REGLOAD(TEXT(REGVALUE_CUSTOM_SPEED),(DWORD *)&bCustom);
|
||||
}
|
||||
CheckRadioButton(window, IDC_AUTHENTIC_SPEED, IDC_CUSTOM_SPEED, bCustom ? IDC_CUSTOM_SPEED : IDC_AUTHENTIC_SPEED);
|
||||
SetFocus(GetDlgItem(window, bCustom ? IDC_SLIDER_CPU_SPEED : IDC_AUTHENTIC_SPEED));
|
||||
EnableTrackbar(window, bCustom);
|
||||
CheckRadioButton(hWnd, IDC_AUTHENTIC_SPEED, IDC_CUSTOM_SPEED, bCustom ? IDC_CUSTOM_SPEED : IDC_AUTHENTIC_SPEED);
|
||||
SetFocus(GetDlgItem(hWnd, bCustom ? IDC_SLIDER_CPU_SPEED : IDC_AUTHENTIC_SPEED));
|
||||
EnableTrackbar(hWnd, bCustom);
|
||||
}
|
||||
|
||||
m_uAfterClose = 0;
|
||||
InitOptions(hWnd);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_LBUTTONDOWN:
|
||||
{
|
||||
POINT pt = { LOWORD(lparam), HIWORD(lparam) };
|
||||
ClientToScreen(window,&pt);
|
||||
ClientToScreen(hWnd,&pt);
|
||||
RECT rect;
|
||||
GetWindowRect(GetDlgItem(window,IDC_SLIDER_CPU_SPEED),&rect);
|
||||
GetWindowRect(GetDlgItem(hWnd,IDC_SLIDER_CPU_SPEED),&rect);
|
||||
if ((pt.x >= rect.left) && (pt.x <= rect.right) &&
|
||||
(pt.y >= rect.top) && (pt.y <= rect.bottom))
|
||||
{
|
||||
CheckRadioButton(window, IDC_AUTHENTIC_SPEED, IDC_CUSTOM_SPEED, IDC_CUSTOM_SPEED);
|
||||
EnableTrackbar(window,1);
|
||||
SetFocus(GetDlgItem(window,IDC_SLIDER_CPU_SPEED));
|
||||
ScreenToClient(GetDlgItem(window,IDC_SLIDER_CPU_SPEED),&pt);
|
||||
PostMessage(GetDlgItem(window,IDC_SLIDER_CPU_SPEED),WM_LBUTTONDOWN,wparam,MAKELONG(pt.x,pt.y));
|
||||
CheckRadioButton(hWnd, IDC_AUTHENTIC_SPEED, IDC_CUSTOM_SPEED, IDC_CUSTOM_SPEED);
|
||||
EnableTrackbar(hWnd,1);
|
||||
SetFocus(GetDlgItem(hWnd,IDC_SLIDER_CPU_SPEED));
|
||||
ScreenToClient(GetDlgItem(hWnd,IDC_SLIDER_CPU_SPEED),&pt);
|
||||
PostMessage(GetDlgItem(hWnd,IDC_SLIDER_CPU_SPEED),WM_LBUTTONDOWN,wparam,MAKELONG(pt.x,pt.y));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_SYSCOLORCHANGE:
|
||||
SendDlgItemMessage(window,IDC_SLIDER_CPU_SPEED,WM_SYSCOLORCHANGE,0,0);
|
||||
SendDlgItemMessage(hWnd,IDC_SLIDER_CPU_SPEED,WM_SYSCOLORCHANGE,0,0);
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void CPageConfig::DlgOK(HWND window)
|
||||
void CPageConfig::DlgOK(HWND hWnd)
|
||||
{
|
||||
const DWORD NewComputerMenuItem = (DWORD) SendDlgItemMessage(window,IDC_COMPUTER,CB_GETCURSEL,0,0);
|
||||
const DWORD newvidtype = (DWORD)SendDlgItemMessage(window,IDC_VIDEOTYPE,CB_GETCURSEL,0,0);
|
||||
const DWORD newserialport = (DWORD)SendDlgItemMessage(window,IDC_SERIALPORT,CB_GETCURSEL,0,0);
|
||||
|
||||
const eApple2Type NewApple2Type = GetApple2Type(NewComputerMenuItem);
|
||||
const eApple2Type OldApple2Type = IS_CLONE() ? (eApple2Type)A2TYPE_CLONE : g_Apple2Type; // For clones, normalise to generic clone type
|
||||
|
||||
if (NewApple2Type != OldApple2Type)
|
||||
{
|
||||
if ((MessageBox(window,
|
||||
TEXT(
|
||||
"You have changed the emulated computer "
|
||||
"type. This change will not take effect "
|
||||
"until the next time you restart the "
|
||||
"emulator.\n\n"
|
||||
"Would you like to restart the emulator now?"),
|
||||
TEXT("Configuration"),
|
||||
MB_ICONQUESTION | MB_OKCANCEL | MB_SETFOREGROUND) == IDOK)
|
||||
&& m_PropertySheetHelper.IsOkToRestart(window))
|
||||
{
|
||||
m_uAfterClose = WM_USER_RESTART;
|
||||
m_PropertySheetHelper.SaveComputerType(NewApple2Type);
|
||||
}
|
||||
}
|
||||
|
||||
const DWORD newvidtype = (DWORD) SendDlgItemMessage(hWnd, IDC_VIDEOTYPE, CB_GETCURSEL, 0, 0);
|
||||
if (g_eVideoType != newvidtype)
|
||||
{
|
||||
g_eVideoType = newvidtype;
|
||||
|
@ -221,26 +205,32 @@ void CPageConfig::DlgOK(HWND window)
|
|||
}
|
||||
}
|
||||
|
||||
sg_SSC.CommSetSerialPort(window,newserialport);
|
||||
|
||||
if (IsDlgButtonChecked(window,IDC_AUTHENTIC_SPEED))
|
||||
g_dwSpeed = SPEED_NORMAL;
|
||||
else
|
||||
g_dwSpeed = SendDlgItemMessage(window,IDC_SLIDER_CPU_SPEED,TBM_GETPOS,0,0);
|
||||
|
||||
SetCurrentCLK6502();
|
||||
|
||||
RegSaveString( TEXT("Configuration"),
|
||||
const DWORD newserialport = (DWORD) SendDlgItemMessage(hWnd, IDC_SERIALPORT, CB_GETCURSEL, 0, 0);
|
||||
sg_SSC.CommSetSerialPort(hWnd, newserialport);
|
||||
RegSaveString( TEXT(REG_CONFIG),
|
||||
TEXT(REGVALUE_SERIAL_PORT_NAME),
|
||||
TRUE,
|
||||
sg_SSC.GetSerialPortName() );
|
||||
|
||||
if (IsDlgButtonChecked(hWnd, IDC_AUTHENTIC_SPEED))
|
||||
g_dwSpeed = SPEED_NORMAL;
|
||||
else
|
||||
g_dwSpeed = SendDlgItemMessage(hWnd, IDC_SLIDER_CPU_SPEED,TBM_GETPOS, 0, 0);
|
||||
|
||||
REGSAVE(TEXT(REGVALUE_CUSTOM_SPEED) ,IsDlgButtonChecked(window,IDC_CUSTOM_SPEED));
|
||||
REGSAVE(TEXT(REGVALUE_EMULATION_SPEED) ,g_dwSpeed);
|
||||
SetCurrentCLK6502();
|
||||
|
||||
REGSAVE(TEXT(REGVALUE_CUSTOM_SPEED), IsDlgButtonChecked(hWnd, IDC_CUSTOM_SPEED));
|
||||
REGSAVE(TEXT(REGVALUE_EMULATION_SPEED), g_dwSpeed);
|
||||
|
||||
Config_Save_Video();
|
||||
|
||||
m_PropertySheetHelper.PostMsgAfterClose(m_Page, m_uAfterClose);
|
||||
m_PropertySheetHelper.PostMsgAfterClose(hWnd, m_Page);
|
||||
}
|
||||
|
||||
void CPageConfig::InitOptions(HWND hWnd)
|
||||
{
|
||||
// Nothing to do:
|
||||
// - no changes made on any other pages affect this page
|
||||
}
|
||||
|
||||
// Config->Computer: Menu item to eApple2Type
|
||||
|
@ -257,13 +247,13 @@ eApple2Type CPageConfig::GetApple2Type(DWORD NewMenuItem)
|
|||
}
|
||||
}
|
||||
|
||||
void CPageConfig::EnableTrackbar(HWND window, BOOL enable)
|
||||
void CPageConfig::EnableTrackbar(HWND hWnd, BOOL enable)
|
||||
{
|
||||
EnableWindow(GetDlgItem(window,IDC_SLIDER_CPU_SPEED),enable);
|
||||
EnableWindow(GetDlgItem(window,IDC_0_5_MHz),enable);
|
||||
EnableWindow(GetDlgItem(window,IDC_1_0_MHz),enable);
|
||||
EnableWindow(GetDlgItem(window,IDC_2_0_MHz),enable);
|
||||
EnableWindow(GetDlgItem(window,IDC_MAX_MHz),enable);
|
||||
EnableWindow(GetDlgItem(hWnd,IDC_SLIDER_CPU_SPEED),enable);
|
||||
EnableWindow(GetDlgItem(hWnd,IDC_0_5_MHz),enable);
|
||||
EnableWindow(GetDlgItem(hWnd,IDC_1_0_MHz),enable);
|
||||
EnableWindow(GetDlgItem(hWnd,IDC_2_0_MHz),enable);
|
||||
EnableWindow(GetDlgItem(hWnd,IDC_MAX_MHz),enable);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -5,29 +5,29 @@
|
|||
#include "PageConfigTfe.h"
|
||||
class CPropertySheetHelper;
|
||||
|
||||
class CPageConfig : public IPropertySheetPage
|
||||
class CPageConfig : private IPropertySheetPage
|
||||
{
|
||||
public:
|
||||
CPageConfig(CPropertySheetHelper& PropertySheetHelper) :
|
||||
m_Page(PG_CONFIG),
|
||||
m_PropertySheetHelper(PropertySheetHelper),
|
||||
m_uAfterClose(0)
|
||||
m_PropertySheetHelper(PropertySheetHelper)
|
||||
{
|
||||
CPageConfig::ms_this = this;
|
||||
}
|
||||
virtual ~CPageConfig(){}
|
||||
|
||||
static BOOL CALLBACK DlgProc(HWND window, UINT message, WPARAM wparam, LPARAM lparam);
|
||||
static BOOL CALLBACK DlgProc(HWND hWnd, UINT message, WPARAM wparam, LPARAM lparam);
|
||||
|
||||
protected:
|
||||
// IPropertySheetPage
|
||||
virtual BOOL DlgProcInternal(HWND window, UINT message, WPARAM wparam, LPARAM lparam);
|
||||
virtual void DlgOK(HWND window);
|
||||
virtual void DlgCANCEL(HWND window){}
|
||||
virtual BOOL DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARAM lparam);
|
||||
virtual void DlgOK(HWND hWnd);
|
||||
virtual void DlgCANCEL(HWND hWnd){}
|
||||
|
||||
private:
|
||||
void InitOptions(HWND hWnd);
|
||||
eApple2Type GetApple2Type(DWORD NewMenuItem);
|
||||
void EnableTrackbar(HWND window, BOOL enable);
|
||||
void EnableTrackbar(HWND hWnd, BOOL enable);
|
||||
void ui_tfe_settings_dialog(HWND hwnd);
|
||||
|
||||
static CPageConfig* ms_this;
|
||||
|
@ -35,6 +35,5 @@ private:
|
|||
|
||||
const PAGETYPE m_Page;
|
||||
CPropertySheetHelper& m_PropertySheetHelper;
|
||||
UINT m_uAfterClose;
|
||||
CPageConfigTfe m_PageConfigTfe;
|
||||
};
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include "IPropertySheetPage.h"
|
||||
#include "..\Tfe\Uilib.h"
|
||||
|
||||
class CPageConfigTfe : public IPropertySheetPage
|
||||
class CPageConfigTfe : private IPropertySheetPage
|
||||
{
|
||||
public:
|
||||
CPageConfigTfe()
|
||||
|
|
|
@ -11,13 +11,13 @@ const TCHAR CPageDisk::m_discchoices[] =
|
|||
TEXT("Enhanced Speed\0");
|
||||
|
||||
|
||||
BOOL CALLBACK CPageDisk::DlgProc(HWND window, UINT message, WPARAM wparam, LPARAM lparam)
|
||||
BOOL CALLBACK CPageDisk::DlgProc(HWND hWnd, UINT message, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
// Switch from static func to our instance
|
||||
return CPageDisk::ms_this->DlgProcInternal(window, message, wparam, lparam);
|
||||
return CPageDisk::ms_this->DlgProcInternal(hWnd, message, wparam, lparam);
|
||||
}
|
||||
|
||||
BOOL CPageDisk::DlgProcInternal(HWND window, UINT message, WPARAM wparam, LPARAM lparam)
|
||||
BOOL CPageDisk::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
switch (message)
|
||||
{
|
||||
|
@ -30,19 +30,20 @@ BOOL CPageDisk::DlgProcInternal(HWND window, UINT message, WPARAM wparam, LPARAM
|
|||
case PSN_SETACTIVE:
|
||||
// About to become the active page
|
||||
m_PropertySheetHelper.SetLastPage(m_Page);
|
||||
InitOptions(hWnd);
|
||||
break;
|
||||
case PSN_KILLACTIVE:
|
||||
SetWindowLong(window, DWL_MSGRESULT, FALSE); // Changes are valid
|
||||
SetWindowLong(hWnd, DWL_MSGRESULT, FALSE); // Changes are valid
|
||||
break;
|
||||
case PSN_APPLY:
|
||||
DlgOK(window);
|
||||
SetWindowLong(window, DWL_MSGRESULT, PSNRET_NOERROR); // Changes are valid
|
||||
DlgOK(hWnd);
|
||||
SetWindowLong(hWnd, DWL_MSGRESULT, PSNRET_NOERROR); // Changes are valid
|
||||
break;
|
||||
case PSN_QUERYCANCEL:
|
||||
// Can use this to ask user to confirm cancel
|
||||
break;
|
||||
case PSN_RESET:
|
||||
DlgCANCEL(window);
|
||||
DlgCANCEL(hWnd);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -53,69 +54,70 @@ BOOL CPageDisk::DlgProcInternal(HWND window, UINT message, WPARAM wparam, LPARAM
|
|||
{
|
||||
case IDC_DISK1:
|
||||
DiskSelect(DRIVE_1);
|
||||
SendDlgItemMessage(window, IDC_EDIT_DISK1, WM_SETTEXT, 0, (LPARAM)DiskGetFullName(DRIVE_1));
|
||||
SendDlgItemMessage(hWnd, IDC_EDIT_DISK1, WM_SETTEXT, 0, (LPARAM)DiskGetFullName(DRIVE_1));
|
||||
FrameRefreshStatus(DRAW_BUTTON_DRIVES);
|
||||
break;
|
||||
|
||||
case IDC_DISK2:
|
||||
DiskSelect(DRIVE_2);
|
||||
SendDlgItemMessage(window, IDC_EDIT_DISK2, WM_SETTEXT, 0, (LPARAM)DiskGetFullName(DRIVE_2));
|
||||
SendDlgItemMessage(hWnd, IDC_EDIT_DISK2, WM_SETTEXT, 0, (LPARAM)DiskGetFullName(DRIVE_2));
|
||||
FrameRefreshStatus(DRAW_BUTTON_DRIVES);
|
||||
break;
|
||||
|
||||
case IDC_HDD1:
|
||||
if(IsDlgButtonChecked(window, IDC_HDD_ENABLE))
|
||||
if(IsDlgButtonChecked(hWnd, IDC_HDD_ENABLE))
|
||||
{
|
||||
HD_Select(HARDDISK_1);
|
||||
SendDlgItemMessage(window, IDC_EDIT_HDD1, WM_SETTEXT, 0, (LPARAM)HD_GetFullName(HARDDISK_1));
|
||||
SendDlgItemMessage(hWnd, IDC_EDIT_HDD1, WM_SETTEXT, 0, (LPARAM)HD_GetFullName(HARDDISK_1));
|
||||
}
|
||||
break;
|
||||
|
||||
case IDC_HDD2:
|
||||
if(IsDlgButtonChecked(window, IDC_HDD_ENABLE))
|
||||
if(IsDlgButtonChecked(hWnd, IDC_HDD_ENABLE))
|
||||
{
|
||||
HD_Select(HARDDISK_2);
|
||||
SendDlgItemMessage(window, IDC_EDIT_HDD2, WM_SETTEXT, 0, (LPARAM)HD_GetFullName(HARDDISK_2));
|
||||
SendDlgItemMessage(hWnd, IDC_EDIT_HDD2, WM_SETTEXT, 0, (LPARAM)HD_GetFullName(HARDDISK_2));
|
||||
}
|
||||
break;
|
||||
|
||||
case IDC_HDD_ENABLE:
|
||||
EnableHDD(window, IsDlgButtonChecked(window, IDC_HDD_ENABLE));
|
||||
EnableHDD(hWnd, IsDlgButtonChecked(hWnd, IDC_HDD_ENABLE));
|
||||
break;
|
||||
|
||||
case IDC_CIDERPRESS_BROWSE:
|
||||
{
|
||||
string CiderPressLoc = m_PropertySheetHelper.BrowseToFile(window, TEXT("Select path to CiderPress"), REGVALUE_CIDERPRESSLOC, TEXT("Applications (*.exe)\0*.exe\0") TEXT("All Files\0*.*\0") );
|
||||
RegSaveString(TEXT("Configuration"),REGVALUE_CIDERPRESSLOC,1,CiderPressLoc.c_str());
|
||||
SendDlgItemMessage(window, IDC_CIDERPRESS_FILENAME, WM_SETTEXT, 0, (LPARAM) CiderPressLoc.c_str());
|
||||
string CiderPressLoc = m_PropertySheetHelper.BrowseToFile(hWnd, TEXT("Select path to CiderPress"), REGVALUE_CIDERPRESSLOC, TEXT("Applications (*.exe)\0*.exe\0") TEXT("All Files\0*.*\0") );
|
||||
RegSaveString(TEXT(REG_CONFIG), REGVALUE_CIDERPRESSLOC, 1, CiderPressLoc.c_str());
|
||||
SendDlgItemMessage(hWnd, IDC_CIDERPRESS_FILENAME, WM_SETTEXT, 0, (LPARAM) CiderPressLoc.c_str());
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_INITDIALOG: //Init disk settings dialog
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
m_PropertySheetHelper.FillComboBox(window,IDC_DISKTYPE,m_discchoices,enhancedisk);
|
||||
m_PropertySheetHelper.FillComboBox(hWnd,IDC_DISKTYPE,m_discchoices,enhancedisk);
|
||||
|
||||
SendDlgItemMessage(window,IDC_EDIT_DISK1,WM_SETTEXT,0,(LPARAM)DiskGetFullName(DRIVE_1));
|
||||
SendDlgItemMessage(window,IDC_EDIT_DISK2,WM_SETTEXT,0,(LPARAM)DiskGetFullName(DRIVE_2));
|
||||
SendDlgItemMessage(hWnd, IDC_EDIT_DISK1, WM_SETTEXT, 0, (LPARAM)DiskGetFullName(DRIVE_1));
|
||||
SendDlgItemMessage(hWnd, IDC_EDIT_DISK2, WM_SETTEXT, 0, (LPARAM)DiskGetFullName(DRIVE_2));
|
||||
|
||||
SendDlgItemMessage(window,IDC_EDIT_HDD1,WM_SETTEXT,0,(LPARAM)HD_GetFullName(HARDDISK_1));
|
||||
SendDlgItemMessage(window,IDC_EDIT_HDD2,WM_SETTEXT,0,(LPARAM)HD_GetFullName(HARDDISK_2));
|
||||
SendDlgItemMessage(hWnd, IDC_EDIT_HDD1, WM_SETTEXT, 0, (LPARAM)HD_GetFullName(HARDDISK_1));
|
||||
SendDlgItemMessage(hWnd, IDC_EDIT_HDD2, WM_SETTEXT, 0, (LPARAM)HD_GetFullName(HARDDISK_2));
|
||||
|
||||
//
|
||||
|
||||
TCHAR PathToCiderPress[MAX_PATH] = "";
|
||||
RegLoadString(TEXT("Configuration"), REGVALUE_CIDERPRESSLOC, 1, PathToCiderPress,MAX_PATH);
|
||||
SendDlgItemMessage(window,IDC_CIDERPRESS_FILENAME ,WM_SETTEXT,0,(LPARAM)PathToCiderPress);
|
||||
SendDlgItemMessage(hWnd, IDC_CIDERPRESS_FILENAME ,WM_SETTEXT, 0, (LPARAM)PathToCiderPress);
|
||||
|
||||
//
|
||||
|
||||
CheckDlgButton(window, IDC_HDD_ENABLE, HD_CardIsEnabled() ? BST_CHECKED : BST_UNCHECKED);
|
||||
CheckDlgButton(hWnd, IDC_HDD_ENABLE, HD_CardIsEnabled() ? BST_CHECKED : BST_UNCHECKED);
|
||||
|
||||
EnableHDD(window, IsDlgButtonChecked(window, IDC_HDD_ENABLE));
|
||||
EnableHDD(hWnd, IsDlgButtonChecked(hWnd, IDC_HDD_ENABLE));
|
||||
|
||||
InitOptions(hWnd);
|
||||
|
||||
m_uAfterClose = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -125,7 +127,7 @@ BOOL CPageDisk::DlgProcInternal(HWND window, UINT message, WPARAM wparam, LPARAM
|
|||
POINT pt; // location of mouse click
|
||||
|
||||
// Get the bounding rectangle of the client area.
|
||||
GetClientRect(window, (LPRECT) &rect);
|
||||
GetClientRect(hWnd, (LPRECT) &rect);
|
||||
|
||||
// Get the client coordinates for the mouse click.
|
||||
pt.x = GET_X_LPARAM(lparam);
|
||||
|
@ -147,7 +149,7 @@ BOOL CPageDisk::DlgProcInternal(HWND window, UINT message, WPARAM wparam, LPARAM
|
|||
HMENU hMenuTrackPopup = GetSubMenu(hMenu, 0); // shortcut menu
|
||||
|
||||
// TrackPopup uses screen coordinates, so convert the coordinates of the mouse click to screen coordinates.
|
||||
ClientToScreen(window, (LPPOINT) &pt);
|
||||
ClientToScreen(hWnd, (LPPOINT) &pt);
|
||||
|
||||
if (Disk_IsDriveEmpty(DRIVE_1))
|
||||
EnableMenuItem(hMenu, ID_DISKMENU_EJECT_DISK1, MF_GRAYED);
|
||||
|
@ -164,7 +166,7 @@ BOOL CPageDisk::DlgProcInternal(HWND window, UINT message, WPARAM wparam, LPARAM
|
|||
, TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_RETURNCMD
|
||||
, pt.x, pt.y
|
||||
, 0
|
||||
, window, NULL );
|
||||
, hWnd, NULL );
|
||||
|
||||
if (iCommand)
|
||||
{
|
||||
|
@ -189,19 +191,19 @@ BOOL CPageDisk::DlgProcInternal(HWND window, UINT message, WPARAM wparam, LPARAM
|
|||
{
|
||||
case ID_DISKMENU_EJECT_DISK1:
|
||||
DiskEject(DRIVE_1);
|
||||
SendDlgItemMessage(window, IDC_EDIT_DISK1, WM_SETTEXT, 0, (LPARAM)DiskGetFullName(DRIVE_1));
|
||||
SendDlgItemMessage(hWnd, IDC_EDIT_DISK1, WM_SETTEXT, 0, (LPARAM)DiskGetFullName(DRIVE_1));
|
||||
break;
|
||||
case ID_DISKMENU_EJECT_DISK2:
|
||||
DiskEject(DRIVE_2);
|
||||
SendDlgItemMessage(window, IDC_EDIT_DISK2, WM_SETTEXT, 0, (LPARAM)DiskGetFullName(DRIVE_2));
|
||||
SendDlgItemMessage(hWnd, IDC_EDIT_DISK2, WM_SETTEXT, 0, (LPARAM)DiskGetFullName(DRIVE_2));
|
||||
break;
|
||||
case ID_DISKMENU_UNPLUG_HARDDISK1:
|
||||
HD_Unplug(HARDDISK_1);
|
||||
SendDlgItemMessage(window, IDC_EDIT_HDD1, WM_SETTEXT, 0, (LPARAM)HD_GetFullName(HARDDISK_1));
|
||||
SendDlgItemMessage(hWnd, IDC_EDIT_HDD1, WM_SETTEXT, 0, (LPARAM)HD_GetFullName(HARDDISK_1));
|
||||
break;
|
||||
case ID_DISKMENU_UNPLUG_HARDDISK2:
|
||||
HD_Unplug(HARDDISK_2);
|
||||
SendDlgItemMessage(window, IDC_EDIT_HDD2, WM_SETTEXT, 0, (LPARAM)HD_GetFullName(HARDDISK_2));
|
||||
SendDlgItemMessage(hWnd, IDC_EDIT_HDD2, WM_SETTEXT, 0, (LPARAM)HD_GetFullName(HARDDISK_2));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -216,40 +218,37 @@ BOOL CPageDisk::DlgProcInternal(HWND window, UINT message, WPARAM wparam, LPARAM
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
void CPageDisk::DlgOK(HWND window)
|
||||
void CPageDisk::DlgOK(HWND hWnd)
|
||||
{
|
||||
BOOL newdisktype = (BOOL) SendDlgItemMessage(window,IDC_DISKTYPE,CB_GETCURSEL,0,0);
|
||||
|
||||
if (newdisktype != enhancedisk)
|
||||
const BOOL bNewEnhanceDisk = (BOOL) SendDlgItemMessage(hWnd, IDC_DISKTYPE,CB_GETCURSEL, 0, 0);
|
||||
if (bNewEnhanceDisk != enhancedisk)
|
||||
{
|
||||
if (MessageBox(window,
|
||||
TEXT("You have changed the disk speed setting. ")
|
||||
TEXT("This change will not take effect ")
|
||||
TEXT("until the next time you restart the ")
|
||||
TEXT("emulator.\n\n")
|
||||
TEXT("Would you like to restart the emulator now?"),
|
||||
TEXT("Configuration"),
|
||||
MB_ICONQUESTION | MB_OKCANCEL | MB_SETFOREGROUND) == IDOK)
|
||||
m_uAfterClose = WM_USER_RESTART;
|
||||
m_PropertySheetHelper.GetConfigNew().m_bEnhanceDisk = bNewEnhanceDisk;
|
||||
}
|
||||
|
||||
bool bHDDIsEnabled = IsDlgButtonChecked(window, IDC_HDD_ENABLE) ? true : false;
|
||||
HD_SetEnabled(bHDDIsEnabled);
|
||||
|
||||
REGSAVE(TEXT(REGVALUE_ENHANCE_DISK_SPEED),newdisktype);
|
||||
REGSAVE(TEXT(REGVALUE_HDD_ENABLED), bHDDIsEnabled ? 1 : 0);
|
||||
const bool bNewHDDIsEnabled = IsDlgButtonChecked(hWnd, IDC_HDD_ENABLE) ? true : false;
|
||||
if (bNewHDDIsEnabled != HD_CardIsEnabled())
|
||||
{
|
||||
m_PropertySheetHelper.GetConfigNew().m_bEnableHDD = bNewHDDIsEnabled;
|
||||
}
|
||||
|
||||
RegSaveString(TEXT(REG_PREFS), TEXT(REGVALUE_PREF_LAST_HARDDISK_1), 1, HD_GetFullPathName(HARDDISK_1));
|
||||
RegSaveString(TEXT(REG_PREFS), TEXT(REGVALUE_PREF_LAST_HARDDISK_2), 1, HD_GetFullPathName(HARDDISK_2));
|
||||
|
||||
m_PropertySheetHelper.PostMsgAfterClose(m_Page, m_uAfterClose);
|
||||
m_PropertySheetHelper.PostMsgAfterClose(hWnd, m_Page);
|
||||
}
|
||||
|
||||
void CPageDisk::EnableHDD(HWND window, BOOL bEnable)
|
||||
void CPageDisk::InitOptions(HWND hWnd)
|
||||
{
|
||||
EnableWindow(GetDlgItem(window, IDC_HDD1), bEnable);
|
||||
EnableWindow(GetDlgItem(window, IDC_EDIT_HDD1), bEnable);
|
||||
|
||||
EnableWindow(GetDlgItem(window, IDC_HDD2), bEnable);
|
||||
EnableWindow(GetDlgItem(window, IDC_EDIT_HDD2), bEnable);
|
||||
// Nothing to do:
|
||||
// - no changes made on any other pages affect this page
|
||||
}
|
||||
|
||||
void CPageDisk::EnableHDD(HWND hWnd, BOOL bEnable)
|
||||
{
|
||||
EnableWindow(GetDlgItem(hWnd, IDC_HDD1), bEnable);
|
||||
EnableWindow(GetDlgItem(hWnd, IDC_EDIT_HDD1), bEnable);
|
||||
|
||||
EnableWindow(GetDlgItem(hWnd, IDC_HDD2), bEnable);
|
||||
EnableWindow(GetDlgItem(hWnd, IDC_EDIT_HDD2), bEnable);
|
||||
}
|
||||
|
|
|
@ -4,33 +4,32 @@
|
|||
#include "PropertySheetDefs.h"
|
||||
class CPropertySheetHelper;
|
||||
|
||||
class CPageDisk : public IPropertySheetPage
|
||||
class CPageDisk : private IPropertySheetPage
|
||||
{
|
||||
public:
|
||||
CPageDisk(CPropertySheetHelper& PropertySheetHelper) :
|
||||
m_Page(PG_DISK),
|
||||
m_PropertySheetHelper(PropertySheetHelper),
|
||||
m_uAfterClose(0)
|
||||
m_PropertySheetHelper(PropertySheetHelper)
|
||||
{
|
||||
CPageDisk::ms_this = this;
|
||||
}
|
||||
virtual ~CPageDisk(){}
|
||||
|
||||
static BOOL CALLBACK DlgProc(HWND window, UINT message, WPARAM wparam, LPARAM lparam);
|
||||
static BOOL CALLBACK DlgProc(HWND hWnd, UINT message, WPARAM wparam, LPARAM lparam);
|
||||
|
||||
protected:
|
||||
// IPropertySheetPage
|
||||
virtual BOOL DlgProcInternal(HWND window, UINT message, WPARAM wparam, LPARAM lparam);
|
||||
virtual void DlgOK(HWND window);
|
||||
virtual void DlgCANCEL(HWND window){}
|
||||
virtual BOOL DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARAM lparam);
|
||||
virtual void DlgOK(HWND hWnd);
|
||||
virtual void DlgCANCEL(HWND hWnd){}
|
||||
|
||||
private:
|
||||
void EnableHDD(HWND window, BOOL bEnable);
|
||||
void InitOptions(HWND hWnd);
|
||||
void EnableHDD(HWND hWnd, BOOL bEnable);
|
||||
|
||||
static CPageDisk* ms_this;
|
||||
static const TCHAR m_discchoices[];
|
||||
|
||||
const PAGETYPE m_Page;
|
||||
CPropertySheetHelper& m_PropertySheetHelper;
|
||||
UINT m_uAfterClose;
|
||||
};
|
||||
|
|
|
@ -32,17 +32,14 @@ const TCHAR CPageInput::m_szCPMSlotChoice_Unplugged[] = TEXT("Unplugged\0");
|
|||
const TCHAR CPageInput::m_szCPMSlotChoice_Unavailable[] = TEXT("Unavailable\0");
|
||||
|
||||
|
||||
BOOL CALLBACK CPageInput::DlgProc(HWND window, UINT message, WPARAM wparam, LPARAM lparam)
|
||||
BOOL CALLBACK CPageInput::DlgProc(HWND hWnd, UINT message, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
// Switch from static func to our instance
|
||||
return CPageInput::ms_this->DlgProcInternal(window, message, wparam, lparam);
|
||||
return CPageInput::ms_this->DlgProcInternal(hWnd, message, wparam, lparam);
|
||||
}
|
||||
|
||||
BOOL CPageInput::DlgProcInternal(HWND window, UINT message, WPARAM wparam, LPARAM lparam)
|
||||
BOOL CPageInput::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
m_MousecardSlotChange = CARD_UNCHANGED;
|
||||
m_CPMcardSlotChange = CARD_UNCHANGED;
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case WM_NOTIFY:
|
||||
|
@ -54,19 +51,20 @@ BOOL CPageInput::DlgProcInternal(HWND window, UINT message, WPARAM wparam, LPARA
|
|||
case PSN_SETACTIVE:
|
||||
// About to become the active page
|
||||
m_PropertySheetHelper.SetLastPage(m_Page);
|
||||
InitOptions(hWnd);
|
||||
break;
|
||||
case PSN_KILLACTIVE:
|
||||
SetWindowLong(window, DWL_MSGRESULT, FALSE); // Changes are valid
|
||||
SetWindowLong(hWnd, DWL_MSGRESULT, FALSE); // Changes are valid
|
||||
break;
|
||||
case PSN_APPLY:
|
||||
DlgOK(window);
|
||||
SetWindowLong(window, DWL_MSGRESULT, PSNRET_NOERROR); // Changes are valid
|
||||
DlgOK(hWnd);
|
||||
SetWindowLong(hWnd, DWL_MSGRESULT, PSNRET_NOERROR); // Changes are valid
|
||||
break;
|
||||
case PSN_QUERYCANCEL:
|
||||
// Can use this to ask user to confirm cancel
|
||||
break;
|
||||
case PSN_RESET:
|
||||
DlgCANCEL(window);
|
||||
DlgCANCEL(hWnd);
|
||||
break;
|
||||
|
||||
/* // Could use this to display PDL() value
|
||||
|
@ -76,13 +74,13 @@ BOOL CPageInput::DlgProcInternal(HWND window, UINT message, WPARAM wparam, LPARA
|
|||
{
|
||||
static int x = 0;
|
||||
x = lpnmud->iPos + lpnmud->iDelta;
|
||||
x = SendDlgItemMessage(window, IDC_SPIN_XTRIM, UDM_GETPOS, 0, 0);
|
||||
x = SendDlgItemMessage(hWnd, IDC_SPIN_XTRIM, UDM_GETPOS, 0, 0);
|
||||
}
|
||||
else if (lpnmud->hdr.idFrom == IDC_SPIN_YTRIM)
|
||||
{
|
||||
static int y = 0;
|
||||
y = lpnmud->iPos + lpnmud->iDelta;
|
||||
y = SendDlgItemMessage(window, IDC_SPIN_YTRIM, UDM_GETPOS, 0, 0);
|
||||
y = SendDlgItemMessage(hWnd, IDC_SPIN_YTRIM, UDM_GETPOS, 0, 0);
|
||||
}
|
||||
break;
|
||||
*/
|
||||
|
@ -96,97 +94,57 @@ BOOL CPageInput::DlgProcInternal(HWND window, UINT message, WPARAM wparam, LPARA
|
|||
case IDC_JOYSTICK0:
|
||||
if(HIWORD(wparam) == CBN_SELCHANGE)
|
||||
{
|
||||
DWORD newjoytype = (DWORD)SendDlgItemMessage(window,IDC_JOYSTICK0,CB_GETCURSEL,0,0);
|
||||
JoySetEmulationType(window,m_nJoy0ChoiceTranlationTbl[newjoytype],JN_JOYSTICK0);
|
||||
InitJoystickChoices(window, JN_JOYSTICK1, IDC_JOYSTICK1); // Re-init joy1 list
|
||||
DWORD newjoytype = (DWORD)SendDlgItemMessage(hWnd,IDC_JOYSTICK0,CB_GETCURSEL,0,0);
|
||||
JoySetEmulationType(hWnd,m_nJoy0ChoiceTranlationTbl[newjoytype],JN_JOYSTICK0);
|
||||
InitJoystickChoices(hWnd, JN_JOYSTICK1, IDC_JOYSTICK1); // Re-init joy1 list
|
||||
}
|
||||
break;
|
||||
|
||||
case IDC_JOYSTICK1:
|
||||
if(HIWORD(wparam) == CBN_SELCHANGE)
|
||||
{
|
||||
DWORD newjoytype = (DWORD)SendDlgItemMessage(window,IDC_JOYSTICK1,CB_GETCURSEL,0,0);
|
||||
JoySetEmulationType(window,m_nJoy1ChoiceTranlationTbl[newjoytype],JN_JOYSTICK1);
|
||||
InitJoystickChoices(window, JN_JOYSTICK0, IDC_JOYSTICK0); // Re-init joy0 list
|
||||
DWORD newjoytype = (DWORD)SendDlgItemMessage(hWnd,IDC_JOYSTICK1,CB_GETCURSEL,0,0);
|
||||
JoySetEmulationType(hWnd,m_nJoy1ChoiceTranlationTbl[newjoytype],JN_JOYSTICK1);
|
||||
InitJoystickChoices(hWnd, JN_JOYSTICK0, IDC_JOYSTICK0); // Re-init joy0 list
|
||||
}
|
||||
break;
|
||||
|
||||
case IDC_SCROLLLOCK_TOGGLE:
|
||||
m_uScrollLockToggle = IsDlgButtonChecked(window, IDC_SCROLLLOCK_TOGGLE) ? 1 : 0;
|
||||
m_uScrollLockToggle = IsDlgButtonChecked(hWnd, IDC_SCROLLLOCK_TOGGLE) ? 1 : 0;
|
||||
break;
|
||||
|
||||
case IDC_MOUSE_IN_SLOT4:
|
||||
{
|
||||
UINT uNewState = IsDlgButtonChecked(window, IDC_MOUSE_IN_SLOT4) ? 1 : 0;
|
||||
LPCSTR pMsg = uNewState ?
|
||||
TEXT("The emulator needs to restart as the slot configuration has changed.\n\n")
|
||||
TEXT("Also Mockingboard/Phasor cards won't be available in slot 4\n")
|
||||
TEXT("and the mouse can't be used for joystick emulation.\n\n")
|
||||
TEXT("Would you like to restart the emulator now?")
|
||||
:
|
||||
TEXT("The emulator needs to restart as the slot configuration has changed.\n\n")
|
||||
TEXT("(Mockingboard/Phasor cards will now be available in slot 4\n")
|
||||
TEXT("and the mouse can be used for joystick emulation)\n\n")
|
||||
TEXT("Would you like to restart the emulator now?");
|
||||
if ( (MessageBox(window,
|
||||
pMsg,
|
||||
TEXT("Configuration"),
|
||||
MB_ICONQUESTION | MB_OKCANCEL | MB_SETFOREGROUND) == IDOK)
|
||||
&& m_PropertySheetHelper.IsOkToRestart(window) )
|
||||
{
|
||||
m_MousecardSlotChange = !uNewState ? CARD_UNPLUGGED : CARD_INSERTED;
|
||||
const UINT uNewState = IsDlgButtonChecked(hWnd, IDC_MOUSE_IN_SLOT4) ? 1 : 0;
|
||||
m_PropertySheetHelper.GetConfigNew().m_Slot[4] = uNewState ? CT_MouseInterface : CT_Empty;
|
||||
|
||||
if (uNewState) // Redundant, since restarting
|
||||
{
|
||||
JoyDisableUsingMouse();
|
||||
InitJoystickChoices(window, JN_JOYSTICK0, IDC_JOYSTICK0);
|
||||
InitJoystickChoices(window, JN_JOYSTICK1, IDC_JOYSTICK1);
|
||||
}
|
||||
|
||||
m_uAfterClose = WM_USER_RESTART;
|
||||
PropSheet_PressButton(GetParent(window), PSBTN_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
const bool bIsSlot4Mouse = g_Slot4 == CT_MouseInterface;
|
||||
CheckDlgButton(window, IDC_MOUSE_IN_SLOT4, bIsSlot4Mouse ? BST_CHECKED : BST_UNCHECKED);
|
||||
}
|
||||
InitOptions(hWnd); // re-init
|
||||
}
|
||||
break;
|
||||
|
||||
case IDC_CPM_CONFIG:
|
||||
if(HIWORD(wparam) == CBN_SELCHANGE)
|
||||
{
|
||||
DWORD NewCPMChoiceItem = (DWORD) SendDlgItemMessage(window, IDC_CPM_CONFIG, CB_GETCURSEL, 0, 0);
|
||||
CPMCHOICE NewCPMChoice = m_CPMComboItemToChoice[NewCPMChoiceItem];
|
||||
const DWORD NewCPMChoiceItem = (DWORD) SendDlgItemMessage(hWnd, IDC_CPM_CONFIG, CB_GETCURSEL, 0, 0);
|
||||
const CPMCHOICE NewCPMChoice = m_CPMComboItemToChoice[NewCPMChoiceItem];
|
||||
if (NewCPMChoice == m_CPMChoice)
|
||||
break;
|
||||
|
||||
LPCSTR pMsg = NewCPMChoice != CPM_UNPLUGGED ?
|
||||
TEXT("The emulator needs to restart as the slot configuration has changed.\n")
|
||||
TEXT("Microsoft CP/M SoftCard will be inserted.\n\n")
|
||||
TEXT("Would you like to restart the emulator now?")
|
||||
:
|
||||
TEXT("The emulator needs to restart as the slot configuration has changed.\n")
|
||||
TEXT("Microsoft CP/M SoftCard will be removed.\n\n")
|
||||
TEXT("Would you like to restart the emulator now?");
|
||||
if ( (MessageBox(window,
|
||||
pMsg,
|
||||
TEXT("Configuration"),
|
||||
MB_ICONQUESTION | MB_OKCANCEL | MB_SETFOREGROUND) == IDOK)
|
||||
&& m_PropertySheetHelper.IsOkToRestart(window) )
|
||||
{
|
||||
m_CPMcardSlotChange = (NewCPMChoice == CPM_UNPLUGGED) ? CARD_UNPLUGGED : CARD_INSERTED;
|
||||
m_CPMChoice = NewCPMChoice;
|
||||
// Whatever has changed, the old slot will now be empty
|
||||
const SS_CARDTYPE Slot4 = m_PropertySheetHelper.GetConfigNew().m_Slot[4];
|
||||
const SS_CARDTYPE Slot5 = m_PropertySheetHelper.GetConfigNew().m_Slot[5];
|
||||
if (Slot4 == CT_Z80)
|
||||
m_PropertySheetHelper.GetConfigNew().m_Slot[4] = CT_Empty;
|
||||
else if (Slot5 == CT_Z80)
|
||||
m_PropertySheetHelper.GetConfigNew().m_Slot[5] = CT_Empty;
|
||||
|
||||
m_uAfterClose = WM_USER_RESTART;
|
||||
PropSheet_PressButton(GetParent(window), PSBTN_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
InitCPMChoices(window); // Restore original state
|
||||
}
|
||||
// Insert CP/M card into new slot (or leave slot empty)
|
||||
if (NewCPMChoice == CPM_SLOT4)
|
||||
m_PropertySheetHelper.GetConfigNew().m_Slot[4] = CT_Z80;
|
||||
else if (NewCPMChoice == CPM_SLOT5)
|
||||
m_PropertySheetHelper.GetConfigNew().m_Slot[5] = CT_Z80;
|
||||
|
||||
InitOptions(hWnd); // re-init
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -196,32 +154,21 @@ BOOL CPageInput::DlgProcInternal(HWND window, UINT message, WPARAM wparam, LPARA
|
|||
}
|
||||
break;
|
||||
|
||||
case WM_INITDIALOG: //Init input settings dialog
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
InitJoystickChoices(window, JN_JOYSTICK0, IDC_JOYSTICK0);
|
||||
InitJoystickChoices(window, JN_JOYSTICK1, IDC_JOYSTICK1);
|
||||
InitJoystickChoices(hWnd, JN_JOYSTICK0, IDC_JOYSTICK0);
|
||||
InitJoystickChoices(hWnd, JN_JOYSTICK1, IDC_JOYSTICK1);
|
||||
|
||||
SendDlgItemMessage(window, IDC_SPIN_XTRIM, UDM_SETRANGE, 0, MAKELONG(128,-127));
|
||||
SendDlgItemMessage(window, IDC_SPIN_YTRIM, UDM_SETRANGE, 0, MAKELONG(128,-127));
|
||||
SendDlgItemMessage(hWnd, IDC_SPIN_XTRIM, UDM_SETRANGE, 0, MAKELONG(128,-127));
|
||||
SendDlgItemMessage(hWnd, IDC_SPIN_YTRIM, UDM_SETRANGE, 0, MAKELONG(128,-127));
|
||||
|
||||
SendDlgItemMessage(window, IDC_SPIN_XTRIM, UDM_SETPOS, 0, MAKELONG(JoyGetTrim(true),0));
|
||||
SendDlgItemMessage(window, IDC_SPIN_YTRIM, UDM_SETPOS, 0, MAKELONG(JoyGetTrim(false),0));
|
||||
SendDlgItemMessage(hWnd, IDC_SPIN_XTRIM, UDM_SETPOS, 0, MAKELONG(JoyGetTrim(true),0));
|
||||
SendDlgItemMessage(hWnd, IDC_SPIN_YTRIM, UDM_SETPOS, 0, MAKELONG(JoyGetTrim(false),0));
|
||||
|
||||
CheckDlgButton(window, IDC_SCROLLLOCK_TOGGLE, m_uScrollLockToggle ? BST_CHECKED : BST_UNCHECKED);
|
||||
CheckDlgButton(hWnd, IDC_SCROLLLOCK_TOGGLE, m_uScrollLockToggle ? BST_CHECKED : BST_UNCHECKED);
|
||||
|
||||
const bool bIsSlot4Mouse = g_Slot4 == CT_MouseInterface;
|
||||
CheckDlgButton(window, IDC_MOUSE_IN_SLOT4, bIsSlot4Mouse ? BST_CHECKED : BST_UNCHECKED);
|
||||
CheckDlgButton(window, IDC_MOUSE_CROSSHAIR, m_uMouseShowCrosshair ? BST_CHECKED : BST_UNCHECKED);
|
||||
CheckDlgButton(window, IDC_MOUSE_RESTRICT_TO_WINDOW, m_uMouseRestrictToWindow ? BST_CHECKED : BST_UNCHECKED);
|
||||
InitOptions(hWnd);
|
||||
|
||||
const bool bIsSlot4Empty = g_Slot4 == CT_Empty;
|
||||
EnableWindow(GetDlgItem(window, IDC_MOUSE_IN_SLOT4), (bIsSlot4Mouse || bIsSlot4Empty) ? TRUE : FALSE);
|
||||
EnableWindow(GetDlgItem(window, IDC_MOUSE_CROSSHAIR), bIsSlot4Mouse ? TRUE : FALSE);
|
||||
EnableWindow(GetDlgItem(window, IDC_MOUSE_RESTRICT_TO_WINDOW), bIsSlot4Mouse ? TRUE : FALSE);
|
||||
|
||||
InitCPMChoices(window);
|
||||
|
||||
m_uAfterClose = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -229,72 +176,47 @@ BOOL CPageInput::DlgProcInternal(HWND window, UINT message, WPARAM wparam, LPARA
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
void CPageInput::DlgOK(HWND window)
|
||||
void CPageInput::DlgOK(HWND hWnd)
|
||||
{
|
||||
UINT uNewJoyType0 = SendDlgItemMessage(window,IDC_JOYSTICK0,CB_GETCURSEL,0,0);
|
||||
UINT uNewJoyType1 = SendDlgItemMessage(window,IDC_JOYSTICK1,CB_GETCURSEL,0,0);
|
||||
const UINT uNewJoyType0 = SendDlgItemMessage(hWnd, IDC_JOYSTICK0, CB_GETCURSEL, 0, 0);
|
||||
const UINT uNewJoyType1 = SendDlgItemMessage(hWnd, IDC_JOYSTICK1, CB_GETCURSEL, 0, 0);
|
||||
|
||||
if (!JoySetEmulationType(window, m_nJoy0ChoiceTranlationTbl[uNewJoyType0], JN_JOYSTICK0))
|
||||
if (JoySetEmulationType(hWnd, m_nJoy0ChoiceTranlationTbl[uNewJoyType0], JN_JOYSTICK0))
|
||||
{
|
||||
m_uAfterClose = 0;
|
||||
return;
|
||||
REGSAVE(TEXT("Joystick 0 Emulation"), joytype[0]);
|
||||
}
|
||||
|
||||
if (!JoySetEmulationType(window, m_nJoy1ChoiceTranlationTbl[uNewJoyType1], JN_JOYSTICK1))
|
||||
if (JoySetEmulationType(hWnd, m_nJoy1ChoiceTranlationTbl[uNewJoyType1], JN_JOYSTICK1))
|
||||
{
|
||||
m_uAfterClose = 0;
|
||||
return;
|
||||
REGSAVE(TEXT("Joystick 1 Emulation"), joytype[1]);
|
||||
}
|
||||
|
||||
JoySetTrim((short)SendDlgItemMessage(window, IDC_SPIN_XTRIM, UDM_GETPOS, 0, 0), true);
|
||||
JoySetTrim((short)SendDlgItemMessage(window, IDC_SPIN_YTRIM, UDM_GETPOS, 0, 0), false);
|
||||
JoySetTrim((short)SendDlgItemMessage(hWnd, IDC_SPIN_XTRIM, UDM_GETPOS, 0, 0), true);
|
||||
JoySetTrim((short)SendDlgItemMessage(hWnd, IDC_SPIN_YTRIM, UDM_GETPOS, 0, 0), false);
|
||||
|
||||
m_uMouseShowCrosshair = IsDlgButtonChecked(window, IDC_MOUSE_CROSSHAIR) ? 1 : 0;
|
||||
m_uMouseRestrictToWindow = IsDlgButtonChecked(window, IDC_MOUSE_RESTRICT_TO_WINDOW) ? 1 : 0;
|
||||
m_uMouseShowCrosshair = IsDlgButtonChecked(hWnd, IDC_MOUSE_CROSSHAIR) ? 1 : 0;
|
||||
m_uMouseRestrictToWindow = IsDlgButtonChecked(hWnd, IDC_MOUSE_RESTRICT_TO_WINDOW) ? 1 : 0;
|
||||
|
||||
REGSAVE(TEXT("Joystick 0 Emulation"),joytype[0]);
|
||||
REGSAVE(TEXT("Joystick 1 Emulation"),joytype[1]);
|
||||
REGSAVE(TEXT(REGVALUE_PDL_XTRIM),JoyGetTrim(true));
|
||||
REGSAVE(TEXT(REGVALUE_PDL_YTRIM),JoyGetTrim(false));
|
||||
REGSAVE(TEXT(REGVALUE_SCROLLLOCK_TOGGLE),m_uScrollLockToggle);
|
||||
REGSAVE(TEXT(REGVALUE_MOUSE_CROSSHAIR),m_uMouseShowCrosshair);
|
||||
REGSAVE(TEXT(REGVALUE_MOUSE_RESTRICT_TO_WINDOW),m_uMouseRestrictToWindow);
|
||||
REGSAVE(TEXT(REGVALUE_PDL_XTRIM), JoyGetTrim(true));
|
||||
REGSAVE(TEXT(REGVALUE_PDL_YTRIM), JoyGetTrim(false));
|
||||
REGSAVE(TEXT(REGVALUE_SCROLLLOCK_TOGGLE), m_uScrollLockToggle);
|
||||
REGSAVE(TEXT(REGVALUE_MOUSE_CROSSHAIR), m_uMouseShowCrosshair);
|
||||
REGSAVE(TEXT(REGVALUE_MOUSE_RESTRICT_TO_WINDOW), m_uMouseRestrictToWindow);
|
||||
|
||||
if (m_MousecardSlotChange == CARD_INSERTED)
|
||||
m_PropertySheetHelper.SetSlot4(CT_MouseInterface);
|
||||
else if (m_MousecardSlotChange == CARD_UNPLUGGED)
|
||||
m_PropertySheetHelper.SetSlot4(CT_Empty);
|
||||
|
||||
//
|
||||
|
||||
if (m_CPMcardSlotChange != CARD_UNCHANGED)
|
||||
{
|
||||
// Whatever has changed, the old slot will now be empty
|
||||
if (g_Slot4 == CT_Z80)
|
||||
m_PropertySheetHelper.SetSlot4(CT_Empty);
|
||||
else if (g_Slot5 == CT_Z80)
|
||||
m_PropertySheetHelper.SetSlot5(CT_Empty);
|
||||
|
||||
// Insert CP/M card into new slot (or leave slot empty)
|
||||
if (m_CPMChoice == CPM_SLOT4)
|
||||
m_PropertySheetHelper.SetSlot4(CT_Z80);
|
||||
else if (m_CPMChoice == CPM_SLOT5)
|
||||
m_PropertySheetHelper.SetSlot5(CT_Z80);
|
||||
}
|
||||
|
||||
m_PropertySheetHelper.PostMsgAfterClose(m_Page, m_uAfterClose);
|
||||
m_PropertySheetHelper.PostMsgAfterClose(hWnd, m_Page);
|
||||
}
|
||||
|
||||
void CPageInput::InitJoystickChoices(HWND window, int nJoyNum, int nIdcValue)
|
||||
void CPageInput::InitOptions(HWND hWnd)
|
||||
{
|
||||
TCHAR *pszMem;
|
||||
int nIdx;
|
||||
unsigned long i;
|
||||
InitSlotOptions(hWnd);
|
||||
}
|
||||
|
||||
void CPageInput::InitJoystickChoices(HWND hWnd, int nJoyNum, int nIdcValue)
|
||||
{
|
||||
TCHAR* pnzJoystickChoices;
|
||||
int *pnJoyTranslationTbl;
|
||||
int nJoyTranslationTblSize;
|
||||
unsigned short nJC_DISABLED,nJC_JOYSTICK,nJC_KEYBD_STANDARD,nJC_KEYBD_CENTERING,nJC_MAX;
|
||||
unsigned short nJC_DISABLED, nJC_JOYSTICK, nJC_KEYBD_STANDARD, nJC_KEYBD_CENTERING, nJC_MAX;
|
||||
TCHAR** ppszJoyChoices;
|
||||
int nOtherJoyNum = nJoyNum == JN_JOYSTICK0 ? JN_JOYSTICK1 : JN_JOYSTICK0;
|
||||
|
||||
|
@ -323,8 +245,8 @@ void CPageInput::InitJoystickChoices(HWND window, int nJoyNum, int nIdcValue)
|
|||
ppszJoyChoices = (TCHAR**) m_pszJoy1Choices;
|
||||
}
|
||||
|
||||
pszMem = pnzJoystickChoices;
|
||||
nIdx = 0;
|
||||
TCHAR* pszMem = pnzJoystickChoices;
|
||||
int nIdx = 0;
|
||||
memset(pnJoyTranslationTbl, -1, nJoyTranslationTblSize);
|
||||
|
||||
// Build the Joystick choices string list. These first 2 are always selectable.
|
||||
|
@ -337,7 +259,7 @@ void CPageInput::InitJoystickChoices(HWND window, int nJoyNum, int nIdcValue)
|
|||
pnJoyTranslationTbl[nIdx++] = nJC_JOYSTICK;
|
||||
|
||||
// Now exclude the other Joystick type (if it exists) from this new list
|
||||
for(i=nJC_KEYBD_STANDARD; i<nJC_MAX; i++)
|
||||
for(UINT i=nJC_KEYBD_STANDARD; i<nJC_MAX; i++)
|
||||
{
|
||||
if( ( (i == nJC_KEYBD_STANDARD) || (i == nJC_KEYBD_CENTERING) ) &&
|
||||
( (joytype[nOtherJoyNum] == nJC_KEYBD_STANDARD) || (joytype[nOtherJoyNum] == nJC_KEYBD_CENTERING) )
|
||||
|
@ -356,13 +278,33 @@ void CPageInput::InitJoystickChoices(HWND window, int nJoyNum, int nIdcValue)
|
|||
|
||||
*pszMem = 0x00; // Doubly null terminated
|
||||
|
||||
m_PropertySheetHelper.FillComboBox(window, nIdcValue, pnzJoystickChoices, joytype[nJoyNum]);
|
||||
m_PropertySheetHelper.FillComboBox(hWnd, nIdcValue, pnzJoystickChoices, joytype[nJoyNum]);
|
||||
}
|
||||
|
||||
void CPageInput::InitCPMChoices(HWND window)
|
||||
void CPageInput::InitSlotOptions(HWND hWnd)
|
||||
{
|
||||
if (g_Slot4 == CT_Z80) m_CPMChoice = CPM_SLOT4;
|
||||
else if (g_Slot5 == CT_Z80) m_CPMChoice = CPM_SLOT5;
|
||||
const SS_CARDTYPE Slot4 = m_PropertySheetHelper.GetConfigNew().m_Slot[4];
|
||||
|
||||
const bool bIsSlot4Mouse = Slot4 == CT_MouseInterface;
|
||||
CheckDlgButton(hWnd, IDC_MOUSE_IN_SLOT4, bIsSlot4Mouse ? BST_CHECKED : BST_UNCHECKED);
|
||||
CheckDlgButton(hWnd, IDC_MOUSE_CROSSHAIR, m_uMouseShowCrosshair ? BST_CHECKED : BST_UNCHECKED);
|
||||
CheckDlgButton(hWnd, IDC_MOUSE_RESTRICT_TO_WINDOW, m_uMouseRestrictToWindow ? BST_CHECKED : BST_UNCHECKED);
|
||||
|
||||
const bool bIsSlot4Empty = Slot4 == CT_Empty;
|
||||
EnableWindow(GetDlgItem(hWnd, IDC_MOUSE_IN_SLOT4), (bIsSlot4Mouse || bIsSlot4Empty) ? TRUE : FALSE);
|
||||
EnableWindow(GetDlgItem(hWnd, IDC_MOUSE_CROSSHAIR), bIsSlot4Mouse ? TRUE : FALSE);
|
||||
EnableWindow(GetDlgItem(hWnd, IDC_MOUSE_RESTRICT_TO_WINDOW), bIsSlot4Mouse ? TRUE : FALSE);
|
||||
|
||||
InitCPMChoices(hWnd);
|
||||
}
|
||||
|
||||
void CPageInput::InitCPMChoices(HWND hWnd)
|
||||
{
|
||||
const SS_CARDTYPE Slot4 = m_PropertySheetHelper.GetConfigNew().m_Slot[4];
|
||||
const SS_CARDTYPE Slot5 = m_PropertySheetHelper.GetConfigNew().m_Slot[5];
|
||||
|
||||
if (Slot4 == CT_Z80) m_CPMChoice = CPM_SLOT4;
|
||||
else if (Slot5 == CT_Z80) m_CPMChoice = CPM_SLOT5;
|
||||
else m_CPMChoice = CPM_UNPLUGGED;
|
||||
|
||||
for (UINT i=0; i<_CPM_MAX_CHOICES; i++)
|
||||
|
@ -371,10 +313,10 @@ void CPageInput::InitCPMChoices(HWND window)
|
|||
UINT uStringOffset = 0;
|
||||
UINT uComboItemIdx = 0;
|
||||
|
||||
const bool bIsSlot4Empty = g_Slot4 == CT_Empty;
|
||||
const bool bIsSlot4CPM = g_Slot4 == CT_Z80;
|
||||
const bool bIsSlot5Empty = g_Slot5 == CT_Empty;
|
||||
const bool bIsSlot5CPM = g_Slot5 == CT_Z80;
|
||||
const bool bIsSlot4Empty = Slot4 == CT_Empty;
|
||||
const bool bIsSlot4CPM = Slot4 == CT_Z80;
|
||||
const bool bIsSlot5Empty = Slot5 == CT_Empty;
|
||||
const bool bIsSlot5CPM = Slot5 == CT_Z80;
|
||||
|
||||
if (bIsSlot4Empty || bIsSlot4CPM)
|
||||
{
|
||||
|
@ -426,5 +368,5 @@ void CPageInput::InitCPMChoices(HWND window)
|
|||
}
|
||||
}
|
||||
|
||||
m_PropertySheetHelper.FillComboBox(window, IDC_CPM_CONFIG, m_szCPMSlotChoices, uCurrentChoice);
|
||||
m_PropertySheetHelper.FillComboBox(hWnd, IDC_CPM_CONFIG, m_szCPMSlotChoices, uCurrentChoice);
|
||||
}
|
||||
|
|
|
@ -3,16 +3,14 @@
|
|||
#include "IPropertySheetPage.h"
|
||||
#include "PropertySheetDefs.h"
|
||||
class CPropertySheetHelper;
|
||||
class CConfigNeedingRestart;
|
||||
|
||||
class CPageInput : public IPropertySheetPage
|
||||
class CPageInput : private IPropertySheetPage
|
||||
{
|
||||
public:
|
||||
CPageInput(CPropertySheetHelper& PropertySheetHelper) :
|
||||
m_Page(PG_INPUT),
|
||||
m_PropertySheetHelper(PropertySheetHelper),
|
||||
m_uAfterClose(0),
|
||||
m_MousecardSlotChange(CARD_UNCHANGED),
|
||||
m_CPMcardSlotChange(CARD_UNCHANGED),
|
||||
m_uScrollLockToggle(0),
|
||||
m_uMouseShowCrosshair(0),
|
||||
m_uMouseRestrictToWindow(0),
|
||||
|
@ -33,13 +31,15 @@ public:
|
|||
|
||||
protected:
|
||||
// IPropertySheetPage
|
||||
virtual BOOL DlgProcInternal(HWND window, UINT message, WPARAM wparam, LPARAM lparam);
|
||||
virtual void DlgOK(HWND window);
|
||||
virtual void DlgCANCEL(HWND window){}
|
||||
virtual BOOL DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARAM lparam);
|
||||
virtual void DlgOK(HWND hWnd);
|
||||
virtual void DlgCANCEL(HWND hWnd){}
|
||||
|
||||
private:
|
||||
void InitJoystickChoices(HWND window, int nJoyNum, int nIdcValue);
|
||||
void InitCPMChoices(HWND window);
|
||||
void InitOptions(HWND hWnd);
|
||||
void InitJoystickChoices(HWND hWnd, int nJoyNum, int nIdcValue);
|
||||
void InitSlotOptions(HWND hWnd);
|
||||
void InitCPMChoices(HWND hWnd);
|
||||
|
||||
static CPageInput* ms_this;
|
||||
static const UINT MaxMenuChoiceLen = 40;
|
||||
|
@ -67,10 +67,7 @@ private:
|
|||
|
||||
const PAGETYPE m_Page;
|
||||
CPropertySheetHelper& m_PropertySheetHelper;
|
||||
UINT m_uAfterClose;
|
||||
|
||||
CARDSTATE m_MousecardSlotChange;
|
||||
CARDSTATE m_CPMcardSlotChange;
|
||||
UINT m_uScrollLockToggle;
|
||||
UINT m_uMouseShowCrosshair;
|
||||
UINT m_uMouseRestrictToWindow;
|
||||
|
|
|
@ -11,13 +11,13 @@ const TCHAR CPageSound::m_soundchoices[] = TEXT("Disabled\0")
|
|||
TEXT("Sound Card\0");
|
||||
|
||||
|
||||
BOOL CALLBACK CPageSound::DlgProc(HWND window, UINT message, WPARAM wparam, LPARAM lparam)
|
||||
BOOL CALLBACK CPageSound::DlgProc(HWND hWnd, UINT message, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
// Switch from static func to our instance
|
||||
return CPageSound::ms_this->DlgProcInternal(window, message, wparam, lparam);
|
||||
return CPageSound::ms_this->DlgProcInternal(hWnd, message, wparam, lparam);
|
||||
}
|
||||
|
||||
BOOL CPageSound::DlgProcInternal(HWND window, UINT message, WPARAM wparam, LPARAM lparam)
|
||||
BOOL CPageSound::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
switch (message)
|
||||
{
|
||||
|
@ -30,19 +30,20 @@ BOOL CPageSound::DlgProcInternal(HWND window, UINT message, WPARAM wparam, LPARA
|
|||
case PSN_SETACTIVE:
|
||||
// About to become the active page
|
||||
m_PropertySheetHelper.SetLastPage(m_Page);
|
||||
InitOptions(hWnd);
|
||||
break;
|
||||
case PSN_KILLACTIVE:
|
||||
SetWindowLong(window, DWL_MSGRESULT, FALSE); // Changes are valid
|
||||
SetWindowLong(hWnd, DWL_MSGRESULT, FALSE); // Changes are valid
|
||||
break;
|
||||
case PSN_APPLY:
|
||||
DlgOK(window);
|
||||
SetWindowLong(window, DWL_MSGRESULT, PSNRET_NOERROR); // Changes are valid
|
||||
DlgOK(hWnd);
|
||||
SetWindowLong(hWnd, DWL_MSGRESULT, PSNRET_NOERROR); // Changes are valid
|
||||
break;
|
||||
case PSN_QUERYCANCEL:
|
||||
// Can use this to ask user to confirm cancel
|
||||
break;
|
||||
case PSN_RESET:
|
||||
DlgCANCEL(window);
|
||||
DlgCANCEL(hWnd);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -56,82 +57,37 @@ BOOL CPageSound::DlgProcInternal(HWND window, UINT message, WPARAM wparam, LPARA
|
|||
case IDC_MB_VOLUME:
|
||||
break;
|
||||
case IDC_MB_ENABLE:
|
||||
{
|
||||
LPCSTR pMsg = TEXT("The emulator needs to restart as the slot configuration has changed.\n")
|
||||
TEXT("Mockingboard cards will be inserted into slots 4 & 5.\n\n")
|
||||
TEXT("Would you like to restart the emulator now?");
|
||||
if (NewSoundcardConfigured(window, wparam, pMsg))
|
||||
{
|
||||
m_NewCardType = CT_MockingboardC;
|
||||
m_SoundcardSlotChange = CARD_INSERTED;
|
||||
EnableWindow(GetDlgItem(window, IDC_MB_VOLUME), TRUE);
|
||||
}
|
||||
}
|
||||
if (NewSoundcardConfigured(hWnd, wparam, CT_MockingboardC))
|
||||
InitOptions(hWnd); // re-init
|
||||
break;
|
||||
case IDC_PHASOR_ENABLE:
|
||||
{
|
||||
LPCSTR pMsg = TEXT("The emulator needs to restart as the slot configuration has changed.\n")
|
||||
TEXT("Phasor card will be inserted into slot 4.\n\n")
|
||||
TEXT("Would you like to restart the emulator now?");
|
||||
if (NewSoundcardConfigured(window, wparam, pMsg))
|
||||
{
|
||||
m_NewCardType = CT_Phasor;
|
||||
m_SoundcardSlotChange = CARD_INSERTED;
|
||||
EnableWindow(GetDlgItem(window, IDC_MB_VOLUME), TRUE);
|
||||
}
|
||||
}
|
||||
if (NewSoundcardConfigured(hWnd, wparam, CT_Phasor))
|
||||
InitOptions(hWnd); // re-init
|
||||
break;
|
||||
case IDC_SOUNDCARD_DISABLE:
|
||||
{
|
||||
LPCSTR pMsg = TEXT("The emulator needs to restart as the slot configuration has changed.\n")
|
||||
TEXT("Sound card(s) will be removed.\n\n")
|
||||
TEXT("Would you like to restart the emulator now?");
|
||||
if (NewSoundcardConfigured(window, wparam, pMsg))
|
||||
{
|
||||
m_NewCardType = CT_Empty;
|
||||
m_SoundcardSlotChange = CARD_UNPLUGGED;
|
||||
EnableWindow(GetDlgItem(window, IDC_MB_VOLUME), FALSE);
|
||||
}
|
||||
}
|
||||
if (NewSoundcardConfigured(hWnd, wparam, CT_Empty))
|
||||
InitOptions(hWnd); // re-init
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
m_PropertySheetHelper.FillComboBox(window,IDC_SOUNDTYPE,m_soundchoices,soundtype);
|
||||
m_PropertySheetHelper.FillComboBox(hWnd,IDC_SOUNDTYPE,m_soundchoices,soundtype);
|
||||
|
||||
SendDlgItemMessage(window,IDC_SPKR_VOLUME,TBM_SETRANGE,1,MAKELONG(VOLUME_MIN,VOLUME_MAX));
|
||||
SendDlgItemMessage(window,IDC_SPKR_VOLUME,TBM_SETPAGESIZE,0,10);
|
||||
SendDlgItemMessage(window,IDC_SPKR_VOLUME,TBM_SETTICFREQ,10,0);
|
||||
SendDlgItemMessage(window,IDC_SPKR_VOLUME,TBM_SETPOS,1,SpkrGetVolume());
|
||||
SendDlgItemMessage(hWnd,IDC_SPKR_VOLUME,TBM_SETRANGE,1,MAKELONG(VOLUME_MIN,VOLUME_MAX));
|
||||
SendDlgItemMessage(hWnd,IDC_SPKR_VOLUME,TBM_SETPAGESIZE,0,10);
|
||||
SendDlgItemMessage(hWnd,IDC_SPKR_VOLUME,TBM_SETTICFREQ,10,0);
|
||||
SendDlgItemMessage(hWnd,IDC_SPKR_VOLUME,TBM_SETPOS,1,SpkrGetVolume());
|
||||
|
||||
SendDlgItemMessage(window,IDC_MB_VOLUME,TBM_SETRANGE,1,MAKELONG(VOLUME_MIN,VOLUME_MAX));
|
||||
SendDlgItemMessage(window,IDC_MB_VOLUME,TBM_SETPAGESIZE,0,10);
|
||||
SendDlgItemMessage(window,IDC_MB_VOLUME,TBM_SETTICFREQ,10,0);
|
||||
SendDlgItemMessage(window,IDC_MB_VOLUME,TBM_SETPOS,1,MB_GetVolume());
|
||||
SendDlgItemMessage(hWnd,IDC_MB_VOLUME,TBM_SETRANGE,1,MAKELONG(VOLUME_MIN,VOLUME_MAX));
|
||||
SendDlgItemMessage(hWnd,IDC_MB_VOLUME,TBM_SETPAGESIZE,0,10);
|
||||
SendDlgItemMessage(hWnd,IDC_MB_VOLUME,TBM_SETTICFREQ,10,0);
|
||||
SendDlgItemMessage(hWnd,IDC_MB_VOLUME,TBM_SETPOS,1,MB_GetVolume());
|
||||
|
||||
SS_CARDTYPE SoundcardType = MB_GetSoundcardType();
|
||||
if(SoundcardType == CT_MockingboardC)
|
||||
m_nCurrentIDCheckButton = IDC_MB_ENABLE;
|
||||
else if(SoundcardType == CT_Phasor)
|
||||
m_nCurrentIDCheckButton = IDC_PHASOR_ENABLE;
|
||||
else
|
||||
m_nCurrentIDCheckButton = IDC_SOUNDCARD_DISABLE;
|
||||
m_NewCardType = MB_GetSoundcardType(); // Reinit 1st time page is activated (fires before PSN_SETACTIVE)
|
||||
InitOptions(hWnd);
|
||||
|
||||
CheckRadioButton(window, IDC_MB_ENABLE, IDC_SOUNDCARD_DISABLE, m_nCurrentIDCheckButton);
|
||||
|
||||
const bool bIsSlot4Empty = g_Slot4 == CT_Empty;
|
||||
const bool bIsSlot5Empty = g_Slot5 == CT_Empty;
|
||||
if (!bIsSlot4Empty && g_Slot4 != CT_MockingboardC)
|
||||
EnableWindow(GetDlgItem(window, IDC_PHASOR_ENABLE), FALSE); // Disable Phasor (slot 4)
|
||||
|
||||
if ((!bIsSlot4Empty || !bIsSlot5Empty) && g_Slot4 != CT_Phasor)
|
||||
EnableWindow(GetDlgItem(window, IDC_MB_ENABLE), FALSE); // Disable Mockingboard (slot 4 & 5)
|
||||
|
||||
EnableWindow(GetDlgItem(window, IDC_MB_VOLUME), (m_nCurrentIDCheckButton != IDC_SOUNDCARD_DISABLE) ? TRUE : FALSE);
|
||||
|
||||
m_uAfterClose = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -139,54 +95,64 @@ BOOL CPageSound::DlgProcInternal(HWND window, UINT message, WPARAM wparam, LPARA
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
void CPageSound::DlgOK(HWND window)
|
||||
void CPageSound::DlgOK(HWND hWnd)
|
||||
{
|
||||
DWORD newsoundtype = (DWORD)SendDlgItemMessage(window,IDC_SOUNDTYPE,CB_GETCURSEL,0,0);
|
||||
const DWORD dwNewSoundType = (DWORD) SendDlgItemMessage(hWnd, IDC_SOUNDTYPE, CB_GETCURSEL, 0, 0);
|
||||
|
||||
DWORD dwSpkrVolume = SendDlgItemMessage(window,IDC_SPKR_VOLUME,TBM_GETPOS,0,0);
|
||||
DWORD dwMBVolume = SendDlgItemMessage(window,IDC_MB_VOLUME,TBM_GETPOS,0,0);
|
||||
const DWORD dwSpkrVolume = SendDlgItemMessage(hWnd, IDC_SPKR_VOLUME, TBM_GETPOS, 0, 0);
|
||||
const DWORD dwMBVolume = SendDlgItemMessage(hWnd, IDC_MB_VOLUME, TBM_GETPOS, 0, 0);
|
||||
|
||||
if (!SpkrSetEmulationType(window,newsoundtype))
|
||||
if (SpkrSetEmulationType(hWnd, dwNewSoundType))
|
||||
{
|
||||
m_uAfterClose = 0;
|
||||
return;
|
||||
REGSAVE(TEXT("Sound Emulation"), soundtype);
|
||||
}
|
||||
|
||||
// NB. Volume: 0=Loudest, VOLUME_MAX=Silence
|
||||
SpkrSetVolume(dwSpkrVolume, VOLUME_MAX);
|
||||
MB_SetVolume(dwMBVolume, VOLUME_MAX);
|
||||
|
||||
REGSAVE(TEXT("Sound Emulation"),soundtype);
|
||||
REGSAVE(TEXT(REGVALUE_SPKR_VOLUME),SpkrGetVolume());
|
||||
REGSAVE(TEXT(REGVALUE_MB_VOLUME),MB_GetVolume());
|
||||
REGSAVE(TEXT(REGVALUE_SPKR_VOLUME), SpkrGetVolume());
|
||||
REGSAVE(TEXT(REGVALUE_MB_VOLUME), MB_GetVolume());
|
||||
|
||||
if (m_SoundcardSlotChange != CARD_UNCHANGED)
|
||||
{
|
||||
MB_SetSoundcardType(m_NewCardType);
|
||||
|
||||
if (m_NewCardType == CT_MockingboardC)
|
||||
{
|
||||
m_PropertySheetHelper.SetSlot4(CT_MockingboardC);
|
||||
m_PropertySheetHelper.SetSlot5(CT_MockingboardC);
|
||||
}
|
||||
else if (m_NewCardType == CT_Phasor)
|
||||
{
|
||||
m_PropertySheetHelper.SetSlot4(CT_Phasor);
|
||||
if (g_Slot5 == CT_MockingboardC)
|
||||
m_PropertySheetHelper.SetSlot5(CT_Empty);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_PropertySheetHelper.SetSlot4(CT_Empty);
|
||||
if (g_Slot5 == CT_MockingboardC)
|
||||
m_PropertySheetHelper.SetSlot5(CT_Empty);
|
||||
}
|
||||
}
|
||||
|
||||
m_PropertySheetHelper.PostMsgAfterClose(m_Page, m_uAfterClose);
|
||||
m_PropertySheetHelper.PostMsgAfterClose(hWnd, m_Page);
|
||||
}
|
||||
|
||||
bool CPageSound::NewSoundcardConfigured(HWND window, WPARAM wparam, LPCSTR pMsg)
|
||||
void CPageSound::InitOptions(HWND hWnd)
|
||||
{
|
||||
// CheckRadioButton
|
||||
if(m_NewCardType == CT_MockingboardC)
|
||||
m_nCurrentIDCheckButton = IDC_MB_ENABLE;
|
||||
else if(m_NewCardType == CT_Phasor)
|
||||
m_nCurrentIDCheckButton = IDC_PHASOR_ENABLE;
|
||||
else
|
||||
m_nCurrentIDCheckButton = IDC_SOUNDCARD_DISABLE;
|
||||
|
||||
CheckRadioButton(hWnd, IDC_MB_ENABLE, IDC_SOUNDCARD_DISABLE, m_nCurrentIDCheckButton);
|
||||
|
||||
//
|
||||
|
||||
const SS_CARDTYPE Slot4 = m_PropertySheetHelper.GetConfigNew().m_Slot[4];
|
||||
const SS_CARDTYPE Slot5 = m_PropertySheetHelper.GetConfigNew().m_Slot[5];
|
||||
|
||||
const bool bIsSlot4Empty = Slot4 == CT_Empty;
|
||||
const bool bIsSlot5Empty = Slot5 == CT_Empty;
|
||||
|
||||
// Phasor button
|
||||
{
|
||||
const BOOL bEnable = bIsSlot4Empty || Slot4 == CT_MockingboardC;
|
||||
EnableWindow(GetDlgItem(hWnd, IDC_PHASOR_ENABLE), bEnable); // Disable Phasor (slot 4)
|
||||
}
|
||||
|
||||
// Mockingboard button
|
||||
{
|
||||
const BOOL bEnable = (bIsSlot4Empty || Slot4 == CT_Phasor) && bIsSlot5Empty;
|
||||
EnableWindow(GetDlgItem(hWnd, IDC_MB_ENABLE), bEnable); // Disable Mockingboard (slot 4 & 5)
|
||||
}
|
||||
|
||||
EnableWindow(GetDlgItem(hWnd, IDC_MB_VOLUME), (m_nCurrentIDCheckButton != IDC_SOUNDCARD_DISABLE) ? TRUE : FALSE);
|
||||
}
|
||||
|
||||
bool CPageSound::NewSoundcardConfigured(HWND hWnd, WPARAM wparam, SS_CARDTYPE NewCardType)
|
||||
{
|
||||
if (HIWORD(wparam) != BN_CLICKED)
|
||||
return false;
|
||||
|
@ -194,19 +160,27 @@ bool CPageSound::NewSoundcardConfigured(HWND window, WPARAM wparam, LPCSTR pMsg)
|
|||
if (LOWORD(wparam) == m_nCurrentIDCheckButton)
|
||||
return false;
|
||||
|
||||
if ( (MessageBox(window,
|
||||
pMsg,
|
||||
TEXT("Configuration"),
|
||||
MB_ICONQUESTION | MB_OKCANCEL | MB_SETFOREGROUND) == IDOK)
|
||||
&& m_PropertySheetHelper.IsOkToRestart(window) )
|
||||
m_NewCardType = NewCardType;
|
||||
|
||||
const SS_CARDTYPE Slot5 = m_PropertySheetHelper.GetConfigNew().m_Slot[5];
|
||||
|
||||
if (NewCardType == CT_MockingboardC)
|
||||
{
|
||||
m_nCurrentIDCheckButton = LOWORD(wparam);
|
||||
m_uAfterClose = WM_USER_RESTART;
|
||||
PropSheet_PressButton(GetParent(window), PSBTN_OK);
|
||||
return true;
|
||||
m_PropertySheetHelper.GetConfigNew().m_Slot[4] = CT_MockingboardC;
|
||||
m_PropertySheetHelper.GetConfigNew().m_Slot[5] = CT_MockingboardC;
|
||||
}
|
||||
else if (NewCardType == CT_Phasor)
|
||||
{
|
||||
m_PropertySheetHelper.GetConfigNew().m_Slot[4] = CT_Phasor;
|
||||
if (Slot5 == CT_MockingboardC)
|
||||
m_PropertySheetHelper.GetConfigNew().m_Slot[5] = CT_Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_PropertySheetHelper.GetConfigNew().m_Slot[4] = CT_Empty;
|
||||
if (Slot5 == CT_MockingboardC)
|
||||
m_PropertySheetHelper.GetConfigNew().m_Slot[5] = CT_Empty;
|
||||
}
|
||||
|
||||
// Restore original state
|
||||
CheckRadioButton(window, IDC_MB_ENABLE, IDC_SOUNDCARD_DISABLE, m_nCurrentIDCheckButton);
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -4,44 +4,42 @@
|
|||
#include "PropertySheetDefs.h"
|
||||
class CPropertySheetHelper;
|
||||
|
||||
class CPageSound : public IPropertySheetPage
|
||||
class CPageSound : private IPropertySheetPage
|
||||
{
|
||||
public:
|
||||
CPageSound(CPropertySheetHelper& PropertySheetHelper) :
|
||||
m_Page(PG_SOUND),
|
||||
m_PropertySheetHelper(PropertySheetHelper),
|
||||
m_uAfterClose(0),
|
||||
m_NewCardType(CT_Empty),
|
||||
m_SoundcardSlotChange(CARD_UNCHANGED),
|
||||
m_nCurrentIDCheckButton(0)
|
||||
{
|
||||
CPageSound::ms_this = this;
|
||||
}
|
||||
virtual ~CPageSound(){}
|
||||
|
||||
static BOOL CALLBACK DlgProc(HWND window, UINT message, WPARAM wparam, LPARAM lparam);
|
||||
static BOOL CALLBACK DlgProc(HWND hWnd, UINT message, WPARAM wparam, LPARAM lparam);
|
||||
|
||||
DWORD GetVolumeMax(void){ return VOLUME_MAX; }
|
||||
bool NewSoundcardConfigured(HWND window, WPARAM wparam, LPCSTR pMsg);
|
||||
|
||||
protected:
|
||||
// IPropertySheetPage
|
||||
virtual BOOL DlgProcInternal(HWND window, UINT message, WPARAM wparam, LPARAM lparam);
|
||||
virtual void DlgOK(HWND window);
|
||||
virtual void DlgCANCEL(HWND window){}
|
||||
virtual BOOL DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARAM lparam);
|
||||
virtual void DlgOK(HWND hWnd);
|
||||
virtual void DlgCANCEL(HWND hWnd){}
|
||||
|
||||
private:
|
||||
void InitOptions(HWND hWnd);
|
||||
bool NewSoundcardConfigured(HWND hWnd, WPARAM wparam, SS_CARDTYPE NewCardType);
|
||||
|
||||
static CPageSound* ms_this;
|
||||
|
||||
const PAGETYPE m_Page;
|
||||
CPropertySheetHelper& m_PropertySheetHelper;
|
||||
UINT m_uAfterClose;
|
||||
|
||||
static const UINT VOLUME_MIN = 0;
|
||||
static const UINT VOLUME_MAX = 59;
|
||||
static const TCHAR m_soundchoices[];
|
||||
|
||||
SS_CARDTYPE m_NewCardType;
|
||||
CARDSTATE m_SoundcardSlotChange;
|
||||
int m_nCurrentIDCheckButton;
|
||||
};
|
||||
|
|
|
@ -4,7 +4,7 @@ AppleWin : An Apple //e emulator for Windows
|
|||
Copyright (C) 1994-1996, Michael O'Brien
|
||||
Copyright (C) 1999-2001, Oliver Schmidt
|
||||
Copyright (C) 2002-2005, Tom Charlesworth
|
||||
Copyright (C) 2006-2009, Tom Charlesworth, Michael Pohoreski
|
||||
Copyright (C) 2006-2012, Tom Charlesworth, Michael Pohoreski
|
||||
|
||||
AppleWin is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -72,28 +72,29 @@ void CPropertySheet::Init(void)
|
|||
PropSheetHeader.hwndParent = g_hFrameWindow;
|
||||
PropSheetHeader.pszCaption = "AppleWin Configuration";
|
||||
PropSheetHeader.nPages = PG_NUM_SHEETS;
|
||||
PropSheetHeader.nStartPage = g_PropertySheetHelper.GetLastPage();
|
||||
PropSheetHeader.nStartPage = m_PropertySheetHelper.GetLastPage();
|
||||
PropSheetHeader.ppsp = PropSheetPages;
|
||||
|
||||
g_PropertySheetHelper.SetUIControlFreezeDlgButton(UI_UNDEFINED);
|
||||
g_PropertySheetHelper.SetUIControlCloneDropdownMenu(UI_UNDEFINED);
|
||||
int i = PropertySheet(&PropSheetHeader); // Result: 0=Cancel, 1=OK
|
||||
m_PropertySheetHelper.ResetPageMask();
|
||||
m_PropertySheetHelper.SaveCurrentConfig();
|
||||
|
||||
INT_PTR nRes = PropertySheet(&PropSheetHeader); // Result: 0=Cancel, 1=OK
|
||||
}
|
||||
|
||||
DWORD CPropertySheet::GetVolumeMax()
|
||||
{
|
||||
return g_PageSound.GetVolumeMax();
|
||||
return m_PageSound.GetVolumeMax();
|
||||
}
|
||||
|
||||
// Called when F11/F12 is pressed
|
||||
bool CPropertySheet::SaveStateSelectImage(HWND hWindow, bool bSave)
|
||||
{
|
||||
g_PropertySheetHelper.ClearSSNewDirectory();
|
||||
m_PropertySheetHelper.ClearSSNewDirectory();
|
||||
|
||||
if(g_PropertySheetHelper.SaveStateSelectImage(hWindow, bSave ? TEXT("Select Save State file")
|
||||
if(m_PropertySheetHelper.SaveStateSelectImage(hWindow, bSave ? TEXT("Select Save State file")
|
||||
: TEXT("Select Load State file"), bSave))
|
||||
{
|
||||
g_PropertySheetHelper.SaveStateUpdate();
|
||||
m_PropertySheetHelper.SaveStateUpdate();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "IPropertySheet.h"
|
||||
#include "PropertySheetHelper.h"
|
||||
#include "PageConfig.h"
|
||||
#include "PageInput.h"
|
||||
|
@ -7,38 +8,37 @@
|
|||
#include "PageDisk.h"
|
||||
#include "PageAdvanced.h"
|
||||
|
||||
extern class CPropertySheet sg_PropertySheet;
|
||||
|
||||
class CPropertySheet
|
||||
class CPropertySheet : public IPropertySheet
|
||||
{
|
||||
public:
|
||||
CPropertySheet() :
|
||||
g_PageConfig(g_PropertySheetHelper),
|
||||
g_PageInput(g_PropertySheetHelper),
|
||||
g_PageSound(g_PropertySheetHelper),
|
||||
g_PageDisk(g_PropertySheetHelper),
|
||||
g_PageAdvanced(g_PropertySheetHelper)
|
||||
{}
|
||||
m_PageConfig(m_PropertySheetHelper),
|
||||
m_PageInput(m_PropertySheetHelper),
|
||||
m_PageSound(m_PropertySheetHelper),
|
||||
m_PageDisk(m_PropertySheetHelper),
|
||||
m_PageAdvanced(m_PropertySheetHelper)
|
||||
{
|
||||
}
|
||||
virtual ~CPropertySheet(){}
|
||||
|
||||
void Init(void);
|
||||
DWORD GetVolumeMax(void); // TODO:TC: Move out of here
|
||||
bool SaveStateSelectImage(HWND hWindow, bool bSave); // TODO:TC: Move out of here
|
||||
virtual void Init(void);
|
||||
virtual DWORD GetVolumeMax(void); // TODO:TC: Move out of here
|
||||
virtual bool SaveStateSelectImage(HWND hWindow, bool bSave); // TODO:TC: Move out of here
|
||||
|
||||
UINT GetScrollLockToggle(void){ return g_PageInput.GetScrollLockToggle(); }
|
||||
void SetScrollLockToggle(UINT uValue){ g_PageInput.SetScrollLockToggle(uValue); }
|
||||
UINT GetMouseShowCrosshair(void){ return g_PageInput.GetMouseShowCrosshair(); }
|
||||
void SetMouseShowCrosshair(UINT uValue){ g_PageInput.SetMouseShowCrosshair(uValue); }
|
||||
UINT GetMouseRestrictToWindow(void){ return g_PageInput.GetMouseRestrictToWindow(); }
|
||||
void SetMouseRestrictToWindow(UINT uValue){ g_PageInput.SetMouseRestrictToWindow(uValue); }
|
||||
UINT GetTheFreezesF8Rom(void){ return g_PageAdvanced.GetTheFreezesF8Rom(); }
|
||||
void SetTheFreezesF8Rom(UINT uValue){ g_PageAdvanced.SetTheFreezesF8Rom(uValue); }
|
||||
virtual UINT GetScrollLockToggle(void){ return m_PageInput.GetScrollLockToggle(); }
|
||||
virtual void SetScrollLockToggle(UINT uValue){ m_PageInput.SetScrollLockToggle(uValue); }
|
||||
virtual UINT GetMouseShowCrosshair(void){ return m_PageInput.GetMouseShowCrosshair(); }
|
||||
virtual void SetMouseShowCrosshair(UINT uValue){ m_PageInput.SetMouseShowCrosshair(uValue); }
|
||||
virtual UINT GetMouseRestrictToWindow(void){ return m_PageInput.GetMouseRestrictToWindow(); }
|
||||
virtual void SetMouseRestrictToWindow(UINT uValue){ m_PageInput.SetMouseRestrictToWindow(uValue); }
|
||||
virtual UINT GetTheFreezesF8Rom(void){ return m_PageAdvanced.GetTheFreezesF8Rom(); }
|
||||
virtual void SetTheFreezesF8Rom(UINT uValue){ m_PageAdvanced.SetTheFreezesF8Rom(uValue); }
|
||||
|
||||
private:
|
||||
CPropertySheetHelper g_PropertySheetHelper;
|
||||
CPageConfig g_PageConfig;
|
||||
CPageInput g_PageInput;
|
||||
CPageSound g_PageSound;
|
||||
CPageDisk g_PageDisk;
|
||||
CPageAdvanced g_PageAdvanced;
|
||||
CPropertySheetHelper m_PropertySheetHelper;
|
||||
CPageConfig m_PageConfig;
|
||||
CPageInput m_PageInput;
|
||||
CPageSound m_PageSound;
|
||||
CPageDisk m_PageDisk;
|
||||
CPageAdvanced m_PageAdvanced;
|
||||
};
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#pragma once
|
||||
|
||||
enum PAGETYPE {PG_CONFIG=0, PG_INPUT, PG_SOUND, PG_DISK, PG_ADVANCED, PG_NUM_SHEETS};
|
||||
enum UICONTROLSTATE {UI_UNDEFINED, UI_DISABLE, UI_ENABLE};
|
||||
enum CARDSTATE {CARD_UNCHANGED, CARD_UNPLUGGED, CARD_INSERTED};
|
||||
|
|
|
@ -1,21 +1,95 @@
|
|||
/*
|
||||
AppleWin : An Apple //e emulator for Windows
|
||||
|
||||
Copyright (C) 1994-1996, Michael O'Brien
|
||||
Copyright (C) 1999-2001, Oliver Schmidt
|
||||
Copyright (C) 2002-2005, Tom Charlesworth
|
||||
Copyright (C) 2006-2012, Tom Charlesworth, Michael Pohoreski
|
||||
|
||||
AppleWin is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
AppleWin is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with AppleWin; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "PropertySheetHelper.h"
|
||||
#include "..\AppleWin.h" // g_nAppMode, g_uScrollLockToggle
|
||||
#include "..\AppleWin.h" // g_nAppMode, g_uScrollLockToggle, sg_PropertySheet
|
||||
#include "IPropertySheet.h"
|
||||
|
||||
/*
|
||||
Config causing AfterClose msgs:
|
||||
===============================
|
||||
|
||||
Page: Action: Comment:
|
||||
------------------------------------------------------------------------
|
||||
Config
|
||||
. Computer WM_USER_RESTART
|
||||
. Benchmark PSBTN_OK -> WM_USER_BENCHMARK Forces PSBTN_OK
|
||||
Input
|
||||
. Mouse WM_USER_RESTART
|
||||
. CP/M WM_USER_RESTART
|
||||
Sound
|
||||
. MB/Phasor/None WM_USER_RESTART
|
||||
Disk
|
||||
. Enhanced disk speed WM_USER_RESTART Why?
|
||||
. HDD enable WM_USER_RESTART
|
||||
Advanced
|
||||
. Save State WM_USER_SAVESTATE
|
||||
. Load State WM_USER_LOADSTATE
|
||||
. Clone WM_USER_RESTART
|
||||
. MrFreeze Rom WM_USER_RESTART
|
||||
|
||||
Requirements:
|
||||
-------------
|
||||
. Want to change multiple HW at once.
|
||||
. Allow change Computer & Load State (ie. multiple AfterClose msgs)
|
||||
|
||||
Design:
|
||||
-------
|
||||
. At PropSheet init, copy original config state (for above items)
|
||||
. On last Page close, compare new config state, if changed:
|
||||
- Show 1 restart + confirm msg (if necessary)
|
||||
- Cancel will rollback to original config (for above items), but other items will be applied
|
||||
. Load State button
|
||||
- Action it immediately?
|
||||
- .aws should contain config (but doesn't), so should override any config changes.
|
||||
- so this can just discard any config changes
|
||||
- if any config change, then show msg box to say they won't be applied
|
||||
. Save State button
|
||||
- Action it immediately?
|
||||
- save state applies to current config (prior to restart).
|
||||
- so this can just discard any config changes
|
||||
- if any config change, then show msg box to say they won't be applied
|
||||
. Benchmark button
|
||||
- Action it immediately (yes).
|
||||
- But apply or discard config changes?
|
||||
- Could discard & show msg box like Load/Save State (for consistency)
|
||||
*/
|
||||
|
||||
// NB. This used to be in FrameWndProc() for case WM_USER_RESTART:
|
||||
// - but this is too late to cancel, since new configurations have already been changed.
|
||||
bool CPropertySheetHelper::IsOkToRestart(HWND window)
|
||||
bool CPropertySheetHelper::IsOkToRestart(HWND hWnd)
|
||||
{
|
||||
if (g_nAppMode == MODE_LOGO)
|
||||
return true;
|
||||
|
||||
if (MessageBox(window,
|
||||
TEXT("Restarting the emulator will reset the state ")
|
||||
TEXT("of the emulated machine, causing you to lose any ")
|
||||
TEXT("unsaved work.\n\n")
|
||||
TEXT("Are you sure you want to do this?"),
|
||||
TEXT("Configuration"),
|
||||
MB_ICONQUESTION | MB_OKCANCEL | MB_SETFOREGROUND) == IDCANCEL)
|
||||
if (MessageBox(hWnd,
|
||||
TEXT("Restarting the emulator will reset the state ")
|
||||
"of the emulated machine, causing you to lose any "
|
||||
"unsaved work.\n\n"
|
||||
"Are you sure you want to do this?",
|
||||
TEXT(REG_CONFIG),
|
||||
MB_ICONQUESTION | MB_OKCANCEL | MB_SETFOREGROUND) == IDCANCEL)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
@ -201,9 +275,240 @@ int CPropertySheetHelper::SaveStateSelectImage(HWND hWindow, TCHAR* pszTitle, bo
|
|||
}
|
||||
|
||||
// On OK: Optionally post a single "uAfterClose" msg after last page closes
|
||||
void CPropertySheetHelper::PostMsgAfterClose(PAGETYPE page, UINT uAfterClose)
|
||||
void CPropertySheetHelper::PostMsgAfterClose(HWND hWnd, PAGETYPE page)
|
||||
{
|
||||
m_bmPages &= ~(1<<(UINT32)page);
|
||||
if (m_bmPages == 0 && uAfterClose)
|
||||
if (m_bmPages)
|
||||
return; // Still pages to close
|
||||
|
||||
//
|
||||
|
||||
UINT uAfterClose = 0;
|
||||
|
||||
if (m_ConfigNew.m_uSaveLoadStateMsg)
|
||||
{
|
||||
// Drop any state change, and do load/save state
|
||||
PostMessage(g_hFrameWindow, m_ConfigNew.m_uSaveLoadStateMsg, 0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_ConfigNew != m_ConfigOld)
|
||||
{
|
||||
if (!CheckChangesForRestart(hWnd))
|
||||
{
|
||||
// Cancelled
|
||||
RestoreCurrentConfig();
|
||||
return;
|
||||
}
|
||||
|
||||
ApplyNewConfig();
|
||||
|
||||
uAfterClose = WM_USER_RESTART;
|
||||
}
|
||||
|
||||
if (m_ConfigNew.m_bDoBenchmark)
|
||||
{
|
||||
uAfterClose = WM_USER_BENCHMARK; // which implies WM_USER_RESTART
|
||||
m_ConfigNew = m_ConfigOld.m_bDoBenchmark;
|
||||
}
|
||||
|
||||
if (uAfterClose)
|
||||
PostMessage(g_hFrameWindow, uAfterClose, 0, 0);
|
||||
}
|
||||
|
||||
bool CPropertySheetHelper::CheckChangesForRestart(HWND hWnd)
|
||||
{
|
||||
if (!HardwareConfigChanged(hWnd))
|
||||
return false; // Cancelled
|
||||
|
||||
if (!IsOkToRestart(hWnd))
|
||||
return false; // Cancelled
|
||||
|
||||
return true; // OK
|
||||
}
|
||||
|
||||
#define CONFIG_CHANGED(var) \
|
||||
(m_ConfigOld.var != m_ConfigNew.var)
|
||||
|
||||
// Apply changes to Registry
|
||||
void CPropertySheetHelper::ApplyNewConfig(void)
|
||||
{
|
||||
if (CONFIG_CHANGED(m_Apple2Type))
|
||||
{
|
||||
SaveComputerType(m_ConfigNew.m_Apple2Type);
|
||||
g_Apple2Type = m_ConfigNew.m_Apple2Type; // Is this necessary?
|
||||
}
|
||||
|
||||
if (CONFIG_CHANGED(m_Slot[4]))
|
||||
SetSlot4(m_ConfigNew.m_Slot[4]);
|
||||
|
||||
if (CONFIG_CHANGED(m_Slot[5]))
|
||||
SetSlot5(m_ConfigNew.m_Slot[5]);
|
||||
|
||||
if (m_ConfigNew.m_Slot[4] == CT_MockingboardC || m_ConfigNew.m_Slot[4] == CT_Phasor)
|
||||
{
|
||||
MB_SetSoundcardType(m_ConfigNew.m_Slot[4]); // Is this necessary?
|
||||
}
|
||||
else
|
||||
{
|
||||
MB_SetSoundcardType(CT_Empty); // Is this necessary?
|
||||
}
|
||||
|
||||
if (CONFIG_CHANGED(m_bEnhanceDisk))
|
||||
REGSAVE(TEXT(REGVALUE_ENHANCE_DISK_SPEED), m_ConfigNew.m_bEnhanceDisk);
|
||||
|
||||
if (CONFIG_CHANGED(m_bEnableHDD))
|
||||
{
|
||||
REGSAVE(TEXT(REGVALUE_HDD_ENABLED), m_ConfigNew.m_bEnableHDD ? 1 : 0);
|
||||
HD_SetEnabled(m_ConfigNew.m_bEnableHDD); // Is this necessary?
|
||||
}
|
||||
|
||||
if (CONFIG_CHANGED(m_bEnableTheFreezesF8Rom))
|
||||
{
|
||||
REGSAVE(TEXT(REGVALUE_THE_FREEZES_F8_ROM), m_ConfigNew.m_bEnableTheFreezesF8Rom);
|
||||
sg_PropertySheet.SetTheFreezesF8Rom(m_ConfigNew.m_bEnableTheFreezesF8Rom); // Is this necessary?
|
||||
}
|
||||
}
|
||||
|
||||
void CPropertySheetHelper::SaveCurrentConfig(void)
|
||||
{
|
||||
// NB. clone-type is encoded in g_Apple2Type
|
||||
m_ConfigOld.m_Apple2Type = g_Apple2Type;
|
||||
m_ConfigOld.m_Slot[4] = g_Slot4;
|
||||
m_ConfigOld.m_Slot[5] = g_Slot5;
|
||||
m_ConfigOld.m_bEnhanceDisk = enhancedisk;
|
||||
m_ConfigOld.m_bEnableHDD = HD_CardIsEnabled();
|
||||
m_ConfigOld.m_bEnableTheFreezesF8Rom = sg_PropertySheet.GetTheFreezesF8Rom();
|
||||
|
||||
// Reset flags each time:
|
||||
m_ConfigOld.m_bDoBenchmark = false;
|
||||
m_ConfigOld.m_uSaveLoadStateMsg = 0;
|
||||
|
||||
// Setup ConfigNew
|
||||
m_ConfigNew = m_ConfigOld;
|
||||
}
|
||||
|
||||
void CPropertySheetHelper::RestoreCurrentConfig(void)
|
||||
{
|
||||
// NB. clone-type is encoded in g_Apple2Type
|
||||
g_Apple2Type = m_ConfigOld.m_Apple2Type;
|
||||
g_Slot4 = m_ConfigOld.m_Slot[4];
|
||||
g_Slot5 = m_ConfigOld.m_Slot[5];
|
||||
enhancedisk = m_ConfigOld.m_bEnhanceDisk;
|
||||
HD_SetEnabled(m_ConfigOld.m_bEnableHDD);
|
||||
sg_PropertySheet.SetTheFreezesF8Rom(m_ConfigOld.m_bEnableTheFreezesF8Rom);
|
||||
}
|
||||
|
||||
bool CPropertySheetHelper::HardwareConfigChanged(HWND hWnd)
|
||||
{
|
||||
std::string strMsg("The emulator needs to restart as the hardware configuration has changed:\n");
|
||||
strMsg += "\n";
|
||||
|
||||
std::string strMsgMain;
|
||||
{
|
||||
if (CONFIG_CHANGED(m_Apple2Type))
|
||||
strMsgMain += ". Emulated computer has changed\n";
|
||||
|
||||
if (CONFIG_CHANGED(m_Slot[4]))
|
||||
strMsgMain += GetSlot(4);
|
||||
|
||||
if (CONFIG_CHANGED(m_Slot[5]))
|
||||
strMsgMain += GetSlot(5);
|
||||
|
||||
if (CONFIG_CHANGED(m_bEnhanceDisk))
|
||||
strMsgMain += ". Floppy disk speed setting has changed\n";
|
||||
|
||||
if (CONFIG_CHANGED(m_bEnableHDD))
|
||||
strMsgMain += ". Harddisk(s) have been plugged/unplugged\n";
|
||||
|
||||
if (CONFIG_CHANGED(m_bEnableTheFreezesF8Rom))
|
||||
strMsgMain += ". F8 ROM changed (The Freeze's F8 Rom)\n";
|
||||
}
|
||||
|
||||
if (strMsgMain.empty())
|
||||
{
|
||||
_ASSERT(0);
|
||||
}
|
||||
|
||||
std::string strMsgPost("\n");
|
||||
strMsgPost += "This change will not take effect until the next time you restart the emulator.\n\n";
|
||||
strMsgPost += "Would you like to restart the emulator now?";
|
||||
|
||||
strMsg += strMsgMain;
|
||||
strMsg += strMsgPost;
|
||||
|
||||
if (MessageBox(hWnd,
|
||||
strMsg.c_str(),
|
||||
TEXT(REG_CONFIG),
|
||||
MB_ICONQUESTION | MB_OKCANCEL | MB_SETFOREGROUND) == IDCANCEL)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string CPropertySheetHelper::GetSlot(const UINT uSlot)
|
||||
{
|
||||
// strMsg = ". Slot n: ";
|
||||
std::string strMsg(". Slot ");
|
||||
strMsg += '0' + uSlot;
|
||||
strMsg += ": ";
|
||||
|
||||
const SS_CARDTYPE OldCardType = m_ConfigOld.m_Slot[uSlot];
|
||||
const SS_CARDTYPE NewCardType = m_ConfigNew.m_Slot[uSlot];
|
||||
|
||||
if ((OldCardType == CT_Empty) || (NewCardType == CT_Empty))
|
||||
{
|
||||
if (NewCardType == CT_Empty)
|
||||
{
|
||||
strMsg += GetCardName(OldCardType);
|
||||
strMsg += " card removed\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
strMsg += GetCardName(NewCardType);
|
||||
strMsg += " card added\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
strMsg += GetCardName(OldCardType);
|
||||
strMsg += " card removed & ";
|
||||
strMsg += GetCardName(NewCardType);
|
||||
strMsg += " card added\n";
|
||||
}
|
||||
|
||||
return strMsg;
|
||||
}
|
||||
|
||||
std::string CPropertySheetHelper::GetCardName(const SS_CARDTYPE CardType)
|
||||
{
|
||||
switch (CardType)
|
||||
{
|
||||
case CT_Empty:
|
||||
return "Empty";
|
||||
case CT_Disk2: // Apple Disk][
|
||||
return "Disk][";
|
||||
case CT_SSC: // Apple Super Serial Card
|
||||
return "Super Serial";
|
||||
case CT_MockingboardC: // Soundcard
|
||||
return "Mockingboard";
|
||||
case CT_GenericPrinter:
|
||||
return "Printer";
|
||||
case CT_GenericHDD: // Hard disk
|
||||
return "Hard Disk";
|
||||
case CT_GenericClock:
|
||||
return "Clock";
|
||||
case CT_MouseInterface:
|
||||
return "Mouse";
|
||||
case CT_Z80:
|
||||
return "CP/M";
|
||||
case CT_Phasor: // Soundcard
|
||||
return "Phasor";
|
||||
case CT_Echo: // Soundcard
|
||||
return "Echo";
|
||||
case CT_SAM: // Soundcard: Software Automated Mouth
|
||||
return "SAM";
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
#include "PropertySheetDefs.h"
|
||||
#include "Config.h"
|
||||
|
||||
class CPropertySheetHelper
|
||||
{
|
||||
|
@ -7,23 +8,20 @@ public:
|
|||
CPropertySheetHelper() :
|
||||
m_LastPage(PG_CONFIG),
|
||||
m_bmPages(0),
|
||||
m_UIControlFreezeDlgButton(UI_UNDEFINED),
|
||||
m_UIControlCloneDropdownMenu(UI_UNDEFINED),
|
||||
m_bSSNewFilename(false)
|
||||
{}
|
||||
virtual ~CPropertySheetHelper(){}
|
||||
|
||||
bool IsOkToRestart(HWND window);
|
||||
void FillComboBox(HWND window, int controlid, LPCTSTR choices, int currentchoice);
|
||||
void SaveComputerType(eApple2Type NewApple2Type);
|
||||
void SetSlot4(SS_CARDTYPE NewCardType);
|
||||
void SetSlot5(SS_CARDTYPE NewCardType);
|
||||
string BrowseToFile(HWND hWindow, TCHAR* pszTitle, TCHAR* REGVALUE,TCHAR* FILEMASKS);
|
||||
void SaveStateUpdate();
|
||||
void GetDiskBaseNameWithAWS(TCHAR* pszFilename);
|
||||
int SaveStateSelectImage(HWND hWindow, TCHAR* pszTitle, bool bSave);
|
||||
void PostMsgAfterClose(PAGETYPE page, UINT uAfterClose);
|
||||
void PostMsgAfterClose(HWND hWnd, PAGETYPE page);
|
||||
|
||||
void ResetPageMask(void) { m_bmPages = 0; } // Req'd because cancelling doesn't clear the page-mask
|
||||
PAGETYPE GetLastPage(void) { return m_LastPage; }
|
||||
void SetLastPage(PAGETYPE page)
|
||||
{
|
||||
|
@ -31,20 +29,28 @@ public:
|
|||
m_bmPages |= 1<<(UINT32)page;
|
||||
}
|
||||
|
||||
UICONTROLSTATE GetUIControlFreezeDlgButton(void) { return m_UIControlFreezeDlgButton; }
|
||||
void SetUIControlFreezeDlgButton(UICONTROLSTATE state) { m_UIControlFreezeDlgButton = state; }
|
||||
UICONTROLSTATE GetUIControlCloneDropdownMenu(void) { return m_UIControlCloneDropdownMenu; }
|
||||
void SetUIControlCloneDropdownMenu(UICONTROLSTATE state) { m_UIControlCloneDropdownMenu = state; }
|
||||
void SaveCurrentConfig(void);
|
||||
char* GetSSNewFilename(void) { return &m_szSSNewFilename[0]; }
|
||||
void ClearSSNewDirectory(void) { m_szSSNewDirectory[0] = 0; }
|
||||
// const CConfigNeedingRestart& GetConfigOld(void) { return m_ConfigOld; }
|
||||
CConfigNeedingRestart& GetConfigNew(void) { return m_ConfigNew; }
|
||||
|
||||
private:
|
||||
bool IsOkToRestart(HWND hWnd);
|
||||
void SaveComputerType(eApple2Type NewApple2Type);
|
||||
bool HardwareConfigChanged(HWND hWnd);
|
||||
bool CheckChangesForRestart(HWND hWnd);
|
||||
void ApplyNewConfig(void);
|
||||
void RestoreCurrentConfig(void);
|
||||
std::string GetSlot(const UINT uSlot);
|
||||
std::string GetCardName(const SS_CARDTYPE CardType);
|
||||
|
||||
PAGETYPE m_LastPage;
|
||||
UINT32 m_bmPages;
|
||||
UICONTROLSTATE m_UIControlFreezeDlgButton;
|
||||
UICONTROLSTATE m_UIControlCloneDropdownMenu;
|
||||
char m_szNewFilename[MAX_PATH];
|
||||
bool m_bSSNewFilename;
|
||||
char m_szSSNewDirectory[MAX_PATH];
|
||||
char m_szSSNewFilename[MAX_PATH];
|
||||
CConfigNeedingRestart m_ConfigOld;
|
||||
CConfigNeedingRestart m_ConfigNew;
|
||||
};
|
||||
|
|
|
@ -265,6 +265,7 @@ void HD_SetEnabled(const bool bEnabled)
|
|||
|
||||
g_bHD_Enabled = bEnabled;
|
||||
|
||||
#if 0
|
||||
// FIXME: For LoadConfiguration(), g_uSlot=7 (see definition at start of file)
|
||||
// . g_uSlot is only really setup by HD_Load_Rom(), later on
|
||||
RegisterIoHandler(g_uSlot, HD_IO_EMUL, HD_IO_EMUL, NULL, NULL, NULL, NULL);
|
||||
|
@ -279,6 +280,7 @@ void HD_SetEnabled(const bool bEnabled)
|
|||
HD_Load_Rom(pCxRomPeripheral, g_uSlot);
|
||||
else
|
||||
memset(pCxRomPeripheral + g_uSlot*256, 0, HDDRVR_SIZE);
|
||||
#endif
|
||||
}
|
||||
|
||||
//-------------------------------------
|
||||
|
@ -324,6 +326,8 @@ VOID HD_Load_Rom(const LPBYTE pCxRomPeripheral, const UINT uSlot)
|
|||
g_uSlot = uSlot;
|
||||
memcpy(pCxRomPeripheral + uSlot*256, pData, HDDRVR_SIZE);
|
||||
g_bHD_RomLoaded = true;
|
||||
|
||||
RegisterIoHandler(g_uSlot, HD_IO_EMUL, HD_IO_EMUL, NULL, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
VOID HD_Cleanup(void)
|
||||
|
|
Loading…
Reference in New Issue
Block a user