Commit e80505af authored by Gildas Bazin's avatar Gildas Bazin

* modules/gui/wince: new open directory menu (win32 only for now)

parent 7b9a0651
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include <windowsx.h> #include <windowsx.h>
#include <commctrl.h> #include <commctrl.h>
#include <commdlg.h> #include <commdlg.h>
#include <shlobj.h>
#define NUMIMAGES 9 // Number of buttons in the toolbar #define NUMIMAGES 9 // Number of buttons in the toolbar
#define IMAGEWIDTH 17 // Width of the buttons in the toolbar #define IMAGEWIDTH 17 // Width of the buttons in the toolbar
...@@ -218,6 +219,8 @@ HWND Interface::CreateMenuBar( HWND hwnd, HINSTANCE hInst ) ...@@ -218,6 +219,8 @@ HWND Interface::CreateMenuBar( HWND hwnd, HINSTANCE hInst )
AppendMenu( menu_file, MF_SEPARATOR, 0, 0 ); AppendMenu( menu_file, MF_SEPARATOR, 0, 0 );
AppendMenu( menu_file, MF_STRING, ID_FILE_OPENFILE, AppendMenu( menu_file, MF_STRING, ID_FILE_OPENFILE,
_T("Open &File...") ); _T("Open &File...") );
AppendMenu( menu_file, MF_STRING, ID_FILE_OPENDIR,
_T("Open &Directory...") );
AppendMenu( menu_file, MF_STRING, ID_FILE_OPENNET, AppendMenu( menu_file, MF_STRING, ID_FILE_OPENNET,
_T("Open &Network Stream...") ); _T("Open &Network Stream...") );
AppendMenu( menu_file, MF_SEPARATOR, 0, 0 ); AppendMenu( menu_file, MF_SEPARATOR, 0, 0 );
...@@ -565,6 +568,10 @@ LRESULT Interface::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) ...@@ -565,6 +568,10 @@ LRESULT Interface::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
delete open; delete open;
break; break;
case ID_FILE_OPENDIR:
OnOpenDirectory();
break;
case ID_FILE_OPENNET: case ID_FILE_OPENNET:
open = new OpenDialog( p_intf, hInst, NET_ACCESS, ID_FILE_OPENNET, open = new OpenDialog( p_intf, hInst, NET_ACCESS, ID_FILE_OPENNET,
OPEN_NORMAL ); OPEN_NORMAL );
...@@ -742,7 +749,7 @@ void Interface::OnOpenFileSimple( void ) ...@@ -742,7 +749,7 @@ void Interface::OnOpenFileSimple( void )
memset( &ofn, 0, sizeof(OPENFILENAME) ); memset( &ofn, 0, sizeof(OPENFILENAME) );
ofn.lStructSize = sizeof(OPENFILENAME); ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = NULL; ofn.hwndOwner = hwndMain;
ofn.hInstance = hInst; ofn.hInstance = hInst;
ofn.lpstrFilter = szFilter; ofn.lpstrFilter = szFilter;
ofn.lpstrCustomFilter = NULL; ofn.lpstrCustomFilter = NULL;
...@@ -774,6 +781,75 @@ void Interface::OnOpenFileSimple( void ) ...@@ -774,6 +781,75 @@ void Interface::OnOpenFileSimple( void )
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
} }
void Interface::OnOpenDirectory( void )
{
TCHAR psz_result[MAX_PATH];
LPMALLOC p_malloc = 0;
LPITEMIDLIST pidl;
BROWSEINFO bi;
playlist_t *p_playlist = 0;
#ifdef UNDER_CE
# define SHGetMalloc MySHGetMalloc
# define SHBrowseForFolder MySHBrowseForFolder
# define SHGetPathFromIDList MySHGetPathFromIDList
HMODULE ceshell_dll = LoadLibrary( _T("ceshell") );
if( !ceshell_dll ) return;
HRESULT WINAPI (*SHGetMalloc)(LPMALLOC *) =
(HRESULT WINAPI (*)(LPMALLOC *))
GetProcAddress( ceshell_dll, _T("SHGetMalloc") );
LPITEMIDLIST WINAPI (*SHBrowseForFolder)(LPBROWSEINFO) =
(LPITEMIDLIST WINAPI (*)(LPBROWSEINFO))
GetProcAddress( ceshell_dll, _T("SHBrowseForFolder") );
BOOL WINAPI (*SHGetPathFromIDList)(LPCITEMIDLIST, LPTSTR) =
(BOOL WINAPI (*)(LPCITEMIDLIST, LPTSTR))
GetProcAddress( ceshell_dll, _T("SHGetPathFromIDList") );
if( !SHGetMalloc || !SHBrowseForFolder || !SHGetPathFromIDList )
{
msg_Err( p_intf, "couldn't load SHBrowseForFolder API" );
FreeLibrary( ceshell_dll );
return;
}
#endif
if( !SUCCEEDED( SHGetMalloc(&p_malloc) ) ) goto error;
p_playlist = (playlist_t *)
vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
if( !p_playlist ) goto error;
memset( &bi, 0, sizeof(BROWSEINFO) );
bi.hwndOwner = hwndMain;
bi.pszDisplayName = psz_result;
bi.ulFlags = BIF_EDITBOX;
#ifndef UNDER_CE
bi.ulFlags |= BIF_USENEWUI;
#endif
if( (pidl = SHBrowseForFolder( &bi ) ) )
{
if( SHGetPathFromIDList( pidl, psz_result ) )
{
char *psz_filename = _TOMB(psz_result);
playlist_Add( p_playlist, psz_filename, psz_filename,
PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
}
p_malloc->Free( pidl );
}
error:
if( p_malloc) p_malloc->Release();
if( p_playlist ) vlc_object_release( p_playlist );
#ifdef UNDER_CE
FreeLibrary( ceshell_dll );
#endif
}
void Interface::OnPlayStream( void ) void Interface::OnPlayStream( void )
{ {
playlist_t *p_playlist = (playlist_t *) playlist_t *p_playlist = (playlist_t *)
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include "wince.h" #include "wince.h"
#include <objbase.h>
#include <commctrl.h> #include <commctrl.h>
#include <commdlg.h> #include <commdlg.h>
...@@ -171,12 +172,17 @@ static void Close( vlc_object_t *p_this ) ...@@ -171,12 +172,17 @@ static void Close( vlc_object_t *p_this )
static void Run( intf_thread_t *p_intf ) static void Run( intf_thread_t *p_intf )
{ {
MSG msg; MSG msg;
Interface interface; Interface intf;
p_intf->p_sys->p_main_window = &interface; p_intf->p_sys->p_main_window = &intf;
if( !hInstance ) hInstance = GetModuleHandle(NULL); if( !hInstance ) hInstance = GetModuleHandle(NULL);
if( !interface.InitInstance( hInstance, p_intf ) ) return; #ifndef UNDER_CE
/* Initialize OLE/COM */
CoInitialize( 0 );
#endif
if( !intf.InitInstance( hInstance, p_intf ) ) return;
// Main message loop // Main message loop
while( GetMessage( &msg, NULL, 0, 0 ) > 0 ) while( GetMessage( &msg, NULL, 0, 0 ) > 0 )
...@@ -184,4 +190,9 @@ static void Run( intf_thread_t *p_intf ) ...@@ -184,4 +190,9 @@ static void Run( intf_thread_t *p_intf )
TranslateMessage( &msg ); TranslateMessage( &msg );
DispatchMessage( &msg ); DispatchMessage( &msg );
} }
#ifndef UNDER_CE
/* Uninitialize OLE/COM */
CoUninitialize();
#endif
} }
...@@ -167,6 +167,7 @@ protected: ...@@ -167,6 +167,7 @@ protected:
virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM ); virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM );
void OnOpenFileSimple( void ); void OnOpenFileSimple( void );
void OnOpenDirectory( void );
void OnPlayStream( void ); void OnPlayStream( void );
void OnVideoOnTop( void ); void OnVideoOnTop( void );
...@@ -653,7 +654,8 @@ extern "C" { ...@@ -653,7 +654,8 @@ extern "C" {
#define IDM_NAVIGATION 40053 #define IDM_NAVIGATION 40053
#define ID_FILE_QUICKOPEN 40057 #define ID_FILE_QUICKOPEN 40057
#define ID_FILE_OPENFILE 40058 #define ID_FILE_OPENFILE 40058
#define ID_FILE_OPENNET 40059 #define ID_FILE_OPENDIR 40059
#define ID_FILE_OPENNET 40060
#define ID_FILE_EXIT 40061 #define ID_FILE_EXIT 40061
#define ID_VIEW_PLAYLIST 40063 #define ID_VIEW_PLAYLIST 40063
#define ID_VIEW_MESSAGES 40064 #define ID_VIEW_MESSAGES 40064
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment