]> git.sesse.net Git - vlc/blobdiff - modules/gui/wince/dialogs.cpp
WinCE: update the use of messages subscription
[vlc] / modules / gui / wince / dialogs.cpp
index e71098bfd15258a5c6fed143f6ab02899228d647..5c127168a5c339a6fb7503c5903717985619cff0 100644 (file)
@@ -2,7 +2,7 @@
  * dialogs.cpp : WinCE plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000-2005 the VideoLAN team
- * $Id: dialogs.cpp 10101 2005-03-02 16:47:31Z robux4 $
+ * $Id$
  *
  * Authors: Gildas Bazin <gbazin@videolan.org>
  *
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include <stdlib.h>                                      /* malloc(), free() */
 
-#include <vlc/vlc.h>
-#include <vlc/aout.h>
-#include <vlc/intf.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
+#include <vlc_aout.h>
+#include <vlc_interface.h>
+#include <vlc_playlist.h>
 
 #include "wince.h"
 
@@ -115,11 +119,11 @@ DialogsProvider::DialogsProvider( intf_thread_t *p_intf,
 DialogsProvider::~DialogsProvider()
 {
     /* Clean up */
-    if( p_open_dialog )     delete p_open_dialog;
-    if( p_playlist_dialog ) delete p_playlist_dialog;
-    if( p_messages_dialog ) delete p_messages_dialog;
-    if( p_fileinfo_dialog ) delete p_fileinfo_dialog;
-    if( p_prefs_dialog )    delete p_prefs_dialog;
+    delete p_open_dialog;
+    delete p_playlist_dialog;
+    delete p_messages_dialog;
+    delete p_fileinfo_dialog;
+    delete p_prefs_dialog;
 
     if( h_gsgetfile_dll ) FreeLibrary( h_gsgetfile_dll );
 }
@@ -146,9 +150,6 @@ LRESULT DialogsProvider::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
 
 void DialogsProvider::OnIdle( void )
 {
-    /* Update the log window */
-    if( p_messages_dialog ) p_messages_dialog->UpdateLog();
-
     /* Update the playlist */
     if( p_playlist_dialog ) p_playlist_dialog->UpdatePlaylist();
 
@@ -271,13 +272,13 @@ void DialogsProvider::OnOpenFileGeneric( intf_dialog_args_t *p_arg )
     ofn.lpstrCustomFilter = NULL;
     ofn.nMaxCustFilter = 0;
     ofn.nFilterIndex = 1;
-    ofn.lpstrFile = (LPTSTR)szFile; 
+    ofn.lpstrFile = (LPTSTR)szFile;
     ofn.nMaxFile = MAX_PATH;
-    ofn.lpstrFileTitle = NULL; 
+    ofn.lpstrFileTitle = NULL;
     ofn.nMaxFileTitle = 40;
     ofn.lpstrInitialDir = NULL;
     ofn.lpstrTitle = _FROMMB(p_arg->psz_title);
-    ofn.Flags = 0; 
+    ofn.Flags = 0;
     ofn.nFileOffset = 0;
     ofn.nFileExtension = 0;
     ofn.lpstrDefExt = NULL;
@@ -317,8 +318,8 @@ void DialogsProvider::OnOpenFileGeneric( intf_dialog_args_t *p_arg )
         }
         free( p_arg->psz_results );
     }
-    if( p_arg->psz_title ) free( p_arg->psz_title );
-    if( p_arg->psz_extensions ) free( p_arg->psz_extensions );
+    free( p_arg->psz_title );
+    free( p_arg->psz_extensions );
 
     free( p_arg );
 }
