factored out the EFFv2 saving into EFFImporter
[gemrb.git] / gemrb / GUIScripts / iwd2 / Sound.py
blob4dd0a6e0629f95ec18b4aed30fe0b8eea16257fa
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
21 from GUIDefines import *
23 SoundWindow = 0
24 TextAreaControl = 0
26 def OnLoad():
27 global SoundWindow, TextAreaControl
29 GemRB.LoadWindowPack("GUIOPT", 800, 600)
30 SoundWindow = GemRB.LoadWindow(7)
31 SoundWindow.SetFrame( )
33 TextAreaControl = SoundWindow.GetControl(14)
34 AmbientButton = SoundWindow.GetControl(16)
35 AmbientSlider = SoundWindow.GetControl(1)
36 SoundEffectsButton = SoundWindow.GetControl(17)
37 SoundEffectsSlider = SoundWindow.GetControl(2)
38 DialogueButton = SoundWindow.GetControl(18)
39 DialogueSlider = SoundWindow.GetControl(3)
40 MusicButton = SoundWindow.GetControl(19)
41 MusicSlider = SoundWindow.GetControl(4)
42 MoviesButton = SoundWindow.GetControl(20)
43 MoviesSlider = SoundWindow.GetControl(22)
44 EnvironmentalButton = SoundWindow.GetControl(28)
45 EnvironmentalButtonB = SoundWindow.GetControl(26)
46 CharacterSoundButton = SoundWindow.GetControl(13)
47 OkButton = SoundWindow.GetControl(24)
48 CancelButton = SoundWindow.GetControl(25)
49 TextAreaControl.SetText(18040)
50 CharacterSoundButton.SetText(17778)
52 OkButton.SetText(11973)
53 OkButton.SetFlags (IE_GUI_BUTTON_DEFAULT, OP_OR)
55 CancelButton.SetText(13727)
56 CancelButton.SetFlags (IE_GUI_BUTTON_CANCEL, OP_OR)
58 AmbientButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, AmbientPress)
59 AmbientSlider.SetEvent(IE_GUI_SLIDER_ON_CHANGE, AmbientPress)
60 AmbientSlider.SetVarAssoc("Volume Ambients",10)
62 SoundEffectsButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, SoundEffectsPress)
63 SoundEffectsSlider.SetEvent(IE_GUI_SLIDER_ON_CHANGE, SoundEffectsPress)
64 SoundEffectsSlider.SetVarAssoc("Volume SFX",10)
66 DialogueButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, DialoguePress)
67 DialogueSlider.SetEvent(IE_GUI_SLIDER_ON_CHANGE, DialoguePress)
68 DialogueSlider.SetVarAssoc("Volume Voices",10)
70 MusicButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, MusicPress)
71 MusicSlider.SetEvent(IE_GUI_SLIDER_ON_CHANGE, MusicPress)
72 MusicSlider.SetVarAssoc("Volume Music",10)
74 MoviesButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, MoviesPress)
75 MoviesSlider.SetEvent(IE_GUI_SLIDER_ON_CHANGE, MoviesPress)
76 MoviesSlider.SetVarAssoc("Volume Movie",10)
78 EnvironmentalButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, EnvironmentalPress)
79 EnvironmentalButtonB.SetEvent(IE_GUI_BUTTON_ON_PRESS, EnvironmentalPress)
80 EnvironmentalButtonB.SetFlags(IE_GUI_BUTTON_CHECKBOX,OP_OR)
81 EnvironmentalButtonB.SetVarAssoc("Environmental Audio",1)
82 EnvironmentalButtonB.SetSprites("GBTNOPT4", 0, 0, 1, 2, 3)
84 CharacterSoundButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, CharacterSoundPress)
85 OkButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, OkPress)
86 CancelButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, CancelPress)
87 SoundWindow.SetVisible(WINDOW_VISIBLE)
88 return
90 def AmbientPress():
91 TextAreaControl.SetText(18008)
92 GemRB.UpdateAmbientsVolume ()
93 return
95 def SoundEffectsPress():
96 TextAreaControl.SetText(18009)
97 return
99 def DialoguePress():
100 TextAreaControl.SetText(18010)
101 return
103 def MusicPress():
104 TextAreaControl.SetText(18011)
105 GemRB.UpdateMusicVolume ()
106 return
108 def MoviesPress():
109 TextAreaControl.SetText(18012)
110 return
112 def EnvironmentalPress():
113 TextAreaControl.SetText(18022)
114 return
116 def CharacterSoundPress():
117 if SoundWindow:
118 SoundWindow.Unload()
119 GemRB.SetNextScript("CharSound")
120 return
122 def OkPress():
123 if SoundWindow:
124 SoundWindow.Unload()
125 GemRB.SetNextScript("Options")
126 return
128 def CancelPress():
129 if SoundWindow:
130 SoundWindow.Unload()
131 GemRB.SetNextScript("Options")
132 return