|
|
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.3 ! root 9: char DlgMain_rcsid[] = "Hatari $Id: dlgMain.c,v 1.7 2005/04/05 14:20:58 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
19: #define MAINDLG_DISCS 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" },
43: { SGBUTTON, 0, 0, 4,6, 12,1, "Discs" },
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;
93: case MAINDLG_DISCS:
94: Dialog_DiscDlg();
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:
121: {
122: CNF_PARAMS tmpParams;
123: /* Configuration_Load uses the variables from ConfigureParams.
124: * That's why we have to temporarily back it up here */
125: tmpParams = ConfigureParams;
1.1.1.3 ! root 126: Configuration_Load(NULL);
1.1 root 127: DialogParams = ConfigureParams;
128: ConfigureParams = tmpParams;
129: }
130: break;
131: case MAINDLG_SAVECFG:
132: {
133: CNF_PARAMS tmpParams;
134: /* Configuration_Save uses the variables from ConfigureParams.
135: * That's why we have to temporarily back it up here */
136: tmpParams = ConfigureParams;
137: ConfigureParams = DialogParams;
138: Configuration_Save();
139: ConfigureParams = tmpParams;
140: }
141: break;
142: case MAINDLG_QUIT:
143: bQuitProgram = TRUE;
144: break;
145: }
146: }
1.1.1.3 ! root 147: while (retbut!=MAINDLG_OK && retbut!=MAINDLG_CANCEL && retbut!=SDLGUI_QUIT && !bQuitProgram);
1.1 root 148:
149:
150: if( maindlg[MAINDLG_RESET].state & SG_SELECTED )
151: *bReset = TRUE;
152: else
153: *bReset = FALSE;
154:
1.1.1.2 root 155: SDL_ShowCursor(bOldMouseVisibility);
156: Main_WarpMouse(nOldMouseX, nOldMouseY);
157:
1.1 root 158: return(retbut == MAINDLG_OK);
159: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.