Convert settings save prompt to TaskDialog

This commit is contained in:
RichardG867
2020-06-17 23:07:32 -03:00
parent 822bc9a3ab
commit 02cdf5e787
3 changed files with 38 additions and 14 deletions

View File

@@ -24,7 +24,7 @@
#define IDS_STRINGS 2048 // "86Box"
#define IDS_2049 2049 // "86Box Error"
#define IDS_2050 2050 // "86Box Fatal Error"
#define IDS_2051 2051 // "This will hard reset the.."
#define IDS_2051 2051 // "Are you sure you want to save..."
#define IDS_2052 2052 // "Use CTRL+ALT+PAGE DOWN.."
#define IDS_2053 2053 // "Speed"
#define IDS_2054 2054 // "ZIP %i (%03i): %ls"
@@ -62,7 +62,7 @@
#define IDS_2086 2086 // "MB"
#define IDS_2087 2087 // "Check BPB"
#define IDS_2088 2088 // "KB"
#define IDS_2089 2089 // "Neither DirectDraw nor Dire.."
#define IDS_2089 2089 // "Could not initialize the video..."
#define IDS_2090 2090 // "Default"
#define IDS_2091 2091 // "%i Wait state(s)"
#define IDS_2092 2092 // "Type"
@@ -77,8 +77,8 @@
#define IDS_2101 2101 // "Microsoft SideWinder Pad"
#define IDS_2102 2102 // "Thrustmaster Flight Cont.."
#define IDS_2103 2103 // "None"
#define IDS_2104 2104 // "Unable to load Accelerators"
#define IDS_2105 2105 // "Unable to register Raw Input"
#define IDS_2104 2104 // "Unable to load keyboard..."
#define IDS_2105 2105 // "Unable to register raw input."
#define IDS_2106 2106 // "%u"
#define IDS_2107 2107 // "%u MB (CHS: %i, %i, %i)"
#define IDS_2108 2108 // "Floppy %i (%s): %ls"
@@ -92,6 +92,11 @@
#define IDS_2116 2116 // "MO images (*.IM?)\0*.IM..."
#define IDS_2117 2117 // "Welcome to 86Box!"
#define IDS_2118 2118 // "Internal controller"
#define IDS_2119 2119 // "Exit"
#define IDS_2120 2120 // "No ROMs found"
#define IDS_2121 2121 // "Save changes\nThis will hard..."
#define IDS_2122 2122 // "Discard changes\nAll changes..."
#define IDS_2123 2123 // "Cancel\nGo back to the..."
#define IDS_4096 4096 // "Hard disk (%s)"
#define IDS_4097 4097 // "%01i:%01i"

View File

@@ -893,12 +893,12 @@ BEGIN
2048 "86Box"
IDS_2049 "86Box Error"
IDS_2050 "86Box Fatal Error"
IDS_2051 "This will hard reset the emulated machine.\nAre you sure you want to save the settings?"
IDS_2051 "Are you sure you want to save the settings?"
IDS_2052 "Use CTRL+ALT+PAGE DOWN to return to windowed mode"
IDS_2053 "Speed"
IDS_2054 "ZIP %03i %i (%s): %ls"
IDS_2055 "ZIP images (*.IM?;*.ZDI)\0*.IM?;*.ZDI\0"
IDS_2056 "86Box could not find any usable ROM images.\n\nPlease download a ROM set from https://github.com/86Box/roms/releases/latest and extract it into the ""roms"" directory."
IDS_2056 "86Box could not find any usable ROM images.\n\nPlease download a ROM set from <a href=""https://github.com/86Box/roms/releases/latest"">https://github.com/86Box/roms/releases/latest</a> and extract it into the ""roms"" directory."
IDS_2057 "(empty)"
IDS_2058 "ZIP images (*.IM?;*.ZDI)\0*.IM?;*.ZDI\0All files (*.*)\0*.*\0"
IDS_2059 "Turbo"
@@ -939,7 +939,7 @@ BEGIN
IDS_2086 "MB"
IDS_2087 "Check BPB"
IDS_2088 "KB"
IDS_2089 "86Box could not initialize the video renderer."
IDS_2089 "Could not initialize the video renderer."
IDS_2090 "Default"
IDS_2091 "%i Wait state(s)"
IDS_2092 "Type"
@@ -954,8 +954,8 @@ BEGIN
IDS_2101 "Microsoft SideWinder Pad"
IDS_2102 "Thrustmaster Flight Control System"
IDS_2103 "None"
IDS_2104 "Unable to load Keyboard Accelerators!"
IDS_2105 "Unable to register Raw Input!"
IDS_2104 "Unable to load keyboard accelerators."
IDS_2105 "Unable to register raw input."
IDS_2106 "%u"
IDS_2107 "%u MB (CHS: %i, %i, %i)"
IDS_2108 "Floppy %i (%s): %ls"
@@ -968,7 +968,12 @@ BEGIN
IDS_2115 "MO %i (%03i): %ls"
IDS_2116 "MO images (*.IM?)\0*.IM?\0All files (*.*)\0*.*\0"
IDS_2117 "Welcome to 86Box!"
IDS_2118 "Internal controller"
IDS_2118 "Internal controller"
IDS_2119 "Exit"
IDS_2120 "No ROMs found"
IDS_2121 "Save changes\nThis will hard reset the emulated machine."
IDS_2122 "Discard changes\nAll changes made to the settings will be lost."
IDS_2123 "Cancel\nGo back to the Settings window."
END
STRINGTABLE DISCARDABLE

View File

@@ -396,17 +396,31 @@ static int
settings_msgbox_reset(void)
{
int changed, i = 0;
TASKDIALOGCONFIG tdconfig = {0};
TASKDIALOG_BUTTON tdbuttons[] = {
{IDYES, MAKEINTRESOURCE(IDS_2121)},
{IDNO, MAKEINTRESOURCE(IDS_2122)},
{IDCANCEL, MAKEINTRESOURCE(IDS_2123)}
};
changed = win_settings_changed();
if (changed) {
i = settings_msgbox(MBX_QUESTION, (wchar_t *)IDS_2051);
tdconfig.cbSize = sizeof(tdconfig);
tdconfig.hwndParent = hwndParentDialog;
tdconfig.dwFlags = TDF_USE_COMMAND_LINKS;
tdconfig.dwCommonButtons = 0;
tdconfig.pszWindowTitle = MAKEINTRESOURCE(IDS_STRINGS);
tdconfig.pszMainInstruction = MAKEINTRESOURCE(IDS_2051);
tdconfig.cButtons = ARRAYSIZE(tdbuttons);
tdconfig.pButtons = tdbuttons;
TaskDialogIndirect(&tdconfig, &i, NULL, NULL);
if (i == 1) return(1); /* no */
if (i == IDNO) return(1); /* no */
if (i < 0) return(0); /* cancel */
if (i == IDYES) return(2); /* yes */
return(2); /* yes */
return(0); /* cancel */
} else
return(1);
}