]> git.sesse.net Git - vlc/blobdiff - modules/gui/wince/interface.cpp
Remove I64C as well
[vlc] / modules / gui / wince / interface.cpp
index dea844a5c1abeee27bb1a3e1c725b0f2f69bbca5..13e8aad20e112111e01094ab948af24fe7a7e3b2 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
+
+#define __STDC_CONSTANT_MACROS 1
+#include <inttypes.h>
+
 #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>
 
-#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
@@ -77,7 +82,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},
@@ -95,7 +100,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
@@ -104,42 +109,25 @@ TCHAR * szToolTips[] =
 /*****************************************************************************
  * Constructor.
  *****************************************************************************/
-Interface::Interface()
-  : hwndMain(0), hwndCB(0), hwndTB(0), hwndSlider(0), hwndLabel(0),
-    hwndVol(0), hwndSB(0),
-    fileinfo(0), messages(0), preferences(0), playlist(0),
-    timer(0), open(0), video(0)
+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;
+    delete timer;
+    delete video;
 }
 
-BOOL Interface::InitInstance( HINSTANCE hInstance, intf_thread_t *_p_intf )
+BOOL Interface::InitInstance()
 {
     /* Initializations */
-    p_intf = _p_intf;
     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
@@ -150,7 +138,7 @@ BOOL Interface::InitInstance( HINSTANCE hInstance, intf_thread_t *_p_intf )
     hwndMain =
         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;
 
@@ -161,10 +149,10 @@ BOOL Interface::InitInstance( HINSTANCE hInstance, intf_thread_t *_p_intf )
 }
 
 /***********************************************************************
-FUNCTION: 
+FUNCTION:
   CreateMenuBar
 
-PURPOSE: 
+PURPOSE:
   Creates a menu bar.
 ***********************************************************************/
 HWND Interface::CreateMenuBar( HWND hwnd, HINSTANCE hInst )
@@ -191,10 +179,10 @@ HWND Interface::CreateMenuBar( HWND hwnd, HINSTANCE hInst )
 
     SendMessage( mbi.hwndMB, TB_GETBUTTONINFO, IDM_FILE, (LPARAM)&tbbi );
     menu_file = (HMENU)tbbi.lParam;
-    RemoveMenu( hmenu_file, 0, MF_BYPOSITION );
+    RemoveMenu( menu_file, 0, MF_BYPOSITION );
     SendMessage( mbi.hwndMB, TB_GETBUTTONINFO, IDM_VIEW, (LPARAM)&tbbi );
     menu_view = (HMENU)tbbi.lParam;
-    RemoveMenu( hmenu_view, 0, MF_BYPOSITION );
+    RemoveMenu( menu_view, 0, MF_BYPOSITION );
     SendMessage( mbi.hwndMB, TB_GETBUTTONINFO, IDM_SETTINGS, (LPARAM)&tbbi );
     menu_settings = (HMENU)tbbi.lParam;
     SendMessage( mbi.hwndMB, TB_GETBUTTONINFO, IDM_VIDEO, (LPARAM)&tbbi );
@@ -218,6 +206,8 @@ HWND Interface::CreateMenuBar( HWND hwnd, HINSTANCE hInst )
     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 );
@@ -258,10 +248,10 @@ HWND Interface::CreateMenuBar( HWND hwnd, HINSTANCE hInst )
 }
 
 /***********************************************************************
-FUNCTION: 
+FUNCTION:
   CreateToolBar
 
-PURPOSE: 
+PURPOSE:
   Registers the TOOLBAR control class and creates a toolbar.
 ***********************************************************************/
 HWND CreateToolBar( HWND hwnd, HINSTANCE hInst )
@@ -286,15 +276,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;
@@ -302,10 +292,10 @@ HWND CreateToolBar( HWND hwnd, HINSTANCE hInst )
 
 /***********************************************************************
 
-FUNCTION: 
+FUNCTION:
   CreateSliderBar
 
-PURPOSE: 
+PURPOSE:
   Registers the TRACKBAR_CLASS control class and creates a trackbar.
 
 ***********************************************************************/
@@ -334,8 +324,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 );
@@ -367,10 +357,10 @@ HWND CreateStaticText( HWND hwnd, HINSTANCE hInst )
 
 /***********************************************************************
 
-FUNCTION: 
+FUNCTION:
   CreateVolTrackBar
 
-PURPOSE: 
+PURPOSE:
   Registers the TRACKBAR_CLASS control class and creates a trackbar.
 
 ***********************************************************************/
@@ -396,12 +386,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 );
@@ -411,10 +401,10 @@ HWND CreateVolTrackBar( HWND hwnd, HINSTANCE hInst )
 
 /***********************************************************************
 
-FUNCTION: 
+FUNCTION:
   CreateStatusBar
 
-PURPOSE: 
+PURPOSE:
   Registers the StatusBar control class and creates a Statusbar.
 
 ***********************************************************************/
