Commit 5eb9bd3a authored by Gildas Bazin's avatar Gildas Bazin

* modules/gui/wxwindows/open.cpp: New "open dialog" that mimics the one from the gtk interface.
* modules/gui/wxwindows/popup.cpp: Started implementing the popup menu.
* modules/gui/wxwindows/interface.cpp: Got rid of the pause button. The play button now acts as a
play/pause button depending on the context.
* modules/gui/wxwindows/*: A few hacks needed to make the win32 version useable.
parent 8f10d4fe
...@@ -2,6 +2,7 @@ SOURCES_wxwindows = \ ...@@ -2,6 +2,7 @@ SOURCES_wxwindows = \
modules/gui/wxwindows/wxwindows.cpp \ modules/gui/wxwindows/wxwindows.cpp \
modules/gui/wxwindows/wxwindows.h \ modules/gui/wxwindows/wxwindows.h \
modules/gui/wxwindows/interface.cpp \ modules/gui/wxwindows/interface.cpp \
modules/gui/wxwindows/open.cpp \
modules/gui/wxwindows/messages.cpp \ modules/gui/wxwindows/messages.cpp \
modules/gui/wxwindows/playlist.cpp \ modules/gui/wxwindows/playlist.cpp \
modules/gui/wxwindows/popup.cpp \ modules/gui/wxwindows/popup.cpp \
......
This diff is collapsed.
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* popup.cpp : wxWindows plugin for vlc * popup.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: popup.cpp,v 1.1 2002/12/13 01:50:32 gbazin Exp $ * $Id: popup.cpp,v 1.2 2003/01/23 23:57:50 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -55,38 +55,85 @@ ...@@ -55,38 +55,85 @@
enum enum
{ {
/* menu items */ /* menu items */
Close_Event = 1, Close_Event = wxID_HIGHEST,
MenuEntry_Event, MenuDummy_Event,
MenuDummy_Event
}; };
BEGIN_EVENT_TABLE(PopupMenu, wxMenu) BEGIN_EVENT_TABLE(PopupMenu, wxMenu)
/* Menu events */ /* Menu events */
EVT_MENU(Close_Event, PopupMenu::OnClose) EVT_MENU(Close_Event, PopupMenu::OnClose)
EVT_MENU(MenuEntry_Event, PopupMenu::OnEntrySelected) EVT_MENU(MenuDummy_Event, PopupMenu::OnEntrySelected)
END_EVENT_TABLE() END_EVENT_TABLE()
BEGIN_EVENT_TABLE(PopupEvtHandler, wxEvtHandler)
EVT_MENU(-1, PopupEvtHandler::OnMenuEvent)
END_EVENT_TABLE()
/***************************************************************************** /*****************************************************************************
* Constructor. * Constructor.
*****************************************************************************/ *****************************************************************************/
PopupMenu::PopupMenu( intf_thread_t *_p_intf, Interface *_p_main_interface ): PopupMenu::PopupMenu( intf_thread_t *_p_intf, Interface *_p_main_interface ):
wxMenu( "VideoLan" ) wxMenu( )
{ {
vlc_object_t *p_object;
/* Initializations */ /* Initializations */
p_intf = _p_intf; p_intf = _p_intf;
p_main_interface = _p_main_interface; p_main_interface = _p_main_interface;
i_item_id = 0;
/* Audio menu */
Append( MenuDummy_Event, _("Audio menu") );
AppendSeparator();
p_object = (vlc_object_t *)vlc_object_find( p_intf, VLC_OBJECT_AOUT,
FIND_ANYWHERE );
if( p_object == NULL ) return;
CreateMenuEntry( "audio-device", p_object );
CreateMenuEntry( "audio-channels", p_object );
vlc_object_release( p_object );
/* Video menu */
AppendSeparator();
Append( MenuDummy_Event, _("Video menu") );
AppendSeparator();
p_object = (vlc_object_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT,
FIND_ANYWHERE );
if( p_object == NULL ) return;
CreateMenuEntry( "fullscreen", p_object );
vlc_object_release( p_object );
Append(MenuEntry_Event, "Dummy1"); /* Input menu */
Append(MenuEntry_Event, "Dummy2"); AppendSeparator();
Append(MenuDummy_Event, "&Dummy sub menu", Append( MenuDummy_Event, _("Input menu") );
CreateDummyMenu(), "Dummy sub menu help"); AppendSeparator();
Append(MenuEntry_Event, "Dummy3", "", TRUE); p_object = (vlc_object_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT,
FIND_ANYWHERE );
if( p_object == NULL ) return;
CreateMenuEntry( "title", p_object );
CreateMenuEntry( "chapter", p_object );
vlc_object_release( p_object );
/* Misc stuff */
AppendSeparator(); AppendSeparator();
Append( Close_Event, _("&Close") ); Append( Close_Event, _("&Close") );
/* Intercept all menu events in our custom event handler */
p_main_interface->p_popup_menu = this;
p_main_interface->PushEventHandler(
new PopupEvtHandler( p_intf, p_main_interface ) );
wxPoint mousepos = wxGetMousePosition(); wxPoint mousepos = wxGetMousePosition();
p_main_interface->PopupMenu( this, mousepos.x, mousepos.y ); p_main_interface->PopupMenu( this,
p_main_interface->ScreenToClient(mousepos).x,
p_main_interface->ScreenToClient(mousepos).y
);
} }
PopupMenu::~PopupMenu() PopupMenu::~PopupMenu()
...@@ -105,12 +152,163 @@ void PopupMenu::OnEntrySelected( wxCommandEvent& WXUNUSED(event) ) ...@@ -105,12 +152,163 @@ void PopupMenu::OnEntrySelected( wxCommandEvent& WXUNUSED(event) )
{ {
} }
wxMenu *PopupMenu::CreateDummyMenu() void PopupMenu::CreateMenuEntry( char *psz_var, vlc_object_t *p_object )
{
vlc_value_t val, val1;
int i_type;
/* Check the type of the object variable */
i_type = var_Type( p_object, psz_var );
if( i_type & VLC_VAR_HASCHOICE )
{
Append( MenuDummy_Event, psz_var,
CreateSubMenu( psz_var, p_object ),
"YEAAAARRRGGGHHH HEEELLPPPPPP" );
return;
}
if( var_Get( p_object, psz_var, &val ) < 0 )
{
return;
}
wxMenuItemExt *menuitem;
switch( i_type )
{
case VLC_VAR_VOID:
menuitem = new wxMenuItemExt( this, i_item_id++, psz_var,
"", wxITEM_NORMAL, strdup(psz_var),
p_object->i_object_id, val );
Append( menuitem );
break;
case VLC_VAR_BOOL:
val1.b_bool = !val.b_bool;
menuitem = new wxMenuItemExt( this, i_item_id++, psz_var,
"", wxITEM_CHECK, strdup(psz_var),
p_object->i_object_id, val1 );
Append( menuitem );
Check( i_item_id - 1, val.b_bool ? TRUE : FALSE );
break;
case VLC_VAR_STRING:
break;
default:
break;
}
}
wxMenu *PopupMenu::CreateSubMenu( char *psz_var, vlc_object_t *p_object )
{ {
wxMenu *menu = new wxMenu; wxMenu *menu = new wxMenu;
menu->Append(MenuEntry_Event, "Sub Dummy1"); vlc_value_t val;
menu->AppendSeparator(); char *psz_value;
menu->Append(MenuEntry_Event, "Sub Dummy2", "", TRUE); int i_type, i;
/* Check the type of the object variable */
i_type = var_Type( p_object, psz_var );
switch( i_type )
{
case VLC_VAR_VOID:
case VLC_VAR_STRING:
break;
default:
break;
}
if( var_Get( p_object, psz_var, &val ) < 0 )
{
return NULL;
}
psz_value = val.psz_string;
if( var_Change( p_object, psz_var, VLC_VAR_GETLIST, &val ) < 0 )
{
return NULL;
}
for( i = 0; i < val.p_list->i_count; i++ )
{
vlc_value_t another_val;
wxMenuItemExt *menuitem;
switch( i_type & VLC_VAR_TYPE )
{
case VLC_VAR_STRING:
another_val.psz_string =
strdup(val.p_list->p_values[i].psz_string);
menuitem =
new wxMenuItemExt( this, i_item_id++, another_val.psz_string,
"", wxITEM_RADIO, strdup(psz_var),
p_object->i_object_id,
another_val );
menu->Append( menuitem );
if( !strcmp( psz_value, val.p_list->p_values[i].psz_string ) )
menu->Check( i_item_id - 1, TRUE );
break;
case VLC_VAR_INTEGER:
menuitem =
new wxMenuItemExt( this, i_item_id++,
wxString::Format(_("%d"),
val.p_list->p_values[i].i_int),
"", wxITEM_RADIO, strdup(psz_var),
p_object->i_object_id,
val.p_list->p_values[i] );
menu->Append( menuitem );
break;
default:
break;
}
}
var_Change( p_object, psz_var, VLC_VAR_FREELIST, &val );
return menu; return menu;
} }
/*****************************************************************************
* A small helper class which intercepts all popup menu events
*****************************************************************************/
PopupEvtHandler::PopupEvtHandler( intf_thread_t *_p_intf,
Interface *_p_main_interface )
{
/* Initializations */
p_intf = _p_intf;
p_main_interface = _p_main_interface;
}
PopupEvtHandler::~PopupEvtHandler()
{
}
void PopupEvtHandler::OnMenuEvent( wxCommandEvent& event )
{
wxMenuItemExt *p_menuitem = (wxMenuItemExt *)
p_main_interface->p_popup_menu->FindItem( event.GetId() );
if( p_menuitem )
{
vlc_object_t *p_object;
p_object = (vlc_object_t *)vlc_object_get( p_intf,
p_menuitem->i_object_id );
if( p_object == NULL ) return;
var_Set( p_object, p_menuitem->psz_var, p_menuitem->val );
vlc_object_release( p_object );
}
else
event.Skip();
}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* timer.cpp : wxWindows plugin for vlc * timer.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: timer.cpp,v 1.7 2002/12/15 18:37:39 ipkiss Exp $ * $Id: timer.cpp,v 1.8 2003/01/23 23:57:50 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -104,7 +104,8 @@ void Timer::Notify() ...@@ -104,7 +104,8 @@ void Timer::Notify()
/* If the "display popup" flag has changed */ /* If the "display popup" flag has changed */
if( p_intf->b_menu_change ) if( p_intf->b_menu_change )
{ {
new PopupMenu( p_intf, p_main_interface ); p_main_interface->p_popup_menu =
new PopupMenu( p_intf, p_main_interface );
p_intf->b_menu_change = 0; p_intf->b_menu_change = 0;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* wxwindows.cpp : wxWindows plugin for vlc * wxwindows.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: wxwindows.cpp,v 1.9 2002/12/15 18:37:39 ipkiss Exp $ * $Id: wxwindows.cpp,v 1.10 2003/01/23 23:57:50 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -144,6 +144,16 @@ static void Close( vlc_object_t *p_this ) ...@@ -144,6 +144,16 @@ static void Close( vlc_object_t *p_this )
/***************************************************************************** /*****************************************************************************
* Run: wxWindows thread * Run: wxWindows thread
*****************************************************************************/ *****************************************************************************/
#if defined( WIN32 )
HINSTANCE hInstance = 0;
extern "C" BOOL WINAPI
DllMain (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved)
{
hInstance = (HINSTANCE)hModule;
return TRUE;
}
#endif
static void Run( intf_thread_t *p_intf ) static void Run( intf_thread_t *p_intf )
{ {
#if !defined( WIN32 ) #if !defined( WIN32 )
...@@ -154,7 +164,7 @@ static void Run( intf_thread_t *p_intf ) ...@@ -154,7 +164,7 @@ static void Run( intf_thread_t *p_intf )
wxTheApp = new Instance( p_intf ); wxTheApp = new Instance( p_intf );
#if defined( WIN32 ) #if defined( WIN32 )
wxEntry( GetModuleHandle(NULL), NULL, NULL, SW_SHOW, TRUE ); wxEntry( hInstance/*GetModuleHandle(NULL)*/, NULL, NULL, SW_SHOW, TRUE );
#else #else
wxEntry( 1, p_args ); wxEntry( 1, p_args );
#endif #endif
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* wxwindows.h: private wxWindows interface description * wxwindows.h: private wxWindows interface description
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: wxwindows.h,v 1.7 2002/12/21 11:20:30 sigmunau Exp $ * $Id: wxwindows.h,v 1.8 2003/01/23 23:57:50 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
#include <wx/listctrl.h> #include <wx/listctrl.h>
#include <wx/textctrl.h> #include <wx/textctrl.h>
#include <wx/notebook.h>
#include <wx/spinctrl.h>
#include <wx/dnd.h> #include <wx/dnd.h>
class Playlist; class Playlist;
...@@ -116,10 +118,15 @@ public: ...@@ -116,10 +118,15 @@ public:
wxWindow *slider_frame; wxWindow *slider_frame;
wxStaticBox *slider_box; wxStaticBox *slider_box;
wxMenu *p_popup_menu;
wxArrayString mrl_history;
private: private:
void CreateOurMenuBar(); void CreateOurMenuBar();
void CreateOurToolBar(); void CreateOurToolBar();
void CreateOurSlider(); void CreateOurSlider();
void Open( int i_access_method );
/* Event handlers (these functions should _not_ be virtual) */ /* Event handlers (these functions should _not_ be virtual) */
void OnExit( wxCommandEvent& event ); void OnExit( wxCommandEvent& event );
...@@ -128,18 +135,98 @@ private: ...@@ -128,18 +135,98 @@ private:
void OnPlaylist( wxCommandEvent& event ); void OnPlaylist( wxCommandEvent& event );
void OnLogs( wxCommandEvent& event ); void OnLogs( wxCommandEvent& event );
void OnFileInfo( wxCommandEvent& event ); void OnFileInfo( wxCommandEvent& event );
void OnOpenFile( wxCommandEvent& event ); void OnOpenFile( wxCommandEvent& event );
void OnOpenDisc( wxCommandEvent& event );
void OnOpenNet( wxCommandEvent& event );
void OnOpenSat( wxCommandEvent& event );
void OnPlayStream( wxCommandEvent& event ); void OnPlayStream( wxCommandEvent& event );
void OnStopStream( wxCommandEvent& event ); void OnStopStream( wxCommandEvent& event );
void OnPauseStream( wxCommandEvent& event );
void OnSliderUpdate( wxScrollEvent& event ); void OnSliderUpdate( wxScrollEvent& event );
void OnPrevStream( wxCommandEvent& event ); void OnPrevStream( wxCommandEvent& event );
void OnNextStream( wxCommandEvent& event ); void OnNextStream( wxCommandEvent& event );
void TogglePlayButton();
DECLARE_EVENT_TABLE(); DECLARE_EVENT_TABLE();
Timer *timer; Timer *timer;
intf_thread_t *p_intf; intf_thread_t *p_intf;
int i_playing_status;
};
/* Open Dialog */
class OpenDialog: public wxDialog
{
public:
/* Constructor */
OpenDialog( intf_thread_t *p_intf, Interface *p_main_interface,
int i_access_method );
virtual ~OpenDialog();
void Rebuild();
void Manage();
wxString mrl;
private:
wxPanel *FilePanel( wxWindow* parent );
wxPanel *DiscPanel( wxWindow* parent );
wxPanel *NetPanel( wxWindow* parent );
wxPanel *SatPanel( wxWindow* parent );
void OpenDialog::UpdateMRL( int i_access_method );
/* Event handlers (these functions should _not_ be virtual) */
void OnOk( wxCommandEvent& event );
void OnCancel( wxCommandEvent& event );
void OnPageChange( wxNotebookEvent& event );
void OnMRLChange( wxCommandEvent& event );
/* Event handlers for the disc page */
void OnFilePanelChange( wxCommandEvent& event );
void OnFileBrowse( wxCommandEvent& event );
/* Event handlers for the disc page */
void OnDiscPanelChange( wxCommandEvent& event );
void OnDiscTypeChange( wxCommandEvent& event );
/* Event handlers for the net page */
void OnNetPanelChange( wxCommandEvent& event );
void OnNetTypeChange( wxCommandEvent& event );
DECLARE_EVENT_TABLE();
intf_thread_t *p_intf;
Interface *p_main_interface;
wxComboBox *mrl_combo;
/* Controls for the file panel */
wxComboBox *file_combo;
/* Controls for the disc panel */
wxRadioBox *disc_type;
wxTextCtrl *disc_device;
wxSpinCtrl *disc_title;
wxSpinCtrl *disc_chapter;
/* Controls for the net panel */
wxRadioBox *net_type;
int i_net_type;
wxPanel *net_subpanels[4];
wxRadioButton *net_radios[4];
wxSpinCtrl *net_ports[4];
wxTextCtrl *net_addrs[4];
};
enum
{
FILE_ACCESS = 0,
DISC_ACCESS,
NET_ACCESS,
SAT_ACCESS
}; };
/* Messages */ /* Messages */
...@@ -241,9 +328,56 @@ private: ...@@ -241,9 +328,56 @@ private:
void OnEntrySelected( wxCommandEvent& event ); void OnEntrySelected( wxCommandEvent& event );
wxMenu *PopupMenu::CreateDummyMenu(); wxMenu *PopupMenu::CreateDummyMenu();
void PopupMenu::CreateMenuEntry( char *, vlc_object_t * );
wxMenu *PopupMenu::CreateSubMenu( char *, vlc_object_t * );
DECLARE_EVENT_TABLE(); DECLARE_EVENT_TABLE();
intf_thread_t *p_intf; intf_thread_t *p_intf;
Interface *p_main_interface; Interface *p_main_interface;
int i_item_id;
};
class PopupEvtHandler : public wxEvtHandler
{
public:
PopupEvtHandler( intf_thread_t *p_intf, Interface *p_main_interface );
virtual ~PopupEvtHandler();
void PopupEvtHandler::OnMenuEvent( wxCommandEvent& event );
private:
DECLARE_EVENT_TABLE()
intf_thread_t *p_intf;
Interface *p_main_interface;
};
class wxMenuItemExt: public wxMenuItem
{
public:
/* Constructor */
wxMenuItemExt( wxMenu* parentMenu, int id,
const wxString& text,
const wxString& helpString,
wxItemKind kind,
char *_psz_var, int _i_object_id, vlc_value_t _val ):
wxMenuItem( parentMenu, id, text, helpString, kind )
{
/* Initializations */
psz_var = _psz_var;
i_object_id = _i_object_id;
val = _val;
};
virtual ~wxMenuItemExt() { if( psz_var ) free( psz_var ); };
char *psz_var;
int i_object_id;
vlc_value_t val;
private:
}; };
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