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

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: */
                      9: char DlgMain_rcsid[] = "Hatari $Id: dlgMain.c,v 1.3 2004/06/11 12:48:49 thothy Exp $";
                     10: 
                     11: #include "main.h"
                     12: #include "configuration.h"
                     13: #include "dialog.h"
                     14: #include "sdlgui.h"
                     15: #include "screen.h"
                     16: 
                     17: /* Prototypes of the dialog functions: */
                     18: void Dialog_AboutDlg(void);
                     19: void Dialog_DiscDlg(void);
                     20: void Dialog_TosGemDlg(void);
                     21: void Dialog_ScreenDlg(void);
                     22: void Dialog_SoundDlg(void);
                     23: void Dialog_SystemDlg(void);
                     24: void Dialog_MemDlg(void);
                     25: void Dialog_JoyDlg(void);
                     26: void Dialog_KeyboardDlg(void);
                     27: void Dialog_DeviceDlg(void);
                     28: 
                     29: 
                     30: #define MAINDLG_ABOUT    2
                     31: #define MAINDLG_DISCS    3
                     32: #define MAINDLG_TOSGEM   4
                     33: #define MAINDLG_SCREEN   5
                     34: #define MAINDLG_SOUND    6
                     35: #define MAINDLG_CPU      7
                     36: #define MAINDLG_MEMORY   8
                     37: #define MAINDLG_JOY      9
                     38: #define MAINDLG_KEYBD    10
                     39: #define MAINDLG_DEVICES  11
                     40: #define MAINDLG_LOADCFG  12
                     41: #define MAINDLG_SAVECFG  13
                     42: #define MAINDLG_NORESET  14
                     43: #define MAINDLG_RESET    15
                     44: #define MAINDLG_OK       16
                     45: #define MAINDLG_CANCEL   17
                     46: #define MAINDLG_QUIT     18
                     47: 
                     48: 
                     49: /* The main dialog: */
                     50: static SGOBJ maindlg[] =
                     51: {
                     52:   { SGBOX, 0, 0, 0,0, 36,22, NULL },
                     53:   { SGTEXT, 0, 0, 10,1, 16,1, "Hatari main menu" },
                     54:   { SGBUTTON, 0, 0, 4,4, 12,1, "About" },
                     55:   { SGBUTTON, 0, 0, 4,6, 12,1, "Discs" },
                     56:   { SGBUTTON, 0, 0, 4,8, 12,1, "TOS/GEM" },
                     57:   { SGBUTTON, 0, 0, 4,10, 12,1, "Screen" },
                     58:   { SGBUTTON, 0, 0, 4,12, 12,1, "Sound" },
                     59:   { SGBUTTON, 0, 0, 20,4, 12,1, "System" },
                     60:   { SGBUTTON, 0, 0, 20,6, 12,1, "Memory" },
                     61:   { SGBUTTON, 0, 0, 20,8, 12,1, "Joysticks" },
                     62:   { SGBUTTON, 0, 0, 20,10, 12,1, "Keyboard" },
                     63:   { SGBUTTON, 0, 0, 20,12, 12,1, "Devices" },
                     64:   { SGBUTTON, 0, 0, 3,15, 14,1, "Load config." },
                     65:   { SGBUTTON, 0, 0, 19,15, 14,1, "Save config." },
                     66:   { SGRADIOBUT, 0, 0, 2,18, 10,1, "No Reset" },
                     67:   { SGRADIOBUT, 0, 0, 2,20, 10,1, "Reset ST" },
                     68:   { SGBUTTON, 0, 0, 14,18, 8,3, "Okay" },
                     69:   { SGBUTTON, 0, 0, 25,20, 8,1, "Cancel" },
                     70:   { SGBUTTON, 0, 0, 25,18, 8,1, "Quit" },
                     71:   { -1, 0, 0, 0,0, 0,0, NULL }
                     72: };
                     73: 
                     74: 
                     75: /*-----------------------------------------------------------------------*/
                     76: /*
                     77:   This functions sets up the actual font and then displays the main dialog.
                     78: */
                     79: int Dialog_MainDlg(BOOL *bReset)
                     80: {
                     81:   int retbut;
                     82: 
                     83:   if(SDLGui_PrepareFont())
                     84:     return FALSE;
                     85: 
                     86:   SDLGui_CenterDlg(maindlg);
                     87:   SDL_ShowCursor(SDL_ENABLE);
                     88: 
                     89:   maindlg[MAINDLG_NORESET].state |= SG_SELECTED;
                     90:   maindlg[MAINDLG_RESET].state &= ~SG_SELECTED;
                     91: 
                     92:   do
                     93:   {
                     94:     retbut = SDLGui_DoDialog(maindlg);
                     95:     switch(retbut)
                     96:     {
                     97:       case MAINDLG_ABOUT:
                     98:         Dialog_AboutDlg();
                     99:         break;
                    100:       case MAINDLG_DISCS:
                    101:         Dialog_DiscDlg();
                    102:         break;
                    103:       case MAINDLG_TOSGEM:
                    104:         Dialog_TosGemDlg();
                    105:         break;
                    106:       case MAINDLG_SCREEN:
                    107:         Dialog_ScreenDlg();
                    108:         break;
                    109:       case MAINDLG_SOUND:
                    110:         Dialog_SoundDlg();
                    111:         break;
                    112:       case MAINDLG_CPU:
                    113:         Dialog_SystemDlg();
                    114:         break;
                    115:       case MAINDLG_MEMORY:
                    116:         Dialog_MemDlg();
                    117:         break;
                    118:       case MAINDLG_JOY:
                    119:         Dialog_JoyDlg();
                    120:         break;
                    121:       case MAINDLG_KEYBD:
                    122:         Dialog_KeyboardDlg();
                    123:         break;
                    124:       case MAINDLG_DEVICES:
                    125:         Dialog_DeviceDlg();
                    126:         break;
                    127:       case MAINDLG_LOADCFG:
                    128:         {
                    129:           CNF_PARAMS tmpParams;
                    130:           /* Configuration_Load uses the variables from ConfigureParams.
                    131:            * That's why we have to temporarily back it up here */
                    132:           tmpParams = ConfigureParams;
                    133:           Configuration_Load();
                    134:           DialogParams = ConfigureParams;
                    135:           ConfigureParams = tmpParams;
                    136:         }
                    137:         break;
                    138:       case MAINDLG_SAVECFG:
                    139:         {
                    140:           CNF_PARAMS tmpParams;
                    141:           /* Configuration_Save uses the variables from ConfigureParams.
                    142:            * That's why we have to temporarily back it up here */
                    143:           tmpParams = ConfigureParams;
                    144:           ConfigureParams = DialogParams;
                    145:           Configuration_Save();
                    146:           ConfigureParams = tmpParams;
                    147:         }
                    148:         break;
                    149:       case MAINDLG_QUIT:
                    150:         bQuitProgram = TRUE;
                    151:         break;
                    152:     }
                    153: 
                    154:     SDL_UpdateRect(sdlscrn, 0,0,0,0);
                    155:   }
                    156:   while(retbut!=MAINDLG_OK && retbut!=MAINDLG_CANCEL && !bQuitProgram);
                    157: 
                    158:   SDL_ShowCursor(SDL_DISABLE);
                    159: 
                    160:   if( maindlg[MAINDLG_RESET].state & SG_SELECTED )
                    161:     *bReset = TRUE;
                    162:   else
                    163:     *bReset = FALSE;
                    164: 
                    165:   return(retbut == MAINDLG_OK);
                    166: }

unix.superglobalmegacorp.com

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