@@ -441,7 +431,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
@@ -460,70 +450,9 @@ HWND CreateStatusBar( HWND hwnd, HINSTANCE hInst )
 
 /***********************************************************************
 FUNCTION:
-  CreateDialogBox
-
-PURPOSE:
-  Creates a Dialog Box.
-***********************************************************************/
-int CBaseWindow::CreateDialogBox( HWND hwnd, CBaseWindow *p_obj )
-{
-    uint8_t p_buffer[sizeof(DLGTEMPLATE) + sizeof(WORD) * 4];
-    DLGTEMPLATE *p_dlg_template = (DLGTEMPLATE *)p_buffer;
-    memset( p_dlg_template, 0, sizeof(DLGTEMPLATE) + sizeof(WORD) * 4 );
-
-    // these values are arbitrary, they won't be used normally anyhow
-    p_dlg_template->x  = 0; p_dlg_template->y  = 0;
-    p_dlg_template->cx = 300; p_dlg_template->cy = 300;
-    p_dlg_template->style =
-        DS_MODALFRAME|WS_POPUP|WS_CAPTION|WS_SYSMENU|WS_SIZEBOX;
-
-    return DialogBoxIndirectParam( GetModuleHandle(0), p_dlg_template, hwnd,
-                                   (DLGPROC)p_obj->BaseWndProc, (LPARAM)p_obj );
-}
-
-/***********************************************************************
-FUNCTION: 
-  BaseWndProc
-
-PURPOSE: 
-  Processes messages sent to the main window.
-***********************************************************************/
-LRESULT CALLBACK CBaseWindow::BaseWndProc( HWND hwnd, UINT msg, WPARAM wParam,
-                                           LPARAM lParam )
-{
-    CBaseWindow *p_obj;
-
-    // check to see if a copy of the 'this' pointer needs to be saved
-    if( msg == WM_CREATE )
-    {
-        p_obj = (CBaseWindow *)(((LPCREATESTRUCT)lParam)->lpCreateParams);
-        SetWindowLong( hwnd, GWL_USERDATA,
-                       (LONG)((LPCREATESTRUCT)lParam)->lpCreateParams );
-
-        p_obj->hWnd = hwnd;
-    }
-
-    if( msg == WM_INITDIALOG )
-    {
-        p_obj = (CBaseWindow *)lParam;
-        SetWindowLong( hwnd, GWL_USERDATA, lParam );
-        p_obj->hWnd = hwnd;
-    }
-
-    // Retrieve the pointer
-    p_obj = (CBaseWindow *)GetWindowLong( hwnd, GWL_USERDATA );
-
-    if( !p_obj ) return DefWindowProc( hwnd, msg, wParam, lParam );
-
-    // Filter message through child classes
-    return p_obj->WndProc( hwnd, msg, wParam, lParam );
-}
-
-/***********************************************************************
-FUNCTION: 
   WndProc
 
-PURPOSE: 
+PURPOSE:
   Processes messages sent to the main window.
 ***********************************************************************/
 LRESULT Interface::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
@@ -545,64 +474,40 @@ LRESULT Interface::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
             video = CreateVideoWindow( p_intf, hwnd );
 
         timer = new Timer( p_intf, hwnd, this );
-
-        // Hide the SIP button (WINCE only)
-        SetForegroundWindow( hwnd );
-        SHFullScreen( GetForegroundWindow(), SHFS_HIDESIPBUTTON );
         break;
 
     case WM_COMMAND:
         switch( GET_WM_COMMAND_ID(wp,lp) )
         {
-        case ID_FILE_QUICKOPEN: 
-            OnOpenFileSimple();
-            break;
-
-        case ID_FILE_OPENFILE: 
-            open = new OpenDialog( p_intf, hInst, FILE_ACCESS,
-                                   ID_FILE_OPENFILE, OPEN_NORMAL );
-            CreateDialogBox( hwnd, open );
-            delete open;
-            break;
-
+        case ID_FILE_QUICKOPEN:
+        case ID_FILE_OPENFILE:
+        case ID_FILE_OPENDIR:
         case ID_FILE_OPENNET:
-            open = new OpenDialog( p_intf, hInst, NET_ACCESS, ID_FILE_OPENNET,
-                                   OPEN_NORMAL );
-            CreateDialogBox( hwnd, open );
-            delete open;
-            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();
+        case ID_VIEW_STREAMINFO:
+        case ID_VIEW_MESSAGES:
+        case ID_VIEW_PLAYLIST:
+        case ID_PREFERENCES:
+            OnShowDialog( GET_WM_COMMAND_ID(wp,lp) );
             break;
 
-        case FastStream_Event: 
-            OnFastStream();
-            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: 
+        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 );
@@ -613,49 +518,25 @@ LRESULT Interface::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
             SendMessage( hwnd, WM_CLOSE, 0, 0 );
             break;
 
