]> git.sesse.net Git - vlc/blobdiff - modules/gui/wince/interface.cpp
We're on git now, so show Git commit instead of svn revision.
[vlc] / modules / gui / wince / interface.cpp
index a47bac302afff303ace92f319852157dbb6f0320..49cd08daca0d5571d80ae4df3bf705cfb2d001f6 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * interface.cpp: WinCE gui plugin for VLC
  *****************************************************************************
- * Copyright (C) 2003 VideoLAN
+ * Copyright (C) 2003 the VideoLAN team
  * $Id$
  *
  * Authors: Marodon Cedric <cedric_marodon@yahoo.fr>
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
 #include <vlc/vlc.h>
-#include <vlc/aout.h>
-#include <vlc/vout.h>
-#include <vlc/intf.h>
+#include <vlc_aout.h>
+#include <vlc_vout.h>
+#include <vlc_interface.h>
 
 #include "wince.h"
 
-#include <winuser.h>
-#include <windows.h>
 #include <windowsx.h>
 #include <commctrl.h>
-#include <commdlg.h> // common dialogs -> fileopen.lib ?
+#include <commdlg.h>
 
-#define NUMIMAGES     9   // Number of buttons in the toolbar           
-#define IMAGEWIDTH    17   // Width of the buttons in the toolbar  
-#define IMAGEHEIGHT   16   // Height of the buttons in the toolbar  
+#define NUMIMAGES     9   // Number of buttons in the toolbar
+#define IMAGEWIDTH    17   // Width of the buttons in the toolbar
+#define IMAGEHEIGHT   16   // Height of the buttons in the toolbar
 #define BUTTONWIDTH   0    // Width of the button images in the toolbar
 #define BUTTONHEIGHT  0    // Height of the button images in the toolbar
 #define ID_TOOLBAR    2000 // Identifier of the main tool bar
-#define dwTBFontStyle TBSTYLE_BUTTON | TBSTYLE_CHECK | TBSTYLE_GROUP // style for toolbar buttons
 
 // Help strings
 #define HELP_SIMPLE _T("Quick file open")
@@ -64,7 +65,6 @@
 #define HELP_FILEINFO   _T("Show information about the file being played")
 
 #define HELP_PREFS _T("Go to the preferences menu")
-#define EXTRA_PREFS _T("Shows the extended GUI")
 
 #define HELP_ABOUT _T("About this program")
 
@@ -79,7 +79,7 @@
 #define HELP_FAST _T("Play faster")
 
 // The TBBUTTON structure contains information the toolbar buttons.
-static TBBUTTON tbButton[] =      
+static TBBUTTON tbButton[] =
 {
   {0, ID_FILE_QUICKOPEN,        TBSTATE_ENABLED, TBSTYLE_BUTTON},
   {1, ID_FILE_OPENNET,       TBSTATE_ENABLED, TBSTYLE_BUTTON},
@@ -97,7 +97,7 @@ static TBBUTTON tbButton[] =
 };
 
 // Toolbar ToolTips
