]> git.sesse.net Git - vlc/commitdiff
* modules/gui/wince: usual bunch of cleanup + updates.
authorGildas Bazin <gbazin@videolan.org>
Mon, 28 Feb 2005 18:23:26 +0000 (18:23 +0000)
committerGildas Bazin <gbazin@videolan.org>
Mon, 28 Feb 2005 18:23:26 +0000 (18:23 +0000)
modules/gui/wince/interface.cpp
modules/gui/wince/open.cpp
modules/gui/wince/playlist.cpp
modules/gui/wince/subtitles.cpp
modules/gui/wince/wince.cpp
modules/gui/wince/wince.h

index 6ed26a814fd3728d718e4882939b75a2d981eb38..65913cd68ac90f6e0489cf0d70d1611b184ebfc9 100644 (file)
@@ -108,7 +108,7 @@ TCHAR * szToolTips[] =
 BOOL Interface::InitInstance( HINSTANCE hInstance, intf_thread_t *_p_intf )
 {
     /* Initializations */
-    pIntf = _p_intf;
+    p_intf = _p_intf;
     hwndMain = hwndCB = hwndTB = hwndSlider = hwndLabel = hwndVol = hwndSB = 0;
     i_old_playing_status = PAUSE_S;
 
@@ -525,10 +525,10 @@ LRESULT CALLBACK Interface::WndProc( HWND hwnd, UINT msg, WPARAM wp,
 #endif
 
         /* Video window */
-        if( config_GetInt( pIntf, "wince-embed" ) )
-            video = CreateVideoWindow( pIntf, hwnd );
+        if( config_GetInt( p_intf, "wince-embed" ) )
+            video = CreateVideoWindow( p_intf, hwnd );
 
-        ti = new Timer(pIntf, hwnd, this);
+        ti = new Timer(p_intf, hwnd, this);
 
         // Hide the SIP button (WINCE only)
         SetForegroundWindow( hwnd );
@@ -543,14 +543,14 @@ LRESULT CALLBACK Interface::WndProc( HWND hwnd, UINT msg, WPARAM wp,
            break;
 
         case ID_FILE_OPENFILE: 
-           open = new OpenDialog( pIntf, hInst, FILE_ACCESS,
+           open = new OpenDialog( p_intf, hInst, FILE_ACCESS,
                                   ID_FILE_OPENFILE, OPEN_NORMAL );
            CreateDialogBox( hwnd, open );
            delete open;
            break;
 
         case ID_FILE_OPENNET:
-            open = new OpenDialog( pIntf, hInst, NET_ACCESS, ID_FILE_OPENNET,
+            open = new OpenDialog( p_intf, hInst, NET_ACCESS, ID_FILE_OPENNET,
                                    OPEN_NORMAL );
            CreateDialogBox( hwnd, open );
             delete open;
@@ -598,31 +598,31 @@ LRESULT CALLBACK Interface::WndProc( HWND hwnd, UINT msg, WPARAM wp,
            break;
 
         case ID_VIEW_STREAMINFO:
-            fi = new FileInfo( pIntf, hInst );
+            fi = new FileInfo( p_intf, hInst );
            CreateDialogBox( hwnd, fi );
             delete fi;
            break;
 
         case ID_VIEW_MESSAGES:
-            hmsg = new Messages( pIntf, hInst );
+            hmsg = new Messages( p_intf, hInst );
            CreateDialogBox( hwnd, hmsg );
             delete hmsg;
            break;
 
         case ID_VIEW_PLAYLIST:
-            pl = new Playlist( pIntf, hInst );
+            pl = new Playlist( p_intf, hInst );
            CreateDialogBox( hwnd, pl );
             delete pl;
            break;
 
         case ID_SETTINGS_PREF:
-            pref = new PrefsDialog( pIntf, hInst );
+            pref = new PrefsDialog( p_intf, hInst );
            CreateDialogBox( hwnd, pref );
             delete pref;
            break;
                   
         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;
@@ -652,16 +652,16 @@ LRESULT CALLBACK Interface::WndProc( HWND hwnd, UINT msg, WPARAM wp,
         break;
 
     case WM_INITMENUPOPUP:
-        RefreshSettingsMenu( pIntf,
+        RefreshSettingsMenu( p_intf,
             (HMENU)SendMessage( hwndCB, SHCMBM_GETSUBMENU, (WPARAM)0,
                                 (LPARAM)IDM_SETTINGS ) );
-        RefreshAudioMenu( pIntf,
+        RefreshAudioMenu( p_intf,
             (HMENU)SendMessage( hwndCB, SHCMBM_GETSUBMENU, (WPARAM)0,
                                 (LPARAM)IDM_AUDIO ) );
-        RefreshVideoMenu( pIntf,
+        RefreshVideoMenu( p_intf,
             (HMENU)SendMessage( hwndCB, SHCMBM_GETSUBMENU, (WPARAM)0,
                                 (LPARAM)IDM_VIDEO ) );
-        RefreshNavigMenu( pIntf,
+        RefreshNavigMenu( p_intf,
             (HMENU)SendMessage( hwndCB, SHCMBM_GETSUBMENU, (WPARAM)0,
                                 (LPARAM)IDM_NAVIGATION ) );
 
@@ -669,7 +669,7 @@ LRESULT CALLBACK Interface::WndProc( HWND hwnd, UINT msg, WPARAM wp,
         // 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,
+        SendMessage( p_intf->p_sys->p_video_window->p_child_window,
                      WM_INITMENUPOPUP, wp, lp );
 #endif
 
@@ -683,7 +683,7 @@ LRESULT CALLBACK Interface::WndProc( HWND hwnd, UINT msg, WPARAM wp,
         // 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,
+            SendMessage( p_intf->p_sys->p_video_window->p_child_window,
                          WM_NOTIFY, wp, lp );
         return lResult;
 #endif
@@ -713,7 +713,7 @@ void Interface::OnOpenFileSimple( void )
     static TCHAR szFilter[] = _T("All (*.*)\0*.*\0");
 
     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;
 
     memset( &ofn, 0, sizeof(OPENFILENAME) );
@@ -740,7 +740,7 @@ void Interface::OnOpenFileSimple( void )
 
     SHFullScreen( GetForegroundWindow(), SHFS_HIDESIPBUTTON );
 
-    if( GetOpenFileName( (LPOPENFILENAME)&ofn ) )
+    if( GetOpenFile&ofn ) )
     {
         char *psz_filename = _TOMB(ofn.lpstrFile);
         playlist_Add( p_playlist, psz_filename, psz_filename,
@@ -753,7 +753,7 @@ void Interface::OnOpenFileSimple( void )
 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 )
@@ -761,7 +761,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 )
         {
@@ -833,7 +833,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;
 
@@ -848,26 +848,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 ); 
 
     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 )
         {
@@ -886,7 +886,7 @@ void Interface::OnSliderUpdate( int wp )
         }
     }
 
-    vlc_mutex_unlock( &pIntf->change_lock );
+    vlc_mutex_unlock( &p_intf->change_lock );
 }
 
 void Interface::OnChange( int wp )
@@ -901,7 +901,7 @@ void Interface::OnChange( int wp )
 
 void Interface::Change( int i_volume )
 {
-    aout_VolumeSet( pIntf, i_volume * AOUT_VOLUME_MAX / 200 / 2 );
+    aout_VolumeSet( p_intf, i_volume * AOUT_VOLUME_MAX / 200 / 2 );
 #if 0
     SetToolTip( wxString::Format((wxString)wxU(_("Volume")) + wxT(" %d"),
                 i_volume ) );
@@ -911,7 +911,7 @@ void Interface::Change( int i_volume )
 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 );
@@ -922,7 +922,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 );
@@ -932,7 +932,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 );
@@ -942,7 +942,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;
 
@@ -954,7 +954,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;
 
index 790dcf0ac5593e47d1862ca5b3a1460233b87c89..796b7fd4cda119ec05380ec5db9a188a907e5bc7 100644 (file)
@@ -691,7 +691,7 @@ void OpenDialog::OnFileBrowse()
     ofn.lCustData = 0L;
     ofn.lpfnHook = NULL;
     ofn.lpTemplateName = NULL;
-    if( GetOpenFileName((LPOPENFILENAME) &ofn) )
+    if( GetOpenFile( &ofn ) )
     {
         if( _tcschr( ofn.lpstrFile, _T(' ') ) )
         {
index ae5f1cd278d45ffbc3adad1357b809fa44636951..fe1b970d8ae5a0a775bce05a1471fec636ae145f 100644 (file)
@@ -279,7 +279,7 @@ LRESULT Playlist::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
                                   BUTTONWIDTH, BUTTONHEIGHT,
                                   IMAGEWIDTH, IMAGEHEIGHT, sizeof(TBBUTTON) );
         if( !hwndTB ) break;
-  
+
         // Add ToolTips to the toolbar.
         SendMessage( hwndTB, TB_SETTOOLTIPS, (WPARAM) NUMIMAGES,
                      (LPARAM)szToolTips2 );
@@ -735,7 +735,7 @@ void Playlist::OnOpen()
     ofn.lpfnHook = NULL;
     ofn.lpTemplateName = NULL;
 
-    if( GetOpenFileName((LPOPENFILENAME)&ofn) )
+    if( GetOpenFile( &ofn ) )
     {
         playlist_Import( p_playlist, _TOMB(ofn.lpstrFile) );
     }
@@ -826,13 +826,9 @@ void Playlist::OnAddFile( vlc_bool_t b_directory )
     ofn.lpfnHook = NULL;
     ofn.lpTemplateName = NULL;
 
-#if 0//def UNDER_CE
-    if( b_directory ) ofn.Flags |= OFN_PROJECT;
-#endif
-
     SHFullScreen( GetForegroundWindow(), SHFS_HIDESIPBUTTON );
 
-    if( GetOpenFileName( (LPOPENFILENAME)&ofn ) )
+    if( GetOpenFile&ofn ) )
     {
         playlist_t *p_playlist = (playlist_t *)
            vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
index 5013f008fc114136e558fd516e367c58e7a54617..de287d38909d222ec6301fa4159127bd83b86afa 100644 (file)
@@ -305,7 +305,7 @@ void SubsFileDialog::OnFileBrowse()
     ofn.lCustData = 0L;
     ofn.lpfnHook = NULL;
     ofn.lpTemplateName = NULL;
-    if( GetOpenFileName((LPOPENFILENAME) &ofn) )
+    if( GetOpenFile( &ofn ) )
     {
         SetWindowText( file_combo, ofn.lpstrFile );
         ComboBox_AddString( file_combo, ofn.lpstrFile );
index 803f511fc65a1142add6af2042035b5f2def28b5..1e25cab0dbd28d9edb33086e82f890301d90113d 100644 (file)
@@ -35,6 +35,9 @@
 
 #include "wince.h"
 
+#include <commctrl.h>
+#include <commdlg.h>
+
 /*****************************************************************************
  * Local prototypes.
  *****************************************************************************/
@@ -112,6 +115,18 @@ static int Open( vlc_object_t *p_this )
     p_intf->p_sys->b_slider_free = 1;
     p_intf->p_sys->i_slider_pos = p_intf->p_sys->i_slider_oldpos = 0;
 
+    p_intf->p_sys->GetOpenFile = 0;
+    p_intf->p_sys->h_gsgetfile_dll = LoadLibrary( _T("gsgetfile") );
+    if( p_intf->p_sys->h_gsgetfile_dll )
+    {
+        p_intf->p_sys->GetOpenFile = (BOOL (WINAPI *)(void *))
+            GetProcAddress( p_intf->p_sys->h_gsgetfile_dll,
+                            _T("gsGetOpenFileName") );
+    }
+
+    if( !p_intf->p_sys->GetOpenFile )
+        p_intf->p_sys->GetOpenFile = (BOOL (WINAPI *)(void *))GetOpenFileName;
+
     return VLC_SUCCESS;
 }
 
@@ -130,6 +145,9 @@ static void Close( vlc_object_t *p_this )
     // Unsuscribe to messages bank
     msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub );
 
+    if( p_intf->p_sys->h_gsgetfile_dll )
+        FreeLibrary( p_intf->p_sys->h_gsgetfile_dll );
+
     // Destroy structure
     free( p_intf->p_sys );
 }
index 87d3803b465e9fb430e6504ceecf372b76ee3553..4320e036ad59a93532c5f80e627c1ab4df4aa3c1 100644 (file)
@@ -82,8 +82,14 @@ struct intf_sys_t
     vector<MenuItemExt*> *p_settings_menu;
 
     VideoWindow          *p_video_window;
+
+    /* GetOpenFileName replacement */
+    BOOL (WINAPI *GetOpenFile)(void *);
+    HMODULE h_gsgetfile_dll;
 };
 
+#define GetOpenFile(a) p_intf->p_sys->GetOpenFile(a)
+
 /*****************************************************************************
  * Prototypes
  *****************************************************************************/
@@ -91,21 +97,23 @@ struct intf_sys_t
 class CBaseWindow
 {
 public:
-   CBaseWindow(){ hInst = 0; }
-   virtual ~CBaseWindow() {};
+    CBaseWindow(){ hInst = 0; }
+    virtual ~CBaseWindow() {};
 
-   HWND hWnd;                // The main window handle
+    HWND hWnd;                // The main window handle
 
-   static LRESULT CALLBACK BaseWndProc( HWND, UINT, WPARAM, LPARAM );
-   static int CreateDialogBox( HWND, CBaseWindow * );
+    static LRESULT CALLBACK BaseWndProc( HWND, UINT, WPARAM, LPARAM );
+    static int CreateDialogBox( HWND, CBaseWindow * );
 
 protected:
 
-   HINSTANCE       hInst;               // The current instance
-   HWND            hwndCB;              // The command bar handle
+    HINSTANCE       hInst;               // The current instance
+    HWND            hwndCB;              // The command bar handle
 
-   HINSTANCE       GetInstance () const { return hInst; }
-   virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM ) {};
+    HINSTANCE       GetInstance () const { return hInst; }
+    virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM ) { return 0; };
+
+    intf_thread_t *p_intf;
 };
 
 class FileInfo;
@@ -125,7 +133,7 @@ public:
     Interface(){}
     ~Interface(){}
 
-    BOOL InitInstance( HINSTANCE hInstance, intf_thread_t *_pIntf );
+    BOOL InitInstance( HINSTANCE, intf_thread_t * );
 
     void TogglePlayButton( int i_playing_status );
 
@@ -165,8 +173,6 @@ protected:
     void OnSlowStream( void );
     void OnFastStream( void );
 
-    intf_thread_t *pIntf;
-
     int i_old_playing_status;
 };
 
@@ -182,7 +188,6 @@ protected:
 
     HWND hwnd_fileinfo;                 // handle to fileinfo window
     HWND hwndTV;                                // handle to tree-view control 
-    intf_thread_t *p_intf;
 
     TCHAR szFileInfoClassName[100];     // Main window class name
     TCHAR szFileInfoTitle[100];         // Main window name
@@ -202,8 +207,6 @@ public:
 
 protected:
 
-    intf_thread_t *p_intf;
-
     virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM );
 
     HWND hListView;
@@ -261,8 +264,6 @@ public:
 
 protected:
 
-    intf_thread_t *p_intf;
-
     virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM );
 
     HWND mrl_box;
@@ -328,8 +329,6 @@ public:
 protected:
     friend class OpenDialog;
 
-    intf_thread_t *p_intf;
-
     HWND file_box;
     HWND file_combo;
     HWND browse_button;
@@ -368,7 +367,6 @@ protected:
     int i_title_sorted;
     int i_author_sorted;
 
-    intf_thread_t *p_intf;
     HWND hwndCB;        // Handle to the command bar (contains menu)
     HWND hwndTB;        // Handle to the toolbar.
     HWND hListView;
@@ -480,8 +478,6 @@ public:
 
 protected:
 
-    intf_thread_t *p_intf;
-
     /* Event handlers (these functions should _not_ be virtual) */
     void OnOk( void );
     /*void OnCancel( UINT event );