-        case ID_VIEW_STREAMINFO:
-            fileinfo = new FileInfo( p_intf, hInst );
-            CreateDialogBox( hwnd, fileinfo );
-            delete fileinfo;
-            break;
-
-        case ID_VIEW_MESSAGES:
-            messages = new Messages( p_intf, hInst );
-            CreateDialogBox( hwnd, messages );
-            delete messages;
-            break;
-
-        case ID_VIEW_PLAYLIST:
-            playlist = new Playlist( p_intf, hInst );
-            CreateDialogBox( hwnd, playlist );
-            delete playlist;
-            break;
-
-        case ID_PREFERENCES:
-            preferences = new PrefsDialog( p_intf, hInst );
-            CreateDialogBox( hwnd, preferences );
-            delete preferences;
-            break;
-                  
         default:
             OnMenuEvent( p_intf, GET_WM_COMMAND_ID(wp,lp) );
             // we should test if it is a menu command
         }
         break;
-  
     case WM_TIMER:
         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;
 
@@ -668,20 +549,27 @@ LRESULT Interface::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
         break;
 
     case WM_INITMENUPOPUP:
-        RefreshSettingsMenu( p_intf, menu_settings );
-        RefreshAudioMenu( p_intf, menu_audio );
-        RefreshVideoMenu( p_intf, menu_video );
-        RefreshNavigMenu( p_intf, menu_navigation );
+        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_ENTERMENULOOP:
     case WM_KILLFOCUS:
+        SHFullScreen( hwnd, SHFS_SHOWSIPBUTTON );
+    case WM_ENTERMENULOOP:
         if( video && video->hWnd )
             SendMessage( video->hWnd, WM_KILLFOCUS, 0, 0 );
         break;
 
-    case WM_EXITMENULOOP:
     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;
@@ -726,48 +614,25 @@ LRESULT Interface::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
     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( p_intf, 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( GetOpenFile( &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 )
@@ -776,7 +641,7 @@ void Interface::OnPlayStream( void )
         vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
     if( p_playlist == NULL ) return;
 
-    if( p_playlist->i_size && p_playlist->i_enabled )
+    if( p_playlist->i_size )
     {
         vlc_value_t state;
 
@@ -814,7 +679,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 );
     }
 }
 
@@ -871,7 +736,7 @@ void Interface::OnSliderUpdate( int wp )
     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 )
@@ -883,11 +748,11 @@ void Interface::OnSliderUpdate( int wp )
             var_Set( p_input, "position", pos );
         }
 
-        p_intf->p_sys->b_slider_free = VLC_TRUE;
+        p_intf->p_sys->b_slider_free = true;
     }
     else
     {
-        p_intf->p_sys->b_slider_free = VLC_FALSE;
+        p_intf->p_sys->b_slider_free = false;
 
         if( p_input )
         {
@@ -895,10 +760,10 @@ void Interface::OnSliderUpdate( int wp )
             char psz_time[ MSTRTIME_MAX_SIZE ], psz_total[ MSTRTIME_MAX_SIZE ];
             mtime_t i_seconds;
 
-            i_seconds = var_GetTime( p_input, "length" ) / I64C(1000000 );
+            i_seconds = var_GetTime( p_input, "length" ) / INT64_C(1000000 );
             secstotimestr( psz_total, i_seconds );
 
-            i_seconds = var_GetTime( p_input, "time" ) / I64C(1000000 );
+            i_seconds = var_GetTime( p_input, "time" ) / INT64_C(1000000 );
             secstotimestr( psz_time, i_seconds );
 
             SendMessage( hwndLabel, WM_SETTEXT, (WPARAM)1,
@@ -915,17 +780,34 @@ 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 = false;
+    }
+    else
+    {
+        b_volume_hold = true;
     }
 }
 
-void Interface::Change( int i_volume )
+void Interface::VolumeChange( int i_volume )
 {
     aout_VolumeSet( p_intf, i_volume * AOUT_VOLUME_MAX / 200 / 2 );
-#if 0
-    SetToolTip( wxString::Format((wxString)wxU(_("Volume")) + wxT(" %d"),
-                i_volume ) );
-#endif
+}
+
+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 )
@@ -966,7 +848,7 @@ void Interface::OnSlowStream( void )
 
     if( p_input == NULL ) return;
 
-    vlc_value_t val; val.b_bool = VLC_TRUE;
+    vlc_value_t val; val.b_bool = true;
     var_Set( p_input, "rate-slower", val );
     vlc_object_release( p_input );
 }
@@ -978,7 +860,13 @@ void Interface::OnFastStream( void )
 
     if( p_input == NULL ) return;
 
-    vlc_value_t val; val.b_bool = VLC_TRUE;
+    vlc_value_t val; val.b_bool = true;
     var_Set( p_input, "rate-faster", val );
     vlc_object_release( p_input );
 }
+
+void Interface::Update()
+{
+    /* Misc updates */
+    VolumeUpdate();
+}