FrameBase: some changes to ease implementations (PR #910)

. simplify the interface FrameBase to make it easier to implement it for different cases (remove HDC and make parameters more explicit)
. remove functions which are only called on a Win32Frame (in which case a cast is guaranteed to succeed)
. otherwise there is the risk that every FrameBase implementation wants to add its own variants.
. FrameBase::FrameRefreshStatus() simplify implementation: pass all flags explicitly
This commit is contained in:
Andrea 2021-01-10 16:33:06 +00:00 committed by GitHub
parent 159cde7d64
commit 6cffb30330
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 292 additions and 239 deletions

View File

@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "PropertySheet.h" #include "PropertySheet.h"
#include "../Windows/AppleWin.h" #include "../Windows/AppleWin.h"
#include "../Windows/WinFrame.h" #include "../Windows/Win32Frame.h"
#include "../Registry.h" #include "../Registry.h"
#include "../SerialComms.h" #include "../SerialComms.h"
#include "../resource/resource.h" #include "../resource/resource.h"
@ -115,7 +115,7 @@ INT_PTR CPageConfig::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPA
break; break;
case IDC_MONOCOLOR: case IDC_MONOCOLOR:
GetFrame().ChooseMonochromeColor(); Win32Frame::GetWin32Frame().ChooseMonochromeColor();
break; break;
case IDC_CHECK_CONFIRM_REBOOT: case IDC_CHECK_CONFIRM_REBOOT:
@ -201,7 +201,8 @@ INT_PTR CPageConfig::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPA
m_PropertySheetHelper.FillComboBox(hWnd,IDC_VIDEOTYPE, GetVideo().GetVideoChoices(), GetVideo().GetVideoType()); m_PropertySheetHelper.FillComboBox(hWnd,IDC_VIDEOTYPE, GetVideo().GetVideoChoices(), GetVideo().GetVideoType());
CheckDlgButton(hWnd, IDC_CHECK_HALF_SCAN_LINES, GetVideo().IsVideoStyle(VS_HALF_SCANLINES) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hWnd, IDC_CHECK_HALF_SCAN_LINES, GetVideo().IsVideoStyle(VS_HALF_SCANLINES) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hWnd, IDC_CHECK_FS_SHOW_SUBUNIT_STATUS, GetFullScreenShowSubunitStatus() ? BST_CHECKED : BST_UNCHECKED); Win32Frame& win32Frame = Win32Frame::GetWin32Frame();
CheckDlgButton(hWnd, IDC_CHECK_FS_SHOW_SUBUNIT_STATUS, win32Frame.GetFullScreenShowSubunitStatus() ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hWnd, IDC_CHECK_VERTICAL_BLEND, GetVideo().IsVideoStyle(VS_COLOR_VERTICAL_BLEND) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hWnd, IDC_CHECK_VERTICAL_BLEND, GetVideo().IsVideoStyle(VS_COLOR_VERTICAL_BLEND) ? BST_CHECKED : BST_UNCHECKED);
EnableWindow(GetDlgItem(hWnd, IDC_CHECK_VERTICAL_BLEND), (GetVideo().GetVideoType() == VT_COLOR_IDEALIZED) ? TRUE : FALSE); EnableWindow(GetDlgItem(hWnd, IDC_CHECK_VERTICAL_BLEND), (GetVideo().GetVideoType() == VT_COLOR_IDEALIZED) ? TRUE : FALSE);
@ -271,6 +272,7 @@ INT_PTR CPageConfig::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPA
void CPageConfig::DlgOK(HWND hWnd) void CPageConfig::DlgOK(HWND hWnd)
{ {
bool bVideoReinit = false; bool bVideoReinit = false;
Win32Frame& win32Frame = Win32Frame::GetWin32Frame();
const VideoType_e newVideoType = (VideoType_e) SendDlgItemMessage(hWnd, IDC_VIDEOTYPE, CB_GETCURSEL, 0, 0); const VideoType_e newVideoType = (VideoType_e) SendDlgItemMessage(hWnd, IDC_VIDEOTYPE, CB_GETCURSEL, 0, 0);
if (GetVideo().GetVideoType() != newVideoType) if (GetVideo().GetVideoType() != newVideoType)
@ -312,34 +314,35 @@ void CPageConfig::DlgOK(HWND hWnd)
{ {
GetVideo().Config_Save_Video(); GetVideo().Config_Save_Video();
GetFrame().FrameRefreshStatus(DRAW_TITLE, false); win32Frame.FrameRefreshStatus(DRAW_TITLE);
GetVideo().VideoReinitialize(); GetVideo().VideoReinitialize();
if ((g_nAppMode != MODE_LOGO) && (g_nAppMode != MODE_DEBUG)) if ((g_nAppMode != MODE_LOGO) && (g_nAppMode != MODE_DEBUG))
{ {
GetFrame().VideoRedrawScreen(); win32Frame.VideoRedrawScreen();
} }
} }
// //
const bool bNewFSSubunitStatus = IsDlgButtonChecked(hWnd, IDC_CHECK_FS_SHOW_SUBUNIT_STATUS) ? true : false; const bool bNewFSSubunitStatus = IsDlgButtonChecked(hWnd, IDC_CHECK_FS_SHOW_SUBUNIT_STATUS) ? true : false;
if (GetFullScreenShowSubunitStatus() != bNewFSSubunitStatus)
if (win32Frame.GetFullScreenShowSubunitStatus() != bNewFSSubunitStatus)
{ {
REGSAVE(TEXT(REGVALUE_FS_SHOW_SUBUNIT_STATUS), bNewFSSubunitStatus ? 1 : 0); REGSAVE(TEXT(REGVALUE_FS_SHOW_SUBUNIT_STATUS), bNewFSSubunitStatus ? 1 : 0);
GetFrame().SetFullScreenShowSubunitStatus(bNewFSSubunitStatus); win32Frame.SetFullScreenShowSubunitStatus(bNewFSSubunitStatus);
if (IsFullScreen()) if (win32Frame.IsFullScreen())
GetFrame().FrameRefreshStatus(DRAW_BACKGROUND | DRAW_LEDS | DRAW_DISK_STATUS); win32Frame.FrameRefreshStatus(DRAW_BACKGROUND | DRAW_LEDS | DRAW_DISK_STATUS);
} }
// //
const BOOL bNewConfirmReboot = IsDlgButtonChecked(hWnd, IDC_CHECK_CONFIRM_REBOOT) ? 1 : 0; const BOOL bNewConfirmReboot = IsDlgButtonChecked(hWnd, IDC_CHECK_CONFIRM_REBOOT) ? 1 : 0;
if (GetFrame().g_bConfirmReboot != bNewConfirmReboot) if (win32Frame.g_bConfirmReboot != bNewConfirmReboot)
{ {
REGSAVE(TEXT(REGVALUE_CONFIRM_REBOOT), bNewConfirmReboot); REGSAVE(TEXT(REGVALUE_CONFIRM_REBOOT), bNewConfirmReboot);
GetFrame().g_bConfirmReboot = bNewConfirmReboot; win32Frame.g_bConfirmReboot = bNewConfirmReboot;
} }
// //

View File

@ -91,14 +91,14 @@ INT_PTR CPageDisk::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARA
if (HIWORD(wparam) == CBN_SELCHANGE) if (HIWORD(wparam) == CBN_SELCHANGE)
{ {
HandleFloppyDriveCombo(hWnd, DRIVE_1, LOWORD(wparam)); HandleFloppyDriveCombo(hWnd, DRIVE_1, LOWORD(wparam));
GetFrame().FrameRefreshStatus(DRAW_BUTTON_DRIVES); GetFrame().FrameRefreshStatus(DRAW_BUTTON_DRIVES | DRAW_DISK_STATUS);
} }
break; break;
case IDC_COMBO_DISK2: case IDC_COMBO_DISK2:
if (HIWORD(wparam) == CBN_SELCHANGE) if (HIWORD(wparam) == CBN_SELCHANGE)
{ {
HandleFloppyDriveCombo(hWnd, DRIVE_2, LOWORD(wparam)); HandleFloppyDriveCombo(hWnd, DRIVE_2, LOWORD(wparam));
GetFrame().FrameRefreshStatus(DRAW_BUTTON_DRIVES); GetFrame().FrameRefreshStatus(DRAW_BUTTON_DRIVES | DRAW_DISK_STATUS);
} }
break; break;
case IDC_COMBO_HDD1: case IDC_COMBO_HDD1:

View File

@ -29,7 +29,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "../Windows/AppleWin.h" // g_nAppMode, g_uScrollLockToggle, sg_PropertySheet #include "../Windows/AppleWin.h" // g_nAppMode, g_uScrollLockToggle, sg_PropertySheet
#include "../CardManager.h" #include "../CardManager.h"
#include "../Disk.h" #include "../Disk.h"
#include "../Windows/WinFrame.h"
#include "../Log.h" #include "../Log.h"
#include "../Registry.h" #include "../Registry.h"
#include "../SaveState.h" #include "../SaveState.h"

View File

@ -44,6 +44,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "../Memory.h" #include "../Memory.h"
#include "../NTSC.h" #include "../NTSC.h"
#include "../SoundCore.h" // SoundCore_SetFade() #include "../SoundCore.h" // SoundCore_SetFade()
#include "../Windows/Win32Frame.h"
#include "../Windows/WinFrame.h" #include "../Windows/WinFrame.h"
// #define DEBUG_COMMAND_HELP 1 // #define DEBUG_COMMAND_HELP 1
@ -752,7 +753,7 @@ Update_t CmdBenchmarkStop (int nArgs)
g_bBenchmarking = false; g_bBenchmarking = false;
DebugEnd(); DebugEnd();
GetFrame().FrameRefreshStatus(DRAW_TITLE); GetFrame().FrameRefreshStatus(DRAW_TITLE | DRAW_DISK_STATUS);
GetFrame().VideoRedrawScreen(); GetFrame().VideoRedrawScreen();
DWORD currtime = GetTickCount(); DWORD currtime = GetTickCount();
while ((extbench = GetTickCount()) != currtime) while ((extbench = GetTickCount()) != currtime)
@ -1962,7 +1963,7 @@ static Update_t CmdGo (int nArgs, const bool bFullSpeed)
g_bGoCmd_ReinitFlag = true; g_bGoCmd_ReinitFlag = true;
g_nAppMode = MODE_STEPPING; g_nAppMode = MODE_STEPPING;
GetFrame().FrameRefreshStatus(DRAW_TITLE); GetFrame().FrameRefreshStatus(DRAW_TITLE | DRAW_DISK_STATUS);
SoundCore_SetFade(FADE_IN); SoundCore_SetFade(FADE_IN);
@ -2031,7 +2032,7 @@ Update_t CmdTrace (int nArgs)
g_nDebugStepStart = regs.pc; g_nDebugStepStart = regs.pc;
g_nDebugStepUntil = -1; g_nDebugStepUntil = -1;
g_nAppMode = MODE_STEPPING; g_nAppMode = MODE_STEPPING;
GetFrame().FrameRefreshStatus(DRAW_TITLE); GetFrame().FrameRefreshStatus(DRAW_TITLE | DRAW_DISK_STATUS);
DebugContinueStepping(true); DebugContinueStepping(true);
return UPDATE_ALL; // TODO: Verify // 0 return UPDATE_ALL; // TODO: Verify // 0
@ -2091,7 +2092,7 @@ Update_t CmdTraceLine (int nArgs)
g_nDebugStepUntil = -1; g_nDebugStepUntil = -1;
g_nAppMode = MODE_STEPPING; g_nAppMode = MODE_STEPPING;
GetFrame().FrameRefreshStatus(DRAW_TITLE); GetFrame().FrameRefreshStatus(DRAW_TITLE | DRAW_DISK_STATUS);
DebugContinueStepping(true); DebugContinueStepping(true);
return UPDATE_ALL; // TODO: Verify // 0 return UPDATE_ALL; // TODO: Verify // 0
@ -3771,7 +3772,7 @@ Update_t CmdDisk ( int nArgs)
return HelpLastCommand(); return HelpLastCommand();
diskCard.EjectDisk( iDrive ); diskCard.EjectDisk( iDrive );
GetFrame().FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES); GetFrame().FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES | DRAW_DISK_STATUS);
} }
else else
if (iParam == PARAM_DISK_PROTECT) if (iParam == PARAM_DISK_PROTECT)
@ -3785,7 +3786,7 @@ Update_t CmdDisk ( int nArgs)
bProtect = g_aArgs[ 3 ].nValue ? true : false; bProtect = g_aArgs[ 3 ].nValue ? true : false;
diskCard.SetProtect( iDrive, bProtect ); diskCard.SetProtect( iDrive, bProtect );
GetFrame().FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES); GetFrame().FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES | DRAW_DISK_STATUS);
} }
else else
{ {
@ -3796,7 +3797,7 @@ Update_t CmdDisk ( int nArgs)
// DISK # "Diskname" // DISK # "Diskname"
diskCard.InsertDisk( iDrive, pDiskName, IMAGE_FORCE_WRITE_PROTECTED, IMAGE_DONT_CREATE ); diskCard.InsertDisk( iDrive, pDiskName, IMAGE_FORCE_WRITE_PROTECTED, IMAGE_DONT_CREATE );
GetFrame().FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES); GetFrame().FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES | DRAW_DISK_STATUS);
} }
return UPDATE_CONSOLE_DISPLAY; return UPDATE_CONSOLE_DISPLAY;
@ -8547,7 +8548,7 @@ void DebugBegin ()
GetDebuggerMemDC(); GetDebuggerMemDC();
g_nAppMode = MODE_DEBUG; g_nAppMode = MODE_DEBUG;
GetFrame().FrameRefreshStatus(DRAW_TITLE); GetFrame().FrameRefreshStatus(DRAW_TITLE | DRAW_DISK_STATUS);
if (GetMainCpu() == CPU_6502) if (GetMainCpu() == CPU_6502)
{ {
@ -8734,7 +8735,7 @@ void DebugContinueStepping(const bool bCallerWillUpdateDisplay/*=false*/)
SoundCore_SetFade(FADE_OUT); // NB. Call when MODE_STEPPING (not MODE_DEBUG) - see function SoundCore_SetFade(FADE_OUT); // NB. Call when MODE_STEPPING (not MODE_DEBUG) - see function
g_nAppMode = MODE_DEBUG; g_nAppMode = MODE_DEBUG;
GetFrame().FrameRefreshStatus(DRAW_TITLE); GetFrame().FrameRefreshStatus(DRAW_TITLE | DRAW_DISK_STATUS);
// BUG: PageUp, Trace - doesn't center cursor // BUG: PageUp, Trace - doesn't center cursor
g_nDisasmCurAddress = regs.pc; g_nDisasmCurAddress = regs.pc;
@ -9662,9 +9663,10 @@ void DebuggerMouseClick( int x, int y )
int nFontHeight = g_aFontConfig[ FONT_DISASM_DEFAULT ]._nLineHeight * GetViewportScale(); int nFontHeight = g_aFontConfig[ FONT_DISASM_DEFAULT ]._nLineHeight * GetViewportScale();
// do picking // do picking
Win32Frame& win32Frame = Win32Frame::GetWin32Frame();
const int nOffsetX = IsFullScreen() ? GetFullScreenOffsetX() : Get3DBorderWidth(); const int nOffsetX = win32Frame.IsFullScreen() ? win32Frame.GetFullScreenOffsetX() : win32Frame.Get3DBorderWidth();
const int nOffsetY = IsFullScreen() ? GetFullScreenOffsetY() : Get3DBorderHeight(); const int nOffsetY = win32Frame.IsFullScreen() ? win32Frame.GetFullScreenOffsetY() : win32Frame.Get3DBorderHeight();
const int nOffsetInScreenX = x - nOffsetX; const int nOffsetInScreenX = x - nOffsetX;
const int nOffsetInScreenY = y - nOffsetY; const int nOffsetInScreenY = y - nOffsetY;

View File

@ -36,6 +36,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "../Interface.h" #include "../Interface.h"
#include "../CPU.h" #include "../CPU.h"
#include "../Windows/WinFrame.h" #include "../Windows/WinFrame.h"
#include "../Windows/Win32Frame.h"
#include "../LanguageCard.h" #include "../LanguageCard.h"
#include "../Memory.h" #include "../Memory.h"
#include "../Mockingboard.h" #include "../Mockingboard.h"
@ -671,8 +672,10 @@ void StretchBltMemToFrameDC(void)
int nViewportCX, nViewportCY; int nViewportCX, nViewportCY;
GetViewportCXCY(nViewportCX, nViewportCY); GetViewportCXCY(nViewportCX, nViewportCY);
int xdest = IsFullScreen() ? GetFullScreenOffsetX() : 0; Win32Frame& win32Frame = Win32Frame::GetWin32Frame();
int ydest = IsFullScreen() ? GetFullScreenOffsetY() : 0;
int xdest = win32Frame.IsFullScreen() ? win32Frame.GetFullScreenOffsetX() : 0;
int ydest = win32Frame.IsFullScreen() ? win32Frame.GetFullScreenOffsetY() : 0;
int wdest = nViewportCX; int wdest = nViewportCX;
int hdest = nViewportCY; int hdest = nViewportCY;

View File

@ -218,7 +218,7 @@ void Disk2InterfaceCard::CheckSpinning(const bool stateChanged, const ULONG uExe
m_floppyDrive[m_currDrive].m_spinning = SPINNING_CYCLES; m_floppyDrive[m_currDrive].m_spinning = SPINNING_CYCLES;
if (modeChanged) if (modeChanged)
GetFrame().FrameDrawDiskLEDS( (HDC)0 ); GetFrame().FrameDrawDiskLEDS();
if (modeChanged) if (modeChanged)
{ {
@ -510,7 +510,7 @@ void __stdcall Disk2InterfaceCard::ControlStepper(WORD, WORD address, BYTE, BYTE
pDrive->m_phasePrecise = newPhasePrecise; pDrive->m_phasePrecise = newPhasePrecise;
pFloppy->m_trackimagedata = false; pFloppy->m_trackimagedata = false;
m_formatTrack.DriveNotWritingTrack(); m_formatTrack.DriveNotWritingTrack();
GetFrame().FrameDrawDiskStatus((HDC)0); // Show track status (GH#201) GetFrame().FrameDrawDiskStatus(); // Show track status (GH#201)
} }
#if LOG_DISK_PHASES #if LOG_DISK_PHASES
@ -682,7 +682,7 @@ ImageError_e Disk2InterfaceCard::InsertDisk(const int drive, LPCTSTR pszImageFil
if (!strcmp(pszOtherPathname.c_str(), szCurrentPathname)) if (!strcmp(pszOtherPathname.c_str(), szCurrentPathname))
{ {
EjectDisk(!drive); EjectDisk(!drive);
GetFrame().FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES); GetFrame().FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES | DRAW_DISK_STATUS);
} }
} }
@ -1032,7 +1032,7 @@ void __stdcall Disk2InterfaceCard::ReadWrite(WORD pc, WORD addr, BYTE bWrite, BY
// Show track status (GH#201) - NB. Prevent flooding of forcing UI to redraw!!! // Show track status (GH#201) - NB. Prevent flooding of forcing UI to redraw!!!
if ((pFloppy->m_byte & 0xFF) == 0) if ((pFloppy->m_byte & 0xFF) == 0)
GetFrame().FrameDrawDiskStatus( (HDC)0 ); GetFrame().FrameDrawDiskStatus();
} }
//=========================================================================== //===========================================================================
@ -1183,7 +1183,7 @@ void __stdcall Disk2InterfaceCard::DataLatchReadWriteWOZ(WORD pc, WORD addr, BYT
// Show track status (GH#201) - NB. Prevent flooding of forcing UI to redraw!!! // Show track status (GH#201) - NB. Prevent flooding of forcing UI to redraw!!!
if ((floppy.m_byte & 0xFF) == 0) if ((floppy.m_byte & 0xFF) == 0)
GetFrame().FrameDrawDiskStatus((HDC)0); GetFrame().FrameDrawDiskStatus();
} }
void Disk2InterfaceCard::DataLatchReadWOZ(WORD pc, WORD addr, UINT bitCellRemainder) void Disk2InterfaceCard::DataLatchReadWOZ(WORD pc, WORD addr, UINT bitCellRemainder)
@ -1542,11 +1542,11 @@ void Disk2InterfaceCard::Reset(const bool bIsPowerCycle)
m_floppyDrive[DRIVE_2].m_spinning = 0; m_floppyDrive[DRIVE_2].m_spinning = 0;
m_floppyDrive[DRIVE_2].m_writelight = 0; m_floppyDrive[DRIVE_2].m_writelight = 0;
GetFrame().FrameRefreshStatus(DRAW_LEDS, false); GetFrame().FrameRefreshStatus(DRAW_LEDS);
} }
InitFirmware(GetCxRomPeripheral()); InitFirmware(GetCxRomPeripheral());
GetFrame().FrameRefreshStatus(DRAW_TITLE, false); GetFrame().FrameRefreshStatus(DRAW_TITLE);
} }
void Disk2InterfaceCard::ResetSwitches(void) void Disk2InterfaceCard::ResetSwitches(void)
@ -1684,7 +1684,7 @@ void __stdcall Disk2InterfaceCard::SetWriteMode(WORD, WORD, BYTE, BYTE, ULONG uE
m_floppyDrive[m_currDrive].m_writelight = WRITELIGHT_CYCLES; m_floppyDrive[m_currDrive].m_writelight = WRITELIGHT_CYCLES;
if (modechange) if (modechange)
GetFrame().FrameDrawDiskLEDS( (HDC)0 ); GetFrame().FrameDrawDiskLEDS();
} }
//=========================================================================== //===========================================================================
@ -1700,8 +1700,8 @@ void Disk2InterfaceCard::UpdateDriveState(DWORD cycles)
{ {
if (!(pDrive->m_spinning -= MIN(pDrive->m_spinning, cycles))) if (!(pDrive->m_spinning -= MIN(pDrive->m_spinning, cycles)))
{ {
GetFrame().FrameDrawDiskLEDS( (HDC)0 ); GetFrame().FrameDrawDiskLEDS();
GetFrame().FrameDrawDiskStatus( (HDC)0 ); GetFrame().FrameDrawDiskStatus();
} }
} }
@ -1713,8 +1713,8 @@ void Disk2InterfaceCard::UpdateDriveState(DWORD cycles)
{ {
if (!(pDrive->m_writelight -= MIN(pDrive->m_writelight, cycles))) if (!(pDrive->m_writelight -= MIN(pDrive->m_writelight, cycles)))
{ {
GetFrame().FrameDrawDiskLEDS( (HDC)0 ); GetFrame().FrameDrawDiskLEDS();
GetFrame().FrameDrawDiskStatus( (HDC)0 ); GetFrame().FrameDrawDiskStatus();
} }
} }
} }
@ -1770,7 +1770,7 @@ bool Disk2InterfaceCard::DriveSwap(void)
SaveLastDiskImage(DRIVE_1); SaveLastDiskImage(DRIVE_1);
SaveLastDiskImage(DRIVE_2); SaveLastDiskImage(DRIVE_2);
GetFrame().FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES, false); GetFrame().FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES);
return true; return true;
} }
@ -2261,7 +2261,7 @@ bool Disk2InterfaceCard::LoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT
LoadSnapshotDriveUnit(yamlLoadHelper, DRIVE_1, version); LoadSnapshotDriveUnit(yamlLoadHelper, DRIVE_1, version);
LoadSnapshotDriveUnit(yamlLoadHelper, DRIVE_2, version); LoadSnapshotDriveUnit(yamlLoadHelper, DRIVE_2, version);
GetFrame().FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES); GetFrame().FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES | DRAW_DISK_STATUS);
return true; return true;
} }

