Win32 - RamWatch Hooked up AskSave() to the main window closing function. However, AskSave() fails to open the message box when called from there.

This commit is contained in:
adelikat 2009-05-05 16:15:18 +00:00
parent a13f65d415
commit cb18c55aa2
1 changed files with 32 additions and 28 deletions

View File

@ -2563,36 +2563,40 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
case WM_CLOSE:
{
NDS_Pause();
//Save window size
WritePrivateProfileInt("Video","Window Size",windowSize,IniName);
if (windowSize==0)
if (AskSave()) //Ask Save comes from the Ram Watch dialog. The dialog uses .wch files and this allows asks the user if he wants to save changes first, should he cancel, closing will not happen
{
// WritePrivateProfileInt("Video","Window width",MainWindowRect.right-MainWindowRect.left+widthTradeOff,IniName);
// WritePrivateProfileInt("Video","Window height",MainWindowRect.bottom-MainWindowRect.top+heightTradeOff,IniName);
RECT rc;
GetClientRect(hwnd, &rc);
WritePrivateProfileInt("Video", "Window width", (rc.right - rc.left), IniName);
WritePrivateProfileInt("Video", "Window height", (rc.bottom - rc.top), IniName);
//Save window size
WritePrivateProfileInt("Video","Window Size",windowSize,IniName);
if (windowSize==0)
{
// WritePrivateProfileInt("Video","Window width",MainWindowRect.right-MainWindowRect.left+widthTradeOff,IniName);
// WritePrivateProfileInt("Video","Window height",MainWindowRect.bottom-MainWindowRect.top+heightTradeOff,IniName);
RECT rc;
GetClientRect(hwnd, &rc);
WritePrivateProfileInt("Video", "Window width", (rc.right - rc.left), IniName);
WritePrivateProfileInt("Video", "Window height", (rc.bottom - rc.top), IniName);
}
//Save window position
WritePrivateProfileInt("Video", "WindowPosX", WndX/*MainWindowRect.left*/, IniName);
WritePrivateProfileInt("Video", "WindowPosY", WndY/*MainWindowRect.top*/, IniName);
//Save frame counter status
WritePrivateProfileInt("Display", "FrameCounter", frameCounterDisplay, IniName);
WritePrivateProfileInt("Display", "ScreenGap", ScreenGap, IniName);
//Save Ram Watch information
WritePrivateProfileInt("RamWatch", "SaveWindowPos", RWSaveWindowPos, IniName);
WritePrivateProfileInt("RamWatch", "RWWindowPosX", ramw_x, IniName);
WritePrivateProfileInt("RamWatch", "RWWindowPosY", ramw_y, IniName);
//TODO: save Auto-load bool value
//TODO: save ram watch recent files
ExitRunLoop();
}
//Save window position
WritePrivateProfileInt("Video", "WindowPosX", WndX/*MainWindowRect.left*/, IniName);
WritePrivateProfileInt("Video", "WindowPosY", WndY/*MainWindowRect.top*/, IniName);
//Save frame counter status
WritePrivateProfileInt("Display", "FrameCounter", frameCounterDisplay, IniName);
WritePrivateProfileInt("Display", "ScreenGap", ScreenGap, IniName);
//Save Ram Watch information
WritePrivateProfileInt("RamWatch", "SaveWindowPos", RWSaveWindowPos, IniName);
WritePrivateProfileInt("RamWatch", "RWWindowPosX", ramw_x, IniName);
WritePrivateProfileInt("RamWatch", "RWWindowPosY", ramw_y, IniName);
//TODO: save Auto-load bool value
//TODO: save ram watch recent files
ExitRunLoop();
else
NDS_UnPause();
return 0;
}
case WM_MOVING: