[svn] / trunk / vfw / src / config.c Repository:
ViewVC logotype

Annotation of /trunk/vfw/src/config.c

Parent Directory Parent Directory | Revision Log Revision Log


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

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4