fixed the rest of the functions that needed globalid capabilities
[gemrb.git] / gemrb / GUIScripts / bg2 / GUIOPT7.py
blob93a887a5a576dfdf2ba5065bfec22564476b3124
1 # GemRB - Infinity Engine Emulator
2 # Copyright (C) 2003 The GemRB Project
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 #sound options
20 import GemRB
22 SoundWindow = 0
23 TextAreaControl = 0
25 def OnLoad():
26 global SoundWindow, TextAreaControl
28 GemRB.LoadWindowPack("GUIOPT", 640, 480)
29 SoundWindow = GemRB.LoadWindow(7)
30 TextAreaControl = SoundWindow.GetControl(14)
31 AmbientButton = SoundWindow.GetControl(16)
32 AmbientSlider = SoundWindow.GetControl(1)
33 SoundEffectsButton = SoundWindow.GetControl(17)
34 SoundEffectsSlider = SoundWindow.GetControl(2)
35 DialogueButton = SoundWindow.GetControl(18)
36 DialogueSlider = SoundWindow.GetControl(3)
37 MusicButton = SoundWindow.GetControl(19)
38 MusicSlider = SoundWindow.GetControl(4)
39 MoviesButton = SoundWindow.GetControl(20)
40 MoviesSlider = SoundWindow.GetControl(22)
41 EnvironmentalButton = SoundWindow.GetControl(28)
42 EnvironmentalButtonB = SoundWindow.GetControl(26)
43 CharacterSoundButton = SoundWindow.GetControl(13)
44 OkButton = SoundWindow.GetControl(24)
45 CancelButton = SoundWindow.GetControl(25)
46 TextAreaControl.SetText(18040)
47 CharacterSoundButton.SetText(17778)
48 OkButton.SetText(11973)
49 CancelButton.SetText(13727)
50 AmbientButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, AmbientPress)
51 AmbientSlider.SetEvent(IE_GUI_SLIDER_ON_CHANGE, AmbientPress)
52 AmbientSlider.SetVarAssoc("Volume Ambients",10)
54 SoundEffectsButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, SoundEffectsPress)
55 SoundEffectsSlider.SetEvent(IE_GUI_SLIDER_ON_CHANGE, SoundEffectsPress)
56 SoundEffectsSlider.SetVarAssoc("Volume SFX",10)
58 DialogueButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, DialoguePress)
59 DialogueSlider.SetEvent(IE_GUI_SLIDER_ON_CHANGE, DialoguePress)
60 DialogueSlider.SetVarAssoc("Volume Voices",10)
62 MusicButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, MusicPress)
63 MusicSlider.SetEvent(IE_GUI_SLIDER_ON_CHANGE, MusicPress)
64 MusicSlider.SetVarAssoc("Volume Music",10)
66 MoviesButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, MoviesPress)
67 MoviesSlider.SetEvent(IE_GUI_SLIDER_ON_CHANGE, MoviesPress)
68 MoviesSlider.SetVarAssoc("Volume Movie",10)
70 EnvironmentalButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, EnvironmentalPress)
71 EnvironmentalButtonB.SetEvent(IE_GUI_BUTTON_ON_PRESS, EnvironmentalPress)
72 EnvironmentalButtonB.SetFlags(IE_GUI_BUTTON_CHECKBOX,OP_OR)
73 EnvironmentalButtonB.SetVarAssoc("Environmental Audio",1)
75 CharacterSoundButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, CharacterSoundPress)
76 OkButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, OkPress)
77 OkButton.SetFlags (IE_GUI_BUTTON_DEFAULT, OP_OR)
78 CancelButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, CancelPress)
79 CancelButton.SetFlags (IE_GUI_BUTTON_CANCEL, OP_OR)
80 SoundWindow.SetVisible(WINDOW_VISIBLE)
81 return
83 def AmbientPress():
84 TextAreaControl.SetText(18008)
85 GemRB.UpdateAmbientsVolume ()
86 return
88 def SoundEffectsPress():
89 TextAreaControl.SetText(18009)
90 return
92 def DialoguePress():
93 TextAreaControl.SetText(18010)
94 return
96 def MusicPress():
97 TextAreaControl.SetText(18011)
98 GemRB.UpdateMusicVolume ()
99 return
101 def MoviesPress():
102 TextAreaControl.SetText(18012)
103 return
105 def EnvironmentalPress():
106 TextAreaControl.SetText(18022)
107 return
109 def CharacterSoundPress():
110 if SoundWindow:
111 SoundWindow.Unload()
112 GemRB.SetNextScript("GUIOPT12")
113 return
115 def OkPress():
116 if SoundWindow:
117 SoundWindow.Unload()
118 GemRB.SetNextScript("StartOpt")
119 return
121 def CancelPress():
122 if SoundWindow:
123 SoundWindow.Unload()
124 GemRB.SetNextScript("StartOpt")
125 return