From d4a3c5c28f714555c5a12ed99634fce3983f4ceb Mon Sep 17 00:00:00 2001 From: tomcw Date: Tue, 27 Feb 2018 21:07:16 +0000 Subject: [PATCH] PrintScreen key: Improve UI feedback when any of the 3 registrations fails & log failures (fixes #547) Also tweak to full-speed: consolidating 2 calls to DiskII module into 1 call. --- source/Applewin.cpp | 28 ++++++++++++++++++++-------- source/Disk.cpp | 5 +++++ source/Disk.h | 1 + 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/source/Applewin.cpp b/source/Applewin.cpp index 58eb823a..23104cca 100644 --- a/source/Applewin.cpp +++ b/source/Applewin.cpp @@ -252,7 +252,7 @@ static void ContinueExecution(void) const bool bWasFullSpeed = g_bFullSpeed; g_bFullSpeed = (g_dwSpeed == SPEED_MAX) || bScrollLock_FullSpeed || - (DiskIsSpinning() && Disk_GetEnhanceDisk() && !Spkr_IsActive() && !MB_IsActive()) || + (Disk_IsConditionForFullSpeed() && !Spkr_IsActive() && !MB_IsActive()) || IsDebugSteppingAtFullSpeed(); if (g_bFullSpeed) @@ -824,32 +824,44 @@ void RegisterExtensions(void) //=========================================================================== void AppleWin_RegisterHotKeys(void) { - BOOL bStatus = true; - - bStatus &= RegisterHotKey( + BOOL bStatus[3] = {0,0,0}; + + bStatus[0] = RegisterHotKey( g_hFrameWindow , // HWND hWnd VK_SNAPSHOT_560, // int id (user/custom id) 0 , // UINT fsModifiers VK_SNAPSHOT // UINT vk = PrintScreen ); - bStatus &= RegisterHotKey( + bStatus[1] = RegisterHotKey( g_hFrameWindow , // HWND hWnd VK_SNAPSHOT_280, // int id (user/custom id) MOD_SHIFT , // UINT fsModifiers VK_SNAPSHOT // UINT vk = PrintScreen ); - bStatus &= RegisterHotKey( + bStatus[2] = RegisterHotKey( g_hFrameWindow , // HWND hWnd VK_SNAPSHOT_TEXT, // int id (user/custom id) MOD_CONTROL , // UINT fsModifiers VK_SNAPSHOT // UINT vk = PrintScreen ); - if (!bStatus && g_bShowPrintScreenWarningDialog) + if ((!bStatus[0] || !bStatus[1] || !bStatus[2]) && g_bShowPrintScreenWarningDialog) { - MessageBox( g_hFrameWindow, "Unable to capture PrintScreen key", "Warning", MB_OK ); + std::string msg("Unable to register for PrintScreen key(s):\n"); + + if (!bStatus[0]) + msg += "\n. PrintScreen"; + if (!bStatus[1]) + msg += "\n. Shift+PrintScreen"; + if (!bStatus[2]) + msg += "\n. Ctrl+PrintScreen"; + + MessageBox( g_hFrameWindow, msg.c_str(), "Warning", MB_ICONASTERISK | MB_OK ); + + msg += "\n"; + LogFileOutput(msg.c_str()); } } diff --git a/source/Disk.cpp b/source/Disk.cpp index 3baaa7cf..7b046873 100644 --- a/source/Disk.cpp +++ b/source/Disk.cpp @@ -651,6 +651,11 @@ ImageError_e DiskInsert(const int iDrive, LPCTSTR pszImageFilename, const bool b //=========================================================================== +bool Disk_IsConditionForFullSpeed(void) +{ + return floppymotoron && enhancedisk; +} + BOOL DiskIsSpinning(void) { return floppymotoron; diff --git a/source/Disk.h b/source/Disk.h index 7fc8064b..02b686ed 100644 --- a/source/Disk.h +++ b/source/Disk.h @@ -55,6 +55,7 @@ LPCTSTR DiskGetBaseName(const int iDrive); void DiskGetLightStatus (Disk_Status_e* pDisk1Status, Disk_Status_e* pDisk2Status); ImageError_e DiskInsert(const int iDrive, LPCTSTR pszImageFilename, const bool bForceWriteProtected, const bool bCreateIfNecessary); +bool Disk_IsConditionForFullSpeed(void); BOOL DiskIsSpinning(void); void DiskNotifyInvalidImage(const int iDrive, LPCTSTR pszImageFilename, const ImageError_e Error); void DiskReset(const bool bIsPowerCycle=false);