--- hatari/src/gui-sdl/dlgMain.c 2019/04/01 07:15:41 1.1.1.8 +++ hatari/src/gui-sdl/dlgMain.c 2019/04/09 08:57:08 1.1.1.14 @@ -1,8 +1,8 @@ /* Hatari - dlgMain.c - This file is distributed under the GNU Public License, version 2 or at - your option any later version. Read the file gpl.txt for details. + This file is distributed under the GNU General Public License, version 2 + or at your option any later version. Read the file gpl.txt for details. The main dialog. */ @@ -15,60 +15,66 @@ const char DlgMain_fileid[] = "Hatari dl #include "screen.h" -#define MAINDLG_ABOUT 2 -#define MAINDLG_DISKS 3 +#define MAINDLG_SYSTEM 2 +#define MAINDLG_CPU 3 #define MAINDLG_ROM 4 -#define MAINDLG_SCREEN 5 -#define MAINDLG_SOUND 6 -#define MAINDLG_CPU 7 -#define MAINDLG_MEMORY 8 -#define MAINDLG_JOY 9 -#define MAINDLG_KEYBD 10 -#define MAINDLG_DEVICES 11 -#define MAINDLG_LOADCFG 12 -#define MAINDLG_SAVECFG 13 -#define MAINDLG_NORESET 14 -#define MAINDLG_RESET 15 -#define MAINDLG_OK 16 -#define MAINDLG_CANCEL 17 -#define MAINDLG_QUIT 18 +#define MAINDLG_MEMORY 5 +#define MAINDLG_FLOPPYS 6 +#define MAINDLG_HARDDISK 7 +#define MAINDLG_MONITOR 8 +#define MAINDLG_WINDOW 9 +#define MAINDLG_JOY 10 +#define MAINDLG_KEYBD 11 +#define MAINDLG_DEVICES 12 +#define MAINDLG_SOUND 13 +#define MAINDLG_ABOUT 14 +#define MAINDLG_LOADCFG 15 +#define MAINDLG_SAVECFG 16 +#define MAINDLG_NORESET 17 +#define MAINDLG_RESET 18 +#define MAINDLG_OK 19 +#define MAINDLG_QUIT 20 +#define MAINDLG_CANCEL 21 /* The main dialog: */ static SGOBJ maindlg[] = { - { SGBOX, 0, 0, 0,0, 36,22, NULL }, - { SGTEXT, 0, 0, 10,1, 16,1, "Hatari main menu" }, - { SGBUTTON, 0, 0, 4,4, 12,1, "About" }, - { SGBUTTON, 0, 0, 4,6, 12,1, "Disks" }, - { SGBUTTON, 0, 0, 4,8, 12,1, "ROM" }, - { SGBUTTON, 0, 0, 4,10, 12,1, "Screen" }, - { SGBUTTON, 0, 0, 4,12, 12,1, "Sound" }, - { SGBUTTON, 0, 0, 20,4, 12,1, "System" }, - { SGBUTTON, 0, 0, 20,6, 12,1, "Memory" }, - { SGBUTTON, 0, 0, 20,8, 12,1, "Joysticks" }, - { SGBUTTON, 0, 0, 20,10, 12,1, "Keyboard" }, - { SGBUTTON, 0, 0, 20,12, 12,1, "Devices" }, - { SGBUTTON, 0, 0, 3,15, 14,1, "Load config." }, - { SGBUTTON, 0, 0, 19,15, 14,1, "Save config." }, - { SGRADIOBUT, 0, 0, 2,18, 10,1, "No Reset" }, - { SGRADIOBUT, 0, 0, 2,20, 10,1, "Reset ST" }, - { SGBUTTON, SG_DEFAULT, 0, 14,18, 8,3, "Okay" }, - { SGBUTTON, SG_CANCEL, 0, 25,20, 8,1, "Cancel" }, - { SGBUTTON, 0, 0, 25,18, 8,1, "Quit" }, - { -1, 0, 0, 0,0, 0,0, NULL } + { SGBOX, 0, 0, 0,0, 50,19, NULL }, + { SGTEXT, 0, 0, 17,1, 16,1, "Hatari main menu" }, + { SGBUTTON, 0, 0, 2, 4, 13,1, "S_ystem" }, + { SGBUTTON, 0, 0, 2, 6, 13,1, "CP_U" }, + { SGBUTTON, 0, 0, 2, 8, 13,1, "_ROM" }, + { SGBUTTON, 0, 0, 2,10, 13,1, "_Memory" }, + { SGBUTTON, 0, 0, 17, 4, 16,1, "_Floppy disks" }, + { SGBUTTON, 0, 0, 17, 6, 16,1, "Hard _disks" }, + { SGBUTTON, 0, 0, 17, 8, 16,1, "_Atari screen" }, + { SGBUTTON, 0, 0, 17,10, 16,1, "_Hatari screen" }, + { SGBUTTON, 0, 0, 35, 4, 13,1, "_Joysticks" }, + { SGBUTTON, 0, 0, 35, 6, 13,1, "_Keyboard" }, + { SGBUTTON, 0, 0, 35, 8, 13,1, "D_evices" }, + { SGBUTTON, 0, 0, 35,10, 13,1, "S_ound" }, + { SGBUTTON, 0, 0, 2,13, 13,1, "A_bout" }, + { SGBUTTON, 0, 0, 17,13, 16,1, "_Load config" }, + { SGBUTTON, 0, 0, 35,13, 13,1, "_Save config" }, + { SGRADIOBUT, 0, 0, 3,15, 10,1, "_No Reset" }, + { SGRADIOBUT, 0, 0, 3,17, 15,1, "Reset ma_chine" }, + { SGBUTTON, SG_DEFAULT, 0, 21,15, 8,3, "OK" }, + { SGBUTTON, 0, 0, 36,15, 10,1, "_Quit" }, + { SGBUTTON, SG_CANCEL, 0, 36,17, 10,1, "Cancel" }, + { SGSTOP, 0, 0, 0,0, 0,0, NULL } }; -/*-----------------------------------------------------------------------*/ -/* - This functions sets up the actual font and then displays the main dialog. -*/ +/** + * This functions sets up the actual font and then displays the main dialog. + */ int Dialog_MainDlg(bool *bReset, bool *bLoadedSnapshot) { int retbut; bool bOldMouseVisibility; int nOldMouseX, nOldMouseY; + char *psNewCfg; *bReset = false; *bLoadedSnapshot = false; @@ -87,32 +93,40 @@ int Dialog_MainDlg(bool *bReset, bool *b do { - retbut = SDLGui_DoDialog(maindlg, NULL); + retbut = SDLGui_DoDialog(maindlg, NULL, false); switch (retbut) { case MAINDLG_ABOUT: Dialog_AboutDlg(); break; - case MAINDLG_DISKS: - Dialog_DiskDlg(); + case MAINDLG_CPU: + DlgCpu_Main(); + break; + case MAINDLG_FLOPPYS: + DlgFloppy_Main(); + break; + case MAINDLG_HARDDISK: + DlgHardDisk_Main(); break; case MAINDLG_ROM: DlgRom_Main(); break; - case MAINDLG_SCREEN: - Dialog_ScreenDlg(); + case MAINDLG_MONITOR: + Dialog_MonitorDlg(); break; - case MAINDLG_SOUND: - Dialog_SoundDlg(); + case MAINDLG_WINDOW: + Dialog_WindowDlg(); break; - case MAINDLG_CPU: - Dialog_SystemDlg(); + case MAINDLG_SYSTEM: + DlgSystem_Main(); break; case MAINDLG_MEMORY: if (Dialog_MemDlg()) { /* Memory snapshot has been loaded - leave GUI immediately */ *bLoadedSnapshot = true; + SDL_ShowCursor(bOldMouseVisibility); + Main_WarpMouse(nOldMouseX, nOldMouseY, true); return true; } break; @@ -125,11 +139,26 @@ int Dialog_MainDlg(bool *bReset, bool *b case MAINDLG_DEVICES: Dialog_DeviceDlg(); break; + case MAINDLG_SOUND: + Dialog_SoundDlg(); + break; case MAINDLG_LOADCFG: - Configuration_Load(NULL); + psNewCfg = SDLGui_FileSelect("Load configuration:", sConfigFileName, NULL, false); + if (psNewCfg) + { + strcpy(sConfigFileName, psNewCfg); + Configuration_Load(NULL); + free(psNewCfg); + } break; case MAINDLG_SAVECFG: - Configuration_Save(); + psNewCfg = SDLGui_FileSelect("Save configuration:", sConfigFileName, NULL, true); + if (psNewCfg) + { + strcpy(sConfigFileName, psNewCfg); + Configuration_Save(); + free(psNewCfg); + } break; case MAINDLG_QUIT: bQuitProgram = true; @@ -144,7 +173,7 @@ int Dialog_MainDlg(bool *bReset, bool *b *bReset = true; SDL_ShowCursor(bOldMouseVisibility); - Main_WarpMouse(nOldMouseX, nOldMouseY); + Main_WarpMouse(nOldMouseX, nOldMouseY, true); return (retbut == MAINDLG_OK); }