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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 30, Sat Mar 16 11:40:48 2002 UTC revision 64, Sun Mar 24 05:47:48 2002 UTC
# Line 23  Line 23 
23   *   *
24   *      History:   *      History:
25   *   *
26     *      24.03.2002      daniel smith <danielsmith@astroboymail.com>
27     *                              added Foxer's new CBR engine
28     *                              - cbr_buffer is being used as reaction delay (quick hack)
29     *      23.03.2002      daniel smith <danielsmith@astroboymail.com>
30     *                              added load defaults button
31     *                              merged foxer's alternative 2-pass code (2-pass alt tab)
32     *                              added proper tooltips
33     *                              moved registry data into reg_ints/reg_strs arrays
34     *                              added DEBUGERR output on errors instead of returning
35   *      16.03.2002      daniel smith <danielsmith@astroboymail.com>   *      16.03.2002      daniel smith <danielsmith@astroboymail.com>
36   *                              rewrote/restructured most of file   *                              rewrote/restructured most of file
37   *                              added tooltips (kind of - dirty message hook method)   *                              added tooltips (kind of - dirty message hook method)
# Line 49  Line 58 
58  #include "resource.h"  #include "resource.h"
59    
60    
61    /* registry info structs */
62    
63    CONFIG reg;
64    
65    REG_INT const reg_ints[] = {
66            {"mode",                                        &reg.mode,                                              DLG_MODE_CBR},
67            {"bitrate",                                     &reg.bitrate,                                   900000},
68            {"quality",                                     &reg.quality,                                   85},
69            {"quant",                                       &reg.quant,                                             5},
70            {"rc_buffersize",                       &reg.rc_buffersize,                             16},
71    
72            {"motion_search",                       &reg.motion_search,                             5},
73            {"quant_type",                          &reg.quant_type,                                0},
74            {"fourcc_used",                         &reg.fourcc_used,                               0},
75            {"max_key_interval",            &reg.max_key_interval,                  300},
76            {"lum_masking",                         &reg.lum_masking,                               0},
77    
78            {"min_iquant",                          &reg.min_iquant,                                1},
79            {"max_iquant",                          &reg.max_iquant,                                31},
80            {"min_pquant",                          &reg.min_pquant,                                1},
81            {"max_pquant",                          &reg.max_pquant,                                31},
82    
83            {"desired_size",                        &reg.desired_size,                              570000},
84            {"keyframe_boost",                      &reg.keyframe_boost,                    20},
85            {"min_key_interval",            &reg.min_key_interval,                  6},
86            {"discard1pass",                        &reg.discard1pass,                              1},
87            {"dummy2pass",                          &reg.dummy2pass,                                0},
88            {"curve_compression_high",      &reg.curve_compression_high,    25},
89            {"curve_compression_low",       &reg.curve_compression_low,             10},
90            {"use_alt_curve",                       &reg.use_alt_curve,                             0},
91            {"alt_curve_use_auto",          &reg.alt_curve_use_auto,                1},
92            {"alt_curve_auto_str",          &reg.alt_curve_auto_str,                50},
93            {"alt_curve_use_auto_bonus_bias",       &reg.alt_curve_use_auto_bonus_bias,     1},
94            {"alt_curve_bonus_bias",        &reg.alt_curve_bonus_bias,              50},
95            {"alt_curve_type",                      &reg.alt_curve_type,                    1},
96            {"alt_curve_high_dist",         &reg.alt_curve_high_dist,               300},
97            {"alt_curve_low_dist",          &reg.alt_curve_low_dist,                300},
98            {"alt_curve_min_rel_qual",      &reg.alt_curve_min_rel_qual,    50},
99            {"bitrate_payback_delay",       &reg.bitrate_payback_delay,             240},
100            {"bitrate_payback_method",      &reg.bitrate_payback_method,    0},
101    
102            {"credits_start",                       &reg.credits_start,                             0},
103            {"credits_start_begin",         &reg.credits_start_begin,               0},
104            {"credits_start_end",           &reg.credits_start_end,                 0},
105            {"credits_end",                         &reg.credits_end,                               0},
106            {"credits_end_begin",           &reg.credits_end_begin,                 0},
107            {"credits_end_end",                     &reg.credits_end_end,                   0},
108    
109            {"credits_mode",                        &reg.credits_mode,                              0},
110            {"credits_rate",                        &reg.credits_rate,                              20},
111            {"credits_quant_i",                     &reg.credits_quant_i,                   20},
112            {"credits_quant_p",                     &reg.credits_quant_p,                   20},
113            {"credits_start_size",          &reg.credits_start_size,                10000},
114            {"credits_end_size",            &reg.credits_end_size,                  10000}
115    };
116    
117    REG_STR const reg_strs[] = {
118            {"stats1",                                      reg.stats1,                                             CONFIG_2PASS_1_FILE},
119            {"stats2",                                      reg.stats2,                                             CONFIG_2PASS_2_FILE}
120    //      {"build",                                       reg.build,                                              XVID_BUILD}
121    };
122    
123  /* get config settings from registry */  /* get config settings from registry */
124    
 #define REG_GET_N(X, Y, Z) size=sizeof(int);if(RegQueryValueEx(hKey, X, 0, 0, (LPBYTE)&Y, &size) != ERROR_SUCCESS) {Y=Z;}  
 #define REG_GET_S(X, Y, Z) size=MAX_PATH;if(RegQueryValueEx(hKey, X, 0, 0, Y, &size) != ERROR_SUCCESS) {lstrcpy(Y, Z);}  
