void OnMessages( void );
void OnFileInfo( void );
void OnPreferences( void );
+ void OnPopupMenu( void );
void OnOpen( int, int );
void OnOpenFileSimple( int );
case WM_APP + INTF_DIALOG_MESSAGES: OnMessages(); return TRUE;
case WM_APP + INTF_DIALOG_FILEINFO: OnFileInfo(); return TRUE;
case WM_APP + INTF_DIALOG_PREFS: OnPreferences(); return TRUE;
+ case WM_APP + INTF_DIALOG_POPUPMENU: OnPopupMenu(); return TRUE;
}
return DefWindowProc( hwnd, msg, wp, lp );
if( p_fileinfo_dialog ) p_fileinfo_dialog->UpdateFileInfo();
}
+void DialogsProvider::OnPopupMenu( void )
+{
+ POINT point = {0};
+ PopupMenu( p_intf, hWnd, point );
+}
+
void DialogsProvider::OnPlaylist( void )
{
#if 1
/*****************************************************************************
* Constructor.
*****************************************************************************/
-Interface::Interface()
- : hwndMain(0), hwndCB(0), hwndTB(0), hwndSlider(0), hwndLabel(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)
{
}
if( video ) 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
-
int i_style = WS_VISIBLE;
#ifndef UNDER_CE
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;
MenuItemExt *p_menuitemext = NULL;
vector<MenuItemExt*>::iterator iter;
+ if( p_intf->p_sys->p_settings_menu )
for( iter = p_intf->p_sys->p_settings_menu->begin();
iter != p_intf->p_sys->p_settings_menu->end(); iter++ )
if( (*iter)->id == id )
p_menuitemext = *iter;
break;
}
+
+ if( p_intf->p_sys->p_audio_menu && !p_menuitemext )
for( iter = p_intf->p_sys->p_audio_menu->begin();
iter != p_intf->p_sys->p_audio_menu->end(); iter++ )
if( (*iter)->id == id )
p_menuitemext = *iter;
break;
}
+
+ if( p_intf->p_sys->p_video_menu && !p_menuitemext )
for( iter = p_intf->p_sys->p_video_menu->begin();
iter != p_intf->p_sys->p_video_menu->end(); iter++ )
if( (*iter)->id == id )
p_menuitemext = *iter;
break;
}
+
+ if( p_intf->p_sys->p_navig_menu && !p_menuitemext )
for( iter = p_intf->p_sys->p_navig_menu->begin();
iter != p_intf->p_sys->p_navig_menu->end(); iter++ )
if( (*iter)->id == id )
vlc_value_t old_val, vlc_value_t new_val, void *param )
{
intf_thread_t *p_intf = (intf_thread_t *)param;
- POINT point = {0};
- PopupMenu( p_intf, p_intf->p_sys->p_main_window->hWnd, point );
+ if( p_intf->p_sys->pf_show_dialog )
+ {
+ p_intf->p_sys->pf_show_dialog( p_intf, INTF_DIALOG_POPUPMENU,
+ new_val.b_bool, 0 );
+ }
return VLC_SUCCESS;
}
static void MainLoop( intf_thread_t *p_intf )
{
MSG msg;
- Interface intf;
+ Interface *intf = 0;
- p_intf->p_sys->p_main_window = &intf;
if( !hInstance ) hInstance = GetModuleHandle(NULL);
// Register window class
if( !p_intf->pf_show_dialog )
{
/* The module is used in interface mode */
- p_intf->p_sys->p_window = &intf;
+ p_intf->p_sys->p_window = intf = new Interface( p_intf, 0, hInstance );
/* Create/Show the interface */
- if( !intf.InitInstance( hInstance, p_intf ) )
- {
-#ifndef UNDER_CE
- /* Uninitialize OLE/COM */
- CoUninitialize();
-#endif
- return;
- }
+ if( !intf->InitInstance() ) goto end;
}
/* Creates the dialogs provider */
DispatchMessage( &msg );
}
+ end:
+ if( intf ) delete intf;
+
#ifndef UNDER_CE
/* Uninitialize OLE/COM */
CoUninitialize();
void (*pf_show_dialog) ( intf_thread_t *p_intf, int i_dialog, int i_arg,
intf_dialog_args_t *p_arg );
- CBaseWindow *p_main_window;
-
/* Dynamic Menu management */
vector<MenuItemExt*> *p_audio_menu;
vector<MenuItemExt*> *p_video_menu;
{
public:
/* Constructor */
- Interface();
+ Interface( intf_thread_t *, CBaseWindow *, HINSTANCE );
~Interface();
- BOOL InitInstance( HINSTANCE, intf_thread_t * );
+ BOOL InitInstance();
HWND CreateMenuBar( HWND, HINSTANCE );
void TogglePlayButton( int i_playing_status );