reorganized VfW UI.
authorLoren Merritt <pengvado@videolan.org>
Sat, 24 Sep 2005 19:41:50 +0000 (19:41 +0000)
committerLoren Merritt <pengvado@videolan.org>
Sat, 24 Sep 2005 19:41:50 +0000 (19:41 +0000)
patch by Antony Boucher, graphic by Jarod.

git-svn-id: svn://svn.videolan.org/x264/trunk@300 df754926-b1dd-0310-bc7b-ec298dee348c

vfw/config.c
vfw/resource.h
vfw/resource.rc
vfw/x264.bmp [new file with mode: 0644]
vfw/x264vfw.h

index 004688f..8887dd9 100644 (file)
@@ -6,6 +6,7 @@
  *
  * Authors: Justin Clay
  *          Laurent Aimar <fenrir@via.ecp.fr>
+ *          Antony Boucher <proximodo@free.fr>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -71,6 +72,7 @@ typedef struct
 } reg_str_t;
 
 CONFIG reg;
+HWND hTabs[8];
 static const reg_int_t reg_int_table[] =
 {
     /* Main dialog */
@@ -129,6 +131,16 @@ static const reg_str_t reg_str_table[] =
     { "statsfile",      reg.stats,       ".\\x264.stats",       MAX_PATH-4 } // -4 because we add pass number
 };
 
+static void set_dlgitem_int(HWND hDlg, UINT item, int value)
+{
+    char buf[8];
+    sprintf(buf, "%i", value);
+    SetDlgItemText(hDlg, item, buf);
+}
+
+
+/* Registry access */
+
 void config_reg_load( CONFIG *config )
 {
     HKEY    hKey;
@@ -199,7 +211,6 @@ void config_reg_save( CONFIG *config )
     RegCloseKey( hKey );
 }
 
-/* config_reg_defaults: */
 void config_reg_defaults( CONFIG *config )
 {
     HKEY hKey;
@@ -219,135 +230,69 @@ void config_reg_defaults( CONFIG *config )
     config_reg_save( config );
 }
 
-/* Enables or Disables Window Elements based on Selection
- */
-static void main_enable_item( HWND hDlg, CONFIG * config )
-{
-    switch( config->i_encoding_type )
-    {
-    case 0 : /* 1 Pass, Bitrate Based */
-        EnableWindow( GetDlgItem( hDlg, IDC_BITRATEEDIT ), TRUE );
-        EnableWindow( GetDlgItem( hDlg, IDC_BITRATESLIDER ), TRUE );
-
-        EnableWindow( GetDlgItem( hDlg, IDC_QUANTEDIT ), FALSE );
-        EnableWindow( GetDlgItem( hDlg, IDC_QUANTSLIDER ), FALSE );
-
-        EnableWindow( GetDlgItem( hDlg, IDC_2PASS1 ), FALSE );
-        EnableWindow( GetDlgItem( hDlg, IDC_2PASS2 ), FALSE );
-        EnableWindow( GetDlgItem( hDlg, IDC_2PASSBITRATE ), FALSE );
-        EnableWindow( GetDlgItem( hDlg, IDC_2PASSBITRATE_S ), FALSE );
-        EnableWindow( GetDlgItem( hDlg, IDC_FAST1PASS ), FALSE );
-        EnableWindow( GetDlgItem( hDlg, IDC_UPDATESTATS ), FALSE );
-        EnableWindow( GetDlgItem( hDlg, IDC_STATSFILE ), FALSE );
-        EnableWindow( GetDlgItem( hDlg, IDC_STATSFILE_BROWSE ), FALSE );
-        break;
-
-    case 1 : /* 1 Pass, Quantizer Based */
-        EnableWindow( GetDlgItem( hDlg, IDC_BITRATEEDIT ), FALSE );
-        EnableWindow( GetDlgItem( hDlg, IDC_BITRATESLIDER ), FALSE );
-
-        EnableWindow( GetDlgItem( hDlg, IDC_QUANTEDIT ), TRUE );
-        EnableWindow( GetDlgItem( hDlg, IDC_QUANTSLIDER ), TRUE );
-
-        EnableWindow( GetDlgItem( hDlg, IDC_2PASS1 ), FALSE );
-        EnableWindow( GetDlgItem( hDlg, IDC_2PASS2 ), FALSE );
-        EnableWindow( GetDlgItem( hDlg, IDC_2PASSBITRATE ), FALSE );
-        EnableWindow( GetDlgItem( hDlg, IDC_2PASSBITRATE_S ), FALSE );
-        EnableWindow( GetDlgItem( hDlg, IDC_FAST1PASS ), FALSE );
-        EnableWindow( GetDlgItem( hDlg, IDC_UPDATESTATS ), FALSE );
-        EnableWindow( GetDlgItem( hDlg, IDC_STATSFILE ), FALSE );
-        EnableWindow( GetDlgItem( hDlg, IDC_STATSFILE_BROWSE ), FALSE );
-        break;
-    
-    case 2 : /* 2 Pass */
-        EnableWindow( GetDlgItem( hDlg, IDC_BITRATEEDIT ), FALSE );
-        EnableWindow( GetDlgItem( hDlg, IDC_BITRATESLIDER ), FALSE );
-
-        EnableWindow( GetDlgItem( hDlg, IDC_QUANTEDIT ), FALSE );
-        EnableWindow( GetDlgItem( hDlg, IDC_QUANTSLIDER ), FALSE );
-
-        EnableWindow( GetDlgItem( hDlg, IDC_2PASS1 ), TRUE );
-        EnableWindow( GetDlgItem( hDlg, IDC_2PASS2 ), TRUE );
-        EnableWindow( GetDlgItem( hDlg, IDC_2PASSBITRATE ), TRUE );
-        EnableWindow( GetDlgItem( hDlg, IDC_2PASSBITRATE_S ), TRUE );
-        EnableWindow( GetDlgItem( hDlg, IDC_FAST1PASS ), config->i_pass == 1);
-        EnableWindow( GetDlgItem( hDlg, IDC_UPDATESTATS ), config->i_pass > 1 );
-        EnableWindow( GetDlgItem( hDlg, IDC_STATSFILE ), config->i_pass == 1 );
-        EnableWindow( GetDlgItem( hDlg, IDC_STATSFILE_BROWSE ), config->i_pass == 1 );
-        break;
-    }
-
-    SendDlgItemMessage( hDlg, IDC_BITRATESLIDER, TBM_SETRANGE, TRUE,
-                        (LPARAM) MAKELONG( 0, BITRATE_MAX ) );
-    SendDlgItemMessage( hDlg, IDC_QUANTSLIDER, TBM_SETRANGE, TRUE,
-                        (LPARAM) MAKELONG( 0, QUANT_MAX ) );
-    SendDlgItemMessage( hDlg, IDC_2PASSBITRATE_S, TBM_SETRANGE, TRUE,
-                        (LPARAM) MAKELONG( 0, BITRATE_MAX ) );
-
-}
-
-/* Updates the window from config */
-static void main_update_dlg( HWND hDlg, CONFIG * config )
-{
-    SetDlgItemInt( hDlg, IDC_BITRATEEDIT, config->bitrate, FALSE );
-    SetDlgItemInt( hDlg, IDC_QUANTEDIT, config->i_qp, FALSE );
-    SetDlgItemInt( hDlg, IDC_2PASSBITRATE, config->i_2passbitrate, FALSE );
-    SetDlgItemText( hDlg, IDC_STATSFILE, config->stats );
-    SetDlgItemInt( hDlg, IDC_THREADEDIT, config->i_threads, FALSE );
-
-    switch( config->i_encoding_type )
-    {
-    case 0 : /* 1 Pass, Bitrate Based */
-        CheckRadioButton( hDlg,
-                          IDC_RADIOBITRATE, IDC_RADIOTWOPASS, IDC_RADIOBITRATE);
-        break;
-    case 1 : /* 1 Pass, Quantizer Based */
-        CheckRadioButton( hDlg,
-                          IDC_RADIOBITRATE, IDC_RADIOTWOPASS, IDC_RADIOQUANT);
-            break;
-    case 2 : /* 2 Pass */
-        CheckRadioButton( hDlg,
-                          IDC_RADIOBITRATE, IDC_RADIOTWOPASS, IDC_RADIOTWOPASS);
-
-        if (config->i_pass == 1)
-            CheckRadioButton(hDlg,
-                             IDC_2PASS1, IDC_2PASS2, IDC_2PASS1);
-        else 
-            CheckRadioButton(hDlg,
-                             IDC_2PASS1, IDC_2PASS2, IDC_2PASS2);
-        EnableWindow( GetDlgItem( hDlg, IDC_2PASSBITRATE ), TRUE );
-        EnableWindow( GetDlgItem( hDlg, IDC_2PASSBITRATE_S ), TRUE );
-
-        break;
-    }
-
-    SendDlgItemMessage( hDlg, IDC_BITRATESLIDER, TBM_SETPOS, TRUE,
-                        config->bitrate );
-    SendDlgItemMessage( hDlg, IDC_QUANTSLIDER, TBM_SETPOS, TRUE,
-                        config->i_qp );
-    SendDlgItemMessage( hDlg, IDC_2PASSBITRATE_S, TBM_SETPOS, TRUE,
-                        config->i_2passbitrate );
-    CheckDlgButton( hDlg, IDC_FAST1PASS, config->b_fast1pass ? BST_CHECKED : BST_UNCHECKED );
-    CheckDlgButton( hDlg, IDC_UPDATESTATS, config->b_updatestats ? BST_CHECKED : BST_UNCHECKED );
-
-}
 
+/* Main window */
 
-/* Main config dialog */
 BOOL CALLBACK callback_main( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
 {
+       TCITEM tie;
     CONFIG* config = (CONFIG*)GetWindowLong(hDlg, GWL_USERDATA);
 
     switch( uMsg )
     {
     case WM_INITDIALOG :
-        SetWindowLong( hDlg, GWL_USERDATA, lParam );
-        config = (CONFIG*)lParam;
-
-        main_enable_item( hDlg, config );
-        main_update_dlg( hDlg, config );
-
-        break;
+               {
+                       RECT rect;
+                       HWND hTabCtrl = GetDlgItem( hDlg, IDC_TAB1 );
+                       SetWindowLong( hDlg, GWL_USERDATA, lParam );
+                       config = (CONFIG*)lParam;
+
+                       // insert tabs in tab control
+                       tie.mask = TCIF_TEXT; 
+                       tie.iImage = -1; 
+                       tie.pszText = "Bitrate";                        TabCtrl_InsertItem(hTabCtrl, 0, &tie);
+                       tie.pszText = "Rate Control";           TabCtrl_InsertItem(hTabCtrl, 1, &tie);
+                       tie.pszText = "I/P/B Frames";           TabCtrl_InsertItem(hTabCtrl, 2, &tie);
+                       tie.pszText = "More...";                        TabCtrl_InsertItem(hTabCtrl, 3, &tie);
+                       hTabs[0] = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_TAB_BITRATE),         hDlg, (DLGPROC)callback_tabs, lParam);
+                       hTabs[1] = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_TAB_RATECONTROL),     hDlg, (DLGPROC)callback_tabs, lParam);
+                       hTabs[2] = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_TAB_IPFRAMES),        hDlg, (DLGPROC)callback_tabs, lParam);
+                       hTabs[3] = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_TAB_MISC),            hDlg, (DLGPROC)callback_tabs, lParam);
+                       GetClientRect(hDlg, &rect);
+                       TabCtrl_AdjustRect(hTabCtrl, FALSE, &rect);
+                       MoveWindow(hTabs[0], rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top-40, TRUE);
+                       MoveWindow(hTabs[1], rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top-40, TRUE);
+                       MoveWindow(hTabs[2], rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top-40, TRUE);
+                       MoveWindow(hTabs[3], rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top-40, TRUE);
+
+                       tabs_enable_items( hDlg, config );
+            tabs_update_items( hDlg, config );
+                       ShowWindow( hTabs[0], SW_SHOW );
+                       BringWindowToTop( hTabs[0] );
+                       UpdateWindow( hDlg );
+                       break;
+               }
+
+       case WM_NOTIFY:
+               {
+                       NMHDR FAR *tem = (NMHDR FAR *)lParam;
+                       if (tem->code == TCN_SELCHANGING)
+                       {
+                               HWND hTabCtrl = GetDlgItem( hDlg, IDC_TAB1 );
+                               int num = TabCtrl_GetCurSel(hTabCtrl);
+                               ShowWindow( hTabs[num], SW_HIDE );
+                               UpdateWindow( hDlg );
+                       } 
+                       else if (tem->code == TCN_SELCHANGE)
+                       {
+                               HWND hTabCtrl = GetDlgItem( hDlg, IDC_TAB1 );
+                               int num = TabCtrl_GetCurSel(hTabCtrl);
+                               ShowWindow( hTabs[num], SW_SHOW );
+                               BringWindowToTop( hTabs[num] );
+                               UpdateWindow( hDlg );
+                       }
+                       break;
+               }
 
     case WM_COMMAND:
         switch ( HIWORD( wParam ) )