125  #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)));}  #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)));}
126    
127  void config_reg_get(CONFIG * config)  void config_reg_get(CONFIG * config)
# Line 60  Line 129 
129          HKEY hKey;          HKEY hKey;
130          DWORD size;          DWORD size;
131          XVID_INIT_PARAM init_param;          XVID_INIT_PARAM init_param;
132            int i;
133    
134          init_param.cpu_flags = 0;          init_param.cpu_flags = 0;
135          xvid_init(0, 0, &init_param, NULL);          xvid_init(0, 0, &init_param, NULL);
# Line 67  Line 137 
137    
138          RegOpenKeyEx(XVID_REG_KEY, XVID_REG_PARENT "\\" XVID_REG_CHILD, 0, KEY_READ, &hKey);          RegOpenKeyEx(XVID_REG_KEY, XVID_REG_PARENT "\\" XVID_REG_CHILD, 0, KEY_READ, &hKey);
139    
140          REG_GET_N("mode",                                       config->mode,                                   DLG_MODE_CBR);          for (i=0 ; i<sizeof(reg_ints)/sizeof(REG_INT) ; ++i)
141          REG_GET_N("bitrate",                            config->bitrate,                                900000);          {
142          REG_GET_N("quality",                            config->quality,                                85);                  size = sizeof(int);
143          REG_GET_N("quant",                                      config->quant,                                  5);  
144          REG_GET_N("rc_buffersize",                      config->rc_buffersize,                  2048000);                  if (RegQueryValueEx(hKey, reg_ints[i].reg_value, 0, 0, (LPBYTE)reg_ints[i].config_int, &size) != ERROR_SUCCESS)
145                    {
146          REG_GET_N("motion_search",                      config->motion_search,                  5);                          *reg_ints[i].config_int = reg_ints[i].def;
147          REG_GET_N("quant_type",                         config->quant_type,                             0);                  }
148          REG_GET_N("fourcc_used",                        config->fourcc_used,                    0);          }
149          REG_GET_N("max_key_interval",           config->max_key_interval,               300);  
150          REG_GET_N("lum_masking",                        config->lum_masking,                    0);          for (i=0 ; i<sizeof(reg_strs)/sizeof(REG_STR) ; ++i)
151            {
152          REG_GET_N("min_iquant",                         config->min_iquant,                             1);                  size = MAX_PATH;
153          REG_GET_N("max_iquant",                         config->max_iquant,                             31);  
154          REG_GET_N("min_pquant",                         config->min_pquant,                             1);                  if (RegQueryValueEx(hKey, reg_strs[i].reg_value, 0, 0, (LPBYTE)reg_strs[i].config_str, &size) != ERROR_SUCCESS)
155          REG_GET_N("max_pquant",                         config->max_pquant,                             31);                  {
156                            memcpy(reg_strs[i].config_str, reg_strs[i].def, MAX_PATH);
157          REG_GET_N("desired_size",                       config->desired_size,                   570000);                  }
158          REG_GET_N("keyframe_boost",                     config->keyframe_boost,                 20);          }
         REG_GET_N("min_key_interval",           config->min_key_interval,               6);  
         REG_GET_N("discard1pass",                       config->discard1pass,                   1);  
         REG_GET_N("dummy2pass",                         config->dummy2pass,                             0);  
         REG_GET_N("curve_compression_high", config->curve_compression_high,     25);  
         REG_GET_N("curve_compression_low",      config->curve_compression_low,  10);  
         REG_GET_N("bitrate_payback_delay",      config->bitrate_payback_delay,  240);  
         REG_GET_N("bitrate_payback_method",     config->bitrate_payback_method, 0);  
         REG_GET_S("stats1",                                     config->stats1,                                 CONFIG_2PASS_1_FILE);  
         REG_GET_S("stats2",                                     config->stats2,                                 CONFIG_2PASS_2_FILE);  
   
         REG_GET_N("credits_start",                      config->credits_start,                  0);  
         REG_GET_N("credits_start_begin",        config->credits_start_begin,    0);  
         REG_GET_N("credits_start_end",          config->credits_start_end,              0);  
         REG_GET_N("credits_end",                        config->credits_end,                    0);  
         REG_GET_N("credits_end_begin",          config->credits_end_begin,              0);  
         REG_GET_N("credits_end_end",            config->credits_end_end,                0);  
   
         REG_GET_N("credits_mode",                       config->credits_mode,                   0);  
         REG_GET_N("credits_rate",                       config->credits_rate,                   20);  
         REG_GET_N("credits_quant_i",            config->credits_quant_i,                20);  
         REG_GET_N("credits_quant_p",            config->credits_quant_p,                20);  
         REG_GET_N("credits_start_size",         config->credits_start_size,             10000);  
         REG_GET_N("credits_end_size",           config->credits_end_size,               10000);  
