--- hatari/src/gui-sdl/dlgMain.c 2019/04/01 07:11:38 1.1 +++ hatari/src/gui-sdl/dlgMain.c 2019/04/01 07:13:17 1.1.1.5 @@ -6,7 +6,7 @@ The main dialog. */ -char DlgMain_rcsid[] = "Hatari $Id: dlgMain.c,v 1.1 2019/04/01 07:11:38 root Exp $"; +const char DlgMain_rcsid[] = "Hatari $Id: dlgMain.c,v 1.1.1.5 2019/04/01 07:13:17 root Exp $"; #include "main.h" #include "configuration.h" @@ -14,22 +14,10 @@ char DlgMain_rcsid[] = "Hatari $Id: dlgM #include "sdlgui.h" #include "screen.h" -/* Prototypes of the dialog functions: */ -void Dialog_AboutDlg(void); -void Dialog_DiscDlg(void); -void Dialog_TosGemDlg(void); -void Dialog_ScreenDlg(void); -void Dialog_SoundDlg(void); -void Dialog_SystemDlg(void); -void Dialog_MemDlg(void); -void Dialog_JoyDlg(void); -void Dialog_KeyboardDlg(void); -void Dialog_DeviceDlg(void); - #define MAINDLG_ABOUT 2 -#define MAINDLG_DISCS 3 -#define MAINDLG_TOSGEM 4 +#define MAINDLG_DISKS 3 +#define MAINDLG_ROM 4 #define MAINDLG_SCREEN 5 #define MAINDLG_SOUND 6 #define MAINDLG_CPU 7 @@ -52,8 +40,8 @@ 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, "Discs" }, - { SGBUTTON, 0, 0, 4,8, 12,1, "TOS/GEM" }, + { 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" }, @@ -79,29 +67,34 @@ static SGOBJ maindlg[] = int Dialog_MainDlg(BOOL *bReset) { int retbut; + BOOL bOldMouseVisibility; + int nOldMouseX, nOldMouseY; - if(SDLGui_PrepareFont()) + if(SDLGui_SetScreen(sdlscrn)) return FALSE; - SDLGui_CenterDlg(maindlg); + SDL_GetMouseState(&nOldMouseX, &nOldMouseY); + bOldMouseVisibility = SDL_ShowCursor(SDL_QUERY); SDL_ShowCursor(SDL_ENABLE); + SDLGui_CenterDlg(maindlg); + maindlg[MAINDLG_NORESET].state |= SG_SELECTED; maindlg[MAINDLG_RESET].state &= ~SG_SELECTED; do { - retbut = SDLGui_DoDialog(maindlg); + retbut = SDLGui_DoDialog(maindlg, NULL); switch(retbut) { case MAINDLG_ABOUT: Dialog_AboutDlg(); break; - case MAINDLG_DISCS: - Dialog_DiscDlg(); + case MAINDLG_DISKS: + Dialog_DiskDlg(); break; - case MAINDLG_TOSGEM: - Dialog_TosGemDlg(); + case MAINDLG_ROM: + DlgRom_Main(); break; case MAINDLG_SCREEN: Dialog_ScreenDlg(); @@ -125,42 +118,26 @@ int Dialog_MainDlg(BOOL *bReset) Dialog_DeviceDlg(); break; case MAINDLG_LOADCFG: - { - CNF_PARAMS tmpParams; - /* Configuration_Load uses the variables from ConfigureParams. - * That's why we have to temporarily back it up here */ - tmpParams = ConfigureParams; - Configuration_Load(); - DialogParams = ConfigureParams; - ConfigureParams = tmpParams; - } + Dialog_LoadParams(); break; case MAINDLG_SAVECFG: - { - CNF_PARAMS tmpParams; - /* Configuration_Save uses the variables from ConfigureParams. - * That's why we have to temporarily back it up here */ - tmpParams = ConfigureParams; - ConfigureParams = DialogParams; - Configuration_Save(); - ConfigureParams = tmpParams; - } + Dialog_SaveParams(); break; case MAINDLG_QUIT: bQuitProgram = TRUE; break; } - - SDL_UpdateRect(sdlscrn, 0,0,0,0); } - while(retbut!=MAINDLG_OK && retbut!=MAINDLG_CANCEL && !bQuitProgram); + while (retbut!=MAINDLG_OK && retbut!=MAINDLG_CANCEL && retbut!=SDLGUI_QUIT && !bQuitProgram); - SDL_ShowCursor(SDL_DISABLE); if( maindlg[MAINDLG_RESET].state & SG_SELECTED ) *bReset = TRUE; else *bReset = FALSE; + SDL_ShowCursor(bOldMouseVisibility); + Main_WarpMouse(nOldMouseX, nOldMouseY); + return(retbut == MAINDLG_OK); }