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