@@ -359,143 +304,22 @@ BOOL CALLBACK callback_main( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
                 config->b_save = TRUE;
                            EndDialog( hDlg, LOWORD(wParam) );
                 break;
+
             case IDCANCEL :
                 config->b_save = FALSE;
                 EndDialog( hDlg, LOWORD(wParam) );
                 break;
-            case IDC_ADVANCED :
-                DialogBoxParam( g_hInst, MAKEINTRESOURCE(IDD_ADVANCED),
-                                (HWND)lParam, callback_advanced,
-                                (LPARAM)config );
-                break;
-            case IDC_DEBUG :
-                DialogBoxParam( g_hInst, MAKEINTRESOURCE(IDD_DEBUG),
-                                (HWND)lParam, callback_debug,
-                                (LPARAM)config );
-                break;
+
             case IDC_DEFAULTS :
                 if( MessageBox( hDlg, X264_DEF_TEXT, X264_NAME, MB_YESNO ) == IDYES )
                 {
                     config_reg_defaults( config );
-                    main_enable_item( hDlg, config );
-                    main_update_dlg( hDlg, config );
-                }
-                break;
-            case IDC_RADIOBITRATE :
-                config->i_encoding_type = 0; /* 1 Pass, Bitrate Mode=0 */
-                main_enable_item( hDlg, config );
-                main_update_dlg( hDlg, config );
-                break;
-            case IDC_RADIOQUANT :
-                config->i_encoding_type = 1; /* 1 Pass, Quantizer Mode=1 */
-                main_enable_item( hDlg, config );
-                main_update_dlg( hDlg, config );
-                break;
-            case IDC_RADIOTWOPASS :
-                config->i_encoding_type = 2; /* 2 Pass Mode=2 */
-                main_enable_item( hDlg,  config );
-                main_update_dlg( hDlg, config );
-                break;
-            case IDC_2PASS1 :
-                config->i_pass = 1; /* 1st pass */
-                main_enable_item( hDlg,  config );
-                main_update_dlg( hDlg, config );
-                break;
-            case IDC_2PASS2 :
-                config->i_pass = 2; /* 2nd pass */
-                main_enable_item( hDlg,  config );
-                main_update_dlg( hDlg, config );
-                break;
-            case IDC_FAST1PASS :
-                config->b_fast1pass = ( IsDlgButtonChecked( hDlg, IDC_FAST1PASS ) == BST_CHECKED );
-                break;
-            case IDC_UPDATESTATS :
-                config->b_updatestats = ( IsDlgButtonChecked( hDlg, IDC_UPDATESTATS ) == BST_CHECKED );
-                break;
-            case IDC_STATSFILE_BROWSE :
-                {
-                OPENFILENAME ofn;
-                char tmp[MAX_PATH];
-
-                GetDlgItemText( hDlg, IDC_STATSFILE, tmp, MAX_PATH );
-
-                memset( &ofn, 0, sizeof( OPENFILENAME ) );
-                ofn.lStructSize = sizeof( OPENFILENAME );
-
-                ofn.hwndOwner = hDlg;
-                ofn.lpstrFilter = "Statsfile (*.stats)\0*.stats\0All files (*.*)\0*.*\0\0";
-                ofn.lpstrFile = tmp;
-                ofn.nMaxFile = MAX_PATH-4;
-                ofn.Flags = OFN_PATHMUSTEXIST;
-
-                if( config->i_pass == 1 )
-                    ofn.Flags |= OFN_OVERWRITEPROMPT;
-                else ofn.Flags |= OFN_FILEMUSTEXIST;
-
-                if( ( config->i_pass == 1 && GetSaveFileName( &ofn ) ) || 
-                    ( config->i_pass > 1 && GetOpenFileName( &ofn ) ) )
-                    SetDlgItemText( hDlg, IDC_STATSFILE, tmp );
-                }
-                break;
-            }
-            break;
-        case EN_CHANGE :
-            switch( LOWORD( wParam ) )
-            {
-            case IDC_THREADEDIT :
-                config->i_threads = GetDlgItemInt( hDlg, IDC_THREADEDIT, FALSE, FALSE );
-                if (config->i_threads < 1)
-                {
-                    config->i_threads = 1;
-                    SetDlgItemInt( hDlg, IDC_THREADEDIT, config->i_threads, FALSE );
+                    tabs_enable_items( hDlg, config );
+                    tabs_update_items( hDlg, config );
                 }
-                else if (config->i_threads > 4)
-                {
-                    config->i_threads = 4;
-                    SetDlgItemInt( hDlg, IDC_THREADEDIT, config->i_threads, FALSE );
-                }                        
-                break;
-            case IDC_BITRATEEDIT :
-                config->bitrate = GetDlgItemInt( hDlg, IDC_BITRATEEDIT, FALSE, FALSE );
-                SendDlgItemMessage( hDlg, IDC_BITRATESLIDER, TBM_SETPOS, TRUE, config->bitrate );
-                break;
-            case IDC_QUANTEDIT :
-                config->i_qp = GetDlgItemInt( hDlg, IDC_QUANTEDIT, FALSE, FALSE );
-                SendDlgItemMessage( hDlg, IDC_QUANTSLIDER, TBM_SETPOS, TRUE, config->i_qp );
-                break;
-            case IDC_2PASSBITRATE :
-                config->i_2passbitrate = GetDlgItemInt( hDlg, IDC_2PASSBITRATE, FALSE, FALSE );
-                SendDlgItemMessage( hDlg, IDC_2PASSBITRATE_S, TBM_SETPOS, TRUE, config->i_2passbitrate );
                 break;
-            case IDC_STATSFILE :
-                if( GetDlgItemText( hDlg, IDC_STATSFILE, config->stats, MAX_PATH ) == 0 )
-                    lstrcpy( config->stats, ".\\x264.stats" );
-                break;
-            }
-            break;
-        default:
-            break;
-        }
-        break;
-
-        case WM_HSCROLL :
-            if( (HWND) lParam == GetDlgItem( hDlg, IDC_BITRATESLIDER ) )
-            {
-                config->bitrate = SendDlgItemMessage( hDlg, IDC_BITRATESLIDER, TBM_GETPOS, 0, 0 );
-                SetDlgItemInt( hDlg, IDC_BITRATEEDIT, config->bitrate, FALSE );
-
-            }
-            else if( (HWND) lParam == GetDlgItem( hDlg, IDC_QUANTSLIDER ) )
-            {
-                config->i_qp = SendDlgItemMessage( hDlg, IDC_QUANTSLIDER, TBM_GETPOS, 0, 0 );
-                SetDlgItemInt( hDlg, IDC_QUANTEDIT, config->i_qp, FALSE );
-            }
-            else if( (HWND) lParam == GetDlgItem( hDlg, IDC_2PASSBITRATE_S ) )
-            {
-                config->i_2passbitrate = SendDlgItemMessage( hDlg, IDC_2PASSBITRATE_S, TBM_GETPOS, 0, 0 );
-                SetDlgItemInt( hDlg, IDC_2PASSBITRATE, config->i_2passbitrate, FALSE );
-            }
-            break;
+                       }
+               }
 
     default :
         return 0;
@@ -504,468 +328,635 @@ BOOL CALLBACK callback_main( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
     return 1;
 }
 
