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