Commit 39c68369 authored by Gildas Bazin's avatar Gildas Bazin

* modules/gui/wince: added dialogs provider + another massive cleanup + updates.

parent 23584f31
......@@ -6,6 +6,7 @@ SOURCES_wince = \
wince.cpp \
wince.h \
interface.cpp \
dialogs.cpp \
menus.cpp \
open.cpp \
playlist.cpp \
......
This diff is collapsed.
......@@ -42,11 +42,11 @@
/*****************************************************************************
* Constructor.
*****************************************************************************/
FileInfo::FileInfo( intf_thread_t *_p_intf, HINSTANCE _hInst )
FileInfo::FileInfo( intf_thread_t *p_intf, CBaseWindow *p_parent,
HINSTANCE h_inst )
: CBaseWindow( p_intf, p_parent, h_inst )
{
/* Initializations */
p_intf = _p_intf;
hInst = _hInst;
hwnd_fileinfo = hwndTV = NULL;
}
......@@ -87,7 +87,7 @@ BOOL FileInfo::CreateTreeView(HWND hwnd)
// Be sure that the tree view actually was created.
if( !hwndTV ) return FALSE;
UpdateFileInfo( hwndTV );
UpdateFileInfo();
return TRUE;
}
......@@ -101,7 +101,7 @@ PURPOSE:
Update the TreeView with file information.
***********************************************************************/
void FileInfo::UpdateFileInfo(HWND hwnd)
void FileInfo::UpdateFileInfo()
{
TVITEM tvi = {0};
TVINSERTSTRUCT tvins = {0};
......@@ -130,7 +130,7 @@ void FileInfo::UpdateFileInfo(HWND hwnd)
tvins.hParent = TVI_ROOT;
// Add the item to the tree-view control.
hPrev = (HTREEITEM)TreeView_InsertItem( hwnd, &tvins );
hPrev = (HTREEITEM)TreeView_InsertItem( hwndTV, &tvins );
hPrevRootItem = hPrev;
......@@ -150,7 +150,7 @@ void FileInfo::UpdateFileInfo(HWND hwnd)
tvins.hParent = hPrevRootItem;
// Add the item to the tree-view control.
hPrev = (HTREEITEM)TreeView_InsertItem( hwnd, &tvins );
hPrev = (HTREEITEM)TreeView_InsertItem( hwndTV, &tvins );
hPrevLev2Item = hPrev;
......@@ -170,14 +170,14 @@ void FileInfo::UpdateFileInfo(HWND hwnd)
tvins.hParent = hPrevLev2Item;
// Add the item to the tree-view control.
hPrev = (HTREEITEM)TreeView_InsertItem( hwnd, &tvins );
hPrev = (HTREEITEM)TreeView_InsertItem( hwndTV, &tvins );
}
TreeView_Expand( hwnd, hPrevLev2Item, TVE_EXPANDPARTIAL |TVE_EXPAND );
TreeView_Expand( hwndTV, hPrevLev2Item, TVE_EXPANDPARTIAL|TVE_EXPAND );
}
vlc_mutex_unlock( &p_input->input.p_item->lock );
TreeView_Expand( hwnd, hPrevRootItem, TVE_EXPANDPARTIAL |TVE_EXPAND );
TreeView_Expand( hwndTV, hPrevRootItem, TVE_EXPANDPARTIAL|TVE_EXPAND );
return;
}
......@@ -212,6 +212,11 @@ LRESULT FileInfo::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
EndDialog( hwnd, LOWORD( wp ) );
break;
case WM_SETFOCUS:
SHSipPreference( hwnd, SIP_DOWN );
SHFullScreen( hwnd, SHFS_HIDESIPBUTTON );
break;
case WM_COMMAND:
if ( LOWORD(wp) == IDOK )
{
......
This diff is collapsed.
......@@ -46,13 +46,12 @@
/*****************************************************************************
* Constructor.
*****************************************************************************/
ItemInfoDialog::ItemInfoDialog( intf_thread_t *_p_intf,
HINSTANCE _hInst,
ItemInfoDialog::ItemInfoDialog( intf_thread_t *p_intf, CBaseWindow *p_parent,
HINSTANCE h_inst,
playlist_item_t *_p_item )
: CBaseWindow( p_intf, p_parent, h_inst )
{
/* Initializations */
p_intf = _p_intf;
hInst = _hInst;
p_item = _p_item;
}
......@@ -154,6 +153,11 @@ LRESULT ItemInfoDialog::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
EndDialog( hwnd, LOWORD( wp ) );
break;
case WM_SETFOCUS:
SHSipPreference( hwnd, SIP_DOWN );
SHFullScreen( hwnd, SHFS_HIDESIPBUTTON );
break;
case WM_COMMAND:
if( LOWORD(wp) == IDOK )
{
......
......@@ -51,23 +51,25 @@
* Constructor.
*****************************************************************************/
Messages::Messages( intf_thread_t *_p_intf, HINSTANCE _hInst )
Messages::Messages( intf_thread_t *p_intf, CBaseWindow *p_parent,
HINSTANCE h_inst )
: CBaseWindow( p_intf, p_parent, h_inst )
{
/* Initializations */
p_intf = _p_intf;
hInst = _hInst;
hListView = NULL;
b_verbose = VLC_FALSE;
hWnd = CreateWindow( _T("VLC WinCE"), _T("Messages"),
WS_POPUP|WS_CAPTION|WS_SYSMENU|WS_SIZEBOX,
0, 0, /*CW_USEDEFAULT*/300, /*CW_USEDEFAULT*/300,
p_parent->GetHandle(), NULL, h_inst, (void *)this );
}
/***********************************************************************
FUNCTION:
WndProc
PURPOSE:
Processes messages sent to the main window.
***********************************************************************/
LRESULT Messages::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
{
......@@ -80,37 +82,45 @@ LRESULT Messages::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
switch( msg )
{
case WM_INITDIALOG:
case WM_CREATE:
shidi.dwMask = SHIDIM_FLAGS;
shidi.dwFlags = SHIDIF_DONEBUTTON | SHIDIF_SIPDOWN |
SHIDIF_FULLSCREENNOMENUBAR;//SHIDIF_SIZEDLGFULLSCREEN;
shidi.hDlg = hwnd;
SHInitDialog( &shidi );
RECT rect;
GetClientRect( hwnd, &rect );
hListView = CreateWindow( WC_LISTVIEW, NULL,
WS_VISIBLE | WS_CHILD | LVS_REPORT |
LVS_SHOWSELALWAYS | WS_VSCROLL | WS_HSCROLL |
WS_BORDER /*| LVS_NOCOLUMNHEADER */,
rect.left + 20, rect.top + 50,
rect.right - rect.left - ( 2 * 20 ),
rect.bottom - rect.top - 50 - 20,
WS_BORDER | LVS_NOCOLUMNHEADER, 0, 0, 0, 0,
hwnd, NULL, hInst, NULL );
ListView_SetExtendedListViewStyle( hListView, LVS_EX_FULLROWSELECT );
LVCOLUMN lv;
lv.mask = LVCF_WIDTH | LVCF_FMT | LVCF_TEXT;
lv.mask = LVCF_FMT;
lv.fmt = LVCFMT_LEFT ;
GetClientRect( hwnd, &rect );
lv.cx = rect.right - rect.left;
lv.pszText = _T("Messages");
lv.cchTextMax = 9;
ListView_InsertColumn( hListView, 0, &lv);
ListView_InsertColumn( hListView, 0, &lv );
SetTimer( hwnd, 1, 500 /*milliseconds*/, NULL );
break;
case WM_WINDOWPOSCHANGED:
{
RECT rect;
if( !GetClientRect( hwnd, &rect ) ) break;
SetWindowPos( hListView, 0, 0, 0,
rect.right - rect.left, rect.bottom - rect.top, 0 );
LVCOLUMN lv;
lv.cx = rect.right - rect.left;
lv.mask = LVCF_WIDTH;
ListView_SetColumn( hListView, 0, &lv );
}
break;
SHFullScreen( GetForegroundWindow(), SHFS_HIDESIPBUTTON );
case WM_SETFOCUS:
SHSipPreference( hwnd, SIP_DOWN );
SHFullScreen( hwnd, SHFS_HIDESIPBUTTON );
break;
case WM_TIMER:
......@@ -118,14 +128,14 @@ LRESULT Messages::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
break;
case WM_CLOSE:
EndDialog( hwnd, LOWORD( wp ) );
break;
Show( FALSE );
return TRUE;
case WM_COMMAND:
switch( LOWORD(wp) )
{
case IDOK:
EndDialog( hwnd, LOWORD( wp ) );
Show( FALSE );
break;
case IDCLEAR:
......@@ -167,8 +177,6 @@ LRESULT Messages::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
CloseHandle(fichier);
}
}
SHFullScreen( GetForegroundWindow(), SHFS_HIDESIPBUTTON );
break;
default:
......@@ -179,7 +187,7 @@ LRESULT Messages::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
break;
}
return FALSE;
return DefWindowProc( hwnd, msg, wp, lp );
}
void Messages::UpdateLog()
......@@ -197,29 +205,31 @@ void Messages::UpdateLog()
for( i_start = p_sub->i_start; i_start != i_stop;
i_start = (i_start+1) % VLC_MSG_QSIZE )
{
if( !b_verbose && VLC_MSG_ERR != p_sub->p_msg[i_start].i_type )
continue;
/* Append all messages to log window */
debug = p_sub->p_msg[i_start].psz_module;
switch( p_sub->p_msg[i_start].i_type )
{
case VLC_MSG_INFO:
debug += ": ";
break;
case VLC_MSG_ERR:
debug += " error: ";
case VLC_MSG_INFO:
if( p_intf->p_libvlc->i_verbose < 0 ) continue;
break;
case VLC_MSG_WARN:
debug += " warning: ";
if( p_intf->p_libvlc->i_verbose < 1 ) continue;
break;
case VLC_MSG_DBG:
default:
debug += " debug: ";
if( p_intf->p_libvlc->i_verbose < 2 ) continue;
break;
}
/* Append all messages to log window */
debug = p_sub->p_msg[i_start].psz_module;
switch( p_sub->p_msg[i_start].i_type )
{
case VLC_MSG_INFO: debug += ": "; break;
case VLC_MSG_ERR: debug += " error: "; break;
case VLC_MSG_WARN: debug += " warning: "; break;
default: debug += " debug: "; break;
}
/* Add message */
debug += p_sub->p_msg[i_start].psz_msg;
......
......@@ -33,11 +33,10 @@
#include "wince.h"
#include <winuser.h>
#include <windows.h>
#include <windowsx.h>
#include <commctrl.h>
#include <commdlg.h>
#include <shlobj.h>
/*****************************************************************************
* Event Table.
......@@ -73,15 +72,13 @@ enum
/*****************************************************************************
* Constructor.
*****************************************************************************/
OpenDialog::OpenDialog( intf_thread_t *_p_intf, HINSTANCE _hInst,
int _i_access_method, int _i_arg, int _i_method )
OpenDialog::OpenDialog( intf_thread_t *p_intf, CBaseWindow *p_parent,
HINSTANCE h_inst, int _i_access, int _i_arg )
: CBaseWindow( p_intf, p_parent, h_inst )
{
/* Initializations */
p_intf = _p_intf;
hInst = _hInst;
i_current_access_method = _i_access_method;
i_access = _i_access;
i_open_arg = _i_arg;
i_method = _i_method;
for( int i = 0; i < 4; i++ )
{
......@@ -94,6 +91,11 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, HINSTANCE _hInst,
net_addrs_label[i] = 0;
net_addrs[i] = 0;
}
CreateWindow( _T("VLC WinCE"), _T("Messages"),
WS_POPUP|WS_CAPTION|WS_SYSMENU|WS_SIZEBOX,
0, 0, /*CW_USEDEFAULT*/300, /*CW_USEDEFAULT*/300,
p_parent->GetHandle(), NULL, h_inst, (void *)this );
}
/***********************************************************************
......@@ -108,36 +110,18 @@ PURPOSE:
LRESULT OpenDialog::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
{
SHINITDLGINFO shidi;
SHMENUBARINFO mbi;
INITCOMMONCONTROLSEX iccex; // INITCOMMONCONTROLSEX structure
RECT rcClient;
TC_ITEM tcItem;
switch( msg )
{
case WM_INITDIALOG:
case WM_CREATE:
shidi.dwMask = SHIDIM_FLAGS;
shidi.dwFlags = SHIDIF_DONEBUTTON | SHIDIF_SIPDOWN |
SHIDIF_FULLSCREENNOMENUBAR;//SHIDIF_SIZEDLGFULLSCREEN;
shidi.dwFlags = SHIDIF_DONEBUTTON | SHIDIF_FULLSCREENNOMENUBAR;
shidi.hDlg = hwnd;
SHInitDialog( &shidi );
//Create the menubar.
memset( &mbi, 0, sizeof(SHMENUBARINFO) );
mbi.cbSize = sizeof(SHMENUBARINFO);
mbi.hwndParent = hwnd;
mbi.dwFlags = SHCMBF_EMPTYBAR;
mbi.hInstRes = hInst;
if( !SHCreateMenuBar( &mbi ) )
{
MessageBox( hwnd, _T("SHCreateMenuBar failed"),
_T("Error"), MB_OK );
//return -1;
}
hwndCB = mbi.hwndMB;
// Get the client area rect to put the panels in
GetClientRect( hwnd, &rcClient );
......@@ -183,7 +167,7 @@ LRESULT OpenDialog::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
tcItem.pszText = _T("Network");
TabCtrl_InsertItem( notebook, 1, &tcItem );
switch( i_current_access_method )
switch( i_access )
{
case FILE_ACCESS:
TabCtrl_SetCurSel( notebook, 0 );
......@@ -200,14 +184,19 @@ LRESULT OpenDialog::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
break;
case WM_CLOSE:
EndDialog( hwnd, LOWORD( wp ) );
Show( FALSE );
return TRUE;
case WM_SETFOCUS:
SHFullScreen( hwnd, SHFS_SHOWSIPBUTTON );
SHSipPreference( hwnd, SIP_DOWN );
break;
case WM_COMMAND:
if( LOWORD(wp) == IDOK )
{
OnOk();
EndDialog( hwnd, LOWORD( wp ) );
Show( FALSE );
break;
}
if( HIWORD(wp) == BN_CLICKED )
......@@ -232,7 +221,6 @@ LRESULT OpenDialog::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
OnSubsFileSettings( hwnd );
} else if( (HWND)lp == browse_button )
{
SHFullScreen( GetForegroundWindow(), SHFS_HIDESIPBUTTON );
OnFileBrowse();
}
break;
......@@ -273,7 +261,7 @@ LRESULT OpenDialog::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
break;
}
return FALSE;
return DefWindowProc( hwnd, msg, wp, lp );
}
/*****************************************************************************
......@@ -282,7 +270,7 @@ LRESULT OpenDialog::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
void OpenDialog::FilePanel( HWND hwnd )
{
RECT rc;
GetWindowRect( notebook, &rc);
GetWindowRect( notebook, &rc );
/* Create browse file line */
file_combo = CreateWindow( _T("COMBOBOX"), _T(""),
......@@ -474,7 +462,7 @@ void OpenDialog::NetPanel( HWND hwnd )
void OpenDialog::UpdateMRL()
{
UpdateMRL( i_current_access_method );
UpdateMRL( i_access );
}
void OpenDialog::UpdateMRL( int i_access_method )
......@@ -483,7 +471,7 @@ void OpenDialog::UpdateMRL( int i_access_method )
TCHAR psz_text[2048];
char psz_tmp[256];
i_current_access_method = i_access_method;
i_access = i_access_method;
switch( i_access_method )
{
......@@ -567,7 +555,7 @@ void OpenDialog::OnPageChange()
SetWindowPos( subsfile_button, HWND_TOP, 0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE );
i_current_access_method = FILE_ACCESS;
i_access = FILE_ACCESS;
}
else if ( TabCtrl_GetCurSel( notebook ) == 1 )
{
......@@ -599,7 +587,7 @@ void OpenDialog::OnPageChange()
SendMessage( net_radios[0], BM_SETCHECK, BST_CHECKED, 0 );
i_current_access_method = NET_ACCESS;
i_access = NET_ACCESS;
}
UpdateMRL();
......@@ -675,51 +663,42 @@ void OpenDialog::OnFilePanelChange()
UpdateMRL( FILE_ACCESS );
}
void OpenDialog::OnFileBrowse()
static void OnOpenCB( intf_dialog_args_t *p_arg )
{
OPENFILENAME ofn;
static TCHAR szFilter[] = _T("All (*.*)\0*.*\0");
TCHAR psz_file[PATH_MAX] = _T("\0");
TCHAR psz_tmp[PATH_MAX+2] = _T("\0");
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 = psz_file;
ofn.nMaxFile = PATH_MAX;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 40;
ofn.lpstrInitialDir = NULL;
ofn.lpstrTitle = _T("Open File");
ofn.Flags = 0;
ofn.nFileOffset = 0;
ofn.nFileExtension = 0;
ofn.lpstrDefExt = NULL;
ofn.lCustData = 0L;
ofn.lpfnHook = NULL;
ofn.lpTemplateName = NULL;
if( GetOpenFile( &ofn ) )
{
if( _tcschr( ofn.lpstrFile, _T(' ') ) )
{
_tcscat( psz_tmp, _T("\"") );
_tcscat( psz_tmp, ofn.lpstrFile );
_tcscat( psz_tmp, _T("\"") );
}
else _tcscat( psz_tmp, ofn.lpstrFile );
SetWindowText( file_combo, psz_tmp );
ComboBox_AddString( file_combo, psz_tmp );
if( ComboBox_GetCount( file_combo ) > 10 )
ComboBox_DeleteString( file_combo, 0 );
OpenDialog *p_this = (OpenDialog *)p_arg->p_arg;
char psz_tmp[PATH_MAX+2] = "\0";
UpdateMRL( FILE_ACCESS );
if( p_arg->i_results && p_arg->psz_results[0] )
{
if( strchr( p_arg->psz_results[0], ' ' ) )
{
strcat( psz_tmp, "\"" );
strcat( psz_tmp, p_arg->psz_results[0] );
strcat( psz_tmp, "\"" );
}
else strcat( psz_tmp, p_arg->psz_results[0] );
SetWindowText( p_this->file_combo, _FROMMB(psz_tmp) );
ComboBox_AddString( p_this->file_combo, _FROMMB(psz_tmp) );
if( ComboBox_GetCount( p_this->file_combo ) > 10 )
ComboBox_DeleteString( p_this->file_combo, 0 );
p_this->UpdateMRL( FILE_ACCESS );
}
}
void OpenDialog::OnFileBrowse()
{
intf_dialog_args_t *p_arg =
(intf_dialog_args_t *)malloc( sizeof(intf_dialog_args_t) );
memset( p_arg, 0, sizeof(intf_dialog_args_t) );
p_arg->psz_title = strdup( "Open file" );
p_arg->psz_extensions = strdup( "All (*.*)|*.*" );
p_arg->p_arg = this;
p_arg->pf_callback = OnOpenCB;
p_intf->p_sys->pf_show_dialog( p_intf, INTF_DIALOG_FILE_GENERIC, 0, p_arg);
}
/*****************************************************************************
......@@ -818,7 +797,7 @@ void OpenDialog::OnSubsFileSettings( HWND hwnd )
{
/* Show/hide the open dialog */
SubsFileDialog *subsfile_dialog = new SubsFileDialog( p_intf, hInst );
SubsFileDialog *subsfile_dialog = new SubsFileDialog( p_intf, this, hInst);
CreateDialogBox( hwnd, subsfile_dialog );
subsfile_mrl.clear();
......
This diff is collapsed.
......@@ -142,11 +142,11 @@ public:
/*****************************************************************************
* Constructor.
*****************************************************************************/
PrefsDialog::PrefsDialog( intf_thread_t *_p_intf, HINSTANCE _hInst )
PrefsDialog::PrefsDialog( intf_thread_t *p_intf, CBaseWindow *p_parent,
HINSTANCE h_inst )
: CBaseWindow( p_intf, p_parent, h_inst )
{
/* Initializations */
p_intf = _p_intf;
hInst = _hInst;
prefs_tree = NULL;
}
......@@ -226,6 +226,10 @@ LRESULT PrefsDialog::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
EndDialog( hwnd, LOWORD( wp ) );
break;
case WM_SETFOCUS:
SHFullScreen( hwnd, SHFS_SHOWSIPBUTTON );
break;
case WM_COMMAND:
if( LOWORD(wp) == IDOK )
{
......
......@@ -46,11 +46,10 @@
/*****************************************************************************
* Constructor.
*****************************************************************************/
SubsFileDialog::SubsFileDialog( intf_thread_t *_p_intf, HINSTANCE _hInst )
SubsFileDialog::SubsFileDialog( intf_thread_t *p_intf, CBaseWindow *p_parent,
HINSTANCE h_inst )
: CBaseWindow( p_intf, p_parent, h_inst )
{
/* Initializations */
p_intf = _p_intf;
hInst = _hInst;
}
/***********************************************************************
......@@ -223,6 +222,10 @@ LRESULT SubsFileDialog::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
EndDialog( hwnd, LOWORD( wp ) );
break;
case WM_SETFOCUS:
SHFullScreen( hwnd, SHFS_SHOWSIPBUTTON );
break;
case WM_COMMAND:
if ( LOWORD(wp) == IDOK )
{
......@@ -278,38 +281,30 @@ LRESULT SubsFileDialog::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
/*****************************************************************************
* Events methods.
*****************************************************************************/
void SubsFileDialog::OnFileBrowse()
static void OnOpenCB( intf_dialog_args_t *p_arg )
{
OPENFILENAME ofn;
TCHAR DateiName[80+1] = _T("\0");
static TCHAR szFilter[] = _T("All (*.*)\0*.*\0");
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("Open File");
ofn.Flags = 0;
ofn.nFileOffset = 0;
ofn.nFileExtension = 0;
ofn.lpstrDefExt = NULL;
ofn.lCustData = 0L;
ofn.lpfnHook = NULL;
ofn.lpTemplateName = NULL;
if( GetOpenFile( &ofn ) )
SubsFileDialog *p_this = (SubsFileDialog *)p_arg->p_arg;
if( p_arg->i_results && p_arg->psz_results[0] )
{
SetWindowText( file_combo, ofn.lpstrFile );
ComboBox_AddString( file_combo, ofn.lpstrFile );
if( ComboBox_GetCount( file_combo ) > 10 )
ComboBox_DeleteString( file_combo, 0 );
SetWindowText( p_this->file_combo, _FROMMB(p_arg->psz_results[0]) );
ComboBox_AddString( p_this->file_combo,
_FROMMB(p_arg->psz_results[0]) );
if( ComboBox_GetCount( p_this->file_combo ) > 10 )
ComboBox_DeleteString( p_this->file_combo, 0 );
}
}
void SubsFileDialog::OnFileBrowse()
{
intf_dialog_args_t *p_arg =
(intf_dialog_args_t *)malloc( sizeof(intf_dialog_args_t) );
memset( p_arg, 0, sizeof(intf_dialog_args_t) );
p_arg->psz_title = strdup( "Open file" );
p_arg->psz_extensions = strdup( "All|*.*" );
p_arg->p_arg = this;
p_arg->pf_callback = OnOpenCB;
p_intf->p_sys->pf_show_dialog( p_intf, INTF_DIALOG_FILE_GENERIC, 0, p_arg);
}
......@@ -197,13 +197,11 @@ LRESULT VideoWindow::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
switch( msg )
{
case WM_KILLFOCUS:
msg_Err( p_intf, "WM_KILLFOCUS1" );
if( p_vout )
vout_Control( p_vout, VOUT_SET_FOCUS, (vlc_bool_t)VLC_FALSE );
return TRUE;
case WM_SETFOCUS:
msg_Err( p_intf, "WM_SETFOCUS1" );
if( p_vout )
vout_Control( p_vout, VOUT_SET_FOCUS, (vlc_bool_t)VLC_TRUE );
return TRUE;
......
......@@ -36,8 +36,6 @@
#include "wince.h"
#include <objbase.h>
#include <commctrl.h>
#include <commdlg.h>
/*****************************************************************************
* Local prototypes.
......@@ -46,6 +44,11 @@ static int Open ( vlc_object_t * );
static void Close ( vlc_object_t * );
static void Run ( intf_thread_t * );
static int OpenDialogs( vlc_object_t * );
static void MainLoop ( intf_thread_t * );
static void ShowDialog( intf_thread_t *, int, int, intf_dialog_args_t * );
/*****************************************************************************
* Module descriptor
*****************************************************************************/
......@@ -62,6 +65,11 @@ vlc_module_begin();
add_bool( "wince-embed", 1, NULL,
EMBED_TEXT, EMBED_LONGTEXT, VLC_FALSE );
add_submodule();
set_description( _("WinCE dialogs provider") );
set_capability( "dialogs provider", 10 );
set_callbacks( OpenDialogs, Close );
vlc_module_end();
HINSTANCE hInstance = 0;
......@@ -113,6 +121,7 @@ static int Open( vlc_object_t *p_this )
p_intf->p_sys->p_settings_menu = NULL;
p_intf->pf_run = Run;
p_intf->pf_show_dialog = NULL;
p_intf->p_sys->p_input = NULL;
p_intf->p_sys->b_playing = 0;
......@@ -120,19 +129,17 @@ 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") );
}
return VLC_SUCCESS;
}
static int OpenDialogs( vlc_object_t *p_this )
{
intf_thread_t *p_intf = (intf_thread_t *)p_this;
int i_ret = Open( p_this );
if( !p_intf->p_sys->GetOpenFile )
p_intf->p_sys->GetOpenFile = (BOOL (WINAPI *)(void *))GetOpenFileName;
p_intf->pf_show_dialog = ShowDialog;
return VLC_SUCCESS;
return i_ret;
}
/*****************************************************************************
......@@ -156,12 +163,19 @@ static void Close( vlc_object_t *p_this )
MenuItemExt::ClearList( p_intf->p_sys->p_navig_menu );
delete p_intf->p_sys->p_navig_menu;
if( p_intf->pf_show_dialog )
{
/* We must destroy the dialogs thread */
#if 0
wxCommandEvent event( wxEVT_DIALOG, INTF_DIALOG_EXIT );
p_intf->p_sys->p_wxwindow->AddPendingEvent( event );
#endif
vlc_thread_join( p_intf );
}
// 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 );
}
......@@ -170,6 +184,27 @@ static void Close( vlc_object_t *p_this )
* Run: main loop
*****************************************************************************/
static void Run( intf_thread_t *p_intf )
{
if( p_intf->pf_show_dialog )
{
/* The module is used in dialog provider mode */
/* Create a new thread for the dialogs provider */
if( vlc_thread_create( p_intf, "Skins Dialogs Thread",
MainLoop, 0, VLC_TRUE ) )
{
msg_Err( p_intf, "cannot create Skins Dialogs Thread" );
p_intf->pf_show_dialog = NULL;
}
}
else
{
/* The module is used in interface mode */
MainLoop( p_intf );
}
}
static void MainLoop( intf_thread_t *p_intf )
{
MSG msg;
Interface intf;
......@@ -177,12 +212,63 @@ static void Run( intf_thread_t *p_intf )
p_intf->p_sys->p_main_window = &intf;
if( !hInstance ) hInstance = GetModuleHandle(NULL);
// Register window class
WNDCLASS wc;
wc.style = CS_HREDRAW | CS_VREDRAW ;
wc.lpfnWndProc = (WNDPROC)CBaseWindow::BaseWndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hIcon = NULL;
wc.hInstance = hInstance;
wc.hCursor = NULL;
wc.hbrBackground = (HBRUSH)(COLOR_MENU+1);
wc.lpszMenuName = NULL;
wc.lpszClassName = _T("VLC WinCE");
RegisterClass( &wc );
#ifndef UNDER_CE
/* Initialize OLE/COM */
CoInitialize( 0 );
#endif
if( !intf.InitInstance( hInstance, p_intf ) ) return;
if( !p_intf->pf_show_dialog )
{
/* The module is used in interface mode */
p_intf->p_sys->p_window = &intf;
/* Create/Show the interface */
if( !intf.InitInstance( hInstance, p_intf ) )
{
#ifndef UNDER_CE
/* Uninitialize OLE/COM */
CoUninitialize();
#endif
return;
}
}
/* Creates the dialogs provider */
p_intf->p_sys->p_window =
CreateDialogsProvider( p_intf, p_intf->pf_show_dialog ?
NULL : p_intf->p_sys->p_window, hInstance );
p_intf->p_sys->pf_show_dialog = ShowDialog;
/* OK, initialization is over */
vlc_thread_ready( p_intf );
/* Check if we need to start playing */
if( !p_intf->pf_show_dialog && p_intf->b_play )
{
playlist_t *p_playlist =
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist )
{
playlist_Play( p_playlist );
vlc_object_release( p_playlist );
}
}
// Main message loop
while( GetMessage( &msg, NULL, 0, 0 ) > 0 )
......@@ -196,3 +282,74 @@ static void Run( intf_thread_t *p_intf )
CoUninitialize();
#endif
}
/*****************************************************************************
* CBaseWindow Implementation
*****************************************************************************/
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 );
}
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);
}
/*****************************************************************************
* ShowDialog
*****************************************************************************/
static void ShowDialog( intf_thread_t *p_intf, int i_dialog_event, int i_arg,
intf_dialog_args_t *p_arg )
{
SendMessage( p_intf->p_sys->p_window->GetHandle(), WM_CANCELMODE, 0, 0 );
if( i_dialog_event == INTF_DIALOG_POPUPMENU && i_arg == 0 ) return;
/* Hack to prevent popup events to be enqueued when
* one is already active */
#if 0
if( i_dialog_event != INTF_DIALOG_POPUPMENU ||
!p_intf->p_sys->p_popup_menu )
#endif
{
SendMessage( p_intf->p_sys->p_window->GetHandle(),
WM_APP + i_dialog_event, (WPARAM)i_arg, (LPARAM)p_arg );
}
}
......@@ -55,6 +55,9 @@ class VideoWindow;
*****************************************************************************/
struct intf_sys_t
{
/* the parent window */
CBaseWindow *p_window;
/* special actions */
vlc_bool_t b_playing;
......@@ -85,14 +88,8 @@ 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
*****************************************************************************/
......@@ -100,7 +97,9 @@ struct intf_sys_t
class CBaseWindow
{
public:
CBaseWindow() : hWnd(0), hInst(0) {};
CBaseWindow( intf_thread_t *_p_intf = 0, CBaseWindow *_p_parent = 0,
HINSTANCE _hInst = 0 )
: hWnd(0), hInst(_hInst), p_parent(_p_parent), p_intf(_p_intf) {};
virtual ~CBaseWindow() {};
HWND hWnd; // The main window handle
......@@ -108,6 +107,10 @@ public:
static LRESULT CALLBACK BaseWndProc( HWND, UINT, WPARAM, LPARAM );
static int CreateDialogBox( HWND, CBaseWindow * );
HWND GetHandle() { return hWnd; }
BOOL Show( BOOL b_show ) { return (hWnd && ShowWindow(hWnd, b_show)); }
BOOL IsShown( void ) { return (hWnd && IsWindowVisible(hWnd)); }
protected:
HINSTANCE hInst; // The current instance
......@@ -116,6 +119,7 @@ protected:
HINSTANCE GetInstance () const { return hInst; }
virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM ) { return 0; };
CBaseWindow *p_parent;
intf_thread_t *p_intf;
};
......@@ -126,6 +130,7 @@ class Timer;
class OpenDialog;
class PrefsDialog;
CBaseWindow *CreateDialogsProvider( intf_thread_t *, CBaseWindow *, HINSTANCE);
CBaseWindow *CreateVideoWindow( intf_thread_t *, HWND );
void PopupMenu( intf_thread_t *, HWND, POINT );
......@@ -154,33 +159,28 @@ public:
HMENU hPopUpMenu;
HMENU hMenu;
FileInfo *fileinfo;
Messages *messages;
PrefsDialog *preferences;
Playlist *playlist;
Timer *timer;
OpenDialog *open;
CBaseWindow *video;
protected:
virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM );
void OnOpenFileSimple( void );
void OnOpenDirectory( void );
void OnPlayStream( void );
void OnVideoOnTop( void );
void OnShowDialog( int );
void OnSliderUpdate( int wp );
void OnChange( int wp );
void VolumeChange( int i_volume );
void VolumeUpdate( void );
void OnPlayStream( void );
void OnStopStream( void );
void OnPrevStream( void );
void OnNextStream( void );
void OnSlowStream( void );
void OnFastStream( void );
void OnVideoOnTop( void );
void OnSliderUpdate( int wp );
void OnChange( int wp );
void VolumeChange( int i_volume );
void VolumeUpdate( void );
int i_old_playing_status;
private:
......@@ -197,9 +197,11 @@ class FileInfo : public CBaseWindow
{
public:
/* Constructor */
FileInfo( intf_thread_t *_p_intf, HINSTANCE _hInst );
FileInfo( intf_thread_t *, CBaseWindow *, HINSTANCE );
virtual ~FileInfo(){};
void UpdateFileInfo(void);
protected:
HWND hwnd_fileinfo; // handle to fileinfo window
......@@ -209,7 +211,6 @@ protected:
TCHAR szFileInfoTitle[100]; // Main window name
virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM );
void UpdateFileInfo( HWND );
BOOL CreateTreeView( HWND );
};
......@@ -218,16 +219,16 @@ class Messages : public CBaseWindow
{
public:
/* Constructor */
Messages( intf_thread_t *_p_intf, HINSTANCE _hInst );
Messages( intf_thread_t *, CBaseWindow *, HINSTANCE );
virtual ~Messages(){};
void UpdateLog(void);
protected:
virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM );
HWND hListView;
void UpdateLog(void);
vlc_bool_t b_verbose;
};
......@@ -236,7 +237,8 @@ class ItemInfoDialog : public CBaseWindow
{
public:
/* Constructor */
ItemInfoDialog( intf_thread_t *, HINSTANCE, playlist_item_t * );
ItemInfoDialog( intf_thread_t *, CBaseWindow *,
HINSTANCE, playlist_item_t * );
virtual ~ItemInfoDialog(){};
protected:
......@@ -271,13 +273,14 @@ class OpenDialog : public CBaseWindow
{
public:
/* Constructor */
OpenDialog( intf_thread_t *_p_intf, HINSTANCE _hInst,
int _i_access_method, int _i_arg, int _i_method );
OpenDialog( intf_thread_t *, CBaseWindow *, HINSTANCE, int, int );
virtual ~OpenDialog(){};
void UpdateMRL();
void UpdateMRL( int i_access_method );
HWND file_combo;
protected:
virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM );
......@@ -289,7 +292,6 @@ protected:
HWND notebook;
HWND file_combo;
HWND browse_button;
HWND subsfile_checkbox;
HWND subsfile_label;
......@@ -307,9 +309,8 @@ protected:
HWND net_addrs_label[4];
HWND net_addrs[4];
int i_current_access_method;
int i_method; /* Normal or for the stream dialog ? */
int i_open_arg;
int i_access;
int i_net_type;
void FilePanel( HWND hwnd );
......@@ -337,16 +338,16 @@ class SubsFileDialog: public CBaseWindow
{
public:
/* Constructor */
SubsFileDialog( intf_thread_t *_p_intf, HINSTANCE _hInst );
SubsFileDialog( intf_thread_t *, CBaseWindow *, HINSTANCE );
virtual ~SubsFileDialog(){};
vector<string> subsfile_mrl;
HWND file_combo;
protected:
friend class OpenDialog;
HWND file_box;
HWND file_combo;
HWND browse_button;
HWND enc_box;
......@@ -372,9 +373,12 @@ class Playlist : public CBaseWindow
{
public:
/* Constructor */
Playlist( intf_thread_t *_p_intf, HINSTANCE _hInst );
Playlist( intf_thread_t *, CBaseWindow *, HINSTANCE );
virtual ~Playlist(){};
void UpdatePlaylist();
void ShowPlaylist( bool );
protected:
bool b_need_update;
......@@ -387,7 +391,6 @@ protected:
HWND hwndTB; // Handle to the toolbar.
HWND hListView;
void UpdatePlaylist();
void Rebuild();
void UpdateItem( int );
LRESULT ProcessCustomDraw( LPARAM lParam );
......@@ -397,8 +400,6 @@ protected:
void OnOpen();
void OnSave();
void OnAddFile();
void OnAddMRL();
void OnDeleteSelection();
void OnInvertSelection();
......@@ -431,7 +432,7 @@ class Timer
{
public:
/* Constructor */
Timer( intf_thread_t *p_intf, HWND hwnd, Interface *_p_main_interface);
Timer( intf_thread_t *p_intf, HWND hwnd, Interface *_p_main_interface );
virtual ~Timer();
void Notify( void );
......@@ -491,7 +492,7 @@ class PrefsDialog: public CBaseWindow
{
public:
/* Constructor */
PrefsDialog( intf_thread_t *_p_intf, HINSTANCE _hInst );
PrefsDialog( intf_thread_t *, CBaseWindow *, HINSTANCE );
virtual ~PrefsDialog(){};
protected:
......@@ -547,6 +548,7 @@ protected:
*****************************************************************************/
#define _WIN32_IE 0x0500
#define SHFS_SHOWSIPBUTTON 0x0004
#define SHFS_HIDESIPBUTTON 0x0008
#define SHIDIM_FLAGS 0x0001
#define SHIDIF_DONEBUTTON 0x0001
......@@ -554,7 +556,6 @@ protected:
#define SHIDIF_FULLSCREENNOMENUBAR 0x0010
#define SHCMBF_HMENU 0x0010
#define SHCMBF_EMPTYBAR 0x0001
#define SHFS_SHOWSIPBUTTON 0x0004
#define GN_CONTEXTMENU 1000
#define SHRG_RETURNCMD 0x0001
#define SHRG_NOTIFYPARENT 0x0002
......@@ -613,6 +614,29 @@ extern "C" {
} SHRGINFO, *PSHRGINFO;
DWORD SHRecognizeGesture(SHRGINFO *shrg);
typedef enum tagSIPSTATE
{
SIP_UP = 0,
SIP_DOWN,
SIP_FORCEDOWN,
SIP_UNCHANGED,
SIP_INPUTDIALOG,
} SIPSTATE;
BOOL SHSipPreference(HWND, SIPSTATE);
BOOL SHSipInfo(UINT, UINT, PVOID, UINT);
typedef struct
{
DWORD cbSize;
DWORD fdwFlags;
RECT rcVisibleDesktop;
RECT rcSipRect;
DWORD dwImDataSize;
VOID *pvImData;
} SIPINFO;
}
#if defined( WIN32 ) && !defined( UNDER_CE )
......@@ -620,6 +644,9 @@ extern "C" {
# define SHInitDialog(a)
# define SHCreateMenuBar(a) 1
# define SHRecognizeGesture(a) 0
# define SHSipPreference(a,b)
# define SHSipInfo(a,b,c,d) 0
#endif
#endif //WINCE_RESOURCE
......
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