|
|
1.1 root 1: /*
1.1.1.4 root 2: Hatari - dialog.c
3:
1.1.1.16 root 4: This file is distributed under the GNU General Public License, version 2
5: or at your option any later version. Read the file gpl.txt for details.
1.1 root 6:
1.1.1.12 root 7: Code to handle our options dialog.
1.1 root 8: */
1.1.1.13 root 9: const char Dialog_fileid[] = "Hatari dialog.c : " __DATE__ " " __TIME__;
1.1.1.3 root 10:
1.1 root 11: #include "main.h"
12: #include "configuration.h"
1.1.1.12 root 13: #include "change.h"
1.1 root 14: #include "dialog.h"
1.1.1.11 root 15: #include "log.h"
1.1.1.2 root 16: #include "sdlgui.h"
1.1.1.12 root 17: #include "screen.h"
1.1 root 18:
19:
1.1.1.2 root 20: /*-----------------------------------------------------------------------*/
1.1.1.11 root 21: /**
22: * Open Property sheet Options dialog.
1.1.1.12 root 23: *
24: * We keep all our configuration details in a structure called
25: * 'ConfigureParams'. When we open our dialog we make a backup
26: * of this structure. When the user finally clicks on 'OK',
27: * we can compare and makes the necessary changes.
28: *
1.1.1.14 root 29: * Return true if user chooses OK, or false if cancel!
1.1.1.11 root 30: */
1.1.1.12 root 31: bool Dialog_DoProperty(void)
1.1 root 32: {
1.1.1.12 root 33: bool bOKDialog; /* Did user 'OK' dialog? */
34: bool bForceReset;
1.1.1.13 root 35: bool bLoadedSnapshot;
1.1.1.12 root 36: CNF_PARAMS current;
1.1 root 37:
1.1.1.18! root 38: #if WITH_SDL2
! 39: bool bOldMouseMode = SDL_GetRelativeMouseMode();
! 40: SDL_SetRelativeMouseMode(SDL_FALSE);
! 41: #endif
! 42:
1.1.1.14 root 43: Main_PauseEmulation(true);
44: bForceReset = false;
1.1 root 45:
1.1.1.12 root 46: /* Copy details (this is so can restore if 'Cancel' dialog) */
47: current = ConfigureParams;
48: ConfigureParams.Screen.bFullScreen = bInFullScreen;
1.1.1.13 root 49: bOKDialog = Dialog_MainDlg(&bForceReset, &bLoadedSnapshot);
50:
1.1.1.18! root 51: #if WITH_SDL2
! 52: SDL_SetRelativeMouseMode(bOldMouseMode);
! 53: #endif
! 54:
1.1.1.13 root 55: /* If a memory snapshot has been loaded, no further changes are required */
56: if (bLoadedSnapshot)
57: {
58: Main_UnPauseEmulation();
59: return true;
60: }
1.1 root 61:
1.1.1.11 root 62: /* Check if reset is required and ask user if he really wants to continue then */
1.1.1.12 root 63: if (bOKDialog && !bForceReset
64: && Change_DoNeedReset(¤t, &ConfigureParams)
1.1.1.15 root 65: && ConfigureParams.Log.nAlertDlgLogLevel > LOG_FATAL) {
1.1.1.11 root 66: bOKDialog = DlgAlert_Query("The emulated system must be "
67: "reset to apply these changes. "
68: "Apply changes now and reset "
69: "the emulator?");
70: }
71:
72: /* Copy details to configuration */
73: if (bOKDialog) {
1.1.1.12 root 74: Change_CopyChangedParamsToConfiguration(¤t, &ConfigureParams, bForceReset);
75: } else {
76: ConfigureParams = current;
1.1.1.11 root 77: }
1.1.1.2 root 78:
1.1.1.9 root 79: Main_UnPauseEmulation();
1.1.1.2 root 80:
1.1.1.9 root 81: if (bQuitProgram)
1.1.1.17 root 82: Main_RequestQuit(0);
1.1.1.6 root 83:
1.1.1.9 root 84: return bOKDialog;
1.1 root 85: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.