Annotation of hatari/src/gui-sdl/dlgMain.c, revision 1.1.1.5

1.1       root        1: /*
                      2:   Hatari - dlgMain.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:   The main dialog.
                      8: */
1.1.1.5 ! root        9: const char DlgMain_rcsid[] = "Hatari $Id: dlgMain.c,v 1.10 2006/07/03 20:36:28 clafou Exp $";
1.1       root       10: 
                     11: #include "main.h"
                     12: #include "configuration.h"
                     13: #include "dialog.h"
                     14: #include "sdlgui.h"
                     15: #include "screen.h"
                     16: 
                     17: 
                     18: #define MAINDLG_ABOUT    2
1.1.1.4   root       19: #define MAINDLG_DISKS    3
1.1.1.2   root       20: #define MAINDLG_ROM      4
1.1       root       21: #define MAINDLG_SCREEN   5
                     22: #define MAINDLG_SOUND    6
                     23: #define MAINDLG_CPU      7
                     24: #define MAINDLG_MEMORY   8
                     25: #define MAINDLG_JOY      9
                     26: #define MAINDLG_KEYBD    10
                     27: #define MAINDLG_DEVICES  11
                     28: #define MAINDLG_LOADCFG  12
                     29: #define MAINDLG_SAVECFG  13
                     30: #define MAINDLG_NORESET  14
                     31: #define MAINDLG_RESET    15
                     32: #define MAINDLG_OK       16
                     33: #define MAINDLG_CANCEL   17
                     34: #define MAINDLG_QUIT     18
                     35: 
                     36: 
                     37: /* The main dialog: */
                     38: static SGOBJ maindlg[] =
                     39: {
                     40:   { SGBOX, 0, 0, 0,0, 36,22, NULL },
                     41:   { SGTEXT, 0, 0, 10,1, 16,1, "Hatari main menu" },
                     42:   { SGBUTTON, 0, 0, 4,4, 12,1, "About" },
1.1.1.4   root       43:   { SGBUTTON, 0, 0, 4,6, 12,1, "Disks" },
1.1.1.2   root       44:   { SGBUTTON, 0, 0, 4,8, 12,1, "ROM" },
1.1       root       45:   { SGBUTTON, 0, 0, 4,10, 12,1, "Screen" },
                     46:   { SGBUTTON, 0, 0, 4,12, 12,1, "Sound" },
                     47:   { SGBUTTON, 0, 0, 20,4, 12,1, "System" },
                     48:   { SGBUTTON, 0, 0, 20,6, 12,1, "Memory" },
                     49:   { SGBUTTON, 0, 0, 20,8, 12,1, "Joysticks" },
                     50:   { SGBUTTON, 0, 0, 20,10, 12,1, "Keyboard" },
                     51:   { SGBUTTON, 0, 0, 20,12, 12,1, "Devices" },
                     52:   { SGBUTTON, 0, 0, 3,15, 14,1, "Load config." },
                     53:   { SGBUTTON, 0, 0, 19,15, 14,1, "Save config." },
                     54:   { SGRADIOBUT, 0, 0, 2,18, 10,1, "No Reset" },
                     55:   { SGRADIOBUT, 0, 0, 2,20, 10,1, "Reset ST" },
                     56:   { SGBUTTON, 0, 0, 14,18, 8,3, "Okay" },
                     57:   { SGBUTTON, 0, 0, 25,20, 8,1, "Cancel" },
                     58:   { SGBUTTON, 0, 0, 25,18, 8,1, "Quit" },
                     59:   { -1, 0, 0, 0,0, 0,0, NULL }
                     60: };
                     61: 
                     62: 
                     63: /*-----------------------------------------------------------------------*/
                     64: /*
                     65:   This functions sets up the actual font and then displays the main dialog.
                     66: */
                     67: int Dialog_MainDlg(BOOL *bReset)
                     68: {
                     69:   int retbut;
1.1.1.2   root       70:   BOOL bOldMouseVisibility;
                     71:   int nOldMouseX, nOldMouseY;
1.1       root       72: 
1.1.1.3   root       73:   if(SDLGui_SetScreen(sdlscrn))
1.1       root       74:     return FALSE;
                     75: 
1.1.1.2   root       76:   SDL_GetMouseState(&nOldMouseX, &nOldMouseY);
                     77:   bOldMouseVisibility = SDL_ShowCursor(SDL_QUERY);
1.1       root       78:   SDL_ShowCursor(SDL_ENABLE);
                     79: 
1.1.1.2   root       80:   SDLGui_CenterDlg(maindlg);
                     81: 
1.1       root       82:   maindlg[MAINDLG_NORESET].state |= SG_SELECTED;
                     83:   maindlg[MAINDLG_RESET].state &= ~SG_SELECTED;
                     84: 
                     85:   do
                     86:   {
1.1.1.3   root       87:     retbut = SDLGui_DoDialog(maindlg, NULL);
1.1       root       88:     switch(retbut)
                     89:     {
                     90:       case MAINDLG_ABOUT:
                     91:         Dialog_AboutDlg();
                     92:         break;
1.1.1.4   root       93:       case MAINDLG_DISKS:
                     94:         Dialog_DiskDlg();
1.1       root       95:         break;
1.1.1.2   root       96:       case MAINDLG_ROM:
                     97:         DlgRom_Main();
1.1       root       98:         break;
                     99:       case MAINDLG_SCREEN:
                    100:         Dialog_ScreenDlg();
                    101:         break;
                    102:       case MAINDLG_SOUND:
                    103:         Dialog_SoundDlg();
                    104:         break;
                    105:       case MAINDLG_CPU:
                    106:         Dialog_SystemDlg();
                    107:         break;
                    108:       case MAINDLG_MEMORY:
                    109:         Dialog_MemDlg();
                    110:         break;
                    111:       case MAINDLG_JOY:
                    112:         Dialog_JoyDlg();
                    113:         break;
                    114:       case MAINDLG_KEYBD:
                    115:         Dialog_KeyboardDlg();
                    116:         break;
                    117:       case MAINDLG_DEVICES:
                    118:         Dialog_DeviceDlg();
                    119:         break;
                    120:       case MAINDLG_LOADCFG:
1.1.1.5 ! root      121:                Dialog_LoadParams();
1.1       root      122:         break;
                    123:       case MAINDLG_SAVECFG:
1.1.1.5 ! root      124:                Dialog_SaveParams();
1.1       root      125:         break;
                    126:       case MAINDLG_QUIT:
                    127:         bQuitProgram = TRUE;
                    128:         break;
                    129:     }
                    130:   }
1.1.1.3   root      131:   while (retbut!=MAINDLG_OK && retbut!=MAINDLG_CANCEL && retbut!=SDLGUI_QUIT && !bQuitProgram);
1.1       root      132: 
                    133: 
                    134:   if( maindlg[MAINDLG_RESET].state & SG_SELECTED )
                    135:     *bReset = TRUE;
                    136:   else
                    137:     *bReset = FALSE;
                    138: 
1.1.1.2   root      139:   SDL_ShowCursor(bOldMouseVisibility);
                    140:   Main_WarpMouse(nOldMouseX, nOldMouseY);
                    141: 
1.1       root      142:   return(retbut == MAINDLG_OK);
                    143: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.