@@ -327,10 +328,9 @@ void DialogsProvider::OnOpenFileSimple( int i_arg )
 {
     OPENFILENAME ofn;
     TCHAR szFile[MAX_PATH] = _T("\0");
-    static TCHAR szFilter[] = _T("All (*.*)\0*.*\0");
+    static TCHAR szFilter[] = _T("wav (*.wav)\0*.wav\0mp3 (*.mp3 *.mpga)\0*.mp3;*.mpga\0All (*.*)\0*.*\0");
 
-    playlist_t *p_playlist = (playlist_t *)
-        vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+    playlist_t *p_playlist = pl_Hold( p_intf );
     if( p_playlist == NULL ) return;
 
     memset( &ofn, 0, sizeof(OPENFILENAME) );
@@ -340,14 +340,14 @@ void DialogsProvider::OnOpenFileSimple( int i_arg )
     ofn.lpstrFilter = szFilter;
     ofn.lpstrCustomFilter = NULL;
     ofn.nMaxCustFilter = 0;
-    ofn.nFilterIndex = 1;     
-    ofn.lpstrFile = (LPTSTR)szFile; 
+    ofn.nFilterIndex = 1;
+    ofn.lpstrFile = (LPTSTR)szFile;
     ofn.nMaxFile = MAX_PATH;
-    ofn.lpstrFileTitle = NULL; 
+    ofn.lpstrFileTitle = NULL;
     ofn.nMaxFileTitle = 40;
     ofn.lpstrInitialDir = NULL;
     ofn.lpstrTitle = _T("Quick Open File");
-    ofn.Flags = 0; 
+    ofn.Flags = 0;
     ofn.nFileOffset = 0;
     ofn.nFileExtension = 0;
     ofn.lpstrDefExt = NULL;
@@ -361,10 +361,11 @@ void DialogsProvider::OnOpenFileSimple( int i_arg )
     {
         char *psz_filename = _TOMB(ofn.lpstrFile);
         playlist_Add( p_playlist, psz_filename, psz_filename,
-                      PLAYLIST_APPEND | (i_arg?PLAYLIST_GO:0), PLAYLIST_END );
+                      PLAYLIST_APPEND | (i_arg?PLAYLIST_GO:0), PLAYLIST_END,
+                      TRUE, FALSE );
     }
 
-    vlc_object_release( p_playlist );
+    pl_Release( p_intf );
 }
 
 void DialogsProvider::OnOpenDirectory( int i_arg )
@@ -383,14 +384,14 @@ void DialogsProvider::OnOpenDirectory( int i_arg )
     HMODULE ceshell_dll = LoadLibrary( _T("ceshell") );
     if( !ceshell_dll ) return;
 
-    HRESULT WINAPI (*SHGetMalloc)(LPMALLOC *) =
-        (HRESULT WINAPI (*)(LPMALLOC *))
+    HRESULT (WINAPI *SHGetMalloc)(LPMALLOC *) =
+        (HRESULT (WINAPI *)(LPMALLOC *))
         GetProcAddress( ceshell_dll, _T("SHGetMalloc") );
-    LPITEMIDLIST WINAPI (*SHBrowseForFolder)(LPBROWSEINFO) =
-        (LPITEMIDLIST WINAPI (*)(LPBROWSEINFO))
+    LPITEMIDLIST (WINAPI *SHBrowseForFolder)(LPBROWSEINFO) =
+        (LPITEMIDLIST (WINAPI *)(LPBROWSEINFO))
         GetProcAddress( ceshell_dll, _T("SHBrowseForFolder") );
-    BOOL WINAPI (*SHGetPathFromIDList)(LPCITEMIDLIST, LPTSTR) =
-        (BOOL WINAPI (*)(LPCITEMIDLIST, LPTSTR))
+    BOOL (WINAPI *SHGetPathFromIDList)(LPCITEMIDLIST, LPTSTR) =
+        (BOOL (WINAPI *)(LPCITEMIDLIST, LPTSTR))
         GetProcAddress( ceshell_dll, _T("SHGetPathFromIDList") );
 
     if( !SHGetMalloc || !SHBrowseForFolder || !SHGetPathFromIDList )
@@ -403,8 +404,7 @@ void DialogsProvider::OnOpenDirectory( int i_arg )
 
     if( !SUCCEEDED( SHGetMalloc(&p_malloc) ) ) goto error;
 
-    p_playlist = (playlist_t *)
-        vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+    p_playlist = pl_Hold( p_intf );
     if( !p_playlist ) goto error;
 
     memset( &bi, 0, sizeof(BROWSEINFO) );
@@ -422,7 +422,7 @@ void DialogsProvider::OnOpenDirectory( int i_arg )
             char *psz_filename = _TOMB(psz_result);
             playlist_Add( p_playlist, psz_filename, psz_filename,
                           PLAYLIST_APPEND | (i_arg ? PLAYLIST_GO : 0),
-                          PLAYLIST_END );
+                          PLAYLIST_END, TRUE, FALSE );
         }
         p_malloc->Free( pidl );
     }
@@ -430,7 +430,7 @@ void DialogsProvider::OnOpenDirectory( int i_arg )
  error:
 
     if( p_malloc) p_malloc->Release();
-    if( p_playlist ) vlc_object_release( p_playlist );
+    if( p_playlist ) pl_Release( p_intf );
 
 #ifdef UNDER_CE
     FreeLibrary( ceshell_dll );