iwd: more gcw syncing with bg2 - actonpc and dragging
[gemrb.git] / gemrb / GUIScripts / bg2 / GUIOPT.py
blob088105e6b5a6941184cba76ff05c793eea451438
1 # -*-python-*-
2 # GemRB - Infinity Engine Emulator
3 # Copyright (C) 2003 The GemRB Project
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 # GUIOPT.py - scripts to control options windows mostly from the GUIOPT winpack
21 # Ingame options
23 ###################################################
24 import GemRB
25 from GUIDefines import *
26 import GUICommon
27 import GUISAVE
29 ###################################################
30 GameOptionsWindow = None
31 PortraitWindow = None
32 OldPortraitWindow = None
33 OptionsWindow = None
34 OldOptionsWindow = None
35 HelpTextArea = None
37 LoadMsgWindow = None
38 QuitMsgWindow = None
40 ###################################################
41 def CloseOptionsWindow ():
42 import GUICommonWindows
43 global GameOptionsWindow, OptionsWindow, PortraitWindow
44 global OldPortraitWindow, OldOptionsWindow
46 if GameOptionsWindow == None:
47 return
49 if GameOptionsWindow:
50 GameOptionsWindow.Unload ()
51 if OptionsWindow:
52 OptionsWindow.Unload ()
53 if PortraitWindow:
54 PortraitWindow.Unload ()
56 GameOptionsWindow = None
57 GemRB.SetVar ("OtherWindow", -1)
58 GUICommon.GameWindow.SetVisible(WINDOW_VISIBLE)
59 GemRB.UnhideGUI ()
60 GUICommonWindows.OptionsWindow = OldOptionsWindow
61 OldOptionsWindow = None
62 GUICommonWindows.PortraitWindow = OldPortraitWindow
63 OldPortraitWindow = None
64 return
66 ###################################################
67 def OpenOptionsWindow ():
68 import GUICommonWindows
69 global GameOptionsWindow, OptionsWindow, PortraitWindow
70 global OldPortraitWindow, OldOptionsWindow
72 if GUICommon.CloseOtherWindow (OpenOptionsWindow):
73 CloseOptionsWindow()
74 return
76 hideflag = GemRB.HideGUI ()
77 GUICommon.GameWindow.SetVisible(WINDOW_INVISIBLE)
79 GemRB.LoadWindowPack ("GUIOPT", 640, 480)
80 GameOptionsWindow = Window = GemRB.LoadWindow (2)
81 GemRB.SetVar ("OtherWindow", GameOptionsWindow.ID)
82 #saving the original portrait window
83 if OldPortraitWindow == None:
84 OldOptionsWindow = GUICommonWindows.OptionsWindow
85 OptionsWindow = GemRB.LoadWindow (0)
86 GUICommonWindows.MarkMenuButton (OptionsWindow)
87 GUICommonWindows.SetupMenuWindowControls (OptionsWindow, 0, OpenOptionsWindow)
88 OptionsWindow.SetFrame ()
89 OldPortraitWindow = GUICommonWindows.PortraitWindow
90 PortraitWindow = GUICommonWindows.OpenPortraitWindow (0)
92 # Return to Game
93 Button = Window.GetControl (11)
94 Button.SetText (10308)
95 Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, OpenOptionsWindow)
97 # Quit Game
98 Button = Window.GetControl (10)
99 Button.SetText (13731)
100 Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, OpenQuitMsgWindow)
102 # Load Game
103 Button = Window.GetControl (5)
104 Button.SetText (13729)
105 Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, OpenLoadMsgWindow)
107 # Save Game
108 Button = Window.GetControl (6)
109 Button.SetText (13730)
110 Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, OpenSaveMsgWindow)
112 # Video Options
113 Button = Window.GetControl (7)
114 Button.SetText (17162)
115 Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, OpenVideoOptionsWindow)
117 # Audio Options
118 Button = Window.GetControl (8)
119 Button.SetText (17164)
120 Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, OpenAudioOptionsWindow)
122 # Gameplay Options
123 Button = Window.GetControl (9)
124 Button.SetText (17165)
125 Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, OpenGameplayOptionsWindow)
127 # game version, e.g. v1.1.0000
128 Label = Window.GetControl (0x1000000b)
129 Label.SetText (GEMRB_VERSION)
131 OptionsWindow.SetVisible (WINDOW_VISIBLE)
132 Window.SetVisible (WINDOW_VISIBLE)
133 PortraitWindow.SetVisible (WINDOW_VISIBLE)
134 return
136 ###################################################
138 def CloseVideoOptionsWindow ():
139 OpenOptionsWindow ()
140 OpenOptionsWindow ()
142 def OpenVideoOptionsWindow ():
143 """Open video options window"""
144 global GameOptionsWindow, HelpTextArea
146 if GameOptionsWindow:
147 if GameOptionsWindow:
148 GameOptionsWindow.Unload ()
149 GameOptionsWindow = None
151 GameOptionsWindow = Window = GemRB.LoadWindow (6)
153 HelpTextArea = OptHelpText ('VideoOptions', Window, 33, 18038)
155 OptDone ('VideoOptions', Window, 21)
156 OptCancel ('VideoOptions', Window, 32)
158 OptSlider ('Brightness', Window, 3, 'Brightness Correction', 4)
159 OptSlider ('Contrast', Window, 22, 'Gamma Correction', 1)
161 OptRadio ('BPP', Window, 5, 37, 'BitsPerPixel', 16)
162 OptRadio ('BPP', Window, 6, 37, 'BitsPerPixel', 24)
163 OptRadio ('BPP', Window, 7, 37, 'BitsPerPixel', 32)
164 OptCheckbox ('FullScreen', Window, 9, 38, 'Full Screen', 1)
166 OptCheckbox ('TransShadow', Window, 51, 50, 'Translucent Shadows', 1)
167 OptCheckbox ('SoftMirrBlt', Window, 40, 44, 'SoftMirrorBlt' ,1)
168 OptCheckbox ('SoftTransBlt', Window, 41, 46, 'SoftSrcKeyBlt' ,1)
169 OptCheckbox ('SoftStandBlt', Window, 42, 48, 'SoftBltFast' ,1)
171 GameOptionsWindow.ShowModal (MODAL_SHADOW_GRAY)
172 return
174 def DisplayHelpFullScreen ():
175 HelpTextArea.SetText (18000)
176 GemRB.SetFullScreen (GemRB.GetVar("Full Screen"))
178 def DisplayHelpBPP ():
179 HelpTextArea.SetText (17205)
181 def DisplayHelpBrightness ():
182 HelpTextArea.SetText (17203)
183 GemRB.SetGamma (GemRB.GetVar("Brightness Correction"),GemRB.GetVar("Gamma Correction"))
185 def DisplayHelpContrast ():
186 HelpTextArea.SetText (17204)
187 GemRB.SetGamma (GemRB.GetVar("Brightness Correction"),GemRB.GetVar("Gamma Correction"))
189 def DisplayHelpSoftMirrBlt ():
190 HelpTextArea.SetText (18004)
192 def DisplayHelpSoftTransBlt ():
193 HelpTextArea.SetText (18006)
195 def DisplayHelpSoftStandBlt ():
196 HelpTextArea.SetText (18007)
198 def DisplayHelpTransShadow ():
199 HelpTextArea.SetText (20620)
202 ###################################################
204 def CloseAudioOptionsWindow ():
205 OpenOptionsWindow ()
206 OpenOptionsWindow ()
208 def OpenAudioOptionsWindow ():
209 """Open audio options window"""
210 global GameOptionsWindow, HelpTextArea
212 if GameOptionsWindow:
213 if GameOptionsWindow:
214 GameOptionsWindow.Unload ()
215 GameOptionsWindow = None
217 GameOptionsWindow = Window = GemRB.LoadWindow (7)
219 HelpTextArea = OptHelpText ('AudioOptions', Window, 14, 18040)
221 OptDone ('AudioOptions', Window, 24)
222 OptCancel ('AudioOptions', Window, 25)
223 OptButton ('CharacterSounds', Window, 13, 17778)
225 OptSlider ('AmbientVolume', Window, 1, 'Volume Ambients', 10)
226 OptSlider ('SoundFXVolume', Window, 2, 'Volume SFX', 10)
227 OptSlider ('VoiceVolume', Window, 3, 'Volume Voices', 10)
228 OptSlider ('MusicVolume', Window, 4, 'Volume Music', 10)
229 OptSlider ('MovieVolume', Window, 22, 'Volume Movie', 10)
231 OptCheckbox ('CreativeEAX', Window, 26, 28, 'Environmental Audio', 1)
232 GameOptionsWindow.ShowModal (MODAL_SHADOW_GRAY)
235 def DisplayHelpAmbientVolume ():
236 HelpTextArea.SetText (18008)
237 GemRB.UpdateAmbientsVolume()
239 def DisplayHelpSoundFXVolume ():
240 HelpTextArea.SetText (18009)
242 def DisplayHelpVoiceVolume ():
243 HelpTextArea.SetText (18010)
245 def DisplayHelpMusicVolume ():
246 HelpTextArea.SetText (18011)
247 GemRB.UpdateMusicVolume()
249 def DisplayHelpMovieVolume ():
250 HelpTextArea.SetText (18012)
252 def DisplayHelpCreativeEAX ():
253 HelpTextArea.SetText (18022)
256 ###################################################
258 def CloseGameplayOptionsWindow ():
259 OpenOptionsWindow ()
260 OpenOptionsWindow ()
262 def OpenGameplayOptionsWindow ():
263 """Open gameplay options window"""
264 global GameOptionsWindow, HelpTextArea
266 if GameOptionsWindow:
267 if GameOptionsWindow:
268 GameOptionsWindow.Unload ()
269 GameOptionsWindow = None
271 #gameplayoptions
272 GameOptionsWindow = Window = GemRB.LoadWindow (8)
275 HelpTextArea = OptHelpText ('GameplayOptions', Window, 40, 18042)
277 OptDone ('GameplayOptions', Window, 7)
278 OptCancel ('GameplayOptions', Window, 20)
280 OptSlider ('TooltipDelay', Window, 1, 'Tooltips', TOOLTIP_DELAY_FACTOR)
281 OptSlider ('MouseScrollingSpeed', Window, 2, 'Mouse Scroll Speed', 5)
282 OptSlider ('KeyboardScrollingSpeed', Window, 3, 'Keyboard Scroll Speed', 5)
283 OptSlider ('Difficulty', Window, 12, 'Difficulty Level', 0)
285 OptCheckbox ('DitherAlways', Window, 14, 25, 'Always Dither', 1)
286 OptCheckbox ('Gore', Window, 19, 27, 'Gore', 1)
287 OptCheckbox ('Infravision', Window, 42, 44, 'Infravision', 1)
288 OptCheckbox ('Weather', Window, 47, 46, 'Weather', 1)
289 OptCheckbox ('RestUntilHealed', Window, 50, 48, 'Heal Party on Rest', 1)
291 OptButton ('FeedbackOptions', Window, 5, 17163)
292 OptButton ('AutopauseOptions', Window, 6, 17166)
293 OptButton ('HotkeyOptions', Window, 51, 816)
295 GameOptionsWindow.ShowModal (MODAL_SHADOW_GRAY)
296 return
298 def DisplayHelpTooltipDelay ():
299 HelpTextArea.SetText (18017)
300 GemRB.SetTooltipDelay (GemRB.GetVar ("Tooltips") )
302 def DisplayHelpMouseScrollingSpeed ():
303 HelpTextArea.SetText (18018)
304 GemRB.SetMouseScrollSpeed (GemRB.GetVar ("Mouse Scroll Speed") )
306 def DisplayHelpKeyboardScrollingSpeed ():
307 HelpTextArea.SetText (18019)
309 def DisplayHelpDifficulty ():
310 HelpTextArea.SetText (18020)
312 def DisplayHelpDitherAlways ():
313 HelpTextArea.SetText (18021)
315 def DisplayHelpGore ():
316 HelpTextArea.SetText (18023)
318 def DisplayHelpInfravision ():
319 HelpTextArea.SetText (11797)
321 def DisplayHelpWeather ():
322 HelpTextArea.SetText (20619)
324 def DisplayHelpRestUntilHealed ():
325 HelpTextArea.SetText (2242)
327 ###################################################
329 def CloseFeedbackOptionsWindow ():
330 global GameOptionsWindow
332 if GameOptionsWindow:
333 GameOptionsWindow.Unload ()
334 GameOptionsWindow = None
335 OpenGameplayOptionsWindow ()
338 def OpenFeedbackOptionsWindow ():
339 """Open feedback options window"""
340 global GameOptionsWindow, HelpTextArea
342 if GameOptionsWindow:
343 if GameOptionsWindow:
344 GameOptionsWindow.Unload ()
345 GameOptionsWindow = None
347 #feedback
348 GameOptionsWindow = Window = GemRB.LoadWindow (9)
350 HelpTextArea = OptHelpText ('FeedbackOptions', Window, 28, 18043)
352 OptDone ('FeedbackOptions', Window, 26)
353 OptCancel ('FeedbackOptions', Window, 27)
355 OptSlider ('MarkerFeedback', Window, 8, 'GUI Feedback Level', 1)
356 OptSlider ('LocatorFeedback', Window, 9, 'Locator Feedback Level', 1)
358 OptCheckbox ('ToHitRolls', Window, 10, 32, 'Rolls', 1)
359 OptCheckbox ('CombatInfo', Window, 11, 33, 'Combat Info', 1)
360 OptCheckbox ('Actions', Window, 12, 34, 'Actions', 1)
361 OptCheckbox ('States', Window, 13, 35, 'State Changes', 1)
362 OptCheckbox ('Selection', Window, 14, 36, 'Selection Text', 1)
363 OptCheckbox ('Miscellaneous', Window, 15, 37, 'Miscellaneous Text', 1)
365 Window.ShowModal (MODAL_SHADOW_GRAY)
366 return
368 def DisplayHelpMarkerFeedback ():
369 HelpTextArea.SetText (18024)
371 def DisplayHelpLocatorFeedback ():
372 HelpTextArea.SetText (18025)
374 def DisplayHelpToHitRolls ():
375 HelpTextArea.SetText (18026)
377 def DisplayHelpCombatInfo ():
378 HelpTextArea.SetText (18027)
380 def DisplayHelpActions ():
381 HelpTextArea.SetText (18028)
383 def DisplayHelpStates ():
384 HelpTextArea.SetText (18029)
386 def DisplayHelpSelection ():
387 HelpTextArea.SetText (18030)
389 def DisplayHelpMiscellaneous ():
390 HelpTextArea.SetText (18031)
393 ###################################################
395 def CloseAutopauseOptionsWindow ():
396 global GameOptionsWindow
398 if GameOptionsWindow:
399 GameOptionsWindow.Unload ()
400 GameOptionsWindow = None
401 OpenGameplayOptionsWindow ()
402 return
404 def OpenAutopauseOptionsWindow ():
405 """Open autopause options window"""
406 global GameOptionsWindow, HelpTextArea
408 if GameOptionsWindow:
409 if GameOptionsWindow:
410 GameOptionsWindow.Unload ()
411 GameOptionsWindow = None
413 GameOptionsWindow = Window = GemRB.LoadWindow (10)
415 HelpTextArea = OptHelpText ('AutopauseOptions', Window, 15, 18044)
417 OptDone ('AutopauseOptions', Window, 11)
418 OptCancel ('AutopauseOptions', Window, 14)
420 OptCheckbox ('CharacterHit', Window, 1, 17, 'Auto Pause State', 1)
421 OptCheckbox ('CharacterInjured', Window, 2, 18, 'Auto Pause State', 2)
422 OptCheckbox ('CharacterDead', Window, 3, 19, 'Auto Pause State', 4)
423 OptCheckbox ('CharacterAttacked', Window, 4, 20, 'Auto Pause State', 8)
424 OptCheckbox ('WeaponUnusable', Window, 5, 21, 'Auto Pause State', 16)
425 OptCheckbox ('TargetGone', Window, 13, 22, 'Auto Pause State', 32)
426 OptCheckbox ('EndOfRound', Window, 25, 24, 'Auto Pause State', 64)
427 OptCheckbox ('EnemySighted', Window, 26, 27, 'Auto Pause State', 128)
428 OptCheckbox ('SpellCast', Window, 34, 30, 'Auto Pause State', 256)
429 OptCheckbox ('TrapFound', Window, 31, 33, 'Auto Pause State', 512)
430 OptCheckbox ('CenterOnActor', Window, 31, 33, 'Auto Pause Center', 1)
432 Window.ShowModal (MODAL_SHADOW_GRAY)
433 return
435 def DisplayHelpCharacterHit ():
436 HelpTextArea.SetText (18032)
438 def DisplayHelpCharacterInjured ():
439 HelpTextArea.SetText (18033)
441 def DisplayHelpCharacterDead ():
442 HelpTextArea.SetText (18034)
444 def DisplayHelpCharacterAttacked ():
445 HelpTextArea.SetText (18035)
447 def DisplayHelpWeaponUnusable ():
448 HelpTextArea.SetText (18036)
450 def DisplayHelpTargetGone ():
451 HelpTextArea.SetText (18037)
453 def DisplayHelpEndOfRound ():
454 HelpTextArea.SetText (10640)
456 def DisplayHelpEnemySighted ():
457 HelpTextArea.SetText (23514)
459 def DisplayHelpSpellCast ():
460 HelpTextArea.SetText (58171)
462 def DisplayHelpTrapFound ():
463 HelpTextArea.SetText (31872)
465 def DisplayHelpCenterOnActor ():
466 HelpTextArea.SetText (10571)
468 ###################################################
470 def CloseCharacterSoundsWindow ():
471 global GameOptionsWindow
473 if GameOptionsWindow:
474 GameOptionsWindow.Unload ()
475 GameOptionsWindow = None
476 OpenGameplayOptionsWindow ()
477 return
479 def OpenCharacterSoundsWindow ():
480 """Open character sounds window"""
481 global GameOptionsWindow, HelpTextArea
483 if GameOptionsWindow:
484 if GameOptionsWindow:
485 GameOptionsWindow.Unload ()
486 GameOptionsWindow = None
488 GameOptionsWindow = Window = GemRB.LoadWindow (12)
490 HelpTextArea = OptHelpText ('CharacterSounds', Window, 16, 18041)
492 OptDone ('CharacterSounds', Window, 24)
493 OptCancel ('CharacterSounds', Window, 25)
495 OptCheckbox ('Subtitles', Window, 5, 20, 'Subtitles', 1)
496 OptCheckbox ('AttackSounds', Window, 6, 18, 'Attack Sounds', 1)
497 OptCheckbox ('Footsteps', Window, 7, 19, 'Footsteps', 1)
498 OptRadio ('CommandSounds', Window, 8, 21, 'Command Sounds Frequency', 1)
499 OptRadio ('CommandSounds', Window, 9, 21, 'Command Sounds Frequency', 2)
500 OptRadio ('CommandSounds', Window, 10, 21, 'Command Sounds Frequency', 3)
501 OptRadio ('SelectionSounds', Window, 58, 57, 'Selection Sounds Frequency', 1)
502 OptRadio ('SelectionSounds', Window, 59, 57, 'Selection Sounds Frequency', 2)
503 OptRadio ('SelectionSounds', Window, 60, 57, 'Selection Sounds Frequency', 3)
505 Window.ShowModal (MODAL_SHADOW_GRAY)
507 def DisplayHelpSubtitles ():
508 HelpTextArea.SetText (18015)
510 def DisplayHelpAttackSounds ():
511 HelpTextArea.SetText (18013)
513 def DisplayHelpFootsteps ():
514 HelpTextArea.SetText (18014)
516 def DisplayHelpCommandSounds ():
517 HelpTextArea.SetText (18016)
519 def DisplayHelpSelectionSounds ():
520 HelpTextArea.SetText (11352)
522 ###################################################
524 def OpenSaveMsgWindow ():
525 GemRB.SetVar("QuitAfterSave",0)
526 GUISAVE.OpenSaveWindow ()
527 #save the game without quitting
528 return
530 ###################################################
532 def OpenLoadMsgWindow ():
533 global LoadMsgWindow
535 if LoadMsgWindow:
536 return
538 LoadMsgWindow = Window = GemRB.LoadWindow (4)
540 # Load
541 Button = Window.GetControl (0)
542 Button.SetText (15590)
543 Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, LoadGamePress)
545 # Cancel
546 Button = Window.GetControl (1)
547 Button.SetText (13727)
548 Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, CloseLoadMsgWindow)
550 # Loading a game will destroy ...
551 Text = Window.GetControl (3)
552 Text.SetText (19531)
554 Window.ShowModal (MODAL_SHADOW_GRAY)
555 return
557 def CloseLoadMsgWindow ():
558 global LoadMsgWindow
560 if LoadMsgWindow:
561 LoadMsgWindow.Unload ()
562 LoadMsgWindow = None
563 OptionsWindow.SetVisible (WINDOW_VISIBLE)
564 GameOptionsWindow.SetVisible (WINDOW_VISIBLE)
565 PortraitWindow.SetVisible (WINDOW_VISIBLE)
566 return
568 def LoadGamePress ():
569 global LoadMsgWindow
571 if LoadMsgWindow:
572 LoadMsgWindow.Unload ()
573 LoadMsgWindow = None
574 GemRB.QuitGame ()
575 OpenOptionsWindow()
576 GemRB.SetNextScript ("GUILOAD")
577 return
579 #save game AND quit
580 def SaveGamePress ():
581 global QuitMsgWindow
583 if QuitMsgWindow:
584 QuitMsgWindow.Unload ()
585 QuitMsgWindow = None
586 #we need to set a state: quit after save
587 GemRB.SetVar("QuitAfterSave",1)
588 OpenOptionsWindow()
589 GUISAVE.OpenSaveWindow ()
590 return
592 def QuitGamePress ():
593 global QuitMsgWindow
595 if QuitMsgWindow:
596 QuitMsgWindow.Unload ()
597 QuitMsgWindow = None
598 GemRB.QuitGame ()
599 OpenOptionsWindow()
600 GemRB.SetNextScript ("Start")
601 return
603 ###################################################
605 def OpenQuitMsgWindow ():
606 global QuitMsgWindow
608 if QuitMsgWindow:
609 return
611 QuitMsgWindow = Window = GemRB.LoadWindow (5)
613 # Save
614 Button = Window.GetControl (0)
615 Button.SetText (15589)
616 Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, SaveGamePress)
618 # Quit Game
619 Button = Window.GetControl (1)
620 Button.SetText (15417)
621 Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, QuitGamePress)
623 # Cancel
624 Button = Window.GetControl (2)
625 Button.SetText (13727)
626 Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, CloseQuitMsgWindow)
628 # The game has not been saved ....
629 Text = Window.GetControl (3)
630 Text.SetText (16456)
632 Window.ShowModal (MODAL_SHADOW_GRAY)
633 return
635 def CloseQuitMsgWindow ():
636 global QuitMsgWindow
638 if QuitMsgWindow:
639 QuitMsgWindow.Unload ()
640 QuitMsgWindow = None
641 OptionsWindow.SetVisible (WINDOW_VISIBLE)
642 GameOptionsWindow.SetVisible (WINDOW_VISIBLE)
643 PortraitWindow.SetVisible (WINDOW_VISIBLE)
644 return
646 ###################################################
647 #TODO
648 def OpenHotkeyOptionsWindow ():
649 return
651 def CloseotkeyOptionsWindow ():
652 return
654 ###################################################
655 ###################################################
657 # These functions help to setup controls found
658 # in Video, Audio, Gameplay, Feedback and Autopause
659 # options windows
661 # These controls are usually made from an active
662 # control (button, slider ...) and a label
665 def OptSlider (name, window, slider_id, variable, value):
666 """Standard slider for option windows"""
667 slider = window.GetControl (slider_id)
668 slider.SetVarAssoc (variable, value)
669 slider.SetEvent (IE_GUI_SLIDER_ON_CHANGE, eval("DisplayHelp" + name))
670 return slider
672 def OptRadio (name, window, button_id, label_id, variable, value):
673 """Standard radio button for option windows"""
675 button = window.GetControl (button_id)
676 button.SetFlags (IE_GUI_BUTTON_RADIOBUTTON, OP_OR)
677 button.SetEvent (IE_GUI_BUTTON_ON_PRESS, eval("DisplayHelp" + name))
678 button.SetVarAssoc (variable, value)
680 label = window.GetControl (label_id)
681 label.SetFlags (IE_GUI_BUTTON_NO_IMAGE, OP_SET)
682 label.SetState (IE_GUI_BUTTON_LOCKED)
684 return button
686 def OptCheckbox (name, window, button_id, label_id, variable, value):
687 """Standard checkbox for option windows"""
689 button = window.GetControl (button_id)
690 button.SetFlags (IE_GUI_BUTTON_CHECKBOX, OP_OR)
691 button.SetEvent (IE_GUI_BUTTON_ON_PRESS, eval("DisplayHelp" + name))
692 button.SetVarAssoc (variable, value)
694 label = window.GetControl (label_id)
695 label.SetFlags (IE_GUI_BUTTON_NO_IMAGE, OP_SET)
696 label.SetState (IE_GUI_BUTTON_LOCKED)
698 return button
700 def OptButton (name, window, button_id, label_strref):
701 """Standard subwindow button for option windows"""
702 button = window.GetControl (button_id)
703 button.SetEvent (IE_GUI_BUTTON_ON_PRESS, eval("Open%sWindow" %name))
704 button.SetText (label_strref)
706 def OptDone (name, window, button_id):
707 """Standard `Done' button for option windows"""
708 button = window.GetControl (button_id)
709 button.SetText (11973) # Done
710 button.SetEvent (IE_GUI_BUTTON_ON_PRESS, eval("Close%sWindow" %name))
711 button.SetFlags (IE_GUI_BUTTON_DEFAULT, OP_OR)
713 def OptCancel (name, window, button_id):
714 """Standard `Cancel' button for option windows"""
715 button = window.GetControl (button_id)
716 button.SetText (13727) # Cancel
717 button.SetEvent (IE_GUI_BUTTON_ON_PRESS, eval("Close%sWindow" %name))
718 button.SetFlags (IE_GUI_BUTTON_CANCEL, OP_OR)
720 def OptHelpText (name, window, text_id, text_strref):
721 """Standard textarea with context help for option windows"""
722 text = window.GetControl (text_id)
723 text.SetText (text_strref)
724 return text
726 ###################################################
727 # End of file GUIOPT.py