View File

@ -18,9 +18,10 @@ public:
virtual void Initialize(void) = 0; virtual void Initialize(void) = 0;
virtual void Destroy(void) = 0; virtual void Destroy(void) = 0;
virtual void FrameDrawDiskLEDS(HDC hdc) = 0; virtual void FrameDrawDiskLEDS() = 0;
virtual void FrameDrawDiskStatus(HDC hdc) = 0; virtual void FrameDrawDiskStatus() = 0;
virtual void FrameRefreshStatus(int, bool bUpdateDiskStatus = true) = 0;
virtual void FrameRefreshStatus(int drawflags) = 0;
virtual void FrameUpdateApple2Type() = 0; virtual void FrameUpdateApple2Type() = 0;
virtual void FrameSetCursorPosByMousePos() = 0; virtual void FrameSetCursorPosByMousePos() = 0;
@ -32,9 +33,6 @@ public:
virtual void SetLoadedSaveStateFlag(const bool bFlag) = 0; virtual void SetLoadedSaveStateFlag(const bool bFlag) = 0;
virtual void VideoPresentScreen(void) = 0; virtual void VideoPresentScreen(void) = 0;
virtual void ChooseMonochromeColor(void) = 0;
virtual void Benchmark(void) = 0;
virtual void DisplayLogo(void) = 0;
void VideoRefreshScreen(uint32_t uRedrawWholeScreenVideoMode, bool bRedrawWholeScreen); void VideoRefreshScreen(uint32_t uRedrawWholeScreenVideoMode, bool bRedrawWholeScreen);
void VideoRedrawScreen(void); void VideoRedrawScreen(void);

