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