Win32 - Ramwatch - fixed AskSave() when called from main window

This commit is contained in:
adelikat 2009-05-09 01:10:08 +00:00
parent ed89660799
commit e80b91bd56
4 changed files with 10 additions and 5 deletions

View File

@ -2587,7 +2587,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
case WM_CLOSE:
{
NDS_Pause();
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
if (true/*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
{
//Save window size
WritePrivateProfileInt("Video","Window Size",windowSize,IniName);
@ -2812,7 +2812,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
if(SPU_user) SPU_user->ShutUp();
return 0;
case IDM_QUIT:
DestroyWindow(hwnd);
if (AskSave()) DestroyWindow(hwnd);
return 0;
case IDM_OPEN:
return OpenFile();

View File

@ -1,3 +1,6 @@
//RamSearch dialog was copied and adapted from GENS11: http://code.google.com/p/gens-rerecording/
//Authors: Upthorn, Nitsuja, adelikat
// A few notes about this implementation of a RAM search window:
//
// Speed of update was one of the highest priories.

View File

@ -31,8 +31,6 @@ int ramw_x, ramw_y; //Used to store ramwatch dialog window positions
AddressWatcher rswatches[MAX_WATCH_COUNT];
int WatchCount=0;
#define MESSAGEBOXPARENT (RamWatchHWnd ? RamWatchHWnd : MainWindow->getHWnd())
bool QuickSaveWatches();
bool ResetWatches();
@ -217,7 +215,8 @@ bool AskSave()
//returns false only if a save was attempted but failed or was cancelled
if (RWfileChanged)
{
int answer = MessageBox(MESSAGEBOXPARENT, "Save Changes?", "Ram Watch", MB_YESNOCANCEL);
HWND Hwnd = GetMainHWND();
int answer = MessageBox(Hwnd, "Save Changes?", "Ram Watch", MB_YESNOCANCEL);
if(answer == IDYES)
if(!QuickSaveWatches())
return false;

View File

@ -1,3 +1,6 @@
//RamWatch dialog was copied and adapted from GENS11: http://code.google.com/p/gens-rerecording/
//Authors: Upthorn, Nitsuja, adelikat
#ifndef RAMWATCH_H
#define RAMWATCH_H
#include "windows.h"