mirror of
https://github.com/AppleWin/AppleWin.git
synced 2024-06-12 11:29:29 +00:00
Split the old PropertySheetPage.cpp into a .cpp module per Page & moved them into Configuration subfolder.
This commit is contained in:
parent
f92c0ab523
commit
be71f901e0
|
@ -653,14 +653,6 @@
|
|||
RelativePath=".\source\ParallelPrinter.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\PropertySheetPage.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\PropertySheetPage.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\Registry.cpp"
|
||||
>
|
||||
|
@ -846,6 +838,82 @@
|
|||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Configuration"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\source\Configuration\IPropertySheetPage.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\Configuration\PageAdvanced.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\Configuration\PageAdvanced.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\Configuration\PageConfig.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\Configuration\PageConfig.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\Configuration\PageConfigTfe.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\Configuration\PageConfigTfe.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\Configuration\PageDisk.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\Configuration\PageDisk.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\Configuration\PageInput.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\Configuration\PageInput.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\Configuration\PageSound.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\Configuration\PageSound.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\Configuration\PropertySheet.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\Configuration\PropertySheet.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\Configuration\PropertySheetDefs.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\Configuration\PropertySheetHelper.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\Configuration\PropertySheetHelper.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Docs"
|
||||
|
|
|
@ -36,6 +36,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
#ifdef USE_SPEECH_API
|
||||
#include "Speech.h"
|
||||
#endif
|
||||
#include "Configuration\PropertySheet.h"
|
||||
#include "Tfe\Tfe.h"
|
||||
|
||||
char VERSIONSTRING[16] = "xx.yy.zz.ww";
|
||||
|
||||
|
@ -80,6 +82,7 @@ FILE* g_fh = NULL;
|
|||
bool g_bDisableDirectSound = false;
|
||||
bool g_bDisableDirectSoundMockingboard = false;
|
||||
|
||||
CPropertySheet sg_PropertySheet;
|
||||
CSuperSerialCard sg_SSC;
|
||||
CMouseInterface sg_Mouse;
|
||||
|
||||
|
@ -155,7 +158,7 @@ void ContinueExecution()
|
|||
|
||||
//
|
||||
|
||||
bool bScrollLock_FullSpeed = g_uScrollLockToggle
|
||||
bool bScrollLock_FullSpeed = sg_PropertySheet.GetScrollLockToggle()
|
||||
? g_bScrollLock_FullSpeed
|
||||
: (GetKeyState(VK_SCROLL) < 0);
|
||||
|
||||
|
@ -484,13 +487,13 @@ void LoadConfiguration()
|
|||
DWORD dwTmp;
|
||||
|
||||
if(REGLOAD(TEXT(REGVALUE_THE_FREEZES_F8_ROM), &dwTmp))
|
||||
g_uTheFreezesF8Rom = dwTmp;
|
||||
sg_PropertySheet.SetTheFreezesF8Rom(dwTmp);
|
||||
|
||||
if(REGLOAD(TEXT(REGVALUE_SPKR_VOLUME), &dwTmp))
|
||||
SpkrSetVolume(dwTmp, PSP_GetVolumeMax());
|
||||
SpkrSetVolume(dwTmp, sg_PropertySheet.GetVolumeMax());
|
||||
|
||||
if(REGLOAD(TEXT(REGVALUE_MB_VOLUME), &dwTmp))
|
||||
MB_SetVolume(dwTmp, PSP_GetVolumeMax());
|
||||
MB_SetVolume(dwTmp, sg_PropertySheet.GetVolumeMax());
|
||||
|
||||
if(REGLOAD(TEXT(REGVALUE_SAVE_STATE_ON_EXIT), &dwTmp))
|
||||
g_bSaveStateOnExit = dwTmp ? true : false;
|
||||
|
@ -524,12 +527,12 @@ void LoadConfiguration()
|
|||
JoySetTrim((short)dwTmp, false);
|
||||
|
||||
if(REGLOAD(TEXT(REGVALUE_SCROLLLOCK_TOGGLE), &dwTmp))
|
||||
g_uScrollLockToggle = dwTmp;
|
||||
sg_PropertySheet.SetScrollLockToggle(dwTmp);
|
||||
|
||||
if(REGLOAD(TEXT(REGVALUE_MOUSE_CROSSHAIR), &dwTmp))
|
||||
g_uMouseShowCrosshair = dwTmp;
|
||||
sg_PropertySheet.SetMouseShowCrosshair(dwTmp);
|
||||
if(REGLOAD(TEXT(REGVALUE_MOUSE_RESTRICT_TO_WINDOW), &dwTmp))
|
||||
g_uMouseRestrictToWindow = dwTmp;
|
||||
sg_PropertySheet.SetMouseRestrictToWindow(dwTmp);
|
||||
|
||||
if(REGLOAD(TEXT(REGVALUE_SLOT4), &dwTmp))
|
||||
g_Slot4 = (SS_CARDTYPE) dwTmp;
|
||||
|
|
|
@ -43,7 +43,6 @@ extern FILE* g_fh; // Filehandle for log file
|
|||
extern bool g_bDisableDirectSound; // Cmd line switch: don't init DS (so no MB/Speaker support)
|
||||
extern bool g_bDisableDirectSoundMockingboard; // Cmd line switch: don't init MB support
|
||||
|
||||
// TODO: Make g_CurrentPeripherals[MAX_SLOTS] = { CT_Empty }
|
||||
extern SS_CARDTYPE g_Slot4; // Mockingboard, Z80, Mouse in slot4
|
||||
extern SS_CARDTYPE g_Slot5; // Mockingboard, Z80, in slot5
|
||||
|
||||
|
|
13
AppleWin/source/Configuration/IPropertySheetPage.h
Normal file
13
AppleWin/source/Configuration/IPropertySheetPage.h
Normal file
|
@ -0,0 +1,13 @@
|
|||
#pragma once
|
||||
|
||||
class IPropertySheetPage
|
||||
{
|
||||
public:
|
||||
IPropertySheetPage(){}
|
||||
virtual ~IPropertySheetPage(){}
|
||||
|
||||
protected:
|
||||
virtual BOOL DlgProcInternal(HWND window, UINT message, WPARAM wparam, LPARAM lparam) = 0;
|
||||
virtual void DlgOK(HWND window, UINT afterclose) = 0;
|
||||
virtual void DlgCANCEL(HWND window) = 0;
|
||||
};
|
284
AppleWin/source/Configuration/PageAdvanced.cpp
Normal file
284
AppleWin/source/Configuration/PageAdvanced.cpp
Normal file
|
@ -0,0 +1,284 @@
|
|||
#include "StdAfx.h"
|
||||
#include "PageAdvanced.h"
|
||||
#include "PropertySheetHelper.h"
|
||||
#include "..\resource\resource.h"
|
||||
|
||||
CPageAdvanced* CPageAdvanced::ms_this = 0; // reinit'd in ctor
|
||||
|
||||
//static bool g_bConfirmedRestartEmulator = false;
|
||||
|
||||
enum CLONECHOICE {MENUITEM_CLONEMIN, MENUITEM_PRAVETS82=MENUITEM_CLONEMIN, MENUITEM_PRAVETS8M, MENUITEM_PRAVETS8A, MENUITEM_CLONEMAX};
|
||||
const TCHAR CPageAdvanced::m_CloneChoices[] =
|
||||
TEXT("Pravets 82\0") // Bulgarian
|
||||
TEXT("Pravets 8M\0") // Bulgarian
|
||||
TEXT("Pravets 8A\0"); // Bulgarian
|
||||
|
||||
|
||||
BOOL CALLBACK CPageAdvanced::DlgProc(HWND window, UINT message, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
// Switch from static func to our instance
|
||||
return CPageAdvanced::ms_this->DlgProcInternal(window, message, wparam, lparam);
|
||||
}
|
||||
|
||||
BOOL CPageAdvanced::DlgProcInternal(HWND window, UINT message, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
static UINT afterclose = 0;
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case WM_NOTIFY:
|
||||
{
|
||||
// Property Sheet notifications
|
||||
|
||||
switch (((LPPSHNOTIFY)lparam)->hdr.code)
|
||||
{
|
||||
case PSN_SETACTIVE:
|
||||
// About to become the active page
|
||||
InitFreezeDlgButton(window);
|
||||
InitCloneDropdownMenu(window);
|
||||
break;
|
||||
case PSN_KILLACTIVE:
|
||||
SetWindowLong(window, DWL_MSGRESULT, FALSE); // Changes are valid
|
||||
break;
|
||||
case PSN_APPLY:
|
||||
DlgOK(window, afterclose);
|
||||
SetWindowLong(window, 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);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wparam))
|
||||
{
|
||||
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());
|
||||
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());
|
||||
}
|
||||
break;
|
||||
case IDC_SAVESTATE_ON_EXIT:
|
||||
break;
|
||||
case IDC_SAVESTATE:
|
||||
afterclose = WM_USER_SAVESTATE;
|
||||
break;
|
||||
case IDC_LOADSTATE:
|
||||
afterclose = 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;
|
||||
afterclose = WM_USER_RESTART;
|
||||
PropSheet_PressButton(GetParent(window), PSBTN_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
CheckDlgButton(window, IDC_THE_FREEZES_F8_ROM_FW, m_uTheFreezesF8Rom ? BST_CHECKED : BST_UNCHECKED);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_INITDIALOG: //Init advanced settings dialog
|
||||
{
|
||||
m_PropertySheetHelper.SetLastPage(m_Page);
|
||||
|
||||
SendDlgItemMessage(window,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());
|
||||
|
||||
InitFreezeDlgButton(window);
|
||||
InitCloneDropdownMenu(window);
|
||||
|
||||
m_PropertySheetHelper.ClearSSNewDirectory();
|
||||
|
||||
// Need to specific cmd-line switch: -printer-real to enable this control
|
||||
EnableWindow(GetDlgItem(window, IDC_DUMPTOPRINTER), g_bEnableDumpToRealPrinter ? TRUE : FALSE);
|
||||
|
||||
afterclose = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void CPageAdvanced::DlgOK(HWND window, UINT afterclose)
|
||||
{
|
||||
// Update save-state filename
|
||||
{
|
||||
char szFilename[MAX_PATH];
|
||||
memset(szFilename, 0, sizeof(szFilename));
|
||||
* (USHORT*) szFilename = sizeof(szFilename);
|
||||
|
||||
UINT nLineLength = SendDlgItemMessage(window, IDC_SAVESTATE_FILENAME, EM_LINELENGTH, 0, 0);
|
||||
|
||||
SendDlgItemMessage(window, IDC_SAVESTATE_FILENAME, EM_GETLINE, 0, (LPARAM)szFilename);
|
||||
|
||||
nLineLength = nLineLength > sizeof(szFilename)-1 ? sizeof(szFilename)-1 : nLineLength;
|
||||
szFilename[nLineLength] = 0x00;
|
||||
|
||||
m_PropertySheetHelper.SaveStateUpdate();
|
||||
}
|
||||
|
||||
// Update printer dump filename
|
||||
{
|
||||
char szFilename[MAX_PATH];
|
||||
memset(szFilename, 0, sizeof(szFilename));
|
||||
* (USHORT*) szFilename = sizeof(szFilename);
|
||||
|
||||
UINT nLineLength = SendDlgItemMessage(window, IDC_PRINTER_DUMP_FILENAME, EM_LINELENGTH, 0, 0);
|
||||
|
||||
SendDlgItemMessage(window, IDC_PRINTER_DUMP_FILENAME, EM_GETLINE, 0, (LPARAM)szFilename);
|
||||
|
||||
nLineLength = nLineLength > sizeof(szFilename)-1 ? sizeof(szFilename)-1 : nLineLength;
|
||||
szFilename[nLineLength] = 0x00;
|
||||
|
||||
Printer_SetFilename(szFilename);
|
||||
RegSaveString(TEXT(REG_CONFIG), REGVALUE_PRINTER_FILENAME, 1, Printer_GetFilename());
|
||||
}
|
||||
|
||||
g_bSaveStateOnExit = IsDlgButtonChecked(window, 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;
|
||||
REGSAVE(TEXT(REGVALUE_DUMP_TO_PRINTER), g_bDumpToPrinter ? 1 : 0);
|
||||
|
||||
g_bConvertEncoding = IsDlgButtonChecked(window, 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;
|
||||
REGSAVE(TEXT(REGVALUE_FILTER_UNPRINTABLE), g_bFilterUnprintable ? 1 : 0);
|
||||
|
||||
g_bPrinterAppend = IsDlgButtonChecked(window, 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));
|
||||
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);
|
||||
|
||||
// Second msgbox fails:
|
||||
// . Config tab: Change to 'Clone'
|
||||
// . Advanced tab: Change clone type, then OK
|
||||
// . ConfigDlg_OK() msgbox asks "restart now?", click OK
|
||||
// . AdvancedDlg_OK() msgbox fails: GetLastError(): ERROR_INVALID_WINDOW_HANDLE; 1400 (0x578)
|
||||
// - Probably because ConfigDlg_OK() has already posted WM_USER_RESTART
|
||||
// - So I added g_bConfirmedRestartEmulator
|
||||
if (IS_CLONE() || (m_PropertySheetHelper.GetUIControlCloneDropdownMenu() == UI_ENABLE))
|
||||
{
|
||||
if (NewCloneType != g_Apple2Type)
|
||||
{
|
||||
if ((afterclose == WM_USER_RESTART) || // Eg. Changing 'Freeze ROM' & user has already OK'd the restart for this
|
||||
// g_bConfirmedRestartEmulator || // See above
|
||||
((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)) )
|
||||
{
|
||||
afterclose = WM_USER_RESTART;
|
||||
m_PropertySheetHelper.SaveComputerType(NewCloneType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (g_Apple2Type > A2TYPE_APPLE2PLUS)
|
||||
m_uTheFreezesF8Rom = 0;
|
||||
|
||||
//
|
||||
|
||||
// if (g_bConfirmedRestartEmulator)
|
||||
// return; // ConfigDlg_OK() has already posted WM_USER_RESTART
|
||||
|
||||
if (afterclose)
|
||||
PostMessage(g_hFrameWindow,afterclose,0,0);
|
||||
}
|
||||
|
||||
// Advanced->Clone: Menu item to eApple2Type
|
||||
eApple2Type CPageAdvanced::GetCloneType(DWORD NewMenuItem)
|
||||
{
|
||||
switch (NewMenuItem)
|
||||
{
|
||||
case MENUITEM_PRAVETS82: return A2TYPE_PRAVETS82;
|
||||
case MENUITEM_PRAVETS8M: return A2TYPE_PRAVETS8M;
|
||||
case MENUITEM_PRAVETS8A: return A2TYPE_PRAVETS8A;
|
||||
default: return A2TYPE_PRAVETS82;
|
||||
}
|
||||
}
|
||||
|
||||
int CPageAdvanced::GetCloneMenuItem(void)
|
||||
{
|
||||
if (!IS_CLONE())
|
||||
return MENUITEM_CLONEMIN;
|
||||
|
||||
int nMenuItem = g_Apple2Type - A2TYPE_PRAVETS;
|
||||
if (nMenuItem < 0 || nMenuItem >= MENUITEM_CLONEMAX)
|
||||
return MENUITEM_CLONEMIN;
|
||||
|
||||
return nMenuItem;
|
||||
}
|
||||
|
||||
void CPageAdvanced::InitFreezeDlgButton(HWND window)
|
||||
{
|
||||
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);
|
||||
|
||||
CheckDlgButton(window, IDC_THE_FREEZES_F8_ROM_FW, m_uTheFreezesF8Rom ? BST_CHECKED : BST_UNCHECKED);
|
||||
}
|
||||
|
||||
void CPageAdvanced::InitCloneDropdownMenu(HWND window)
|
||||
{
|
||||
// Set clone menu choice (ok even if it's not a clone)
|
||||
int nCurrentChoice = GetCloneMenuItem();
|
||||
m_PropertySheetHelper.FillComboBox(window, 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);
|
||||
}
|
42
AppleWin/source/Configuration/PageAdvanced.h
Normal file
42
AppleWin/source/Configuration/PageAdvanced.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
#pragma once
|
||||
|
||||
#include "IPropertySheetPage.h"
|
||||
#include "PropertySheetDefs.h"
|
||||
class CPropertySheetHelper;
|
||||
|
||||
class CPageAdvanced : public IPropertySheetPage
|
||||
{
|
||||
public:
|
||||
CPageAdvanced(CPropertySheetHelper& PropertySheetHelper) :
|
||||
m_Page(PG_ADVANCED),
|
||||
m_PropertySheetHelper(PropertySheetHelper),
|
||||
m_uTheFreezesF8Rom(0)
|
||||
{
|
||||
CPageAdvanced::ms_this = this;
|
||||
}
|
||||
virtual ~CPageAdvanced(){}
|
||||
|
||||
static BOOL CALLBACK DlgProc(HWND window, 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, UINT afterclose);
|
||||
virtual void DlgCANCEL(HWND window){}
|
||||
|
||||
private:
|
||||
eApple2Type GetCloneType(DWORD NewMenuItem);
|
||||
int GetCloneMenuItem(void);
|
||||
void InitFreezeDlgButton(HWND window);
|
||||
void InitCloneDropdownMenu(HWND window);
|
||||
|
||||
static CPageAdvanced* ms_this;
|
||||
static const TCHAR m_CloneChoices[];
|
||||
|
||||
const PAGETYPE m_Page;
|
||||
CPropertySheetHelper& m_PropertySheetHelper;
|
||||
UINT m_uTheFreezesF8Rom;
|
||||
};
|
278
AppleWin/source/Configuration/PageConfig.cpp
Normal file
278
AppleWin/source/Configuration/PageConfig.cpp
Normal file
|
@ -0,0 +1,278 @@
|
|||
#include "StdAfx.h"
|
||||
#include "PageConfig.h"
|
||||
#include "PropertySheetHelper.h"
|
||||
#include "..\resource\resource.h"
|
||||
|
||||
CPageConfig* CPageConfig::ms_this = 0; // reinit'd in ctor
|
||||
|
||||
enum APPLEIICHOICE {MENUITEM_IIORIGINAL, MENUITEM_IIPLUS, MENUITEM_IIE, MENUITEM_ENHANCEDIIE, MENUITEM_CLONE};
|
||||
const TCHAR CPageConfig::m_ComputerChoices[] =
|
||||
TEXT("Apple ][ (Original)\0")
|
||||
TEXT("Apple ][+\0")
|
||||
TEXT("Apple //e\0")
|
||||
TEXT("Enhanced Apple //e\0")
|
||||
TEXT("Clone\0");
|
||||
|
||||
BOOL CALLBACK CPageConfig::DlgProc(HWND window, UINT message, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
// Switch from static func to our instance
|
||||
return CPageConfig::ms_this->DlgProcInternal(window, message, wparam, lparam);
|
||||
}
|
||||
|
||||
BOOL CPageConfig::DlgProcInternal(HWND window, UINT message, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
static UINT afterclose = 0;
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case WM_NOTIFY:
|
||||
{
|
||||
// Property Sheet notifications
|
||||
|
||||
switch (((LPPSHNOTIFY)lparam)->hdr.code)
|
||||
{
|
||||
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
|
||||
}
|
||||
break;
|
||||
case PSN_APPLY:
|
||||
DlgOK(window, afterclose);
|
||||
SetWindowLong(window, 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);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wparam))
|
||||
{
|
||||
case IDC_AUTHENTIC_SPEED: // Authentic Machine Speed
|
||||
SendDlgItemMessage(window,IDC_SLIDER_CPU_SPEED,TBM_SETPOS,1,SPEED_NORMAL);
|
||||
EnableTrackbar(window,0);
|
||||
break;
|
||||
|
||||
case IDC_CUSTOM_SPEED: // Select Custom Speed
|
||||
SetFocus(GetDlgItem(window,IDC_SLIDER_CPU_SPEED));
|
||||
EnableTrackbar(window,1);
|
||||
break;
|
||||
|
||||
case IDC_SLIDER_CPU_SPEED: // CPU speed slider
|
||||
CheckRadioButton(window,IDC_AUTHENTIC_SPEED,IDC_CUSTOM_SPEED,IDC_CUSTOM_SPEED);
|
||||
EnableTrackbar(window,1);
|
||||
break;
|
||||
|
||||
case IDC_BENCHMARK:
|
||||
afterclose = WM_USER_BENCHMARK;
|
||||
PropSheet_PressButton(GetParent(window), PSBTN_OK);
|
||||
break;
|
||||
|
||||
case IDC_ETHERNET:
|
||||
ui_tfe_settings_dialog(window);
|
||||
break;
|
||||
|
||||
case IDC_MONOCOLOR:
|
||||
VideoChooseColor();
|
||||
break;
|
||||
|
||||
case IDC_CHECK_HALF_SCAN_LINES:
|
||||
g_uHalfScanLines = IsDlgButtonChecked(window, IDC_CHECK_HALF_SCAN_LINES) ? 1 : 0;
|
||||
|
||||
#if 0
|
||||
case IDC_RECALIBRATE:
|
||||
RegSaveValue(TEXT(""),TEXT("RunningOnOS"),0,0);
|
||||
if (MessageBox(window,
|
||||
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"),
|
||||
MB_ICONQUESTION | MB_OKCANCEL | MB_SETFOREGROUND) == IDOK)
|
||||
{
|
||||
afterclose = WM_USER_RESTART;
|
||||
PropSheet_PressButton(GetParent(window), PSBTN_OK);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
} // switch( (LOWORD(wparam))
|
||||
break; // WM_COMMAND
|
||||
|
||||
case WM_HSCROLL:
|
||||
CheckRadioButton(window, IDC_AUTHENTIC_SPEED, IDC_CUSTOM_SPEED, IDC_CUSTOM_SPEED); // FirstButton, LastButton, CheckButton
|
||||
break;
|
||||
|
||||
case WM_INITDIALOG: //Init general settings dialog
|
||||
{
|
||||
m_PropertySheetHelper.SetLastPage(m_Page);
|
||||
|
||||
// Convert Apple2 type to menu item
|
||||
{
|
||||
int nCurrentChoice = 0;
|
||||
switch (g_Apple2Type)
|
||||
{
|
||||
case A2TYPE_APPLE2: nCurrentChoice = MENUITEM_IIORIGINAL; break;
|
||||
case A2TYPE_APPLE2PLUS: nCurrentChoice = MENUITEM_IIPLUS; break;
|
||||
case A2TYPE_APPLE2E: nCurrentChoice = MENUITEM_IIE; break;
|
||||
case A2TYPE_APPLE2EEHANCED: nCurrentChoice = MENUITEM_ENHANCEDIIE; break;
|
||||
case A2TYPE_PRAVETS82: nCurrentChoice = MENUITEM_CLONE; break;
|
||||
case A2TYPE_PRAVETS8M: nCurrentChoice = MENUITEM_CLONE; break;
|
||||
case A2TYPE_PRAVETS8A: nCurrentChoice = MENUITEM_CLONE; break;
|
||||
}
|
||||
|
||||
m_PropertySheetHelper.FillComboBox(window, 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(window,IDC_SERIALPORT, sg_SSC.GetSerialPortChoices(), sg_SSC.GetSerialPort());
|
||||
EnableWindow(GetDlgItem(window, 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);
|
||||
|
||||
{
|
||||
BOOL bCustom = TRUE;
|
||||
if (g_dwSpeed == SPEED_NORMAL)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
afterclose = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_LBUTTONDOWN:
|
||||
{
|
||||
POINT pt = { LOWORD(lparam), HIWORD(lparam) };
|
||||
ClientToScreen(window,&pt);
|
||||
RECT rect;
|
||||
GetWindowRect(GetDlgItem(window,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));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_SYSCOLORCHANGE:
|
||||
SendDlgItemMessage(window,IDC_SLIDER_CPU_SPEED,WM_SYSCOLORCHANGE,0,0);
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void CPageConfig::DlgOK(HWND window, UINT afterclose)
|
||||
{
|
||||
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 ((afterclose == 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)) )
|
||||
{
|
||||
//g_bConfirmedRestartEmulator = true;
|
||||
afterclose = WM_USER_RESTART;
|
||||
m_PropertySheetHelper.SaveComputerType(NewApple2Type);
|
||||
}
|
||||
}
|
||||
|
||||
if (g_eVideoType != newvidtype)
|
||||
{
|
||||
g_eVideoType = newvidtype;
|
||||
VideoReinitialize();
|
||||
if ((g_nAppMode != MODE_LOGO) && (g_nAppMode != MODE_DEBUG))
|
||||
{
|
||||
VideoRedrawScreen();
|
||||
}
|
||||
}
|
||||
|
||||
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"),
|
||||
TEXT(REGVALUE_SERIAL_PORT_NAME),
|
||||
TRUE,
|
||||
sg_SSC.GetSerialPortName() );
|
||||
|
||||
REGSAVE(TEXT(REGVALUE_CUSTOM_SPEED) ,IsDlgButtonChecked(window,IDC_CUSTOM_SPEED));
|
||||
REGSAVE(TEXT(REGVALUE_EMULATION_SPEED) ,g_dwSpeed);
|
||||
|
||||
Config_Save_Video();
|
||||
|
||||
//
|
||||
|
||||
if (afterclose)
|
||||
PostMessage(g_hFrameWindow,afterclose,0,0);
|
||||
}
|
||||
|
||||
// Config->Computer: Menu item to eApple2Type
|
||||
eApple2Type CPageConfig::GetApple2Type(DWORD NewMenuItem)
|
||||
{
|
||||
switch (NewMenuItem)
|
||||
{
|
||||
case MENUITEM_IIORIGINAL: return A2TYPE_APPLE2;
|
||||
case MENUITEM_IIPLUS: return A2TYPE_APPLE2PLUS;
|
||||
case MENUITEM_IIE: return A2TYPE_APPLE2E;
|
||||
case MENUITEM_ENHANCEDIIE: return A2TYPE_APPLE2EEHANCED;
|
||||
case MENUITEM_CLONE: return A2TYPE_CLONE;
|
||||
default: return A2TYPE_APPLE2EEHANCED;
|
||||
}
|
||||
}
|
||||
|
||||
void CPageConfig::EnableTrackbar(HWND window, 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);
|
||||
}
|
||||
|
||||
|
||||
void CPageConfig::ui_tfe_settings_dialog(HWND hwnd)
|
||||
{
|
||||
DialogBox(g_hInstance, (LPCTSTR)IDD_TFE_SETTINGS_DIALOG, hwnd, CPageConfigTfe::DlgProc);
|
||||
}
|
38
AppleWin/source/Configuration/PageConfig.h
Normal file
38
AppleWin/source/Configuration/PageConfig.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
#pragma once
|
||||
|
||||
#include "IPropertySheetPage.h"
|
||||
#include "PropertySheetDefs.h"
|
||||
#include "PageConfigTfe.h"
|
||||
class CPropertySheetHelper;
|
||||
|
||||
class CPageConfig : public IPropertySheetPage
|
||||
{
|
||||
public:
|
||||
CPageConfig(CPropertySheetHelper& PropertySheetHelper) :
|
||||
m_Page(PG_CONFIG),
|
||||
m_PropertySheetHelper(PropertySheetHelper)
|
||||
{
|
||||
CPageConfig::ms_this = this;
|
||||
}
|
||||
virtual ~CPageConfig(){}
|
||||
|
||||
static BOOL CALLBACK DlgProc(HWND window, UINT message, WPARAM wparam, LPARAM lparam);
|
||||
|
||||
protected:
|
||||
// IPropertySheetPage
|
||||
virtual BOOL DlgProcInternal(HWND window, UINT message, WPARAM wparam, LPARAM lparam);
|
||||
virtual void DlgOK(HWND window, UINT afterclose);
|
||||
virtual void DlgCANCEL(HWND window){}
|
||||
|
||||
private:
|
||||
eApple2Type GetApple2Type(DWORD NewMenuItem);
|
||||
void EnableTrackbar(HWND window, BOOL enable);
|
||||
void ui_tfe_settings_dialog(HWND hwnd);
|
||||
|
||||
static CPageConfig* ms_this;
|
||||
static const TCHAR m_ComputerChoices[];
|
||||
|
||||
const PAGETYPE m_Page;
|
||||
CPropertySheetHelper& m_PropertySheetHelper;
|
||||
CPageConfigTfe m_PageConfigTfe;
|
||||
};
|
269
AppleWin/source/Configuration/PageConfigTfe.cpp
Normal file
269
AppleWin/source/Configuration/PageConfigTfe.cpp
Normal file
|
@ -0,0 +1,269 @@
|
|||
#include "StdAfx.h"
|
||||
#include "PageConfigTfe.h"
|
||||
#include "..\resource\resource.h"
|
||||
#include "..\Tfe\Tfe.h"
|
||||
#include "..\Tfe\Tfesupp.h"
|
||||
|
||||
CPageConfigTfe* CPageConfigTfe::ms_this = 0; // reinit'd in ctor
|
||||
|
||||
uilib_localize_dialog_param CPageConfigTfe::ms_dialog[] =
|
||||
{
|
||||
{0, IDS_TFE_CAPTION, -1},
|
||||
{IDC_TFE_SETTINGS_ENABLE_T, IDS_TFE_ETHERNET, 0},
|
||||
{IDC_TFE_SETTINGS_INTERFACE_T, IDS_TFE_INTERFACE, 0},
|
||||
{IDOK, IDS_OK, 0},
|
||||
{IDCANCEL, IDS_CANCEL, 0},
|
||||
{0, 0, 0}
|
||||
};
|
||||
|
||||
uilib_dialog_group CPageConfigTfe::ms_leftgroup[] =
|
||||
{
|
||||
{IDC_TFE_SETTINGS_ENABLE_T, 0},
|
||||
{IDC_TFE_SETTINGS_INTERFACE_T, 0},
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
uilib_dialog_group CPageConfigTfe::ms_rightgroup[] =
|
||||
{
|
||||
{IDC_TFE_SETTINGS_ENABLE, 0},
|
||||
{IDC_TFE_SETTINGS_INTERFACE, 0},
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
BOOL CALLBACK CPageConfigTfe::DlgProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
// Switch from static func to our instance
|
||||
return CPageConfigTfe::ms_this->DlgProcInternal(hwnd, msg, wparam, lparam);
|
||||
}
|
||||
|
||||
BOOL CPageConfigTfe::DlgProcInternal(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
switch (msg)
|
||||
{
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wparam))
|
||||
{
|
||||
case IDOK:
|
||||
DlgOK(hwnd, 0);
|
||||
/* FALL THROUGH */
|
||||
|
||||
case IDCANCEL:
|
||||
DlgCANCEL(hwnd);
|
||||
return TRUE;
|
||||
|
||||
case IDC_TFE_SETTINGS_INTERFACE:
|
||||
/* FALL THROUGH */
|
||||
|
||||
case IDC_TFE_SETTINGS_ENABLE:
|
||||
gray_ungray_items(hwnd);
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
|
||||
case WM_CLOSE:
|
||||
EndDialog(hwnd,0);
|
||||
return TRUE;
|
||||
|
||||
case WM_INITDIALOG:
|
||||
init_tfe_dialog(hwnd);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void CPageConfigTfe::DlgOK(HWND window, UINT afterclose)
|
||||
{
|
||||
save_tfe_dialog(window);
|
||||
}
|
||||
|
||||
void CPageConfigTfe::DlgCANCEL(HWND window)
|
||||
{
|
||||
EndDialog(window, 0);
|
||||
}
|
||||
|
||||
BOOL CPageConfigTfe::get_tfename(int number, char **ppname, char **ppdescription)
|
||||
{
|
||||
if (tfe_enumadapter_open())
|
||||
{
|
||||
char *pname = NULL;
|
||||
char *pdescription = NULL;
|
||||
|
||||
while (number--)
|
||||
{
|
||||
if (!tfe_enumadapter(&pname, &pdescription))
|
||||
break;
|
||||
|
||||
lib_free(pname);
|
||||
lib_free(pdescription);
|
||||
}
|
||||
|
||||
if (tfe_enumadapter(&pname, &pdescription))
|
||||
{
|
||||
*ppname = pname;
|
||||
*ppdescription = pdescription;
|
||||
tfe_enumadapter_close();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
tfe_enumadapter_close();
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int CPageConfigTfe::gray_ungray_items(HWND hwnd)
|
||||
{
|
||||
int enable;
|
||||
int number;
|
||||
|
||||
int disabled = 0;
|
||||
|
||||
//resources_get_value("ETHERNET_DISABLED", (void *)&disabled);
|
||||
REGLOAD(TEXT("Uthernet Disabled") ,(DWORD *)&disabled);
|
||||
get_disabled_state(&disabled);
|
||||
|
||||
if (disabled)
|
||||
{
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_TFE_SETTINGS_ENABLE_T), 0);
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_TFE_SETTINGS_ENABLE), 0);
|
||||
EnableWindow(GetDlgItem(hwnd, IDOK), 0);
|
||||
SetWindowText(GetDlgItem(hwnd,IDC_TFE_SETTINGS_INTERFACE_NAME), "");
|
||||
SetWindowText(GetDlgItem(hwnd,IDC_TFE_SETTINGS_INTERFACE_DESC), "");
|
||||
enable = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
enable = SendMessage(GetDlgItem(hwnd, IDC_TFE_SETTINGS_ENABLE), CB_GETCURSEL, 0, 0) ? 1 : 0;
|
||||
}
|
||||
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_TFE_SETTINGS_INTERFACE_T), enable);
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_TFE_SETTINGS_INTERFACE), enable);
|
||||
|
||||
if (enable)
|
||||
{
|
||||
char *pname = NULL;
|
||||
char *pdescription = NULL;
|
||||
|
||||
number = SendMessage(GetDlgItem(hwnd, IDC_TFE_SETTINGS_INTERFACE), CB_GETCURSEL, 0, 0);
|
||||
|
||||
if (get_tfename(number, &pname, &pdescription))
|
||||
{
|
||||
SetWindowText(GetDlgItem(hwnd, IDC_TFE_SETTINGS_INTERFACE_NAME), pname);
|
||||
SetWindowText(GetDlgItem(hwnd, IDC_TFE_SETTINGS_INTERFACE_DESC), pdescription);
|
||||
lib_free(pname);
|
||||
lib_free(pdescription);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SetWindowText(GetDlgItem(hwnd, IDC_TFE_SETTINGS_INTERFACE_NAME), "");
|
||||
SetWindowText(GetDlgItem(hwnd, IDC_TFE_SETTINGS_INTERFACE_DESC), "");
|
||||
}
|
||||
|
||||
return disabled ? 1 : 0;
|
||||
}
|
||||
|
||||
void CPageConfigTfe::init_tfe_dialog(HWND hwnd)
|
||||
{
|
||||
HWND temp_hwnd;
|
||||
int active_value;
|
||||
|
||||
int tfe_enable;
|
||||
int xsize, ysize;
|
||||
|
||||
char *interface_name = NULL;
|
||||
|
||||
uilib_get_group_extent(hwnd, ms_leftgroup, &xsize, &ysize);
|
||||
uilib_adjust_group_width(hwnd, ms_leftgroup);
|
||||
uilib_move_group(hwnd, ms_rightgroup, xsize + 30);
|
||||
|
||||
//resources_get_value("ETHERNET_ACTIVE", (void *)&tfe_enabled);
|
||||
get_tfe_enabled(&tfe_enable);
|
||||
|
||||
//resources_get_value("ETHERNET_AS_RR", (void *)&tfe_as_rr_net);
|
||||
active_value = (tfe_enable ? 1 : 0);
|
||||
|
||||
temp_hwnd=GetDlgItem(hwnd,IDC_TFE_SETTINGS_ENABLE);
|
||||
SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"Disabled");
|
||||
SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"Uthernet");
|
||||
SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)active_value, 0);
|
||||
|
||||
//resources_get_value("ETHERNET_INTERFACE", (void *)&interface_name);
|
||||
interface_name = (char *) get_tfe_interface();
|
||||
|
||||
if (tfe_enumadapter_open())
|
||||
{
|
||||
int cnt = 0;
|
||||
|
||||
char *pname;
|
||||
char *pdescription;
|
||||
|
||||
temp_hwnd=GetDlgItem(hwnd,IDC_TFE_SETTINGS_INTERFACE);
|
||||
|
||||
for (cnt = 0; tfe_enumadapter(&pname, &pdescription); cnt++)
|
||||
{
|
||||
BOOL this_entry = FALSE;
|
||||
|
||||
if (strcmp(pname, interface_name) == 0)
|
||||
{
|
||||
this_entry = TRUE;
|
||||
}
|
||||
|
||||
SetWindowText(GetDlgItem(hwnd, IDC_TFE_SETTINGS_INTERFACE_NAME), pname);
|
||||
SetWindowText(GetDlgItem(hwnd, IDC_TFE_SETTINGS_INTERFACE_DESC), pdescription);
|
||||
SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)pname);
|
||||
lib_free(pname);
|
||||
lib_free(pdescription);
|
||||
|
||||
if (this_entry)
|
||||
{
|
||||
SendMessage(GetDlgItem(hwnd, IDC_TFE_SETTINGS_INTERFACE),
|
||||
CB_SETCURSEL, (WPARAM)cnt, 0);
|
||||
}
|
||||
}
|
||||
|
||||
tfe_enumadapter_close();
|
||||
}
|
||||
|
||||
if (gray_ungray_items(hwnd))
|
||||
{
|
||||
/* we have a problem: TFE is disabled. Give a message to the user */
|
||||
MessageBox( hwnd,
|
||||
"TFE support is not available on your system,\n"
|
||||
"there is some important part missing. Please have a\n"
|
||||
"look at the VICE knowledge base support page\n"
|
||||
"\n http://vicekb.trikaliotis.net/13-005\n\n"
|
||||
"for possible reasons and to activate networking with VICE.",
|
||||
"TFE support", MB_ICONINFORMATION|MB_OK);
|
||||
|
||||
/* just quit the dialog before it is open */
|
||||
SendMessage( hwnd, WM_COMMAND, IDCANCEL, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void CPageConfigTfe::save_tfe_dialog(HWND hwnd)
|
||||
{
|
||||
int active_value;
|
||||
int tfe_enabled;
|
||||
char buffer[256];
|
||||
|
||||
buffer[255] = 0;
|
||||
GetDlgItemText(hwnd, IDC_TFE_SETTINGS_INTERFACE, buffer, sizeof(buffer)-1);
|
||||
|
||||
// RGJ - Added check for NULL interface so we don't set it active without a valid interface selected
|
||||
if (strlen(buffer) > 0)
|
||||
{
|
||||
RegSaveString(TEXT("Configuration"), TEXT("Uthernet Interface"), 1, buffer);
|
||||
|
||||
active_value = SendMessage(GetDlgItem(hwnd, IDC_TFE_SETTINGS_ENABLE), CB_GETCURSEL, 0, 0);
|
||||
|
||||
tfe_enabled = active_value >= 1 ? 1 : 0;
|
||||
REGSAVE(TEXT("Uthernet Active") ,tfe_enabled);
|
||||
}
|
||||
else
|
||||
{
|
||||
REGSAVE(TEXT("Uthernet Active") ,0);
|
||||
}
|
||||
}
|
||||
|
33
AppleWin/source/Configuration/PageConfigTfe.h
Normal file
33
AppleWin/source/Configuration/PageConfigTfe.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
#pragma once
|
||||
|
||||
#include "IPropertySheetPage.h"
|
||||
#include "..\Tfe\Uilib.h"
|
||||
|
||||
class CPageConfigTfe : public IPropertySheetPage
|
||||
{
|
||||
public:
|
||||
CPageConfigTfe()
|
||||
{
|
||||
CPageConfigTfe::ms_this = this;
|
||||
}
|
||||
virtual ~CPageConfigTfe(){}
|
||||
|
||||
static BOOL CALLBACK DlgProc(HWND window, UINT message, WPARAM wparam, LPARAM lparam);
|
||||
|
||||
protected:
|
||||
// IPropertySheetPage
|
||||
virtual BOOL DlgProcInternal(HWND window, UINT message, WPARAM wparam, LPARAM lparam);
|
||||
virtual void DlgOK(HWND window, UINT afterclose);
|
||||
virtual void DlgCANCEL(HWND window);
|
||||
|
||||
private:
|
||||
BOOL CPageConfigTfe::get_tfename(int number, char **ppname, char **ppdescription);
|
||||
int CPageConfigTfe::gray_ungray_items(HWND hwnd);
|
||||
void CPageConfigTfe::init_tfe_dialog(HWND hwnd);
|
||||
void CPageConfigTfe::save_tfe_dialog(HWND hwnd);
|
||||
|
||||
static CPageConfigTfe* ms_this;
|
||||
static uilib_localize_dialog_param ms_dialog[];
|
||||
static uilib_dialog_group ms_leftgroup[];
|
||||
static uilib_dialog_group ms_rightgroup[];
|
||||
};
|
258
AppleWin/source/Configuration/PageDisk.cpp
Normal file
258
AppleWin/source/Configuration/PageDisk.cpp
Normal file
|
@ -0,0 +1,258 @@
|
|||
#include "StdAfx.h"
|
||||
#include "PageDisk.h"
|
||||
#include "PropertySheetHelper.h"
|
||||
#include "..\Harddisk.h"
|
||||
#include "..\resource\resource.h"
|
||||
|
||||
CPageDisk* CPageDisk::ms_this = 0; // reinit'd in ctor
|
||||
|
||||
const TCHAR CPageDisk::m_discchoices[] =
|
||||
TEXT("Authentic Speed\0")
|
||||
TEXT("Enhanced Speed\0");
|
||||
|
||||
|
||||
BOOL CALLBACK CPageDisk::DlgProc(HWND window, UINT message, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
// Switch from static func to our instance
|
||||
return CPageDisk::ms_this->DlgProcInternal(window, message, wparam, lparam);
|
||||
}
|
||||
|
||||
BOOL CPageDisk::DlgProcInternal(HWND window, UINT message, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
static UINT afterclose = 0;
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case WM_NOTIFY:
|
||||
{
|
||||
// Property Sheet notifications
|
||||
|
||||
switch (((LPPSHNOTIFY)lparam)->hdr.code)
|
||||
{
|
||||
case PSN_KILLACTIVE:
|
||||
SetWindowLong(window, DWL_MSGRESULT, FALSE); // Changes are valid
|
||||
break;
|
||||
case PSN_APPLY:
|
||||
DlgOK(window, afterclose);
|
||||
SetWindowLong(window, 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);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wparam))
|
||||
{
|
||||
case IDC_DISK1:
|
||||
DiskSelect(DRIVE_1);
|
||||
SendDlgItemMessage(window, 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));
|
||||
FrameRefreshStatus(DRAW_BUTTON_DRIVES);
|
||||
break;
|
||||
|
||||
case IDC_HDD1:
|
||||
if(IsDlgButtonChecked(window, IDC_HDD_ENABLE))
|
||||
{
|
||||
HD_Select(HARDDISK_1);
|
||||
SendDlgItemMessage(window, IDC_EDIT_HDD1, WM_SETTEXT, 0, (LPARAM)HD_GetFullName(HARDDISK_1));
|
||||
}
|
||||
break;
|
||||
|
||||
case IDC_HDD2:
|
||||
if(IsDlgButtonChecked(window, IDC_HDD_ENABLE))
|
||||
{
|
||||
HD_Select(HARDDISK_2);
|
||||
SendDlgItemMessage(window, IDC_EDIT_HDD2, WM_SETTEXT, 0, (LPARAM)HD_GetFullName(HARDDISK_2));
|
||||
}
|
||||
break;
|
||||
|
||||
case IDC_HDD_ENABLE:
|
||||
EnableHDD(window, IsDlgButtonChecked(window, 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());
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_INITDIALOG: //Init disk settings dialog
|
||||
{
|
||||
m_PropertySheetHelper.SetLastPage(m_Page);
|
||||
|
||||
m_PropertySheetHelper.FillComboBox(window,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(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));
|
||||
|
||||
//
|
||||
|
||||
TCHAR PathToCiderPress[MAX_PATH] = "";
|
||||
RegLoadString(TEXT("Configuration"), REGVALUE_CIDERPRESSLOC, 1, PathToCiderPress,MAX_PATH);
|
||||
SendDlgItemMessage(window,IDC_CIDERPRESS_FILENAME ,WM_SETTEXT,0,(LPARAM)PathToCiderPress);
|
||||
|
||||
//
|
||||
|
||||
CheckDlgButton(window, IDC_HDD_ENABLE, HD_CardIsEnabled() ? BST_CHECKED : BST_UNCHECKED);
|
||||
|
||||
EnableHDD(window, IsDlgButtonChecked(window, IDC_HDD_ENABLE));
|
||||
|
||||
afterclose = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_RBUTTONUP:
|
||||
{
|
||||
RECT rect; // client area
|
||||
POINT pt; // location of mouse click
|
||||
|
||||
// Get the bounding rectangle of the client area.
|
||||
GetClientRect(window, (LPRECT) &rect);
|
||||
|
||||
// Get the client coordinates for the mouse click.
|
||||
pt.x = GET_X_LPARAM(lparam);
|
||||
pt.y = GET_Y_LPARAM(lparam);
|
||||
|
||||
// If the mouse click took place inside the client
|
||||
// area, execute the application-defined function
|
||||
// that displays the shortcut menu.
|
||||
if (PtInRect((LPRECT) &rect, pt))
|
||||
{
|
||||
// Load the menu template containing the shortcut menu from the application's resources.
|
||||
HMENU hMenu = LoadMenu(g_hInstance, MAKEINTRESOURCE(IDR_MENU_DISK_CFG_POPUP)); // menu template
|
||||
_ASSERT(hMenu);
|
||||
if (!hMenu)
|
||||
break;
|
||||
|
||||
// Get the first shortcut menu in the menu template.
|
||||
// This is the menu that TrackPopupMenu displays.
|
||||
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);
|
||||
|
||||
if (Disk_IsDriveEmpty(DRIVE_1))
|
||||
EnableMenuItem(hMenu, ID_DISKMENU_EJECT_DISK1, MF_GRAYED);
|
||||
if (Disk_IsDriveEmpty(DRIVE_2))
|
||||
EnableMenuItem(hMenu, ID_DISKMENU_EJECT_DISK2, MF_GRAYED);
|
||||
if (HD_IsDriveUnplugged(HARDDISK_1))
|
||||
EnableMenuItem(hMenu, ID_DISKMENU_UNPLUG_HARDDISK1, MF_GRAYED);
|
||||
if (HD_IsDriveUnplugged(HARDDISK_2))
|
||||
EnableMenuItem(hMenu, ID_DISKMENU_UNPLUG_HARDDISK2, MF_GRAYED);
|
||||
|
||||
// Draw and track the shortcut menu.
|
||||
int iCommand = TrackPopupMenu(
|
||||
hMenuTrackPopup
|
||||
, TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_RETURNCMD
|
||||
, pt.x, pt.y
|
||||
, 0
|
||||
, window, NULL );
|
||||
|
||||
if (iCommand)
|
||||
{
|
||||
TCHAR szText[100];
|
||||
bool bMsgBox = true;
|
||||
if (iCommand == ID_DISKMENU_EJECT_DISK1 || iCommand == ID_DISKMENU_EJECT_DISK2)
|
||||
wsprintf(szText, "Do you really want to eject the disk in drive-%c ?", '1'+iCommand-ID_DISKMENU_EJECT_DISK1);
|
||||
else if (iCommand == ID_DISKMENU_UNPLUG_HARDDISK1 || iCommand == ID_DISKMENU_UNPLUG_HARDDISK2)
|
||||
wsprintf(szText, "Do you really want to unplug harddisk-%c ?", '1'+iCommand-ID_DISKMENU_UNPLUG_HARDDISK1);
|
||||
else
|
||||
bMsgBox = false;
|
||||
|
||||
if (bMsgBox)
|
||||
{
|
||||
int nRes = MessageBox(g_hFrameWindow, szText, TEXT("Eject/Unplug Warning"), MB_ICONWARNING | MB_OKCANCEL | MB_SETFOREGROUND);
|
||||
if (nRes == IDNO)
|
||||
iCommand = 0;
|
||||
}
|
||||
}
|
||||
|
||||
switch (iCommand)
|
||||
{
|
||||
case ID_DISKMENU_EJECT_DISK1:
|
||||
DiskEject(DRIVE_1);
|
||||
SendDlgItemMessage(window, 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));
|
||||
break;
|
||||
case ID_DISKMENU_UNPLUG_HARDDISK1:
|
||||
HD_Unplug(HARDDISK_1);
|
||||
SendDlgItemMessage(window, 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));
|
||||
break;
|
||||
}
|
||||
|
||||
if (iCommand != 0)
|
||||
FrameRefreshStatus(DRAW_BUTTON_DRIVES);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void CPageDisk::DlgOK(HWND window, UINT afterclose)
|
||||
{
|
||||
BOOL newdisktype = (BOOL) SendDlgItemMessage(window,IDC_DISKTYPE,CB_GETCURSEL,0,0);
|
||||
|
||||
if (newdisktype != 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)
|
||||
afterclose = WM_USER_RESTART;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
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));
|
||||
|
||||
//
|
||||
|
||||
if (afterclose)
|
||||
PostMessage(g_hFrameWindow,afterclose,0,0);
|
||||
}
|
||||
|
||||
void CPageDisk::EnableHDD(HWND window, BOOL bEnable)
|
||||
{
|
||||
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);
|
||||
}
|
34
AppleWin/source/Configuration/PageDisk.h
Normal file
34
AppleWin/source/Configuration/PageDisk.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
#pragma once
|
||||
|
||||
#include "IPropertySheetPage.h"
|
||||
#include "PropertySheetDefs.h"
|
||||
class CPropertySheetHelper;
|
||||
|
||||
class CPageDisk : public IPropertySheetPage
|
||||
{
|
||||
public:
|
||||
CPageDisk(CPropertySheetHelper& PropertySheetHelper) :
|
||||
m_Page(PG_DISK),
|
||||
m_PropertySheetHelper(PropertySheetHelper)
|
||||
{
|
||||
CPageDisk::ms_this = this;
|
||||
}
|
||||
virtual ~CPageDisk(){}
|
||||
|
||||
static BOOL CALLBACK DlgProc(HWND window, UINT message, WPARAM wparam, LPARAM lparam);
|
||||
|
||||
protected:
|
||||
// IPropertySheetPage
|
||||
virtual BOOL DlgProcInternal(HWND window, UINT message, WPARAM wparam, LPARAM lparam);
|
||||
virtual void DlgOK(HWND window, UINT afterclose);
|
||||
virtual void DlgCANCEL(HWND window){}
|
||||
|
||||
private:
|
||||
void EnableHDD(HWND window, BOOL bEnable);
|
||||
|
||||
static CPageDisk* ms_this;
|
||||
static const TCHAR m_discchoices[];
|
||||
|
||||
const PAGETYPE m_Page;
|
||||
CPropertySheetHelper& m_PropertySheetHelper;
|
||||
};
|
432
AppleWin/source/Configuration/PageInput.cpp
Normal file
432
AppleWin/source/Configuration/PageInput.cpp
Normal file
|
@ -0,0 +1,432 @@
|
|||
#include "StdAfx.h"
|
||||
#include "PageInput.h"
|
||||
#include "PropertySheetHelper.h"
|
||||
#include "..\resource\resource.h"
|
||||
|
||||
CPageInput* CPageInput::ms_this = 0; // reinit'd in ctor
|
||||
|
||||
const TCHAR CPageInput::m_szJoyChoice0[] = TEXT("Disabled\0");
|
||||
const TCHAR CPageInput::m_szJoyChoice1[] = TEXT("PC Joystick #1\0");
|
||||
const TCHAR CPageInput::m_szJoyChoice2[] = TEXT("PC Joystick #2\0");
|
||||
const TCHAR CPageInput::m_szJoyChoice3[] = TEXT("Keyboard (standard)\0");
|
||||
const TCHAR CPageInput::m_szJoyChoice4[] = TEXT("Keyboard (centering)\0");
|
||||
const TCHAR CPageInput::m_szJoyChoice5[] = TEXT("Mouse\0");
|
||||
|
||||
const TCHAR* const CPageInput::m_pszJoy0Choices[J0C_MAX] = {
|
||||
CPageInput::m_szJoyChoice0,
|
||||
CPageInput::m_szJoyChoice1, // PC Joystick #1
|
||||
CPageInput::m_szJoyChoice3,
|
||||
CPageInput::m_szJoyChoice4,
|
||||
CPageInput::m_szJoyChoice5 };
|
||||
|
||||
const TCHAR* const CPageInput::m_pszJoy1Choices[J1C_MAX] = {
|
||||
CPageInput::m_szJoyChoice0,
|
||||
CPageInput::m_szJoyChoice2, // PC Joystick #2
|
||||
CPageInput::m_szJoyChoice3,
|
||||
CPageInput::m_szJoyChoice4,
|
||||
CPageInput::m_szJoyChoice5 };
|
||||
|
||||
const TCHAR CPageInput::m_szCPMSlotChoice_Slot4[] = TEXT("Slot 4\0");
|
||||
const TCHAR CPageInput::m_szCPMSlotChoice_Slot5[] = TEXT("Slot 5\0");
|
||||
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)
|
||||
{
|
||||
// Switch from static func to our instance
|
||||
return CPageInput::ms_this->DlgProcInternal(window, message, wparam, lparam);
|
||||
}
|
||||
|
||||
BOOL CPageInput::DlgProcInternal(HWND window, UINT message, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
static UINT afterclose = 0;
|
||||
m_MousecardSlotChange = CARD_UNCHANGED;
|
||||
m_CPMcardSlotChange = CARD_UNCHANGED;
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case WM_NOTIFY:
|
||||
{
|
||||
// Property Sheet notifications
|
||||
|
||||
switch (((LPPSHNOTIFY)lparam)->hdr.code)
|
||||
{
|
||||
case PSN_KILLACTIVE:
|
||||
SetWindowLong(window, DWL_MSGRESULT, FALSE); // Changes are valid
|
||||
break;
|
||||
case PSN_APPLY:
|
||||
DlgOK(window, afterclose);
|
||||
SetWindowLong(window, 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);
|
||||
break;
|
||||
|
||||
/* // Could use this to display PDL() value
|
||||
case UDN_DELTAPOS:
|
||||
LPNMUPDOWN lpnmud = (LPNMUPDOWN) lparam;
|
||||
if (lpnmud->hdr.idFrom == IDC_SPIN_XTRIM)
|
||||
{
|
||||
static int x = 0;
|
||||
x = lpnmud->iPos + lpnmud->iDelta;
|
||||
x = SendDlgItemMessage(window, 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);
|
||||
}
|
||||
break;
|
||||
*/
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wparam))
|
||||
{
|
||||
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
|
||||
}
|
||||
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
|
||||
}
|
||||
break;
|
||||
|
||||
case IDC_SCROLLLOCK_TOGGLE:
|
||||
m_uScrollLockToggle = IsDlgButtonChecked(window, 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;
|
||||
|
||||
if (uNewState) // Redundant, since restarting
|
||||
{
|
||||
JoyDisableUsingMouse();
|
||||
InitJoystickChoices(window, JN_JOYSTICK0, IDC_JOYSTICK0);
|
||||
InitJoystickChoices(window, JN_JOYSTICK1, IDC_JOYSTICK1);
|
||||
}
|
||||
|
||||
afterclose = 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);
|
||||
}
|
||||
}
|
||||
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];
|
||||
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;
|
||||
|
||||
afterclose = WM_USER_RESTART;
|
||||
PropSheet_PressButton(GetParent(window), PSBTN_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
InitCPMChoices(window); // Restore original state
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case IDC_PASTE_FROM_CLIPBOARD:
|
||||
ClipboardInitiatePaste();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_INITDIALOG: //Init input settings dialog
|
||||
{
|
||||
m_PropertySheetHelper.SetLastPage(m_Page);
|
||||
|
||||
InitJoystickChoices(window, JN_JOYSTICK0, IDC_JOYSTICK0);
|
||||
InitJoystickChoices(window, 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(window, IDC_SPIN_XTRIM, UDM_SETPOS, 0, MAKELONG(JoyGetTrim(true),0));
|
||||
SendDlgItemMessage(window, IDC_SPIN_YTRIM, UDM_SETPOS, 0, MAKELONG(JoyGetTrim(false),0));
|
||||
|
||||
CheckDlgButton(window, 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);
|
||||
|
||||
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);
|
||||
|
||||
afterclose = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void CPageInput::DlgOK(HWND window, UINT afterclose)
|
||||
{
|
||||
UINT uNewJoyType0 = SendDlgItemMessage(window,IDC_JOYSTICK0,CB_GETCURSEL,0,0);
|
||||
UINT uNewJoyType1 = SendDlgItemMessage(window,IDC_JOYSTICK1,CB_GETCURSEL,0,0);
|
||||
|
||||
if (!JoySetEmulationType(window, m_nJoy0ChoiceTranlationTbl[uNewJoyType0], JN_JOYSTICK0))
|
||||
{
|
||||
//afterclose = 0; // TC: does nothing
|
||||
return;
|
||||
}
|
||||
|
||||
if (!JoySetEmulationType(window, m_nJoy1ChoiceTranlationTbl[uNewJoyType1], JN_JOYSTICK1))
|
||||
{
|
||||
//afterclose = 0; // TC: does nothing
|
||||
return;
|
||||
}
|
||||
|
||||
JoySetTrim((short)SendDlgItemMessage(window, IDC_SPIN_XTRIM, UDM_GETPOS, 0, 0), true);
|
||||
JoySetTrim((short)SendDlgItemMessage(window, 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;
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
if (afterclose)
|
||||
PostMessage(g_hFrameWindow,afterclose,0,0);
|
||||
}
|
||||
|
||||
void CPageInput::InitJoystickChoices(HWND window, int nJoyNum, int nIdcValue)
|
||||
{
|
||||
TCHAR *pszMem;
|
||||
int nIdx;
|
||||
unsigned long i;
|
||||
|
||||
TCHAR* pnzJoystickChoices;
|
||||
int *pnJoyTranslationTbl;
|
||||
int nJoyTranslationTblSize;
|
||||
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;
|
||||
|
||||
if(nJoyNum == JN_JOYSTICK0)
|
||||
{
|
||||
pnzJoystickChoices = m_joystick0choices;
|
||||
pnJoyTranslationTbl = m_nJoy0ChoiceTranlationTbl;
|
||||
nJoyTranslationTblSize = sizeof(m_nJoy0ChoiceTranlationTbl);
|
||||
nJC_DISABLED = J0C_DISABLED;
|
||||
nJC_JOYSTICK = J0C_JOYSTICK1;
|
||||
nJC_KEYBD_STANDARD = J0C_KEYBD_STANDARD;
|
||||
nJC_KEYBD_CENTERING = J0C_KEYBD_CENTERING;
|
||||
nJC_MAX = J0C_MAX;
|
||||
ppszJoyChoices = (TCHAR**) m_pszJoy0Choices;
|
||||
}
|
||||
else
|
||||
{
|
||||
pnzJoystickChoices = m_joystick1choices;
|
||||
pnJoyTranslationTbl = m_nJoy1ChoiceTranlationTbl;
|
||||
nJoyTranslationTblSize = sizeof(m_nJoy1ChoiceTranlationTbl);
|
||||
nJC_DISABLED = J1C_DISABLED;
|
||||
nJC_JOYSTICK = J1C_JOYSTICK2;
|
||||
nJC_KEYBD_STANDARD = J1C_KEYBD_STANDARD;
|
||||
nJC_KEYBD_CENTERING = J1C_KEYBD_CENTERING;
|
||||
nJC_MAX = J1C_MAX;
|
||||
ppszJoyChoices = (TCHAR**) m_pszJoy1Choices;
|
||||
}
|
||||
|
||||
pszMem = pnzJoystickChoices;
|
||||
nIdx = 0;
|
||||
memset(pnJoyTranslationTbl, -1, nJoyTranslationTblSize);
|
||||
|
||||
// Build the Joystick choices string list. These first 2 are always selectable.
|
||||
memcpy(pszMem, ppszJoyChoices[nJC_DISABLED], strlen(ppszJoyChoices[nJC_DISABLED])+1);
|
||||
pszMem += strlen(ppszJoyChoices[nJC_DISABLED])+1;
|
||||
pnJoyTranslationTbl[nIdx++] = nJC_DISABLED;
|
||||
|
||||
memcpy(pszMem, ppszJoyChoices[nJC_JOYSTICK], strlen(ppszJoyChoices[nJC_JOYSTICK])+1);
|
||||
pszMem += strlen(ppszJoyChoices[nJC_JOYSTICK])+1;
|
||||
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++)
|
||||
{
|
||||
if( ( (i == nJC_KEYBD_STANDARD) || (i == nJC_KEYBD_CENTERING) ) &&
|
||||
( (joytype[nOtherJoyNum] == nJC_KEYBD_STANDARD) || (joytype[nOtherJoyNum] == nJC_KEYBD_CENTERING) )
|
||||
)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if(joytype[nOtherJoyNum] != i)
|
||||
{
|
||||
memcpy(pszMem, ppszJoyChoices[i], strlen(ppszJoyChoices[i])+1);
|
||||
pszMem += strlen(ppszJoyChoices[i])+1;
|
||||
pnJoyTranslationTbl[nIdx++] = i;
|
||||
}
|
||||
}
|
||||
|
||||
*pszMem = 0x00; // Doubly null terminated
|
||||
|
||||
m_PropertySheetHelper.FillComboBox(window, nIdcValue, pnzJoystickChoices, joytype[nJoyNum]);
|
||||
}
|
||||
|
||||
void CPageInput::InitCPMChoices(HWND window)
|
||||
{
|
||||
if (g_Slot4 == CT_Z80) m_CPMChoice = CPM_SLOT4;
|
||||
else if (g_Slot5 == CT_Z80) m_CPMChoice = CPM_SLOT5;
|
||||
else m_CPMChoice = CPM_UNPLUGGED;
|
||||
|
||||
for (UINT i=0; i<_CPM_MAX_CHOICES; i++)
|
||||
m_CPMComboItemToChoice[i] = CPM_UNAVAILABLE;
|
||||
|
||||
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;
|
||||
|
||||
if (bIsSlot4Empty || bIsSlot4CPM)
|
||||
{
|
||||
const UINT uStrLen = strlen(m_szCPMSlotChoice_Slot4)+1;
|
||||
memcpy(&m_szCPMSlotChoices[uStringOffset], m_szCPMSlotChoice_Slot4, uStrLen);
|
||||
uStringOffset += uStrLen;
|
||||
|
||||
m_CPMComboItemToChoice[uComboItemIdx++] = CPM_SLOT4;
|
||||
}
|
||||
|
||||
if (bIsSlot5Empty || bIsSlot5CPM)
|
||||
{
|
||||
const UINT uStrLen = strlen(m_szCPMSlotChoice_Slot5)+1;
|
||||
memcpy(&m_szCPMSlotChoices[uStringOffset], m_szCPMSlotChoice_Slot5, uStrLen);
|
||||
uStringOffset += uStrLen;
|
||||
|
||||
m_CPMComboItemToChoice[uComboItemIdx++] = CPM_SLOT5;
|
||||
}
|
||||
|
||||
if (uStringOffset)
|
||||
{
|
||||
const UINT uStrLen = strlen(m_szCPMSlotChoice_Unplugged)+1;
|
||||
memcpy(&m_szCPMSlotChoices[uStringOffset], m_szCPMSlotChoice_Unplugged, uStrLen);
|
||||
uStringOffset += uStrLen;
|
||||
|
||||
m_CPMComboItemToChoice[uComboItemIdx] = CPM_UNPLUGGED;
|
||||
}
|
||||
else
|
||||
{
|
||||
const UINT uStrLen = strlen(m_szCPMSlotChoice_Unavailable)+1;
|
||||
memcpy(&m_szCPMSlotChoices[uStringOffset], m_szCPMSlotChoice_Unavailable, uStrLen);
|
||||
uStringOffset += uStrLen;
|
||||
|
||||
m_CPMChoice = CPM_UNAVAILABLE; // Force this
|
||||
m_CPMComboItemToChoice[uComboItemIdx] = CPM_UNAVAILABLE;
|
||||
}
|
||||
|
||||
m_szCPMSlotChoices[uStringOffset] = 0; // Doubly null terminated
|
||||
|
||||
//
|
||||
|
||||
UINT uCurrentChoice = uComboItemIdx; // Default to last item (either UNPLUGGED or UNAVAILABLE)
|
||||
for (UINT i=0; i<=uComboItemIdx; i++)
|
||||
{
|
||||
if (m_CPMComboItemToChoice[i] == m_CPMChoice)
|
||||
{
|
||||
uCurrentChoice = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_PropertySheetHelper.FillComboBox(window, IDC_CPM_CONFIG, m_szCPMSlotChoices, uCurrentChoice);
|
||||
}
|
80
AppleWin/source/Configuration/PageInput.h
Normal file
80
AppleWin/source/Configuration/PageInput.h
Normal file
|
@ -0,0 +1,80 @@
|
|||
#pragma once
|
||||
|
||||
#include "IPropertySheetPage.h"
|
||||
#include "PropertySheetDefs.h"
|
||||
class CPropertySheetHelper;
|
||||
|
||||
class CPageInput : public IPropertySheetPage
|
||||
{
|
||||
public:
|
||||
CPageInput(CPropertySheetHelper& PropertySheetHelper) :
|
||||
m_Page(PG_INPUT),
|
||||
m_PropertySheetHelper(PropertySheetHelper),
|
||||
m_MousecardSlotChange(CARD_UNCHANGED),
|
||||
m_CPMcardSlotChange(CARD_UNCHANGED),
|
||||
m_uScrollLockToggle(0),
|
||||
m_uMouseShowCrosshair(0),
|
||||
m_uMouseRestrictToWindow(0),
|
||||
m_CPMChoice(CPM_UNPLUGGED)
|
||||
{
|
||||
CPageInput::ms_this = this;
|
||||
}
|
||||
virtual ~CPageInput(){}
|
||||
|
||||
static BOOL CALLBACK DlgProc(HWND window, UINT message, WPARAM wparam, LPARAM lparam);
|
||||
|
||||
UINT GetScrollLockToggle(void){ return m_uScrollLockToggle; }
|
||||
void SetScrollLockToggle(UINT uValue){ m_uScrollLockToggle = uValue; }
|
||||
UINT GetMouseShowCrosshair(void){ return m_uMouseShowCrosshair; }
|
||||
void SetMouseShowCrosshair(UINT uValue){ m_uMouseShowCrosshair = uValue; }
|
||||
UINT GetMouseRestrictToWindow(void){ return m_uMouseRestrictToWindow; }
|
||||
void SetMouseRestrictToWindow(UINT uValue){ m_uMouseRestrictToWindow = uValue; }
|
||||
|
||||
protected:
|
||||
// IPropertySheetPage
|
||||
virtual BOOL DlgProcInternal(HWND window, UINT message, WPARAM wparam, LPARAM lparam);
|
||||
virtual void DlgOK(HWND window, UINT afterclose);
|
||||
virtual void DlgCANCEL(HWND window){}
|
||||
|
||||
private:
|
||||
void InitJoystickChoices(HWND window, int nJoyNum, int nIdcValue);
|
||||
void InitCPMChoices(HWND window);
|
||||
|
||||
static CPageInput* ms_this;
|
||||
static const UINT MaxMenuChoiceLen = 40;
|
||||
|
||||
enum JOY0CHOICE {J0C_DISABLED=0, J0C_JOYSTICK1, J0C_KEYBD_STANDARD, J0C_KEYBD_CENTERING, J0C_MOUSE, J0C_MAX};
|
||||
enum JOY1CHOICE {J1C_DISABLED=0, J1C_JOYSTICK2, J1C_KEYBD_STANDARD, J1C_KEYBD_CENTERING, J1C_MOUSE, J1C_MAX};
|
||||
static const TCHAR m_szJoyChoice0[];
|
||||
static const TCHAR m_szJoyChoice1[];
|
||||
static const TCHAR m_szJoyChoice2[];
|
||||
static const TCHAR m_szJoyChoice3[];
|
||||
static const TCHAR m_szJoyChoice4[];
|
||||
static const TCHAR m_szJoyChoice5[];
|
||||
static const TCHAR* const m_pszJoy0Choices[J0C_MAX];
|
||||
static const TCHAR* const m_pszJoy1Choices[J1C_MAX];
|
||||
|
||||
static const TCHAR m_szCPMSlotChoice_Slot4[];
|
||||
static const TCHAR m_szCPMSlotChoice_Slot5[];
|
||||
static const TCHAR m_szCPMSlotChoice_Unplugged[];
|
||||
static const TCHAR m_szCPMSlotChoice_Unavailable[];
|
||||
|
||||
int m_nJoy0ChoiceTranlationTbl[J0C_MAX];
|
||||
TCHAR m_joystick0choices[J0C_MAX * MaxMenuChoiceLen];
|
||||
int m_nJoy1ChoiceTranlationTbl[J1C_MAX];
|
||||
TCHAR m_joystick1choices[J1C_MAX * MaxMenuChoiceLen];
|
||||
|
||||
const PAGETYPE m_Page;
|
||||
CPropertySheetHelper& m_PropertySheetHelper;
|
||||
|
||||
CARDSTATE m_MousecardSlotChange;
|
||||
CARDSTATE m_CPMcardSlotChange;
|
||||
UINT m_uScrollLockToggle;
|
||||
UINT m_uMouseShowCrosshair;
|
||||
UINT m_uMouseRestrictToWindow;
|
||||
|
||||
enum CPMCHOICE {CPM_SLOT4=0, CPM_SLOT5, CPM_UNPLUGGED, CPM_UNAVAILABLE, _CPM_MAX_CHOICES};
|
||||
TCHAR m_szCPMSlotChoices[_CPM_MAX_CHOICES * MaxMenuChoiceLen];
|
||||
CPMCHOICE m_CPMChoice;
|
||||
CPMCHOICE m_CPMComboItemToChoice[_CPM_MAX_CHOICES];
|
||||
};
|
215
AppleWin/source/Configuration/PageSound.cpp
Normal file
215
AppleWin/source/Configuration/PageSound.cpp
Normal file
|
@ -0,0 +1,215 @@
|
|||
#include "StdAfx.h"
|
||||
#include "PageSound.h"
|
||||
#include "PropertySheetHelper.h"
|
||||
#include "..\resource\resource.h"
|
||||
|
||||
CPageSound* CPageSound::ms_this = 0; // reinit'd in ctor
|
||||
|
||||
const TCHAR CPageSound::m_soundchoices[] = TEXT("Disabled\0")
|
||||
TEXT("PC Speaker (direct)\0")
|
||||
TEXT("PC Speaker (translated)\0")
|
||||
TEXT("Sound Card\0");
|
||||
|
||||
|
||||
BOOL CALLBACK CPageSound::DlgProc(HWND window, UINT message, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
// Switch from static func to our instance
|
||||
return CPageSound::ms_this->DlgProcInternal(window, message, wparam, lparam);
|
||||
}
|
||||
|
||||
BOOL CPageSound::DlgProcInternal(HWND window, UINT message, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
static UINT afterclose = 0;
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case WM_NOTIFY:
|
||||
{
|
||||
// Property Sheet notifications
|
||||
|
||||
switch (((LPPSHNOTIFY)lparam)->hdr.code)
|
||||
{
|
||||
case PSN_KILLACTIVE:
|
||||
SetWindowLong(window, DWL_MSGRESULT, FALSE); // Changes are valid
|
||||
break;
|
||||
case PSN_APPLY:
|
||||
DlgOK(window, afterclose);
|
||||
SetWindowLong(window, 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);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wparam))
|
||||
{
|
||||
case IDC_SPKR_VOLUME:
|
||||
break;
|
||||
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, afterclose))
|
||||
{
|
||||
m_NewCardType = CT_MockingboardC;
|
||||
m_SoundcardSlotChange = CARD_INSERTED;
|
||||
EnableWindow(GetDlgItem(window, IDC_MB_VOLUME), TRUE);
|
||||
}
|
||||
}
|
||||
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, afterclose))
|
||||
{
|
||||
m_NewCardType = CT_Phasor;
|
||||
m_SoundcardSlotChange = CARD_INSERTED;
|
||||
EnableWindow(GetDlgItem(window, IDC_MB_VOLUME), TRUE);
|
||||
}
|
||||
}
|
||||
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, afterclose))
|
||||
{
|
||||
m_NewCardType = CT_Empty;
|
||||
m_SoundcardSlotChange = CARD_UNPLUGGED;
|
||||
EnableWindow(GetDlgItem(window, IDC_MB_VOLUME), FALSE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
m_PropertySheetHelper.SetLastPage(m_Page);
|
||||
|
||||
m_PropertySheetHelper.FillComboBox(window,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(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());
|
||||
|
||||
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;
|
||||
|
||||
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);
|
||||
|
||||
afterclose = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void CPageSound::DlgOK(HWND window, UINT afterclose)
|
||||
{
|
||||
DWORD newsoundtype = (DWORD)SendDlgItemMessage(window,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);
|
||||
|
||||
if (!SpkrSetEmulationType(window,newsoundtype))
|
||||
{
|
||||
//afterclose = 0; // TC: does nothing
|
||||
return;
|
||||
}
|
||||
|
||||
// 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());
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
if (afterclose)
|
||||
PostMessage(g_hFrameWindow,afterclose,0,0);
|
||||
}
|
||||
|
||||
bool CPageSound::NewSoundcardConfigured(HWND window, WPARAM wparam, LPCSTR pMsg, UINT& afterclose)
|
||||
{
|
||||
if (HIWORD(wparam) != BN_CLICKED)
|
||||
return false;
|
||||
|
||||
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_nCurrentIDCheckButton = LOWORD(wparam);
|
||||
afterclose = WM_USER_RESTART;
|
||||
PropSheet_PressButton(GetParent(window), PSBTN_OK);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Restore original state
|
||||
CheckRadioButton(window, IDC_MB_ENABLE, IDC_SOUNDCARD_DISABLE, m_nCurrentIDCheckButton);
|
||||
return false;
|
||||
}
|
45
AppleWin/source/Configuration/PageSound.h
Normal file
45
AppleWin/source/Configuration/PageSound.h
Normal file
|
@ -0,0 +1,45 @@
|
|||
#pragma once
|
||||
|
||||
#include "IPropertySheetPage.h"
|
||||
#include "PropertySheetDefs.h"
|
||||
class CPropertySheetHelper;
|
||||
|
||||
class CPageSound : public IPropertySheetPage
|
||||
{
|
||||
public:
|
||||
CPageSound(CPropertySheetHelper& PropertySheetHelper) :
|
||||
m_Page(PG_SOUND),
|
||||
m_PropertySheetHelper(PropertySheetHelper),
|
||||
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);
|
||||
|
||||
DWORD GetVolumeMax(void){ return VOLUME_MAX; }
|
||||
bool NewSoundcardConfigured(HWND window, WPARAM wparam, LPCSTR pMsg, UINT& afterclose);
|
||||
|
||||
protected:
|
||||
// IPropertySheetPage
|
||||
virtual BOOL DlgProcInternal(HWND window, UINT message, WPARAM wparam, LPARAM lparam);
|
||||
virtual void DlgOK(HWND window, UINT afterclose);
|
||||
virtual void DlgCANCEL(HWND window){}
|
||||
|
||||
private:
|
||||
static CPageSound* ms_this;
|
||||
|
||||
const PAGETYPE m_Page;
|
||||
CPropertySheetHelper& m_PropertySheetHelper;
|
||||
|
||||
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;
|
||||
};
|
104
AppleWin/source/Configuration/PropertySheet.cpp
Normal file
104
AppleWin/source/Configuration/PropertySheet.cpp
Normal file
|
@ -0,0 +1,104 @@
|
|||
/*
|
||||
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
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
/* Description: Property Sheet Pages
|
||||
*
|
||||
* Author: Tom Charlesworth
|
||||
* Spiro Trikaliotis <Spiro.Trikaliotis@gmx.de>
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "PropertySheet.h"
|
||||
#include "..\resource\resource.h"
|
||||
|
||||
void CPropertySheet::Init(void)
|
||||
{
|
||||
PROPSHEETPAGE PropSheetPages[PG_NUM_SHEETS];
|
||||
|
||||
PropSheetPages[PG_CONFIG].dwSize = sizeof(PROPSHEETPAGE);
|
||||
PropSheetPages[PG_CONFIG].dwFlags = PSP_DEFAULT;
|
||||
PropSheetPages[PG_CONFIG].hInstance = g_hInstance;
|
||||
PropSheetPages[PG_CONFIG].pszTemplate = MAKEINTRESOURCE(IDD_PROPPAGE_CONFIG);
|
||||
PropSheetPages[PG_CONFIG].pfnDlgProc = (DLGPROC)CPageConfig::DlgProc;
|
||||
|
||||
PropSheetPages[PG_INPUT].dwSize = sizeof(PROPSHEETPAGE);
|
||||
PropSheetPages[PG_INPUT].dwFlags = PSP_DEFAULT;
|
||||
PropSheetPages[PG_INPUT].hInstance = g_hInstance;
|
||||
PropSheetPages[PG_INPUT].pszTemplate = MAKEINTRESOURCE(IDD_PROPPAGE_INPUT);
|
||||
PropSheetPages[PG_INPUT].pfnDlgProc = (DLGPROC)CPageInput::DlgProc;
|
||||
|
||||
PropSheetPages[PG_SOUND].dwSize = sizeof(PROPSHEETPAGE);
|
||||
PropSheetPages[PG_SOUND].dwFlags = PSP_DEFAULT;
|
||||
PropSheetPages[PG_SOUND].hInstance = g_hInstance;
|
||||
PropSheetPages[PG_SOUND].pszTemplate = MAKEINTRESOURCE(IDD_PROPPAGE_SOUND);
|
||||
PropSheetPages[PG_SOUND].pfnDlgProc = (DLGPROC)CPageSound::DlgProc;
|
||||
|
||||
PropSheetPages[PG_DISK].dwSize = sizeof(PROPSHEETPAGE);
|
||||
PropSheetPages[PG_DISK].dwFlags = PSP_DEFAULT;
|
||||
PropSheetPages[PG_DISK].hInstance = g_hInstance;
|
||||
PropSheetPages[PG_DISK].pszTemplate = MAKEINTRESOURCE(IDD_PROPPAGE_DISK);
|
||||
PropSheetPages[PG_DISK].pfnDlgProc = (DLGPROC)CPageDisk::DlgProc;
|
||||
|
||||
PropSheetPages[PG_ADVANCED].dwSize = sizeof(PROPSHEETPAGE);
|
||||
PropSheetPages[PG_ADVANCED].dwFlags = PSP_DEFAULT;
|
||||
PropSheetPages[PG_ADVANCED].hInstance = g_hInstance;
|
||||
PropSheetPages[PG_ADVANCED].pszTemplate = MAKEINTRESOURCE(IDD_PROPPAGE_ADVANCED);
|
||||
PropSheetPages[PG_ADVANCED].pfnDlgProc = (DLGPROC)CPageAdvanced::DlgProc;
|
||||
|
||||
PROPSHEETHEADER PropSheetHeader;
|
||||
|
||||
PropSheetHeader.dwSize = sizeof(PROPSHEETHEADER);
|
||||
PropSheetHeader.dwFlags = PSH_NOAPPLYNOW | /* PSH_NOCONTEXTHELP | */ PSH_PROPSHEETPAGE;
|
||||
PropSheetHeader.hwndParent = g_hFrameWindow;
|
||||
PropSheetHeader.pszCaption = "AppleWin Configuration";
|
||||
PropSheetHeader.nPages = PG_NUM_SHEETS;
|
||||
PropSheetHeader.nStartPage = g_PropertySheetHelper.GetLastPage();
|
||||
PropSheetHeader.ppsp = PropSheetPages;
|
||||
|
||||
// g_bConfirmedRestartEmulator = false;
|
||||
g_PropertySheetHelper.SetUIControlFreezeDlgButton(UI_UNDEFINED);
|
||||
g_PropertySheetHelper.SetUIControlCloneDropdownMenu(UI_UNDEFINED);
|
||||
int i = PropertySheet(&PropSheetHeader); // Result: 0=Cancel, 1=OK
|
||||
}
|
||||
|
||||
DWORD CPropertySheet::GetVolumeMax()
|
||||
{
|
||||
return g_PageSound.GetVolumeMax();
|
||||
}
|
||||
|
||||
// Called when F11/F12 is pressed
|
||||
bool CPropertySheet::SaveStateSelectImage(HWND hWindow, bool bSave)
|
||||
{
|
||||
g_PropertySheetHelper.ClearSSNewDirectory();
|
||||
|
||||
if(g_PropertySheetHelper.SaveStateSelectImage(hWindow, bSave ? TEXT("Select Save State file")
|
||||
: TEXT("Select Load State file"), bSave))
|
||||
{
|
||||
g_PropertySheetHelper.SaveStateUpdate();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false; // Cancelled
|
||||
}
|
||||
}
|
44
AppleWin/source/Configuration/PropertySheet.h
Normal file
44
AppleWin/source/Configuration/PropertySheet.h
Normal file
|
@ -0,0 +1,44 @@
|
|||
#pragma once
|
||||
|
||||
#include "PropertySheetHelper.h"
|
||||
#include "PageConfig.h"
|
||||
#include "PageInput.h"
|
||||
#include "PageSound.h"
|
||||
#include "PageDisk.h"
|
||||
#include "PageAdvanced.h"
|
||||
|
||||
extern class CPropertySheet sg_PropertySheet;
|
||||
|
||||
class CPropertySheet
|
||||
{
|
||||
public:
|
||||
CPropertySheet() :
|
||||
g_PageConfig(g_PropertySheetHelper),
|
||||
g_PageInput(g_PropertySheetHelper),
|
||||
g_PageSound(g_PropertySheetHelper),
|
||||
g_PageDisk(g_PropertySheetHelper),
|
||||
g_PageAdvanced(g_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
|
||||
|
||||
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); }
|
||||
|
||||
private:
|
||||
CPropertySheetHelper g_PropertySheetHelper;
|
||||
CPageConfig g_PageConfig;
|
||||
CPageInput g_PageInput;
|
||||
CPageSound g_PageSound;
|
||||
CPageDisk g_PageDisk;
|
||||
CPageAdvanced g_PageAdvanced;
|
||||
};
|
5
AppleWin/source/Configuration/PropertySheetDefs.h
Normal file
5
AppleWin/source/Configuration/PropertySheetDefs.h
Normal file
|
@ -0,0 +1,5 @@
|
|||
#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};
|
201
AppleWin/source/Configuration/PropertySheetHelper.cpp
Normal file
201
AppleWin/source/Configuration/PropertySheetHelper.cpp
Normal file
|
@ -0,0 +1,201 @@
|
|||
#include "stdafx.h"
|
||||
#include "PropertySheetHelper.h"
|
||||
#include "..\AppleWin.h" // g_nAppMode, g_uScrollLockToggle
|
||||
|
||||
// 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)
|
||||
{
|
||||
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)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CPropertySheetHelper::FillComboBox(HWND window, int controlid, LPCTSTR choices, int currentchoice)
|
||||
{
|
||||
_ASSERT(choices);
|
||||
HWND combowindow = GetDlgItem(window, controlid);
|
||||
SendMessage(combowindow, CB_RESETCONTENT, 0, 0);
|
||||
while (choices && *choices)
|
||||
{
|
||||
SendMessage(combowindow, CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)choices);
|
||||
choices += _tcslen(choices)+1;
|
||||
}
|
||||
SendMessage(combowindow, CB_SETCURSEL, currentchoice, 0);
|
||||
}
|
||||
|
||||
void CPropertySheetHelper::SaveComputerType(eApple2Type NewApple2Type)
|
||||
{
|
||||
if (NewApple2Type == A2TYPE_CLONE) // Clone picked from Config tab, but no specific one picked from Advanced tab
|
||||
NewApple2Type = A2TYPE_PRAVETS82;
|
||||
|
||||
REGSAVE(TEXT(REGVALUE_APPLE2_TYPE), NewApple2Type);
|
||||
}
|
||||
|
||||
void CPropertySheetHelper::SetSlot4(SS_CARDTYPE NewCardType)
|
||||
{
|
||||
g_Slot4 = NewCardType;
|
||||
REGSAVE(TEXT(REGVALUE_SLOT4),(DWORD)g_Slot4);
|
||||
}
|
||||
|
||||
void CPropertySheetHelper::SetSlot5(SS_CARDTYPE NewCardType)
|
||||
{
|
||||
g_Slot5 = NewCardType;
|
||||
REGSAVE(TEXT(REGVALUE_SLOT5),(DWORD)g_Slot5);
|
||||
}
|
||||
|
||||
// Looks like a (bad) C&P from SaveStateSelectImage()
|
||||
// - eg. see "RAPCS" tags below...
|
||||
// Used by:
|
||||
// . CPageDisk: IDC_CIDERPRESS_BROWSE
|
||||
// . CPageAdvanced: IDC_PRINTER_DUMP_FILENAME_BROWSE
|
||||
string CPropertySheetHelper::BrowseToFile(HWND hWindow, TCHAR* pszTitle, TCHAR* REGVALUE, TCHAR* FILEMASKS)
|
||||
{
|
||||
static char PathToFile[MAX_PATH] = {0}; //This is a really awkward way to prevent mixing CiderPress and SaveStated values (RAPCS), but it seem the quickest. Here is its Line 1.
|
||||
strcpy(PathToFile, Snapshot_GetFilename()); //RAPCS, line 2.
|
||||
TCHAR szDirectory[MAX_PATH] = TEXT("");
|
||||
TCHAR szFilename[MAX_PATH];
|
||||
strcpy(szFilename, "");
|
||||
RegLoadString(TEXT("Configuration"), REGVALUE, 1, szFilename ,MAX_PATH);
|
||||
string PathName = szFilename;
|
||||
|
||||
OPENFILENAME ofn;
|
||||
ZeroMemory(&ofn,sizeof(OPENFILENAME));
|
||||
|
||||
ofn.lStructSize = sizeof(OPENFILENAME);
|
||||
ofn.hwndOwner = hWindow;
|
||||
ofn.hInstance = g_hInstance;
|
||||
ofn.lpstrFilter = FILEMASKS;
|
||||
/*ofn.lpstrFilter = TEXT("Applications (*.exe)\0*.exe\0")
|
||||
TEXT("Text files (*.txt)\0*.txt\0")
|
||||
TEXT("All Files\0*.*\0");*/
|
||||
ofn.lpstrFile = szFilename;
|
||||
ofn.nMaxFile = MAX_PATH;
|
||||
ofn.lpstrInitialDir = szDirectory;
|
||||
ofn.Flags = OFN_PATHMUSTEXIST | OFN_HIDEREADONLY;
|
||||
ofn.lpstrTitle = pszTitle;
|
||||
|
||||
int nRes = GetOpenFileName(&ofn);
|
||||
if(nRes) // Okay is pressed
|
||||
{
|
||||
strcpy(m_szNewFilename, &szFilename[ofn.nFileOffset]); // TODO:TC: m_szNewFilename not used! (Was g_szNewFilename)
|
||||
|
||||
szFilename[ofn.nFileOffset] = 0;
|
||||
if (_tcsicmp(szDirectory, szFilename))
|
||||
strcpy(m_szSSNewDirectory, szFilename); // TODO:TC: m_szSSNewDirectory looks dodgy! (Was g_szSSNewDirectory)
|
||||
|
||||
PathName = szFilename;
|
||||
PathName.append (m_szNewFilename);
|
||||
}
|
||||
else // Cancel is pressed
|
||||
{
|
||||
RegLoadString(TEXT("Configuration"), REGVALUE, 1, szFilename,MAX_PATH);
|
||||
PathName = szFilename;
|
||||
}
|
||||
|
||||
strcpy(m_szNewFilename, PathToFile); //RAPCS, line 3 (last).
|
||||
return PathName;
|
||||
}
|
||||
|
||||
void CPropertySheetHelper::SaveStateUpdate()
|
||||
{
|
||||
if (m_bSSNewFilename)
|
||||
{
|
||||
Snapshot_SetFilename(m_szSSNewFilename);
|
||||
|
||||
RegSaveString(TEXT(REG_CONFIG), REGVALUE_SAVESTATE_FILENAME, 1, Snapshot_GetFilename());
|
||||
|
||||
if(m_szSSNewDirectory[0])
|
||||
RegSaveString(TEXT(REG_PREFS), REGVALUE_PREF_START_DIR, 1 ,m_szSSNewDirectory);
|
||||
}
|
||||
}
|
||||
|
||||
void CPropertySheetHelper::GetDiskBaseNameWithAWS(TCHAR* pszFilename)
|
||||
{
|
||||
LPCTSTR pDiskName = DiskGetBaseName(DRIVE_1);
|
||||
if (pDiskName && pDiskName[0])
|
||||
{
|
||||
strcpy(pszFilename, pDiskName);
|
||||
strcpy(&pszFilename[strlen(pDiskName)], ".aws");
|
||||
}
|
||||
}
|
||||
|
||||
// NB. OK'ing this property sheet will call Snapshot_SetFilename() with this new filename
|
||||
int CPropertySheetHelper::SaveStateSelectImage(HWND hWindow, TCHAR* pszTitle, bool bSave)
|
||||
{
|
||||
TCHAR szDirectory[MAX_PATH] = TEXT("");
|
||||
TCHAR szFilename[MAX_PATH] = {0};
|
||||
|
||||
if (bSave)
|
||||
{
|
||||
// Attempt to use drive1's image name as the name for the .aws file
|
||||
// Else Attempt to use the Prop Sheet's filename
|
||||
GetDiskBaseNameWithAWS(szFilename);
|
||||
if (szFilename[0] == 0)
|
||||
{
|
||||
strcpy(szFilename, Snapshot_GetFilename());
|
||||
}
|
||||
}
|
||||
else // Load
|
||||
{
|
||||
// Attempt to use the Prop Sheet's filename first
|
||||
// Else attempt to use drive1's image name as the name for the .aws file
|
||||
strcpy(szFilename, Snapshot_GetFilename());
|
||||
if (szFilename[0] == 0)
|
||||
{
|
||||
GetDiskBaseNameWithAWS(szFilename);
|
||||
}
|
||||
}
|
||||
|
||||
RegLoadString(TEXT(REG_PREFS),REGVALUE_PREF_START_DIR,1,szDirectory,MAX_PATH);
|
||||
|
||||
//
|
||||
|
||||
OPENFILENAME ofn;
|
||||
ZeroMemory(&ofn,sizeof(OPENFILENAME));
|
||||
|
||||
ofn.lStructSize = sizeof(OPENFILENAME);
|
||||
ofn.hwndOwner = hWindow;
|
||||
ofn.hInstance = g_hInstance;
|
||||
ofn.lpstrFilter = TEXT("Save State files (*.aws)\0*.aws\0")
|
||||
TEXT("All Files\0*.*\0");
|
||||
ofn.lpstrFile = szFilename;
|
||||
ofn.nMaxFile = MAX_PATH;
|
||||
ofn.lpstrInitialDir = szDirectory;
|
||||
ofn.Flags = OFN_PATHMUSTEXIST | OFN_HIDEREADONLY;
|
||||
ofn.lpstrTitle = pszTitle;
|
||||
|
||||
int nRes = bSave ? GetSaveFileName(&ofn) : GetOpenFileName(&ofn);
|
||||
|
||||
if(nRes)
|
||||
{
|
||||
strcpy(m_szSSNewFilename, &szFilename[ofn.nFileOffset]);
|
||||
|
||||
if (bSave) // Only for saving (allow loading of any file for backwards compatibility)
|
||||
{
|
||||
// Append .aws if it's not there
|
||||
const char szAWS_EXT[] = ".aws";
|
||||
const UINT uStrLenFile = strlen(m_szSSNewFilename);
|
||||
const UINT uStrLenExt = strlen(szAWS_EXT);
|
||||
if ((uStrLenFile <= uStrLenExt) || (strcmp(&m_szSSNewFilename[uStrLenFile-uStrLenExt], szAWS_EXT) != 0))
|
||||
strcpy(&m_szSSNewFilename[uStrLenFile], szAWS_EXT);
|
||||
}
|
||||
|
||||
szFilename[ofn.nFileOffset] = 0;
|
||||
if (_tcsicmp(szDirectory, szFilename))
|
||||
strcpy(m_szSSNewDirectory, szFilename);
|
||||
}
|
||||
|
||||
m_bSSNewFilename = nRes ? true : false;
|
||||
return nRes;
|
||||
}
|
42
AppleWin/source/Configuration/PropertySheetHelper.h
Normal file
42
AppleWin/source/Configuration/PropertySheetHelper.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
#pragma once
|
||||
#include "PropertySheetDefs.h"
|
||||
|
||||
class CPropertySheetHelper
|
||||
{
|
||||
public:
|
||||
CPropertySheetHelper() :
|
||||
m_LastPage(PG_CONFIG),
|
||||
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);
|
||||
|
||||
PAGETYPE GetLastPage(void) { return m_LastPage; }
|
||||
void SetLastPage(PAGETYPE page) { m_LastPage = 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; }
|
||||
char* GetSSNewFilename(void) { return &m_szSSNewFilename[0]; }
|
||||
void ClearSSNewDirectory(void) { m_szSSNewDirectory[0] = 0; }
|
||||
|
||||
private:
|
||||
PAGETYPE m_LastPage;
|
||||
UICONTROLSTATE m_UIControlFreezeDlgButton;
|
||||
UICONTROLSTATE m_UIControlCloneDropdownMenu;
|
||||
char m_szNewFilename[MAX_PATH];
|
||||
bool m_bSSNewFilename;
|
||||
char m_szSSNewDirectory[MAX_PATH];
|
||||
char m_szSSNewFilename[MAX_PATH];
|
||||
};
|
|
@ -35,6 +35,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
#ifdef USE_SPEECH_API
|
||||
#include "Speech.h"
|
||||
#endif
|
||||
#include "Configuration\PropertySheet.h"
|
||||
|
||||
//#define ENABLE_MENU 0
|
||||
|
||||
|
@ -173,7 +174,7 @@ void GetAppleWindowTitle()
|
|||
|
||||
if (g_hCustomRomF8 != INVALID_HANDLE_VALUE)
|
||||
_tcscat(g_pAppleWindowTitle,TEXT(" (custom rom)"));
|
||||
else if (g_uTheFreezesF8Rom && IS_APPLE2)
|
||||
else if (sg_PropertySheet.GetTheFreezesF8Rom() && IS_APPLE2)
|
||||
_tcscat(g_pAppleWindowTitle,TEXT(" (The Freeze's non-autostart F8 rom)"));
|
||||
|
||||
switch (g_nAppMode)
|
||||
|
@ -224,10 +225,10 @@ static void RevealCursor()
|
|||
|
||||
FrameShowCursor(TRUE);
|
||||
|
||||
if (g_uMouseShowCrosshair) // Erase crosshairs if they are being drawn
|
||||
if (sg_PropertySheet.GetMouseShowCrosshair()) // Erase crosshairs if they are being drawn
|
||||
DrawCrosshairs(0,0);
|
||||
|
||||
if (g_uMouseRestrictToWindow)
|
||||
if (sg_PropertySheet.GetMouseRestrictToWindow())
|
||||
SetUsingCursor(FALSE);
|
||||
|
||||
g_bLastCursorInAppleViewport = false;
|
||||
|
@ -913,7 +914,7 @@ LRESULT CALLBACK FrameWndProc (
|
|||
else if ((wparam == VK_F11) && (GetKeyState(VK_CONTROL) >= 0)) // Save state (F11)
|
||||
{
|
||||
SoundCore_SetFade(FADE_OUT);
|
||||
if(PSP_SaveStateSelectImage(window, true))
|
||||
if(sg_PropertySheet.SaveStateSelectImage(window, true))
|
||||
{
|
||||
Snapshot_SaveState();
|
||||
}
|
||||
|
@ -922,7 +923,7 @@ LRESULT CALLBACK FrameWndProc (
|
|||
else if (wparam == VK_F12) // Load state (F12 or Ctrl+F12)
|
||||
{
|
||||
SoundCore_SetFade(FADE_OUT);
|
||||
if(PSP_SaveStateSelectImage(window, false))
|
||||
if(sg_PropertySheet.SaveStateSelectImage(window, false))
|
||||
{
|
||||
Snapshot_LoadState();
|
||||
}
|
||||
|
@ -956,7 +957,7 @@ LRESULT CALLBACK FrameWndProc (
|
|||
VideoRedrawScreen();
|
||||
g_bResetTiming = true;
|
||||
}
|
||||
else if ((wparam == VK_SCROLL) && g_uScrollLockToggle)
|
||||
else if ((wparam == VK_SCROLL) && sg_PropertySheet.GetScrollLockToggle())
|
||||
{
|
||||
g_bScrollLock_FullSpeed = !g_bScrollLock_FullSpeed;
|
||||
}
|
||||
|
@ -1524,7 +1525,7 @@ void ProcessButtonClick (int button)
|
|||
|
||||
case BTN_SETUP:
|
||||
{
|
||||
PSP_Init();
|
||||
sg_PropertySheet.Init();
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -2100,7 +2101,7 @@ static void FrameSetCursorPosByMousePos(int x, int y, int dx, int dy, bool bLeav
|
|||
|
||||
static void DrawCrosshairsMouse()
|
||||
{
|
||||
if (!g_uMouseShowCrosshair)
|
||||
if (!sg_PropertySheet.GetMouseShowCrosshair())
|
||||
return;
|
||||
|
||||
int iX, iMinX, iMaxX;
|
||||
|
@ -2127,7 +2128,7 @@ static void UpdateMouseInAppleViewport(int iOutOfBoundsX, int iOutOfBoundsY, int
|
|||
|
||||
if (bOutsideAppleViewport)
|
||||
{
|
||||
if (g_uMouseRestrictToWindow)
|
||||
if (sg_PropertySheet.GetMouseRestrictToWindow())
|
||||
return;
|
||||
|
||||
g_bLastCursorInAppleViewport = false;
|
||||
|
@ -2159,7 +2160,7 @@ static void UpdateMouseInAppleViewport(int iOutOfBoundsX, int iOutOfBoundsY, int
|
|||
|
||||
//
|
||||
|
||||
if (g_uMouseRestrictToWindow)
|
||||
if (sg_PropertySheet.GetMouseRestrictToWindow())
|
||||
SetUsingCursor(TRUE);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -34,6 +34,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
#include "Z80VICE\z80.h"
|
||||
#include "Z80VICE\z80mem.h"
|
||||
#include "..\resource\resource.h"
|
||||
#include "Configuration\PropertySheet.h"
|
||||
|
||||
// Memory Flag
|
||||
#define MF_80STORE 0x00000001
|
||||
|
@ -1141,7 +1142,7 @@ void MemInitialize()
|
|||
}
|
||||
}
|
||||
|
||||
if (g_uTheFreezesF8Rom && IS_APPLE2)
|
||||
if (sg_PropertySheet.GetTheFreezesF8Rom() && IS_APPLE2)
|
||||
{
|
||||
hResInfo = FindResource(NULL, MAKEINTRESOURCE(IDR_FREEZES_F8_ROM), "ROM");
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,21 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
// Globals
|
||||
extern UINT g_uScrollLockToggle;
|
||||
extern UINT g_uMouseShowCrosshair;
|
||||
extern UINT g_uMouseRestrictToWindow;
|
||||
extern UINT g_uTheFreezesF8Rom;
|
||||
extern HWND hwConfigTab;
|
||||
extern HWND hwAdvancedTab;
|
||||
|
||||
// Prototypes
|
||||
void PSP_Init();
|
||||
DWORD PSP_GetVolumeMax();
|
||||
bool PSP_SaveStateSelectImage(HWND hWindow, bool bSave);
|
||||
void ui_tfe_settings_dialog(HWND hwnd);
|
||||
void * get_tfe_interface(void);
|
||||
void get_tfe_enabled(int *tfe_enabled);
|
||||
string BrowseToFile(HWND hWindow, TCHAR* pszTitle, TCHAR* REGVALUE, TCHAR* FILEMASKS);
|
||||
|
||||
void Config_Save_Video();
|
||||
void Config_Load_Video();
|
|
@ -57,7 +57,6 @@
|
|||
#include "Memory.h"
|
||||
#include "Mockingboard.h"
|
||||
#include "ParallelPrinter.h"
|
||||
#include "PropertySheetPage.h"
|
||||
#include "Registry.h"
|
||||
#include "Riff.h"
|
||||
#include "SaveState.h"
|
||||
|
@ -65,5 +64,3 @@
|
|||
#include "SoundCore.h"
|
||||
#include "Speaker.h"
|
||||
#include "Tape.h"
|
||||
#include "Tfe/Tfe.h"
|
||||
|
||||
|
|
|
@ -77,6 +77,8 @@ extern int tfe_enumadapter_open(void);
|
|||
extern int tfe_enumadapter(char **ppname, char **ppdescription);
|
||||
extern int tfe_enumadapter_close(void);
|
||||
|
||||
extern void* get_tfe_interface(void);
|
||||
extern void get_tfe_enabled(int *tfe_enabled);
|
||||
|
||||
extern FILE* g_fh; // Filehandle for log file
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
|
||||
#include "StdAfx.h"
|
||||
#include "..\resource\resource.h"
|
||||
#include "Configuration\PropertySheet.h"
|
||||
|
||||
#define HALF_PIXEL_SOLID 1
|
||||
#define HALF_PIXEL_BLEED 0
|
||||
|
@ -4088,3 +4089,22 @@ void Video_SaveScreenShot( const char *pScreenShotFileName )
|
|||
MessageBox( NULL, pScreenShotFileName, "Screen Captured", MB_OK );
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
||||
void Config_Load_Video()
|
||||
{
|
||||
REGLOAD(TEXT(REGVALUE_VIDEO_MODE ),&g_eVideoType);
|
||||
REGLOAD(TEXT(REGVALUE_VIDEO_HALF_SCAN_LINES),&g_uHalfScanLines);
|
||||
REGLOAD(TEXT(REGVALUE_VIDEO_MONO_COLOR ),&monochrome);
|
||||
|
||||
if (g_eVideoType >= NUM_VIDEO_MODES)
|
||||
g_eVideoType = VT_COLOR_STANDARD; // Old default: VT_COLOR_TVEMU
|
||||
}
|
||||
|
||||
void Config_Save_Video()
|
||||
{
|
||||
REGSAVE(TEXT(REGVALUE_VIDEO_MODE ),g_eVideoType);
|
||||
REGSAVE(TEXT(REGVALUE_VIDEO_HALF_SCAN_LINES),g_uHalfScanLines);
|
||||
REGSAVE(TEXT(REGVALUE_VIDEO_MONO_COLOR ),monochrome);
|
||||
}
|
||||
|
|
|
@ -135,3 +135,6 @@ void Video_TakeScreenShot( int iScreenShotType );
|
|||
BYTE VideoCheckMode (WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG uExecutedCycles);
|
||||
BYTE VideoCheckVbl (WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG uExecutedCycles);
|
||||
BYTE VideoSetMode (WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG uExecutedCycles);
|
||||
|
||||
void Config_Load_Video(void);
|
||||
void Config_Save_Video(void);
|
||||
|
|
Loading…
Reference in New Issue
Block a user