159    
160          {          {
161                  BYTE default_qmatrix_intra[] = {                  BYTE default_qmatrix_intra[] = {
# Line 133  Line 180 
180                          23,24,25,27,28,30,31,33                          23,24,25,27,28,30,31,33
181                  };                  };
182    
183                  REG_GET_B("qmatrix_intra", config->qmatrix_intra, default_qmatrix_intra);                  REG_GET_B("qmatrix_intra", reg.qmatrix_intra, default_qmatrix_intra);
184                  REG_GET_B("qmatrix_inter", config->qmatrix_inter, default_qmatrix_inter);                  REG_GET_B("qmatrix_inter", reg.qmatrix_inter, default_qmatrix_inter);
185          }          }
186    
187            memcpy(config, &reg, sizeof(CONFIG));
188    
189          RegCloseKey(hKey);          RegCloseKey(hKey);
190  }  }
191    
192    
193  /* put config settings in registry */  /* put config settings in registry */
194    
 #define REG_SET_N(X, Y) RegSetValueEx(hKey, X, 0, REG_DWORD, (LPBYTE)&Y, sizeof(int))  
 #define REG_SET_S(X, Y) RegSetValueEx(hKey, X, 0, REG_SZ, Y, lstrlen(Y)+1)  
195  #define REG_SET_B(X, Y) RegSetValueEx(hKey, X, 0, REG_BINARY, Y, sizeof((Y)))  #define REG_SET_B(X, Y) RegSetValueEx(hKey, X, 0, REG_BINARY, Y, sizeof((Y)))
196    
197  void config_reg_set(CONFIG * config)  void config_reg_set(CONFIG * config)
198  {  {
199          HKEY hKey;          HKEY hKey;
200          DWORD dispo;          DWORD dispo;
201            int i;
202    
203          if (RegCreateKeyEx(          if (RegCreateKeyEx(
204                          XVID_REG_KEY,                          XVID_REG_KEY,
# Line 167  Line 215 
215                  return;                  return;
216          }          }
217    
218          REG_SET_N("mode",                                       config->mode);          memcpy(&reg, config, sizeof(CONFIG));
219          REG_SET_N("bitrate",                            config->bitrate);  
220          REG_SET_N("quality",                            config->quality);          for (i=0 ; i<sizeof(reg_ints)/sizeof(REG_INT) ; ++i)
221          REG_SET_N("quant",                                      config->quant);          {
222          REG_SET_N("rc_buffersize",                      config->rc_buffersize);                  RegSetValueEx(hKey, reg_ints[i].reg_value, 0, REG_DWORD, (LPBYTE)reg_ints[i].config_int, sizeof(int));
223            }
224          REG_SET_N("motion_search",                      config->motion_search);  
225          REG_SET_N("quant_type",                         config->quant_type);          for (i=0 ; i<sizeof(reg_strs)/sizeof(REG_STR) ; ++i)
226          REG_SET_N("fourcc_used",                        config->fourcc_used);          {
227          REG_SET_N("max_key_interval",           config->max_key_interval);                  RegSetValueEx(hKey, reg_strs[i].reg_value, 0, REG_SZ, reg_strs[i].config_str, lstrlen(reg_strs[i].config_str)+1);
228          REG_SET_N("lum_masking",                        config->lum_masking);          }
229    
230          REG_SET_N("min_iquant",                         config->min_iquant);          REG_SET_B("qmatrix_intra", reg.qmatrix_intra);
231          REG_SET_N("max_iquant",                         config->max_iquant);          REG_SET_B("qmatrix_inter", reg.qmatrix_inter);
         REG_SET_N("min_pquant",                         config->min_pquant);  
         REG_SET_N("max_pquant",                         config->max_pquant);  
         REG_SET_B("qmatrix_intra",                      config->qmatrix_intra);  
         REG_SET_B("qmatrix_inter",                      config->qmatrix_inter);  
   
         REG_SET_N("desired_size",                       config->desired_size);  
         REG_SET_N("keyframe_boost",                     config->keyframe_boost);  
         REG_SET_N("min_key_interval",           config->min_key_interval);  
         REG_SET_N("discard1pass",                       config->discard1pass);  
         REG_SET_N("dummy2pass",                         config->dummy2pass);  
         REG_SET_N("curve_compression_high",     config->curve_compression_high);  
         REG_SET_N("curve_compression_low",      config->curve_compression_low);  
         REG_SET_N("bitrate_payback_delay",      config->bitrate_payback_delay);  
         REG_SET_N("bitrate_payback_method",     config->bitrate_payback_method);  
         REG_SET_S("stats1",                                     config->stats1);  
         REG_SET_S("stats2",                                     config->stats2);  
   
         REG_SET_N("credits_start",                      config->credits_start);  
         REG_SET_N("credits_start_begin",        config->credits_start_begin);  
         REG_SET_N("credits_start_end",          config->credits_start_end);  
         REG_SET_N("credits_end",                        config->credits_end);  
         REG_SET_N("credits_end_begin",          config->credits_end_begin);  
         REG_SET_N("credits_end_end",            config->credits_end_end);  
   
         REG_SET_N("credits_mode",                       config->credits_mode);  
         REG_SET_N("credits_rate",                       config->credits_rate);  
         REG_SET_N("credits_quant_i",            config->credits_quant_i);  
         REG_SET_N("credits_quant_p",            config->credits_quant_p);  
         REG_SET_N("credits_start_size",         config->credits_start_size);  
         REG_SET_N("credits_end_size",           config->credits_end_size);  
232    
233          RegCloseKey(hKey);          RegCloseKey(hKey);
234  }  }
# Line 228  Line 246 
246                  return;                  return;
247          }          }
248    
249          if (RegDeleteKey(XVID_REG_KEY, XVID_REG_CHILD))          if (RegDeleteKey(hKey, XVID_REG_CHILD))
250          {          {
251                  DEBUG1("Couldn't delete registry key - ", GetLastError());                  DEBUG1("Couldn't delete registry key - ", GetLastError());
252                  return;                  return;
253          }          }
254    
255            RegCloseKey(hKey);
256          config_reg_get(config);          config_reg_get(config);
257            config_reg_set(config);
258  }  }
259    
260    
# Line 394  Line 414 
414          psp[DLG_GLOBAL].pszTemplate             = MAKEINTRESOURCE(IDD_GLOBAL);          psp[DLG_GLOBAL].pszTemplate             = MAKEINTRESOURCE(IDD_GLOBAL);
415          psp[DLG_QUANT].pszTemplate              = MAKEINTRESOURCE(IDD_QUANT);          psp[DLG_QUANT].pszTemplate              = MAKEINTRESOURCE(IDD_QUANT);
416          psp[DLG_2PASS].pszTemplate              = MAKEINTRESOURCE(IDD_2PASS);          psp[DLG_2PASS].pszTemplate              = MAKEINTRESOURCE(IDD_2PASS);
417            psp[DLG_2PASSALT].pszTemplate   = MAKEINTRESOURCE(IDD_2PASSALT);
418          psp[DLG_CREDITS].pszTemplate    = MAKEINTRESOURCE(IDD_CREDITS);          psp[DLG_CREDITS].pszTemplate    = MAKEINTRESOURCE(IDD_CREDITS);
419          psp[DLG_CPU].pszTemplate                = MAKEINTRESOURCE(IDD_CPU);          psp[DLG_CPU].pszTemplate                = MAKEINTRESOURCE(IDD_CPU);
420    
# Line 421  Line 442 
442  #define CONTROLDLG(X,Y) EnableWindow(GetDlgItem(hDlg, (X)), (Y))  #define CONTROLDLG(X,Y) EnableWindow(GetDlgItem(hDlg, (X)), (Y))
443  #define ISDLGSET(X)     (IsDlgButtonChecked(hDlg, (X)) == BST_CHECKED)  #define ISDLGSET(X)     (IsDlgButtonChecked(hDlg, (X)) == BST_CHECKED)
444    
445    #define MOD_CBR
446    
447  void adv_mode(HWND hDlg, int mode)  void adv_mode(HWND hDlg, int mode)
448  {  {
449          // create arrays of controls to be disabled for each mode          // create arrays of controls to be disabled for each mode
# Line 485  Line 508 
508          int i;          int i;
509    
510          // first perform checkbox-based enable/disable          // first perform checkbox-based enable/disable
511            CONTROLDLG(IDC_USEAUTO,                         ISDLGSET(IDC_USEALT));
512            CONTROLDLG(IDC_AUTOSTR,                         ISDLGSET(IDC_USEALT) && ISDLGSET(IDC_USEAUTO));
513            CONTROLDLG(IDC_USEAUTOBONUS,            ISDLGSET(IDC_USEALT));
514            CONTROLDLG(IDC_BONUSBIAS,                       (ISDLGSET(IDC_USEALT) && !(ISDLGSET(IDC_USEAUTOBONUS))));
515            CONTROLDLG(IDC_CURVETYPE,                       ISDLGSET(IDC_USEALT));
516            CONTROLDLG(IDC_ALTCURVEHIGH,            ISDLGSET(IDC_USEALT));
517            CONTROLDLG(IDC_ALTCURVELOW,                     ISDLGSET(IDC_USEALT));
518            CONTROLDLG(IDC_MINQUAL,                         ISDLGSET(IDC_USEALT) && !(ISDLGSET(IDC_USEAUTO)));
519    
520          CONTROLDLG(IDC_CREDITS_START_BEGIN,     ISDLGSET(IDC_CREDITS_START));          CONTROLDLG(IDC_CREDITS_START_BEGIN,     ISDLGSET(IDC_CREDITS_START));
521          CONTROLDLG(IDC_CREDITS_START_END,       ISDLGSET(IDC_CREDITS_START));          CONTROLDLG(IDC_CREDITS_START_END,       ISDLGSET(IDC_CREDITS_START));
522    
# Line 549  Line 581 
581                  SetDlgItemText(hDlg, IDC_STATS2, config->stats2);                  SetDlgItemText(hDlg, IDC_STATS2, config->stats2);
582                  break;                  break;
583    
584            case DLG_2PASSALT :
585                    CheckDlgButton(hDlg, IDC_USEALT, config->use_alt_curve ? BST_CHECKED : BST_UNCHECKED);
586    
587                    SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_SETCURSEL, config->alt_curve_type, 0);
588                    SetDlgItemInt(hDlg, IDC_ALTCURVEHIGH, config->alt_curve_high_dist, FALSE);
589                    SetDlgItemInt(hDlg, IDC_ALTCURVELOW, config->alt_curve_low_dist, FALSE);
590                    SetDlgItemInt(hDlg, IDC_MINQUAL, config->alt_curve_min_rel_qual, FALSE);
591    
592                    CheckDlgButton(hDlg, IDC_USEAUTO, config->alt_curve_use_auto ? BST_CHECKED : BST_UNCHECKED);
593                    SetDlgItemInt(hDlg, IDC_AUTOSTR, config->alt_curve_auto_str, FALSE);
594    
595                    CheckDlgButton(hDlg, IDC_USEAUTOBONUS, config->alt_curve_use_auto_bonus_bias ? BST_CHECKED : BST_UNCHECKED);
596                    SetDlgItemInt(hDlg, IDC_BONUSBIAS, config->alt_curve_bonus_bias, FALSE);
597                    break;
598    
599          case DLG_CREDITS :          case DLG_CREDITS :
600                  CheckDlgButton(hDlg, IDC_CREDITS_START, config->credits_start ? BST_CHECKED : BST_UNCHECKED);                  CheckDlgButton(hDlg, IDC_CREDITS_START, config->credits_start ? BST_CHECKED : BST_UNCHECKED);
601                  SetDlgItemInt(hDlg, IDC_CREDITS_START_BEGIN, config->credits_start_begin, FALSE);                  SetDlgItemInt(hDlg, IDC_CREDITS_START_BEGIN, config->credits_start_begin, FALSE);
# Line 647  Line 694 
694                  CONSTRAINVAL(config->curve_compression_low, 0, 100);                  CONSTRAINVAL(config->curve_compression_low, 0, 100);
695                  break;                  break;
696    
697            case DLG_2PASSALT :
698                    config->use_alt_curve = ISDLGSET(IDC_USEALT);
699    
700                    config->alt_curve_use_auto = ISDLGSET(IDC_USEAUTO);
701                    config->alt_curve_auto_str = config_get_int(hDlg, IDC_AUTOSTR, config->alt_curve_auto_str);
702    
703                    config->alt_curve_use_auto_bonus_bias = ISDLGSET(IDC_USEAUTOBONUS);
704                    config->alt_curve_bonus_bias = config_get_int(hDlg, IDC_BONUSBIAS, config->alt_curve_bonus_bias);
705    
706                    config->alt_curve_type = SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_GETCURSEL, 0, 0);
707                    config->alt_curve_high_dist = config_get_int(hDlg, IDC_ALTCURVEHIGH, config->alt_curve_high_dist);
708                    config->alt_curve_low_dist = config_get_int(hDlg, IDC_ALTCURVELOW, config->alt_curve_low_dist);
709                    config->alt_curve_min_rel_qual = config_get_int(hDlg, IDC_MINQUAL, config->alt_curve_min_rel_qual);
710                    break;
711    
712          case DLG_CREDITS :          case DLG_CREDITS :
713                  config->credits_start = ISDLGSET(IDC_CREDITS_START);                  config->credits_start = ISDLGSET(IDC_CREDITS_START);
714                  config->credits_start_begin = GetDlgItemInt(hDlg, IDC_CREDITS_START_BEGIN, NULL, FALSE);                  config->credits_start_begin = GetDlgItemInt(hDlg, IDC_CREDITS_START_BEGIN, NULL, FALSE);
# Line 726  Line 788 
788          }          }
789  }  }
790    
 /* monitor mouse events to dialog controls for help text */  
