Commit dace3170 authored by Anil Daoud's avatar Anil Daoud

* activex: updated svn:ignore property

* wxwindows: systray integration, with a basic popup menu, tested under
  WinXP and Gnome (introduces two new options, wxwin-taskbar and
  wxwin-systray).

  The icon looks ok under windows but not so good with some gnome-panel
  sizes.
parent bb3190bc
...@@ -49,6 +49,8 @@ ...@@ -49,6 +49,8 @@
/* include the icon graphic */ /* include the icon graphic */
#include "../../../share/vlc32x32.xpm" #include "../../../share/vlc32x32.xpm"
/* include a small icon graphic for the systray icon */
#include "../../../share/vlc16x16.xpm"
/***************************************************************************** /*****************************************************************************
* Local class declarations. * Local class declarations.
...@@ -97,6 +99,26 @@ BEGIN_EVENT_TABLE(wxVolCtrl, wxWindow) ...@@ -97,6 +99,26 @@ BEGIN_EVENT_TABLE(wxVolCtrl, wxWindow)
EVT_MOTION(wxVolCtrl::OnChange) EVT_MOTION(wxVolCtrl::OnChange)
END_EVENT_TABLE() END_EVENT_TABLE()
/* Systray integration */
class Systray: public wxTaskBarIcon
{
public:
Systray( Interface* p_main_interface );
virtual ~Systray() {};
wxMenu* CreatePopupMenu();
private:
void OnLeftClick( wxTaskBarIconEvent& event );
void OnPlayStream ( wxCommandEvent& event );
void OnStopStream ( wxCommandEvent& event );
void OnPrevStream ( wxCommandEvent& event );
void OnNextStream ( wxCommandEvent& event );
void OnExit( wxCommandEvent& event );
Interface* p_main_interface;
DECLARE_EVENT_TABLE()
};
/***************************************************************************** /*****************************************************************************
* Event Table. * Event Table.
*****************************************************************************/ *****************************************************************************/
...@@ -146,7 +168,9 @@ enum ...@@ -146,7 +168,9 @@ enum
/* it is important for the id corresponding to the "About" command to have /* it is important for the id corresponding to the "About" command to have
* this standard value as otherwise it won't be handled properly under Mac * this standard value as otherwise it won't be handled properly under Mac
* (where it is special and put into the "Apple" menu) */ * (where it is special and put into the "Apple" menu) */
About_Event = wxID_ABOUT About_Event = wxID_ABOUT,
Iconize_Event
}; };
BEGIN_EVENT_TABLE(Interface, wxFrame) BEGIN_EVENT_TABLE(Interface, wxFrame)
...@@ -201,12 +225,24 @@ BEGIN_EVENT_TABLE(Interface, wxFrame) ...@@ -201,12 +225,24 @@ BEGIN_EVENT_TABLE(Interface, wxFrame)
END_EVENT_TABLE() END_EVENT_TABLE()
BEGIN_EVENT_TABLE(Systray, wxTaskBarIcon)
/* Mouse events */
EVT_TASKBAR_LEFT_DOWN(Systray::OnLeftClick)
/* Menu events */
EVT_MENU(Iconize_Event, Systray::OnLeftClick)
EVT_MENU(Exit_Event, Systray::OnExit)
EVT_MENU(PlayStream_Event, Systray::OnPlayStream)
EVT_MENU(NextStream_Event, Systray::OnNextStream)
EVT_MENU(PrevStream_Event, Systray::OnPrevStream)
EVT_MENU(StopStream_Event, Systray::OnStopStream)
END_EVENT_TABLE()
/***************************************************************************** /*****************************************************************************
* Constructor. * Constructor.
*****************************************************************************/ *****************************************************************************/
Interface::Interface( intf_thread_t *_p_intf ): Interface::Interface( intf_thread_t *_p_intf, long style ):
wxFrame( NULL, -1, wxT("VLC media player"), wxFrame( NULL, -1, wxT("VLC media player"),
wxDefaultPosition, wxSize(700,100), wxDEFAULT_FRAME_STYLE ) wxDefaultPosition, wxSize(700,100), style )
{ {
/* Initializations */ /* Initializations */
p_intf = _p_intf; p_intf = _p_intf;
...@@ -217,7 +253,7 @@ Interface::Interface( intf_thread_t *_p_intf ): ...@@ -217,7 +253,7 @@ Interface::Interface( intf_thread_t *_p_intf ):
extra_window = NULL; extra_window = NULL;
/* Give our interface a nice little icon */ /* Give our interface a nice little icon */
SetIcon( wxIcon( vlc_xpm ) ); SetIcon( wxIcon( vlc16x16_xpm ) );
/* Create a sizer for the main frame */ /* Create a sizer for the main frame */
frame_sizer = new wxBoxSizer( wxVERTICAL ); frame_sizer = new wxBoxSizer( wxVERTICAL );
...@@ -229,6 +265,18 @@ Interface::Interface( intf_thread_t *_p_intf ): ...@@ -229,6 +265,18 @@ Interface::Interface( intf_thread_t *_p_intf ):
p_dummy->SetFocus(); p_dummy->SetFocus();
frame_sizer->Add( p_dummy, 0, 0 ); frame_sizer->Add( p_dummy, 0, 0 );
/* Systray integration */
p_systray = NULL;
if ( config_GetInt( p_intf, "wxwin-systray" ) )
{
p_systray = new Systray(this);
p_systray->SetIcon( wxIcon( vlc_xpm ), wxT("VLC media player") );
if ( (! p_systray->IsOk()) || (! p_systray->IsIconInstalled()) )
{
msg_Warn(p_intf, "Cannot set systray icon, weird things may happen");
}
}
/* Creation of the menu bar */ /* Creation of the menu bar */
CreateOurMenuBar(); CreateOurMenuBar();
...@@ -280,6 +328,11 @@ Interface::Interface( intf_thread_t *_p_intf ): ...@@ -280,6 +328,11 @@ Interface::Interface( intf_thread_t *_p_intf ):
Interface::~Interface() Interface::~Interface()
{ {
if( p_systray )
{
delete p_systray;
}
if( p_intf->p_sys->p_wxwindow ) if( p_intf->p_sys->p_wxwindow )
{ {
delete p_intf->p_sys->p_wxwindow; delete p_intf->p_sys->p_wxwindow;
...@@ -874,7 +927,13 @@ void Interface::OnUndock(wxCommandEvent& event) ...@@ -874,7 +927,13 @@ void Interface::OnUndock(wxCommandEvent& event)
} }
#endif #endif
void Interface::OnPlayStream( wxCommandEvent& WXUNUSED(event) ) void Interface::OnPlayStream( wxCommandEvent& WXUNUSED(event) )
{
PlayStream();
}
void Interface::PlayStream()
{ {
wxCommandEvent dummy; wxCommandEvent dummy;
playlist_t *p_playlist = playlist_t *p_playlist =
...@@ -925,6 +984,10 @@ void Interface::OnPlayStream( wxCommandEvent& WXUNUSED(event) ) ...@@ -925,6 +984,10 @@ void Interface::OnPlayStream( wxCommandEvent& WXUNUSED(event) )
} }
void Interface::OnStopStream( wxCommandEvent& WXUNUSED(event) ) void Interface::OnStopStream( wxCommandEvent& WXUNUSED(event) )
{
StopStream();
}
void Interface::StopStream()
{ {
playlist_t * p_playlist = playlist_t * p_playlist =
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
...@@ -989,6 +1052,11 @@ void Interface::OnSliderUpdate( wxScrollEvent& event ) ...@@ -989,6 +1052,11 @@ void Interface::OnSliderUpdate( wxScrollEvent& event )
} }
void Interface::OnPrevStream( wxCommandEvent& WXUNUSED(event) ) void Interface::OnPrevStream( wxCommandEvent& WXUNUSED(event) )
{
PrevStream();
}
void Interface::PrevStream()
{ {
playlist_t * p_playlist = playlist_t * p_playlist =
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
...@@ -1019,6 +1087,11 @@ void Interface::OnPrevStream( wxCommandEvent& WXUNUSED(event) ) ...@@ -1019,6 +1087,11 @@ void Interface::OnPrevStream( wxCommandEvent& WXUNUSED(event) )
} }
void Interface::OnNextStream( wxCommandEvent& WXUNUSED(event) ) void Interface::OnNextStream( wxCommandEvent& WXUNUSED(event) )
{
NextStream();
}
void Interface::NextStream()
{ {
playlist_t * p_playlist = playlist_t * p_playlist =
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
...@@ -1221,3 +1294,59 @@ void wxVolCtrl::UpdateVolume() ...@@ -1221,3 +1294,59 @@ void wxVolCtrl::UpdateVolume()
SetToolTip( wxString::Format((wxString)wxU(_("Volume")) + wxT(" %d"), SetToolTip( wxString::Format((wxString)wxU(_("Volume")) + wxT(" %d"),
i_gauge_volume / 2 ) ); i_gauge_volume / 2 ) );
} }
/*****************************************************************************
* Definition of Systray class.
*****************************************************************************/
Systray::Systray( Interface *_p_main_interface )
{
p_main_interface = _p_main_interface;
}
/* Event handlers */
void Systray::OnLeftClick( wxTaskBarIconEvent& event )
{
p_main_interface->Show( ! p_main_interface->IsShown() );
}
void Systray::OnExit( wxCommandEvent& event )
{
p_main_interface->Close(TRUE);
}
void Systray::OnPrevStream( wxCommandEvent& event )
{
p_main_interface->PrevStream();
}
void Systray::OnNextStream( wxCommandEvent& event )
{
p_main_interface->NextStream();
}
void Systray::OnPlayStream( wxCommandEvent& event )
{
p_main_interface->PlayStream();
}
void Systray::OnStopStream( wxCommandEvent& event )
{
p_main_interface->StopStream();
}
/* Systray popup menu */
wxMenu* Systray::CreatePopupMenu()
{
wxMenu* systray_menu = new wxMenu;
systray_menu->Append( Exit_Event, wxU(_("Quit VLC")) );
systray_menu->AppendSeparator();
systray_menu->Append( PlayStream_Event, wxU(_("Play/Pause")) );
systray_menu->Append( PrevStream_Event, wxU(_("Previous")) );
systray_menu->Append( NextStream_Event, wxU(_("Next")) );
systray_menu->Append( StopStream_Event, wxU(_("Stop")) );
systray_menu->AppendSeparator();
systray_menu->Append( Iconize_Event, wxU(_("Show/Hide interface")) );
return systray_menu;
}
/***************************************************************************** /*****************************************************************************
* wxwindows.cpp : wxWindows plugin for vlc * wxwindows.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2004 VideoLAN * Copyright (C) 2000-2005 VideoLAN
* $Id$ * $Id$
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
#include "wxwindows.h" #include "wxwindows.h"
/* Temporary hack */ /* Temporary hack */
#if defined(WIN32) && defined(_WX_INIT_H_) #if defined(WIN32) && defined(_WX_INIT_H_)
#if (wxMAJOR_VERSION <= 2) && (wxMINOR_VERSION <= 5) && (wxRELEASE_NUMBER < 3) #if (wxMAJOR_VERSION <= 2) && (wxMINOR_VERSION <= 5) && (wxRELEASE_NUMBER < 3)
/* Hack to detect wxWindows 2.5 which has a different wxEntry() prototype */ /* Hack to detect wxWindows 2.5 which has a different wxEntry() prototype */
extern int wxEntry( HINSTANCE hInstance, HINSTANCE hPrevInstance = NULL, extern int wxEntry( HINSTANCE hInstance, HINSTANCE hPrevInstance = NULL,
...@@ -89,6 +89,10 @@ private: ...@@ -89,6 +89,10 @@ private:
#define BOOKMARKS_TEXT N_("Show bookmarks dialog") #define BOOKMARKS_TEXT N_("Show bookmarks dialog")
#define BOOKMARKS_LONGTEXT N_("Show bookmarks dialog when the interface " \ #define BOOKMARKS_LONGTEXT N_("Show bookmarks dialog when the interface " \
"starts.") "starts.")
#define TASKBAR_TEXT N_("Show taskbar entry")
#define TASKBAR_LONGTEXT N_("Show taskbar entry")
#define SYSTRAY_TEXT N_("Show systray icon")
#define SYSTRAY_LONGTEXT N_("Show systray icon")
vlc_module_begin(); vlc_module_begin();
#ifdef WIN32 #ifdef WIN32
...@@ -111,6 +115,10 @@ vlc_module_begin(); ...@@ -111,6 +115,10 @@ vlc_module_begin();
EMBED_TEXT, EMBED_LONGTEXT, VLC_FALSE ); EMBED_TEXT, EMBED_LONGTEXT, VLC_FALSE );
add_bool( "wxwin-bookmarks", 0, NULL, add_bool( "wxwin-bookmarks", 0, NULL,
BOOKMARKS_TEXT, BOOKMARKS_LONGTEXT, VLC_FALSE ); BOOKMARKS_TEXT, BOOKMARKS_LONGTEXT, VLC_FALSE );
add_bool( "wxwin-taskbar", 1, NULL,
TASKBAR_TEXT, TASKBAR_LONGTEXT, VLC_FALSE );
add_bool( "wxwin-systray", 0, NULL,
SYSTRAY_TEXT, SYSTRAY_LONGTEXT, VLC_FALSE );
add_submodule(); add_submodule();
set_description( _("wxWindows dialogs provider") ); set_description( _("wxWindows dialogs provider") );
...@@ -296,7 +304,12 @@ bool Instance::OnInit() ...@@ -296,7 +304,12 @@ bool Instance::OnInit()
if( !p_intf->pf_show_dialog ) if( !p_intf->pf_show_dialog )
{ {
/* The module is used in interface mode */ /* The module is used in interface mode */
Interface *MainInterface = new Interface( p_intf ); long style = wxDEFAULT_FRAME_STYLE;
if ( ! config_GetInt( p_intf, "wxwin-taskbar" ) )
{
style = wxDEFAULT_FRAME_STYLE|wxFRAME_NO_TASKBAR;
}
Interface *MainInterface = new Interface( p_intf, style );
p_intf->p_sys->p_wxwindow = MainInterface; p_intf->p_sys->p_wxwindow = MainInterface;
/* Show the interface */ /* Show the interface */
......
/***************************************************************************** /*****************************************************************************
* wxwindows.h: private wxWindows interface description * wxwindows.h: private wxWindows interface description
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2004 VideoLAN * Copyright (C) 1999-2005 VideoLAN
* $Id$ * $Id$
* *
* Authors: Gildas Bazin <gbazin@videolan.org> * Authors: Gildas Bazin <gbazin@videolan.org>
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include <wx/accel.h> #include <wx/accel.h>
#include <wx/checkbox.h> #include <wx/checkbox.h>
#include <wx/wizard.h> #include <wx/wizard.h>
#include <wx/taskbar.h>
#include "vlc_keys.h" #include "vlc_keys.h"
...@@ -93,6 +94,7 @@ class DialogsProvider; ...@@ -93,6 +94,7 @@ class DialogsProvider;
class PrefsTreeCtrl; class PrefsTreeCtrl;
class AutoBuiltPanel; class AutoBuiltPanel;
class VideoWindow; class VideoWindow;
class Systray;
/***************************************************************************** /*****************************************************************************
* intf_sys_t: description and status of wxwindows interface * intf_sys_t: description and status of wxwindows interface
...@@ -289,11 +291,15 @@ class Interface: public wxFrame ...@@ -289,11 +291,15 @@ class Interface: public wxFrame
{ {
public: public:
/* Constructor */ /* Constructor */
Interface( intf_thread_t *p_intf ); Interface( intf_thread_t *p_intf, long style = wxDEFAULT_FRAME_STYLE );
virtual ~Interface(); virtual ~Interface();
void Init(); void Init();
void TogglePlayButton( int i_playing_status ); void TogglePlayButton( int i_playing_status );
void Update(); void Update();
void PlayStream();
void StopStream();
void PrevStream();
void NextStream();
wxBoxSizer *frame_sizer; wxBoxSizer *frame_sizer;
wxStatusBar *statusbar; wxStatusBar *statusbar;
...@@ -314,8 +320,8 @@ public: ...@@ -314,8 +320,8 @@ public:
vlc_bool_t b_extra; vlc_bool_t b_extra;
vlc_bool_t b_undock; vlc_bool_t b_undock;
wxGauge *volctrl; wxGauge *volctrl;
Systray *p_systray;
private: private:
void SetupHotkeys(); void SetupHotkeys();
...@@ -576,7 +582,7 @@ private: ...@@ -576,7 +582,7 @@ private:
/* Event specific to the announce address */ /* Event specific to the announce address */
void OnAnnounceGroupChange( wxCommandEvent& event ); void OnAnnounceGroupChange( wxCommandEvent& event );
void OnAnnounceAddrChange( wxCommandEvent& event ); void OnAnnounceAddrChange( wxCommandEvent& event );
/* Event handlers for the encapsulation panel */ /* Event handlers for the encapsulation panel */
void OnEncapsulationChange( wxCommandEvent& event ); void OnEncapsulationChange( wxCommandEvent& event );
...@@ -969,7 +975,6 @@ private: ...@@ -969,7 +975,6 @@ private:
wxTreeItemId fileinfo_root; wxTreeItemId fileinfo_root;
wxString fileinfo_root_label; wxString fileinfo_root_label;
}; };
#if wxUSE_DRAG_AND_DROP #if wxUSE_DRAG_AND_DROP
...@@ -1017,3 +1022,4 @@ private: ...@@ -1017,3 +1022,4 @@ private:
} // end of wxvlc namespace } // end of wxvlc namespace
using namespace wxvlc; using namespace wxvlc;
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