View File

@ -417,7 +417,7 @@ BOOL HD_Insert(const int iDrive, const std::string & pszImageFilename)
if (!strcmp(pszOtherPathname.c_str(), szCurrentPathname)) if (!strcmp(pszOtherPathname.c_str(), szCurrentPathname))
{ {
HD_Unplug(!iDrive); HD_Unplug(!iDrive);
GetFrame().FrameRefreshStatus(DRAW_LEDS); GetFrame().FrameRefreshStatus(DRAW_LEDS | DRAW_DISK_STATUS);
} }
} }
@ -711,7 +711,7 @@ static BYTE __stdcall HD_IO_EMUL(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG
if( pHDD->hd_status_prev != pHDD->hd_status_next ) // Update LEDs if state changes if( pHDD->hd_status_prev != pHDD->hd_status_next ) // Update LEDs if state changes
{ {
pHDD->hd_status_prev = pHDD->hd_status_next; pHDD->hd_status_prev = pHDD->hd_status_next;
GetFrame().FrameRefreshStatus(DRAW_LEDS); GetFrame().FrameRefreshStatus(DRAW_LEDS | DRAW_DISK_STATUS);
} }
#endif #endif
@ -740,7 +740,7 @@ bool HD_ImageSwap(void)
HD_SaveLastDiskImage(HARDDISK_1); HD_SaveLastDiskImage(HARDDISK_1);
HD_SaveLastDiskImage(HARDDISK_2); HD_SaveLastDiskImage(HARDDISK_2);
GetFrame().FrameRefreshStatus(DRAW_LEDS, false); GetFrame().FrameRefreshStatus(DRAW_LEDS);
return true; return true;
} }
@ -900,7 +900,7 @@ bool HD_LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version, co
HD_SetEnabled(true); HD_SetEnabled(true);
GetFrame().FrameRefreshStatus(DRAW_LEDS); GetFrame().FrameRefreshStatus(DRAW_LEDS | DRAW_DISK_STATUS);
return true; return true;
} }

View File

@ -301,7 +301,7 @@ void KeybQueueKeypress (WPARAM key, Keystroke_e bASCII)
if (g_Apple2Type == A2TYPE_TK30002E) if (g_Apple2Type == A2TYPE_TK30002E)
{ {
g_bTK3KModeKey = (GetKeyState(VK_SCROLL) & 1) ? true : false; // Sync with the Scroll Lock status g_bTK3KModeKey = (GetKeyState(VK_SCROLL) & 1) ? true : false; // Sync with the Scroll Lock status
GetFrame().FrameRefreshStatus(DRAW_LEDS); // TODO: Implement |Mode| LED in the UI; make it appear only when in TK3000 mode GetFrame().FrameRefreshStatus(DRAW_LEDS | DRAW_DISK_STATUS); // TODO: Implement |Mode| LED in the UI; make it appear only when in TK3000 mode
GetFrame().VideoRedrawScreen(); // TODO: Still need to implement page mode switching and 'whatnot' GetFrame().VideoRedrawScreen(); // TODO: Still need to implement page mode switching and 'whatnot'
} }
return; return;
@ -537,7 +537,7 @@ void KeybToggleCapsLock ()
if (!IS_APPLE2) if (!IS_APPLE2)
{ {
g_bCapsLock = (GetKeyState(VK_CAPITAL) & 1); g_bCapsLock = (GetKeyState(VK_CAPITAL) & 1);
GetFrame().FrameRefreshStatus(DRAW_LEDS); GetFrame().FrameRefreshStatus(DRAW_LEDS | DRAW_DISK_STATUS);
} }
} }
@ -546,7 +546,7 @@ void KeybToggleP8ACapsLock ()
{ {
_ASSERT(g_Apple2Type == A2TYPE_PRAVETS8A); _ASSERT(g_Apple2Type == A2TYPE_PRAVETS8A);
P8CAPS_ON = !P8CAPS_ON; P8CAPS_ON = !P8CAPS_ON;
GetFrame().FrameRefreshStatus(DRAW_LEDS); GetFrame().FrameRefreshStatus(DRAW_LEDS | DRAW_DISK_STATUS);
// g_bP8CapsLock= g_bP8CapsLock?false:true; //The same as the upper, but slower // g_bP8CapsLock= g_bP8CapsLock?false:true; //The same as the upper, but slower
} }

View File

@ -44,6 +44,6 @@ void PravetsReset(void)
{ {
P8CAPS_ON = false; P8CAPS_ON = false;
TapeWrite(0, 0, 0, 0 ,0); TapeWrite(0, 0, 0, 0 ,0);
GetFrame().FrameRefreshStatus(DRAW_LEDS); GetFrame().FrameRefreshStatus(DRAW_LEDS | DRAW_DISK_STATUS);
} }
} }

View File

@ -402,7 +402,7 @@ void InsertFloppyDisks(const UINT slot, LPSTR szImageName_drive[NUM_DRIVES], boo
{ {
bRes = DoDiskInsert(slot, DRIVE_1, szImageName_drive[DRIVE_1]); bRes = DoDiskInsert(slot, DRIVE_1, szImageName_drive[DRIVE_1]);
LogFileOutput("Init: S%d, DoDiskInsert(D1), res=%d\n", slot, bRes); LogFileOutput("Init: S%d, DoDiskInsert(D1), res=%d\n", slot, bRes);
GetFrame().FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES); // floppy activity LEDs and floppy buttons GetFrame().FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES | DRAW_DISK_STATUS); // floppy activity LEDs and floppy buttons
bBoot = true; bBoot = true;
} }
@ -442,7 +442,7 @@ void InsertHardDisks(LPSTR szImageName_harddisk[NUM_HARDDISKS], bool& bBoot)
{ {
bRes = DoHardDiskInsert(HARDDISK_1, szImageName_harddisk[HARDDISK_1]); bRes = DoHardDiskInsert(HARDDISK_1, szImageName_harddisk[HARDDISK_1]);
LogFileOutput("Init: DoHardDiskInsert(HDD1), res=%d\n", bRes); LogFileOutput("Init: DoHardDiskInsert(HDD1), res=%d\n", bRes);
GetFrame().FrameRefreshStatus(DRAW_LEDS); // harddisk activity LED GetFrame().FrameRefreshStatus(DRAW_LEDS | DRAW_DISK_STATUS); // harddisk activity LED
bBoot = true; bBoot = true;
} }

View File

@ -768,7 +768,7 @@ static void OneTimeInitialization(HINSTANCE passinstance)
LogFileOutput("Init: RegisterExtensions()\n"); LogFileOutput("Init: RegisterExtensions()\n");
} }
FrameRegisterClass(); Win32Frame::GetWin32Frame().FrameRegisterClass();
LogFileOutput("Init: FrameRegisterClass()\n"); LogFileOutput("Init: FrameRegisterClass()\n");
} }
@ -843,7 +843,7 @@ static void RepeatInitialization(void)
LogFileOutput("Main: VideoInitialize()\n"); LogFileOutput("Main: VideoInitialize()\n");
LogFileOutput("Main: FrameCreateWindow() - pre\n"); LogFileOutput("Main: FrameCreateWindow() - pre\n");
FrameCreateWindow(); // GetFrame().g_hFrameWindow is now valid Win32Frame::GetWin32Frame().FrameCreateWindow(); // GetFrame().g_hFrameWindow is now valid
LogFileOutput("Main: FrameCreateWindow() - post\n"); LogFileOutput("Main: FrameCreateWindow() - post\n");
// Init palette color // Init palette color

View File

@ -22,6 +22,20 @@ Win32Frame::Win32Frame()
g_hLogoBitmap = (HBITMAP)0; g_hLogoBitmap = (HBITMAP)0;
g_hDeviceBitmap = (HBITMAP)0; g_hDeviceBitmap = (HBITMAP)0;
g_hDeviceDC = (HDC)0; g_hDeviceDC = (HDC)0;
g_bAltEnter_ToggleFullScreen = false;
g_bIsFullScreen = false;
g_bShowingCursor = true;
g_bLastCursorInAppleViewport = false;
g_uCount100msec = 0;
g_TimerIDEvent_100msec = 0;
g_bUsingCursor = FALSE;
g_bAppActive = false;
g_bFrameActive = false;
g_windowMinimized = false;
g_bFullScreen_ShowSubunitStatus = true;
g_win_fullscreen_scale = 1;
g_win_fullscreen_offsetx = 0;
g_win_fullscreen_offsety = 0;
} }
void Win32Frame::videoCreateDIBSection(Video & video) void Win32Frame::videoCreateDIBSection(Video & video)
@ -499,3 +513,10 @@ void Win32Frame::DDUninit(void)
} }
#undef SAFE_RELEASE #undef SAFE_RELEASE
Win32Frame& Win32Frame::GetWin32Frame()
{
FrameBase& frameBase = GetFrame();
Win32Frame& win32Frame = dynamic_cast<Win32Frame&>(frameBase);
return win32Frame;
}

View File