791    
792  HHOOK hHook;  /* enumerates child windows, assigns tooltips */
 HWND hParent;  
793    
794  LRESULT CALLBACK msg_proc(int nCode, WPARAM wParam, LPARAM lParam)  BOOL CALLBACK enum_tooltips(HWND hWnd, LPARAM lParam)
 {  
         MSG* pmsg = (MSG *)lParam;  
   
         if (pmsg->message == WM_MOUSEMOVE)  
         {  
                 if (pmsg->hwnd == hParent)  
                 {  
                         SetDlgItemText(hParent, IDC_STATIC_HELP, XVID_HELP);  
                 }  
                 else if (IsChild(hParent, pmsg->hwnd))  
795                  {                  {
                         char *message;  
796                          char help[500];                          char help[500];
797    
798                          int mode = SendDlgItemMessage(hParent, IDC_MODE, CB_GETCURSEL, 0, 0);          if (LoadString(hInst, GetDlgCtrlID(hWnd), help, 500))
                         int item = GetDlgCtrlID(pmsg->hwnd);  
   
                         if (item == IDC_VALUE || item == IDC_SLIDER)  
                         {  
                                 switch (mode)  
                                 {  
                                 case DLG_MODE_2PASS_2_INT :  
                                         if (item == IDC_VALUE)  
799                                          {                                          {
800                                                  message = "Set the desired video size in Kilobytes";                  TOOLINFO ti;
                                                 break;  
                                         }  
                                 default :  
                                 case DLG_MODE_CBR :  
                                         message = "Set the target video bitrate";  
                                         break;  
801    
802                                  case DLG_MODE_VBR_QUAL :                  ti.cbSize = sizeof(TOOLINFO);
803                                          message = "Set the target video quality";                  ti.uFlags = TTF_SUBCLASS | TTF_IDISHWND;
804                                          break;                  ti.hwnd = GetParent(hWnd);
805                    ti.uId  = (LPARAM)hWnd;
806                    ti.lpszText = help;
807    
808                                  case DLG_MODE_VBR_QUANT :                  SendMessage(hTooltip, TTM_ADDTOOL, 0, (LPARAM)&ti);
                                         message = "Set the fixed quantizer for encoding";  
                                         break;  
                                 }  
                                 lstrcpy(help, message);  
                         }  
                         else if (!LoadString(hInst, GetDlgCtrlID(pmsg->hwnd), help, 500))  
                         {  
                                 lstrcpy(help, XVID_HELP);  
809                          }                          }
810    
811                          SetDlgItemText(hParent, IDC_STATIC_HELP, help);          return TRUE;
                 }  
         }  
   
         return (CallNextHookEx(hHook, nCode, wParam, lParam));  
812  }  }
813    
814    
# Line 810  Line 835 
835    
836                  SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0);                  SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0);
837                  SetDlgItemInt(hDlg, IDC_CBRBUFFER, config->rc_buffersize, FALSE);                  SetDlgItemInt(hDlg, IDC_CBRBUFFER, config->rc_buffersize, FALSE);
                 SetDlgItemText(hDlg, IDC_STATIC_HELP, XVID_HELP);  
   
                 hHook = SetWindowsHookEx(WH_GETMESSAGE, msg_proc, 0, GetCurrentThreadId());  
