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

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.6 ! root        9: const char DlgMain_rcsid[] = "Hatari $Id: dlgMain.c,v 1.14 2008/02/29 20:24:21 thothy 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: {
1.1.1.6 ! root       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" },
        !            43:        { SGBUTTON, 0, 0, 4,6, 12,1, "Disks" },
        !            44:        { SGBUTTON, 0, 0, 4,8, 12,1, "ROM" },
        !            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, SG_DEFAULT, 0, 14,18, 8,3, "Okay" },
        !            57:        { SGBUTTON, SG_CANCEL, 0, 25,20, 8,1, "Cancel" },
        !            58:        { SGBUTTON, 0, 0, 25,18, 8,1, "Quit" },
        !            59:        { -1, 0, 0, 0,0, 0,0, NULL }
1.1       root       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: {
1.1.1.6 ! root       69:        int retbut;
        !            70:        BOOL bOldMouseVisibility;
        !            71:        int nOldMouseX, nOldMouseY;
        !            72: 
        !            73:        if (SDLGui_SetScreen(sdlscrn))
        !            74:                return FALSE;
        !            75: 
        !            76:        SDL_GetMouseState(&nOldMouseX, &nOldMouseY);
        !            77:        bOldMouseVisibility = SDL_ShowCursor(SDL_QUERY);
        !            78:        SDL_ShowCursor(SDL_ENABLE);
        !            79: 
        !            80:        SDLGui_CenterDlg(maindlg);
        !            81: 
        !            82:        maindlg[MAINDLG_NORESET].state |= SG_SELECTED;
        !            83:        maindlg[MAINDLG_RESET].state &= ~SG_SELECTED;
        !            84: 
        !            85:        do
        !            86:        {
        !            87:                retbut = SDLGui_DoDialog(maindlg, NULL);
        !            88:                switch (retbut)
        !            89:                {
        !            90:                 case MAINDLG_ABOUT:
        !            91:                        Dialog_AboutDlg();
        !            92:                        break;
        !            93:                 case MAINDLG_DISKS:
        !            94:                        Dialog_DiskDlg();
        !            95:                        break;
        !            96:                 case MAINDLG_ROM:
        !            97:                        DlgRom_Main();
        !            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:
        !           121:                        Dialog_LoadParams();
        !           122:                        break;
        !           123:                 case MAINDLG_SAVECFG:
        !           124:                        Dialog_SaveParams();
        !           125:                        break;
        !           126:                 case MAINDLG_QUIT:
        !           127:                        bQuitProgram = TRUE;
        !           128:                        break;
        !           129:                }
        !           130:        }
        !           131:        while (retbut != MAINDLG_OK && retbut != MAINDLG_CANCEL && retbut != SDLGUI_QUIT
        !           132:                && retbut != SDLGUI_ERROR && !bQuitProgram);
        !           133: 
        !           134: 
        !           135:        if (maindlg[MAINDLG_RESET].state & SG_SELECTED)
        !           136:                *bReset = TRUE;
        !           137:        else
        !           138:                *bReset = FALSE;
1.1       root      139: 
1.1.1.6 ! root      140:        SDL_ShowCursor(bOldMouseVisibility);
        !           141:        Main_WarpMouse(nOldMouseX, nOldMouseY);
1.1.1.2   root      142: 
1.1.1.6 ! root      143:        return (retbut == MAINDLG_OK);
1.1       root      144: }

unix.superglobalmegacorp.com

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