(Windows) Ask the user if they want to save changes to the Cheat list when the dialog's close/X button is clicked, if there are changes to save.
This commit is contained in:
parent
51303b9bc9
commit
084a42a2f8
|
@ -670,6 +670,13 @@ INT_PTR CALLBACK CheatsAdd_XX_Proc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lp
|
|||
return FALSE;
|
||||
}
|
||||
//==============================================================================
|
||||
void AttemptSaveAndClose(HWND dialog)
|
||||
{
|
||||
if (cheats->save())
|
||||
EndDialog(dialog, TRUE);
|
||||
else
|
||||
MessageBox(dialog, "Can't save cheats to file.\nCheck your path (Menu->Config->Path Settings->\"Cheats\")", "Error", MB_OK);
|
||||
}
|
||||
INT_PTR CALLBACK CheatsListBox_Proc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
|
||||
{
|
||||
switch(msg)
|
||||
|
@ -823,12 +830,25 @@ INT_PTR CALLBACK CheatsListBox_Proc(HWND dialog, UINT msg,WPARAM wparam,LPARAM l
|
|||
switch (LOWORD(wparam))
|
||||
{
|
||||
case IDOK:
|
||||
if (cheats->save())
|
||||
EndDialog(dialog, TRUE);
|
||||
else
|
||||
MessageBox(dialog, "Can't save cheats to file.\nCheck your path (Menu->Config->Path Settings->\"Cheats\")","Error",MB_OK);
|
||||
AttemptSaveAndClose(dialog);
|
||||
return TRUE;
|
||||
|
||||
case IDCANCEL:
|
||||
{
|
||||
if (IsWindowEnabled(GetDlgItem(dialog, IDOK)))
|
||||
{
|
||||
int result = MessageBox(dialog, "Do you wish to save your changes?", "Save?", MB_YESNOCANCEL);
|
||||
if (result == IDYES)
|
||||
AttemptSaveAndClose(dialog);
|
||||
else if (result == IDNO)
|
||||
EndDialog(dialog, FALSE);
|
||||
}
|
||||
else
|
||||
EndDialog(dialog, FALSE);
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
case IDCLOSE:
|
||||
EndDialog(dialog, FALSE);
|
||||
return TRUE;
|
||||
|
||||
|
|
|
@ -214,7 +214,7 @@ BEGIN
|
|||
PUSHBUTTON "Edit",IDC_BEDIT,245,228,64,14,WS_DISABLED
|
||||
PUSHBUTTON "Remove",IDC_BREMOVE,246,244,63,14,WS_DISABLED
|
||||
DEFPUSHBUTTON "Save",IDOK,109,263,50,14,WS_DISABLED
|
||||
PUSHBUTTON "Cancel",IDCANCEL,163,263,50,14
|
||||
PUSHBUTTON "Cancel",IDCLOSE,163,263,50,14
|
||||
GROUPBOX " Add cheats code as... ",IDC_STATIC,7,230,205,31
|
||||
PUSHBUTTON "Cheats Database",IDC_EXPORT,246,263,63,14
|
||||
END
|
||||
|
|
Loading…
Reference in New Issue