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