@ -4,14 +4,23 @@
class Video; class Video;
#if 0 // enable non-integral full-screen scaling
#define FULLSCREEN_SCALE_TYPE float
#else
#define FULLSCREEN_SCALE_TYPE int
#endif
class Win32Frame : public FrameBase class Win32Frame : public FrameBase
{ {
public: public:
Win32Frame(); Win32Frame();
virtual void FrameDrawDiskLEDS(HDC hdc); static Win32Frame& GetWin32Frame();
virtual void FrameDrawDiskStatus(HDC hdc);
virtual void FrameRefreshStatus(int, bool bUpdateDiskStatus = true); virtual void FrameDrawDiskLEDS();
virtual void FrameDrawDiskStatus();
virtual void FrameRefreshStatus(int drawflags);
virtual void FrameUpdateApple2Type(); virtual void FrameUpdateApple2Type();
virtual void FrameSetCursorPosByMousePos(); virtual void FrameSetCursorPosByMousePos();
@ -25,21 +34,73 @@ public:
virtual void Initialize(void); virtual void Initialize(void);
virtual void Destroy(void); virtual void Destroy(void);
virtual void VideoPresentScreen(void); virtual void VideoPresentScreen(void);
virtual void ChooseMonochromeColor(void);
virtual void Benchmark(void); bool GetFullScreenShowSubunitStatus(void);
virtual void DisplayLogo(void); int GetFullScreenOffsetX(void);
int GetFullScreenOffsetY(void);
bool IsFullScreen(void);
void FrameRegisterClass();
void FrameCreateWindow(void);
void ChooseMonochromeColor(void);
UINT Get3DBorderWidth(void);
UINT Get3DBorderHeight(void);
LRESULT WndProc(HWND window, UINT message, WPARAM wparam, LPARAM lparam);
private: private:
static BOOL CALLBACK DDEnumProc(LPGUID lpGUID, LPCTSTR lpszDesc, LPCTSTR lpszDrvName, LPVOID lpContext);
void videoCreateDIBSection(Video& video); void videoCreateDIBSection(Video& video);
void VideoDrawLogoBitmap(HDC hDstDC, int xoff, int yoff, int srcw, int srch, int scale); void VideoDrawLogoBitmap(HDC hDstDC, int xoff, int yoff, int srcw, int srch, int scale);
static BOOL CALLBACK DDEnumProc(LPGUID lpGUID, LPCTSTR lpszDesc, LPCTSTR lpszDrvName, LPVOID lpContext);
bool DDInit(void); bool DDInit(void);
void DDUninit(void); void DDUninit(void);
void Benchmark(void);
void DisplayLogo(void);
void FrameDrawDiskLEDS(HDC hdc); // overloaded Win32 only, call via GetWin32Frame()
void FrameDrawDiskStatus(HDC hdc); // overloaded Win32 only, call via GetWin32Frame()
void EraseButton(int number);
void DrawButton(HDC passdc, int number);
void DrawCrosshairs(int x, int y);
void DrawFrameWindow(bool bPaintingWindow = false);
void DrawStatusArea(HDC passdc, int drawflags);
void ProcessButtonClick(int button, bool bFromButtonUI = false);
bool ConfirmReboot(bool bFromButtonUI);
void ProcessDiskPopupMenu(HWND hwnd, POINT pt, const int iDrive);
void RelayEvent(UINT message, WPARAM wparam, LPARAM lparam);
void SetFullScreenMode();
void SetNormalMode();
void SetUsingCursor(BOOL bNewValue);
void SetupTooltipControls(void);
void FrameResizeWindow(int nNewScale);
void RevealCursor();
void ScreenWindowResize(const bool bCtrlKey);
void UpdateMouseInAppleViewport(int iOutOfBoundsX, int iOutOfBoundsY, int x=0, int y=0);
void DrawCrosshairsMouse();
void FrameSetCursorPosByMousePos(int x, int y, int dx, int dy, bool bLeavingAppleScreen);
void CreateGdiObjects(void);
void FrameShowCursor(BOOL bShow);
void FullScreenRevealCursor(void);
bool g_bAltEnter_ToggleFullScreen; // Default for ALT+ENTER is to toggle between windowed and full-screen modes
bool g_bIsFullScreen;
bool g_bShowingCursor;
bool g_bLastCursorInAppleViewport;
UINT_PTR g_TimerIDEvent_100msec;
UINT g_uCount100msec;
COLORREF customcolors[256]; // MONOCHROME is last custom color COLORREF customcolors[256]; // MONOCHROME is last custom color
HBITMAP g_hLogoBitmap; HBITMAP g_hLogoBitmap;
HBITMAP g_hDeviceBitmap; HBITMAP g_hDeviceBitmap;
HDC g_hDeviceDC; HDC g_hDeviceDC;
LPBITMAPINFO g_pFramebufferinfo; LPBITMAPINFO g_pFramebufferinfo;
BOOL g_bUsingCursor; // TRUE = AppleWin is using (hiding) the mouse-cursor && restricting cursor to window - see SetUsingCursor()
bool g_bAppActive;
bool g_bFrameActive;
bool g_windowMinimized;
std::string driveTooltip;
bool g_bFullScreen_ShowSubunitStatus;
FULLSCREEN_SCALE_TYPE g_win_fullscreen_scale;
int g_win_fullscreen_offsetx;
int g_win_fullscreen_offsety;
static const UINT MAX_DRAW_DEVICES = 10; static const UINT MAX_DRAW_DEVICES = 10;
char* draw_devices[MAX_DRAW_DEVICES]; char* draw_devices[MAX_DRAW_DEVICES];

View File

@ -105,7 +105,6 @@ static DWORD g_aDiskFullScreenColorsLED[ NUM_DISK_STATUS ] =
static HBITMAP buttonbitmap[BUTTONS]; static HBITMAP buttonbitmap[BUTTONS];
static bool g_bAppActive = false;
static HBRUSH btnfacebrush = (HBRUSH)0; static HBRUSH btnfacebrush = (HBRUSH)0;
static HPEN btnfacepen = (HPEN)0; static HPEN btnfacepen = (HPEN)0;
static HPEN btnhighlightpen = (HPEN)0; static HPEN btnhighlightpen = (HPEN)0;
@ -118,62 +117,22 @@ static int buttony = BUTTONY;
static HDC g_hFrameDC = (HDC)0; static HDC g_hFrameDC = (HDC)0;
static RECT framerect = {0,0,0,0}; static RECT framerect = {0,0,0,0};
static bool g_bIsFullScreen = false;
static BOOL helpquit = 0; static BOOL helpquit = 0;
static HFONT smallfont = (HFONT)0; static HFONT smallfont = (HFONT)0;
static HWND tooltipwindow = (HWND)0; static HWND tooltipwindow = (HWND)0;
static BOOL g_bUsingCursor = FALSE; // TRUE = AppleWin is using (hiding) the mouse-cursor && restricting cursor to window - see SetUsingCursor()
static int viewportx = VIEWPORTX; // Default to Normal (non-FullScreen) mode static int viewportx = VIEWPORTX; // Default to Normal (non-FullScreen) mode
static int viewporty = VIEWPORTY; // Default to Normal (non-FullScreen) mode static int viewporty = VIEWPORTY; // Default to Normal (non-FullScreen) mode
static UINT_PTR g_TimerIDEvent_100msec = 0;
static UINT g_uCount100msec = 0;
static bool g_bShowingCursor = true;
static bool g_bLastCursorInAppleViewport = false;
static void DrawStatusArea (HDC passdc, int drawflags);
static void ProcessButtonClick (int button, bool bFromButtonUI=false);
void ProcessDiskPopupMenu(HWND hwnd, POINT pt, const int iDrive);
void RelayEvent (UINT message, WPARAM wparam, LPARAM lparam);
void SetFullScreenMode ();
void SetNormalMode ();
static void SetUsingCursor(BOOL);
static bool FileExists(std::string strFilename); static bool FileExists(std::string strFilename);
bool g_bScrollLock_FullSpeed = false; bool g_bScrollLock_FullSpeed = false;
static bool g_bFullScreen32Bit = true;
#if 0 // enable non-integral full-screen scaling
#define FULLSCREEN_SCALE_TYPE float
#else
#define FULLSCREEN_SCALE_TYPE int
#endif
static RECT g_main_window_saved_rect; static RECT g_main_window_saved_rect;
static int g_main_window_saved_style; static int g_main_window_saved_style;
static int g_main_window_saved_exstyle; static int g_main_window_saved_exstyle;
static FULLSCREEN_SCALE_TYPE g_win_fullscreen_scale = 1;
static int g_win_fullscreen_offsetx = 0;
static int g_win_fullscreen_offsety = 0;
static bool g_bFrameActive = false;
static bool g_windowMinimized = false;
static std::string driveTooltip;
// __ Prototypes __________________________________________________________________________________
void DrawCrosshairs (int x, int y);
void UpdateMouseInAppleViewport(int iOutOfBoundsX, int iOutOfBoundsY, int x=0, int y=0);
static void ScreenWindowResize(const bool bCtrlKey);
void FrameResizeWindow(int nNewScale);
// ========================================================================== // ==========================================================================
static bool g_bAltEnter_ToggleFullScreen = true; // Default for ALT+ENTER is to toggle between windowed and full-screen modes
void Win32Frame::SetAltEnterToggleFullScreen(bool mode) void Win32Frame::SetAltEnterToggleFullScreen(bool mode)
{ {
g_bAltEnter_ToggleFullScreen = mode; g_bAltEnter_ToggleFullScreen = mode;
@ -191,19 +150,19 @@ void Win32Frame::SetAltEnterToggleFullScreen(bool mode)
// - Optional: Draw status area to frame DC // - Optional: Draw status area to frame DC
// //
UINT Get3DBorderWidth(void) UINT Win32Frame::Get3DBorderWidth(void)
{ {
return IsFullScreen() ? 0 : VIEWPORTX; return IsFullScreen() ? 0 : VIEWPORTX;
} }
UINT Get3DBorderHeight(void) UINT Win32Frame::Get3DBorderHeight(void)
{ {
return IsFullScreen() ? 0 : VIEWPORTY; return IsFullScreen() ? 0 : VIEWPORTY;
} }
//=========================================================================== //===========================================================================
static void FrameShowCursor(BOOL bShow) void Win32Frame::FrameShowCursor(BOOL bShow)
{ {
int nCount; int nCount;
@ -231,7 +190,7 @@ static void FrameShowCursor(BOOL bShow)
// . Ctrl-Left mouse button // . Ctrl-Left mouse button
// . PAUSE pressed (when MODE_RUNNING) // . PAUSE pressed (when MODE_RUNNING)
// . AppleWin's main window is activated/deactivated // . AppleWin's main window is activated/deactivated
static void RevealCursor() void Win32Frame::RevealCursor()
{ {
CMouseInterface* pMouseCard = GetCardMgr().GetMouseCard(); CMouseInterface* pMouseCard = GetCardMgr().GetMouseCard();
@ -255,7 +214,7 @@ static void RevealCursor()
// . WM_MOUSEMOVE event // . WM_MOUSEMOVE event
// . Switch from full-screen to normal (windowed) mode // . Switch from full-screen to normal (windowed) mode
// . AppleWin's main window is activated/deactivated // . AppleWin's main window is activated/deactivated
static void FullScreenRevealCursor(void) void Win32Frame::FullScreenRevealCursor(void)
{ {
if (!g_bIsFullScreen) if (!g_bIsFullScreen)
return; return;
@ -272,13 +231,13 @@ static void FullScreenRevealCursor(void)
//=========================================================================== //===========================================================================
#define LOADBUTTONBITMAP(bitmapname) LoadImage(GetFrame().g_hInstance,bitmapname, \ #define LOADBUTTONBITMAP(bitmapname) LoadImage(g_hInstance,bitmapname, \
IMAGE_BITMAP,0,0, \ IMAGE_BITMAP,0,0, \
LR_CREATEDIBSECTION | \ LR_CREATEDIBSECTION | \
LR_LOADMAP3DCOLORS | \ LR_LOADMAP3DCOLORS | \
LR_LOADTRANSPARENT); LR_LOADTRANSPARENT);
static void CreateGdiObjects(void) void Win32Frame::CreateGdiObjects(void)
{ {
memset(buttonbitmap, 0, BUTTONS*sizeof(HBITMAP)); memset(buttonbitmap, 0, BUTTONS*sizeof(HBITMAP));
@ -397,9 +356,9 @@ static void DrawBitmapRect (HDC dc, int x, int y, LPRECT rect, HBITMAP bitmap) {
} }
//=========================================================================== //===========================================================================
static void DrawButton (HDC passdc, int number) { void Win32Frame::DrawButton (HDC passdc, int number) {
FrameReleaseDC(); FrameReleaseDC();
HDC dc = (passdc ? passdc : GetDC(GetFrame().g_hFrameWindow)); HDC dc = (passdc ? passdc : GetDC(g_hFrameWindow));
int x = buttonx; int x = buttonx;
int y = buttony+number*BUTTONCY; int y = buttony+number*BUTTONCY;
if (number == buttondown) { if (number == buttondown) {
@ -436,17 +395,17 @@ static void DrawButton (HDC passdc, int number) {
NULL); NULL);
} }
if (!passdc) if (!passdc)
ReleaseDC(GetFrame().g_hFrameWindow,dc); ReleaseDC(g_hFrameWindow,dc);
} }
//=========================================================================== //===========================================================================
// NB. x=y=0 means erase only // NB. x=y=0 means erase only
static void DrawCrosshairs (int x, int y) { void Win32Frame::DrawCrosshairs (int x, int y) {
static int lastx = 0; static int lastx = 0;
static int lasty = 0; static int lasty = 0;
FrameReleaseDC(); FrameReleaseDC();
HDC dc = GetDC(GetFrame().g_hFrameWindow); HDC dc = GetDC(g_hFrameWindow);
#define LINE(x1,y1,x2,y2) MoveToEx(dc,x1,y1,NULL); LineTo(dc,x2,y2); #define LINE(x1,y1,x2,y2) MoveToEx(dc,x1,y1,NULL); LineTo(dc,x2,y2);
// ERASE THE OLD CROSSHAIRS // ERASE THE OLD CROSSHAIRS
@ -531,18 +490,17 @@ static void DrawCrosshairs (int x, int y) {
#undef LINE #undef LINE
lastx = x; lastx = x;
lasty = y; lasty = y;
ReleaseDC(GetFrame().g_hFrameWindow,dc); ReleaseDC(g_hFrameWindow,dc);
} }
//=========================================================================== //===========================================================================
static void DrawFrameWindow (bool bPaintingWindow = false); void Win32Frame::DrawFrameWindow (bool bPaintingWindow/*=false*/)
static void DrawFrameWindow (bool bPaintingWindow/*=false*/)
{ {
FrameReleaseDC(); FrameReleaseDC();
PAINTSTRUCT ps; PAINTSTRUCT ps;
HDC dc = bPaintingWindow HDC dc = bPaintingWindow
? BeginPaint(GetFrame().g_hFrameWindow,&ps) ? BeginPaint(g_hFrameWindow,&ps)
: GetDC(GetFrame().g_hFrameWindow); : GetDC(g_hFrameWindow);
if (!g_bIsFullScreen) if (!g_bIsFullScreen)
{ {
@ -584,28 +542,27 @@ static void DrawFrameWindow (bool bPaintingWindow/*=false*/)
// DRAW THE CONTENTS OF THE EMULATED SCREEN // DRAW THE CONTENTS OF THE EMULATED SCREEN
if (g_nAppMode == MODE_LOGO) if (g_nAppMode == MODE_LOGO)
GetFrame().DisplayLogo(); DisplayLogo();
else if (g_nAppMode == MODE_DEBUG) else if (g_nAppMode == MODE_DEBUG)
DebugDisplay(); DebugDisplay();
else else
GetFrame().VideoRedrawScreen(); VideoRedrawScreen();
if (bPaintingWindow) if (bPaintingWindow)
EndPaint(GetFrame().g_hFrameWindow,&ps); EndPaint(g_hFrameWindow,&ps);
else else
ReleaseDC(GetFrame().g_hFrameWindow,dc); ReleaseDC(g_hFrameWindow,dc);
} }
//=========================================================================== //===========================================================================
static bool g_bFullScreen_ShowSubunitStatus = true;
bool IsFullScreen(void) bool Win32Frame::IsFullScreen(void)
{ {
return g_bIsFullScreen; return g_bIsFullScreen;
} }
bool GetFullScreenShowSubunitStatus(void) bool Win32Frame::GetFullScreenShowSubunitStatus(void)
{ {
return g_bFullScreen_ShowSubunitStatus; return g_bFullScreen_ShowSubunitStatus;
} }
@ -615,6 +572,11 @@ void Win32Frame::SetFullScreenShowSubunitStatus(bool bShow)
g_bFullScreen_ShowSubunitStatus = bShow; g_bFullScreen_ShowSubunitStatus = bShow;
} }
void Win32Frame::FrameDrawDiskLEDS()
{
FrameDrawDiskLEDS((HDC)0);
}
//=========================================================================== //===========================================================================
void Win32Frame::FrameDrawDiskLEDS( HDC passdc ) void Win32Frame::FrameDrawDiskLEDS( HDC passdc )
{ {
@ -638,7 +600,7 @@ void Win32Frame::FrameDrawDiskLEDS( HDC passdc )
// Draw Track/Sector // Draw Track/Sector
FrameReleaseDC(); FrameReleaseDC();
HDC dc = (passdc ? passdc : GetDC(GetFrame().g_hFrameWindow)); HDC dc = (passdc ? passdc : GetDC(g_hFrameWindow));
int x = buttonx; int x = buttonx;
int y = buttony+BUTTONS*BUTTONCY+1; int y = buttony+BUTTONS*BUTTONCY+1;
@ -667,6 +629,11 @@ void Win32Frame::FrameDrawDiskLEDS( HDC passdc )
} }
} }
void Win32Frame::FrameDrawDiskStatus()
{
FrameDrawDiskStatus((HDC)0);
}
// Feature Request #201 Show track status // Feature Request #201 Show track status
// https://github.com/AppleWin/AppleWin/issues/201 // https://github.com/AppleWin/AppleWin/issues/201
//=========================================================================== //===========================================================================
@ -762,7 +729,7 @@ void Win32Frame::FrameDrawDiskStatus( HDC passdc )
// Draw Track/Sector // Draw Track/Sector
FrameReleaseDC(); FrameReleaseDC();
HDC dc = (passdc ? passdc : GetDC(GetFrame().g_hFrameWindow)); HDC dc = (passdc ? passdc : GetDC(g_hFrameWindow));
int x = buttonx; int x = buttonx;
int y = buttony+BUTTONS*BUTTONCY+4; int y = buttony+BUTTONS*BUTTONCY+4;
@ -823,9 +790,9 @@ void Win32Frame::FrameDrawDiskStatus( HDC passdc )
} }
//=========================================================================== //===========================================================================
static void DrawStatusArea (HDC passdc, int drawflags) void Win32Frame::DrawStatusArea (HDC passdc, int drawflags)
{ {
if (GetFrame().g_hFrameWindow == NULL) if (g_hFrameWindow == NULL)
{ {
// TC: Fix drawing of drive buttons before frame created: // TC: Fix drawing of drive buttons before frame created:
// . Main init loop: LoadConfiguration() called before FrameCreateWindow(), eg: // . Main init loop: LoadConfiguration() called before FrameCreateWindow(), eg:
@ -834,7 +801,7 @@ static void DrawStatusArea (HDC passdc, int drawflags)
} }
FrameReleaseDC(); FrameReleaseDC();
HDC dc = (passdc ? passdc : GetDC(GetFrame().g_hFrameWindow)); HDC dc = (passdc ? passdc : GetDC(g_hFrameWindow));
int x = buttonx; int x = buttonx;
int y = buttony+BUTTONS*BUTTONCY+1; int y = buttony+BUTTONS*BUTTONCY+1;
const bool bCaps = KeybGetCapsStatus(); const bool bCaps = KeybGetCapsStatus();
@ -859,7 +826,9 @@ static void DrawStatusArea (HDC passdc, int drawflags)
SelectObject(dc,smallfont); SelectObject(dc,smallfont);
if (drawflags & DRAW_DISK_STATUS) if (drawflags & DRAW_DISK_STATUS)
GetFrame().FrameDrawDiskStatus( dc ); {
FrameDrawDiskStatus(dc);
}
#if HD_LED #if HD_LED
SetTextAlign(dc, TA_RIGHT | TA_TOP); SetTextAlign(dc, TA_RIGHT | TA_TOP);
@ -926,10 +895,10 @@ static void DrawStatusArea (HDC passdc, int drawflags)
if (drawflags & DRAW_LEDS) if (drawflags & DRAW_LEDS)
{ {
GetFrame().FrameDrawDiskLEDS( dc ); FrameDrawDiskLEDS( dc );
if (drawflags & DRAW_DISK_STATUS) if (drawflags & DRAW_DISK_STATUS)
GetFrame().FrameDrawDiskStatus( dc ); FrameDrawDiskStatus( dc );
if (!IS_APPLE2) if (!IS_APPLE2)
{ {
@ -957,7 +926,7 @@ static void DrawStatusArea (HDC passdc, int drawflags)
if (drawflags & DRAW_TITLE) if (drawflags & DRAW_TITLE)
{ {
GetAppleWindowTitle(); // SetWindowText() // WindowTitle GetAppleWindowTitle(); // SetWindowText() // WindowTitle
SendMessage(GetFrame().g_hFrameWindow,WM_SETTEXT,0,(LPARAM)g_pAppTitle.c_str()); SendMessage(g_hFrameWindow,WM_SETTEXT,0,(LPARAM)g_pAppTitle.c_str());
} }
if (drawflags & DRAW_BUTTON_DRIVES) if (drawflags & DRAW_BUTTON_DRIVES)
@ -968,23 +937,33 @@ static void DrawStatusArea (HDC passdc, int drawflags)
} }
if (!passdc) if (!passdc)
ReleaseDC(GetFrame().g_hFrameWindow,dc); ReleaseDC(g_hFrameWindow,dc);
} }
//=========================================================================== //===========================================================================
static void EraseButton (int number) { void Win32Frame::EraseButton (int number) {
RECT rect; RECT rect;
rect.left = buttonx; rect.left = buttonx;
rect.right = rect.left+BUTTONCX; rect.right = rect.left+BUTTONCX;
rect.top = buttony+number*BUTTONCY; rect.top = buttony+number*BUTTONCY;
rect.bottom = rect.top+BUTTONCY; rect.bottom = rect.top+BUTTONCY;
InvalidateRect(GetFrame().g_hFrameWindow,&rect,1); InvalidateRect(g_hFrameWindow,&rect,1);
} }
//=========================================================================== //===========================================================================
LRESULT CALLBACK FrameWndProc ( LRESULT CALLBACK FrameWndProc(
HWND window,
UINT message,
WPARAM wparam,
LPARAM lparam)
{
Win32Frame& win32Frame = Win32Frame::GetWin32Frame();
return win32Frame.WndProc(window, message, wparam, lparam);
}
LRESULT Win32Frame::WndProc(
HWND window, HWND window,
UINT message, UINT message,
WPARAM wparam, WPARAM wparam,
@ -1039,7 +1018,7 @@ LRESULT CALLBACK FrameWndProc (
} }
if (g_TimerIDEvent_100msec) if (g_TimerIDEvent_100msec)
{ {
BOOL bRes = KillTimer(GetFrame().g_hFrameWindow, g_TimerIDEvent_100msec); BOOL bRes = KillTimer(g_hFrameWindow, g_TimerIDEvent_100msec);
LogFileOutput("KillTimer(g_TimerIDEvent_100msec), res=%d\n", bRes ? 1 : 0); LogFileOutput("KillTimer(g_TimerIDEvent_100msec), res=%d\n", bRes ? 1 : 0);
g_TimerIDEvent_100msec = 0; g_TimerIDEvent_100msec = 0;
} }
@ -1063,7 +1042,7 @@ LRESULT CALLBACK FrameWndProc (
CpuDestroy(); CpuDestroy();
MemDestroy(); MemDestroy();
SpkrDestroy(); SpkrDestroy();
GetFrame().Destroy(); Destroy();
MB_Destroy(); MB_Destroy();
DeleteGdiObjects(); DeleteGdiObjects();
DIMouse::DirectInputUninit(window); // NB. do before window is destroyed DIMouse::DirectInputUninit(window); // NB. do before window is destroyed
@ -1073,7 +1052,7 @@ LRESULT CALLBACK FrameWndProc (
case WM_CREATE: case WM_CREATE:
LogFileOutput("WM_CREATE\n"); LogFileOutput("WM_CREATE\n");
GetFrame().g_hFrameWindow = window; // NB. g_hFrameWindow by CreateWindow() g_hFrameWindow = window; // NB. g_hFrameWindow by CreateWindow()
CreateGdiObjects(); CreateGdiObjects();
LogFileOutput("WM_CREATE: CreateGdiObjects()\n"); LogFileOutput("WM_CREATE: CreateGdiObjects()\n");
@ -1185,12 +1164,12 @@ LRESULT CALLBACK FrameWndProc (
// lparam = modifiers: shift, ctrl, alt, win // lparam = modifiers: shift, ctrl, alt, win
if (wparam == VK_SNAPSHOT_560) if (wparam == VK_SNAPSHOT_560)
{ {
GetFrame().Video_TakeScreenShot( Video::SCREENSHOT_560x384 ); Video_TakeScreenShot( Video::SCREENSHOT_560x384 );
} }
else else
if (wparam == VK_SNAPSHOT_280) // ( lparam & MOD_SHIFT ) if (wparam == VK_SNAPSHOT_280) // ( lparam & MOD_SHIFT )
{ {
GetFrame().Video_TakeScreenShot( Video::SCREENSHOT_280x192 ); Video_TakeScreenShot( Video::SCREENSHOT_280x192 );
} }
else else
if (wparam == VK_SNAPSHOT_TEXT) // ( lparam & MOD_CONTROL ) if (wparam == VK_SNAPSHOT_TEXT) // ( lparam & MOD_CONTROL )
@ -1253,13 +1232,13 @@ LRESULT CALLBACK FrameWndProc (
{ {
UINT debugVideoMode; UINT debugVideoMode;
if ( DebugGetVideoMode(&debugVideoMode) ) if ( DebugGetVideoMode(&debugVideoMode) )
GetFrame().VideoRefreshScreen(debugVideoMode, true); VideoRefreshScreen(debugVideoMode, true);
else else
GetFrame().VideoPresentScreen(); VideoPresentScreen();
} }
else else
{ {
GetFrame().VideoPresentScreen(); VideoPresentScreen();
} }
} }
@ -1321,7 +1300,7 @@ LRESULT CALLBACK FrameWndProc (
} }
DrawStatusArea((HDC)0,DRAW_TITLE); DrawStatusArea((HDC)0,DRAW_TITLE);
if ((g_nAppMode != MODE_LOGO) && (g_nAppMode != MODE_DEBUG)) if ((g_nAppMode != MODE_LOGO) && (g_nAppMode != MODE_DEBUG))
GetFrame().VideoRedrawScreen(); VideoRedrawScreen();
} }
else if ((wparam == VK_SCROLL) && GetPropertySheet().GetScrollLockToggle()) else if ((wparam == VK_SCROLL) && GetPropertySheet().GetScrollLockToggle())
{ {
@ -1425,7 +1404,7 @@ LRESULT CALLBACK FrameWndProc (
const int iDrive = wparam - VK_F3; const int iDrive = wparam - VK_F3;
ProcessDiskPopupMenu( window, pt, iDrive ); ProcessDiskPopupMenu( window, pt, iDrive );
GetFrame().FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES); FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES | DRAW_DISK_STATUS);
DrawButton((HDC)0, iButton); DrawButton((HDC)0, iButton);
} }
else else
@ -1496,7 +1475,7 @@ LRESULT CALLBACK FrameWndProc (
POINT Point; POINT Point;
GetCursorPos(&Point); GetCursorPos(&Point);
ScreenToClient(GetFrame().g_hFrameWindow, &Point); ScreenToClient(g_hFrameWindow, &Point);
const int iOutOfBoundsX=0, iOutOfBoundsY=0; const int iOutOfBoundsX=0, iOutOfBoundsY=0;
UpdateMouseInAppleViewport(iOutOfBoundsX, iOutOfBoundsY, Point.x, Point.y); UpdateMouseInAppleViewport(iOutOfBoundsX, iOutOfBoundsY, Point.x, Point.y);
@ -1733,7 +1712,7 @@ LRESULT CALLBACK FrameWndProc (
ProcessDiskPopupMenu( window, pt, iDrive ); ProcessDiskPopupMenu( window, pt, iDrive );
} }
GetFrame().FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES); FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES | DRAW_DISK_STATUS);
DrawButton((HDC)0, iButton); DrawButton((HDC)0, iButton);
} }
} }
@ -1808,7 +1787,7 @@ LRESULT CALLBACK FrameWndProc (
DrawStatusArea((HDC)0,DRAW_TITLE); DrawStatusArea((HDC)0,DRAW_TITLE);
HCURSOR oldcursor = SetCursor(LoadCursor(0,IDC_WAIT)); HCURSOR oldcursor = SetCursor(LoadCursor(0,IDC_WAIT));
g_nAppMode = MODE_BENCHMARK; g_nAppMode = MODE_BENCHMARK;
GetFrame().Benchmark(); Win32Frame::GetWin32Frame().Benchmark();
g_nAppMode = MODE_LOGO; g_nAppMode = MODE_LOGO;
ResetMachineState(); ResetMachineState();
SetCursor(oldcursor); SetCursor(oldcursor);
@ -1902,7 +1881,7 @@ LRESULT CALLBACK FrameWndProc (
//=========================================================================== //===========================================================================
// Process: VK_F6 // Process: VK_F6
static void ScreenWindowResize(const bool bCtrlKey) void Win32Frame::ScreenWindowResize(const bool bCtrlKey)
{ {
static int nOldViewportScale = kDEFAULT_VIEWPORT_SCALE; static int nOldViewportScale = kDEFAULT_VIEWPORT_SCALE;
@ -1924,12 +1903,12 @@ static void ScreenWindowResize(const bool bCtrlKey)
} }
} }
static bool ConfirmReboot(bool bFromButtonUI) bool Win32Frame::ConfirmReboot(bool bFromButtonUI)
{ {
if (!bFromButtonUI || !GetFrame().g_bConfirmReboot) if (!bFromButtonUI || !g_bConfirmReboot)
return true; return true;
int res = MessageBox(GetFrame().g_hFrameWindow, int res = MessageBox(g_hFrameWindow,
"Are you sure you want to reboot?\n" "Are you sure you want to reboot?\n"
"(All data will be lost!)\n" "(All data will be lost!)\n"
"\n" "\n"
@ -1943,7 +1922,7 @@ static bool ConfirmReboot(bool bFromButtonUI)
return res == IDYES; return res == IDYES;
} }
static void ProcessButtonClick(int button, bool bFromButtonUI /*=false*/) void Win32Frame::ProcessButtonClick(int button, bool bFromButtonUI /*=false*/)
{ {
SoundCore_SetFade(FADE_OUT); SoundCore_SetFade(FADE_OUT);
bool bAllowFadeIn = true; bool bAllowFadeIn = true;
@ -1967,7 +1946,7 @@ static void ProcessButtonClick(int button, bool bFromButtonUI /*=false*/)
DeleteFile(filename_with_zone_identifier.c_str()); DeleteFile(filename_with_zone_identifier.c_str());
} }
HtmlHelp(GetFrame().g_hFrameWindow,filename.c_str(),HH_DISPLAY_TOC,0); HtmlHelp(g_hFrameWindow,filename.c_str(),HH_DISPLAY_TOC,0);
helpquit = 1; helpquit = 1;
} }
break; break;
@ -2004,7 +1983,7 @@ static void ProcessButtonClick(int button, bool bFromButtonUI /*=false*/)
} }
DrawStatusArea((HDC)0,DRAW_TITLE); DrawStatusArea((HDC)0,DRAW_TITLE);
GetFrame().VideoRedrawScreen(); VideoRedrawScreen();
break; break;
case BTN_DRIVE1: case BTN_DRIVE1:
@ -2074,7 +2053,7 @@ static void ProcessButtonClick(int button, bool bFromButtonUI /*=false*/)
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/resources/menus/usingmenus.asp // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/resources/menus/usingmenus.asp
// http://www.codeproject.com/menu/MenusForBeginners.asp?df=100&forumid=67645&exp=0&select=903061 // http://www.codeproject.com/menu/MenusForBeginners.asp?df=100&forumid=67645&exp=0&select=903061
void ProcessDiskPopupMenu(HWND hwnd, POINT pt, const int iDrive) void Win32Frame::ProcessDiskPopupMenu(HWND hwnd, POINT pt, const int iDrive)
{ {
if (GetCardMgr().QuerySlot(SLOT6) != CT_Disk2) if (GetCardMgr().QuerySlot(SLOT6) != CT_Disk2)
return; return;
@ -2101,7 +2080,7 @@ void ProcessDiskPopupMenu(HWND hwnd, POINT pt, const int iDrive)
// Load the menu template containing the shortcut menu from the // Load the menu template containing the shortcut menu from the
// application's resources. // application's resources.
HMENU hmenu = LoadMenu(GetFrame().g_hInstance, MAKEINTRESOURCE(IDR_MENU_DISK_POPUP)); // menu template HMENU hmenu = LoadMenu(g_hInstance, MAKEINTRESOURCE(IDR_MENU_DISK_POPUP)); // menu template
if (hmenu == NULL) if (hmenu == NULL)
return; return;
@ -2161,7 +2140,7 @@ void ProcessDiskPopupMenu(HWND hwnd, POINT pt, const int iDrive)
//if(!filename1.compare("\"\"") == false) //Do not use this, for some reason it does not work!!! //if(!filename1.compare("\"\"") == false) //Do not use this, for some reason it does not work!!!
if(!filename1.compare(sFileNameEmpty) ) if(!filename1.compare(sFileNameEmpty) )
{ {
int MB_Result = MessageBox(GetFrame().g_hFrameWindow, "No disk image loaded. Do you want to run CiderPress anyway?" ,"No disk image.", MB_ICONINFORMATION|MB_YESNO); int MB_Result = MessageBox(g_hFrameWindow, "No disk image loaded. Do you want to run CiderPress anyway?" ,"No disk image.", MB_ICONINFORMATION|MB_YESNO);
if (MB_Result == IDYES) if (MB_Result == IDYES)
{ {
if (FileExists (PathToCiderPress )) if (FileExists (PathToCiderPress ))
@ -2170,7 +2149,7 @@ void ProcessDiskPopupMenu(HWND hwnd, POINT pt, const int iDrive)
} }
else else
{ {
MessageBox(GetFrame().g_hFrameWindow, szCiderpressNotFoundText, szCiderpressNotFoundCaption, MB_ICONINFORMATION|MB_OK); MessageBox(g_hFrameWindow, szCiderpressNotFoundText, szCiderpressNotFoundCaption, MB_ICONINFORMATION|MB_OK);
} }
} }
} }
@ -2182,7 +2161,7 @@ void ProcessDiskPopupMenu(HWND hwnd, POINT pt, const int iDrive)
} }
else else
{ {
MessageBox(GetFrame().g_hFrameWindow, szCiderpressNotFoundText, szCiderpressNotFoundCaption, MB_ICONINFORMATION|MB_OK); MessageBox(g_hFrameWindow, szCiderpressNotFoundText, szCiderpressNotFoundCaption, MB_ICONINFORMATION|MB_OK);
} }
} }
} }
@ -2194,11 +2173,11 @@ void ProcessDiskPopupMenu(HWND hwnd, POINT pt, const int iDrive)
//=========================================================================== //===========================================================================
void RelayEvent (UINT message, WPARAM wparam, LPARAM lparam) { void Win32Frame::RelayEvent (UINT message, WPARAM wparam, LPARAM lparam) {
if (g_bIsFullScreen) if (g_bIsFullScreen)
return; return;
MSG msg; MSG msg;
msg.hwnd = GetFrame().g_hFrameWindow; msg.hwnd = g_hFrameWindow;
msg.message = message; msg.message = message;
msg.wParam = wparam; msg.wParam = wparam;
msg.lParam = lparam; msg.lParam = lparam;
@ -2208,17 +2187,17 @@ void RelayEvent (UINT message, WPARAM wparam, LPARAM lparam) {
//=========================================================================== //===========================================================================
int GetFullScreenOffsetX(void) int Win32Frame::GetFullScreenOffsetX(void)
{ {
return g_win_fullscreen_offsetx; return g_win_fullscreen_offsetx;
} }
int GetFullScreenOffsetY(void) int Win32Frame::GetFullScreenOffsetY(void)
{ {
return g_win_fullscreen_offsety; return g_win_fullscreen_offsety;
} }
void SetFullScreenMode () void Win32Frame::SetFullScreenMode ()
{ {
#ifdef NO_DIRECT_X #ifdef NO_DIRECT_X
@ -2232,14 +2211,14 @@ void SetFullScreenMode ()
buttonover = -1; buttonover = -1;
g_main_window_saved_style = GetWindowLong(GetFrame().g_hFrameWindow, GWL_STYLE); g_main_window_saved_style = GetWindowLong(g_hFrameWindow, GWL_STYLE);
g_main_window_saved_exstyle = GetWindowLong(GetFrame().g_hFrameWindow, GWL_EXSTYLE); g_main_window_saved_exstyle = GetWindowLong(g_hFrameWindow, GWL_EXSTYLE);
GetWindowRect(GetFrame().g_hFrameWindow, &g_main_window_saved_rect); GetWindowRect(g_hFrameWindow, &g_main_window_saved_rect);
SetWindowLong(GetFrame().g_hFrameWindow, GWL_STYLE , g_main_window_saved_style & ~(WS_CAPTION | WS_THICKFRAME)); SetWindowLong(g_hFrameWindow, GWL_STYLE , g_main_window_saved_style & ~(WS_CAPTION | WS_THICKFRAME));
SetWindowLong(GetFrame().g_hFrameWindow, GWL_EXSTYLE, g_main_window_saved_exstyle & ~(WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE | WS_EX_STATICEDGE)); SetWindowLong(g_hFrameWindow, GWL_EXSTYLE, g_main_window_saved_exstyle & ~(WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE | WS_EX_STATICEDGE));
monitor_info.cbSize = sizeof(monitor_info); monitor_info.cbSize = sizeof(monitor_info);
GetMonitorInfo(MonitorFromWindow(GetFrame().g_hFrameWindow, MONITOR_DEFAULTTONEAREST), &monitor_info); GetMonitorInfo(MonitorFromWindow(g_hFrameWindow, MONITOR_DEFAULTTONEAREST), &monitor_info);
left = monitor_info.rcMonitor.left; left = monitor_info.rcMonitor.left;
top = monitor_info.rcMonitor.top; top = monitor_info.rcMonitor.top;
@ -2253,23 +2232,23 @@ void SetFullScreenMode ()
g_win_fullscreen_scale = (scalex <= scaley) ? scalex : scaley; g_win_fullscreen_scale = (scalex <= scaley) ? scalex : scaley;
g_win_fullscreen_offsetx = ((int)width - (int)(g_win_fullscreen_scale * GetVideo().GetFrameBufferBorderlessWidth())) / 2; g_win_fullscreen_offsetx = ((int)width - (int)(g_win_fullscreen_scale * GetVideo().GetFrameBufferBorderlessWidth())) / 2;
g_win_fullscreen_offsety = ((int)height - (int)(g_win_fullscreen_scale * GetVideo().GetFrameBufferBorderlessHeight())) / 2; g_win_fullscreen_offsety = ((int)height - (int)(g_win_fullscreen_scale * GetVideo().GetFrameBufferBorderlessHeight())) / 2;
SetWindowPos(GetFrame().g_hFrameWindow, NULL, left, top, (int)width, (int)height, SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED); SetWindowPos(g_hFrameWindow, NULL, left, top, (int)width, (int)height, SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
g_bIsFullScreen = true; g_bIsFullScreen = true;
GetFrame().SetViewportScale(g_win_fullscreen_scale, true); SetViewportScale(g_win_fullscreen_scale, true);
buttonx = GetFullScreenOffsetX() + g_nViewportCX + VIEWPORTX*2; buttonx = GetFullScreenOffsetX() + g_nViewportCX + VIEWPORTX*2;
buttony = GetFullScreenOffsetY(); buttony = GetFullScreenOffsetY();
viewportx = VIEWPORTX; // TC-TODO: Should be zero too? (Since there's no 3D border in full-screen) viewportx = VIEWPORTX; // TC-TODO: Should be zero too? (Since there's no 3D border in full-screen)
viewporty = 0; // GH#464 viewporty = 0; // GH#464
InvalidateRect(GetFrame().g_hFrameWindow,NULL,1); InvalidateRect(g_hFrameWindow,NULL,1);
#endif // NO_DIRECT_X #endif // NO_DIRECT_X
} }
//=========================================================================== //===========================================================================
void SetNormalMode () void Win32Frame::SetNormalMode ()
{ {
FullScreenRevealCursor(); // Do before clearing g_bIsFullScreen flag FullScreenRevealCursor(); // Do before clearing g_bIsFullScreen flag
@ -2282,9 +2261,9 @@ void SetNormalMode ()
g_win_fullscreen_offsetx = 0; g_win_fullscreen_offsetx = 0;
g_win_fullscreen_offsety = 0; g_win_fullscreen_offsety = 0;
g_win_fullscreen_scale = 1; g_win_fullscreen_scale = 1;
SetWindowLong(GetFrame().g_hFrameWindow, GWL_STYLE, g_main_window_saved_style); SetWindowLong(g_hFrameWindow, GWL_STYLE, g_main_window_saved_style);
SetWindowLong(GetFrame().g_hFrameWindow, GWL_EXSTYLE, g_main_window_saved_exstyle); SetWindowLong(g_hFrameWindow, GWL_EXSTYLE, g_main_window_saved_exstyle);
SetWindowPos(GetFrame().g_hFrameWindow, NULL, SetWindowPos(g_hFrameWindow, NULL,
g_main_window_saved_rect.left, g_main_window_saved_rect.left,
g_main_window_saved_rect.top, g_main_window_saved_rect.top,
g_main_window_saved_rect.right - g_main_window_saved_rect.left, g_main_window_saved_rect.right - g_main_window_saved_rect.left,
@ -2294,7 +2273,7 @@ void SetNormalMode ()
} }
//=========================================================================== //===========================================================================
static void SetUsingCursor (BOOL bNewValue) void Win32Frame::SetUsingCursor (BOOL bNewValue)
{ {
if (bNewValue == g_bUsingCursor) if (bNewValue == g_bUsingCursor)
return; return;
@ -2306,18 +2285,18 @@ static void SetUsingCursor (BOOL bNewValue)
// Set TRUE when: // Set TRUE when:
// . Using mouse for joystick emulation // . Using mouse for joystick emulation
// . Using mousecard and mouse is restricted to window // . Using mousecard and mouse is restricted to window
SetCapture(GetFrame().g_hFrameWindow); SetCapture(g_hFrameWindow);
RECT rect = { viewportx+2, // left RECT rect = { viewportx+2, // left
viewporty+2, // top viewporty+2, // top
viewportx+g_nViewportCX-1, // right viewportx+g_nViewportCX-1, // right
viewporty+g_nViewportCY-1}; // bottom viewporty+g_nViewportCY-1}; // bottom
ClientToScreen(GetFrame().g_hFrameWindow,(LPPOINT)&rect.left); ClientToScreen(g_hFrameWindow,(LPPOINT)&rect.left);
ClientToScreen(GetFrame().g_hFrameWindow,(LPPOINT)&rect.right); ClientToScreen(g_hFrameWindow,(LPPOINT)&rect.right);
ClipCursor(&rect); ClipCursor(&rect);
FrameShowCursor(FALSE); FrameShowCursor(FALSE);
POINT pt; POINT pt;
GetCursorPos(&pt); GetCursorPos(&pt);
ScreenToClient(GetFrame().g_hFrameWindow,&pt); ScreenToClient(g_hFrameWindow,&pt);
DrawCrosshairs(pt.x,pt.y); DrawCrosshairs(pt.x,pt.y);
} }
else else
@ -2346,13 +2325,13 @@ int Win32Frame::SetViewportScale(int nNewScale, bool bForce /*=false*/)
return nNewScale; return nNewScale;
} }
static void SetupTooltipControls(void) void Win32Frame::SetupTooltipControls(void)
{ {
TOOLINFO toolinfo; TOOLINFO toolinfo;
toolinfo.cbSize = sizeof(toolinfo); toolinfo.cbSize = sizeof(toolinfo);
toolinfo.uFlags = TTF_CENTERTIP; toolinfo.uFlags = TTF_CENTERTIP;
toolinfo.hwnd = GetFrame().g_hFrameWindow; toolinfo.hwnd = g_hFrameWindow;
toolinfo.hinst = GetFrame().g_hInstance; toolinfo.hinst = g_hInstance;
toolinfo.lpszText = LPSTR_TEXTCALLBACK; toolinfo.lpszText = LPSTR_TEXTCALLBACK;
toolinfo.rect.left = BUTTONX; toolinfo.rect.left = BUTTONX;
toolinfo.rect.right = toolinfo.rect.left+BUTTONCX+1; toolinfo.rect.right = toolinfo.rect.left+BUTTONCX+1;
@ -2397,14 +2376,14 @@ static void GetWidthHeight(int& nWidth, int& nHeight)
#endif #endif
} }
static void FrameResizeWindow(int nNewScale) void Win32Frame::FrameResizeWindow(int nNewScale)
{ {
int nOldWidth, nOldHeight; int nOldWidth, nOldHeight;
GetWidthHeight(nOldWidth, nOldHeight); GetWidthHeight(nOldWidth, nOldHeight);
nNewScale = GetFrame().SetViewportScale(nNewScale); nNewScale = SetViewportScale(nNewScale);
GetWindowRect(GetFrame().g_hFrameWindow, &framerect); GetWindowRect(g_hFrameWindow, &framerect);
int nXPos = framerect.left; int nXPos = framerect.left;
int nYPos = framerect.top; int nYPos = framerect.top;
@ -2419,20 +2398,20 @@ static void FrameResizeWindow(int nNewScale)
irect.left = irect.top = 0; irect.left = irect.top = 0;
irect.right = nOldWidth; irect.right = nOldWidth;
irect.bottom = nOldHeight; irect.bottom = nOldHeight;
InvalidateRect(GetFrame().g_hFrameWindow, &irect, TRUE); InvalidateRect(g_hFrameWindow, &irect, TRUE);
} }
// Resize the window // Resize the window
int nNewWidth, nNewHeight; int nNewWidth, nNewHeight;
GetWidthHeight(nNewWidth, nNewHeight); GetWidthHeight(nNewWidth, nNewHeight);
MoveWindow(GetFrame().g_hFrameWindow, nXPos, nYPos, nNewWidth, nNewHeight, TRUE); MoveWindow(g_hFrameWindow, nXPos, nYPos, nNewWidth, nNewHeight, TRUE);
UpdateWindow(GetFrame().g_hFrameWindow); UpdateWindow(g_hFrameWindow);
// Remove the tooltips for the old window size // Remove the tooltips for the old window size
TOOLINFO toolinfo = {0}; TOOLINFO toolinfo = {0};
toolinfo.cbSize = sizeof(toolinfo); toolinfo.cbSize = sizeof(toolinfo);
toolinfo.hwnd = GetFrame().g_hFrameWindow; toolinfo.hwnd = g_hFrameWindow;
toolinfo.uId = 0; toolinfo.uId = 0;
SendMessage(tooltipwindow, TTM_DELTOOL, 0, (LPARAM)&toolinfo); SendMessage(tooltipwindow, TTM_DELTOOL, 0, (LPARAM)&toolinfo);
toolinfo.uId = 1; toolinfo.uId = 1;
@ -2448,7 +2427,7 @@ static void FrameResizeWindow(int nNewScale)
//=========================================================================== //===========================================================================
void FrameCreateWindow(void) void Win32Frame::FrameCreateWindow(void)
{ {
int nWidth, nHeight; int nWidth, nHeight;
@ -2474,7 +2453,7 @@ void FrameCreateWindow(void)
if (g_nViewportScale == 2 && (nWidth > GetSystemMetrics(SM_CXSCREEN) || nHeight > GetSystemMetrics(SM_CYSCREEN))) if (g_nViewportScale == 2 && (nWidth > GetSystemMetrics(SM_CXSCREEN) || nHeight > GetSystemMetrics(SM_CYSCREEN)))
{ {
g_nMaxViewportScale = 1; g_nMaxViewportScale = 1;
GetFrame().SetViewportScale(1); SetViewportScale(1);
GetWidthHeight(nWidth, nHeight); GetWidthHeight(nWidth, nHeight);
} }
@ -2485,11 +2464,11 @@ void FrameCreateWindow(void)
if (RegLoadValue(TEXT(REG_PREFS), TEXT(REGVALUE_PREF_WINDOW_X_POS), 1, (DWORD*)&nXPos)) if (RegLoadValue(TEXT(REG_PREFS), TEXT(REGVALUE_PREF_WINDOW_X_POS), 1, (DWORD*)&nXPos))
{ {
if ((nXPos > nXScreen) && !GetFrame().g_bMultiMon) if ((nXPos > nXScreen) && !g_bMultiMon)
nXPos = -1; // Not fully visible, so default to centre position nXPos = -1; // Not fully visible, so default to centre position
} }
if ((nXPos == -1) && !GetFrame().g_bMultiMon) if ((nXPos == -1) && !g_bMultiMon)
nXPos = nXScreen / 2; nXPos = nXScreen / 2;
} }
@ -2500,11 +2479,11 @@ void FrameCreateWindow(void)
if (RegLoadValue(TEXT(REG_PREFS), TEXT(REGVALUE_PREF_WINDOW_Y_POS), 1, (DWORD*)&nYPos)) if (RegLoadValue(TEXT(REG_PREFS), TEXT(REGVALUE_PREF_WINDOW_Y_POS), 1, (DWORD*)&nYPos))
{ {
if ((nYPos > nYScreen) && !GetFrame().g_bMultiMon) if ((nYPos > nYScreen) && !g_bMultiMon)
nYPos = -1; // Not fully visible, so default to centre position nYPos = -1; // Not fully visible, so default to centre position
} }
if ((nYPos == -1) && !GetFrame().g_bMultiMon) if ((nYPos == -1) && !g_bMultiMon)
nYPos = nYScreen / 2; nYPos = nYScreen / 2;
} }
@ -2516,7 +2495,7 @@ void FrameCreateWindow(void)
GetAppleWindowTitle(); GetAppleWindowTitle();
// NB. g_hFrameWindow also set by WM_CREATE - NB. CreateWindow() must synchronously send WM_CREATE // NB. g_hFrameWindow also set by WM_CREATE - NB. CreateWindow() must synchronously send WM_CREATE
GetFrame().g_hFrameWindow = CreateWindow( g_hFrameWindow = CreateWindow(
TEXT("APPLE2FRAME"), TEXT("APPLE2FRAME"),
g_pAppTitle.c_str(), g_pAppTitle.c_str(),
WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU |
@ -2524,20 +2503,20 @@ void FrameCreateWindow(void)
nXPos, nYPos, nWidth, nHeight, nXPos, nYPos, nWidth, nHeight,
HWND_DESKTOP, HWND_DESKTOP,
(HMENU)0, (HMENU)0,
GetFrame().g_hInstance, NULL ); g_hInstance, NULL );
InitCommonControls(); InitCommonControls();
tooltipwindow = CreateWindow( tooltipwindow = CreateWindow(
TOOLTIPS_CLASS,NULL,TTS_ALWAYSTIP, TOOLTIPS_CLASS,NULL,TTS_ALWAYSTIP,
CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT, CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,
GetFrame().g_hFrameWindow, g_hFrameWindow,
(HMENU)0, (HMENU)0,
GetFrame().g_hInstance,NULL ); g_hInstance,NULL );
SetupTooltipControls(); SetupTooltipControls();
_ASSERT(g_TimerIDEvent_100msec == 0); _ASSERT(g_TimerIDEvent_100msec == 0);
g_TimerIDEvent_100msec = SetTimer(GetFrame().g_hFrameWindow, IDEVENT_TIMER_100MSEC, 100, NULL); g_TimerIDEvent_100msec = SetTimer(g_hFrameWindow, IDEVENT_TIMER_100MSEC, 100, NULL);
LogFileOutput("FrameCreateWindow: SetTimer(), id=0x%08X\n", g_TimerIDEvent_100msec); LogFileOutput("FrameCreateWindow: SetTimer(), id=0x%08X\n", g_TimerIDEvent_100msec);
} }
@ -2560,28 +2539,26 @@ void FrameReleaseDC () {
} }
//=========================================================================== //===========================================================================
void Win32Frame::FrameRefreshStatus (int drawflags, bool bUpdateDiskStatus) { void Win32Frame::FrameRefreshStatus (int drawflags) {
// NB. 99% of the time we draw the disk status. On DiskDriveSwap() we don't.
drawflags |= bUpdateDiskStatus ? DRAW_DISK_STATUS : 0;
DrawStatusArea((HDC)0,drawflags); DrawStatusArea((HDC)0,drawflags);
} }
//=========================================================================== //===========================================================================
void FrameRegisterClass () { void Win32Frame::FrameRegisterClass () {
WNDCLASSEX wndclass; WNDCLASSEX wndclass;
memset(&wndclass, 0, sizeof(WNDCLASSEX)); memset(&wndclass, 0, sizeof(WNDCLASSEX));
wndclass.cbSize = sizeof(WNDCLASSEX); wndclass.cbSize = sizeof(WNDCLASSEX);
wndclass.style = CS_OWNDC | CS_BYTEALIGNCLIENT; wndclass.style = CS_OWNDC | CS_BYTEALIGNCLIENT;
wndclass.lpfnWndProc = FrameWndProc; wndclass.lpfnWndProc = FrameWndProc;
wndclass.hInstance = GetFrame().g_hInstance; wndclass.hInstance = g_hInstance;
wndclass.hIcon = LoadIcon(GetFrame().g_hInstance,TEXT("APPLEWIN_ICON")); wndclass.hIcon = LoadIcon(g_hInstance,TEXT("APPLEWIN_ICON"));
wndclass.hCursor = LoadCursor(0,IDC_ARROW); wndclass.hCursor = LoadCursor(0,IDC_ARROW);
wndclass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); wndclass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
#if ENABLE_MENU #if ENABLE_MENU
wndclass.lpszMenuName = (LPCSTR)IDR_MENU1; wndclass.lpszMenuName = (LPCSTR)IDR_MENU1;
#endif #endif
wndclass.lpszClassName = TEXT("APPLE2FRAME"); wndclass.lpszClassName = TEXT("APPLE2FRAME");
wndclass.hIconSm = (HICON)LoadImage(GetFrame().g_hInstance,TEXT("APPLEWIN_ICON"), wndclass.hIconSm = (HICON)LoadImage(g_hInstance,TEXT("APPLEWIN_ICON"),
IMAGE_ICON,16,16,LR_DEFAULTCOLOR); IMAGE_ICON,16,16,LR_DEFAULTCOLOR);
RegisterClassEx(&wndclass); RegisterClassEx(&wndclass);
} }
@ -2606,7 +2583,7 @@ void Win32Frame::FrameSetCursorPosByMousePos()
if (!GetCardMgr().IsMouseCardInstalled()) if (!GetCardMgr().IsMouseCardInstalled())
return; return;
if (!GetFrame().g_hFrameWindow || g_bShowingCursor) if (!g_hFrameWindow || g_bShowingCursor)
return; return;
int iX, iMinX, iMaxX; int iX, iMinX, iMaxX;
@ -2620,7 +2597,7 @@ void Win32Frame::FrameSetCursorPosByMousePos()
int iWindowY = (int)(fScaleY * (float)g_nViewportCY); int iWindowY = (int)(fScaleY * (float)g_nViewportCY);
POINT Point = {viewportx+2, viewporty+2}; // top-left POINT Point = {viewportx+2, viewporty+2}; // top-left
ClientToScreen(GetFrame().g_hFrameWindow, &Point); ClientToScreen(g_hFrameWindow, &Point);
SetCursorPos(Point.x+iWindowX-VIEWPORTX, Point.y+iWindowY-VIEWPORTY); SetCursorPos(Point.x+iWindowX-VIEWPORTX, Point.y+iWindowY-VIEWPORTY);
#if defined(_DEBUG) && 0 // OutputDebugString() when cursor position changes since last time #if defined(_DEBUG) && 0 // OutputDebugString() when cursor position changes since last time
@ -2639,14 +2616,14 @@ void Win32Frame::FrameSetCursorPosByMousePos()
// Called when: // Called when:
// . UpdateMouseInAppleViewport() is called and mouse leaving/entering Apple screen area // . UpdateMouseInAppleViewport() is called and mouse leaving/entering Apple screen area
// . NB. Not called when leaving & mouse clipped to Apple screen area // . NB. Not called when leaving & mouse clipped to Apple screen area
static void FrameSetCursorPosByMousePos(int x, int y, int dx, int dy, bool bLeavingAppleScreen) void Win32Frame::FrameSetCursorPosByMousePos(int x, int y, int dx, int dy, bool bLeavingAppleScreen)
{ {
_ASSERT(GetCardMgr().IsMouseCardInstalled()); _ASSERT(GetCardMgr().IsMouseCardInstalled());
if (!GetCardMgr().IsMouseCardInstalled()) if (!GetCardMgr().IsMouseCardInstalled())
return; return;
// char szDbg[200]; // char szDbg[200];
if (!GetFrame().g_hFrameWindow || (g_bShowingCursor && bLeavingAppleScreen) || (!g_bShowingCursor && !bLeavingAppleScreen)) if (!g_hFrameWindow || (g_bShowingCursor && bLeavingAppleScreen) || (!g_bShowingCursor && !bLeavingAppleScreen))
return; return;
int iX, iMinX, iMaxX; int iX, iMinX, iMaxX;
@ -2668,7 +2645,7 @@ static void FrameSetCursorPosByMousePos(int x, int y, int dx, int dy, bool bLeav
int iWindowY = (int)(fScaleY * (float)g_nViewportCY) + dy; int iWindowY = (int)(fScaleY * (float)g_nViewportCY) + dy;
POINT Point = {viewportx+2, viewporty+2}; // top-left POINT Point = {viewportx+2, viewporty+2}; // top-left
ClientToScreen(GetFrame().g_hFrameWindow, &Point); ClientToScreen(g_hFrameWindow, &Point);
SetCursorPos(Point.x+iWindowX-VIEWPORTX, Point.y+iWindowY-VIEWPORTY); SetCursorPos(Point.x+iWindowX-VIEWPORTX, Point.y+iWindowY-VIEWPORTY);
// sprintf(szDbg, "[MOUSE_LEAVING ] x=%d, y=%d (Scale: x,y=%f,%f; iX,iY=%d,%d)\n", iWindowX, iWindowY, fScaleX, fScaleY, iX, iY); OutputDebugString(szDbg); // sprintf(szDbg, "[MOUSE_LEAVING ] x=%d, y=%d (Scale: x,y=%f,%f; iX,iY=%d,%d)\n", iWindowX, iWindowY, fScaleX, fScaleY, iX, iY); OutputDebugString(szDbg);
} }
@ -2696,7 +2673,7 @@ static void FrameSetCursorPosByMousePos(int x, int y, int dx, int dy, bool bLeav
} }
} }
static void DrawCrosshairsMouse() void Win32Frame::DrawCrosshairsMouse()
{ {
_ASSERT(GetCardMgr().IsMouseCardInstalled()); _ASSERT(GetCardMgr().IsMouseCardInstalled());
if (!GetCardMgr().IsMouseCardInstalled()) if (!GetCardMgr().IsMouseCardInstalled())
@ -2723,7 +2700,7 @@ static void DrawCrosshairsMouse()
//#define _DEBUG_SHOW_CURSOR // NB. Get an ASSERT on LMB (after Ctrl+LMB) //#define _DEBUG_SHOW_CURSOR // NB. Get an ASSERT on LMB (after Ctrl+LMB)
#endif #endif
static void UpdateMouseInAppleViewport(int iOutOfBoundsX, int iOutOfBoundsY, int x, int y) void Win32Frame::UpdateMouseInAppleViewport(int iOutOfBoundsX, int iOutOfBoundsY, int x, int y)
{ {
const bool bOutsideAppleViewport = iOutOfBoundsX || iOutOfBoundsY; const bool bOutsideAppleViewport = iOutOfBoundsX || iOutOfBoundsY;
@ -2766,7 +2743,7 @@ static void UpdateMouseInAppleViewport(int iOutOfBoundsX, int iOutOfBoundsY, int
} }
else else
{ {
GetFrame().FrameSetCursorPosByMousePos(); // Set cursor to Apple position each time FrameSetCursorPosByMousePos(); // Set cursor to Apple position each time
} }
DrawCrosshairsMouse(); DrawCrosshairsMouse();

View File

@ -10,24 +10,13 @@
// Prototypes // Prototypes
void FrameCreateWindow(void);
HDC FrameGetDC (); HDC FrameGetDC ();
void FrameReleaseDC (); void FrameReleaseDC ();
void FrameRegisterClass ();
int GetViewportScale(void); int GetViewportScale(void);
void GetViewportCXCY(int& nViewportCX, int& nViewportCY); void GetViewportCXCY(int& nViewportCX, int& nViewportCY);
bool IsFullScreen(void);
bool GetFullScreenShowSubunitStatus(void);
LRESULT CALLBACK FrameWndProc ( LRESULT CALLBACK FrameWndProc (
HWND window, HWND window,
UINT message, UINT message,
WPARAM wparam, WPARAM wparam,
LPARAM lparam ); LPARAM lparam );
int GetFullScreenOffsetX(void);
int GetFullScreenOffsetY(void);
UINT Get3DBorderWidth(void);
UINT Get3DBorderHeight(void);