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