Mercurial > mplayer.hg
annotate gui/win32/preferences.c @ 36815:4c44fdd14655
Fix issue with Win32 GUI default preferences.
Don't (mis)use option variables to set defaults (and then don't use
them when actually setting the defaults in the preferences dialog).
Set them directly (and correctly) instead, and use proper symbolic
constants.
author | ib |
---|---|
date | Sun, 23 Feb 2014 19:33:46 +0000 |
parents | a5550a57a6cb |
children | 790318d7ce23 |
rev | line source |
---|---|
23077 | 1 /* |
23079 | 2 * MPlayer GUI for Win32 |
3 * Copyright (C) 2003 Sascha Sommer <saschasommer@freenet.de> | |
4 * Copyright (C) 2006 Erik Augustson <erik_27can@yahoo.com> | |
5 * Copyright (C) 2006 Gianluigi Tiesi <sherpya@netfarm.it> | |
6 * | |
7 * This file is part of MPlayer. | |
8 * | |
9 * MPlayer is free software; you can redistribute it and/or modify | |
10 * it under the terms of the GNU General Public License as published by | |
11 * the Free Software Foundation; either version 2 of the License, or | |
12 * (at your option) any later version. | |
13 * | |
14 * MPlayer is distributed in the hope that it will be useful, | |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 * GNU General Public License for more details. | |
18 * | |
26457 | 19 * You should have received a copy of the GNU General Public License along |
20 * with MPlayer; if not, write to the Free Software Foundation, Inc., | |
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
23079 | 22 */ |
23077 | 23 |
24 #include <windows.h> | |
25 #include <commctrl.h> | |
26 #include <stdio.h> | |
27 #include <stdlib.h> | |
28 #include <string.h> | |
23091
52488bb09d90
Consistently use quotes instead of angled brackets in #include
diego
parents:
23079
diff
changeset
|
29 |
52488bb09d90
Consistently use quotes instead of angled brackets in #include
diego
parents:
23079
diff
changeset
|
30 #include "libvo/video_out.h" |
52488bb09d90
Consistently use quotes instead of angled brackets in #include
diego
parents:
23079
diff
changeset
|
31 #include "libao2/audio_out.h" |
32068
ab6ac5b156ca
Replace proc_priority extern declaration by osdep/priority.h #include.
diego
parents:
30558
diff
changeset
|
32 #include "osdep/priority.h" |
23091
52488bb09d90
Consistently use quotes instead of angled brackets in #include
diego
parents:
23079
diff
changeset
|
33 #include "mixer.h" |
33761 | 34 #include "gui/util/list.h" |
35528 | 35 #include "gui/ui/ui.h" |
26372
76413880bfad
Update include paths to account for build system changes.
diego
parents:
26193
diff
changeset
|
36 #include "gui/interface.h" |
23077 | 37 #include "gui.h" |
38 #include "mp_msg.h" | |
39 #include "help_mp.h" | |
40 #include "dialogs.h" | |
41 | |
33619
35a12ef532de
win32 gui: Move static function around to avoid a forward declaration.
diego
parents:
33614
diff
changeset
|
42 |
23077 | 43 static LRESULT CALLBACK PrefsWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam) |
44 { | |
34390
9082a0976655
Remove options cdrom_device and dvd_device from the Win32 GUI.
ib
parents:
34164
diff
changeset
|
45 HWND btn, label, edit1, edit2, updown1, updown2, track1, track2; |
23077 | 46 static HWND vo_driver, ao_driver, prio; |
47 int i = 0, j = 0; | |
48 char procprio[11]; | |
49 float x = 10.0, y = 100.0, stereopos, delaypos; | |
50 stereopos = gtkAOExtraStereoMul * x; | |
51 delaypos = audio_delay * y; | |
52 | |
53 switch (iMsg) | |
54 { | |
55 case WM_CREATE: | |
56 { | |
57 /* video and audio drivers */ | |
36694 | 58 label = CreateWindow("static", acp(MSGTR_GUI_Video), |
34164
d57ed389b6e2
Resize the Win32 GUI preference window and reposition items.
ib
parents:
34163
diff
changeset
|
59 WS_CHILD | WS_VISIBLE | SS_RIGHT, |
d57ed389b6e2
Resize the Win32 GUI preference window and reposition items.
ib
parents:
34163
diff
changeset
|
60 10, 14, 60, 15, hwnd, |
23077 | 61 NULL, ((LPCREATESTRUCT) lParam) -> hInstance, |
62 NULL); | |
63 SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
64 | |
36694 | 65 label = CreateWindow("static", acp(MSGTR_GUI_Audio), |
34164
d57ed389b6e2
Resize the Win32 GUI preference window and reposition items.
ib
parents:
34163
diff
changeset
|
66 WS_CHILD | WS_VISIBLE | SS_RIGHT, |
d57ed389b6e2
Resize the Win32 GUI preference window and reposition items.
ib
parents:
34163
diff
changeset
|
67 205, 14, 60, 15, hwnd, |
23077 | 68 NULL, ((LPCREATESTRUCT) lParam) -> hInstance, |
69 NULL); | |
70 SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
71 | |
36694 | 72 label = CreateWindow("static", acp(MSGTR_GUI_Coefficient":"), |
34164
d57ed389b6e2
Resize the Win32 GUI preference window and reposition items.
ib
parents:
34163
diff
changeset
|
73 WS_CHILD | WS_VISIBLE | SS_RIGHT, |
d57ed389b6e2
Resize the Win32 GUI preference window and reposition items.
ib
parents:
34163
diff
changeset
|
74 10, 148, 140, 15, hwnd, |
23077 | 75 NULL, ((LPCREATESTRUCT) lParam) -> hInstance, |
76 NULL); | |
77 SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
78 | |
36694 | 79 label = CreateWindow("static", acp(MSGTR_GUI_AudioDelay":"), |
34164
d57ed389b6e2
Resize the Win32 GUI preference window and reposition items.
ib
parents:
34163
diff
changeset
|
80 WS_CHILD | WS_VISIBLE | SS_RIGHT, |
d57ed389b6e2
Resize the Win32 GUI preference window and reposition items.
ib
parents:
34163
diff
changeset
|
81 10, 187, 140, 15, hwnd, |
23077 | 82 NULL, ((LPCREATESTRUCT) lParam) -> hInstance, |
83 NULL); | |
84 SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
85 | |
36694 | 86 label = CreateWindow("static", acp(MSGTR_GUI_OsdLevel), |
23077 | 87 WS_CHILD | WS_VISIBLE, |
34087 | 88 10, 286, 115, 15, hwnd, |
23077 | 89 NULL, ((LPCREATESTRUCT) lParam) -> hInstance, |
90 NULL); | |
91 SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
92 | |
36694 | 93 label = CreateWindow("static", acp(MSGTR_GUI_WIN32_Priority), |
34164
d57ed389b6e2
Resize the Win32 GUI preference window and reposition items.
ib
parents:
34163
diff
changeset
|
94 WS_CHILD | WS_VISIBLE | SS_RIGHT, |
d57ed389b6e2
Resize the Win32 GUI preference window and reposition items.
ib
parents:
34163
diff
changeset
|
95 200, 286, 100, 15, hwnd, |
23077 | 96 NULL, ((LPCREATESTRUCT) lParam) -> hInstance, |
97 NULL); | |
98 SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
99 | |
100 vo_driver = CreateWindow("combobox", NULL, | |
101 CBS_DROPDOWNLIST | CB_SHOWDROPDOWN | | |
102 CBS_NOINTEGRALHEIGHT | CBS_HASSTRINGS | | |
103 WS_CHILD | WS_VISIBLE | | |
104 WS_VSCROLL | WS_TABSTOP, | |
105 80, 10, 100, 160, hwnd, | |
106 (HMENU) ID_VO_DRIVER, | |
107 ((LPCREATESTRUCT) lParam) -> hInstance, | |
108 NULL); | |
109 | |
110 ao_driver = CreateWindow("combobox", NULL, | |
111 CBS_DROPDOWNLIST | CB_SHOWDROPDOWN | | |
112 CBS_NOINTEGRALHEIGHT | CBS_HASSTRINGS | | |
113 WS_CHILD | WS_VISIBLE | | |
114 WS_VSCROLL | WS_TABSTOP, | |
34164
d57ed389b6e2
Resize the Win32 GUI preference window and reposition items.
ib
parents:
34163
diff
changeset
|
115 275, 10, 100, 160, hwnd, |
23077 | 116 (HMENU) ID_AO_DRIVER, |
117 ((LPCREATESTRUCT) lParam) -> hInstance, | |
118 NULL); | |
119 | |
120 prio = CreateWindow("combobox", NULL, | |
121 CBS_DROPDOWNLIST | CB_SHOWDROPDOWN | | |
122 CBS_NOINTEGRALHEIGHT | CBS_HASSTRINGS | | |
123 WS_CHILD | WS_VISIBLE | | |
124 WS_VSCROLL | WS_TABSTOP, | |
34164
d57ed389b6e2
Resize the Win32 GUI preference window and reposition items.
ib
parents:
34163
diff
changeset
|
125 310, 282, 100, 160, hwnd, |
23077 | 126 (HMENU) ID_PRIO, |
127 ((LPCREATESTRUCT) lParam) -> hInstance, | |
128 NULL); | |
129 | |
130 /* checkboxes */ | |
36694 | 131 btn = CreateWindow("button", acp(MSGTR_GUI_EnableDoubleBuffering), |
23077 | 132 WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, |
36670 | 133 10, 35, 205, 25, |
23077 | 134 hwnd, (HMENU) ID_DOUBLE, |
135 ((LPCREATESTRUCT) lParam) -> hInstance, | |
136 NULL); | |
137 SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
138 | |
36694 | 139 btn = CreateWindow("button", acp(MSGTR_GUI_EnableDirectRendering), |
23077 | 140 WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, |
36670 | 141 10, 57, 205, 25, |
23077 | 142 hwnd, (HMENU) ID_DIRECT, |
143 ((LPCREATESTRUCT) lParam) -> hInstance, | |
144 NULL); | |
145 SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
146 | |
36694 | 147 btn = CreateWindow("button", acp(MSGTR_GUI_EnableFrameDropping), |
23077 | 148 WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, |
36670 | 149 10, 79, 205, 25, |
23077 | 150 hwnd, (HMENU) ID_FRAMEDROP, |
151 ((LPCREATESTRUCT) lParam) -> hInstance, | |
152 NULL); | |
153 SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
154 | |
36694 | 155 btn = CreateWindow("button", acp(MSGTR_GUI_QuitAfterPlaying), |
34087 | 156 WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, |
34164
d57ed389b6e2
Resize the Win32 GUI preference window and reposition items.
ib
parents:
34163
diff
changeset
|
157 10, 101, 225, 25, |
34087 | 158 hwnd, (HMENU) ID_IDLE, |
159 ((LPCREATESTRUCT) lParam) -> hInstance, | |
160 NULL); | |
161 SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
162 | |
36694 | 163 btn = CreateWindow("button", acp(MSGTR_GUI_NormalizeSound), |
23077 | 164 WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, |
36670 | 165 220, 35, 190, 25, |
23077 | 166 hwnd, (HMENU) ID_NORMALIZE, |
167 ((LPCREATESTRUCT) lParam) -> hInstance, | |
168 NULL); | |
169 SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
170 | |
36694 | 171 btn = CreateWindow("button", acp(MSGTR_GUI_EnableSoftwareMixer), |
23077 | 172 WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, |
36670 | 173 220, 57, 190, 25, |
23077 | 174 hwnd, (HMENU) ID_SOFTMIX, |
175 ((LPCREATESTRUCT) lParam) -> hInstance, | |
176 NULL); | |
177 SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
178 | |
36694 | 179 btn = CreateWindow("button", acp(MSGTR_GUI_EnableExtraStereo), |
23077 | 180 WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, |
36670 | 181 220, 79, 190, 25, |
23077 | 182 hwnd, (HMENU) ID_EXTRASTEREO, |
183 ((LPCREATESTRUCT) lParam) -> hInstance, | |
184 NULL); | |
185 SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
186 | |
36694 | 187 btn = CreateWindow("button", acp(MSGTR_GUI_EnableCache), |
23077 | 188 WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, |
36670 | 189 10, 222, 100, 25, |
23077 | 190 hwnd, (HMENU) ID_CACHE, |
191 ((LPCREATESTRUCT) lParam) -> hInstance, | |
192 NULL); | |
193 SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
194 | |
36694 | 195 btn = CreateWindow("button", acp(MSGTR_GUI_EnableAutomaticAVSync), |
23077 | 196 WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, |
36670 | 197 225, 222, 185, 25, hwnd, |
23077 | 198 (HMENU) ID_AUTOSYNC, |
199 ((LPCREATESTRUCT) lParam) -> hInstance, | |
200 NULL); | |
201 SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
202 | |
36694 | 203 btn = CreateWindow("button", acp(MSGTR_GUI_WIN32_DisplayInVideoWindow), |
23077 | 204 WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, |
34164
d57ed389b6e2
Resize the Win32 GUI preference window and reposition items.
ib
parents:
34163
diff
changeset
|
205 10, 249, 250, 25, |
34697 | 206 hwnd, (HMENU) ID_VIDEOWINDOW, |
23077 | 207 ((LPCREATESTRUCT) lParam) -> hInstance, |
208 NULL); | |
209 SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
210 | |
211 /* osd level */ | |
36694 | 212 btn = CreateWindow("button", acp(MSGTR_GUI_OsdLevel0), |
23077 | 213 WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON, |
34164
d57ed389b6e2
Resize the Win32 GUI preference window and reposition items.
ib
parents:
34163
diff
changeset
|
214 15, 297, 200, 25, hwnd, |
23077 | 215 (HMENU) ID_NONE, |
216 ((LPCREATESTRUCT) lParam) -> hInstance, | |
217 NULL); | |
218 SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
219 | |
36694 | 220 btn = CreateWindow("button", acp(MSGTR_GUI_OsdLevel1), |
23077 | 221 WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON, |
34164
d57ed389b6e2
Resize the Win32 GUI preference window and reposition items.
ib
parents:
34163
diff
changeset
|
222 15, 317, 395, 25, hwnd, |
23077 | 223 (HMENU) ID_OSD1, |
224 ((LPCREATESTRUCT) lParam) -> hInstance, | |
225 NULL); | |
226 SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
227 | |
36694 | 228 btn = CreateWindow("button", acp(MSGTR_GUI_OsdLevel2), |
23077 | 229 WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON, |
34164
d57ed389b6e2
Resize the Win32 GUI preference window and reposition items.
ib
parents:
34163
diff
changeset
|
230 15, 337, 395, 25, hwnd, |
23077 | 231 (HMENU) ID_OSD2, |
232 ((LPCREATESTRUCT) lParam) -> hInstance, | |
233 NULL); | |
234 SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
235 | |
36694 | 236 btn = CreateWindow("button", acp(MSGTR_GUI_OsdLevel3), |
23077 | 237 WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON, |
34164
d57ed389b6e2
Resize the Win32 GUI preference window and reposition items.
ib
parents:
34163
diff
changeset
|
238 15, 357, 395, 25, hwnd, |
23077 | 239 (HMENU) ID_OSD3, |
240 ((LPCREATESTRUCT) lParam) -> hInstance, | |
241 NULL); | |
242 SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
243 | |
36694 | 244 btn = CreateWindow("button", acp(MSGTR_GUI_Ok), |
23077 | 245 WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, |
34164
d57ed389b6e2
Resize the Win32 GUI preference window and reposition items.
ib
parents:
34163
diff
changeset
|
246 248, 417, 80, 25, hwnd, |
23077 | 247 (HMENU) ID_APPLY, |
248 ((LPCREATESTRUCT) lParam) -> hInstance, | |
249 NULL); | |
250 SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
251 | |
36694 | 252 btn = CreateWindow("button", acp(MSGTR_GUI_Cancel), |
23077 | 253 WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, |
34164
d57ed389b6e2
Resize the Win32 GUI preference window and reposition items.
ib
parents:
34163
diff
changeset
|
254 334, 417, 80, 25, hwnd, |
23077 | 255 (HMENU) ID_CANCEL, |
256 ((LPCREATESTRUCT) lParam) -> hInstance, | |
257 NULL); | |
258 SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
259 | |
36694 | 260 btn = CreateWindow("button", acp(MSGTR_GUI_WIN32_Defaults), |
23077 | 261 WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, |
34164
d57ed389b6e2
Resize the Win32 GUI preference window and reposition items.
ib
parents:
34163
diff
changeset
|
262 5, 417, 80, 25, hwnd, |
23077 | 263 (HMENU) ID_DEFAULTS, |
264 ((LPCREATESTRUCT) lParam) -> hInstance, | |
265 NULL); | |
266 SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
267 | |
268 /* extra stereo coefficient trackbar */ | |
269 track1 = CreateWindow(TRACKBAR_CLASS, "Coefficient", | |
270 WS_CHILD | WS_VISIBLE | WS_TABSTOP | | |
271 WS_DISABLED | TBS_HORZ | | |
272 TBS_BOTTOM | TBS_NOTICKS, | |
34164
d57ed389b6e2
Resize the Win32 GUI preference window and reposition items.
ib
parents:
34163
diff
changeset
|
273 165, 142, 245, 35, hwnd, |
23077 | 274 (HMENU) ID_TRACKBAR1, |
275 ((LPCREATESTRUCT) lParam) -> hInstance, | |
276 NULL); | |
277 SendDlgItemMessage(hwnd, ID_TRACKBAR1, TBM_SETRANGE, 1, MAKELONG(-100, 100)); | |
278 | |
279 /* audio delay */ | |
280 track2 = CreateWindow(TRACKBAR_CLASS, "Audio delay", | |
281 WS_CHILD | WS_VISIBLE | WS_TABSTOP | | |
282 WS_DISABLED | TBS_HORZ | | |
283 TBS_BOTTOM | TBS_NOTICKS, | |
34164
d57ed389b6e2
Resize the Win32 GUI preference window and reposition items.
ib
parents:
34163
diff
changeset
|
284 165, 182, 245, 35, hwnd, |
23077 | 285 (HMENU) ID_TRACKBAR2, |
286 ((LPCREATESTRUCT) lParam) -> hInstance, | |
287 NULL); | |
288 SendDlgItemMessage(hwnd, ID_TRACKBAR2, TBM_SETRANGE, 1, MAKELONG(-1000, 1000)); | |
289 | |
290 /* cache */ | |
291 edit1 = CreateWindowEx(WS_EX_CLIENTEDGE, "edit", "cache", | |
292 WS_CHILD | WS_VISIBLE | WS_DISABLED | | |
293 ES_LEFT | ES_AUTOHSCROLL, | |
36670 | 294 115, 225, 60, 20, hwnd, |
23077 | 295 (HMENU) ID_EDIT1, |
296 ((LPCREATESTRUCT) lParam) -> hInstance, | |
297 NULL); | |
298 SendMessage(edit1, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
299 | |
300 updown1 = CreateUpDownControl(WS_CHILD | WS_VISIBLE | | |
301 WS_DISABLED | UDS_SETBUDDYINT | | |
302 UDS_ARROWKEYS | UDS_NOTHOUSANDS, | |
34709
b74a8e55c632
Increase width of control for cache size in Win32 GUI.
ib
parents:
34707
diff
changeset
|
303 165, 225, 20, 20, hwnd, |
23077 | 304 ID_UPDOWN1, |
305 ((LPCREATESTRUCT) lParam) -> hInstance, | |
306 (HWND)edit1, 0, 0, 0); | |
34707 | 307 SendDlgItemMessage(hwnd, ID_UPDOWN1, UDM_SETRANGE32, (WPARAM)32, (LPARAM)0x7fffffff); |
23077 | 308 |
309 /* autosync */ | |
310 edit2 = CreateWindowEx(WS_EX_CLIENTEDGE, "edit", "autosync", | |
311 WS_CHILD | WS_VISIBLE | WS_DISABLED | | |
312 ES_LEFT | ES_AUTOHSCROLL, | |
36670 | 313 355, 247, 40, 20, hwnd, |
23077 | 314 (HMENU) ID_EDIT2, |
315 ((LPCREATESTRUCT) lParam) -> hInstance, | |
316 NULL); | |
317 SendMessage(edit2, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
318 | |
319 updown2 = CreateUpDownControl(WS_CHILD | WS_VISIBLE | | |
320 WS_DISABLED | UDS_SETBUDDYINT | | |
321 UDS_ARROWKEYS | UDS_NOTHOUSANDS, | |
36670 | 322 395, 247, 20, 20, hwnd, |
23077 | 323 ID_UPDOWN2, |
324 ((LPCREATESTRUCT) lParam) -> hInstance, | |
325 (HWND)edit2, 0, 0, 0); | |
326 SendDlgItemMessage(hwnd, ID_UPDOWN2, UDM_SETRANGE32, (WPARAM)0, (LPARAM)10000); | |
327 | |
328 while(video_out_drivers[i]) | |
329 { | |
330 const vo_info_t *info = video_out_drivers[i++]->info; | |
34610 | 331 if(!video_driver_list) listSet(&video_driver_list, (char *)info->short_name); |
23077 | 332 SendDlgItemMessage(hwnd, ID_VO_DRIVER, CB_ADDSTRING, 0, (LPARAM) info->short_name); |
333 } | |
334 /* Special case for directx:noaccel */ | |
335 SendDlgItemMessage(hwnd, ID_VO_DRIVER, CB_ADDSTRING, 0, (LPARAM) "directx:noaccel"); | |
336 SendMessage(vo_driver, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
337 | |
338 while(audio_out_drivers[j]) | |
339 { | |
340 const ao_info_t *info = audio_out_drivers[j++]->info; | |
341 if(!audio_driver_list) | |
342 { | |
343 // FIXME: default priority (i.e. order in audio_out_drivers) should be fixed instead | |
344 // if win32 as default is really desirable | |
34610 | 345 listSet(&audio_driver_list, "win32"/*(char *)info->short_name*/); |
23077 | 346 } |
347 SendDlgItemMessage(hwnd, ID_AO_DRIVER, CB_ADDSTRING, 0, (LPARAM) info->short_name); | |
348 } | |
349 SendMessage(ao_driver, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
350 | |
351 /* priority list, i'm leaving out realtime for safety's sake */ | |
36694 | 352 SendDlgItemMessage(hwnd, ID_PRIO, CB_INSERTSTRING, 0, (LPARAM) acp(MSGTR_GUI_WIN32_PriorityLow)); |
353 SendDlgItemMessage(hwnd, ID_PRIO, CB_INSERTSTRING, 0, (LPARAM) acp(MSGTR_GUI_WIN32_PriorityBelowNormal)); | |
354 SendDlgItemMessage(hwnd, ID_PRIO, CB_INSERTSTRING, 0, (LPARAM) acp(MSGTR_GUI_WIN32_PriorityNormal)); | |
355 SendDlgItemMessage(hwnd, ID_PRIO, CB_INSERTSTRING, 0, (LPARAM) acp(MSGTR_GUI_WIN32_PriorityAboveNormal)); | |
356 SendDlgItemMessage(hwnd, ID_PRIO, CB_INSERTSTRING, 0, (LPARAM) acp(MSGTR_GUI_WIN32_PriorityHigh)); | |
23077 | 357 SendMessage(prio, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); |
358 | |
359 /* set our preferences on what we already have */ | |
360 if(video_driver_list) | |
361 SendDlgItemMessage(hwnd, ID_VO_DRIVER, CB_SETCURSEL, | |
362 (WPARAM)SendMessage(vo_driver, CB_FINDSTRING, -1, | |
363 (LPARAM)video_driver_list[0]), 0); | |
364 | |
365 if(audio_driver_list) | |
366 SendDlgItemMessage(hwnd, ID_AO_DRIVER, CB_SETCURSEL, | |
367 (WPARAM)SendMessage(ao_driver, CB_FINDSTRING, -1, | |
368 (LPARAM)audio_driver_list[0]), 0); | |
369 | |
370 if(vo_doublebuffering) | |
371 SendDlgItemMessage(hwnd, ID_DOUBLE, BM_SETCHECK, 1, 0); | |
372 if(vo_directrendering) | |
373 SendDlgItemMessage(hwnd, ID_DIRECT, BM_SETCHECK, 1, 0); | |
34087 | 374 if(!player_idle_mode) |
375 SendDlgItemMessage(hwnd, ID_IDLE, BM_SETCHECK, 1, 0); | |
23077 | 376 if(frame_dropping) |
377 SendDlgItemMessage(hwnd, ID_FRAMEDROP, BM_SETCHECK, 1, 0); | |
378 if(gtkAONorm) | |
379 SendDlgItemMessage(hwnd, ID_NORMALIZE, BM_SETCHECK, 1, 0); | |
380 if(soft_vol) | |
381 SendDlgItemMessage(hwnd, ID_SOFTMIX, BM_SETCHECK, 1, 0); | |
382 if(gtkAOExtraStereo) | |
383 { | |
384 SendDlgItemMessage(hwnd, ID_EXTRASTEREO, BM_SETCHECK, 1, 0); | |
33555 | 385 if(!guiInfo.Playing) |
23077 | 386 { |
387 EnableWindow(track1, 1); | |
388 EnableWindow(track2, 1); | |
389 } | |
390 } | |
391 else gtkAOExtraStereoMul = 1.0; | |
392 SendDlgItemMessage(hwnd, ID_TRACKBAR1, TBM_SETPOS, 1, (LPARAM)stereopos); | |
393 | |
394 if(audio_delay) | |
395 SendDlgItemMessage(hwnd, ID_TRACKBAR2, TBM_SETPOS, 1, (LPARAM)delaypos); | |
396 | |
397 if(gtkCacheOn) { | |
398 SendDlgItemMessage(hwnd, ID_CACHE, BM_SETCHECK, 1, 0); | |
399 EnableWindow(edit1, 1); | |
400 EnableWindow(updown1, 1); | |
401 } | |
402 else gtkCacheSize = 2048; | |
403 SendDlgItemMessage(hwnd, ID_UPDOWN1, UDM_SETPOS32, 0, (LPARAM)gtkCacheSize); | |
404 | |
405 if(gtkAutoSyncOn) { | |
406 SendDlgItemMessage(hwnd, ID_AUTOSYNC, BM_SETCHECK, 1, 0); | |
407 EnableWindow(edit2, 1); | |
408 EnableWindow(updown2, 1); | |
409 } | |
410 else gtkAutoSync = 0; | |
411 SendDlgItemMessage(hwnd, ID_UPDOWN2, UDM_SETPOS32, 0, (LPARAM)gtkAutoSync); | |
412 | |
34697 | 413 if(video_window) |
414 SendDlgItemMessage(hwnd, ID_VIDEOWINDOW, BM_SETCHECK, 1, 0); | |
23077 | 415 |
416 if(!osd_level) | |
417 SendDlgItemMessage(hwnd, ID_NONE, BM_SETCHECK, 1, 0); | |
418 else if(osd_level == 1) | |
419 SendDlgItemMessage(hwnd, ID_OSD1, BM_SETCHECK, 1, 0); | |
420 else if(osd_level == 2) | |
421 SendDlgItemMessage(hwnd, ID_OSD2, BM_SETCHECK, 1, 0); | |
422 else if(osd_level == 3) | |
423 SendDlgItemMessage(hwnd, ID_OSD3, BM_SETCHECK, 1, 0); | |
424 | |
425 if(proc_priority) | |
426 SendDlgItemMessage(hwnd, ID_PRIO, CB_SETCURSEL, | |
427 (WPARAM)SendMessage(prio, CB_FINDSTRING, -1, | |
428 (LPARAM)proc_priority), 0); | |
429 | |
430 else SendDlgItemMessage(hwnd, ID_PRIO, CB_SETCURSEL, 2, 0); | |
431 | |
432 break; | |
433 } | |
434 case WM_CTLCOLORDLG: | |
435 case WM_CTLCOLOREDIT: | |
436 case WM_CTLCOLORBTN: | |
437 case WM_CTLCOLORSTATIC: | |
438 { | |
439 HDC hdc = (HDC)wParam; | |
440 SetBkMode(hdc, TRANSPARENT); | |
441 return (INT_PTR)SOLID_GREY; | |
442 } | |
443 break; | |
444 case WM_COMMAND: | |
445 { | |
446 switch (LOWORD(wParam)) | |
447 { | |
448 case ID_EXTRASTEREO: | |
449 { | |
450 if(SendDlgItemMessage(hwnd, ID_EXTRASTEREO, BM_GETCHECK, 0, 0) == BST_CHECKED) | |
451 { | |
452 EnableWindow(GetDlgItem(hwnd, ID_TRACKBAR1), 1); | |
453 EnableWindow(GetDlgItem(hwnd, ID_TRACKBAR2), 1); | |
454 } else { | |
455 EnableWindow(GetDlgItem(hwnd, ID_TRACKBAR1), 0); | |
456 EnableWindow(GetDlgItem(hwnd, ID_TRACKBAR2), 0); | |
457 SendDlgItemMessage(hwnd, ID_TRACKBAR1, TBM_SETPOS, 1, (LPARAM)10.0); | |
458 SendDlgItemMessage(hwnd, ID_TRACKBAR2, TBM_SETPOS, 1, (LPARAM)0); | |
459 } | |
460 break; | |
461 } | |
462 case ID_CACHE: | |
463 { | |
464 if(SendDlgItemMessage(hwnd, ID_CACHE, BM_GETCHECK, 0, 0) == BST_CHECKED) | |
465 { | |
466 EnableWindow(GetDlgItem(hwnd, ID_EDIT1), 1); | |
467 EnableWindow(GetDlgItem(hwnd, ID_UPDOWN1), 1); | |
468 } else { | |
469 EnableWindow(GetDlgItem(hwnd, ID_EDIT1), 0); | |
470 EnableWindow(GetDlgItem(hwnd, ID_UPDOWN1), 0); | |
471 SendDlgItemMessage(hwnd, ID_UPDOWN1, UDM_SETPOS32, 1, (LPARAM)2048); | |
472 } | |
473 break; | |
474 } | |
475 case ID_AUTOSYNC: | |
476 { | |
477 if(SendDlgItemMessage(hwnd, ID_AUTOSYNC, BM_GETCHECK, 0, 0) == BST_CHECKED) | |
478 { | |
479 EnableWindow(GetDlgItem(hwnd, ID_EDIT2), 1); | |
480 EnableWindow(GetDlgItem(hwnd, ID_UPDOWN2), 1); | |
481 } else { | |
482 EnableWindow(GetDlgItem(hwnd, ID_EDIT2), 0); | |
483 EnableWindow(GetDlgItem(hwnd, ID_UPDOWN2), 0); | |
484 SendDlgItemMessage(hwnd, ID_UPDOWN2, UDM_SETPOS32, 1, (LPARAM)0); | |
485 } | |
486 break; | |
487 } | |
488 case ID_DEFAULTS: | |
489 { | |
490 SendDlgItemMessage(hwnd, ID_VO_DRIVER, CB_SETCURSEL, | |
491 (WPARAM)SendMessage(vo_driver, CB_FINDSTRING, -1, (LPARAM)"directx"), 0); | |
492 | |
493 SendDlgItemMessage(hwnd, ID_AO_DRIVER, CB_SETCURSEL, | |
494 (WPARAM)SendMessage(ao_driver, CB_FINDSTRING, -1, (LPARAM)"dsound"), 0); | |
495 | |
496 SendDlgItemMessage(hwnd, ID_PRIO, CB_SETCURSEL, | |
36815 | 497 (WPARAM)SendMessage(prio, CB_FINDSTRING, -1, (LPARAM)"normal"), 0); |
23077 | 498 |
36815 | 499 SendDlgItemMessage(hwnd, ID_TRACKBAR1, TBM_SETPOS, TRUE, (LPARAM)10.0); |
500 SendDlgItemMessage(hwnd, ID_TRACKBAR2, TBM_SETPOS, TRUE, (LPARAM)0.0); | |
23077 | 501 SendDlgItemMessage(hwnd, ID_UPDOWN1, UDM_SETPOS32, 0, (LPARAM)gtkCacheSize); |
502 SendDlgItemMessage(hwnd, ID_UPDOWN2, UDM_SETPOS32, 0, (LPARAM)gtkAutoSync); | |
36815 | 503 SendDlgItemMessage(hwnd, ID_DOUBLE, BM_SETCHECK, BST_CHECKED, 0); |
504 SendDlgItemMessage(hwnd, ID_DIRECT, BM_SETCHECK, BST_UNCHECKED, 0); | |
505 SendDlgItemMessage(hwnd, ID_IDLE, BM_SETCHECK, BST_UNCHECKED, 0); | |
506 SendDlgItemMessage(hwnd, ID_FRAMEDROP, BM_SETCHECK, BST_UNCHECKED, 0); | |
507 SendDlgItemMessage(hwnd, ID_NORMALIZE, BM_SETCHECK, BST_UNCHECKED, 0); | |
508 SendDlgItemMessage(hwnd, ID_SOFTMIX, BM_SETCHECK, BST_UNCHECKED, 0); | |
509 SendDlgItemMessage(hwnd, ID_EXTRASTEREO, BM_SETCHECK, BST_UNCHECKED, 0); | |
510 SendDlgItemMessage(hwnd, ID_CACHE, BM_SETCHECK, BST_UNCHECKED, 0); | |
511 SendDlgItemMessage(hwnd, ID_AUTOSYNC, BM_SETCHECK, BST_UNCHECKED, 0); | |
512 SendDlgItemMessage(hwnd, ID_VIDEOWINDOW, BM_SETCHECK, BST_CHECKED, 0); | |
513 SendDlgItemMessage(hwnd, ID_NONE, BM_SETCHECK, BST_UNCHECKED, 0); | |
514 SendDlgItemMessage(hwnd, ID_OSD1, BM_SETCHECK, BST_CHECKED, 0); | |
515 SendDlgItemMessage(hwnd, ID_OSD2, BM_SETCHECK, BST_UNCHECKED, 0); | |
516 SendDlgItemMessage(hwnd, ID_OSD3, BM_SETCHECK, BST_UNCHECKED, 0); | |
23077 | 517 SendMessage(hwnd, WM_COMMAND, (WPARAM)ID_APPLY, 0); |
518 break; | |
519 } | |
520 case ID_CANCEL: | |
521 DestroyWindow(hwnd); | |
522 return 0; | |
523 case ID_APPLY: | |
524 { | |
36780 | 525 int idx, strl; |
526 char *driver, *caption; | |
36719 | 527 |
23077 | 528 /* Set the video driver */ |
36780 | 529 idx = SendMessage(vo_driver, CB_GETCURSEL, 0, 0); |
530 strl = SendMessage(vo_driver, CB_GETLBTEXTLEN, (WPARAM)idx, 0); | |
531 driver = malloc(strl + 1); | |
532 SendMessage(vo_driver, CB_GETLBTEXT, (WPARAM)idx, (LPARAM)driver); | |
533 listSet(&video_driver_list, driver); | |
534 free(driver); | |
23077 | 535 |
536 /* Set the audio driver */ | |
36780 | 537 idx = SendMessage(ao_driver, CB_GETCURSEL, 0, 0); |
538 strl = SendMessage(ao_driver, CB_GETLBTEXTLEN, (WPARAM)idx, 0); | |
539 driver = malloc(strl + 1); | |
540 SendMessage(ao_driver, CB_GETLBTEXT, (WPARAM)idx, (LPARAM)driver); | |
541 listSet(&audio_driver_list, driver); | |
542 free(driver); | |
23077 | 543 |
544 /* Set the priority level */ | |
545 SendMessage(prio, CB_GETLBTEXT, (WPARAM)SendMessage(prio, CB_GETCURSEL, 0, 0), (LPARAM)procprio); | |
546 proc_priority = strdup(procprio); | |
547 | |
548 /* double buffering */ | |
549 if(SendDlgItemMessage(hwnd, ID_DOUBLE, BM_GETCHECK, 0, 0) == BST_CHECKED) | |
35501 | 550 vo_doublebuffering = TRUE; |
551 else vo_doublebuffering = FALSE; | |
23077 | 552 |
553 /* direct rendering */ | |
554 if(SendDlgItemMessage(hwnd, ID_DIRECT, BM_GETCHECK, 0, 0) == BST_CHECKED) | |
35501 | 555 vo_directrendering = TRUE; |
556 else vo_directrendering = FALSE; | |
23077 | 557 |
34087 | 558 /* quit after playing */ |
559 if(SendDlgItemMessage(hwnd, ID_IDLE, BM_GETCHECK, 0, 0) == BST_CHECKED) | |
35501 | 560 player_idle_mode = FALSE; |
561 else player_idle_mode = TRUE; | |
34087 | 562 |
23077 | 563 /* frame dropping */ |
564 if(SendDlgItemMessage(hwnd, ID_FRAMEDROP, BM_GETCHECK, 0, 0) == BST_CHECKED) | |
565 frame_dropping = 1; | |
566 else frame_dropping = 0; | |
567 | |
568 /* normalize */ | |
569 if(SendDlgItemMessage(hwnd, ID_NORMALIZE, BM_GETCHECK, 0, 0) == BST_CHECKED) | |
35501 | 570 gtkAONorm = TRUE; |
571 else gtkAONorm = FALSE; | |
23077 | 572 |
573 /* software mixer */ | |
574 if(SendDlgItemMessage(hwnd, ID_SOFTMIX, BM_GETCHECK, 0, 0) == BST_CHECKED) | |
35501 | 575 soft_vol = TRUE; |
576 else soft_vol = FALSE; | |
23077 | 577 |
578 /* extra stereo */ | |
579 if(SendDlgItemMessage(hwnd, ID_EXTRASTEREO, BM_GETCHECK, 0, 0) == BST_CHECKED) | |
35501 | 580 gtkAOExtraStereo = TRUE; |
23077 | 581 else { |
35501 | 582 gtkAOExtraStereo = FALSE; |
23077 | 583 gtkAOExtraStereoMul = 10.0; |
584 } | |
585 gtkAOExtraStereoMul = SendDlgItemMessage(hwnd, ID_TRACKBAR1, TBM_GETPOS, 0, 0) / 10.0; | |
586 | |
587 /* audio delay */ | |
588 audio_delay = SendDlgItemMessage(hwnd, ID_TRACKBAR2, TBM_GETPOS, 0, 0) / 100.0; | |
589 | |
590 /* cache */ | |
591 if(SendDlgItemMessage(hwnd, ID_CACHE, BM_GETCHECK, 0, 0) == BST_CHECKED) | |
35501 | 592 gtkCacheOn = TRUE; |
593 else gtkCacheOn = FALSE; | |
23077 | 594 gtkCacheSize = SendDlgItemMessage(hwnd, ID_UPDOWN1, UDM_GETPOS32, 0, 0); |
595 | |
596 /* autosync */ | |
597 if(SendDlgItemMessage(hwnd, ID_AUTOSYNC, BM_GETCHECK, 0, 0) == BST_CHECKED) | |
35501 | 598 gtkAutoSyncOn = TRUE; |
599 else gtkAutoSyncOn = FALSE; | |
23077 | 600 gtkAutoSync = SendDlgItemMessage(hwnd, ID_UPDOWN2, UDM_GETPOS32, 0, 0); |
601 | |
34697 | 602 /* video window */ |
603 if(SendDlgItemMessage(hwnd, ID_VIDEOWINDOW, BM_GETCHECK, 0, 0) == BST_CHECKED) | |
35501 | 604 video_window = TRUE; |
605 else video_window = FALSE; | |
23077 | 606 |
607 /* osd level */ | |
608 if(SendDlgItemMessage(hwnd, ID_NONE, BM_GETCHECK, 0, 0) == BST_CHECKED) | |
609 osd_level = 0; | |
610 else if(SendDlgItemMessage(hwnd, ID_OSD1, BM_GETCHECK, 0, 0) == BST_CHECKED) | |
611 osd_level = 1; | |
612 else if(SendDlgItemMessage(hwnd, ID_OSD2, BM_GETCHECK, 0, 0) == BST_CHECKED) | |
613 osd_level = 2; | |
614 else if(SendDlgItemMessage(hwnd, ID_OSD3, BM_GETCHECK, 0, 0) == BST_CHECKED) | |
615 osd_level = 3; | |
616 | |
36724 | 617 if (guiInfo.Playing) |
618 { | |
36725 | 619 caption = strdup(acp(MSGTR_GUI_Information)); |
620 MessageBox(hwnd, acp(MSGTR_GUI_MSG_PlaybackNeedsRestart), caption, MB_OK | MB_ICONINFORMATION); | |
621 free(caption); | |
36724 | 622 } |
623 | |
23077 | 624 DestroyWindow(hwnd); |
625 break; | |
626 } | |
627 } | |
628 return 0; | |
629 } | |
630 } | |
631 return DefWindowProc(hwnd, iMsg, wParam, lParam); | |
632 } | |
633 | |
634 void display_prefswindow(gui_t *gui) | |
635 { | |
636 HWND hWnd; | |
637 HINSTANCE hInstance = GetModuleHandle(NULL); | |
638 WNDCLASS wc; | |
639 int x, y; | |
36694 | 640 if(FindWindow(NULL, acp(MSGTR_GUI_Preferences))) return; |
23077 | 641 wc.style = CS_HREDRAW | CS_VREDRAW; |
642 wc.lpfnWndProc = PrefsWndProc; | |
643 wc.cbClsExtra = 0; | |
644 wc.cbWndExtra = 0; | |
645 wc.hInstance = hInstance; | |
646 wc.hCursor = LoadCursor(NULL,IDC_ARROW); | |
647 wc.hIcon = gui->icon; | |
648 wc.hbrBackground = SOLID_GREY; | |
36694 | 649 wc.lpszClassName = acp(MSGTR_GUI_Preferences); |
23077 | 650 wc.lpszMenuName = NULL; |
651 RegisterClass(&wc); | |
34164
d57ed389b6e2
Resize the Win32 GUI preference window and reposition items.
ib
parents:
34163
diff
changeset
|
652 x = (GetSystemMetrics(SM_CXSCREEN) / 2) - (425 / 2); |
34087 | 653 y = (GetSystemMetrics(SM_CYSCREEN) / 2) - (474 / 2); |
36694 | 654 hWnd = CreateWindow(acp(MSGTR_GUI_Preferences), |
655 acp(MSGTR_GUI_Preferences), | |
23077 | 656 WS_POPUPWINDOW | WS_CAPTION, |
657 x, | |
658 y, | |
34164
d57ed389b6e2
Resize the Win32 GUI preference window and reposition items.
ib
parents:
34163
diff
changeset
|
659 425, |
34087 | 660 474, |
23077 | 661 NULL, |
662 NULL, | |
663 hInstance, | |
664 NULL); | |
33638
dbca6aa18b50
Cast new user data value in SetWindowLongPtr() to LONG_PTR.
ib
parents:
33619
diff
changeset
|
665 SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR) gui); |
23077 | 666 ShowWindow(hWnd, SW_SHOW); |
667 UpdateWindow(hWnd); | |
668 } |