Starshatter_Open
Open source Starshatter engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
AudDlg.cpp
Go to the documentation of this file.
1 /* Project Starshatter 4.5
2  Destroyer Studios LLC
3  Copyright © 1997-2004. All Rights Reserved.
4 
5  SUBSYSTEM: Stars.exe
6  FILE: AudDlg.cpp
7  AUTHOR: John DiCamillo
8 
9 
10  OVERVIEW
11  ========
12  Main Menu Dialog Active Window class
13 */
14 
15 #include "MemDebug.h"
16 #include "AudDlg.h"
17 #include "MenuScreen.h"
18 #include "Starshatter.h"
19 #include "AudioConfig.h"
20 
21 #include "DataLoader.h"
22 #include "Button.h"
23 #include "ListBox.h"
24 #include "Slider.h"
25 #include "Video.h"
26 #include "Keyboard.h"
27 #include "MachineInfo.h"
28 
29 // +--------------------------------------------------------------------+
30 // DECLARE MAPPING FUNCTIONS:
31 
32 DEF_MAP_CLIENT(AudDlg, OnApply);
33 DEF_MAP_CLIENT(AudDlg, OnCancel);
34 DEF_MAP_CLIENT(AudDlg, OnAudio);
35 DEF_MAP_CLIENT(AudDlg, OnVideo);
36 DEF_MAP_CLIENT(AudDlg, OnOptions);
37 DEF_MAP_CLIENT(AudDlg, OnControls);
38 DEF_MAP_CLIENT(AudDlg, OnMod);
39 
40 // +--------------------------------------------------------------------+
41 
43 : FormWindow(s, 0, 0, s->Width(), s->Height()), manager(mgr),
44 apply(0), cancel(0), vid_btn(0), aud_btn(0), ctl_btn(0), opt_btn(0), mod_btn(0),
45 closed(true)
46 {
47  Init(def);
48 }
49 
51 {
52 }
53 
54 // +--------------------------------------------------------------------+
55 
56 void
58 {
59  if (apply)
60  return;
61 
66 
69 
70  apply = (Button*) FindControl(1);
72 
73  cancel = (Button*) FindControl(2);
75 
76  vid_btn = (Button*) FindControl(901);
78 
79  aud_btn = (Button*) FindControl(902);
81 
82  ctl_btn = (Button*) FindControl(903);
84 
85  opt_btn = (Button*) FindControl(904);
87 
88  mod_btn = (Button*) FindControl(905);
89  if (mod_btn) {
91  }
92 }
93 
94 // +--------------------------------------------------------------------+
95 
96 void
98 {
100 
101  if (closed && AudioConfig::GetInstance()) {
103 
104  if (efx_volume_slider)
106 
107  if (gui_volume_slider)
109 
110  if (wrn_volume_slider)
112 
113  if (vox_volume_slider)
115 
116  if (menu_music_slider)
118 
119  if (game_music_slider)
121  }
122 
123  if (vid_btn) vid_btn->SetButtonState(0);
124  if (aud_btn) aud_btn->SetButtonState(1);
125  if (ctl_btn) ctl_btn->SetButtonState(0);
126  if (opt_btn) opt_btn->SetButtonState(0);
127  if (mod_btn) mod_btn->SetButtonState(0);
128 
129  closed = false;
130 }
131 
132 // +--------------------------------------------------------------------+
133 
134 void
136 {
137  if (Keyboard::KeyDown(VK_RETURN)) {
138  OnApply(0);
139  }
140 }
141 
142 // +--------------------------------------------------------------------+
143 
149 
150 // +--------------------------------------------------------------------+
151 
152 void
154 {
155  if (manager)
157 }
158 
159 void
161 {
163 }
164 
165 // +--------------------------------------------------------------------+
166 
167 void
169 {
170  if (!closed && AudioConfig::GetInstance()) {
172 
173  if (efx_volume_slider)
175 
176  if (gui_volume_slider)
178 
179  if (wrn_volume_slider)
181 
182  if (vox_volume_slider)
184 
185  if (menu_music_slider)
187 
188  if (game_music_slider)
190 
191  audio->Save();
192  }
193 
194  closed = true;
195 }
196 
197 void
199 {
200  closed = true;
201 }