TickHook: Fix crash when TickHook isn't set.
[gemrb.git] / gemrb / GUIScripts / bg2 / GUIOPT6.py
blobfcd090d5ae59399697fe0e076336ff12ef49ff9e
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 #graphics options
20 import GemRB
22 GraphicsWindow = 0
23 TextAreaControl = 0
25 def OnLoad():
26 global GraphicsWindow, TextAreaControl
27 GemRB.LoadWindowPack("GUIOPT", 640, 480)
28 GraphicsWindow = GemRB.LoadWindow(6)
29 TextAreaControl = GraphicsWindow.GetControl(33)
30 BrightnessButton = GraphicsWindow.GetControl(35)
31 BrightnessSlider = GraphicsWindow.GetControl(3)
32 BrightnessSlider.SetVarAssoc("Brightness Correction",4)
34 ContrastButton = GraphicsWindow.GetControl(36)
35 ContrastSlider = GraphicsWindow.GetControl(22)
36 ContrastSlider.SetVarAssoc("Gamma Correction",1)
38 BppButton = GraphicsWindow.GetControl(37)
39 BppButtonB1 = GraphicsWindow.GetControl(5)
40 BppButtonB2 = GraphicsWindow.GetControl(6)
41 BppButtonB3 = GraphicsWindow.GetControl(7)
42 BppButtonB1.SetFlags(IE_GUI_BUTTON_RADIOBUTTON,OP_OR)
43 BppButtonB2.SetFlags(IE_GUI_BUTTON_RADIOBUTTON,OP_OR)
44 BppButtonB3.SetFlags(IE_GUI_BUTTON_RADIOBUTTON,OP_OR)
45 BppButtonB1.SetVarAssoc("BitsPerPixel",16)
46 BppButtonB2.SetVarAssoc("BitsPerPixel",24)
47 BppButtonB3.SetVarAssoc("BitsPerPixel",32)
49 FullScreenButton = GraphicsWindow.GetControl(38)
50 FullScreenButtonB = GraphicsWindow.GetControl(9)
51 FullScreenButtonB.SetFlags(IE_GUI_BUTTON_CHECKBOX,OP_OR)
52 FullScreenButtonB.SetVarAssoc("Full Screen",1)
54 SoftMirrBltButton = GraphicsWindow.GetControl(44)
55 SoftMirrBltButtonB = GraphicsWindow.GetControl(40)
56 SoftMirrBltButtonB.SetFlags(IE_GUI_BUTTON_CHECKBOX,OP_OR)
57 SoftMirrBltButtonB.SetVarAssoc("SoftMirrorBlt",1)
59 SoftTransBltButton = GraphicsWindow.GetControl(46)
60 SoftTransBltButtonB = GraphicsWindow.GetControl(41)
61 SoftTransBltButtonB.SetFlags(IE_GUI_BUTTON_CHECKBOX,OP_OR)
62 SoftTransBltButtonB.SetVarAssoc("SoftSrcKeyBlt",1)
64 SoftStandBltButton = GraphicsWindow.GetControl(48)
65 SoftStandBltButtonB = GraphicsWindow.GetControl(42)
66 SoftStandBltButtonB.SetFlags(IE_GUI_BUTTON_CHECKBOX,OP_OR)
67 SoftStandBltButtonB.SetVarAssoc("SoftBltFast",1)
69 TransShadowButton = GraphicsWindow.GetControl(50)
70 TransShadowButtonB = GraphicsWindow.GetControl(51)
71 TransShadowButtonB.SetFlags(IE_GUI_BUTTON_CHECKBOX,OP_OR)
72 TransShadowButtonB.SetVarAssoc("Translucent Shadows",1)
74 OkButton = GraphicsWindow.GetControl(21)
75 CancelButton = GraphicsWindow.GetControl(32)
76 TextAreaControl.SetText(18038)
77 OkButton.SetText(11973)
78 CancelButton.SetText(13727)
79 BrightnessButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, BrightnessPress)
80 BrightnessSlider.SetEvent(IE_GUI_SLIDER_ON_CHANGE, BrightnessPress)
81 ContrastButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, ContrastPress)
82 ContrastSlider.SetEvent(IE_GUI_SLIDER_ON_CHANGE, ContrastPress)
83 BppButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, BppPress)
84 BppButtonB1.SetEvent(IE_GUI_BUTTON_ON_PRESS, BppPress)
85 BppButtonB2.SetEvent(IE_GUI_BUTTON_ON_PRESS, BppPress)
86 BppButtonB3.SetEvent(IE_GUI_BUTTON_ON_PRESS, BppPress)
87 FullScreenButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, FullScreenPress)
88 FullScreenButtonB.SetEvent(IE_GUI_BUTTON_ON_PRESS, FullScreenPress)
89 TransShadowButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, TransShadowPress)
90 TransShadowButtonB.SetEvent(IE_GUI_BUTTON_ON_PRESS, TransShadowPress)
91 SoftMirrBltButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, SoftMirrBltPress)
92 SoftMirrBltButtonB.SetEvent(IE_GUI_BUTTON_ON_PRESS, SoftMirrBltPress)
93 SoftTransBltButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, SoftTransBltPress)
94 SoftTransBltButtonB.SetEvent(IE_GUI_BUTTON_ON_PRESS, SoftTransBltPress)
95 SoftStandBltButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, SoftStandBltPress)
96 SoftStandBltButtonB.SetEvent(IE_GUI_BUTTON_ON_PRESS, SoftStandBltPress)
97 OkButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, OkPress)
98 OkButton.SetFlags (IE_GUI_BUTTON_DEFAULT, OP_OR)
99 CancelButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, CancelPress)
100 CancelButton.SetFlags (IE_GUI_BUTTON_CANCEL, OP_OR)
101 GraphicsWindow.ShowModal()
102 return
104 def BrightnessPress():
105 TextAreaControl.SetText(17203)
106 GemRB.SetGamma (GemRB.GetVar("Brightness Correction"),GemRB.GetVar("Gamma Correction"))
107 return
109 def ContrastPress():
110 TextAreaControl.SetText(17204)
111 GemRB.SetGamma (GemRB.GetVar("Brightness Correction"),GemRB.GetVar("Gamma Correction"))
112 return
114 def BppPress():
115 TextAreaControl.SetText(17205)
116 return
118 def FullScreenPress():
119 TextAreaControl.SetText(18000)
120 GemRB.SetFullScreen (GemRB.GetVar("Full Screen"))
121 return
123 def TransShadowPress():
124 TextAreaControl.SetText(20620)
125 return
127 def SoftMirrBltPress():
128 TextAreaControl.SetText(18004)
129 return
131 def SoftTransBltPress():
132 TextAreaControl.SetText(18006)
133 return
135 def SoftStandBltPress():
136 TextAreaControl.SetText(18007)
137 return
139 def OkPress():
140 if GraphicsWindow:
141 GraphicsWindow.Unload()
142 GemRB.SetNextScript("StartOpt")
143 return
145 def CancelPress():
146 if GraphicsWindow:
147 GraphicsWindow.Unload()
148 GemRB.SetNextScript("StartOpt")
149 return