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

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