Mercurial > mplayer.hg
annotate gui/win32/preferences.c @ 23091:52488bb09d90
Consistently use quotes instead of angled brackets in #include
statements for non-system headers.
author | diego |
---|---|
date | Wed, 25 Apr 2007 07:34:56 +0000 |
parents | 8e9b11648f40 |
children | 21e29d5932c5 |
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 * | |
19 * You should have received a copy of the GNU General Public License | |
20 * along with MPlayer; if not, write to the Free Software | |
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
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" |
52488bb09d90
Consistently use quotes instead of angled brackets in #include
diego
parents:
23079
diff
changeset
|
32 #include "mixer.h" |
23077 | 33 #include "interface.h" |
34 #include "gui.h" | |
35 #include "mp_msg.h" | |
36 #include "help_mp.h" | |
37 #include "dialogs.h" | |
38 #include "wincfg.h" | |
39 | |
40 extern int vo_doublebuffering; | |
41 extern int vo_directrendering; | |
42 extern int frame_dropping; | |
43 extern int soft_vol; | |
44 extern float audio_delay; | |
45 extern int osd_level; | |
46 extern char *dvd_device, *cdrom_device; | |
47 extern char *proc_priority; | |
48 | |
49 static void set_defaults(void); | |
50 | |
51 static LRESULT CALLBACK PrefsWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam) | |
52 { | |
53 HWND btn, label, edit1, edit2, edit3, updown1, updown2, track1, track2; | |
54 static HWND vo_driver, ao_driver, prio; | |
55 int i = 0, j = 0; | |
56 char dvddevice[MAX_PATH]; | |
57 char cdromdevice[MAX_PATH]; | |
58 char procprio[11]; | |
59 float x = 10.0, y = 100.0, stereopos, delaypos; | |
60 stereopos = gtkAOExtraStereoMul * x; | |
61 delaypos = audio_delay * y; | |
62 | |
63 switch (iMsg) | |
64 { | |
65 case WM_CREATE: | |
66 { | |
67 /* video and audio drivers */ | |
68 label = CreateWindow("static", "Video Driver:", | |
69 WS_CHILD | WS_VISIBLE, | |
70 10, 13, 70, 15, hwnd, | |
71 NULL, ((LPCREATESTRUCT) lParam) -> hInstance, | |
72 NULL); | |
73 SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
74 | |
75 label = CreateWindow("static", "Audio Driver:", | |
76 WS_CHILD | WS_VISIBLE, | |
77 190, 13, 70, 15, hwnd, | |
78 NULL, ((LPCREATESTRUCT) lParam) -> hInstance, | |
79 NULL); | |
80 SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
81 | |
82 label = CreateWindow("static", "Extra stereo coefficient:", | |
83 WS_CHILD | WS_VISIBLE, | |
84 10, 126, 115, 15, hwnd, | |
85 NULL, ((LPCREATESTRUCT) lParam) -> hInstance, | |
86 NULL); | |
87 SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
88 | |
89 label = CreateWindow("static", "Audio delay:", | |
90 WS_CHILD | WS_VISIBLE, | |
91 36, 165, 115, 15, hwnd, | |
92 NULL, ((LPCREATESTRUCT) lParam) -> hInstance, | |
93 NULL); | |
94 SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
95 | |
96 label = CreateWindow("static", "OSD level:", | |
97 WS_CHILD | WS_VISIBLE, | |
98 10, 264, 115, 15, hwnd, | |
99 NULL, ((LPCREATESTRUCT) lParam) -> hInstance, | |
100 NULL); | |
101 SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
102 | |
103 label = CreateWindow("static", "DVD device:", | |
104 WS_CHILD | WS_VISIBLE, | |
105 80, 363, 115, 15, hwnd, | |
106 NULL, ((LPCREATESTRUCT) lParam) -> hInstance, | |
107 NULL); | |
108 SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
109 | |
110 label = CreateWindow("static", "CD device:", | |
111 WS_CHILD | WS_VISIBLE, | |
112 202, 363, 115, 15, hwnd, | |
113 NULL, ((LPCREATESTRUCT) lParam) -> hInstance, | |
114 NULL); | |
115 SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
116 | |
117 label = CreateWindow("static", "Priority:", | |
118 WS_CHILD | WS_VISIBLE, | |
119 217, 264, 115, 15, hwnd, | |
120 NULL, ((LPCREATESTRUCT) lParam) -> hInstance, | |
121 NULL); | |
122 SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
123 | |
124 vo_driver = CreateWindow("combobox", NULL, | |
125 CBS_DROPDOWNLIST | CB_SHOWDROPDOWN | | |
126 CBS_NOINTEGRALHEIGHT | CBS_HASSTRINGS | | |
127 WS_CHILD | WS_VISIBLE | | |
128 WS_VSCROLL | WS_TABSTOP, | |
129 80, 10, 100, 160, hwnd, | |
130 (HMENU) ID_VO_DRIVER, | |
131 ((LPCREATESTRUCT) lParam) -> hInstance, | |
132 NULL); | |
133 | |
134 ao_driver = CreateWindow("combobox", NULL, | |
135 CBS_DROPDOWNLIST | CB_SHOWDROPDOWN | | |
136 CBS_NOINTEGRALHEIGHT | CBS_HASSTRINGS | | |
137 WS_CHILD | WS_VISIBLE | | |
138 WS_VSCROLL | WS_TABSTOP, | |
139 260, 10, 100, 160, hwnd, | |
140 (HMENU) ID_AO_DRIVER, | |
141 ((LPCREATESTRUCT) lParam) -> hInstance, | |
142 NULL); | |
143 | |
144 prio = CreateWindow("combobox", NULL, | |
145 CBS_DROPDOWNLIST | CB_SHOWDROPDOWN | | |
146 CBS_NOINTEGRALHEIGHT | CBS_HASSTRINGS | | |
147 WS_CHILD | WS_VISIBLE | | |
148 WS_VSCROLL | WS_TABSTOP, | |
149 260, 260, 100, 160, hwnd, | |
150 (HMENU) ID_PRIO, | |
151 ((LPCREATESTRUCT) lParam) -> hInstance, | |
152 NULL); | |
153 | |
154 /* checkboxes */ | |
155 btn = CreateWindow("button", "Enable double buffering", | |
156 WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, | |
157 25, 35, 150, 25, | |
158 hwnd, (HMENU) ID_DOUBLE, | |
159 ((LPCREATESTRUCT) lParam) -> hInstance, | |
160 NULL); | |
161 SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
162 | |
163 btn = CreateWindow("button", "Enable direct rendering", | |
164 WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, | |
165 25, 57, 150, 25, | |
166 hwnd, (HMENU) ID_DIRECT, | |
167 ((LPCREATESTRUCT) lParam) -> hInstance, | |
168 NULL); | |
169 SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
170 | |
171 btn = CreateWindow("button", "Enable framedropping", | |
172 WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, | |
173 25, 79, 150, 25, | |
174 hwnd, (HMENU) ID_FRAMEDROP, | |
175 ((LPCREATESTRUCT) lParam) -> hInstance, | |
176 NULL); | |
177 SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
178 | |
179 btn = CreateWindow("button", "Normalize sound", | |
180 WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, | |
181 205, 35, 150, 25, | |
182 hwnd, (HMENU) ID_NORMALIZE, | |
183 ((LPCREATESTRUCT) lParam) -> hInstance, | |
184 NULL); | |
185 SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
186 | |
187 btn = CreateWindow("button", "Enable software mixer", | |
188 WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, | |
189 205, 57, 150, 25, | |
190 hwnd, (HMENU) ID_SOFTMIX, | |
191 ((LPCREATESTRUCT) lParam) -> hInstance, | |
192 NULL); | |
193 SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
194 | |
195 btn = CreateWindow("button", "Enable extra stereo", | |
196 WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, | |
197 205, 79, 150, 25, | |
198 hwnd, (HMENU) ID_EXTRASTEREO, | |
199 ((LPCREATESTRUCT) lParam) -> hInstance, | |
200 NULL); | |
201 SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
202 | |
203 btn = CreateWindow("button", "Enable cache", | |
204 WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, | |
205 10, 200, 90, 25, | |
206 hwnd, (HMENU) ID_CACHE, | |
207 ((LPCREATESTRUCT) lParam) -> hInstance, | |
208 NULL); | |
209 SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
210 | |
211 btn = CreateWindow("button", "Enable autosync", | |
212 WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, | |
213 192, 200, 100, 25, hwnd, | |
214 (HMENU) ID_AUTOSYNC, | |
215 ((LPCREATESTRUCT) lParam) -> hInstance, | |
216 NULL); | |
217 SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
218 | |
219 btn = CreateWindow("button", "Display videos in the sub window", | |
220 WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, | |
221 85, 227, 250, 25, | |
222 hwnd, (HMENU) ID_SUBWINDOW, | |
223 ((LPCREATESTRUCT) lParam) -> hInstance, | |
224 NULL); | |
225 SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
226 | |
227 /* osd level */ | |
228 btn = CreateWindow("button", "None", | |
229 WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON, | |
230 95, 260, 100, 25, hwnd, | |
231 (HMENU) ID_NONE, | |
232 ((LPCREATESTRUCT) lParam) -> hInstance, | |
233 NULL); | |
234 SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
235 | |
236 btn = CreateWindow("button", "Timer and indicators", | |
237 WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON, | |
238 95, 280, 180, 25, hwnd, | |
239 (HMENU) ID_OSD1, | |
240 ((LPCREATESTRUCT) lParam) -> hInstance, | |
241 NULL); | |
242 SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
243 | |
244 btn = CreateWindow("button", "Progress bar only", | |
245 WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON, | |
246 95, 300, 180, 25, hwnd, | |
247 (HMENU) ID_OSD2, | |
248 ((LPCREATESTRUCT) lParam) -> hInstance, | |
249 NULL); | |
250 SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
251 | |
252 btn = CreateWindow("button", "Timer, percentage, and total time", | |
253 WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON, | |
254 95, 320, 180, 25, hwnd, | |
255 (HMENU) ID_OSD3, | |
256 ((LPCREATESTRUCT) lParam) -> hInstance, | |
257 NULL); | |
258 SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
259 | |
260 btn = CreateWindow("button", "Apply", | |
261 WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, | |
262 199, 395, 80, 25, hwnd, | |
263 (HMENU) ID_APPLY, | |
264 ((LPCREATESTRUCT) lParam) -> hInstance, | |
265 NULL); | |
266 SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
267 | |
268 btn = CreateWindow("button", "Cancel", | |
269 WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, | |
270 285, 395, 80, 25, hwnd, | |
271 (HMENU) ID_CANCEL, | |
272 ((LPCREATESTRUCT) lParam) -> hInstance, | |
273 NULL); | |
274 SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
275 | |
276 btn = CreateWindow("button", "Defaults", | |
277 WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, | |
278 4, 395, 80, 25, hwnd, | |
279 (HMENU) ID_DEFAULTS, | |
280 ((LPCREATESTRUCT) lParam) -> hInstance, | |
281 NULL); | |
282 SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
283 | |
284 /* extra stereo coefficient trackbar */ | |
285 track1 = CreateWindow(TRACKBAR_CLASS, "Coefficient", | |
286 WS_CHILD | WS_VISIBLE | WS_TABSTOP | | |
287 WS_DISABLED | TBS_HORZ | | |
288 TBS_BOTTOM | TBS_NOTICKS, | |
289 120, 120, 245, 35, hwnd, | |
290 (HMENU) ID_TRACKBAR1, | |
291 ((LPCREATESTRUCT) lParam) -> hInstance, | |
292 NULL); | |
293 SendDlgItemMessage(hwnd, ID_TRACKBAR1, TBM_SETRANGE, 1, MAKELONG(-100, 100)); | |
294 | |
295 /* audio delay */ | |
296 track2 = CreateWindow(TRACKBAR_CLASS, "Audio delay", | |
297 WS_CHILD | WS_VISIBLE | WS_TABSTOP | | |
298 WS_DISABLED | TBS_HORZ | | |
299 TBS_BOTTOM | TBS_NOTICKS, | |
300 120, 160, 245, 35, hwnd, | |
301 (HMENU) ID_TRACKBAR2, | |
302 ((LPCREATESTRUCT) lParam) -> hInstance, | |
303 NULL); | |
304 SendDlgItemMessage(hwnd, ID_TRACKBAR2, TBM_SETRANGE, 1, MAKELONG(-1000, 1000)); | |
305 | |
306 /* cache */ | |
307 edit1 = CreateWindowEx(WS_EX_CLIENTEDGE, "edit", "cache", | |
308 WS_CHILD | WS_VISIBLE | WS_DISABLED | | |
309 ES_LEFT | ES_AUTOHSCROLL, | |
310 105, 203, 40, 20, hwnd, | |
311 (HMENU) ID_EDIT1, | |
312 ((LPCREATESTRUCT) lParam) -> hInstance, | |
313 NULL); | |
314 SendMessage(edit1, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
315 | |
316 updown1 = CreateUpDownControl(WS_CHILD | WS_VISIBLE | | |
317 WS_DISABLED | UDS_SETBUDDYINT | | |
318 UDS_ARROWKEYS | UDS_NOTHOUSANDS, | |
319 145, 203, 20, 20, hwnd, | |
320 ID_UPDOWN1, | |
321 ((LPCREATESTRUCT) lParam) -> hInstance, | |
322 (HWND)edit1, 0, 0, 0); | |
323 SendDlgItemMessage(hwnd, ID_UPDOWN1, UDM_SETRANGE32, (WPARAM)0, (LPARAM)65535); | |
324 | |
325 /* autosync */ | |
326 edit2 = CreateWindowEx(WS_EX_CLIENTEDGE, "edit", "autosync", | |
327 WS_CHILD | WS_VISIBLE | WS_DISABLED | | |
328 ES_LEFT | ES_AUTOHSCROLL, | |
329 300, 203, 40, 20, hwnd, | |
330 (HMENU) ID_EDIT2, | |
331 ((LPCREATESTRUCT) lParam) -> hInstance, | |
332 NULL); | |
333 SendMessage(edit2, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
334 | |
335 updown2 = CreateUpDownControl(WS_CHILD | WS_VISIBLE | | |
336 WS_DISABLED | UDS_SETBUDDYINT | | |
337 UDS_ARROWKEYS | UDS_NOTHOUSANDS, | |
338 340, 203, 20, 20, hwnd, | |
339 ID_UPDOWN2, | |
340 ((LPCREATESTRUCT) lParam) -> hInstance, | |
341 (HWND)edit2, 0, 0, 0); | |
342 SendDlgItemMessage(hwnd, ID_UPDOWN2, UDM_SETRANGE32, (WPARAM)0, (LPARAM)10000); | |
343 | |
344 /* dvd and cd devices */ | |
345 edit3 = CreateWindowEx(WS_EX_CLIENTEDGE, "edit", NULL, | |
346 WS_CHILD | WS_VISIBLE | | |
347 ES_LEFT | ES_AUTOHSCROLL, | |
348 145, 360, 20, 20, hwnd, | |
349 (HMENU) ID_DVDDEVICE, | |
350 ((LPCREATESTRUCT) lParam) -> hInstance, | |
351 NULL); | |
352 SendMessage(edit3, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
353 | |
354 edit3 = CreateWindowEx(WS_EX_CLIENTEDGE, "edit", NULL, | |
355 WS_CHILD | WS_VISIBLE | | |
356 ES_LEFT| ES_AUTOHSCROLL, | |
357 260, 360, 20, 20, hwnd, | |
358 (HMENU) ID_CDDEVICE, | |
359 ((LPCREATESTRUCT) lParam) -> hInstance, | |
360 NULL); | |
361 SendMessage(edit3, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
362 | |
363 while(video_out_drivers[i]) | |
364 { | |
365 const vo_info_t *info = video_out_drivers[i++]->info; | |
366 if(!video_driver_list) gaddlist(&video_driver_list, (char *)info->short_name); | |
367 SendDlgItemMessage(hwnd, ID_VO_DRIVER, CB_ADDSTRING, 0, (LPARAM) info->short_name); | |
368 } | |
369 /* Special case for directx:noaccel */ | |
370 SendDlgItemMessage(hwnd, ID_VO_DRIVER, CB_ADDSTRING, 0, (LPARAM) "directx:noaccel"); | |
371 SendMessage(vo_driver, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
372 | |
373 while(audio_out_drivers[j]) | |
374 { | |
375 const ao_info_t *info = audio_out_drivers[j++]->info; | |
376 if(!audio_driver_list) | |
377 { | |
378 // FIXME: default priority (i.e. order in audio_out_drivers) should be fixed instead | |
379 // if win32 as default is really desirable | |
380 gaddlist(&audio_driver_list, "win32"/*(char *)info->short_name*/); | |
381 } | |
382 SendDlgItemMessage(hwnd, ID_AO_DRIVER, CB_ADDSTRING, 0, (LPARAM) info->short_name); | |
383 } | |
384 SendMessage(ao_driver, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
385 | |
386 /* priority list, i'm leaving out realtime for safety's sake */ | |
387 SendDlgItemMessage(hwnd, ID_PRIO, CB_INSERTSTRING, 0, (LPARAM) "low"); | |
388 SendDlgItemMessage(hwnd, ID_PRIO, CB_INSERTSTRING, 0, (LPARAM) "belownormal"); | |
389 SendDlgItemMessage(hwnd, ID_PRIO, CB_INSERTSTRING, 0, (LPARAM) "normal"); | |
390 SendDlgItemMessage(hwnd, ID_PRIO, CB_INSERTSTRING, 0, (LPARAM) "abovenormal"); | |
391 SendDlgItemMessage(hwnd, ID_PRIO, CB_INSERTSTRING, 0, (LPARAM) "high"); | |
392 SendMessage(prio, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); | |
393 | |
394 /* set our preferences on what we already have */ | |
395 if(video_driver_list) | |
396 SendDlgItemMessage(hwnd, ID_VO_DRIVER, CB_SETCURSEL, | |
397 (WPARAM)SendMessage(vo_driver, CB_FINDSTRING, -1, | |
398 (LPARAM)video_driver_list[0]), 0); | |
399 | |
400 if(audio_driver_list) | |
401 SendDlgItemMessage(hwnd, ID_AO_DRIVER, CB_SETCURSEL, | |
402 (WPARAM)SendMessage(ao_driver, CB_FINDSTRING, -1, | |
403 (LPARAM)audio_driver_list[0]), 0); | |
404 | |
405 if(vo_doublebuffering) | |
406 SendDlgItemMessage(hwnd, ID_DOUBLE, BM_SETCHECK, 1, 0); | |
407 if(vo_directrendering) | |
408 SendDlgItemMessage(hwnd, ID_DIRECT, BM_SETCHECK, 1, 0); | |
409 if(frame_dropping) | |
410 SendDlgItemMessage(hwnd, ID_FRAMEDROP, BM_SETCHECK, 1, 0); | |
411 if(gtkAONorm) | |
412 SendDlgItemMessage(hwnd, ID_NORMALIZE, BM_SETCHECK, 1, 0); | |
413 if(soft_vol) | |
414 SendDlgItemMessage(hwnd, ID_SOFTMIX, BM_SETCHECK, 1, 0); | |
415 if(gtkAOExtraStereo) | |
416 { | |
417 SendDlgItemMessage(hwnd, ID_EXTRASTEREO, BM_SETCHECK, 1, 0); | |
418 if(!guiIntfStruct.Playing) | |
419 { | |
420 EnableWindow(track1, 1); | |
421 EnableWindow(track2, 1); | |
422 } | |
423 } | |
424 else gtkAOExtraStereoMul = 1.0; | |
425 SendDlgItemMessage(hwnd, ID_TRACKBAR1, TBM_SETPOS, 1, (LPARAM)stereopos); | |
426 | |
427 if(audio_delay) | |
428 SendDlgItemMessage(hwnd, ID_TRACKBAR2, TBM_SETPOS, 1, (LPARAM)delaypos); | |
429 | |
430 if(gtkCacheOn) { | |
431 SendDlgItemMessage(hwnd, ID_CACHE, BM_SETCHECK, 1, 0); | |
432 EnableWindow(edit1, 1); | |
433 EnableWindow(updown1, 1); | |
434 } | |
435 else gtkCacheSize = 2048; | |
436 SendDlgItemMessage(hwnd, ID_UPDOWN1, UDM_SETPOS32, 0, (LPARAM)gtkCacheSize); | |
437 | |
438 if(gtkAutoSyncOn) { | |
439 SendDlgItemMessage(hwnd, ID_AUTOSYNC, BM_SETCHECK, 1, 0); | |
440 EnableWindow(edit2, 1); | |
441 EnableWindow(updown2, 1); | |
442 } | |
443 else gtkAutoSync = 0; | |
444 SendDlgItemMessage(hwnd, ID_UPDOWN2, UDM_SETPOS32, 0, (LPARAM)gtkAutoSync); | |
445 | |
446 if(sub_window) | |
447 SendDlgItemMessage(hwnd, ID_SUBWINDOW, BM_SETCHECK, 1, 0); | |
448 | |
449 if(!osd_level) | |
450 SendDlgItemMessage(hwnd, ID_NONE, BM_SETCHECK, 1, 0); | |
451 else if(osd_level == 1) | |
452 SendDlgItemMessage(hwnd, ID_OSD1, BM_SETCHECK, 1, 0); | |
453 else if(osd_level == 2) | |
454 SendDlgItemMessage(hwnd, ID_OSD2, BM_SETCHECK, 1, 0); | |
455 else if(osd_level == 3) | |
456 SendDlgItemMessage(hwnd, ID_OSD3, BM_SETCHECK, 1, 0); | |
457 | |
458 if(dvd_device) | |
459 SendDlgItemMessage(hwnd, ID_DVDDEVICE, WM_SETTEXT, 0, (LPARAM)dvd_device); | |
460 else SendDlgItemMessage(hwnd, ID_DVDDEVICE, WM_SETTEXT, 0, (LPARAM)"D:"); | |
461 | |
462 if(cdrom_device) | |
463 SendDlgItemMessage(hwnd, ID_CDDEVICE, WM_SETTEXT, 0, (LPARAM)cdrom_device); | |
464 else SendDlgItemMessage(hwnd, ID_CDDEVICE, WM_SETTEXT, 0, (LPARAM)"D:"); | |
465 | |
466 if(proc_priority) | |
467 SendDlgItemMessage(hwnd, ID_PRIO, CB_SETCURSEL, | |
468 (WPARAM)SendMessage(prio, CB_FINDSTRING, -1, | |
469 (LPARAM)proc_priority), 0); | |
470 | |
471 else SendDlgItemMessage(hwnd, ID_PRIO, CB_SETCURSEL, 2, 0); | |
472 | |
473 break; | |
474 } | |
475 case WM_CTLCOLORDLG: | |
476 case WM_CTLCOLOREDIT: | |
477 case WM_CTLCOLORBTN: | |
478 case WM_CTLCOLORSTATIC: | |
479 { | |
480 HDC hdc = (HDC)wParam; | |
481 SetBkMode(hdc, TRANSPARENT); | |
482 return (INT_PTR)SOLID_GREY; | |
483 } | |
484 break; | |
485 case WM_COMMAND: | |
486 { | |
487 switch (LOWORD(wParam)) | |
488 { | |
489 case ID_EXTRASTEREO: | |
490 { | |
491 if(SendDlgItemMessage(hwnd, ID_EXTRASTEREO, BM_GETCHECK, 0, 0) == BST_CHECKED) | |
492 { | |
493 EnableWindow(GetDlgItem(hwnd, ID_TRACKBAR1), 1); | |
494 EnableWindow(GetDlgItem(hwnd, ID_TRACKBAR2), 1); | |
495 } else { | |
496 EnableWindow(GetDlgItem(hwnd, ID_TRACKBAR1), 0); | |
497 EnableWindow(GetDlgItem(hwnd, ID_TRACKBAR2), 0); | |
498 SendDlgItemMessage(hwnd, ID_TRACKBAR1, TBM_SETPOS, 1, (LPARAM)10.0); | |
499 SendDlgItemMessage(hwnd, ID_TRACKBAR2, TBM_SETPOS, 1, (LPARAM)0); | |
500 } | |
501 break; | |
502 } | |
503 case ID_CACHE: | |
504 { | |
505 if(SendDlgItemMessage(hwnd, ID_CACHE, BM_GETCHECK, 0, 0) == BST_CHECKED) | |
506 { | |
507 EnableWindow(GetDlgItem(hwnd, ID_EDIT1), 1); | |
508 EnableWindow(GetDlgItem(hwnd, ID_UPDOWN1), 1); | |
509 } else { | |
510 EnableWindow(GetDlgItem(hwnd, ID_EDIT1), 0); | |
511 EnableWindow(GetDlgItem(hwnd, ID_UPDOWN1), 0); | |
512 SendDlgItemMessage(hwnd, ID_UPDOWN1, UDM_SETPOS32, 1, (LPARAM)2048); | |
513 } | |
514 break; | |
515 } | |
516 case ID_AUTOSYNC: | |
517 { | |
518 if(SendDlgItemMessage(hwnd, ID_AUTOSYNC, BM_GETCHECK, 0, 0) == BST_CHECKED) | |
519 { | |
520 EnableWindow(GetDlgItem(hwnd, ID_EDIT2), 1); | |
521 EnableWindow(GetDlgItem(hwnd, ID_UPDOWN2), 1); | |
522 } else { | |
523 EnableWindow(GetDlgItem(hwnd, ID_EDIT2), 0); | |
524 EnableWindow(GetDlgItem(hwnd, ID_UPDOWN2), 0); | |
525 SendDlgItemMessage(hwnd, ID_UPDOWN2, UDM_SETPOS32, 1, (LPARAM)0); | |
526 } | |
527 break; | |
528 } | |
529 case ID_DEFAULTS: | |
530 { | |
531 set_defaults(); | |
532 SendDlgItemMessage(hwnd, ID_VO_DRIVER, CB_SETCURSEL, | |
533 (WPARAM)SendMessage(vo_driver, CB_FINDSTRING, -1, (LPARAM)"directx"), 0); | |
534 | |
535 SendDlgItemMessage(hwnd, ID_AO_DRIVER, CB_SETCURSEL, | |
536 (WPARAM)SendMessage(ao_driver, CB_FINDSTRING, -1, (LPARAM)"dsound"), 0); | |
537 | |
538 SendDlgItemMessage(hwnd, ID_PRIO, CB_SETCURSEL, | |
539 (WPARAM)SendMessage(prio, CB_FINDSTRING, -1, (LPARAM)proc_priority), 0); | |
540 | |
541 SendDlgItemMessage(hwnd, ID_TRACKBAR1, TBM_SETPOS, 1, (LPARAM)10.0); | |
542 SendDlgItemMessage(hwnd, ID_TRACKBAR2, TBM_SETPOS, 1, (LPARAM)0.0); | |
543 SendDlgItemMessage(hwnd, ID_UPDOWN1, UDM_SETPOS32, 0, (LPARAM)gtkCacheSize); | |
544 SendDlgItemMessage(hwnd, ID_UPDOWN2, UDM_SETPOS32, 0, (LPARAM)gtkAutoSync); | |
545 SendDlgItemMessage(hwnd, ID_DOUBLE, BM_SETCHECK, 0, 0); | |
546 SendDlgItemMessage(hwnd, ID_DIRECT, BM_SETCHECK, 0, 0); | |
547 SendDlgItemMessage(hwnd, ID_FRAMEDROP, BM_SETCHECK, 0, 0); | |
548 SendDlgItemMessage(hwnd, ID_NORMALIZE, BM_SETCHECK, 0, 0); | |
549 SendDlgItemMessage(hwnd, ID_SOFTMIX, BM_SETCHECK, 0, 0); | |
550 SendDlgItemMessage(hwnd, ID_EXTRASTEREO, BM_SETCHECK, 0, 0); | |
551 SendDlgItemMessage(hwnd, ID_CACHE, BM_SETCHECK, 0, 0); | |
552 SendDlgItemMessage(hwnd, ID_AUTOSYNC, BM_SETCHECK, 0, 0); | |
553 SendDlgItemMessage(hwnd, ID_SUBWINDOW, BM_SETCHECK, 1, 0); | |
554 SendDlgItemMessage(hwnd, ID_NONE, BM_SETCHECK, 0, 0); | |
555 SendDlgItemMessage(hwnd, ID_OSD1, BM_SETCHECK, 1, 0); | |
556 SendDlgItemMessage(hwnd, ID_OSD2, BM_SETCHECK, 0, 0); | |
557 SendDlgItemMessage(hwnd, ID_OSD3, BM_SETCHECK, 0, 0); | |
558 SendDlgItemMessage(hwnd, ID_DVDDEVICE, WM_SETTEXT, 0, (LPARAM)"D:"); | |
559 SendDlgItemMessage(hwnd, ID_CDDEVICE, WM_SETTEXT, 0, (LPARAM)"D:"); | |
560 SendMessage(hwnd, WM_COMMAND, (WPARAM)ID_APPLY, 0); | |
561 break; | |
562 } | |
563 case ID_CANCEL: | |
564 DestroyWindow(hwnd); | |
565 return 0; | |
566 case ID_APPLY: | |
567 { | |
568 int strl; | |
569 if(guiIntfStruct.Playing) guiGetEvent(guiCEvent, (void *)guiSetStop); | |
570 | |
571 /* Set the video driver */ | |
572 gfree(video_driver_list[0]); | |
573 strl = SendMessage(vo_driver, CB_GETCURSEL, 0, 0); | |
574 video_driver_list[0] = malloc(strl); | |
575 SendMessage(vo_driver, CB_GETLBTEXT, (WPARAM)strl, | |
576 (LPARAM)video_driver_list[0]); | |
577 | |
578 /* Set the audio driver */ | |
579 gfree(audio_driver_list[0]); | |
580 strl = SendMessage(ao_driver, CB_GETCURSEL, 0, 0); | |
581 audio_driver_list[0] = malloc(strl); | |
582 SendMessage(ao_driver, CB_GETLBTEXT, (WPARAM)strl, | |
583 (LPARAM)audio_driver_list[0]); | |
584 | |
585 /* Set the priority level */ | |
586 SendMessage(prio, CB_GETLBTEXT, (WPARAM)SendMessage(prio, CB_GETCURSEL, 0, 0), (LPARAM)procprio); | |
587 proc_priority = strdup(procprio); | |
588 | |
589 /* double buffering */ | |
590 if(SendDlgItemMessage(hwnd, ID_DOUBLE, BM_GETCHECK, 0, 0) == BST_CHECKED) | |
591 vo_doublebuffering = 1; | |
592 else vo_doublebuffering = 0; | |
593 | |
594 /* direct rendering */ | |
595 if(SendDlgItemMessage(hwnd, ID_DIRECT, BM_GETCHECK, 0, 0) == BST_CHECKED) | |
596 vo_directrendering = 1; | |
597 else vo_directrendering = 0; | |
598 | |
599 /* frame dropping */ | |
600 if(SendDlgItemMessage(hwnd, ID_FRAMEDROP, BM_GETCHECK, 0, 0) == BST_CHECKED) | |
601 frame_dropping = 1; | |
602 else frame_dropping = 0; | |
603 | |
604 /* normalize */ | |
605 if(SendDlgItemMessage(hwnd, ID_NORMALIZE, BM_GETCHECK, 0, 0) == BST_CHECKED) | |
606 gtkAONorm = 1; | |
607 else gtkAONorm = 0; | |
608 | |
609 /* software mixer */ | |
610 if(SendDlgItemMessage(hwnd, ID_SOFTMIX, BM_GETCHECK, 0, 0) == BST_CHECKED) | |
611 soft_vol = 1; | |
612 else soft_vol = 0; | |
613 | |
614 /* extra stereo */ | |
615 if(SendDlgItemMessage(hwnd, ID_EXTRASTEREO, BM_GETCHECK, 0, 0) == BST_CHECKED) | |
616 gtkAOExtraStereo = 1; | |
617 else { | |
618 gtkAOExtraStereo = 0; | |
619 gtkAOExtraStereoMul = 10.0; | |
620 } | |
621 gtkAOExtraStereoMul = SendDlgItemMessage(hwnd, ID_TRACKBAR1, TBM_GETPOS, 0, 0) / 10.0; | |
622 | |
623 /* audio delay */ | |
624 audio_delay = SendDlgItemMessage(hwnd, ID_TRACKBAR2, TBM_GETPOS, 0, 0) / 100.0; | |
625 | |
626 /* cache */ | |
627 if(SendDlgItemMessage(hwnd, ID_CACHE, BM_GETCHECK, 0, 0) == BST_CHECKED) | |
628 gtkCacheOn = 1; | |
629 else gtkCacheOn = 0; | |
630 gtkCacheSize = SendDlgItemMessage(hwnd, ID_UPDOWN1, UDM_GETPOS32, 0, 0); | |
631 | |
632 /* autosync */ | |
633 if(SendDlgItemMessage(hwnd, ID_AUTOSYNC, BM_GETCHECK, 0, 0) == BST_CHECKED) | |
634 gtkAutoSyncOn = 1; | |
635 else gtkAutoSyncOn = 0; | |
636 gtkAutoSync = SendDlgItemMessage(hwnd, ID_UPDOWN2, UDM_GETPOS32, 0, 0); | |
637 | |
638 /* sub window */ | |
639 if(SendDlgItemMessage(hwnd, ID_SUBWINDOW, BM_GETCHECK, 0, 0) == BST_CHECKED) | |
640 sub_window = 1; | |
641 else sub_window = 0; | |
642 | |
643 /* osd level */ | |
644 if(SendDlgItemMessage(hwnd, ID_NONE, BM_GETCHECK, 0, 0) == BST_CHECKED) | |
645 osd_level = 0; | |
646 else if(SendDlgItemMessage(hwnd, ID_OSD1, BM_GETCHECK, 0, 0) == BST_CHECKED) | |
647 osd_level = 1; | |
648 else if(SendDlgItemMessage(hwnd, ID_OSD2, BM_GETCHECK, 0, 0) == BST_CHECKED) | |
649 osd_level = 2; | |
650 else if(SendDlgItemMessage(hwnd, ID_OSD3, BM_GETCHECK, 0, 0) == BST_CHECKED) | |
651 osd_level = 3; | |
652 | |
653 /* dvd and cd devices */ | |
654 SendDlgItemMessage(hwnd, ID_DVDDEVICE, WM_GETTEXT, MAX_PATH, (LPARAM)dvddevice); | |
655 dvd_device = strdup(dvddevice); | |
656 SendDlgItemMessage(hwnd, ID_CDDEVICE, WM_GETTEXT, MAX_PATH, (LPARAM)cdromdevice); | |
657 cdrom_device = strdup(cdromdevice); | |
658 | |
659 MessageBox(hwnd, "You must restart MPlayer for the changes to take effect.", "MPlayer - Info:", MB_OK); | |
660 DestroyWindow(hwnd); | |
661 break; | |
662 } | |
663 } | |
664 return 0; | |
665 } | |
666 case WM_DESTROY: | |
667 PostQuitMessage (0); | |
668 return 0; | |
669 } | |
670 return DefWindowProc(hwnd, iMsg, wParam, lParam); | |
671 } | |
672 | |
673 void display_prefswindow(gui_t *gui) | |
674 { | |
675 HWND hWnd; | |
676 HINSTANCE hInstance = GetModuleHandle(NULL); | |
677 WNDCLASS wc; | |
678 int x, y; | |
679 if(FindWindow(NULL, "MPlayer - Preferences")) return; | |
680 wc.style = CS_HREDRAW | CS_VREDRAW; | |
681 wc.lpfnWndProc = PrefsWndProc; | |
682 wc.cbClsExtra = 0; | |
683 wc.cbWndExtra = 0; | |
684 wc.hInstance = hInstance; | |
685 wc.hCursor = LoadCursor(NULL,IDC_ARROW); | |
686 wc.hIcon = gui->icon; | |
687 wc.hbrBackground = SOLID_GREY; | |
688 wc.lpszClassName = "MPlayer - Preferences"; | |
689 wc.lpszMenuName = NULL; | |
690 RegisterClass(&wc); | |
691 x = (GetSystemMetrics(SM_CXSCREEN) / 2) - (375 / 2); | |
692 y = (GetSystemMetrics(SM_CYSCREEN) / 2) - (452 / 2); | |
693 hWnd = CreateWindow("MPlayer - Preferences", | |
694 "MPlayer - Preferences", | |
695 WS_POPUPWINDOW | WS_CAPTION, | |
696 x, | |
697 y, | |
698 375, | |
699 452, | |
700 NULL, | |
701 NULL, | |
702 hInstance, | |
703 NULL); | |
704 SetWindowLongPtr(hWnd, GWLP_USERDATA, (DWORD) gui); | |
705 ShowWindow(hWnd, SW_SHOW); | |
706 UpdateWindow(hWnd); | |
707 } | |
708 | |
709 static void set_defaults(void) | |
710 { | |
711 proc_priority = "normal"; | |
712 vo_doublebuffering = 1; | |
713 vo_directrendering = 0; | |
714 frame_dropping = 0; | |
715 soft_vol = 0; | |
716 gtkAONorm = 0; | |
717 gtkAOExtraStereo = 0; | |
718 gtkAOExtraStereoMul = 1.0; | |
719 audio_delay = 0.0; | |
720 sub_window = 1; | |
721 gtkCacheOn = 0; | |
722 gtkCacheSize = 2048; | |
723 gtkAutoSyncOn = 0; | |
724 gtkAutoSync = 0; | |
725 } |