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