-/* About dialog */
-BOOL CALLBACK callback_about( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
+
+/* Tabs */
+
+void tabs_enable_items( HWND hDlg, CONFIG * config )
 {
-    switch( uMsg )
-    {
-    case WM_INITDIALOG :
+       char szTmp[1024];
+    sprintf( szTmp, "Core %d%s, build %s %s", X264_BUILD, X264_VERSION, __DATE__, __TIME__ );
+    SetDlgItemText( hTabs[3], IDC_BUILDREV,  szTmp );
+
+       switch( config->i_encoding_type )
     {
-        char temp[1024];
-        sprintf( temp, "Core %d%s, build %s %s", X264_BUILD, X264_VERSION, __DATE__, __TIME__ );
-        SetDlgItemText( hDlg, IDC_BUILD,  temp );
+    case 0 : /* 1 Pass, Bitrate Based */
+               SetDlgItemText( hTabs[0], IDC_BITRATELABEL, "Average Bitrate" );
+               SetDlgItemText( hTabs[0], IDC_BITRATELOW, "0" );
+               sprintf(szTmp, "%d", BITRATE_MAX);
+               SetDlgItemText( hTabs[0], IDC_BITRATEHIGH, szTmp );
+               SendDlgItemMessage( hTabs[0], IDC_BITRATESLIDER, TBM_SETRANGE, TRUE,
+                                                       (LPARAM) MAKELONG( 0, BITRATE_MAX ) );
+        EnableWindow( GetDlgItem( hTabs[0], IDC_UPDATESTATS ), FALSE );
+        EnableWindow( GetDlgItem( hTabs[0], IDC_STATSFILE ), FALSE );
+        EnableWindow( GetDlgItem( hTabs[0], IDC_STATSFILE_BROWSE ), FALSE );
         break;
-    }
 
-    case WM_COMMAND:
-        if (LOWORD(wParam) == IDC_HOMEPAGE && HIWORD(wParam) == STN_CLICKED)
-            ShellExecute( hDlg, "open", X264_WEBSITE, NULL, NULL, SW_SHOWNORMAL );
-        else if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
-            EndDialog( hDlg, LOWORD(wParam) );
+    case 1 : /* 1 Pass, Quantizer Based */
+               SetDlgItemText( hTabs[0], IDC_BITRATELABEL, "Quantizer" );
+               SetDlgItemText( hTabs[0], IDC_BITRATELOW, "0 (High Quality)" );
+               sprintf(szTmp, "(Low Quality) %d", QUANT_MAX);
+               SetDlgItemText( hTabs[0], IDC_BITRATEHIGH, szTmp );
+               SendDlgItemMessage( hTabs[0], IDC_BITRATESLIDER, TBM_SETRANGE, TRUE,
+                                                       (LPARAM) MAKELONG( 0, QUANT_MAX ) );
+        EnableWindow( GetDlgItem( hTabs[0], IDC_UPDATESTATS ), FALSE );
+        EnableWindow( GetDlgItem( hTabs[0], IDC_STATSFILE ), FALSE );
+        EnableWindow( GetDlgItem( hTabs[0], IDC_STATSFILE_BROWSE ), FALSE );
+        break;
+    
+    case 2 : /* 2 Pass */
+               SetDlgItemText( hTabs[0], IDC_BITRATELABEL, "Target Bitrate" );
+               SetDlgItemText( hTabs[0], IDC_BITRATELOW, "0" );
+               sprintf(szTmp, "%d", BITRATE_MAX);
+               SetDlgItemText( hTabs[0], IDC_BITRATEHIGH, szTmp );
+               SendDlgItemMessage( hTabs[0], IDC_BITRATESLIDER, TBM_SETRANGE, TRUE,
+                                                       (LPARAM) MAKELONG( 0, BITRATE_MAX ) );
+        EnableWindow( GetDlgItem( hTabs[0], IDC_UPDATESTATS ), TRUE );
+        EnableWindow( GetDlgItem( hTabs[0], IDC_STATSFILE ), TRUE );
+        EnableWindow( GetDlgItem( hTabs[0], IDC_STATSFILE_BROWSE ), TRUE );
         break;
-
-    default :
-        return 0;
     }
 
-    return 1;
+    EnableWindow( GetDlgItem( hTabs[1], IDC_DIRECTPRED ), config->i_bframe > 0 );
+       EnableWindow( GetDlgItem( hTabs[3], IDC_INLOOP_A        ), config->b_filter );
+       EnableWindow( GetDlgItem( hTabs[3], IDC_INLOOP_B        ), config->b_filter );
+    EnableWindow( GetDlgItem( hTabs[2], IDC_P8X8               ), config->b_psub16x16 );
+    EnableWindow( GetDlgItem( hTabs[2], IDC_I8X8               ), config->b_dct8x8 );
+    EnableWindow( GetDlgItem( hTabs[2], IDC_BREFS              ), config->i_bframe > 1 );
+    EnableWindow( GetDlgItem( hTabs[2], IDC_WBPRED             ), config->i_bframe > 1 );
+    EnableWindow( GetDlgItem( hTabs[2], IDC_BADAPT             ), config->i_bframe > 0 );
+    EnableWindow( GetDlgItem( hTabs[2], IDC_BBIAS              ), config->i_bframe > 0 );
+    EnableWindow( GetDlgItem( hTabs[2], IDC_BBIASSLIDER ), config->i_bframe > 0 );
+    EnableWindow( GetDlgItem( hTabs[3], IDC_MERANGE     ), config->i_me_method > 1 );
+    EnableWindow( GetDlgItem( hTabs[3], IDC_CHROMAME    ), config->i_subpel_refine >= 4 );
 }
-static void debug_update_dlg( HWND hDlg, CONFIG * config )
-{
-    char fourcc[5];
-
-    SendDlgItemMessage(hDlg, IDC_LOG, CB_ADDSTRING, 0, (LPARAM)"None");
-    SendDlgItemMessage(hDlg, IDC_LOG, CB_ADDSTRING, 0, (LPARAM)"Error");
-    SendDlgItemMessage(hDlg, IDC_LOG, CB_ADDSTRING, 0, (LPARAM)"Warning");
-    SendDlgItemMessage(hDlg, IDC_LOG, CB_ADDSTRING, 0, (LPARAM)"Info");
-    SendDlgItemMessage(hDlg, IDC_LOG, CB_ADDSTRING, 0, (LPARAM)"Debug");
-    SendDlgItemMessage(hDlg, IDC_LOG, CB_SETCURSEL, (config->i_log_level), 0);
 
-    memcpy( fourcc, config->fcc, 4 );
-    fourcc[4] = '\0';
-    SetDlgItemText( hDlg, IDC_FOURCC, fourcc );
-
-}
-BOOL CALLBACK callback_debug( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
+void tabs_update_items( HWND hDlg, CONFIG * config )
 {
-    CONFIG* config = (CONFIG*)GetWindowLong(hDlg, GWL_USERDATA);
+    char fourcc[5];
 
-    switch( uMsg )
+       /* update bitrate tab */
+       if (SendMessage( GetDlgItem(hTabs[0],IDC_BITRATEMODE), CB_GETCOUNT, 0, 0 ) == 0)
+       {
+               SendDlgItemMessage(hTabs[0], IDC_BITRATEMODE, CB_ADDSTRING, 0, (LPARAM)"Single Pass - Bitrate");
+               SendDlgItemMessage(hTabs[0], IDC_BITRATEMODE, CB_ADDSTRING, 0, (LPARAM)"Single Pass - Quantizer");
+               SendDlgItemMessage(hTabs[0], IDC_BITRATEMODE, CB_ADDSTRING, 0, (LPARAM)"Multipass - First Pass");
+               SendDlgItemMessage(hTabs[0], IDC_BITRATEMODE, CB_ADDSTRING, 0, (LPARAM)"Multipass - First Pass (fast)");
+               SendDlgItemMessage(hTabs[0], IDC_BITRATEMODE, CB_ADDSTRING, 0, (LPARAM)"Multipass - Nth Pass");
+       }
+       switch( config->i_encoding_type )
     {
-    case WM_INITDIALOG :
-        SetWindowLong( hDlg, GWL_USERDATA, lParam );
-        config = (CONFIG*)lParam;
-        debug_update_dlg( hDlg, config );
+    case 0 : /* 1 Pass, Bitrate Based */
+               SendDlgItemMessage(hTabs[0], IDC_BITRATEMODE, CB_SETCURSEL, 0, 0);
+               SetDlgItemInt( hTabs[0], IDC_BITRATEEDIT, config->bitrate, FALSE );
+               SendDlgItemMessage(hTabs[0], IDC_BITRATESLIDER, TBM_SETPOS, TRUE,
+                                                  config->bitrate );
         break;
-
-    case WM_COMMAND:
-        switch ( HIWORD( wParam ) )
-        {
-        case BN_CLICKED :
-            switch( LOWORD( wParam ) )
-            {
-            case IDOK :
-                EndDialog( hDlg, LOWORD( wParam ) );
-                break;
-            case IDCANCEL :
-                EndDialog( hDlg, LOWORD( wParam ) );
-                break;
-            }
-        case EN_CHANGE :
-            switch( LOWORD( wParam ) )
-            {
-            case IDC_FOURCC :
-                GetDlgItemText( hDlg, IDC_FOURCC, config->fcc, 5 );
-                break;
-            }
-            break;
-            case LBN_SELCHANGE :
-                switch ( LOWORD( wParam ) ) {
-                case IDC_LOG:
-                    config->i_log_level = SendDlgItemMessage(hDlg, IDC_LOG, CB_GETCURSEL, 0, 0);
-                    break;
-                }
-            break;
-        }
+    case 1 : /* 1 Pass, Quantizer Based */
+               SendDlgItemMessage(hTabs[0], IDC_BITRATEMODE, CB_SETCURSEL, 1, 0);
+               SetDlgItemInt( hTabs[0], IDC_BITRATEEDIT, config->i_qp, FALSE );
+               SendDlgItemMessage(hTabs[0], IDC_BITRATESLIDER, TBM_SETPOS, TRUE,
+                                                  config->i_qp );
         break;
+    case 2 : /* 2 Pass */
+               if (config->i_pass >= 2) {
+                       SendDlgItemMessage(hTabs[0], IDC_BITRATEMODE, CB_SETCURSEL, 4, 0);
+               } else if (config->b_fast1pass) {
+                       SendDlgItemMessage(hTabs[0], IDC_BITRATEMODE, CB_SETCURSEL, 3, 0);
+               } else {
+                       SendDlgItemMessage(hTabs[0], IDC_BITRATEMODE, CB_SETCURSEL, 2, 0);
+               }
+               SetDlgItemInt( hTabs[0], IDC_BITRATEEDIT, config->i_2passbitrate, FALSE );
+               SendDlgItemMessage(hTabs[0], IDC_BITRATESLIDER, TBM_SETPOS, TRUE,
+                                                  config->i_2passbitrate );
+        break;
+       }
+
+       CheckDlgButton( hTabs[0], IDC_UPDATESTATS, config->b_updatestats ? BST_CHECKED : BST_UNCHECKED );
+    SetDlgItemText( hTabs[0], IDC_STATSFILE, config->stats );
+
+       /* update rate control tab */
+    SetDlgItemInt( hTabs[1], IDC_QPMIN, config->i_qp_min, FALSE );
+    SetDlgItemInt( hTabs[1], IDC_QPMAX, config->i_qp_max, FALSE );
+    SetDlgItemInt( hTabs[1], IDC_QPSTEP, config->i_qp_step, FALSE );
+    SetDlgItemInt( hTabs[1], IDC_IPRATIO, config->i_key_boost, FALSE );
+    SetDlgItemInt( hTabs[1], IDC_PBRATIO, config->i_b_red, FALSE );
+    SetDlgItemInt( hTabs[1], IDC_CURVECOMP, config->i_curve_comp, FALSE );
+
+       /* update debug tab */
+       if (SendMessage( GetDlgItem(hTabs[3],IDC_LOG), CB_GETCOUNT, 0, 0 ) == 0)
+       {
+               SendDlgItemMessage(hTabs[3], IDC_LOG, CB_ADDSTRING, 0, (LPARAM)"None");
+               SendDlgItemMessage(hTabs[3], IDC_LOG, CB_ADDSTRING, 0, (LPARAM)"Error");
+               SendDlgItemMessage(hTabs[3], IDC_LOG, CB_ADDSTRING, 0, (LPARAM)"Warning");
+               SendDlgItemMessage(hTabs[3], IDC_LOG, CB_ADDSTRING, 0, (LPARAM)"Info");
+               SendDlgItemMessage(hTabs[3], IDC_LOG, CB_ADDSTRING, 0, (LPARAM)"Debug");
+       }
+    SendDlgItemMessage(hTabs[3], IDC_LOG, CB_SETCURSEL, (config->i_log_level), 0);
 
-    default :
-        return 0;
-    }
-
-    return 1;
-}
-
-static void set_dlgitem_int(HWND hDlg, UINT item, int value)
-{
-    char buf[8];
-    sprintf(buf, "%i", value);
-    SetDlgItemText(hDlg, item, buf);
-}
-
-static void adv_update_dlg( HWND hDlg, CONFIG * config )
-{
-    SendDlgItemMessage(hDlg, IDC_ME_METHOD, CB_ADDSTRING, 0, (LPARAM)"Diamond Search");
-    SendDlgItemMessage(hDlg, IDC_ME_METHOD, CB_ADDSTRING, 0, (LPARAM)"Hexagonal Search");
-    SendDlgItemMessage(hDlg, IDC_ME_METHOD, CB_ADDSTRING, 0, (LPARAM)"Uneven Multi-Hexagon");
-    SendDlgItemMessage(hDlg, IDC_ME_METHOD, CB_ADDSTRING, 0, (LPARAM)"Exhaustive Search");
+    memcpy( fourcc, config->fcc, 4 );
+    fourcc[4] = '\0';
+    SetDlgItemText( hTabs[3], IDC_FOURCC, fourcc );
 
-    SetDlgItemInt( hDlg, IDC_MERANGE, config->i_me_range, FALSE );
-    CheckDlgButton( hDlg,IDC_CHROMAME,
-                    config->b_chroma_me ? BST_CHECKED: BST_UNCHECKED );
+       /* update misc. tab */
+       SetDlgItemInt( hTabs[3], IDC_THREADEDIT, config->i_threads, FALSE );
+    CheckDlgButton( hTabs[3],IDC_CABAC,
+                    config->b_cabac ? BST_CHECKED : BST_UNCHECKED );
+    CheckDlgButton( hTabs[3],IDC_LOOPFILTER,
+                    config->b_filter ? BST_CHECKED: BST_UNCHECKED );
 
-    SendDlgItemMessage(hDlg, IDC_DIRECTPRED, CB_ADDSTRING, 0, (LPARAM)"Spatial");
-    SendDlgItemMessage(hDlg, IDC_DIRECTPRED, CB_ADDSTRING, 0, (LPARAM)"Temporal");
+    SetDlgItemInt( hTabs[3], IDC_SAR_W, config->i_sar_width,  FALSE );
+    SetDlgItemInt( hTabs[3], IDC_SAR_H, config->i_sar_height, FALSE );
 
-    SendDlgItemMessage(hDlg, IDC_SUBPEL, CB_ADDSTRING, 0, (LPARAM)"1 (Fastest)");
-    SendDlgItemMessage(hDlg, IDC_SUBPEL, CB_ADDSTRING, 0, (LPARAM)"2");
-    SendDlgItemMessage(hDlg, IDC_SUBPEL, CB_ADDSTRING, 0, (LPARAM)"3");
-    SendDlgItemMessage(hDlg, IDC_SUBPEL, CB_ADDSTRING, 0, (LPARAM)"4");
-    SendDlgItemMessage(hDlg, IDC_SUBPEL, CB_ADDSTRING, 0, (LPARAM)"5 (High Quality)");
-    SendDlgItemMessage(hDlg, IDC_SUBPEL, CB_ADDSTRING, 0, (LPARAM)"6 (RDO - Slowest)");
+    SendDlgItemMessage( hTabs[3], IDC_INLOOP_A, TBM_SETRANGE, TRUE,
+                        (LPARAM) MAKELONG( -6, 6 ) );
+    SendDlgItemMessage( hTabs[3], IDC_INLOOP_A, TBM_SETPOS, TRUE,
+                        config->i_inloop_a );
+    set_dlgitem_int( hTabs[3], IDC_LOOPA_TXT, config->i_inloop_a);
+    SendDlgItemMessage( hTabs[3], IDC_INLOOP_B, TBM_SETRANGE, TRUE,
+                        (LPARAM) MAKELONG( -6, 6 ) );
+    SendDlgItemMessage( hTabs[3], IDC_INLOOP_B, TBM_SETPOS, TRUE,
+                        config->i_inloop_b );
+    set_dlgitem_int( hTabs[3], IDC_LOOPB_TXT, config->i_inloop_b);
 
-    CheckDlgButton( hDlg,IDC_CABAC,
-                    config->b_cabac ? BST_CHECKED : BST_UNCHECKED );
-    CheckDlgButton( hDlg,IDC_LOOPFILTER,
-                    config->b_filter ? BST_CHECKED: BST_UNCHECKED );
-    CheckDlgButton( hDlg,IDC_WBPRED,
-                    config->b_b_wpred ? BST_CHECKED: BST_UNCHECKED );
-    CheckDlgButton( hDlg,IDC_BADAPT,
-                    config->b_bframe_adaptive ? BST_CHECKED: BST_UNCHECKED );
-    CheckDlgButton( hDlg,IDC_BREFS,
-                    config->b_b_refs ? BST_CHECKED: BST_UNCHECKED );
-    CheckDlgButton( hDlg,IDC_P16X16,
+       /* update i/p-frames tab */
+    CheckDlgButton( hTabs[2],IDC_P16X16,
                     config->b_psub16x16 ? BST_CHECKED: BST_UNCHECKED );
-    CheckDlgButton( hDlg,IDC_P8X8,
+    CheckDlgButton( hTabs[2],IDC_P8X8,
                     config->b_psub8x8 ? BST_CHECKED: BST_UNCHECKED );
-    CheckDlgButton( hDlg,IDC_B16X16,
-                    config->b_bsub16x16 ? BST_CHECKED: BST_UNCHECKED );
-    CheckDlgButton( hDlg,IDC_I4X4,
+    CheckDlgButton( hTabs[2],IDC_I4X4,
                     config->b_i4x4 ? BST_CHECKED: BST_UNCHECKED );
-    CheckDlgButton( hDlg,IDC_I8X8,
+    CheckDlgButton( hTabs[2],IDC_I8X8,
                     config->b_i8x8 ? BST_CHECKED: BST_UNCHECKED );
-    CheckDlgButton( hDlg,IDC_DCT8X8,
+    CheckDlgButton( hTabs[2],IDC_DCT8X8,
                     config->b_dct8x8 ? BST_CHECKED: BST_UNCHECKED );
+       SetDlgItemInt( hTabs[2], IDC_REFFRAMES, config->i_refmax, FALSE );
 
-    SetDlgItemInt( hDlg, IDC_KEYINTMIN, config->i_keyint_min, FALSE );
-    SetDlgItemInt( hDlg, IDC_KEYINTMAX, config->i_keyint_max, FALSE );
-    SetDlgItemInt( hDlg, IDC_SCENECUT, config->i_scenecut_threshold, TRUE );
-    SetDlgItemInt( hDlg, IDC_REFFRAMES, config->i_refmax, FALSE );
-    SetDlgItemInt( hDlg, IDC_BFRAME, config->i_bframe, FALSE );
-    SetDlgItemInt( hDlg, IDC_QPMIN, config->i_qp_min, FALSE );
-    SetDlgItemInt( hDlg, IDC_QPMAX, config->i_qp_max, FALSE );
-    SetDlgItemInt( hDlg, IDC_QPSTEP, config->i_qp_step, FALSE );
-
-    SetDlgItemInt( hDlg, IDC_BBIAS, config->i_bframe_bias, TRUE );
-    SendDlgItemMessage( hDlg, IDC_BBIASSLIDER, TBM_SETRANGE, TRUE,
+       /* update b-frames tab */
+    CheckDlgButton( hTabs[2],IDC_WBPRED,
+                    config->b_b_wpred ? BST_CHECKED: BST_UNCHECKED );
+    CheckDlgButton( hTabs[2],IDC_BADAPT,
+                    config->b_bframe_adaptive ? BST_CHECKED: BST_UNCHECKED );
+    CheckDlgButton( hTabs[2],IDC_BREFS,
+                    config->b_b_refs ? BST_CHECKED: BST_UNCHECKED );
+    CheckDlgButton( hTabs[2],IDC_B16X16,
+                    config->b_bsub16x16 ? BST_CHECKED: BST_UNCHECKED );
+    SetDlgItemInt( hTabs[2], IDC_BFRAME, config->i_bframe, FALSE );
+    SetDlgItemInt( hTabs[2], IDC_BBIAS, config->i_bframe_bias, TRUE );
+    SendDlgItemMessage( hTabs[2], IDC_BBIASSLIDER, TBM_SETRANGE, TRUE,
                         (LPARAM) MAKELONG( -100, 100 ) );
-    SendDlgItemMessage( hDlg, IDC_BBIASSLIDER, TBM_SETPOS, TRUE,
+    SendDlgItemMessage( hTabs[2], IDC_BBIASSLIDER, TBM_SETPOS, TRUE,
                         config->i_bframe_bias );
 
-    SetDlgItemInt( hDlg, IDC_SAR_W, config->i_sar_width,  FALSE );
-    SetDlgItemInt( hDlg, IDC_SAR_H, config->i_sar_height, FALSE );
-
-    SetDlgItemInt( hDlg, IDC_IPRATIO, config->i_key_boost, FALSE );
-    SetDlgItemInt( hDlg, IDC_PBRATIO, config->i_b_red, FALSE );
-    SetDlgItemInt( hDlg, IDC_CURVECOMP, config->i_curve_comp, FALSE );
-
-    SendDlgItemMessage(hDlg, IDC_DIRECTPRED, CB_SETCURSEL, (config->i_direct_mv_pred), 0);
-    SendDlgItemMessage(hDlg, IDC_SUBPEL, CB_SETCURSEL, (config->i_subpel_refine), 0);
-    SendDlgItemMessage(hDlg, IDC_ME_METHOD, CB_SETCURSEL, (config->i_me_method), 0);
-
-    SendDlgItemMessage( hDlg, IDC_INLOOP_A, TBM_SETRANGE, TRUE,
-                        (LPARAM) MAKELONG( -6, 6 ) );
-    SendDlgItemMessage( hDlg, IDC_INLOOP_A, TBM_SETPOS, TRUE,
-                        config->i_inloop_a );
-    set_dlgitem_int( hDlg, IDC_LOOPA_TXT, config->i_inloop_a);
-    SendDlgItemMessage( hDlg, IDC_INLOOP_B, TBM_SETRANGE, TRUE,
-                        (LPARAM) MAKELONG( -6, 6 ) );
-    SendDlgItemMessage( hDlg, IDC_INLOOP_B, TBM_SETPOS, TRUE,
-                        config->i_inloop_b );
-    set_dlgitem_int( hDlg, IDC_LOOPB_TXT, config->i_inloop_b);
-
-    EnableWindow( GetDlgItem( hDlg, IDC_P8X8 ), config->b_psub16x16 );
-    EnableWindow( GetDlgItem( hDlg, IDC_BREFS ), config->i_bframe > 1 );
-    EnableWindow( GetDlgItem( hDlg, IDC_WBPRED ), config->i_bframe > 1 );
-    EnableWindow( GetDlgItem( hDlg, IDC_BADAPT ), config->i_bframe > 0 );
-    EnableWindow( GetDlgItem( hDlg, IDC_BBIAS ), config->i_bframe > 0 );
-    EnableWindow( GetDlgItem( hDlg, IDC_BBIASSLIDER ), config->i_bframe > 0 );
-    EnableWindow( GetDlgItem( hDlg, IDC_DIRECTPRED ), config->i_bframe > 0 );
-    EnableWindow( GetDlgItem( hDlg, IDC_I8X8 ), config->b_dct8x8 );
-    EnableWindow( GetDlgItem( hDlg, IDC_MERANGE ), config->i_me_method > 1 );
-    EnableWindow( GetDlgItem( hDlg, IDC_INLOOP_A ), config->b_filter );
-    EnableWindow( GetDlgItem( hDlg, IDC_INLOOP_B ), config->b_filter );
-    EnableWindow( GetDlgItem( hDlg, IDC_CHROMAME ), config->i_subpel_refine >= 4 );
+       /* update scene-cuts tab */
+    SetDlgItemInt( hTabs[1], IDC_KEYINTMIN, config->i_keyint_min, FALSE );
+    SetDlgItemInt( hTabs[1], IDC_KEYINTMAX, config->i_keyint_max, FALSE );
+    SetDlgItemInt( hTabs[1], IDC_SCENECUT, config->i_scenecut_threshold, TRUE );
+
+       /* update motion estimation tab */
+       if (SendMessage( GetDlgItem(hTabs[3],IDC_ME_METHOD), CB_GETCOUNT, 0, 0 ) == 0)
+       {
+               SendDlgItemMessage(hTabs[3], IDC_ME_METHOD, CB_ADDSTRING, 0, (LPARAM)"Diamond Search");
+               SendDlgItemMessage(hTabs[3], IDC_ME_METHOD, CB_ADDSTRING, 0, (LPARAM)"Hexagonal Search");
+               SendDlgItemMessage(hTabs[3], IDC_ME_METHOD, CB_ADDSTRING, 0, (LPARAM)"Uneven Multi-Hexagon");
+               SendDlgItemMessage(hTabs[3], IDC_ME_METHOD, CB_ADDSTRING, 0, (LPARAM)"Exhaustive Search");
+               SendDlgItemMessage(hTabs[3], IDC_DIRECTPRED, CB_ADDSTRING, 0, (LPARAM)"Spatial");
+               SendDlgItemMessage(hTabs[3], IDC_DIRECTPRED, CB_ADDSTRING, 0, (LPARAM)"Temporal");
+               SendDlgItemMessage(hTabs[3], IDC_SUBPEL, CB_ADDSTRING, 0, (LPARAM)"1 (Fastest)");
+               SendDlgItemMessage(hTabs[3], IDC_SUBPEL, CB_ADDSTRING, 0, (LPARAM)"2");
+               SendDlgItemMessage(hTabs[3], IDC_SUBPEL, CB_ADDSTRING, 0, (LPARAM)"3");
+               SendDlgItemMessage(hTabs[3], IDC_SUBPEL, CB_ADDSTRING, 0, (LPARAM)"4");
+               SendDlgItemMessage(hTabs[3], IDC_SUBPEL, CB_ADDSTRING, 0, (LPARAM)"5 (High Quality)");
+               SendDlgItemMessage(hTabs[3], IDC_SUBPEL, CB_ADDSTRING, 0, (LPARAM)"6 (RDO - Slowest)");
+       }
+
+    SendDlgItemMessage(hTabs[3], IDC_ME_METHOD, CB_SETCURSEL, (config->i_me_method), 0);
+    SendDlgItemMessage(hTabs[3], IDC_DIRECTPRED, CB_SETCURSEL, (config->i_direct_mv_pred), 0);
+    SendDlgItemMessage(hTabs[3], IDC_SUBPEL, CB_SETCURSEL, (config->i_subpel_refine), 0);
+    SetDlgItemInt( hTabs[3], IDC_MERANGE, config->i_me_range, FALSE );
+    CheckDlgButton( hTabs[3],IDC_CHROMAME,
+                    config->b_chroma_me ? BST_CHECKED: BST_UNCHECKED );
 }
 
-/* advanced configuration dialog process */
-BOOL CALLBACK callback_advanced( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
+BOOL CALLBACK callback_tabs( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
 {
     CONFIG* config = (CONFIG*)GetWindowLong(hDlg, GWL_USERDATA);
-
     switch( uMsg )
     {
     case WM_INITDIALOG :
-        SetWindowLong( hDlg, GWL_USERDATA, lParam );
-        config = (CONFIG*)lParam;
-
-        adv_update_dlg( hDlg, config );
-        break;
+       
+               SetWindowLong( hDlg, GWL_USERDATA, lParam );
+               config = (CONFIG*)lParam;
+               break;
 
     case WM_COMMAND:
+
         switch ( HIWORD( wParam ) )
         {
         case BN_CLICKED :
+               
             switch( LOWORD( wParam ) )
             {
-            case IDOK :
-                EndDialog( hDlg, LOWORD( wParam ) );
-                break;
             case IDC_CABAC :
-                config->b_cabac = ( IsDlgButtonChecked( hDlg, IDC_CABAC ) == BST_CHECKED );
+                config->b_cabac = ( IsDlgButtonChecked( hTabs[3], IDC_CABAC ) == BST_CHECKED );
                 break;
             case IDC_LOOPFILTER :
-                config->b_filter = ( IsDlgButtonChecked( hDlg, IDC_LOOPFILTER ) == BST_CHECKED );
-                EnableWindow( GetDlgItem( hDlg, IDC_INLOOP_A ), config->b_filter );
-                EnableWindow( GetDlgItem( hDlg, IDC_INLOOP_B ), config->b_filter );
+                config->b_filter = ( IsDlgButtonChecked( hTabs[3], IDC_LOOPFILTER ) == BST_CHECKED );
+                EnableWindow( GetDlgItem( hTabs[3], IDC_INLOOP_A ), config->b_filter );
+                EnableWindow( GetDlgItem( hTabs[3], IDC_INLOOP_B ), config->b_filter );
                 break;
             case IDC_BREFS :
-                config->b_b_refs = ( IsDlgButtonChecked( hDlg, IDC_BREFS ) == BST_CHECKED );
+                config->b_b_refs = ( IsDlgButtonChecked( hTabs[2], IDC_BREFS ) == BST_CHECKED );
                 break;
             case IDC_WBPRED :
-                config->b_b_wpred = ( IsDlgButtonChecked( hDlg, IDC_WBPRED ) == BST_CHECKED );
+                config->b_b_wpred = ( IsDlgButtonChecked( hTabs[2], IDC_WBPRED ) == BST_CHECKED );
                 break;
             case IDC_BADAPT :
-                config->b_bframe_adaptive = ( IsDlgButtonChecked( hDlg, IDC_BADAPT ) == BST_CHECKED );
+                config->b_bframe_adaptive = ( IsDlgButtonChecked( hTabs[2], IDC_BADAPT ) == BST_CHECKED );
                 break;
             case IDC_P16X16 :
-                config->b_psub16x16 = ( IsDlgButtonChecked( hDlg, IDC_P16X16 ) == BST_CHECKED );
-                EnableWindow( GetDlgItem( hDlg, IDC_P8X8 ), config->b_psub16x16 );
+                config->b_psub16x16 = ( IsDlgButtonChecked( hTabs[2], IDC_P16X16 ) == BST_CHECKED );
+                EnableWindow( GetDlgItem( hTabs[2], IDC_P8X8 ), config->b_psub16x16 );
                 break;
             case IDC_P8X8 :
-                config->b_psub8x8 = ( IsDlgButtonChecked( hDlg, IDC_P8X8 ) == BST_CHECKED );
+                config->b_psub8x8 = ( IsDlgButtonChecked( hTabs[2], IDC_P8X8 ) == BST_CHECKED );
                 break;
             case IDC_B16X16 :
-                config->b_bsub16x16 = ( IsDlgButtonChecked( hDlg, IDC_B16X16 ) == BST_CHECKED );
+                config->b_bsub16x16 = ( IsDlgButtonChecked( hTabs[2], IDC_B16X16 ) == BST_CHECKED );
                 break;
             case IDC_I4X4 :
-                config->b_i4x4 = ( IsDlgButtonChecked( hDlg, IDC_I4X4 ) == BST_CHECKED );
+                config->b_i4x4 = ( IsDlgButtonChecked( hTabs[2], IDC_I4X4 ) == BST_CHECKED );
                 break;
             case IDC_I8X8 :
-                config->b_i8x8 = ( IsDlgButtonChecked( hDlg, IDC_I8X8 ) == BST_CHECKED );
+                config->b_i8x8 = ( IsDlgButtonChecked( hTabs[2], IDC_I8X8 ) == BST_CHECKED );
                 break;
             case IDC_DCT8X8 :
-                config->b_dct8x8 = ( IsDlgButtonChecked( hDlg, IDC_DCT8X8 ) == BST_CHECKED );
-                EnableWindow( GetDlgItem( hDlg, IDC_I8X8 ), config->b_dct8x8 );
+                config->b_dct8x8 = ( IsDlgButtonChecked( hTabs[2], IDC_DCT8X8 ) == BST_CHECKED );
+                EnableWindow( GetDlgItem( hTabs[2], IDC_I8X8 ), config->b_dct8x8 );
                 break;
             case IDC_CHROMAME :
-                config->b_chroma_me = ( IsDlgButtonChecked( hDlg, IDC_CHROMAME ) == BST_CHECKED );
+                config->b_chroma_me = ( IsDlgButtonChecked( hTabs[3], IDC_CHROMAME ) == BST_CHECKED );
                 break;
-            }
-            break;
-        case EN_KILLFOCUS :
-                 switch( LOWORD( wParam ) )
-                 {
-            case IDC_MERANGE :
-                config->i_me_range = GetDlgItemInt( hDlg, IDC_MERANGE, FALSE, FALSE );
-                if( config->i_me_range < 4 )
+            case IDC_UPDATESTATS :
+                config->b_updatestats = ( IsDlgButtonChecked( hTabs[0], IDC_UPDATESTATS ) == BST_CHECKED );
+                break;
+            case IDC_STATSFILE_BROWSE :
                 {
-                    config->i_me_range = 4;
-                    SetDlgItemInt( hDlg, IDC_MERANGE, config->i_me_range, FALSE );
+                OPENFILENAME ofn;
+                char tmp[MAX_PATH];
+
+                GetDlgItemText( hTabs[0], IDC_STATSFILE, tmp, MAX_PATH );
+
+                memset( &ofn, 0, sizeof( OPENFILENAME ) );
+                ofn.lStructSize = sizeof( OPENFILENAME );
+
+                ofn.hwndOwner = hDlg;
+                ofn.lpstrFilter = "Statsfile (*.stats)\0*.stats\0All files (*.*)\0*.*\0\0";
+                ofn.lpstrFile = tmp;
+                ofn.nMaxFile = MAX_PATH-4;
+                ofn.Flags = OFN_PATHMUSTEXIST;
+
+                if( config->i_pass == 1 )
+                    ofn.Flags |= OFN_OVERWRITEPROMPT;
+                else ofn.Flags |= OFN_FILEMUSTEXIST;
+
+                if( ( config->i_pass == 1 && GetSaveFileName( &ofn ) ) || 
+                    ( config->i_pass > 1 && GetOpenFileName( &ofn ) ) )
+                    SetDlgItemText( hTabs[0], IDC_STATSFILE, tmp );
                 }
                 break;
             }
             break;
+
         case EN_CHANGE :
+
             switch( LOWORD( wParam ) )
             {
+            case IDC_FOURCC :
+                GetDlgItemText( hTabs[3], IDC_FOURCC, config->fcc, 5 );
+                break;
+            case IDC_THREADEDIT :
+                config->i_threads = GetDlgItemInt( hTabs[3], IDC_THREADEDIT, FALSE, FALSE );
+                if (config->i_threads < 1)
+                {
+                    config->i_threads = 1;
+                    SetDlgItemInt( hTabs[3], IDC_THREADEDIT, config->i_threads, FALSE );
+                }
+                else if (config->i_threads > 4)
+                {
+                    config->i_threads = 4;
+                    SetDlgItemInt( hTabs[3], IDC_THREADEDIT, config->i_threads, FALSE );
+                }                        
+                break;
+            case IDC_BITRATEEDIT :
+                               switch (config->i_encoding_type)
+                               {
+                               case 0:
+                                       config->bitrate = GetDlgItemInt( hTabs[0], IDC_BITRATEEDIT, FALSE, FALSE );
+                                       SendDlgItemMessage( hTabs[0], IDC_BITRATESLIDER, TBM_SETPOS, TRUE, config->bitrate );
+                                       break;
+                               case 1:
+                                       config->i_qp = GetDlgItemInt( hTabs[0], IDC_BITRATEEDIT, FALSE, FALSE );
+                                       SendDlgItemMessage( hTabs[0], IDC_BITRATESLIDER, TBM_SETPOS, TRUE, config->i_qp );
+                                       break;
+                               case 2:
+                                       config->i_2passbitrate = GetDlgItemInt( hTabs[0], IDC_BITRATEEDIT, FALSE, FALSE );
+                                       SendDlgItemMessage( hTabs[0], IDC_BITRATESLIDER, TBM_SETPOS, TRUE, config->i_2passbitrate );
+                                       break;
+                               }
+                               break;
+            case IDC_STATSFILE :
+                if( GetDlgItemText( hTabs[0], IDC_STATSFILE, config->stats, MAX_PATH ) == 0 )
+                    lstrcpy( config->stats, ".\\x264.stats" );
+                break;
             case IDC_KEYINTMIN :
-                config->i_keyint_min = GetDlgItemInt( hDlg, IDC_KEYINTMIN, FALSE, FALSE );
+                config->i_keyint_min = GetDlgItemInt( hTabs[1], IDC_KEYINTMIN, FALSE, FALSE );
                 break;
             case IDC_KEYINTMAX :
-                config->i_keyint_max = GetDlgItemInt( hDlg, IDC_KEYINTMAX, FALSE, FALSE );
+                config->i_keyint_max = GetDlgItemInt( hTabs[1], IDC_KEYINTMAX, FALSE, FALSE );
                 break;
             case IDC_SCENECUT :
-                config->i_scenecut_threshold = GetDlgItemInt( hDlg, IDC_SCENECUT, FALSE, TRUE );
+                config->i_scenecut_threshold = GetDlgItemInt( hTabs[1], IDC_SCENECUT, FALSE, TRUE );
                 if( config->i_scenecut_threshold > 100 )
                 {
                     config->i_scenecut_threshold = 100;
-                    SetDlgItemInt( hDlg, IDC_SCENECUT, config->i_scenecut_threshold, TRUE );
+                    SetDlgItemInt( hTabs[1], IDC_SCENECUT, config->i_scenecut_threshold, TRUE );
                 } else if ( config->i_scenecut_threshold < -1 )
                 {
                     config->i_scenecut_threshold = -1;
-                    SetDlgItemInt( hDlg, IDC_SCENECUT, config->i_scenecut_threshold, TRUE );
+                    SetDlgItemInt( hTabs[1], IDC_SCENECUT, config->i_scenecut_threshold, TRUE );
                 }
                 break;
             case IDC_QPMIN :
-                config->i_qp_min = GetDlgItemInt( hDlg, IDC_QPMIN, FALSE, FALSE );
+                config->i_qp_min = GetDlgItemInt( hTabs[1], IDC_QPMIN, FALSE, FALSE );
                 if( config->i_qp_min > 51 )
                 {
                     config->i_qp_min = 51;
-                    SetDlgItemInt( hDlg, IDC_QPMIN, config->i_qp_min, FALSE );
+                    SetDlgItemInt( hTabs[1], IDC_QPMIN, config->i_qp_min, FALSE );
                 } else if ( config->i_qp_min < 1 )
                 {
                     config->i_qp_min = 1;
-                    SetDlgItemInt( hDlg, IDC_QPMIN, config->i_qp_min, FALSE );
+                    SetDlgItemInt( hTabs[1], IDC_QPMIN, config->i_qp_min, FALSE );
                 }
                 break;
             case IDC_QPMAX :
-                config->i_qp_max = GetDlgItemInt( hDlg, IDC_QPMAX, FALSE, FALSE );
+                config->i_qp_max = GetDlgItemInt( hTabs[1], IDC_QPMAX, FALSE, FALSE );
                 if( config->i_qp_max > 51 )
                 {
                     config->i_qp_max = 51;
-                    SetDlgItemInt( hDlg, IDC_QPMAX, config->i_qp_max, FALSE );
+                    SetDlgItemInt( hTabs[1], IDC_QPMAX, config->i_qp_max, FALSE );
                 } else if ( config->i_qp_max < 1 )
                 {
                     config->i_qp_max = 1;
-                    SetDlgItemInt( hDlg, IDC_QPMAX, config->i_qp_max, FALSE );
+                    SetDlgItemInt( hTabs[1], IDC_QPMAX, config->i_qp_max, FALSE );
                 }
                 break;
             case IDC_QPSTEP :
-                config->i_qp_step = GetDlgItemInt( hDlg, IDC_QPSTEP, FALSE, FALSE );
+                config->i_qp_step = GetDlgItemInt( hTabs[1], IDC_QPSTEP, FALSE, FALSE );
                 if( config->i_qp_step > 50 )
                 {
                     config->i_qp_step = 50;
-                    SetDlgItemInt( hDlg, IDC_QPSTEP, config->i_qp_step, FALSE );
+                    SetDlgItemInt( hTabs[1], IDC_QPSTEP, config->i_qp_step, FALSE );
                 } else if ( config->i_qp_step < 1 )
                 {
                     config->i_qp_step = 1;
-                    SetDlgItemInt( hDlg, IDC_QPSTEP, config->i_qp_step, FALSE );
+                    SetDlgItemInt( hTabs[1], IDC_QPSTEP, config->i_qp_step, FALSE );
                 }
                 break;
             case IDC_SAR_W :
-                config->i_sar_width = GetDlgItemInt( hDlg, IDC_SAR_W, FALSE, FALSE );
+                config->i_sar_width = GetDlgItemInt( hTabs[3], IDC_SAR_W, FALSE, FALSE );
                 break;
             case IDC_SAR_H :
-                config->i_sar_height = GetDlgItemInt( hDlg, IDC_SAR_H, FALSE, FALSE );
+                config->i_sar_height = GetDlgItemInt( hTabs[3], IDC_SAR_H, FALSE, FALSE );
                 break;
             case IDC_REFFRAMES :
-                config->i_refmax = GetDlgItemInt( hDlg, IDC_REFFRAMES, FALSE, FALSE );
+                config->i_refmax = GetDlgItemInt( hTabs[2], IDC_REFFRAMES, FALSE, FALSE );
                 if( config->i_refmax > 16 )
                 {
                     config->i_refmax = 16;
-                    SetDlgItemInt( hDlg, IDC_REFFRAMES, config->i_refmax, FALSE );
+                    SetDlgItemInt( hTabs[2], IDC_REFFRAMES, config->i_refmax, FALSE );
                 }
                 break;
             case IDC_MERANGE :
-                config->i_me_range = GetDlgItemInt( hDlg, IDC_MERANGE, FALSE, FALSE );
+                config->i_me_range = GetDlgItemInt( hTabs[3], IDC_MERANGE, FALSE, FALSE );
                 if( config->i_me_range > 64 )
                 {
                     config->i_me_range = 64;
-                    SetDlgItemInt( hDlg, IDC_MERANGE, config->i_me_range, FALSE );
+                    SetDlgItemInt( hTabs[3], IDC_MERANGE, config->i_me_range, FALSE );
                 }
                 break;
 
             case IDC_BFRAME :
-                config->i_bframe = GetDlgItemInt( hDlg, IDC_BFRAME, FALSE, FALSE );
+                config->i_bframe = GetDlgItemInt( hTabs[2], IDC_BFRAME, FALSE, FALSE );
                 if( config->i_bframe > 5 )
                 {
                     config->i_bframe = 5;
-                    SetDlgItemInt( hDlg, IDC_BFRAME, config->i_bframe, FALSE );
+                    SetDlgItemInt( hTabs[2], IDC_BFRAME, config->i_bframe, FALSE );
                 }
-                EnableWindow( GetDlgItem( hDlg, IDC_BREFS ), config->i_bframe > 1 );
-                EnableWindow( GetDlgItem( hDlg, IDC_WBPRED ), config->i_bframe > 1 );
-                EnableWindow( GetDlgItem( hDlg, IDC_DIRECTPRED ), config->i_bframe > 0 );
-                EnableWindow( GetDlgItem( hDlg, IDC_BADAPT ), config->i_bframe > 0 );
-                EnableWindow( GetDlgItem( hDlg, IDC_BBIAS ), config->i_bframe > 0 );
-                EnableWindow( GetDlgItem( hDlg, IDC_BBIASSLIDER ), config->i_bframe > 0 );
+                EnableWindow( GetDlgItem( hTabs[2], IDC_BREFS ), config->i_bframe > 1 );
+                EnableWindow( GetDlgItem( hTabs[2], IDC_WBPRED ), config->i_bframe > 1 );
+                EnableWindow( GetDlgItem( hTabs[3], IDC_DIRECTPRED ), config->i_bframe > 0 );
+                EnableWindow( GetDlgItem( hTabs[2], IDC_BADAPT ), config->i_bframe > 0 );
+                EnableWindow( GetDlgItem( hTabs[2], IDC_BBIAS ), config->i_bframe > 0 );
+                EnableWindow( GetDlgItem( hTabs[2], IDC_BBIASSLIDER ), config->i_bframe > 0 );
                 break;
             case IDC_BBIAS :
-                config->i_bframe_bias = GetDlgItemInt( hDlg, IDC_BBIAS, FALSE, TRUE );
-                SendDlgItemMessage(hDlg, IDC_BBIASSLIDER, TBM_SETPOS, 1,
+                config->i_bframe_bias = GetDlgItemInt( hTabs[2], IDC_BBIAS, FALSE, TRUE );
+                SendDlgItemMessage(hTabs[2], IDC_BBIASSLIDER, TBM_SETPOS, 1,
                 config->i_bframe_bias);
                 if( config->i_bframe_bias > 100 )
                 {
                     config->i_bframe_bias = 100;
-                    SetDlgItemInt( hDlg, IDC_BBIAS, config->i_bframe_bias, TRUE );
+                    SetDlgItemInt( hTabs[2], IDC_BBIAS, config->i_bframe_bias, TRUE );
                 } else if ( config->i_bframe_bias < -100 )
                 {
                     config->i_bframe_bias = -100;
-                    SetDlgItemInt( hDlg, IDC_BBIAS, config->i_bframe_bias, TRUE );
+                    SetDlgItemInt( hTabs[2], IDC_BBIAS, config->i_bframe_bias, TRUE );
                 }
                 break;
             case IDC_IPRATIO :
-                config->i_key_boost = GetDlgItemInt( hDlg, IDC_IPRATIO, FALSE, FALSE );
+                config->i_key_boost = GetDlgItemInt( hTabs[1], IDC_IPRATIO, FALSE, FALSE );
                 if (config->i_key_boost < 0)
                 {
                     config->i_key_boost = 0;
-                    SetDlgItemInt( hDlg, IDC_IPRATIO, config->i_key_boost, FALSE );
+                    SetDlgItemInt( hTabs[1], IDC_IPRATIO, config->i_key_boost, FALSE );
                 }
                 else if (config->i_key_boost > 70)
                 {
                     config->i_key_boost = 70;
-                    SetDlgItemInt( hDlg, IDC_IPRATIO, config->i_key_boost, FALSE );
+                    SetDlgItemInt( hTabs[1], IDC_IPRATIO, config->i_key_boost, FALSE );
                 }                        
                 break;
             case IDC_PBRATIO :
-                config->i_b_red = GetDlgItemInt( hDlg, IDC_PBRATIO, FALSE, FALSE );
+                config->i_b_red = GetDlgItemInt( hTabs[1], IDC_PBRATIO, FALSE, FALSE );
                 if (config->i_b_red < 0)
                 {
                     config->i_b_red = 0;
-                    SetDlgItemInt( hDlg, IDC_PBRATIO, config->i_b_red, FALSE );
+                    SetDlgItemInt( hTabs[1], IDC_PBRATIO, config->i_b_red, FALSE );
                 }
                 else if (config->i_b_red > 60)
                 {
                     config->i_b_red = 60;
-                    SetDlgItemInt( hDlg, IDC_PBRATIO, config->i_b_red, FALSE );
+                    SetDlgItemInt( hTabs[1], IDC_PBRATIO, config->i_b_red, FALSE );
                 }                        
                 break;
             case IDC_CURVECOMP:
-                config->i_curve_comp = GetDlgItemInt( hDlg, IDC_CURVECOMP, FALSE, FALSE );
+                config->i_curve_comp = GetDlgItemInt( hTabs[1], IDC_CURVECOMP, FALSE, FALSE );
                 if( config->i_curve_comp < 0 )
                 {
                     config->i_curve_comp = 0;
-                    SetDlgItemInt( hDlg, IDC_CURVECOMP, config->i_curve_comp, FALSE );
+                    SetDlgItemInt( hTabs[1], IDC_CURVECOMP, config->i_curve_comp, FALSE );
                 }
                 else if( config->i_curve_comp > 100 )
                 {
                     config->i_curve_comp = 100;
-                    SetDlgItemInt( hDlg, IDC_CURVECOMP, config->i_curve_comp, FALSE );
+                    SetDlgItemInt( hTabs[1], IDC_CURVECOMP, config->i_curve_comp, FALSE );
                 }                        
                 break;
             }
             break;
-            case LBN_SELCHANGE :
-                switch ( LOWORD( wParam ) ) {
-                case IDC_DIRECTPRED:
-                    config->i_direct_mv_pred = SendDlgItemMessage(hDlg, IDC_DIRECTPRED, CB_GETCURSEL, 0, 0);
-                    break;
-                case IDC_SUBPEL:
-                    config->i_subpel_refine = SendDlgItemMessage(hDlg, IDC_SUBPEL, CB_GETCURSEL, 0, 0);
-                    EnableWindow( GetDlgItem( hDlg, IDC_CHROMAME ), config->i_subpel_refine >= 4 );
-                    break;
-                case IDC_ME_METHOD:
-                    config->i_me_method = SendDlgItemMessage(hDlg, IDC_ME_METHOD, CB_GETCURSEL, 0, 0);
-                    EnableWindow( GetDlgItem( hDlg, IDC_MERANGE ), config->i_me_method > 1 );
-                    break;
+
+        case LBN_SELCHANGE :
+               
+            switch ( LOWORD( wParam ) ) 
+                       {
+            case IDC_DIRECTPRED:
+                config->i_direct_mv_pred = SendDlgItemMessage(hTabs[3], IDC_DIRECTPRED, CB_GETCURSEL, 0, 0);
+                break;
+            case IDC_SUBPEL:
+                config->i_subpel_refine = SendDlgItemMessage(hTabs[3], IDC_SUBPEL, CB_GETCURSEL, 0, 0);
+                EnableWindow( GetDlgItem( hTabs[3], IDC_CHROMAME ), config->i_subpel_refine >= 4 );
+                break;
+            case IDC_ME_METHOD:
+                config->i_me_method = SendDlgItemMessage(hTabs[3], IDC_ME_METHOD, CB_GETCURSEL, 0, 0);
+                EnableWindow( GetDlgItem( hTabs[3], IDC_MERANGE ), config->i_me_method > 1 );
+                break;
+            case IDC_LOG:
+                config->i_log_level = SendDlgItemMessage(hTabs[3], IDC_LOG, CB_GETCURSEL, 0, 0);
+                break;
+                       case IDC_BITRATEMODE:
+                               switch(SendDlgItemMessage(hTabs[0], IDC_BITRATEMODE, CB_GETCURSEL, 0, 0))
+                               {
+                               case 0:
+                                       config->i_encoding_type = 0;
+                                       break;
+                               case 1:
+                                       config->i_encoding_type = 1;
+                                       break;
+                               case 2:
+                                       config->i_encoding_type = 2;
+                                       config->i_pass = 1;
+                                       config->b_fast1pass = FALSE;
+                                       break;
+                               case 3:
+                                       config->i_encoding_type = 2;
+                                       config->i_pass = 1;
+                                       config->b_fast1pass = TRUE;
+                                       break;
+                               case 4:
+                                       config->i_encoding_type = 2;
+                                       config->i_pass = 2;
+                                       break;
+                               }
+                               tabs_enable_items( hDlg, config );
+                               tabs_update_items( hDlg, config );
+                               break;
+                       }
+               break;
+
+        case EN_KILLFOCUS :
+               
+                       switch( LOWORD( wParam ) )
+                       {
+            case IDC_MERANGE :
+                config->i_me_range = GetDlgItemInt( hTabs[3], IDC_MERANGE, FALSE, FALSE );
+                if( config->i_me_range < 4 )
+                {
+                    config->i_me_range = 4;
+                    SetDlgItemInt( hTabs[3], IDC_MERANGE, config->i_me_range, FALSE );
                 }
+                break;
+            }
             break;
-        }
+               }
         break;
-        case WM_HSCROLL : 
-        if( (HWND) lParam == GetDlgItem( hDlg, IDC_INLOOP_A ) ) {
-                config->i_inloop_a = SendDlgItemMessage( hDlg, IDC_INLOOP_A, TBM_GETPOS, 0, 0 );
-                set_dlgitem_int( hDlg, IDC_LOOPA_TXT, config->i_inloop_a);
-        }
-        if( (HWND) lParam == GetDlgItem( hDlg, IDC_INLOOP_B ) ) {
-                config->i_inloop_b = SendDlgItemMessage( hDlg, IDC_INLOOP_B, TBM_GETPOS, 0, 0 );
-                set_dlgitem_int( hDlg, IDC_LOOPB_TXT, config->i_inloop_b);
-        }
-        if( (HWND) lParam == GetDlgItem( hDlg, IDC_BBIASSLIDER ) ) {
-                config->i_bframe_bias = SendDlgItemMessage( hDlg, IDC_BBIASSLIDER, TBM_GETPOS, 0, 0 );
-                set_dlgitem_int( hDlg, IDC_BBIAS, config->i_bframe_bias);
+
+    case WM_HSCROLL :
+       
+        if( (HWND) lParam == GetDlgItem( hTabs[0], IDC_BITRATESLIDER ) )
+        {
+                       switch (config->i_encoding_type)
+                       {
+                       case 0:
+                               config->bitrate = SendDlgItemMessage( hTabs[0], IDC_BITRATESLIDER, TBM_GETPOS, 0, 0 );
+                               SetDlgItemInt( hTabs[0], IDC_BITRATEEDIT, config->bitrate, FALSE );
+                               break;
+                       case 1:
+                               config->i_qp = SendDlgItemMessage( hTabs[0], IDC_BITRATESLIDER, TBM_GETPOS, 0, 0 );
+                               SetDlgItemInt( hTabs[0], IDC_BITRATEEDIT, config->i_qp, FALSE );
+                               break;
+                       case 2:
+                               config->i_2passbitrate = SendDlgItemMessage( hTabs[0], IDC_BITRATESLIDER, TBM_GETPOS, 0, 0 );
+                               SetDlgItemInt( hTabs[0], IDC_BITRATEEDIT, config->i_2passbitrate, FALSE );
+                               break;
+                       }
+                       break;
         }
+               else if( (HWND) lParam == GetDlgItem( hTabs[3], IDC_INLOOP_A ) ) 
+               {
+                       config->i_inloop_a = SendDlgItemMessage( hTabs[3], IDC_INLOOP_A, TBM_GETPOS, 0, 0 );
+                       set_dlgitem_int( hTabs[3], IDC_LOOPA_TXT, config->i_inloop_a);
+               }
+               else if( (HWND) lParam == GetDlgItem( hTabs[3], IDC_INLOOP_B ) ) 
+               {
+                       config->i_inloop_b = SendDlgItemMessage( hTabs[3], IDC_INLOOP_B, TBM_GETPOS, 0, 0 );
+                       set_dlgitem_int( hTabs[3], IDC_LOOPB_TXT, config->i_inloop_b);
+               }
+               else if( (HWND) lParam == GetDlgItem( hTabs[2], IDC_BBIASSLIDER ) ) 
+               {
+                       config->i_bframe_bias = SendDlgItemMessage( hTabs[2], IDC_BBIASSLIDER, TBM_GETPOS, 0, 0 );
+                       set_dlgitem_int( hTabs[2], IDC_BBIAS, config->i_bframe_bias);
+               }
+               break;
+
+    default :
+        return 0;
+    }
+
+    return 1;
+}
+
+
+/* About box */
+
+BOOL CALLBACK callback_about( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
+{
+    switch( uMsg )
+    {
+    case WM_INITDIALOG :
+    {
+        char temp[1024];
+        sprintf( temp, "Core %d%s, build %s %s", X264_BUILD, X264_VERSION, __DATE__, __TIME__ );
+        SetDlgItemText( hDlg, IDC_BUILD,  temp );
         break;
-        case WM_CLOSE:
-            EndDialog( hDlg, LOWORD( wParam ) );
-            break;
+    }
+
+    case WM_COMMAND:
+        if (LOWORD(wParam) == IDC_HOMEPAGE && HIWORD(wParam) == STN_CLICKED)
+            ShellExecute( hDlg, "open", X264_WEBSITE, NULL, NULL, SW_SHOWNORMAL );
+        else if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
+            EndDialog( hDlg, LOWORD(wParam) );
+        break;
+
     default :
         return 0;
     }
+
     return 1;
 }
 
-/* error console dialog process */
+
+/* Error console */
+
 BOOL CALLBACK callback_err_console( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
 {
     switch( uMsg )
@@ -1037,3 +1028,5 @@ BOOL CALLBACK callback_err_console( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM
 
     return 0;
 }
+
+
index 87c1fe1..891324c 100644 (file)
@@ -1,13 +1,16 @@
 //{{NO_DEPENDENCIES}}
-// Microsoft Developer Studio generated include file.
+// Microsoft Visual C++ generated include file.
 // Used by resource.rc
 //
 #define IDD_DIALOG1                     101
-#define IDD_MAINCONFIG                  101
-#define IDD_ADVANCED                    102
 #define IDD_ABOUT                       103
 #define IDD_ERRCONSOLE                  104
-#define IDD_DEBUG                       105
+#define IDD_TAB_BITRATE                 106
+#define IDD_MAINCONFIG                  107
+#define IDB_LOGO                        108
+#define IDD_TAB_IPFRAMES                109
+#define IDD_TAB_RATECONTROL             113
+#define IDD_TAB_MISC                    114
 #define IDC_BITRATESLIDER               1002
 #define IDC_BITRATEEDIT                 1003
 #define IDC_BITRATESLIDER2              1004
 #define IDC_DEBUG                       1084
 #define IDC_CPU_MMX                     1086
 #define IDC_SCENECUT                    1087
+#define IDC_TAB1                        1089
+#define IDC_BITRATEMODE                 1091
+#define IDC_BITRATELABEL                1092
+#define IDC_LOGO                        1093
+#define IDC_BUILDREV                    1095
 
 // Next default values for new objects
 // 
 #ifdef APSTUDIO_INVOKED
 #ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE        106
+#define _APS_NEXT_RESOURCE_VALUE        109
 #define _APS_NEXT_COMMAND_VALUE         40001
-#define _APS_NEXT_CONTROL_VALUE         1088
+#define _APS_NEXT_CONTROL_VALUE         1096
 #define _APS_NEXT_SYMED_VALUE           101
 #endif
 #endif
index 5d4abab..d5ffb19 100644 (file)
@@ -1,4 +1,4 @@
-//Microsoft Developer Studio generated resource script.
+// Microsoft Visual C++ generated resource script.
 //
 #include "resource.h"
 
@@ -7,20 +7,17 @@
 //
 // Generated from the TEXTINCLUDE 2 resource.
 //
-#include <windows.h>
-#ifndef IDC_STATIC
-#define IDC_STATIC (-1)
-#endif
+#include "afxres.h"
 
 /////////////////////////////////////////////////////////////////////////////
 #undef APSTUDIO_READONLY_SYMBOLS
 
 /////////////////////////////////////////////////////////////////////////////
-// English (Canada) resources
+// English (U.S.) resources
 
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENC)
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
 #ifdef _WIN32
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_CAN
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 #pragma code_page(1252)
 #endif //_WIN32
 
@@ -29,215 +26,120 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_CAN
 // Dialog
 //
 
-IDD_DEBUG DIALOG DISCARDABLE  0, 0, 186, 95
-STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION
-CAPTION "Debug"
-FONT 8, "MS Sans Serif"
-BEGIN
-    DEFPUSHBUTTON   "OK",IDOK,129,7,50,14
-    PUSHBUTTON      "Cancel",IDCANCEL,129,24,50,14
-    COMBOBOX        IDC_LOG,48,14,48,55,CBS_DROPDOWNLIST | WS_VSCROLL |
-                    WS_TABSTOP
-    LTEXT           "Log Mode",IDC_STATIC,13,17,33,8
-    LTEXT           "FourCC:",IDC_STATIC,13,36,26,14,SS_CENTERIMAGE
-    EDITTEXT        IDC_FOURCC,48,36,25,14,ES_AUTOHSCROLL
-END
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// DESIGNINFO
-//
-
-#ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO DISCARDABLE
+IDD_MAINCONFIG DIALOGEX 0, 0, 204, 222
+STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "x264 Configuration"
+FONT 8, "MS Sans Serif", 400, 0, 0x0
 BEGIN
-    IDD_DEBUG, DIALOG
-    BEGIN
-        LEFTMARGIN, 7
-        RIGHTMARGIN, 179
-        TOPMARGIN, 7
-        BOTTOMMARGIN, 88
-    END
+    DEFPUSHBUTTON   "OK",IDOK,156,204,42,14
+    CONTROL         "",IDC_TAB1,"SysTabControl32",TCS_MULTILINE | WS_TABSTOP,0,0,204,200,WS_EX_TRANSPARENT
+    PUSHBUTTON      "Load Defaults",IDC_DEFAULTS,6,204,54,14
+    PUSHBUTTON      "Cancel",IDCANCEL,108,204,42,14
 END
-#endif    // APSTUDIO_INVOKED
-
 
-/////////////////////////////////////////////////////////////////////////////
-//
-// Dialog
-//
-
-IDD_MAINCONFIG DIALOG DISCARDABLE  0, 0, 225, 253
-STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "x264 Configuration"
-FONT 8, "MS Sans Serif"
+IDD_TAB_BITRATE DIALOGEX 0, 0, 200, 188
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+FONT 8, "MS Shell Dlg", 0, 0, 0x0
 BEGIN
-    DEFPUSHBUTTON   "OK",IDOK,120,232,46,14
-    PUSHBUTTON      "Cancel",IDCANCEL,168,232,50,14
-    CONTROL         "Slider1",IDC_BITRATESLIDER,"msctls_trackbar32",TBS_BOTH | 
-                    TBS_NOTICKS | WS_TABSTOP,13,31,175,15
-    EDITTEXT        IDC_BITRATEEDIT,189,32,26,14,ES_AUTOHSCROLL | ES_NUMBER
-    LTEXT           "Average Bitrate (kbps)",IDC_STATIC,59,20,73,8
-    GROUPBOX        "",IDC_STATIC,7,7,211,47
-    LTEXT           "0",IDC_BITRATELOW,16,20,22,8
-    LTEXT           "5000",IDC_BITRATEHIGH,166,20,17,8
-    PUSHBUTTON      "Load Defaults",IDC_DEFAULTS,7,232,57,14
-    PUSHBUTTON      "Advanced",IDC_ADVANCED,67,232,49,14
-    CONTROL         "Slider1",IDC_QUANTSLIDER,"msctls_trackbar32",TBS_BOTH | 
-                    TBS_NOTICKS | WS_TABSTOP,13,81,175,15
-    EDITTEXT        IDC_QUANTEDIT,189,82,26,14,ES_AUTOHSCROLL | ES_NUMBER
-    LTEXT           "Quantizer",IDC_STATIC,83,71,31,8
-    GROUPBOX        "",IDC_STATIC,7,57,211,47
-    LTEXT           "0 (High Quality)",IDC_BITRATELOW2,16,71,50,8
-    LTEXT           "51 (Low Quality)",IDC_BITRATEHIGH2,131,71,53,8
-    GROUPBOX        "",IDC_STATIC,7,108,211,95
-    CONTROL         "Single Pass - Bitrate",IDC_RADIOBITRATE,"Button",
-                    BS_AUTORADIOBUTTON,13,7,77,10
-    CONTROL         "Single Pass - Quantizer",IDC_RADIOQUANT,"Button",
-                    BS_AUTORADIOBUTTON,13,57,87,10
-    CONTROL         "Multipass",IDC_RADIOTWOPASS,"Button",BS_AUTORADIOBUTTON,
-                    13,108,43,10
-    CONTROL         "First pass",IDC_2PASS1,"Button",BS_AUTORADIOBUTTON | 
-                    WS_GROUP,27,123,46,10
-    CONTROL         "Nth pass",IDC_2PASS2,"Button",BS_AUTORADIOBUTTON,87,
-                    123,58,10
-    CONTROL         "Slider1",IDC_2PASSBITRATE_S,"msctls_trackbar32",
-                    TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,13,148,175,15
-    EDITTEXT        IDC_2PASSBITRATE,189,148,26,14,ES_AUTOHSCROLL | 
-                    ES_NUMBER
-    LTEXT           "Target Bitrate (kbps)",IDC_STATIC,63,137,73,8
-    LTEXT           "0",IDC_BITRATELOW3,16,137,22,8
-    LTEXT           "5000",IDC_BITRATEHIGH3,166,137,17,8
-    CONTROL         "Fast first pass",IDC_FAST1PASS,"Button",BS_AUTOCHECKBOX |
-                    WS_TABSTOP,20,167,61,10
-    CONTROL         "Update statsfile",IDC_UPDATESTATS,"Button",
-                    BS_AUTOCHECKBOX | WS_TABSTOP,112,167,80,10
-    LTEXT           "Statsfile name:",IDC_STATIC,20,185,52,8
-    EDITTEXT        IDC_STATSFILE,72,184,100,13,ES_AUTOHSCROLL
-    PUSHBUTTON      "...",IDC_STATSFILE_BROWSE,177,185,18,11
-    LTEXT           "Threads",IDC_THREADS,102,214,27,8
-    EDITTEXT        IDC_THREADEDIT,132,211,19,14,ES_AUTOHSCROLL | ES_NUMBER
-    PUSHBUTTON      "Debug",IDC_DEBUG,7,214,57,14
+    CONTROL         108,IDC_LOGO,"Static",SS_BITMAP,31,12,136,39,WS_EX_CLIENTEDGE
+    COMBOBOX        IDC_BITRATEMODE,30,66,138,66,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    LTEXT           "Average Bitrate (kbps)",IDC_BITRATELABEL,30,84,90,12
+    CONTROL         "",IDC_BITRATESLIDER,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,24,95,150,18
+    EDITTEXT        IDC_BITRATEEDIT,144,84,24,12,ES_AUTOHSCROLL | ES_NUMBER
+    LTEXT           "0",IDC_BITRATELOW,30,114,66,12
+    RTEXT           "5000",IDC_BITRATEHIGH,108,114,60,12
+    CONTROL         "Update Statsfile",IDC_UPDATESTATS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,138,72,12
+    LTEXT           "Statsfile name",IDC_STATIC,12,156,48,12,SS_CENTERIMAGE
+    EDITTEXT        IDC_STATSFILE,60,156,102,12,ES_AUTOHSCROLL
+    PUSHBUTTON      "...",IDC_STATSFILE_BROWSE,168,156,18,12
 END
 
-IDD_ADVANCED DIALOG DISCARDABLE  0, 0, 489, 247
-STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "x264 Advanced Settings"
-FONT 8, "MS Sans Serif"
+IDD_TAB_IPFRAMES DIALOGEX 0, 0, 200, 188
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+FONT 8, "MS Shell Dlg", 0, 0, 0x0
 BEGIN
-    DEFPUSHBUTTON   "OK",IDOK,432,231,50,14
-    GROUPBOX        "H.264 Features",IDC_STATIC,7,7,145,91
-    CONTROL         "CABAC",IDC_CABAC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
-                    16,18,39,10
-    GROUPBOX        "",IDC_STATIC,12,36,136,40
-    CONTROL         "Deblocking filter",IDC_LOOPFILTER,"Button",
-                    BS_AUTOCHECKBOX | WS_TABSTOP,16,35,64,10
-    LTEXT           "Strength",IDC_STATIC,16,48,51,10,SS_CENTERIMAGE
-    CONTROL         "Slider1",IDC_INLOOP_A,"msctls_trackbar32",TBS_NOTICKS | 
-                    WS_TABSTOP,71,48,50,10
-    LTEXT           "0",IDC_LOOPA_TXT,130,48,8,10,SS_CENTERIMAGE
-    LTEXT           "Max ref frames:",IDC_STATIC,16,80,52,14,SS_CENTERIMAGE
-    EDITTEXT        IDC_REFFRAMES,122,80,25,14,ES_AUTOHSCROLL | ES_NUMBER
-    GROUPBOX        "B-frames",IDC_STATIC,7,98,290,36
-    LTEXT           "Max consecutive:",IDC_STATIC,16,116,60,8
-    EDITTEXT        IDC_BFRAME,80,113,25,14,ES_AUTOHSCROLL | ES_NUMBER
-    LTEXT           "Direct mode:",IDC_STATIC,300,200,43,12,SS_CENTERIMAGE
-    COMBOBOX        IDC_DIRECTPRED,420,200,55,67,CBS_DROPDOWNLIST |
-                    WS_VSCROLL | WS_TABSTOP
-    COMBOBOX        IDC_SUBPEL,383,152,93,77,CBS_DROPDOWNLIST | CBS_SORT |
-                    WS_VSCROLL | WS_TABSTOP
-    CONTROL         "Use as references",IDC_BREFS,"Button",BS_AUTOCHECKBOX | 
-                    BS_LEFTTEXT | WS_TABSTOP,113,108,71,10
-    CONTROL         "Weighted biprediction",IDC_WBPRED,"Button",
-                    BS_AUTOCHECKBOX | WS_TABSTOP,165,168,82,12
-    GROUPBOX        "More Encoder Settings",IDC_STATIC,155,7,141,91
-    LTEXT           "Max IDR-frame interval:",IDC_STATIC,164,18,95,14,
-                    SS_CENTERIMAGE
-    EDITTEXT        IDC_KEYINTMAX,262,18,25,14,ES_AUTOHSCROLL | ES_NUMBER
-    LTEXT           "Min IDR-frame interval:",IDC_STATIC,164,36,90,14,
-                    SS_CENTERIMAGE
-    EDITTEXT        IDC_KEYINTMIN,262,36,25,14,ES_AUTOHSCROLL | ES_NUMBER
-    GROUPBOX        "Ratecontrol",IDC_STATIC,300,7,182,128
-    LTEXT           "Keyframe boost (%):",IDC_STATIC,362,18,68,14,
-                    SS_CENTERIMAGE
-    EDITTEXT        IDC_IPRATIO,444,18,25,14,ES_AUTOHSCROLL | ES_NUMBER
-    LTEXT           "B-frames reduction (%):",IDC_STATIC,362,36,75,14,
-                    SS_CENTERIMAGE
-    EDITTEXT        IDC_PBRATIO,444,36,25,14,ES_AUTOHSCROLL | ES_NUMBER
-    LTEXT           "Bitrate variability (%):",IDC_STATIC,362,54,75,14,
-                    SS_CENTERIMAGE
-    EDITTEXT        IDC_CURVECOMP,444,54,25,14,ES_AUTOHSCROLL | ES_NUMBER
-    GROUPBOX        "Analysis:",IDC_STATIC,7,136,475,90
-    CONTROL         "8x16, 16x8 and 8x8 P-frame search",IDC_P16X16,"Button",
-                    BS_AUTOCHECKBOX | WS_TABSTOP,17,152,127,12
-    CONTROL         "4x8, 8x4 and 4x4 P-frame search",IDC_P8X8,"Button",
-                    BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,165,152,119,12
-    CONTROL         "8x16, 16x8 and 8x8 B-frame search",IDC_B16X16,"Button",
-                    BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,17,168,127,12
-    CONTROL         "4x4 Intra search",IDC_I4X4,"Button",BS_AUTOCHECKBOX | 
-                    WS_TABSTOP,165,184,82,12
-    LTEXT           "Partition decision quality:",IDC_STATIC,300,152,80,12,
-                    SS_CENTERIMAGE
-    EDITTEXT        IDC_SAR_W,232,79,21,14,ES_AUTOHSCROLL | ES_NUMBER
-    EDITTEXT        IDC_SAR_H,266,79,21,14,ES_AUTOHSCROLL | ES_NUMBER
-    LTEXT           "Sample AR",IDC_STATIC,164,79,58,14,
-                    SS_CENTERIMAGE
-    LTEXT           ":",IDC_STATIC,257,81,8,8
-    CONTROL         "8x8 Intra search",IDC_I8X8,"Button",BS_AUTOCHECKBOX | 
-                    BS_VCENTER | WS_TABSTOP,17,184,67,12
-    CONTROL         "8x8 DCT",IDC_DCT8X8,"Button",BS_AUTOCHECKBOX | 
-                    WS_TABSTOP,17,200,44,12
-    LTEXT           "ME Method",IDC_STATIC,300,168,38,12,SS_CENTERIMAGE
-    CONTROL         "Chroma ME",IDC_CHROMAME,"Button",BS_AUTOCHECKBOX |
-                    WS_TABSTOP,165,200,53,12
-    LTEXT           "ME Range",IDC_STATIC,300,184,35,12,SS_CENTERIMAGE
-    EDITTEXT        IDC_MERANGE,384,184,24,14,ES_AUTOHSCROLL | ES_NUMBER
-    COMBOBOX        IDC_ME_METHOD,384,168,92,67,CBS_DROPDOWNLIST |
-                    WS_VSCROLL | WS_TABSTOP
-    CONTROL         "Adaptive",IDC_BADAPT,"Button",BS_AUTOCHECKBOX |
-                    BS_LEFTTEXT | WS_TABSTOP,141,120,43,10
-    LTEXT           "Bias",IDC_STATIC,227,119,14,10,SS_CENTERIMAGE
-    CONTROL         "Slider1",IDC_BBIASSLIDER,"msctls_trackbar32",TBS_BOTH |
-                    TBS_NOTICKS | WS_TABSTOP,215,106,73,10
-    EDITTEXT        IDC_BBIAS,255,117,29,14,ES_AUTOHSCROLL
-    LTEXT           "Min QP",IDC_STATIC,362,72,24,14,SS_CENTERIMAGE
-    LTEXT           "Max QP",IDC_STATIC,362,90,26,14,SS_CENTERIMAGE
-    LTEXT           "Max QP Step",IDC_STATIC,362,108,43,14,SS_CENTERIMAGE
-    EDITTEXT        IDC_QPMIN,444,72,25,14,ES_AUTOHSCROLL
-    EDITTEXT        IDC_QPMAX,444,90,25,14,ES_AUTOHSCROLL
-    EDITTEXT        IDC_QPSTEP,444,108,25,14,ES_AUTOHSCROLL
-    CONTROL         "Slider2",IDC_INLOOP_B,"msctls_trackbar32",TBS_NOTICKS |
-                    WS_TABSTOP,71,62,50,10
-    LTEXT           "Threshold",IDC_STATIC,16,62,48,10,SS_CENTERIMAGE
-    LTEXT           "0",IDC_LOOPB_TXT,130,62,8,10
-    LTEXT           "Scene Cut Threshold",IDC_STATIC,164,52,68,14,
-                    SS_CENTERIMAGE
-    EDITTEXT        IDC_SCENECUT,262,54,25,14,ES_AUTOHSCROLL
+    GROUPBOX        "I Frames",IDC_STATIC,6,2,186,40,WS_DISABLED
+    GROUPBOX        "P Frames",IDC_STATIC,6,44,186,51,WS_DISABLED
+    GROUPBOX        "B Frames",IDC_STATIC,6,98,186,82,WS_DISABLED
+    CONTROL         "8x8 DCT",IDC_DCT8X8,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,30,12,42,12,WS_EX_TRANSPARENT
+    CONTROL         "8x8 Intra search",IDC_I8X8,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,30,24,66,12,WS_EX_TRANSPARENT
+    CONTROL         "4x4 Intra search",IDC_I4X4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,24,66,12,WS_EX_TRANSPARENT
+    CONTROL         "8x16, 16x8 and 8x8 P-frame search",IDC_P16X16,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,30,54,127,12,WS_EX_TRANSPARENT
+    CONTROL         "4x8, 8x4 and 4x4 P-frame search",IDC_P8X8,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,30,66,119,12,WS_EX_TRANSPARENT
+    LTEXT           "Max ref frames",IDC_STATIC,30,78,52,12,SS_CENTERIMAGE,WS_EX_TRANSPARENT
+    EDITTEXT        IDC_REFFRAMES,84,78,24,12,ES_AUTOHSCROLL | ES_NUMBER
+    CONTROL         "Adaptive",IDC_BADAPT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,30,120,43,12,WS_EX_TRANSPARENT
+    CONTROL         "Use as references",IDC_BREFS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,30,108,71,12,WS_EX_TRANSPARENT
+    CONTROL         "Weighted biprediction",IDC_WBPRED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,78,120,82,12,WS_EX_TRANSPARENT
+    CONTROL         "8x16, 16x8 and 8x8 B-frame search",IDC_B16X16,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,30,132,127,12,WS_EX_TRANSPARENT
+    LTEXT           "Max consecutive",IDC_STATIC,30,148,60,12,SS_CENTERIMAGE,WS_EX_TRANSPARENT
+    EDITTEXT        IDC_BFRAME,126,148,24,12,ES_AUTOHSCROLL | ES_NUMBER
+    LTEXT           "Bias",IDC_STATIC,30,162,14,12,SS_CENTERIMAGE,WS_EX_TRANSPARENT
+    CONTROL         "",IDC_BBIASSLIDER,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,48,162,72,12,WS_EX_TRANSPARENT
+    EDITTEXT        IDC_BBIAS,126,162,24,12,ES_AUTOHSCROLL
 END
 
-IDD_ABOUT DIALOG DISCARDABLE  0, 0, 213, 130
-STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "About x264"
-FONT 8, "MS Sans Serif"
+IDD_TAB_RATECONTROL DIALOGEX 0, 0, 200, 188
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+FONT 8, "MS Shell Dlg", 0, 0, 0x0
 BEGIN
-    DEFPUSHBUTTON   "OK",IDOK,158,109,48,14
-    PUSHBUTTON      "Visit Homepage",IDC_HOMEPAGE,7,109,77,14
-    CTEXT           "BUILD",IDC_BUILD,13,20,173,8,SS_CENTERIMAGE
-    LTEXT           "x264 - H.264/MPEG-4 AVC codec",IDC_X264,53,8,145,8,
-                    SS_CENTERIMAGE
-    CTEXT           "Copyright 2005 Laurent Aimar, Justin Clay, Min Chen,\nEric Petit, Måns Rullgård, Loren Merritt\n\nThis program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation",
-                    IDC_STATIC,7,47,199,51
+    GROUPBOX        "Bitrate",IDC_STATIC,6,2,186,58,WS_DISABLED
+    GROUPBOX        "Quality",IDC_STATIC,6,62,186,58,WS_DISABLED
+    GROUPBOX        "Scene Cuts",IDC_STATIC,6,122,186,58,WS_DISABLED
+    LTEXT           "Keyframe boost (%)",IDC_STATIC,42,12,68,12,SS_CENTERIMAGE,WS_EX_TRANSPARENT
+    LTEXT           "B-frames reduction (%)",IDC_STATIC,42,27,78,12,SS_CENTERIMAGE,WS_EX_TRANSPARENT
+    LTEXT           "Bitrate variability (%)",IDC_STATIC,42,40,68,12,SS_CENTERIMAGE,WS_EX_TRANSPARENT
+    LTEXT           "Min QP",IDC_STATIC,42,72,24,12,SS_CENTERIMAGE,WS_EX_TRANSPARENT
+    LTEXT           "Max QP",IDC_STATIC,42,86,26,12,SS_CENTERIMAGE,WS_EX_TRANSPARENT
+    LTEXT           "Max QP Step",IDC_STATIC,42,100,43,12,SS_CENTERIMAGE,WS_EX_TRANSPARENT
+    LTEXT           "Scene Cut Threshold",IDC_STATIC,42,132,72,12,SS_CENTERIMAGE,WS_EX_TRANSPARENT
+    LTEXT           "Min IDR-frame interval",IDC_STATIC,42,146,78,12,SS_CENTERIMAGE,WS_EX_TRANSPARENT
+    LTEXT           "Max IDR-frame interval",IDC_STATIC,42,160,78,12,SS_CENTERIMAGE,WS_EX_TRANSPARENT
+    EDITTEXT        IDC_IPRATIO,126,12,24,12,ES_AUTOHSCROLL | ES_NUMBER
+    EDITTEXT        IDC_PBRATIO,126,26,24,12,ES_AUTOHSCROLL | ES_NUMBER
+    EDITTEXT        IDC_CURVECOMP,126,40,24,12,ES_AUTOHSCROLL | ES_NUMBER
+    EDITTEXT        IDC_QPMIN,126,72,24,12,ES_AUTOHSCROLL
+    EDITTEXT        IDC_QPMAX,126,86,24,12,ES_AUTOHSCROLL
+    EDITTEXT        IDC_QPSTEP,126,100,24,12,ES_AUTOHSCROLL
+    EDITTEXT        IDC_SCENECUT,126,132,24,12,ES_AUTOHSCROLL
+    EDITTEXT        IDC_KEYINTMIN,126,146,24,12,ES_AUTOHSCROLL | ES_NUMBER
+    EDITTEXT        IDC_KEYINTMAX,126,160,24,12,ES_AUTOHSCROLL | ES_NUMBER
 END
 
-IDD_ERRCONSOLE DIALOG DISCARDABLE  0, 0, 264, 130
-STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION
-CAPTION "x264 error console"
-FONT 8, "MS Sans Serif"
+IDD_TAB_MISC DIALOGEX 0, 0, 200, 188
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+FONT 8, "MS Shell Dlg", 0, 0, 0x0
 BEGIN
-    DEFPUSHBUTTON   "OK",IDOK,68,110,48,14
-    DEFPUSHBUTTON   "Copy",IDC_COPYCLIP,148,110,48,14
-    LISTBOX         IDC_CONSOLE,6,8,251,95,LBS_NOINTEGRALHEIGHT | LBS_NOSEL
+    LTEXT           "Strength",IDC_STATIC,78,144,36,12,SS_CENTERIMAGE,WS_EX_TRANSPARENT
+    LTEXT           "Threshold",IDC_STATIC,78,157,36,12,SS_CENTERIMAGE,WS_EX_TRANSPARENT
+    LTEXT           "0",IDC_LOOPA_TXT,162,144,12,12,SS_CENTERIMAGE,WS_EX_TRANSPARENT
+    LTEXT           "0",IDC_LOOPB_TXT,162,157,12,12,SS_CENTERIMAGE,WS_EX_TRANSPARENT
+    GROUPBOX        "Motion Estimation",IDC_STATIC,6,2,186,74,WS_DISABLED
+    LTEXT           "Partition decision",IDC_STATIC,30,12,60,12,SS_CENTERIMAGE,WS_EX_TRANSPARENT
+    LTEXT           "Method",IDC_STATIC,30,27,30,12,SS_CENTERIMAGE,WS_EX_TRANSPARENT
+    LTEXT           "Direct mode",IDC_STATIC,30,42,42,12,SS_CENTERIMAGE,WS_EX_TRANSPARENT
+    LTEXT           "Range",IDC_STATIC,30,57,24,12,SS_CENTERIMAGE,WS_EX_TRANSPARENT
+    GROUPBOX        "Debug",IDC_STATIC,96,80,96,46,WS_DISABLED
+    LTEXT           "Log Mode",IDC_STATIC,102,90,36,12,SS_CENTERIMAGE
+    LTEXT           "FourCC",IDC_STATIC,102,108,36,12,SS_CENTERIMAGE
+    LTEXT           "Sample AR",IDC_STATIC,6,90,36,12,SS_CENTERIMAGE,WS_EX_TRANSPARENT
+    LTEXT           "Threads",IDC_THREADS,6,108,30,12,SS_CENTERIMAGE
+    CTEXT           ":",IDC_STATIC,57,90,12,12,SS_CENTERIMAGE
+    CONTROL         "CABAC",IDC_CABAC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,126,39,12,WS_EX_TRANSPARENT
+    CONTROL         "Deblocking filter:",IDC_LOOPFILTER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,144,66,12
+    CONTROL         "",IDC_INLOOP_A,"msctls_trackbar32",TBS_NOTICKS | WS_TABSTOP,114,145,42,12,WS_EX_TRANSPARENT
+    CONTROL         "",IDC_INLOOP_B,"msctls_trackbar32",TBS_NOTICKS | WS_TABSTOP,114,157,42,12,WS_EX_TRANSPARENT
+    EDITTEXT        IDC_SAR_W,42,90,18,12,ES_AUTOHSCROLL | ES_NUMBER
+    EDITTEXT        IDC_SAR_H,66,90,18,12,ES_AUTOHSCROLL | ES_NUMBER
+    EDITTEXT        IDC_THREADEDIT,42,108,18,12,ES_AUTOHSCROLL | ES_NUMBER
+    COMBOBOX        IDC_LOG,138,90,48,67,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    EDITTEXT        IDC_FOURCC,138,108,30,12,ES_AUTOHSCROLL
+    CTEXT           "BUILD",IDC_BUILDREV,12,174,174,8,SS_CENTERIMAGE | WS_DISABLED
+    CONTROL         "Chroma ME",IDC_CHROMAME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,126,57,48,12,WS_EX_TRANSPARENT
+    COMBOBOX        IDC_SUBPEL,90,12,84,77,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
+    COMBOBOX        IDC_ME_METHOD,84,27,90,67,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    EDITTEXT        IDC_MERANGE,60,57,24,12,ES_AUTOHSCROLL | ES_NUMBER
+    COMBOBOX        IDC_DIRECTPRED,120,42,54,67,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
 END
 
 
@@ -247,53 +149,117 @@ END
 //
 
 #ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO DISCARDABLE 
+GUIDELINES DESIGNINFO 
 BEGIN
     IDD_MAINCONFIG, DIALOG
     BEGIN
         LEFTMARGIN, 7
-        RIGHTMARGIN, 218
+        RIGHTMARGIN, 197
+        TOPMARGIN, 7
+        BOTTOMMARGIN, 215
+    END
+
+    IDD_TAB_BITRATE, DIALOG
+    BEGIN
+        LEFTMARGIN, 7
+        RIGHTMARGIN, 193
+        TOPMARGIN, 7
+        BOTTOMMARGIN, 181
+    END
+
+    IDD_TAB_IPFRAMES, DIALOG
+    BEGIN
+        LEFTMARGIN, 7
+        RIGHTMARGIN, 193
         TOPMARGIN, 7
-        BOTTOMMARGIN, 246
+        BOTTOMMARGIN, 181
     END
 
-    IDD_ADVANCED, DIALOG
+    IDD_TAB_RATECONTROL, DIALOG
     BEGIN
         LEFTMARGIN, 7
-        RIGHTMARGIN, 482
+        RIGHTMARGIN, 193
         TOPMARGIN, 7
-        BOTTOMMARGIN, 231
+        BOTTOMMARGIN, 181
     END
 
-    IDD_ABOUT, DIALOG
+    IDD_TAB_MISC, DIALOG
     BEGIN
         LEFTMARGIN, 7
-        RIGHTMARGIN, 192
+        RIGHTMARGIN, 193
         TOPMARGIN, 7
-        BOTTOMMARGIN, 80
+        BOTTOMMARGIN, 181
     END
 END
 #endif    // APSTUDIO_INVOKED
 
 
+/////////////////////////////////////////////////////////////////////////////
+//
+// Bitmap
+//
+
+IDB_LOGO                BITMAP                  "x264.bmp"
+#endif    // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (Canada) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENC)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_CAN
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_ABOUT DIALOGEX 0, 0, 213, 130
+STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "About x264"
+FONT 8, "MS Sans Serif", 0, 0, 0x0
+BEGIN
+    DEFPUSHBUTTON   "OK",IDOK,158,109,48,14
+    PUSHBUTTON      "Visit Homepage",IDC_HOMEPAGE,7,109,77,14
+    CTEXT           "BUILD",IDC_BUILD,6,18,199,8
+    CTEXT           "x264 - H.264/MPEG-4 AVC codec",IDC_X264,6,6,199,8
+    CTEXT           "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation.",IDC_STATIC,6,78,199,26
+    CTEXT           "Copyright 2005 Laurent Aimar, Justin Clay, Min Chen,\nEric Petit, Måns Rullgård, Loren Merritt",IDC_STATIC,6,48,199,18
+END
+
+IDD_ERRCONSOLE DIALOG  0, 0, 264, 130
+STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION
+CAPTION "x264 error console"
+FONT 8, "MS Sans Serif"
+BEGIN
+    DEFPUSHBUTTON   "OK",IDOK,68,110,48,14
+    DEFPUSHBUTTON   "Copy",IDC_COPYCLIP,148,110,48,14
+    LISTBOX         IDC_CONSOLE,6,8,251,95,LBS_NOINTEGRALHEIGHT | LBS_NOSEL
+END
+
+
 #ifdef APSTUDIO_INVOKED
 /////////////////////////////////////////////////////////////////////////////
 //
 // TEXTINCLUDE
 //
 
-1 TEXTINCLUDE DISCARDABLE
+1 TEXTINCLUDE 
 BEGIN
     "resource.h\0"
 END
 
-2 TEXTINCLUDE DISCARDABLE
+2 TEXTINCLUDE 
 BEGIN
     "#include ""afxres.h""\r\n"
     "\0"
 END
 
-3 TEXTINCLUDE DISCARDABLE
+3 TEXTINCLUDE 
 BEGIN
     "\r\n"
     "\0"
diff --git a/vfw/x264.bmp b/vfw/x264.bmp
new file mode 100644 (file)
index 0000000..39895a9
Binary files /dev/null and b/vfw/x264.bmp differ
index 68e408e..6bea6f4 100644 (file)
@@ -129,13 +129,13 @@ LRESULT compress(CODEC *, ICCOMPRESS *);
 /* config functions */
 void config_reg_load( CONFIG * config );
 void config_reg_save( CONFIG * config );
-
+static void tabs_enable_items( HWND hDlg, CONFIG * config );
+static void tabs_update_items( HWND hDlg, CONFIG * config );
 
 /* Dialog callbacks */
-BOOL CALLBACK callback_about( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
-BOOL CALLBACK callback_debug( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
 BOOL CALLBACK callback_main ( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
-BOOL CALLBACK callback_advanced( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
+BOOL CALLBACK callback_tabs( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
+BOOL CALLBACK callback_about( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
 BOOL CALLBACK callback_err_console( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
 
 /* Dll instance */