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