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.
This commit is contained in:
tomcw 2018-02-27 21:07:16 +00:00
parent 552d8fcc7b
commit d4a3c5c28f
3 changed files with 26 additions and 8 deletions

View File

@ -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());
}
}

View File

@ -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;

View File

@ -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);