Parent Directory
|
Revision Log
Revision 30 - (view) (download)
1 : | Isibaar | 3 | /************************************************************************** |
2 : | * | ||
3 : | * XVID VFW FRONTEND | ||
4 : | * config | ||
5 : | * | ||
6 : | * This program is free software; you can redistribute it and/or modify | ||
7 : | * it under the terms of the GNU General Public License as published by | ||
8 : | * the Free Software Foundation; either version 2 of the License, or | ||
9 : | * (at your option) any later version. | ||
10 : | * | ||
11 : | * This program is distributed in the hope that it will be useful, | ||
12 : | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 : | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 : | * GNU General Public License for more details. | ||
15 : | * | ||
16 : | * You should have received a copy of the GNU General Public License | ||
17 : | * along with this program; if not, write to the Free Software | ||
18 : | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
19 : | * | ||
20 : | *************************************************************************/ | ||
21 : | |||
22 : | /************************************************************************** | ||
23 : | * | ||
24 : | * History: | ||
25 : | * | ||
26 : | h | 30 | * 16.03.2002 daniel smith <danielsmith@astroboymail.com> |
27 : | * rewrote/restructured most of file | ||
28 : | * added tooltips (kind of - dirty message hook method) | ||
29 : | * split tabs into a main dialog / advanced prop sheet | ||
30 : | * advanced controls are now enabled/disabled by mode | ||
31 : | * added modulated quantization, DX50 fourcc | ||
32 : | * 11.03.2002 Min Chen <chenm001@163.com> | ||
33 : | * now get Core Version use xvid_init() | ||
34 : | * 05.03.2002 Min Chen <chenm001@163.com> | ||
35 : | * Add Core version display to about box | ||
36 : | Isibaar | 3 | * 01.12.2001 inital version; (c)2001 peter ross <suxen_drol@hotmail.com> |
37 : | * | ||
38 : | *************************************************************************/ | ||
39 : | |||
40 : | |||
41 : | #include <windows.h> | ||
42 : | h | 30 | #include <commctrl.h> |
43 : | Isibaar | 3 | #include <shlobj.h> |
44 : | #include <prsht.h> | ||
45 : | |||
46 : | #include "codec.h" | ||
47 : | #include "config.h" | ||
48 : | h | 30 | #include "xvid.h" // cpu masks |
49 : | Isibaar | 3 | #include "resource.h" |
50 : | |||
51 : | h | 30 | |
52 : | Isibaar | 3 | /* get config settings from registry */ |
53 : | |||
54 : | #define REG_GET_N(X, Y, Z) size=sizeof(int);if(RegQueryValueEx(hKey, X, 0, 0, (LPBYTE)&Y, &size) != ERROR_SUCCESS) {Y=Z;} | ||
55 : | #define REG_GET_S(X, Y, Z) size=MAX_PATH;if(RegQueryValueEx(hKey, X, 0, 0, Y, &size) != ERROR_SUCCESS) {lstrcpy(Y, Z);} | ||
56 : | #define REG_GET_B(X, Y, Z) size=sizeof((Z));if(RegQueryValueEx(hKey, X, 0, 0, Y, &size) != ERROR_SUCCESS) {memcpy(Y, Z, sizeof((Z)));} | ||
57 : | |||
58 : | void config_reg_get(CONFIG * config) | ||
59 : | { | ||
60 : | HKEY hKey; | ||
61 : | DWORD size; | ||
62 : | XVID_INIT_PARAM init_param; | ||
63 : | |||
64 : | init_param.cpu_flags = 0; | ||
65 : | xvid_init(0, 0, &init_param, NULL); | ||
66 : | config->cpu = init_param.cpu_flags; | ||
67 : | |||
68 : | h | 30 | RegOpenKeyEx(XVID_REG_KEY, XVID_REG_PARENT "\\" XVID_REG_CHILD, 0, KEY_READ, &hKey); |
69 : | Isibaar | 3 | |
70 : | h | 30 | REG_GET_N("mode", config->mode, DLG_MODE_CBR); |
71 : | REG_GET_N("bitrate", config->bitrate, 900000); | ||
72 : | REG_GET_N("quality", config->quality, 85); | ||
73 : | REG_GET_N("quant", config->quant, 5); | ||
74 : | REG_GET_N("rc_buffersize", config->rc_buffersize, 2048000); | ||
75 : | Isibaar | 3 | |
76 : | h | 30 | REG_GET_N("motion_search", config->motion_search, 5); |
77 : | REG_GET_N("quant_type", config->quant_type, 0); | ||
78 : | REG_GET_N("fourcc_used", config->fourcc_used, 0); | ||
79 : | REG_GET_N("max_key_interval", config->max_key_interval, 300); | ||
80 : | REG_GET_N("lum_masking", config->lum_masking, 0); | ||
81 : | Isibaar | 3 | |
82 : | h | 30 | REG_GET_N("min_iquant", config->min_iquant, 1); |
83 : | REG_GET_N("max_iquant", config->max_iquant, 31); | ||
84 : | REG_GET_N("min_pquant", config->min_pquant, 1); | ||
85 : | REG_GET_N("max_pquant", config->max_pquant, 31); | ||
86 : | Isibaar | 3 | |
87 : | h | 30 | REG_GET_N("desired_size", config->desired_size, 570000); |
88 : | REG_GET_N("keyframe_boost", config->keyframe_boost, 20); | ||
89 : | REG_GET_N("min_key_interval", config->min_key_interval, 6); | ||
90 : | REG_GET_N("discard1pass", config->discard1pass, 1); | ||
91 : | REG_GET_N("dummy2pass", config->dummy2pass, 0); | ||
92 : | REG_GET_N("curve_compression_high", config->curve_compression_high, 25); | ||
93 : | REG_GET_N("curve_compression_low", config->curve_compression_low, 10); | ||
94 : | REG_GET_N("bitrate_payback_delay", config->bitrate_payback_delay, 240); | ||
95 : | REG_GET_N("bitrate_payback_method", config->bitrate_payback_method, 0); | ||
96 : | REG_GET_S("stats1", config->stats1, CONFIG_2PASS_1_FILE); | ||
97 : | REG_GET_S("stats2", config->stats2, CONFIG_2PASS_2_FILE); | ||
98 : | Isibaar | 3 | |
99 : | h | 30 | REG_GET_N("credits_start", config->credits_start, 0); |
100 : | REG_GET_N("credits_start_begin", config->credits_start_begin, 0); | ||
101 : | REG_GET_N("credits_start_end", config->credits_start_end, 0); | ||
102 : | REG_GET_N("credits_end", config->credits_end, 0); | ||
103 : | REG_GET_N("credits_end_begin", config->credits_end_begin, 0); | ||
104 : | REG_GET_N("credits_end_end", config->credits_end_end, 0); | ||
105 : | Isibaar | 3 | |
106 : | h | 30 | REG_GET_N("credits_mode", config->credits_mode, 0); |
107 : | REG_GET_N("credits_rate", config->credits_rate, 20); | ||
108 : | REG_GET_N("credits_quant_i", config->credits_quant_i, 20); | ||
109 : | REG_GET_N("credits_quant_p", config->credits_quant_p, 20); | ||
110 : | REG_GET_N("credits_start_size", config->credits_start_size, 10000); | ||
111 : | REG_GET_N("credits_end_size", config->credits_end_size, 10000); | ||
112 : | Isibaar | 3 | |
113 : | { | ||
114 : | BYTE default_qmatrix_intra[] = { | ||
115 : | 8, 17,18,19,21,23,25,27, | ||
116 : | 17,18,19,21,23,25,27,28, | ||
117 : | 20,21,22,23,24,26,28,30, | ||
118 : | 21,22,23,24,26,28,30,32, | ||
119 : | 22,23,24,26,28,30,32,35, | ||
120 : | 23,24,26,28,30,32,35,38, | ||
121 : | 25,26,28,30,32,35,38,41, | ||
122 : | 27,28,30,32,35,38,41,45 | ||
123 : | }; | ||
124 : | |||
125 : | BYTE default_qmatrix_inter[] = { | ||
126 : | 16,17,18,19,20,21,22,23, | ||
127 : | 17,18,19,20,21,22,23,24, | ||
128 : | 18,19,20,21,22,23,24,25, | ||
129 : | 19,20,21,22,23,24,26,27, | ||
130 : | 20,21,22,23,25,26,27,28, | ||
131 : | 21,22,23,24,26,27,28,30, | ||
132 : | 22,23,24,26,27,28,30,31, | ||
133 : | 23,24,25,27,28,30,31,33 | ||
134 : | }; | ||
135 : | |||
136 : | h | 30 | REG_GET_B("qmatrix_intra", config->qmatrix_intra, default_qmatrix_intra); |
137 : | REG_GET_B("qmatrix_inter", config->qmatrix_inter, default_qmatrix_inter); | ||
138 : | Isibaar | 3 | } |
139 : | |||
140 : | RegCloseKey(hKey); | ||
141 : | } | ||
142 : | |||
143 : | |||
144 : | /* put config settings in registry */ | ||
145 : | |||
146 : | #define REG_SET_N(X, Y) RegSetValueEx(hKey, X, 0, REG_DWORD, (LPBYTE)&Y, sizeof(int)) | ||
147 : | #define REG_SET_S(X, Y) RegSetValueEx(hKey, X, 0, REG_SZ, Y, lstrlen(Y)+1) | ||
148 : | #define REG_SET_B(X, Y) RegSetValueEx(hKey, X, 0, REG_BINARY, Y, sizeof((Y))) | ||
149 : | |||
150 : | void config_reg_set(CONFIG * config) | ||
151 : | { | ||
152 : | HKEY hKey; | ||
153 : | DWORD dispo; | ||
154 : | |||
155 : | if (RegCreateKeyEx( | ||
156 : | XVID_REG_KEY, | ||
157 : | h | 30 | XVID_REG_PARENT "\\" XVID_REG_CHILD, |
158 : | Isibaar | 3 | 0, |
159 : | XVID_REG_CLASS, | ||
160 : | REG_OPTION_NON_VOLATILE, | ||
161 : | KEY_WRITE, | ||
162 : | 0, | ||
163 : | &hKey, | ||
164 : | &dispo) != ERROR_SUCCESS) | ||
165 : | { | ||
166 : | DEBUG1("Couldn't create XVID_REG_SUBKEY - ", GetLastError()); | ||
167 : | return; | ||
168 : | } | ||
169 : | |||
170 : | REG_SET_N("mode", config->mode); | ||
171 : | REG_SET_N("bitrate", config->bitrate); | ||
172 : | REG_SET_N("quality", config->quality); | ||
173 : | REG_SET_N("quant", config->quant); | ||
174 : | h | 30 | REG_SET_N("rc_buffersize", config->rc_buffersize); |
175 : | Isibaar | 3 | |
176 : | h | 30 | REG_SET_N("motion_search", config->motion_search); |
177 : | REG_SET_N("quant_type", config->quant_type); | ||
178 : | REG_SET_N("fourcc_used", config->fourcc_used); | ||
179 : | REG_SET_N("max_key_interval", config->max_key_interval); | ||
180 : | REG_SET_N("lum_masking", config->lum_masking); | ||
181 : | Isibaar | 3 | |
182 : | REG_SET_N("min_iquant", config->min_iquant); | ||
183 : | REG_SET_N("max_iquant", config->max_iquant); | ||
184 : | h | 30 | REG_SET_N("min_pquant", config->min_pquant); |
185 : | REG_SET_N("max_pquant", config->max_pquant); | ||
186 : | REG_SET_B("qmatrix_intra", config->qmatrix_intra); | ||
187 : | REG_SET_B("qmatrix_inter", config->qmatrix_inter); | ||
188 : | Isibaar | 3 | |
189 : | h | 30 | REG_SET_N("desired_size", config->desired_size); |
190 : | Isibaar | 3 | REG_SET_N("keyframe_boost", config->keyframe_boost); |
191 : | REG_SET_N("min_key_interval", config->min_key_interval); | ||
192 : | h | 30 | REG_SET_N("discard1pass", config->discard1pass); |
193 : | REG_SET_N("dummy2pass", config->dummy2pass); | ||
194 : | REG_SET_N("curve_compression_high", config->curve_compression_high); | ||
195 : | REG_SET_N("curve_compression_low", config->curve_compression_low); | ||
196 : | Isibaar | 3 | REG_SET_N("bitrate_payback_delay", config->bitrate_payback_delay); |
197 : | REG_SET_N("bitrate_payback_method", config->bitrate_payback_method); | ||
198 : | h | 30 | REG_SET_S("stats1", config->stats1); |
199 : | REG_SET_S("stats2", config->stats2); | ||
200 : | Isibaar | 3 | |
201 : | REG_SET_N("credits_start", config->credits_start); | ||
202 : | REG_SET_N("credits_start_begin", config->credits_start_begin); | ||
203 : | REG_SET_N("credits_start_end", config->credits_start_end); | ||
204 : | REG_SET_N("credits_end", config->credits_end); | ||
205 : | REG_SET_N("credits_end_begin", config->credits_end_begin); | ||
206 : | REG_SET_N("credits_end_end", config->credits_end_end); | ||
207 : | |||
208 : | REG_SET_N("credits_mode", config->credits_mode); | ||
209 : | REG_SET_N("credits_rate", config->credits_rate); | ||
210 : | REG_SET_N("credits_quant_i", config->credits_quant_i); | ||
211 : | REG_SET_N("credits_quant_p", config->credits_quant_p); | ||
212 : | REG_SET_N("credits_start_size", config->credits_start_size); | ||
213 : | REG_SET_N("credits_end_size", config->credits_end_size); | ||
214 : | |||
215 : | RegCloseKey(hKey); | ||
216 : | } | ||
217 : | |||
218 : | |||
219 : | h | 30 | /* clear XviD registry key, load defaults */ |
220 : | Isibaar | 3 | |
221 : | h | 30 | void config_reg_default(CONFIG * config) |
222 : | Isibaar | 3 | { |
223 : | h | 30 | HKEY hKey; |
224 : | Isibaar | 3 | |
225 : | h | 30 | if (RegOpenKeyEx(XVID_REG_KEY, XVID_REG_PARENT, 0, KEY_ALL_ACCESS, &hKey)) |
226 : | Isibaar | 3 | { |
227 : | h | 30 | DEBUG1("Couldn't open registry key for deletion - ", GetLastError()); |
228 : | return; | ||
229 : | Isibaar | 3 | } |
230 : | |||
231 : | h | 30 | if (RegDeleteKey(XVID_REG_KEY, XVID_REG_CHILD)) |
232 : | Isibaar | 3 | { |
233 : | h | 30 | DEBUG1("Couldn't delete registry key - ", GetLastError()); |
234 : | return; | ||
235 : | Isibaar | 3 | } |
236 : | |||
237 : | h | 30 | config_reg_get(config); |
238 : | } | ||
239 : | Isibaar | 3 | |
240 : | |||
241 : | h | 30 | /* leaves current config value if dialog item is empty */ |
242 : | Isibaar | 3 | |
243 : | h | 30 | int config_get_int(HWND hDlg, UINT item, int config) |
244 : | { | ||
245 : | BOOL success = FALSE; | ||
246 : | Isibaar | 3 | |
247 : | h | 30 | int tmp = GetDlgItemInt(hDlg, item, &success, FALSE); |
248 : | Isibaar | 3 | |
249 : | h | 30 | return (success) ? tmp : config; |
250 : | Isibaar | 3 | } |
251 : | |||
252 : | |||
253 : | h | 30 | /* downloads data from main dialog */ |
254 : | Isibaar | 3 | |
255 : | h | 30 | void main_download(HWND hDlg, CONFIG * config) |
256 : | Isibaar | 3 | { |
257 : | h | 30 | switch(config->mode) |
258 : | Isibaar | 3 | { |
259 : | h | 30 | default : |
260 : | case DLG_MODE_CBR : | ||
261 : | config->bitrate = config_get_int(hDlg, IDC_VALUE, config->bitrate) * CONFIG_KBPS; | ||
262 : | Isibaar | 3 | break; |
263 : | |||
264 : | h | 30 | case DLG_MODE_VBR_QUAL : |
265 : | config->quality = config_get_int(hDlg, IDC_VALUE, config->quality); | ||
266 : | Isibaar | 3 | break; |
267 : | |||
268 : | h | 30 | case DLG_MODE_VBR_QUANT : |
269 : | config->quant = config_get_int(hDlg, IDC_VALUE, config->quant); | ||
270 : | Isibaar | 3 | break; |
271 : | |||
272 : | h | 30 | case DLG_MODE_2PASS_2_INT : |
273 : | config->desired_size = config_get_int(hDlg, IDC_VALUE, config->desired_size); | ||
274 : | Isibaar | 3 | break; |
275 : | } | ||
276 : | h | 30 | |
277 : | config->mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); | ||
278 : | config->rc_buffersize = config_get_int(hDlg, IDC_CBRBUFFER, config->rc_buffersize); | ||
279 : | Isibaar | 3 | } |
280 : | |||
281 : | |||
282 : | h | 30 | /* updates the edit box */ |
283 : | Isibaar | 3 | |
284 : | h | 30 | void main_value(HWND hDlg, CONFIG* config) |
285 : | Isibaar | 3 | { |
286 : | h | 30 | char* text; |
287 : | Isibaar | 3 | int value; |
288 : | h | 30 | int enabled = TRUE; |
289 : | Isibaar | 3 | |
290 : | h | 30 | switch (config->mode) |
291 : | Isibaar | 3 | { |
292 : | h | 30 | default : |
293 : | enabled = FALSE; | ||
294 : | Isibaar | 3 | |
295 : | h | 30 | case DLG_MODE_CBR : |
296 : | text = "Bitrate (Kbps):"; | ||
297 : | value = config->bitrate / CONFIG_KBPS; | ||
298 : | Isibaar | 3 | break; |
299 : | |||
300 : | h | 30 | case DLG_MODE_VBR_QUAL : |
301 : | text = "Quality:"; | ||
302 : | value = config->quality; | ||
303 : | Isibaar | 3 | break; |
304 : | |||
305 : | h | 30 | case DLG_MODE_VBR_QUANT : |
306 : | text = "Quantizer:"; | ||
307 : | value = config->quant; | ||
308 : | Isibaar | 3 | break; |
309 : | |||
310 : | h | 30 | case DLG_MODE_2PASS_2_INT : |
311 : | text = "Desired size (Kbtyes):"; | ||
312 : | value = config->desired_size; | ||
313 : | Isibaar | 3 | break; |
314 : | } | ||
315 : | h | 30 | |
316 : | SetDlgItemText(hDlg, IDC_VALUE_STATIC, text); | ||
317 : | SetDlgItemInt(hDlg, IDC_VALUE, value, FALSE); | ||
318 : | |||
319 : | EnableWindow(GetDlgItem(hDlg, IDC_VALUE_STATIC), enabled); | ||
320 : | EnableWindow(GetDlgItem(hDlg, IDC_VALUE), enabled); | ||
321 : | EnableWindow(GetDlgItem(hDlg, IDC_CBRBUFFER_STATIC), (config->mode == DLG_MODE_CBR)); | ||
322 : | EnableWindow(GetDlgItem(hDlg, IDC_CBRBUFFER), (config->mode == DLG_MODE_CBR)); | ||
323 : | Isibaar | 3 | } |
324 : | |||
325 : | |||
326 : | /* updates the slider */ | ||
327 : | |||
328 : | h | 30 | void main_slider(HWND hDlg, CONFIG * config) |
329 : | Isibaar | 3 | { |
330 : | char* text; | ||
331 : | long range; | ||
332 : | int pos; | ||
333 : | h | 30 | int enabled = TRUE; |
334 : | Isibaar | 3 | |
335 : | switch (config->mode) | ||
336 : | { | ||
337 : | default : | ||
338 : | h | 30 | enabled = FALSE; |
339 : | |||
340 : | Isibaar | 3 | case DLG_MODE_CBR : |
341 : | text = "Bitrate (Kbps):"; | ||
342 : | range = MAKELONG(0,10000); | ||
343 : | pos = config->bitrate / CONFIG_KBPS; | ||
344 : | break; | ||
345 : | |||
346 : | case DLG_MODE_VBR_QUAL : | ||
347 : | text = "Quality:"; | ||
348 : | range = MAKELONG(0,100); | ||
349 : | pos = config->quality; | ||
350 : | break; | ||
351 : | |||
352 : | case DLG_MODE_VBR_QUANT : | ||
353 : | text = "Quantizer:"; | ||
354 : | range = MAKELONG(1,31); | ||
355 : | pos = config->quant; | ||
356 : | break; | ||
357 : | } | ||
358 : | |||
359 : | SetDlgItemText(hDlg, IDC_SLIDER_STATIC, text); | ||
360 : | SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETRANGE, TRUE, range); | ||
361 : | SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, pos); | ||
362 : | h | 30 | |
363 : | EnableWindow(GetDlgItem(hDlg, IDC_SLIDER_STATIC), enabled); | ||
364 : | EnableWindow(GetDlgItem(hDlg, IDC_SLIDER), enabled); | ||
365 : | Isibaar | 3 | } |
366 : | |||
367 : | |||
368 : | h | 30 | /* load advanced options property sheet */ |
369 : | Isibaar | 3 | |
370 : | h | 30 | void adv_dialog(HWND hParent, CONFIG * config) |
371 : | Isibaar | 3 | { |
372 : | h | 30 | PROPSHEETINFO psi[DLG_COUNT]; |
373 : | PROPSHEETPAGE psp[DLG_COUNT]; | ||
374 : | PROPSHEETHEADER psh; | ||
375 : | CONFIG temp; | ||
376 : | int i; | ||
377 : | Isibaar | 3 | |
378 : | h | 30 | config->save = FALSE; |
379 : | memcpy(&temp, config, sizeof(CONFIG)); | ||
380 : | |||
381 : | for (i=0 ; i<DLG_COUNT ; ++i) | ||
382 : | Isibaar | 3 | { |
383 : | h | 30 | psp[i].dwSize = sizeof(PROPSHEETPAGE); |
384 : | psp[i].dwFlags = 0; | ||
385 : | psp[i].hInstance = hInst; | ||
386 : | psp[i].pfnDlgProc = adv_proc; | ||
387 : | psp[i].lParam = (LPARAM)&psi[i]; | ||
388 : | psp[i].pfnCallback = NULL; | ||
389 : | Isibaar | 3 | |
390 : | h | 30 | psi[i].page = i; |
391 : | psi[i].config = &temp; | ||
392 : | } | ||
393 : | Isibaar | 3 | |
394 : | h | 30 | psp[DLG_GLOBAL].pszTemplate = MAKEINTRESOURCE(IDD_GLOBAL); |
395 : | psp[DLG_QUANT].pszTemplate = MAKEINTRESOURCE(IDD_QUANT); | ||
396 : | psp[DLG_2PASS].pszTemplate = MAKEINTRESOURCE(IDD_2PASS); | ||
397 : | psp[DLG_CREDITS].pszTemplate = MAKEINTRESOURCE(IDD_CREDITS); | ||
398 : | psp[DLG_CPU].pszTemplate = MAKEINTRESOURCE(IDD_CPU); | ||
399 : | |||
400 : | psh.dwSize = sizeof(PROPSHEETHEADER); | ||
401 : | psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW; | ||
402 : | psh.hwndParent = hParent; | ||
403 : | psh.hInstance = hInst; | ||
404 : | psh.pszCaption = (LPSTR) "XviD Configuration"; | ||
405 : | psh.nPages = DLG_COUNT; | ||
406 : | psh.nStartPage = DLG_GLOBAL; | ||
407 : | psh.ppsp = (LPCPROPSHEETPAGE)&psp; | ||
408 : | psh.pfnCallback = NULL; | ||
409 : | |||
410 : | PropertySheet(&psh); | ||
411 : | |||
412 : | if (temp.save) | ||
413 : | { | ||
414 : | memcpy(config, &temp, sizeof(CONFIG)); | ||
415 : | Isibaar | 3 | } |
416 : | h | 30 | } |
417 : | Isibaar | 3 | |
418 : | h | 30 | |
419 : | /* enable/disable advanced controls based on encoder mode */ | ||
420 : | |||
421 : | #define CONTROLDLG(X,Y) EnableWindow(GetDlgItem(hDlg, (X)), (Y)) | ||
422 : | #define ISDLGSET(X) (IsDlgButtonChecked(hDlg, (X)) == BST_CHECKED) | ||
423 : | |||
424 : | void adv_mode(HWND hDlg, int mode) | ||
425 : | { | ||
426 : | // create arrays of controls to be disabled for each mode | ||
427 : | const int cbr_disable[] = { | ||
428 : | IDC_KFBOOST, IDC_MINKEY, IDC_DISCARD1PASS, IDC_DUMMY2PASS, | ||
429 : | IDC_CURVECOMPH, IDC_CURVECOMPL, IDC_PAYBACK, IDC_PAYBACKBIAS, IDC_PAYBACKPROP, | ||
430 : | IDC_STATS1, IDC_STATS1_BROWSE, IDC_STATS2, IDC_STATS2_BROWSE, | ||
431 : | IDC_CREDITS_START, IDC_CREDITS_END, IDC_CREDITS_START_BEGIN, IDC_CREDITS_START_END, | ||
432 : | IDC_CREDITS_END_BEGIN, IDC_CREDITS_END_END, IDC_CREDITS_RATE_RADIO, | ||
433 : | IDC_CREDITS_QUANT_RADIO, IDC_CREDITS_QUANT_STATIC, IDC_CREDITS_SIZE_RADIO, | ||
434 : | IDC_CREDITS_END_STATIC, IDC_CREDITS_RATE, IDC_CREDITS_QUANTI, IDC_CREDITS_QUANTP, | ||
435 : | IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE, | ||
436 : | }; | ||
437 : | |||
438 : | const int qual_disable[] = { | ||
439 : | IDC_KFBOOST, IDC_MINKEY, IDC_DISCARD1PASS, IDC_DUMMY2PASS, | ||
440 : | IDC_CURVECOMPH, IDC_CURVECOMPL, IDC_PAYBACK, IDC_PAYBACKBIAS, IDC_PAYBACKPROP, | ||
441 : | IDC_STATS1, IDC_STATS1_BROWSE, IDC_STATS2, IDC_STATS2_BROWSE, | ||
442 : | IDC_CREDITS_SIZE_RADIO, IDC_CREDITS_END_STATIC, IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE | ||
443 : | }; | ||
444 : | |||
445 : | const int quant_disable[] = { | ||
446 : | IDC_MINIQUANT, IDC_MAXIQUANT, IDC_MINPQUANT, IDC_MAXPQUANT, | ||
447 : | IDC_KFBOOST, IDC_MINKEY, IDC_DISCARD1PASS, IDC_DUMMY2PASS, | ||
448 : | IDC_CURVECOMPH, IDC_CURVECOMPL, IDC_PAYBACK, IDC_PAYBACKBIAS, IDC_PAYBACKPROP, | ||
449 : | IDC_STATS1, IDC_STATS1_BROWSE, IDC_STATS2, IDC_STATS2_BROWSE, | ||
450 : | IDC_CREDITS_SIZE_RADIO, IDC_CREDITS_END_STATIC, IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE | ||
451 : | }; | ||
452 : | |||
453 : | const int twopass1_disable[] = { | ||
454 : | IDC_LUMMASK, IDC_MINIQUANT, IDC_MAXIQUANT, IDC_MINPQUANT, IDC_MAXPQUANT, | ||
455 : | IDC_KFBOOST, IDC_DUMMY2PASS, | ||
456 : | IDC_CURVECOMPH, IDC_CURVECOMPL, IDC_PAYBACK, IDC_PAYBACKBIAS, IDC_PAYBACKPROP, | ||
457 : | IDC_STATS2, IDC_STATS2_BROWSE, | ||
458 : | IDC_CREDITS_RATE_RADIO, IDC_CREDITS_RATE, IDC_CREDITS_SIZE_RADIO, IDC_CREDITS_END_STATIC, | ||
459 : | IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE | ||
460 : | }; | ||
461 : | |||
462 : | const int twopass2_ext_disable[] = { | ||
463 : | IDC_CREDITS_RATE_RADIO, IDC_CREDITS_QUANT_RADIO, IDC_CREDITS_QUANT_STATIC, | ||
464 : | IDC_CREDITS_SIZE_RADIO, IDC_CREDITS_END_STATIC, IDC_CREDITS_RATE, | ||
465 : | IDC_CREDITS_QUANTI, IDC_CREDITS_QUANTP, IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE | ||
466 : | }; | ||
467 : | |||
468 : | const int twopass2_int_disable[] = { | ||
469 : | IDC_STATS2, IDC_STATS2_BROWSE | ||
470 : | }; | ||
471 : | |||
472 : | // store pointers in order so we can lookup using config->mode | ||
473 : | const int* modes[] = { | ||
474 : | cbr_disable, qual_disable, quant_disable, | ||
475 : | twopass1_disable, twopass2_ext_disable, twopass2_int_disable | ||
476 : | }; | ||
477 : | |||
478 : | // ditto modes[] | ||
479 : | const int lengths[] = { | ||
480 : | sizeof(cbr_disable)/sizeof(int), sizeof(qual_disable)/sizeof(int), | ||
481 : | sizeof(quant_disable)/sizeof(int), sizeof(twopass1_disable)/sizeof(int), | ||
482 : | sizeof(twopass2_ext_disable)/sizeof(int), sizeof(twopass2_int_disable)/sizeof(int) | ||
483 : | }; | ||
484 : | |||
485 : | int i; | ||
486 : | |||
487 : | // first perform checkbox-based enable/disable | ||
488 : | CONTROLDLG(IDC_CREDITS_START_BEGIN, ISDLGSET(IDC_CREDITS_START)); | ||
489 : | CONTROLDLG(IDC_CREDITS_START_END, ISDLGSET(IDC_CREDITS_START)); | ||
490 : | |||
491 : | CONTROLDLG(IDC_CREDITS_END_BEGIN, ISDLGSET(IDC_CREDITS_END)); | ||
492 : | CONTROLDLG(IDC_CREDITS_END_END, ISDLGSET(IDC_CREDITS_END)); | ||
493 : | |||
494 : | CONTROLDLG(IDC_CREDITS_RATE, ISDLGSET(IDC_CREDITS_RATE_RADIO)); | ||
495 : | CONTROLDLG(IDC_CREDITS_QUANTI, ISDLGSET(IDC_CREDITS_QUANT_RADIO)); | ||
496 : | CONTROLDLG(IDC_CREDITS_QUANTP, ISDLGSET(IDC_CREDITS_QUANT_RADIO)); | ||
497 : | CONTROLDLG(IDC_CREDITS_START_SIZE, ISDLGSET(IDC_CREDITS_SIZE_RADIO)); | ||
498 : | CONTROLDLG(IDC_CREDITS_END_SIZE, ISDLGSET(IDC_CREDITS_SIZE_RADIO)); | ||
499 : | |||
500 : | CONTROLDLG(IDC_CPU_MMX, ISDLGSET(IDC_CPU_FORCE)); | ||
501 : | CONTROLDLG(IDC_CPU_MMXEXT, ISDLGSET(IDC_CPU_FORCE)); | ||
502 : | CONTROLDLG(IDC_CPU_SSE, ISDLGSET(IDC_CPU_FORCE)); | ||
503 : | CONTROLDLG(IDC_CPU_SSE2, ISDLGSET(IDC_CPU_FORCE)); | ||
504 : | CONTROLDLG(IDC_CPU_3DNOW, ISDLGSET(IDC_CPU_FORCE)); | ||
505 : | CONTROLDLG(IDC_CPU_3DNOWEXT, ISDLGSET(IDC_CPU_FORCE)); | ||
506 : | |||
507 : | // now perform codec mode enable/disable | ||
508 : | for (i=0 ; i<lengths[mode] ; ++i) | ||
509 : | { | ||
510 : | EnableWindow(GetDlgItem(hDlg, modes[mode][i]), FALSE); | ||
511 : | } | ||
512 : | Isibaar | 3 | } |
513 : | |||
514 : | |||
515 : | h | 30 | /* upload config data into dialog */ |
516 : | Isibaar | 3 | |
517 : | h | 30 | void adv_upload(HWND hDlg, int page, CONFIG * config) |
518 : | Isibaar | 3 | { |
519 : | h | 30 | switch (page) |
520 : | { | ||
521 : | case DLG_GLOBAL : | ||
522 : | SendDlgItemMessage(hDlg, IDC_MOTION, CB_SETCURSEL, config->motion_search, 0); | ||
523 : | SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_SETCURSEL, config->quant_type, 0); | ||
524 : | SendDlgItemMessage(hDlg, IDC_FOURCC, CB_SETCURSEL, config->fourcc_used, 0); | ||
525 : | SetDlgItemInt(hDlg, IDC_MAXKEY, config->max_key_interval, FALSE); | ||
526 : | CheckDlgButton(hDlg, IDC_LUMMASK, config->lum_masking ? BST_CHECKED : BST_UNCHECKED); | ||
527 : | break; | ||
528 : | Isibaar | 3 | |
529 : | h | 30 | case DLG_QUANT : |
530 : | SetDlgItemInt(hDlg, IDC_MINIQUANT, config->min_iquant, FALSE); | ||
531 : | SetDlgItemInt(hDlg, IDC_MAXIQUANT, config->max_iquant, FALSE); | ||
532 : | SetDlgItemInt(hDlg, IDC_MINPQUANT, config->min_pquant, FALSE); | ||
533 : | SetDlgItemInt(hDlg, IDC_MAXPQUANT, config->max_pquant, FALSE); | ||
534 : | break; | ||
535 : | Isibaar | 3 | |
536 : | h | 30 | case DLG_2PASS : |
537 : | SetDlgItemInt(hDlg, IDC_KFBOOST, config->keyframe_boost, FALSE); | ||
538 : | SetDlgItemInt(hDlg, IDC_MINKEY, config->min_key_interval, FALSE); | ||
539 : | CheckDlgButton(hDlg, IDC_DISCARD1PASS, config->discard1pass ? BST_CHECKED : BST_UNCHECKED); | ||
540 : | CheckDlgButton(hDlg, IDC_DUMMY2PASS, config->dummy2pass ? BST_CHECKED : BST_UNCHECKED); | ||
541 : | |||
542 : | SetDlgItemInt(hDlg, IDC_CURVECOMPH, config->curve_compression_high, FALSE); | ||
543 : | SetDlgItemInt(hDlg, IDC_CURVECOMPL, config->curve_compression_low, FALSE); | ||
544 : | SetDlgItemInt(hDlg, IDC_PAYBACK, config->bitrate_payback_delay, FALSE); | ||
545 : | CheckDlgButton(hDlg, IDC_PAYBACKBIAS, (config->bitrate_payback_method == 0)); | ||
546 : | CheckDlgButton(hDlg, IDC_PAYBACKPROP, (config->bitrate_payback_method == 1)); | ||
547 : | |||
548 : | SetDlgItemText(hDlg, IDC_STATS1, config->stats1); | ||
549 : | SetDlgItemText(hDlg, IDC_STATS2, config->stats2); | ||
550 : | break; | ||
551 : | |||
552 : | case DLG_CREDITS : | ||
553 : | CheckDlgButton(hDlg, IDC_CREDITS_START, config->credits_start ? BST_CHECKED : BST_UNCHECKED); | ||
554 : | SetDlgItemInt(hDlg, IDC_CREDITS_START_BEGIN, config->credits_start_begin, FALSE); | ||
555 : | SetDlgItemInt(hDlg, IDC_CREDITS_START_END, config->credits_start_end, FALSE); | ||
556 : | CheckDlgButton(hDlg, IDC_CREDITS_END, config->credits_end ? BST_CHECKED : BST_UNCHECKED); | ||
557 : | SetDlgItemInt(hDlg, IDC_CREDITS_END_BEGIN, config->credits_end_begin, FALSE); | ||
558 : | SetDlgItemInt(hDlg, IDC_CREDITS_END_END, config->credits_end_end, FALSE); | ||
559 : | |||
560 : | SetDlgItemInt(hDlg, IDC_CREDITS_RATE, config->credits_rate, FALSE); | ||
561 : | SetDlgItemInt(hDlg, IDC_CREDITS_QUANTI, config->credits_quant_i, FALSE); | ||
562 : | SetDlgItemInt(hDlg, IDC_CREDITS_QUANTP, config->credits_quant_p, FALSE); | ||
563 : | SetDlgItemInt(hDlg, IDC_CREDITS_START_SIZE, config->credits_start_size, FALSE); | ||
564 : | SetDlgItemInt(hDlg, IDC_CREDITS_END_SIZE, config->credits_end_size, FALSE); | ||
565 : | |||
566 : | if (config->credits_mode == CREDITS_MODE_RATE) | ||
567 : | { | ||
568 : | CheckDlgButton(hDlg, IDC_CREDITS_RATE_RADIO, BST_CHECKED); | ||
569 : | } | ||
570 : | else if (config->credits_mode == CREDITS_MODE_QUANT) | ||
571 : | { | ||
572 : | CheckDlgButton(hDlg, IDC_CREDITS_QUANT_RADIO, BST_CHECKED); | ||
573 : | } | ||
574 : | else // CREDITS_MODE_SIZE | ||
575 : | { | ||
576 : | CheckDlgButton(hDlg, IDC_CREDITS_SIZE_RADIO, BST_CHECKED); | ||
577 : | } | ||
578 : | break; | ||
579 : | |||
580 : | case DLG_CPU : | ||
581 : | CheckDlgButton(hDlg, IDC_CPU_MMX, (config->cpu & XVID_CPU_MMX) ? BST_CHECKED : BST_UNCHECKED); | ||
582 : | CheckDlgButton(hDlg, IDC_CPU_MMXEXT, (config->cpu & XVID_CPU_MMXEXT) ? BST_CHECKED : BST_UNCHECKED); | ||
583 : | CheckDlgButton(hDlg, IDC_CPU_SSE, (config->cpu & XVID_CPU_SSE) ? BST_CHECKED : BST_UNCHECKED); | ||
584 : | CheckDlgButton(hDlg, IDC_CPU_SSE2, (config->cpu & XVID_CPU_SSE2) ? BST_CHECKED : BST_UNCHECKED); | ||
585 : | CheckDlgButton(hDlg, IDC_CPU_3DNOW, (config->cpu & XVID_CPU_3DNOW) ? BST_CHECKED : BST_UNCHECKED); | ||
586 : | CheckDlgButton(hDlg, IDC_CPU_3DNOWEXT, (config->cpu & XVID_CPU_3DNOWEXT) ? BST_CHECKED : BST_UNCHECKED); | ||
587 : | |||
588 : | CheckRadioButton(hDlg, IDC_CPU_AUTO, IDC_CPU_FORCE, | ||
589 : | config->cpu & XVID_CPU_FORCE ? IDC_CPU_FORCE : IDC_CPU_AUTO ); | ||
590 : | break; | ||
591 : | Isibaar | 3 | } |
592 : | } | ||
593 : | |||
594 : | |||
595 : | h | 30 | /* download config data from dialog |
596 : | replaces invalid values instead of alerting user for now | ||
597 : | */ | ||
598 : | Isibaar | 3 | |
599 : | h | 30 | #define CONSTRAINVAL(X,Y,Z) if((X)<(Y)) X=Y; if((X)>(Z)) X=Z; |
600 : | |||
601 : | void adv_download(HWND hDlg, int page, CONFIG * config) | ||
602 : | Isibaar | 3 | { |
603 : | h | 30 | switch (page) |
604 : | { | ||
605 : | case DLG_GLOBAL : | ||
606 : | config->motion_search = SendDlgItemMessage(hDlg, IDC_MOTION, CB_GETCURSEL, 0, 0); | ||
607 : | config->quant_type = SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_GETCURSEL, 0, 0); | ||
608 : | config->fourcc_used = SendDlgItemMessage(hDlg, IDC_FOURCC, CB_GETCURSEL, 0, 0); | ||
609 : | config->max_key_interval = config_get_int(hDlg, IDC_MAXKEY, config->max_key_interval); | ||
610 : | config->lum_masking = ISDLGSET(IDC_LUMMASK); | ||
611 : | break; | ||
612 : | Isibaar | 3 | |
613 : | h | 30 | case DLG_QUANT : |
614 : | config->min_iquant = config_get_int(hDlg, IDC_MINIQUANT, config->min_iquant); | ||
615 : | config->max_iquant = config_get_int(hDlg, IDC_MAXIQUANT, config->max_iquant); | ||
616 : | config->min_pquant = config_get_int(hDlg, IDC_MINPQUANT, config->min_pquant); | ||
617 : | config->max_pquant = config_get_int(hDlg, IDC_MAXPQUANT, config->max_pquant); | ||
618 : | Isibaar | 3 | |
619 : | h | 30 | CONSTRAINVAL(config->min_iquant, 1, 31); |
620 : | CONSTRAINVAL(config->max_iquant, config->min_iquant, 31); | ||
621 : | CONSTRAINVAL(config->min_pquant, 1, 31); | ||
622 : | CONSTRAINVAL(config->max_pquant, config->min_pquant, 31); | ||
623 : | break; | ||
624 : | |||
625 : | case DLG_2PASS : | ||
626 : | config->keyframe_boost = GetDlgItemInt(hDlg, IDC_KFBOOST, NULL, FALSE); | ||
627 : | config->min_key_interval = config_get_int(hDlg, IDC_MINKEY, config->min_key_interval); | ||
628 : | config->discard1pass = ISDLGSET(IDC_DISCARD1PASS); | ||
629 : | config->dummy2pass = ISDLGSET(IDC_DUMMY2PASS); | ||
630 : | config->curve_compression_high = GetDlgItemInt(hDlg, IDC_CURVECOMPH, NULL, FALSE); | ||
631 : | config->curve_compression_low = GetDlgItemInt(hDlg, IDC_CURVECOMPL, NULL, FALSE); | ||
632 : | config->bitrate_payback_delay = config_get_int(hDlg, IDC_PAYBACK, config->bitrate_payback_delay); | ||
633 : | config->bitrate_payback_method = ISDLGSET(IDC_PAYBACKPROP); | ||
634 : | |||
635 : | if (GetDlgItemText(hDlg, IDC_STATS1, config->stats1, MAX_PATH) == 0) | ||
636 : | { | ||
637 : | lstrcpy(config->stats1, CONFIG_2PASS_1_FILE); | ||
638 : | } | ||
639 : | if (GetDlgItemText(hDlg, IDC_STATS2, config->stats2, MAX_PATH) == 0) | ||
640 : | { | ||
641 : | lstrcpy(config->stats2, CONFIG_2PASS_2_FILE); | ||
642 : | } | ||
643 : | |||
644 : | CONSTRAINVAL(config->bitrate_payback_delay, 1, 10000); | ||
645 : | CONSTRAINVAL(config->keyframe_boost, 0, 1000); | ||
646 : | CONSTRAINVAL(config->curve_compression_high, 0, 100); | ||
647 : | CONSTRAINVAL(config->curve_compression_low, 0, 100); | ||
648 : | break; | ||
649 : | |||
650 : | case DLG_CREDITS : | ||
651 : | config->credits_start = ISDLGSET(IDC_CREDITS_START); | ||
652 : | config->credits_start_begin = GetDlgItemInt(hDlg, IDC_CREDITS_START_BEGIN, NULL, FALSE); | ||
653 : | config->credits_start_end = config_get_int(hDlg, IDC_CREDITS_START_END, config->credits_start_end); | ||
654 : | config->credits_end = ISDLGSET(IDC_CREDITS_END); | ||
655 : | config->credits_end_begin = config_get_int(hDlg, IDC_CREDITS_END_BEGIN, config->credits_end_begin); | ||
656 : | config->credits_end_end = config_get_int(hDlg, IDC_CREDITS_END_END, config->credits_end_end); | ||
657 : | |||
658 : | config->credits_rate = config_get_int(hDlg, IDC_CREDITS_RATE, config->credits_rate); | ||
659 : | config->credits_quant_i = config_get_int(hDlg, IDC_CREDITS_QUANTI, config->credits_quant_i); | ||
660 : | config->credits_quant_p = config_get_int(hDlg, IDC_CREDITS_QUANTP, config->credits_quant_p); | ||
661 : | config->credits_start_size = config_get_int(hDlg, IDC_CREDITS_START_SIZE, config->credits_start_size); | ||
662 : | config->credits_end_size = config_get_int(hDlg, IDC_CREDITS_END_SIZE, config->credits_end_size); | ||
663 : | |||
664 : | config->credits_mode = 0; | ||
665 : | config->credits_mode = ISDLGSET(IDC_CREDITS_RATE_RADIO) ? CREDITS_MODE_RATE : config->credits_mode; | ||
666 : | config->credits_mode = ISDLGSET(IDC_CREDITS_QUANT_RADIO) ? CREDITS_MODE_QUANT : config->credits_mode; | ||
667 : | config->credits_mode = ISDLGSET(IDC_CREDITS_SIZE_RADIO) ? CREDITS_MODE_SIZE : config->credits_mode; | ||
668 : | |||
669 : | CONSTRAINVAL(config->credits_rate, 1, 100); | ||
670 : | CONSTRAINVAL(config->credits_quant_i, 1, 31); | ||
671 : | CONSTRAINVAL(config->credits_quant_p, 1, 31); | ||
672 : | |||
673 : | if (config->credits_start_begin > config->credits_start_end) | ||
674 : | { | ||
675 : | config->credits_start_begin = config->credits_start_end; | ||
676 : | config->credits_start = 0; | ||
677 : | } | ||
678 : | if (config->credits_end_begin > config->credits_end_end) | ||
679 : | { | ||
680 : | config->credits_end_begin = config->credits_end_end; | ||
681 : | config->credits_end = 0; | ||
682 : | } | ||
683 : | break; | ||
684 : | |||
685 : | case DLG_CPU : | ||
686 : | config->cpu = 0; | ||
687 : | config->cpu |= ISDLGSET(IDC_CPU_MMX) ? XVID_CPU_MMX : 0; | ||
688 : | config->cpu |= ISDLGSET(IDC_CPU_MMXEXT) ? XVID_CPU_MMXEXT: 0; | ||
689 : | config->cpu |= ISDLGSET(IDC_CPU_SSE) ? XVID_CPU_SSE: 0; | ||
690 : | config->cpu |= ISDLGSET(IDC_CPU_SSE2) ? XVID_CPU_SSE2: 0; | ||
691 : | config->cpu |= ISDLGSET(IDC_CPU_3DNOW) ? XVID_CPU_3DNOW: 0; | ||
692 : | config->cpu |= ISDLGSET(IDC_CPU_3DNOWEXT) ? XVID_CPU_3DNOWEXT: 0; | ||
693 : | config->cpu |= ISDLGSET(IDC_CPU_FORCE) ? XVID_CPU_FORCE : 0; | ||
694 : | break; | ||
695 : | } | ||
696 : | Isibaar | 3 | } |
697 : | |||
698 : | |||
699 : | void quant_upload(HWND hDlg, CONFIG* config) | ||
700 : | { | ||
701 : | int i; | ||
702 : | |||
703 : | for (i=0 ; i<64 ; ++i) | ||
704 : | { | ||
705 : | SetDlgItemInt(hDlg, IDC_QINTRA00 + i, config->qmatrix_intra[i], FALSE); | ||
706 : | SetDlgItemInt(hDlg, IDC_QINTER00 + i, config->qmatrix_inter[i], FALSE); | ||
707 : | } | ||
708 : | } | ||
709 : | |||
710 : | |||
711 : | void quant_download(HWND hDlg, CONFIG* config) | ||
712 : | { | ||
713 : | int i; | ||
714 : | |||
715 : | for (i=0 ; i<64 ; ++i) | ||
716 : | { | ||
717 : | h | 30 | int temp; |
718 : | Isibaar | 3 | |
719 : | h | 30 | temp = config_get_int(hDlg, i + IDC_QINTRA00, config->qmatrix_intra[i]); |
720 : | CONSTRAINVAL(temp, 1, 255); | ||
721 : | temp = config->qmatrix_intra[i]; | ||
722 : | |||
723 : | temp = config_get_int(hDlg, i + IDC_QINTER00, config->qmatrix_inter[i]); | ||
724 : | CONSTRAINVAL(temp, 1, 255); | ||
725 : | temp = config->qmatrix_inter[i]; | ||
726 : | Isibaar | 3 | } |
727 : | } | ||
728 : | |||
729 : | h | 30 | /* monitor mouse events to dialog controls for help text */ |
730 : | Isibaar | 3 | |
731 : | h | 30 | HHOOK hHook; |
732 : | HWND hParent; | ||
733 : | Isibaar | 3 | |
734 : | h | 30 | LRESULT CALLBACK msg_proc(int nCode, WPARAM wParam, LPARAM lParam) |
735 : | Isibaar | 3 | { |
736 : | h | 30 | MSG* pmsg = (MSG *)lParam; |
737 : | Isibaar | 3 | |
738 : | h | 30 | if (pmsg->message == WM_MOUSEMOVE) |
739 : | Isibaar | 3 | { |
740 : | h | 30 | if (pmsg->hwnd == hParent) |
741 : | Isibaar | 3 | { |
742 : | h | 30 | SetDlgItemText(hParent, IDC_STATIC_HELP, XVID_HELP); |
743 : | } | ||
744 : | else if (IsChild(hParent, pmsg->hwnd)) | ||
745 : | { | ||
746 : | char *message; | ||
747 : | char help[500]; | ||
748 : | Isibaar | 3 | |
749 : | h | 30 | int mode = SendDlgItemMessage(hParent, IDC_MODE, CB_GETCURSEL, 0, 0); |
750 : | int item = GetDlgCtrlID(pmsg->hwnd); | ||
751 : | Isibaar | 3 | |
752 : | h | 30 | if (item == IDC_VALUE || item == IDC_SLIDER) |
753 : | { | ||
754 : | switch (mode) | ||
755 : | { | ||
756 : | case DLG_MODE_2PASS_2_INT : | ||
757 : | if (item == IDC_VALUE) | ||
758 : | { | ||
759 : | message = "Set the desired video size in Kilobytes"; | ||
760 : | break; | ||
761 : | } | ||
762 : | default : | ||
763 : | case DLG_MODE_CBR : | ||
764 : | message = "Set the target video bitrate"; | ||
765 : | break; | ||
766 : | Isibaar | 3 | |
767 : | h | 30 | case DLG_MODE_VBR_QUAL : |
768 : | message = "Set the target video quality"; | ||
769 : | break; | ||
770 : | Isibaar | 3 | |
771 : | h | 30 | case DLG_MODE_VBR_QUANT : |
772 : | message = "Set the fixed quantizer for encoding"; | ||
773 : | break; | ||
774 : | } | ||
775 : | lstrcpy(help, message); | ||
776 : | } | ||
777 : | else if (!LoadString(hInst, GetDlgCtrlID(pmsg->hwnd), help, 500)) | ||
778 : | Isibaar | 3 | { |
779 : | h | 30 | lstrcpy(help, XVID_HELP); |
780 : | } | ||
781 : | Isibaar | 3 | |
782 : | h | 30 | SetDlgItemText(hParent, IDC_STATIC_HELP, help); |
783 : | } | ||
784 : | } | ||
785 : | Isibaar | 3 | |
786 : | h | 30 | return (CallNextHookEx(hHook, nCode, wParam, lParam)); |
787 : | } | ||
788 : | Isibaar | 3 | |
789 : | |||
790 : | h | 30 | /* main dialog proc */ |
791 : | Isibaar | 3 | |
792 : | h | 30 | BOOL CALLBACK main_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
793 : | { | ||
794 : | CONFIG* config = (CONFIG*)GetWindowLong(hDlg, GWL_USERDATA); | ||
795 : | |||
796 : | switch (uMsg) | ||
797 : | { | ||
798 : | case WM_INITDIALOG : | ||
799 : | SetWindowLong(hDlg, GWL_USERDATA, lParam); | ||
800 : | |||
801 : | config = (CONFIG*)lParam; | ||
802 : | |||
803 : | SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"1 Pass - CBR"); | ||
804 : | SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"1 Pass - quality"); | ||
805 : | SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"1 Pass - quantizer"); | ||
806 : | SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"2 Pass - 1st pass"); | ||
807 : | SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"2 Pass - 2nd pass Ext."); | ||
808 : | SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"2 Pass - 2nd pass Int."); | ||
809 : | SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"Null - test speed"); | ||
810 : | |||
811 : | SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); | ||
812 : | SetDlgItemInt(hDlg, IDC_CBRBUFFER, config->rc_buffersize, FALSE); | ||
813 : | SetDlgItemText(hDlg, IDC_STATIC_HELP, XVID_HELP); | ||
814 : | |||
815 : | hHook = SetWindowsHookEx(WH_GETMESSAGE, msg_proc, 0, GetCurrentThreadId()); | ||
816 : | |||
817 : | main_slider(hDlg, config); | ||
818 : | main_value(hDlg, config); | ||
819 : | break; | ||
820 : | |||
821 : | case WM_ACTIVATE : | ||
822 : | if (LOWORD(wParam) != WA_INACTIVE) | ||
823 : | { | ||
824 : | hParent = hDlg; | ||
825 : | Isibaar | 3 | } |
826 : | h | 30 | return 0; |
827 : | Isibaar | 3 | |
828 : | h | 30 | case WM_DESTROY : |
829 : | UnhookWindowsHookEx(hHook); | ||
830 : | Isibaar | 3 | break; |
831 : | |||
832 : | h | 30 | case WM_HSCROLL : |
833 : | if((HWND)lParam == GetDlgItem(hDlg, IDC_SLIDER)) | ||
834 : | Isibaar | 3 | { |
835 : | h | 30 | SetDlgItemInt(hDlg, IDC_VALUE, SendMessage((HWND)lParam, TBM_GETPOS, 0, 0), FALSE); |
836 : | Isibaar | 3 | } |
837 : | h | 30 | else |
838 : | { | ||
839 : | return 0; | ||
840 : | } | ||
841 : | break; | ||
842 : | Isibaar | 3 | |
843 : | case WM_COMMAND : | ||
844 : | if (LOWORD(wParam) == IDC_MODE && HIWORD(wParam) == LBN_SELCHANGE) | ||
845 : | { | ||
846 : | h | 30 | main_download(hDlg, config); |
847 : | main_slider(hDlg, config); | ||
848 : | main_value(hDlg, config); | ||
849 : | Isibaar | 3 | } |
850 : | h | 30 | else if (LOWORD(wParam) == IDC_ADVANCED && HIWORD(wParam) == BN_CLICKED) |
851 : | Isibaar | 3 | { |
852 : | h | 30 | adv_dialog(hDlg, config); |
853 : | |||
854 : | if (config->save) | ||
855 : | { | ||
856 : | config_reg_set(config); | ||
857 : | } | ||
858 : | Isibaar | 3 | } |
859 : | else if (HIWORD(wParam) == EN_UPDATE && LOWORD(wParam) == IDC_VALUE) | ||
860 : | { | ||
861 : | int value = config_get_int(hDlg, IDC_VALUE, 1); | ||
862 : | int max = 1; | ||
863 : | |||
864 : | h | 30 | max = (config->mode == DLG_MODE_CBR) ? 10000 : |
865 : | ((config->mode == DLG_MODE_VBR_QUAL) ? 100 : | ||
866 : | ((config->mode == DLG_MODE_VBR_QUANT) ? 31 : 1<<30)); | ||
867 : | Isibaar | 3 | |
868 : | if (value < 1) | ||
869 : | { | ||
870 : | value = 1; | ||
871 : | } | ||
872 : | if (value > max) | ||
873 : | { | ||
874 : | value = max; | ||
875 : | SetDlgItemInt(hDlg, IDC_VALUE, value, FALSE); | ||
876 : | } | ||
877 : | |||
878 : | h | 30 | if (config->mode != DLG_MODE_2PASS_2_INT) |
879 : | Isibaar | 3 | { |
880 : | h | 30 | SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, value); |
881 : | Isibaar | 3 | } |
882 : | } | ||
883 : | h | 30 | else if (LOWORD(wParam) == IDOK && HIWORD(wParam) == BN_CLICKED) |
884 : | Isibaar | 3 | { |
885 : | h | 30 | main_download(hDlg, config); |
886 : | config->save = TRUE; | ||
887 : | EndDialog(hDlg, IDOK); | ||
888 : | Isibaar | 3 | } |
889 : | h | 30 | else if (LOWORD(wParam) == IDCANCEL) |
890 : | Isibaar | 3 | { |
891 : | h | 30 | config->save = FALSE; |
892 : | EndDialog(hDlg, IDCANCEL); | ||
893 : | Isibaar | 3 | } |
894 : | break; | ||
895 : | |||
896 : | default : | ||
897 : | return 0; | ||
898 : | } | ||
899 : | |||
900 : | return 1; | ||
901 : | } | ||
902 : | |||
903 : | |||
904 : | h | 30 | /* advanced dialog proc */ |
905 : | Isibaar | 3 | |
906 : | h | 30 | BOOL CALLBACK adv_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
907 : | Isibaar | 3 | { |
908 : | h | 30 | PROPSHEETINFO *psi; |
909 : | Isibaar | 3 | |
910 : | h | 30 | psi = (PROPSHEETINFO*)GetWindowLong(hDlg, GWL_USERDATA); |
911 : | |||
912 : | Isibaar | 3 | switch (uMsg) |
913 : | { | ||
914 : | case WM_INITDIALOG : | ||
915 : | h | 30 | psi = (PROPSHEETINFO*) ((LPPROPSHEETPAGE)lParam)->lParam; |
916 : | Isibaar | 3 | |
917 : | h | 30 | SetWindowLong(hDlg, GWL_USERDATA, (LPARAM)psi); |
918 : | Isibaar | 3 | |
919 : | h | 30 | if (psi->page == DLG_GLOBAL) |
920 : | Isibaar | 3 | { |
921 : | h | 30 | SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"0 - None"); |
922 : | SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"1 - Very Low"); | ||
923 : | SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"2 - Low"); | ||
924 : | SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"3 - Medium"); | ||
925 : | SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"4 - High"); | ||
926 : | SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"5 - Very High"); | ||
927 : | SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"6 - Ultra High"); | ||
928 : | Isibaar | 3 | |
929 : | h | 30 | SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"H.263"); |
930 : | SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG"); | ||
931 : | SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG-Custom"); | ||
932 : | SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"Modulated"); | ||
933 : | Isibaar | 3 | |
934 : | h | 30 | SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"XVID"); |
935 : | SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DIVX"); | ||
936 : | SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DX50"); | ||
937 : | Isibaar | 3 | } |
938 : | |||
939 : | h | 30 | SetDlgItemText(hDlg, IDC_STATIC_HELP, XVID_HELP); |
940 : | adv_upload(hDlg, psi->page, psi->config); | ||
941 : | adv_mode(hDlg, psi->config->mode); | ||
942 : | Isibaar | 3 | break; |
943 : | |||
944 : | case WM_COMMAND : | ||
945 : | h | 30 | if (HIWORD(wParam) == BN_CLICKED) |
946 : | Isibaar | 3 | { |
947 : | switch (LOWORD(wParam)) | ||
948 : | { | ||
949 : | case IDC_CREDITS_START : | ||
950 : | case IDC_CREDITS_END : | ||
951 : | case IDC_CREDITS_RATE_RADIO : | ||
952 : | case IDC_CREDITS_QUANT_RADIO : | ||
953 : | case IDC_CREDITS_SIZE_RADIO : | ||
954 : | h | 30 | case IDC_CPU_AUTO : |
955 : | case IDC_CPU_FORCE : | ||
956 : | adv_mode(hDlg, psi->config->mode); | ||
957 : | Isibaar | 3 | break; |
958 : | h | 30 | } |
959 : | } | ||
960 : | if ((LOWORD(wParam) == IDC_STATS1_BROWSE || LOWORD(wParam) == IDC_STATS2_BROWSE) && HIWORD(wParam) == BN_CLICKED) | ||
961 : | { | ||
962 : | OPENFILENAME ofn; | ||
963 : | char tmp[MAX_PATH]; | ||
964 : | int hComponent = (LOWORD(wParam) == IDC_STATS1_BROWSE ? IDC_STATS1 : IDC_STATS2); | ||
965 : | Isibaar | 3 | |
966 : | h | 30 | GetDlgItemText(hDlg, hComponent, tmp, MAX_PATH); |
967 : | Isibaar | 3 | |
968 : | h | 30 | memset(&ofn, 0, sizeof(OPENFILENAME)); |
969 : | ofn.lStructSize = sizeof(OPENFILENAME); | ||
970 : | Isibaar | 3 | |
971 : | h | 30 | ofn.hwndOwner = hDlg; |
972 : | ofn.lpstrFilter = "bitrate curve (*.stats)\0*.stats\0All files (*.*)\0*.*\0\0"; | ||
973 : | ofn.lpstrFile = tmp; | ||
974 : | ofn.nMaxFile = MAX_PATH; | ||
975 : | ofn.Flags = OFN_PATHMUSTEXIST; | ||
976 : | Isibaar | 3 | |
977 : | h | 30 | // display save box for stats1 using 1st-pass |
978 : | if (LOWORD(wParam) == IDC_STATS1_BROWSE && | ||
979 : | psi->config->mode == DLG_MODE_2PASS_1) | ||
980 : | { | ||
981 : | ofn.Flags |= OFN_OVERWRITEPROMPT; | ||
982 : | if (GetSaveFileName(&ofn)) | ||
983 : | Isibaar | 3 | { |
984 : | h | 30 | SetDlgItemText(hDlg, hComponent, tmp); |
985 : | Isibaar | 3 | } |
986 : | h | 30 | } |
987 : | else | ||
988 : | { | ||
989 : | ofn.Flags |= OFN_FILEMUSTEXIST; | ||
990 : | if (GetOpenFileName(&ofn)) { | ||
991 : | SetDlgItemText(hDlg, hComponent, tmp); | ||
992 : | Isibaar | 3 | } |
993 : | } | ||
994 : | } | ||
995 : | h | 30 | else if (LOWORD(wParam) == IDC_QUANTMATRIX && HIWORD(wParam) == BN_CLICKED) |
996 : | { | ||
997 : | DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_QUANTMATRIX), hDlg, quantmatrix_proc, (LPARAM)psi->config); | ||
998 : | } | ||
999 : | Isibaar | 3 | break; |
1000 : | |||
1001 : | h | 30 | case WM_NOTIFY : |
1002 : | switch (((NMHDR *)lParam)->code) | ||
1003 : | Isibaar | 3 | { |
1004 : | h | 30 | case PSN_SETACTIVE : |
1005 : | hParent = hDlg; | ||
1006 : | break; | ||
1007 : | Isibaar | 3 | |
1008 : | h | 30 | case PSN_KILLACTIVE : |
1009 : | /* validate */ | ||
1010 : | adv_download(hDlg, psi->page, psi->config); | ||
1011 : | SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); | ||
1012 : | break; | ||
1013 : | Isibaar | 3 | |
1014 : | h | 30 | case PSN_APPLY : |
1015 : | /* apply */ | ||
1016 : | adv_download(hDlg, psi->page, psi->config); | ||
1017 : | SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); | ||
1018 : | psi->config->save = TRUE; | ||
1019 : | break; | ||
1020 : | Isibaar | 3 | } |
1021 : | break; | ||
1022 : | |||
1023 : | default : | ||
1024 : | return 0; | ||
1025 : | } | ||
1026 : | |||
1027 : | return 1; | ||
1028 : | } | ||
1029 : | |||
1030 : | |||
1031 : | /* quantization matrix dialog proc */ | ||
1032 : | |||
1033 : | BOOL CALLBACK quantmatrix_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) | ||
1034 : | { | ||
1035 : | CONFIG* config = (CONFIG*)GetWindowLong(hDlg, GWL_USERDATA); | ||
1036 : | |||
1037 : | switch (uMsg) | ||
1038 : | { | ||
1039 : | case WM_INITDIALOG : | ||
1040 : | SetWindowLong(hDlg, GWL_USERDATA, lParam); | ||
1041 : | config = (CONFIG*)lParam; | ||
1042 : | quant_upload(hDlg, config); | ||
1043 : | break; | ||
1044 : | |||
1045 : | h | 30 | case WM_ACTIVATE : |
1046 : | if (LOWORD(wParam) != WA_INACTIVE) | ||
1047 : | { | ||
1048 : | hParent = hDlg; | ||
1049 : | } | ||
1050 : | return 0; | ||
1051 : | |||
1052 : | Isibaar | 3 | case WM_COMMAND : |
1053 : | if (LOWORD(wParam) == IDOK && HIWORD(wParam) == BN_CLICKED) | ||
1054 : | { | ||
1055 : | quant_download(hDlg, config); | ||
1056 : | EndDialog(hDlg, IDOK); | ||
1057 : | } | ||
1058 : | else if (LOWORD(wParam) == IDCANCEL) | ||
1059 : | { | ||
1060 : | EndDialog(hDlg, IDCANCEL); | ||
1061 : | } | ||
1062 : | else if ((LOWORD(wParam) == IDC_LOAD || LOWORD(wParam) == IDC_SAVE) && HIWORD(wParam) == BN_CLICKED) | ||
1063 : | { | ||
1064 : | OPENFILENAME ofn; | ||
1065 : | char file[MAX_PATH]; | ||
1066 : | |||
1067 : | HANDLE hFile; | ||
1068 : | DWORD read=128, wrote=0; | ||
1069 : | BYTE quant_data[128]; | ||
1070 : | |||
1071 : | strcpy(file, "\\matrix"); | ||
1072 : | memset(&ofn, 0, sizeof(OPENFILENAME)); | ||
1073 : | ofn.lStructSize = sizeof(OPENFILENAME); | ||
1074 : | |||
1075 : | ofn.hwndOwner = hDlg; | ||
1076 : | ofn.lpstrFilter = "All files (*.*)\0*.*\0\0"; | ||
1077 : | ofn.lpstrFile = file; | ||
1078 : | ofn.nMaxFile = MAX_PATH; | ||
1079 : | ofn.Flags = OFN_PATHMUSTEXIST; | ||
1080 : | |||
1081 : | if (LOWORD(wParam) == IDC_SAVE) | ||
1082 : | { | ||
1083 : | ofn.Flags |= OFN_OVERWRITEPROMPT; | ||
1084 : | if (GetSaveFileName(&ofn)) | ||
1085 : | { | ||
1086 : | hFile = CreateFile(file, GENERIC_WRITE, 0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); | ||
1087 : | |||
1088 : | quant_download(hDlg, config); | ||
1089 : | memcpy(quant_data, config->qmatrix_intra, 64); | ||
1090 : | memcpy(quant_data+64, config->qmatrix_inter, 64); | ||
1091 : | |||
1092 : | if (hFile == INVALID_HANDLE_VALUE) | ||
1093 : | { | ||
1094 : | DEBUG("Couldn't save quant matrix"); | ||
1095 : | } | ||
1096 : | else | ||
1097 : | { | ||
1098 : | if (!WriteFile(hFile, quant_data, 128, &wrote, 0)) | ||
1099 : | { | ||
1100 : | DEBUG("Couldnt write quant matrix"); | ||
1101 : | } | ||
1102 : | } | ||
1103 : | |||
1104 : | CloseHandle(hFile); | ||
1105 : | } | ||
1106 : | } | ||
1107 : | else | ||
1108 : | { | ||
1109 : | ofn.Flags |= OFN_FILEMUSTEXIST; | ||
1110 : | if (GetOpenFileName(&ofn)) | ||
1111 : | { | ||
1112 : | hFile = CreateFile(file, GENERIC_READ, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); | ||
1113 : | |||
1114 : | if (hFile == INVALID_HANDLE_VALUE) | ||
1115 : | { | ||
1116 : | DEBUG("Couldn't load quant matrix"); | ||
1117 : | } | ||
1118 : | else | ||
1119 : | { | ||
1120 : | if (!ReadFile(hFile, quant_data, 128, &read, 0)) | ||
1121 : | { | ||
1122 : | DEBUG("Couldnt read quant matrix"); | ||
1123 : | } | ||
1124 : | else | ||
1125 : | { | ||
1126 : | memcpy(config->qmatrix_intra, quant_data, 64); | ||
1127 : | memcpy(config->qmatrix_inter, quant_data+64, 64); | ||
1128 : | quant_upload(hDlg, config); | ||
1129 : | } | ||
1130 : | } | ||
1131 : | |||
1132 : | CloseHandle(hFile); | ||
1133 : | } | ||
1134 : | } | ||
1135 : | } | ||
1136 : | break; | ||
1137 : | |||
1138 : | default : | ||
1139 : | return 0; | ||
1140 : | } | ||
1141 : | |||
1142 : | return 1; | ||
1143 : | } | ||
1144 : | h | 30 | |
1145 : | |||
1146 : | /* about dialog proc */ | ||
1147 : | |||
1148 : | BOOL CALLBACK about_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) | ||
1149 : | { | ||
1150 : | switch (uMsg) | ||
1151 : | { | ||
1152 : | case WM_INITDIALOG : | ||
1153 : | { | ||
1154 : | XVID_INIT_PARAM init_param; | ||
1155 : | char core[100]; | ||
1156 : | HFONT hFont; | ||
1157 : | LOGFONT lfData; | ||
1158 : | |||
1159 : | SetDlgItemText(hDlg, IDC_BUILD, __TIME__ ", " __DATE__); | ||
1160 : | |||
1161 : | xvid_init(NULL, 0, &init_param, 0); | ||
1162 : | wsprintf(core, "Core Version %d.%d", (init_param.api_version>>16),(init_param.api_version&0xFFFFU)); | ||
1163 : | SetDlgItemText(hDlg, IDC_CORE, core); | ||
1164 : | |||
1165 : | hFont = (HFONT)SendDlgItemMessage(hDlg, IDC_WEBSITE, WM_GETFONT, 0, 0L); | ||
1166 : | |||
1167 : | if (GetObject(hFont, sizeof(LOGFONT), &lfData)) | ||
1168 : | { | ||
1169 : | lfData.lfUnderline = 1; | ||
1170 : | |||
1171 : | hFont = CreateFontIndirect(&lfData); | ||
1172 : | if (hFont) | ||
1173 : | { | ||
1174 : | SendDlgItemMessage(hDlg, IDC_WEBSITE, WM_SETFONT, (WPARAM)hFont, 1L); | ||
1175 : | } | ||
1176 : | } | ||
1177 : | |||
1178 : | SetClassLong(GetDlgItem(hDlg, IDC_WEBSITE), GCL_HCURSOR, (LONG)LoadCursor(NULL, IDC_HAND)); | ||
1179 : | SetDlgItemText(hDlg, IDC_WEBSITE, XVID_WEBSITE); | ||
1180 : | } | ||
1181 : | break; | ||
1182 : | |||
1183 : | case WM_CTLCOLORSTATIC : | ||
1184 : | if ((HWND)lParam == GetDlgItem(hDlg, IDC_WEBSITE)) | ||
1185 : | { | ||
1186 : | SetBkMode((HDC)wParam, TRANSPARENT) ; | ||
1187 : | SetTextColor((HDC)wParam, RGB(0x00,0x00,0xc0)); | ||
1188 : | return (BOOL)GetStockObject(NULL_BRUSH); | ||
1189 : | } | ||
1190 : | return 0; | ||
1191 : | |||
1192 : | case WM_COMMAND : | ||
1193 : | if (LOWORD(wParam) == IDC_WEBSITE && HIWORD(wParam) == STN_CLICKED) | ||
1194 : | { | ||
1195 : | ShellExecute(hDlg, "open", XVID_WEBSITE, NULL, NULL, SW_SHOWNORMAL); | ||
1196 : | } | ||
1197 : | else if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) | ||
1198 : | { | ||
1199 : | EndDialog(hDlg, LOWORD(wParam)); | ||
1200 : | } | ||
1201 : | break; | ||
1202 : | |||
1203 : | default : | ||
1204 : | return 0; | ||
1205 : | } | ||
1206 : | |||
1207 : | return 1; | ||
1208 : | } |
No admin address has been configured | ViewVC Help |
Powered by ViewVC 1.0.4 |