838    
839                  main_slider(hDlg, config);                  InitCommonControls();
                 main_value(hDlg, config);  
                 break;  
840    
841          case WM_ACTIVATE :                  if (hTooltip = CreateWindow(TOOLTIPS_CLASS, NULL, TTS_ALWAYSTIP,
842                  if (LOWORD(wParam) != WA_INACTIVE)                                  CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
843                                    NULL, NULL, hInst, NULL))
844                  {                  {
845                          hParent = hDlg;                          SetWindowPos(hTooltip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
846                            SendMessage(hTooltip, TTM_SETDELAYTIME, TTDT_AUTOMATIC, MAKELONG(1500, 0));
847                            SendMessage(hTooltip, TTM_SETMAXTIPWIDTH, 0, 400);
848    
849                            EnumChildWindows(hDlg, enum_tooltips, 0);
850                  }                  }
                 return 0;  
851    
852          case WM_DESTROY :                  main_slider(hDlg, config);
853                  UnhookWindowsHookEx(hHook);                  main_value(hDlg, config);
854                  break;                  break;
855    
856          case WM_HSCROLL :          case WM_HSCROLL :
# Line 856  Line 880 
880                                  config_reg_set(config);                                  config_reg_set(config);
881                          }                          }
882                  }                  }
883                    else if (LOWORD(wParam) == IDC_DEFAULTS && HIWORD(wParam) == BN_CLICKED)
884                    {
885                            config_reg_default(config);
886    
887                            SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0);
888                            SetDlgItemInt(hDlg, IDC_CBRBUFFER, config->rc_buffersize, FALSE);
889    
890                            main_slider(hDlg, config);
891                            main_value(hDlg, config);
892                    }
893                  else if (HIWORD(wParam) == EN_UPDATE && LOWORD(wParam) == IDC_VALUE)                  else if (HIWORD(wParam) == EN_UPDATE && LOWORD(wParam) == IDC_VALUE)
894                  {                  {
895                          int value = config_get_int(hDlg, IDC_VALUE, 1);                          int value = config_get_int(hDlg, IDC_VALUE, 1);
# Line 935  Line 969 
969                          SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DIVX");                          SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DIVX");
970                          SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DX50");                          SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DX50");
971                  }                  }
972                    else if (psi->page == DLG_2PASSALT)
973                    {
974                            SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"Low");
975                            SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"Medium");
976                            SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"High");
977                    }
978    
979                    if (hTooltip)
980                    {
981                            EnumChildWindows(hDlg, enum_tooltips, 0);
982                    }
983    
                 SetDlgItemText(hDlg, IDC_STATIC_HELP, XVID_HELP);  