-TCHAR * szToolTips[] = 
+TCHAR * szToolTips[] =
 {
     HELP_SIMPLE, HELP_NET, HELP_STOP, HELP_PLAY, HELP_PLO, HELP_PLP,
     HELP_PLN, HELP_SLOW, HELP_FAST
@@ -106,34 +106,36 @@ TCHAR * szToolTips[] =
 /*****************************************************************************
  * Constructor.
  *****************************************************************************/
-BOOL Interface::InitInstance( HINSTANCE hInstance, intf_thread_t *_p_intf )
+Interface::Interface( intf_thread_t *p_intf, CBaseWindow *p_parent,
+                      HINSTANCE h_inst )
+  : CBaseWindow( p_intf, p_parent, h_inst ),
+    hwndMain(0), hwndCB(0), hwndTB(0), hwndSlider(0), hwndLabel(0),
+    hwndVol(0), hwndSB(0), timer(0), video(0), b_volume_hold(0)
+{
+}
+
+Interface::~Interface()
+{
+    if( timer ) delete timer;
+    if( video ) delete video;
+}
+
+BOOL Interface::InitInstance()
 {
     /* Initializations */
-    pIntf = _p_intf;
-    hwndMain = hwndCB = hwndTB = hwndSlider = hwndLabel = hwndVol = hwndSB = 0;
     i_old_playing_status = PAUSE_S;
 
-    hInst = hInstance; // Store instance handle in our global variable
-
-    // Register window class
-    WNDCLASS wc;
-    wc.style = CS_HREDRAW | CS_VREDRAW ;
-    wc.lpfnWndProc = (WNDPROC)BaseWndProc;
-    wc.cbClsExtra = 0;
-    wc.cbWndExtra = 0;
-    wc.hIcon = NULL;
-    wc.hInstance = hInstance;
-    wc.hCursor = NULL;
-    wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
-    wc.lpszMenuName = NULL;
-    wc.lpszClassName = _T("VLC WinCE");
-    if( !RegisterClass( &wc ) ) return FALSE;
+    int i_style = WS_VISIBLE;
+
+#ifndef UNDER_CE
+    i_style |= WS_OVERLAPPEDWINDOW | WS_SIZEBOX;
+#endif
 
     // Create main window
     hwndMain =
-        CreateWindow( _T("VLC WinCE"), _T("VLC media player"), WS_VISIBLE,
+        CreateWindow( _T("VLC WinCE"), _T("VLC media player"), i_style,
                       0, MENU_HEIGHT, CW_USEDEFAULT, CW_USEDEFAULT,
-                      NULL, NULL, hInstance, (void *)this );
+                      NULL, NULL, GetInstance(), (void *)this );
 
     if( !hwndMain ) return FALSE;
 
@@ -144,14 +146,16 @@ BOOL Interface::InitInstance( HINSTANCE hInstance, intf_thread_t *_p_intf )
 }
 
 /***********************************************************************
-FUNCTION: 
+FUNCTION:
   CreateMenuBar
 
-PURPOSE: 
+PURPOSE:
   Creates a menu bar.
 ***********************************************************************/
-HWND CreateMenuBar( HWND hwnd, HINSTANCE hInst )
+HWND Interface::CreateMenuBar( HWND hwnd, HINSTANCE hInst )
 {
+    HMENU menu_file, menu_view;
+
 #ifdef UNDER_CE
     SHMENUBARINFO mbi;
     memset( &mbi, 0, sizeof(SHMENUBARINFO) );
@@ -171,46 +175,52 @@ HWND CreateMenuBar( HWND hwnd, HINSTANCE hInst )
     tbbi.dwMask = TBIF_LPARAM;
 
     SendMessage( mbi.hwndMB, TB_GETBUTTONINFO, IDM_FILE, (LPARAM)&tbbi );
-    HMENU hmenu_file = (HMENU)tbbi.lParam;
-    RemoveMenu( hmenu_file, 0, MF_BYPOSITION );
+    menu_file = (HMENU)tbbi.lParam;
+    RemoveMenu( menu_file, 0, MF_BYPOSITION );
     SendMessage( mbi.hwndMB, TB_GETBUTTONINFO, IDM_VIEW, (LPARAM)&tbbi );
-    HMENU hmenu_view = (HMENU)tbbi.lParam;
-    RemoveMenu( hmenu_view, 0, MF_BYPOSITION );
+    menu_view = (HMENU)tbbi.lParam;
+    RemoveMenu( menu_view, 0, MF_BYPOSITION );
     SendMessage( mbi.hwndMB, TB_GETBUTTONINFO, IDM_SETTINGS, (LPARAM)&tbbi );
-    HMENU hmenu_settings = (HMENU)tbbi.lParam;
+    menu_settings = (HMENU)tbbi.lParam;
+    SendMessage( mbi.hwndMB, TB_GETBUTTONINFO, IDM_VIDEO, (LPARAM)&tbbi );
+    menu_video = (HMENU)tbbi.lParam;
+    SendMessage( mbi.hwndMB, TB_GETBUTTONINFO, IDM_AUDIO, (LPARAM)&tbbi );
+    menu_audio = (HMENU)tbbi.lParam;
+    SendMessage( mbi.hwndMB, TB_GETBUTTONINFO, IDM_NAVIGATION, (LPARAM)&tbbi );
+    menu_navigation = (HMENU)tbbi.lParam;
 
 #else
-    HMENU hmenu_file = CreatePopupMenu();
-    HMENU hmenu_view = CreatePopupMenu();
-    HMENU hmenu_settings = CreatePopupMenu();
-    HMENU hmenu_audio = CreatePopupMenu();
-    HMENU hmenu_video = CreatePopupMenu();
-    HMENU hmenu_navigation = CreatePopupMenu();
+    menu_file = CreatePopupMenu();
+    menu_view = CreatePopupMenu();
+    menu_settings = CreatePopupMenu();
+    menu_audio = CreatePopupMenu();
+    menu_video = CreatePopupMenu();
+    menu_navigation = CreatePopupMenu();
 #endif
 
-    AppendMenu( hmenu_file, MF_STRING, ID_FILE_QUICKOPEN,
-                _T("Quick &Open File") );
-    AppendMenu( hmenu_file, MF_SEPARATOR, 0, 0 );
-    AppendMenu( hmenu_file, MF_STRING, ID_FILE_OPENFILE,
-                _T("Open &File") );
-    AppendMenu( hmenu_file, MF_STRING, ID_FILE_OPENNET,
-                _T("Open Network Stream") );
-    AppendMenu( hmenu_file, MF_SEPARATOR, 0, 0 );
-    AppendMenu( hmenu_file, MF_STRING, ID_FILE_ABOUT,
+    AppendMenu( menu_file, MF_STRING, ID_FILE_QUICKOPEN,
+                _T("Quick &Open File...") );
+    AppendMenu( menu_file, MF_SEPARATOR, 0, 0 );
+    AppendMenu( menu_file, MF_STRING, ID_FILE_OPENFILE,
+                _T("Open &File...") );
+    AppendMenu( menu_file, MF_STRING, ID_FILE_OPENDIR,
+                _T("Open &Directory...") );
+    AppendMenu( menu_file, MF_STRING, ID_FILE_OPENNET,
+                _T("Open &Network Stream...") );
+    AppendMenu( menu_file, MF_SEPARATOR, 0, 0 );
+    AppendMenu( menu_file, MF_STRING, ID_FILE_ABOUT,
                 _T("About VLC") );
-    AppendMenu( hmenu_file, MF_STRING, ID_FILE_EXIT,
+    AppendMenu( menu_file, MF_STRING, ID_FILE_EXIT,
                 _T("E&xit") );
 
-    AppendMenu( hmenu_view, MF_STRING, ID_VIEW_PLAYLIST,
-                _T("&Playlist") );
-    AppendMenu( hmenu_view, MF_STRING, ID_VIEW_MESSAGES,
-                _T("&Messages") );
-    AppendMenu( hmenu_view, MF_STRING, ID_VIEW_STREAMINFO,
-                _T("&Stream and Media info") );
+    AppendMenu( menu_view, MF_STRING, ID_VIEW_PLAYLIST,
+                _T("&Playlist...") );
+    AppendMenu( menu_view, MF_STRING, ID_VIEW_MESSAGES,
+                _T("&Messages...") );
+    AppendMenu( menu_view, MF_STRING, ID_VIEW_STREAMINFO,
+                _T("Stream and Media &info...") );
 
-    AppendMenu( hmenu_settings, MF_STRING, ID_SETTINGS_EXTEND,
-                _T("&Extended GUI") );
-    AppendMenu( hmenu_settings, MF_STRING, ID_SETTINGS_PREF,
+    AppendMenu( menu_settings, MF_STRING, ID_PREFERENCES,
                 _T("&Preferences...") );
 
 
@@ -220,26 +230,25 @@ HWND CreateMenuBar( HWND hwnd, HINSTANCE hInst )
 #else
     HMENU hmenu = CreateMenu();
 
-    AppendMenu( hmenu, MF_POPUP|MF_STRING, (UINT)hmenu_file, _T("File") );
-    AppendMenu( hmenu, MF_POPUP|MF_STRING, (UINT)hmenu_view, _T("View") );
-    AppendMenu( hmenu, MF_POPUP|MF_STRING, (UINT)hmenu_settings,
+    AppendMenu( hmenu, MF_POPUP|MF_STRING, (UINT)menu_file, _T("File") );
+    AppendMenu( hmenu, MF_POPUP|MF_STRING, (UINT)menu_view, _T("View") );
+    AppendMenu( hmenu, MF_POPUP|MF_STRING, (UINT)menu_settings,
                 _T("Settings") );
-    AppendMenu( hmenu, MF_POPUP|MF_STRING, (UINT)hmenu_audio, _T("Audio") );
-    AppendMenu( hmenu, MF_POPUP|MF_STRING, (UINT)hmenu_video, _T("Video") );
-    AppendMenu( hmenu, MF_POPUP|MF_STRING, (UINT)hmenu_navigation,
-                _T("Nav.") );
+    AppendMenu( hmenu, MF_POPUP|MF_STRING, (UINT)menu_audio, _T("Audio") );
+    AppendMenu( hmenu, MF_POPUP|MF_STRING, (UINT)menu_video, _T("Video") );
+    AppendMenu( hmenu, MF_POPUP|MF_STRING, (UINT)menu_navigation, _T("Nav") );
 
     SetMenu( hwnd, hmenu );
-    return hwnd;
+    return 0;
 
 #endif
 }
 
 /***********************************************************************
-FUNCTION: 
+FUNCTION:
   CreateToolBar
 
-PURPOSE: 
+PURPOSE:
   Registers the TOOLBAR control class and creates a toolbar.
 ***********************************************************************/
 HWND CreateToolBar( HWND hwnd, HINSTANCE hInst )
@@ -264,15 +273,15 @@ HWND CreateToolBar( HWND hwnd, HINSTANCE hInst )
         BUTTONWIDTH, BUTTONHEIGHT, IMAGEWIDTH, IMAGEHEIGHT, sizeof(TBBUTTON) );
 
     if( !hwndTB ) return NULL;
-  
     // Add ToolTips to the toolbar.
-    SendMessage( hwndTB, TB_SETTOOLTIPS, (WPARAM)NUMIMAGES, 
+    SendMessage( hwndTB, TB_SETTOOLTIPS, (WPARAM)NUMIMAGES,
                  (LPARAM)szToolTips );
 
     // Reposition the toolbar.
     GetClientRect( hwnd, &rect );
     GetWindowRect( hwndTB, &rectTB );
-    MoveWindow( hwndTB, rect.left, rect.bottom - rect.top - 2*MENU_HEIGHT, 
+    MoveWindow( hwndTB, rect.left, rect.bottom - rect.top - 2*MENU_HEIGHT,
                 rect.right - rect.left, MENU_HEIGHT, TRUE );
 
     return hwndTB;
@@ -280,10 +289,10 @@ HWND CreateToolBar( HWND hwnd, HINSTANCE hInst )
 
 /***********************************************************************
 
-FUNCTION: 
+FUNCTION:
   CreateSliderBar
 
-PURPOSE: 
+PURPOSE:
   Registers the TRACKBAR_CLASS control class and creates a trackbar.
 
 ***********************************************************************/
@@ -312,8 +321,8 @@ HWND CreateSliderBar( HWND hwnd, HINSTANCE hInst )
 
     // Reposition the trackbar
     GetClientRect( hwnd, &rect );
-    MoveWindow( hwndSlider, rect.left, 
-                rect.bottom - rect.top - 2*(MENU_HEIGHT-1) - SLIDER_HEIGHT, 
+    MoveWindow( hwndSlider, rect.left,
+                rect.bottom - rect.top - 2*(MENU_HEIGHT-1) - SLIDER_HEIGHT,
                 rect.right - rect.left - 40, 30, TRUE );
 
     ShowWindow( hwndSlider, SW_HIDE );
@@ -345,10 +354,10 @@ HWND CreateStaticText( HWND hwnd, HINSTANCE hInst )
 
 /***********************************************************************
 
-FUNCTION: 
+FUNCTION:
   CreateVolTrackBar
 
-PURPOSE: 
+PURPOSE:
   Registers the TRACKBAR_CLASS control class and creates a trackbar.
 
 ***********************************************************************/
@@ -374,12 +383,12 @@ HWND CreateVolTrackBar( HWND hwnd, HINSTANCE hInst )
     SendMessage( hwndVol, TBM_SETRANGEMIN, 1, 0 );
     SendMessage( hwndVol, TBM_SETRANGEMAX, 1, 200 );
     SendMessage( hwndVol, TBM_SETPOS, 1, 100 );
-    SendMessage( hwndVol, TBM_SETTICFREQ, 50, 0 );  
+    SendMessage( hwndVol, TBM_SETTICFREQ, 50, 0 );
 
     // Reposition the trackbar
     GetClientRect( hwnd, &rect );
-    MoveWindow( hwndVol, rect.right - rect.left - 40, 
-                rect.bottom - rect.top - 2*(MENU_HEIGHT-1) - SLIDER_HEIGHT, 
+    MoveWindow( hwndVol, rect.right - rect.left - 40,
+                rect.bottom - rect.top - 2*(MENU_HEIGHT-1) - SLIDER_HEIGHT,
                 40, SLIDER_HEIGHT, TRUE );
 
     ShowWindow( hwndVol, SW_HIDE );
@@ -389,10 +398,10 @@ HWND CreateVolTrackBar( HWND hwnd, HINSTANCE hInst )
 
 /***********************************************************************
 
-FUNCTION: 
+FUNCTION:
   CreateStatusBar
 
-PURPOSE: 
+PURPOSE:
   Registers the StatusBar control class and creates a Statusbar.
 
 ***********************************************************************/
@@ -419,7 +428,7 @@ HWND CreateStatusBar( HWND hwnd, HINSTANCE hInst )
 
     if (!hwndSB ) return NULL;
 
-    // Get the coordinates of the parent window's client area. 
+    // Get the coordinates of the parent window's client area.
     GetClientRect( hwnd, &rect );
 
     // allocate memory for the panes of status bar
@@ -437,79 +446,17 @@ HWND CreateStatusBar( HWND hwnd, HINSTANCE hInst )
 }
 
 /***********************************************************************
-
-FUNCTION: 
-  BaseWndProc
-
-PURPOSE: 
-  Processes messages sent to the main window.
-  
-***********************************************************************/
-LRESULT CALLBACK CBaseWindow::BaseWndProc( HWND hwnd, UINT msg, WPARAM wParam,
-                                           LPARAM lParam )
-{
-    // check to see if a copy of the 'this' pointer needs to be saved
-    if( msg == WM_CREATE )
-    {
-        CBaseWindow *pObj = reinterpret_cast<CBaseWindow *>
-            ((long)((LPCREATESTRUCT)lParam)->lpCreateParams);
-        ::SetWindowLong( hwnd, GWL_USERDATA,
-                         (LONG)((LPCREATESTRUCT)lParam)->lpCreateParams );
-
-        pObj->DlgFlag = FALSE;
-        pObj->hWnd = hwnd; // videowindow
-    }
-
-    if( msg == WM_INITDIALOG )
-    {
-        CBaseWindow *pObj = reinterpret_cast<CBaseWindow *>(lParam);
-        ::SetWindowLong( hwnd, GWL_USERDATA, lParam );
-        pObj->DlgFlag = TRUE;
-        pObj->hWnd = hwnd; //streamout
-    }
-
-    BOOL bProcessed = FALSE;
-    LRESULT lResult;
-
-    // Retrieve the pointer
-    CBaseWindow *pObj =
-        reinterpret_cast<CBaseWindow *>(::GetWindowLong( hwnd, GWL_USERDATA ));
-
-    if( !pObj ) return DefWindowProc( hwnd, msg, wParam, lParam );
-
-    // Filter message through child classes
-    if( pObj )
-        lResult = pObj->WndProc( hwnd, msg, wParam, lParam, &bProcessed );
-
-    if( pObj->DlgFlag )
-        return bProcessed; // processing a dialog message return TRUE if processed
-    else if( !bProcessed )
-        // If message was unprocessed and not a dialog, send it back to Windows
-        lResult = DefWindowProc( hwnd, msg, wParam, lParam );
-
-    return lResult; // processing a window message return FALSE if processed
-}
-
-/***********************************************************************
-
-FUNCTION: 
+FUNCTION:
   WndProc
 
-PURPOSE: 
+PURPOSE:
   Processes messages sent to the main window.
-  
 ***********************************************************************/
-LRESULT CALLBACK Interface::WndProc( HWND hwnd, UINT msg, WPARAM wp,
-                                     LPARAM lp, PBOOL pbProcessed )
+LRESULT Interface::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
 {
-    // call the base class first
-    LRESULT lResult = CBaseWindow::WndProc( hwnd, msg, wp, lp, pbProcessed );
-    *pbProcessed = TRUE;
-
     switch( msg )
     {
     case WM_CREATE:
-        {
         hwndCB = CreateMenuBar( hwnd, hInst );
         hwndTB = CreateToolBar( hwnd, hInst );
         hwndSlider = CreateSliderBar( hwnd, hInst );
@@ -520,249 +467,175 @@ LRESULT CALLBACK Interface::WndProc( HWND hwnd, UINT msg, WPARAM wp,
 #endif
 
         /* Video window */
-        if( config_GetInt( pIntf, "wince-embed" ) )
-            video = CreateVideoWindow( pIntf, hInst, hwnd );
-
-        ti = new Timer(pIntf, hwnd, this);
+        if( config_GetInt( p_intf, "wince-embed" ) )
+            video = CreateVideoWindow( p_intf, hwnd );
 
-        // Hide the SIP button (WINCE only)
-        SetForegroundWindow( hwnd );
-        SHFullScreen( GetForegroundWindow(), SHFS_HIDESIPBUTTON );
-        }
-        return lResult;
+        timer = new Timer( p_intf, hwnd, this );
+        break;
 
     case WM_COMMAND:
         switch( GET_WM_COMMAND_ID(wp,lp) )
         {
-        case ID_FILE_QUICKOPEN: 
-            OnOpenFileSimple();
-            return lResult;
-
-        case ID_FILE_OPENFILE: 
-            open = new OpenDialog( pIntf, hInst, FILE_ACCESS,
-                                   ID_FILE_OPENFILE, OPEN_NORMAL );
-            DialogBoxParam( hInst, (LPCTSTR)IDD_DUMMY, hwnd,
-                            (DLGPROC)open->BaseWndProc, (long)open );
-            delete open;
-            return lResult;
-
+        case ID_FILE_QUICKOPEN:
+        case ID_FILE_OPENFILE:
+        case ID_FILE_OPENDIR:
         case ID_FILE_OPENNET:
-            open = new OpenDialog( pIntf, hInst, NET_ACCESS, ID_FILE_OPENNET,
-                                   OPEN_NORMAL );
-            DialogBoxParam( hInst, (LPCTSTR)IDD_DUMMY, hwnd,
-                            (DLGPROC)open->BaseWndProc, (long)open );
-            delete open;
-            return lResult;
-
-        case PlayStream_Event: 
-            OnPlayStream();
-            return lResult;
-
-        case StopStream_Event: 
-            OnStopStream();
-            return lResult;
-
-        case PrevStream_Event: 
-            OnPrevStream();
-            return lResult;
-
-        case NextStream_Event: 
-            OnNextStream();
-            return lResult;
-
-        case SlowStream_Event: 
-            OnSlowStream();
-            return lResult;
-
-        case FastStream_Event: 
-            OnFastStream();
-            return lResult;
-
-        case ID_FILE_ABOUT: 
+        case ID_VIEW_STREAMINFO:
+        case ID_VIEW_MESSAGES:
+        case ID_VIEW_PLAYLIST:
+        case ID_PREFERENCES:
+            OnShowDialog( GET_WM_COMMAND_ID(wp,lp) );
+            break;
+
+        case PlayStream_Event: OnPlayStream(); break;
+        case StopStream_Event: OnStopStream(); break;
+        case PrevStream_Event: OnPrevStream(); break;
+        case NextStream_Event: OnNextStream(); break;
+        case SlowStream_Event: OnSlowStream(); break;
+        case FastStream_Event: OnFastStream(); break;
+
+        case ID_FILE_ABOUT:
         {
             string about = (string)"VLC media player " PACKAGE_VERSION +
                 _("\n(WinCE interface)\n\n") +
-                _("(c) 1996-2005 - the VideoLAN Team\n\n") +
+                _("(c) 1996-2006 - the VideoLAN Team\n\n") +
+                _("Compiled by ") + VLC_CompileBy() + "@" +
+                VLC_CompileHost() + "." + VLC_CompileDomain() + ".\n" +
+                _("Compiler: ") + VLC_Compiler() + ".\n" +
+                _("Based on Git commit: ") + VLC_Changeset() + ".\n\n" +
                 _("The VideoLAN team <videolan@videolan.org>\n"
-                  "http://www.videolan.org/\n\n");
+                  "http://www.videolan.org/");
 
             MessageBox( hwnd, _FROMMB(about.c_str()),
                         _T("About VLC media player"), MB_OK );
-            return lResult;
+            break;
         }
 
         case ID_FILE_EXIT:
             SendMessage( hwnd, WM_CLOSE, 0, 0 );
-            return lResult;
-
-        case ID_VIEW_STREAMINFO:
-            fi = new FileInfo( pIntf, hInst );
-            DialogBoxParam( hInst, (LPCTSTR)IDD_DUMMY, hwnd,
-                            (DLGPROC)fi->BaseWndProc, (long)fi );
-            delete fi;
-            return lResult;
+            break;
 
-        case ID_VIEW_MESSAGES:
-            hmsg = new Messages( pIntf, hInst );
-            DialogBoxParam( hInst, (LPCTSTR)IDD_MESSAGES, hwnd,
-                            (DLGPROC)hmsg->BaseWndProc, (long)hmsg );
-            delete hmsg;
-            return lResult;
-
-        case ID_VIEW_PLAYLIST:
-            pl = new Playlist( pIntf, hInst );
-            DialogBoxParam( hInst, (LPCTSTR)IDD_DUMMY, hwnd,
-                            (DLGPROC)pl->BaseWndProc, (long)pl );
-            delete pl;
-            return lResult;
-
-        case ID_SETTINGS_PREF:
-            pref = new PrefsDialog( pIntf, hInst );
-            DialogBoxParam( hInst, (LPCTSTR)IDD_DUMMY, hwnd,
-                            (DLGPROC)pref->BaseWndProc, (long)pref );
-            delete pref;
-            return lResult;
-                  
         default:
-            OnMenuEvent( pIntf, GET_WM_COMMAND_ID(wp,lp) );
+            OnMenuEvent( p_intf, GET_WM_COMMAND_ID(wp,lp) );
             // we should test if it is a menu command
         }
         break;
-  
     case WM_TIMER:
-        ti->Notify();
-        return lResult;
+        timer->Notify();
+        break;
 
-    case WM_CTLCOLORSTATIC: 
+    case WM_CTLCOLORSTATIC:
         if( ( (HWND)lp == hwndSlider ) || ( (HWND)lp == hwndVol ) )
-        { 
-            return( (LRESULT)::GetSysColorBrush(COLOR_3DFACE) ); 
+        {
+            return( (LRESULT)::GetSysColorBrush(COLOR_3DFACE) );
         }
         if( (HWND)lp == hwndLabel )
         {
-            SetBkColor( (HDC)wp, RGB (192, 192, 192) ); 
-            return( (LRESULT)::GetSysColorBrush(COLOR_3DFACE) ); 
+            SetBkColor( (HDC)wp, RGB (192, 192, 192) );
+            return( (LRESULT)::GetSysColorBrush(COLOR_3DFACE) );
         }
         break;
 
     case WM_HSCROLL:
-        if( (HWND)lp == hwndSlider )
-        {
-            OnSliderUpdate( wp );
-            return lResult;
-        }
+        if( (HWND)lp == hwndSlider ) OnSliderUpdate( wp );
         break;
 
     case WM_VSCROLL:
-        if( (HWND)lp == hwndVol )
-        {
-            OnChange( wp );
-            return lResult;
-        }
+        if( (HWND)lp == hwndVol ) OnChange( wp );
         break;
 
     case WM_INITMENUPOPUP:
-        RefreshSettingsMenu( pIntf,
-            (HMENU)SendMessage( hwndCB, SHCMBM_GETSUBMENU, (WPARAM)0,
-                                (LPARAM)IDM_SETTINGS ) );
-        RefreshAudioMenu( pIntf,
-            (HMENU)SendMessage( hwndCB, SHCMBM_GETSUBMENU, (WPARAM)0,
-                                (LPARAM)IDM_AUDIO ) );
-        RefreshVideoMenu( pIntf,
-            (HMENU)SendMessage( hwndCB, SHCMBM_GETSUBMENU, (WPARAM)0,
-                                (LPARAM)IDM_VIDEO ) );
-        RefreshNavigMenu( pIntf,
-            (HMENU)SendMessage( hwndCB, SHCMBM_GETSUBMENU, (WPARAM)0,
-                                (LPARAM)IDM_NAVIGATION ) );
-
-#if 0
-        // Undo the video display because menu is opened
-        // due to GAPI, menu top display is not assumed
-        // FIXME verify if p_child_window exits
-        SendMessage( pIntf->p_sys->p_video_window->p_child_window,
-                     WM_INITMENUPOPUP, wp, lp );
-#endif
+        if( (HMENU)wp == menu_settings )
+            RefreshSettingsMenu( p_intf, menu_settings );
+        if( (HMENU)wp == menu_audio )
+            RefreshAudioMenu( p_intf, menu_audio );
+        if( (HMENU)wp == menu_video )
+            RefreshVideoMenu( p_intf, menu_video );
+        if( (HMENU)wp == menu_navigation )
+            RefreshNavigMenu( p_intf, menu_navigation );
+        /* Fall through */
+
+    case WM_KILLFOCUS:
+        SHFullScreen( hwnd, SHFS_SHOWSIPBUTTON );
+    case WM_ENTERMENULOOP:
+        if( video && video->hWnd )
+            SendMessage( video->hWnd, WM_KILLFOCUS, 0, 0 );
+        break;
 
-        //refresh screen
-        /* InvalidateRect(hwnd, NULL, TRUE);
-           /UpdateWindow(hwndCB); //  NULL*/
+    case WM_SETFOCUS:
+        SHSipPreference( hwnd, SIP_DOWN );
+        SHFullScreen( GetForegroundWindow(), SHFS_HIDESIPBUTTON );
+    case WM_EXITMENULOOP:
+        if( video && video->hWnd )
+            SendMessage( video->hWnd, WM_SETFOCUS, 0, 0 );
         break;
 
-#if 0
-    case WM_NOTIFY:
-        // Redo the video display because menu can be closed
-        // FIXME verify if p_child_window exits
-        if( (((NMHDR *)lp)->code) == NM_CUSTOMDRAW )
-            SendMessage( pIntf->p_sys->p_video_window->p_child_window,
-                         WM_NOTIFY, wp, lp );
-        return lResult;
-#endif
+    case WM_LBUTTONDOWN:
+        {
+            SHRGINFO shrg;
+            shrg.cbSize = sizeof( shrg );
+            shrg.hwndClient = hwnd;
+            shrg.ptDown.x = LOWORD(lp);
+            shrg.ptDown.y = HIWORD(lp);
+            shrg.dwFlags = SHRG_RETURNCMD ;
+
+            if( SHRecognizeGesture( &shrg ) == GN_CONTEXTMENU )
+                PopupMenu( p_intf, hwnd, shrg.ptDown );
+        }
+        break;
+
+   case WM_RBUTTONUP:
+        {
+            POINT point;
+            point.x = LOWORD(lp);
+            point.y = HIWORD(lp);
+            PopupMenu( p_intf, hwnd, point );
+        }
+        break;
 
     case WM_HELP:
         MessageBox (hwnd, _T("Help"), _T("Help"), MB_OK);
-        return lResult;
+        break;
 
     case WM_CLOSE:
-        DestroyWindow( hwndCB );
+        if( hwndCB ) DestroyWindow( hwndCB );
         DestroyWindow( hwnd );
-        return lResult;
+        break;
 
     case WM_DESTROY:
         PostQuitMessage( 0 );
-        return lResult;
+        break;
     }
 
     return DefWindowProc( hwnd, msg, wp, lp );
 }
 
-void Interface::OnOpenFileSimple( void )
+void Interface::OnShowDialog( int i_dialog_event )
 {
-    OPENFILENAME ofn;
-    TCHAR DateiName[80+1] = _T("\0");
-    static TCHAR szFilter[] = _T("All (*.*)\0*.*\0");
-
-    playlist_t *p_playlist = (playlist_t *)
-        vlc_object_find( pIntf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
-    if( p_playlist == NULL ) return;
+    int i_id;
 
-    memset( &ofn, 0, sizeof(OPENFILENAME) );
-    ofn.lStructSize = sizeof(OPENFILENAME);
-    ofn.hwndOwner = NULL;
-    ofn.hInstance = hInst;
-    ofn.lpstrFilter = szFilter;
-    ofn.lpstrCustomFilter = NULL;
-    ofn.nMaxCustFilter = 0;
-    ofn.nFilterIndex = 1;     
-    ofn.lpstrFile = (LPTSTR)DateiName; 
-    ofn.nMaxFile = 80;
-    ofn.lpstrFileTitle = NULL; 
-    ofn.nMaxFileTitle = 40;
-    ofn.lpstrInitialDir = NULL;
-    ofn.lpstrTitle = _T("Quick Open File");
-    ofn.Flags = 0; 
-    ofn.nFileOffset = 0;
-    ofn.nFileExtension = 0;
-    ofn.lpstrDefExt = NULL;
-    ofn.lCustData = 0L;
-    ofn.lpfnHook = NULL;
-    ofn.lpTemplateName = NULL;
-
-    SHFullScreen( GetForegroundWindow(), SHFS_HIDESIPBUTTON );
-
-    if( GetOpenFileName( (LPOPENFILENAME)&ofn ) )
+    switch( i_dialog_event )
     {
-        char *psz_filename = _TOMB(ofn.lpstrFile);
-        playlist_Add( p_playlist, psz_filename, psz_filename,
-                      PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
+    case ID_FILE_QUICKOPEN: i_id = INTF_DIALOG_FILE_SIMPLE; break;
+    case ID_FILE_OPENFILE: i_id = INTF_DIALOG_FILE; break;
+    case ID_FILE_OPENDIR: i_id = INTF_DIALOG_DIRECTORY; break;
+    case ID_FILE_OPENNET: i_id = INTF_DIALOG_NET; break;
+    case ID_VIEW_PLAYLIST: i_id = INTF_DIALOG_PLAYLIST; break;
+    case ID_VIEW_MESSAGES: i_id = INTF_DIALOG_MESSAGES; break;
+    case ID_VIEW_STREAMINFO: i_id = INTF_DIALOG_FILEINFO; break;
+    case ID_PREFERENCES: i_id = INTF_DIALOG_PREFS; break;
+    default: i_id = INTF_DIALOG_FILE; break;
     }
 
-    vlc_object_release( p_playlist );
+    if( p_intf->p_sys->pf_show_dialog )
+        p_intf->p_sys->pf_show_dialog( p_intf, i_id, 1, 0 );
 }
 
 void Interface::OnPlayStream( void )
 {
     playlist_t *p_playlist = (playlist_t *)
-        vlc_object_find( pIntf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+        vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
     if( p_playlist == NULL ) return;
 
     if( p_playlist->i_size && p_playlist->i_enabled )
@@ -770,7 +643,7 @@ void Interface::OnPlayStream( void )
         vlc_value_t state;
 
         input_thread_t *p_input = (input_thread_t *)
-            vlc_object_find( pIntf, VLC_OBJECT_INPUT, FIND_ANYWHERE );
+            vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE );
 
         if( p_input == NULL )
         {
@@ -803,7 +676,7 @@ void Interface::OnPlayStream( void )
     {
         /* If the playlist is empty, open a file requester instead */
         vlc_object_release( p_playlist );
-        OnOpenFileSimple();
+        OnShowDialog( ID_FILE_QUICKOPEN );
     }
 }
 
@@ -842,7 +715,7 @@ void Interface::OnVideoOnTop( void )
     vlc_value_t val;
 
     vout_thread_t *p_vout = (vout_thread_t *)
-        vlc_object_find( pIntf, VLC_OBJECT_VOUT, FIND_ANYWHERE );
+        vlc_object_find( p_intf, VLC_OBJECT_VOUT, FIND_ANYWHERE );
 
     if( p_vout == NULL ) return;
 
@@ -857,26 +730,26 @@ void Interface::OnVideoOnTop( void )
 
 void Interface::OnSliderUpdate( int wp )
 {
-    vlc_mutex_lock( &pIntf->change_lock );
-    input_thread_t *p_input = pIntf->p_sys->p_input;
+    vlc_mutex_lock( &p_intf->change_lock );
+    input_thread_t *p_input = p_intf->p_sys->p_input;
 
-    int dwPos = SendMessage( hwndSlider, TBM_GETPOS, 0, 0 ); 
+    int dwPos = SendMessage( hwndSlider, TBM_GETPOS, 0, 0 );
 
     if( (int)LOWORD(wp) == SB_THUMBPOSITION ||
         (int)LOWORD(wp) == SB_ENDSCROLL )
     {
-        if( pIntf->p_sys->i_slider_pos != dwPos && p_input )
+        if( p_intf->p_sys->i_slider_pos != dwPos && p_input )
         {
             vlc_value_t pos;
             pos.f_float = (float)dwPos / (float)SLIDER_MAX_POS;
             var_Set( p_input, "position", pos );
         }
 
-        pIntf->p_sys->b_slider_free = VLC_TRUE;
+        p_intf->p_sys->b_slider_free = VLC_TRUE;
     }
     else
     {
-        pIntf->p_sys->b_slider_free = VLC_FALSE;
+        p_intf->p_sys->b_slider_free = VLC_FALSE;
 
         if( p_input )
         {
@@ -895,7 +768,7 @@ void Interface::OnSliderUpdate( int wp )
         }
     }
 
-    vlc_mutex_unlock( &pIntf->change_lock );
+    vlc_mutex_unlock( &p_intf->change_lock );
 }
 
 void Interface::OnChange( int wp )
@@ -904,23 +777,40 @@ void Interface::OnChange( int wp )
 
     if( LOWORD(wp) == SB_THUMBPOSITION || LOWORD(wp) == SB_ENDSCROLL )
     {
-        Change( 200 - (int)dwPos );
+        VolumeChange( 200 - (int)dwPos );
+        b_volume_hold = VLC_FALSE;
+    }
+    else
+    {
+        b_volume_hold = VLC_TRUE;
     }
 }
 
-void Interface::Change( int i_volume )
+void Interface::VolumeChange( int i_volume )
 {
-    aout_VolumeSet( pIntf, i_volume * AOUT_VOLUME_MAX / 200 / 2 );
-#if 0
-    SetToolTip( wxString::Format((wxString)wxU(_("Volume")) + wxT(" %d"),
-                i_volume ) );
-#endif
+    aout_VolumeSet( p_intf, i_volume * AOUT_VOLUME_MAX / 200 / 2 );
+}
+
+void Interface::VolumeUpdate()
+{
+    audio_volume_t i_volume;
+
+    if( b_volume_hold ) return;
+
+    aout_VolumeGet( p_intf, &i_volume );
+
+    int i_volume_ctrl = 200 - i_volume * 200 * 2 / AOUT_VOLUME_MAX;
+
+    DWORD dwPos = SendMessage( hwndVol, TBM_GETPOS, 0, 0 );
+    if( i_volume_ctrl == (int)dwPos ) return;
+
+    SendMessage( hwndVol, TBM_SETPOS, 1, i_volume_ctrl );
 }
 
 void Interface::OnStopStream( void )
 {
     playlist_t * p_playlist = (playlist_t *)
-        vlc_object_find( pIntf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+        vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
     if( p_playlist == NULL ) return;
 
     playlist_Stop( p_playlist );
@@ -931,7 +821,7 @@ void Interface::OnStopStream( void )
 void Interface::OnPrevStream( void )
 {
     playlist_t * p_playlist = (playlist_t *)
-        vlc_object_find( pIntf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+        vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
     if( p_playlist == NULL ) return;
 
     playlist_Prev( p_playlist );
@@ -941,7 +831,7 @@ void Interface::OnPrevStream( void )
 void Interface::OnNextStream( void )
 {
     playlist_t * p_playlist = (playlist_t *)
-        vlc_object_find( pIntf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+        vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
     if( p_playlist == NULL ) return;
 
     playlist_Next( p_playlist );
@@ -951,7 +841,7 @@ void Interface::OnNextStream( void )
 void Interface::OnSlowStream( void )
 {
     input_thread_t *p_input = (input_thread_t *)
-        vlc_object_find( pIntf, VLC_OBJECT_INPUT, FIND_ANYWHERE );
+        vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE );
 
     if( p_input == NULL ) return;
 
@@ -963,7 +853,7 @@ void Interface::OnSlowStream( void )
 void Interface::OnFastStream( void )
 {
     input_thread_t *p_input = (input_thread_t *)
-        vlc_object_find( pIntf, VLC_OBJECT_INPUT, FIND_ANYWHERE );
+        vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE );
 
     if( p_input == NULL ) return;
 
@@ -971,3 +861,9 @@ void Interface::OnFastStream( void )
     var_Set( p_input, "rate-faster", val );
     vlc_object_release( p_input );
 }
+
+void Interface::Update()
+{
+    /* Misc updates */
+    VolumeUpdate();
+}