984                  adv_upload(hDlg, psi->page, psi->config);                  adv_upload(hDlg, psi->page, psi->config);
985                  adv_mode(hDlg, psi->config->mode);                  adv_mode(hDlg, psi->config->mode);
986                  break;                  break;
# Line 946  Line 990 
990                  {                  {
991                          switch (LOWORD(wParam))                          switch (LOWORD(wParam))
992                          {                          {
993                            case IDC_USEALT :
994                            case IDC_USEAUTO :
995                            case IDC_USEAUTOBONUS :
996                          case IDC_CREDITS_START :                          case IDC_CREDITS_START :
997                          case IDC_CREDITS_END :                          case IDC_CREDITS_END :
998                          case IDC_CREDITS_RATE_RADIO :                          case IDC_CREDITS_RATE_RADIO :
# Line 1001  Line 1048 
1048          case WM_NOTIFY :          case WM_NOTIFY :
1049                  switch (((NMHDR *)lParam)->code)                  switch (((NMHDR *)lParam)->code)
1050                  {                  {
                 case PSN_SETACTIVE :  
                         hParent = hDlg;  
                         break;  
   
1051                  case PSN_KILLACTIVE :                  case PSN_KILLACTIVE :
1052                          /* validate */                          /* validate */
1053                          adv_download(hDlg, psi->page, psi->config);                          adv_download(hDlg, psi->page, psi->config);
# Line 1040  Line 1083 
1083                  SetWindowLong(hDlg, GWL_USERDATA, lParam);                  SetWindowLong(hDlg, GWL_USERDATA, lParam);
1084                  config = (CONFIG*)lParam;                  config = (CONFIG*)lParam;
1085                  quant_upload(hDlg, config);                  quant_upload(hDlg, config);
                 break;  
1086    
1087          case WM_ACTIVATE :                  if (hTooltip)
                 if (LOWORD(wParam) != WA_INACTIVE)  
1088                  {                  {
1089                          hParent = hDlg;                          EnumChildWindows(hDlg, enum_tooltips, 0);
1090                  }                  }
1091                  return 0;                  break;
1092    
1093          case WM_COMMAND :          case WM_COMMAND :
1094                  if (LOWORD(wParam) == IDOK && HIWORD(wParam) == BN_CLICKED)                  if (LOWORD(wParam) == IDOK && HIWORD(wParam) == BN_CLICKED)
# Line 1091  Line 1132 
1132    
1133                                          if (hFile == INVALID_HANDLE_VALUE)                                          if (hFile == INVALID_HANDLE_VALUE)
1134                                          {                                          {
1135                                                  DEBUG("Couldn't save quant matrix");                                                  DEBUGERR("Couldn't save quant matrix");
1136                                          }                                          }
1137                                          else                                          else
1138                                          {                                          {
1139                                                  if (!WriteFile(hFile, quant_data, 128, &wrote, 0))                                                  if (!WriteFile(hFile, quant_data, 128, &wrote, 0))
1140                                                  {                                                  {
1141                                                          DEBUG("Couldnt write quant matrix");                                                          DEBUGERR("Couldnt write quant matrix");
1142                                                  }                                                  }
1143                                          }                                          }
1144    
# Line 1113  Line 1154 
1154    
1155                                          if (hFile == INVALID_HANDLE_VALUE)                                          if (hFile == INVALID_HANDLE_VALUE)
1156                                          {                                          {
1157                                                  DEBUG("Couldn't load quant matrix");                                                  DEBUGERR("Couldn't load quant matrix");
1158                                          }                                          }
1159                                          else                                          else
1160                                          {                                          {
1161                                                  if (!ReadFile(hFile, quant_data, 128, &read, 0))                                                  if (!ReadFile(hFile, quant_data, 128, &read, 0))
1162                                                  {                                                  {
1163                                                          DEBUG("Couldnt read quant matrix");                                                          DEBUGERR("Couldnt read quant matrix");
1164                                                  }                                                  }
1165                                                  else                                                  else
1166                                                  {                                                  {
# Line 1156  Line 1197 
1197                          HFONT hFont;                          HFONT hFont;
1198                          LOGFONT lfData;                          LOGFONT lfData;
1199    
1200                          SetDlgItemText(hDlg, IDC_BUILD, __TIME__ ", " __DATE__);                          SetDlgItemText(hDlg, IDC_BUILD, XVID_BUILD);
1201    
1202                          xvid_init(NULL, 0, &init_param, 0);                          xvid_init(NULL, 0, &init_param, 0);
1203                          wsprintf(core, "Core Version %d.%d", (init_param.api_version>>16),(init_param.api_version&0xFFFFU));                          wsprintf(core, "Core Version %d.%d", (init_param.api_version>>16),(init_param.api_version&0xFFFFU));

Legend:
Removed from v.30  
changed lines
  Added in v.64

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