Commit 11bfb464 authored by Clément Stenac's avatar Clément Stenac

Add separate audio and video popup menus

parent 9f750249
/* /*
* Created on 28-feb-2006 * Created on 28-feb-2006
* *
* $Id: VideoIntf.java 8 2006-02-28 12:03:47Z little $ * $Id$
* *
* This program is free software; you can redistribute it * This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public License * and/or modify it under the terms of the GNU General Public License
......
...@@ -162,6 +162,9 @@ VLC_EXPORT( void, intf_Destroy, ( intf_thread_t * ) ); ...@@ -162,6 +162,9 @@ VLC_EXPORT( void, intf_Destroy, ( intf_thread_t * ) );
#define INTF_DIALOG_BOOKMARKS 14 #define INTF_DIALOG_BOOKMARKS 14
#define INTF_DIALOG_POPUPMENU 20 #define INTF_DIALOG_POPUPMENU 20
#define INTF_DIALOG_AUDIOPOPUPMENU 21
#define INTF_DIALOG_VIDEOPOPUPMENU 22
#define INTF_DIALOG_MISCPOPUPMENU 23
#define INTF_DIALOG_FILE_GENERIC 30 #define INTF_DIALOG_FILE_GENERIC 30
#define INTF_DIALOG_INTERACTION 50 #define INTF_DIALOG_INTERACTION 50
......
...@@ -84,6 +84,9 @@ private: ...@@ -84,6 +84,9 @@ private:
void OnOpenSat( wxCommandEvent& event ); void OnOpenSat( wxCommandEvent& event );
void OnPopupMenu( wxCommandEvent& event ); void OnPopupMenu( wxCommandEvent& event );
void OnAudioPopupMenu( wxCommandEvent& event );
void OnVideoPopupMenu( wxCommandEvent& event );
void OnMiscPopupMenu( wxCommandEvent& event );
void OnIdle( wxIdleEvent& event ); void OnIdle( wxIdleEvent& event );
...@@ -140,8 +143,16 @@ BEGIN_EVENT_TABLE(DialogsProvider, wxFrame) ...@@ -140,8 +143,16 @@ BEGIN_EVENT_TABLE(DialogsProvider, wxFrame)
DialogsProvider::OnFileInfo) DialogsProvider::OnFileInfo)
EVT_COMMAND(INTF_DIALOG_BOOKMARKS, wxEVT_DIALOG, EVT_COMMAND(INTF_DIALOG_BOOKMARKS, wxEVT_DIALOG,
DialogsProvider::OnBookmarks) DialogsProvider::OnBookmarks)
EVT_COMMAND(INTF_DIALOG_POPUPMENU, wxEVT_DIALOG, EVT_COMMAND(INTF_DIALOG_POPUPMENU, wxEVT_DIALOG,
DialogsProvider::OnPopupMenu) DialogsProvider::OnPopupMenu)
EVT_COMMAND(INTF_DIALOG_AUDIOPOPUPMENU, wxEVT_DIALOG,
DialogsProvider::OnAudioPopupMenu)
EVT_COMMAND(INTF_DIALOG_VIDEOPOPUPMENU, wxEVT_DIALOG,
DialogsProvider::OnVideoPopupMenu)
EVT_COMMAND(INTF_DIALOG_MISCPOPUPMENU, wxEVT_DIALOG,
DialogsProvider::OnMiscPopupMenu)
EVT_COMMAND(INTF_DIALOG_EXIT, wxEVT_DIALOG, EVT_COMMAND(INTF_DIALOG_EXIT, wxEVT_DIALOG,
DialogsProvider::OnExitThread) DialogsProvider::OnExitThread)
EVT_COMMAND(INTF_DIALOG_UPDATEVLC, wxEVT_DIALOG, EVT_COMMAND(INTF_DIALOG_UPDATEVLC, wxEVT_DIALOG,
...@@ -508,6 +519,22 @@ void DialogsProvider::OnPopupMenu( wxCommandEvent& event ) ...@@ -508,6 +519,22 @@ void DialogsProvider::OnPopupMenu( wxCommandEvent& event )
::PopupMenu( p_intf, this, mousepos ); ::PopupMenu( p_intf, this, mousepos );
} }
void DialogsProvider::OnAudioPopupMenu( wxCommandEvent& event )
{
wxPoint mousepos = ScreenToClient( wxGetMousePosition() );
::AudioPopupMenu( p_intf, this, mousepos );
}
void DialogsProvider::OnVideoPopupMenu( wxCommandEvent& event )
{
wxPoint mousepos = ScreenToClient( wxGetMousePosition() );
::VideoPopupMenu( p_intf, this, mousepos );
}
void DialogsProvider::OnMiscPopupMenu( wxCommandEvent& event )
{
wxPoint mousepos = ScreenToClient( wxGetMousePosition() );
::MiscPopupMenu( p_intf, this, mousepos );
}
void DialogsProvider::OnExitThread( wxCommandEvent& WXUNUSED(event) ) void DialogsProvider::OnExitThread( wxCommandEvent& WXUNUSED(event) )
{ {
wxTheApp->ExitMainLoop(); wxTheApp->ExitMainLoop();
......
...@@ -239,6 +239,9 @@ namespace wxvlc ...@@ -239,6 +239,9 @@ namespace wxvlc
}; };
void PopupMenu( intf_thread_t *, wxWindow *, const wxPoint& ); void PopupMenu( intf_thread_t *, wxWindow *, const wxPoint& );
void AudioPopupMenu( intf_thread_t *, wxWindow *, const wxPoint& );
void VideoPopupMenu( intf_thread_t *, wxWindow *, const wxPoint& );
void MiscPopupMenu( intf_thread_t *, wxWindow *, const wxPoint& );
wxMenu *SettingsMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL ); wxMenu *SettingsMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
wxMenu *AudioMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL ); wxMenu *AudioMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
wxMenu *VideoMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL ); wxMenu *VideoMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
......
...@@ -21,20 +21,16 @@ ...@@ -21,20 +21,16 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/ *****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <stdlib.h> /* malloc(), free() */
#include <errno.h> /* ENOMEM */
#include <string.h> /* strerror() */
#include <stdio.h>
#include <vlc/vlc.h> #include <vlc/vlc.h>
#include <vlc/intf.h> #include <vlc/intf.h>
#include "wxwidgets.hpp" #include "wxwidgets.hpp"
#include "interface.hpp" #include "interface.hpp"
#include <vector>
#include <string>
using namespace std;
class wxMenuItemExt: public wxMenuItem class wxMenuItemExt: public wxMenuItem
{ {
public: public:
...@@ -43,16 +39,12 @@ public: ...@@ -43,16 +39,12 @@ public:
const wxString& helpString, wxItemKind kind, const wxString& helpString, wxItemKind kind,
char *_psz_var, int _i_object_id, vlc_value_t _val, char *_psz_var, int _i_object_id, vlc_value_t _val,
int _i_val_type ); int _i_val_type );
virtual ~wxMenuItemExt(); virtual ~wxMenuItemExt();
char *psz_var; char *psz_var;
int i_val_type; int i_val_type;
int i_object_id; int i_object_id;
vlc_value_t val; vlc_value_t val;
private:
}; };
class Menu: public wxMenu class Menu: public wxMenu
...@@ -62,7 +54,7 @@ public: ...@@ -62,7 +54,7 @@ public:
Menu( intf_thread_t *p_intf, int i_start_id ); Menu( intf_thread_t *p_intf, int i_start_id );
virtual ~Menu(); virtual ~Menu();
void Populate( int i_count, char **ppsz_names, int *pi_objects ); void Populate( vector<string> &, vector<int> &);
void Clear(); void Clear();
private: private:
...@@ -81,8 +73,6 @@ private: ...@@ -81,8 +73,6 @@ private:
/***************************************************************************** /*****************************************************************************
* Event Table. * Event Table.
*****************************************************************************/ *****************************************************************************/
/* IDs for the controls and the menu commands */
enum enum
{ {
/* menu items */ /* menu items */
...@@ -126,6 +116,9 @@ BEGIN_EVENT_TABLE(MenuEvtHandler, wxEvtHandler) ...@@ -126,6 +116,9 @@ BEGIN_EVENT_TABLE(MenuEvtHandler, wxEvtHandler)
EVT_MENU(-1, MenuEvtHandler::OnMenuEvent) EVT_MENU(-1, MenuEvtHandler::OnMenuEvent)
END_EVENT_TABLE() END_EVENT_TABLE()
/*****************************************************************************
* Static menu helpers
*****************************************************************************/
wxMenu *OpenStreamMenu( intf_thread_t *p_intf ) wxMenu *OpenStreamMenu( intf_thread_t *p_intf )
{ {
wxMenu *menu = new wxMenu; wxMenu *menu = new wxMenu;
...@@ -147,215 +140,283 @@ wxMenu *MiscMenu( intf_thread_t *p_intf ) ...@@ -147,215 +140,283 @@ wxMenu *MiscMenu( intf_thread_t *p_intf )
return menu; return menu;
} }
void PopupMenu( intf_thread_t *p_intf, wxWindow *p_parent, /*****************************************************************************
const wxPoint& pos ) * Builders for the dynamic menus
{ *****************************************************************************/
#define MAX_POPUP_ITEMS 45 #define PUSH_VAR( var ) rs_varnames.push_back( var ); \
ri_objects.push_back( p_object->i_object_id );
int minimal = config_GetInt( p_intf, "wx-minimal" ); int InputAutoMenuBuilder( vlc_object_t *p_object,
vector<int> &ri_objects, vector<string> &rs_varnames )
{
PUSH_VAR( "bookmark");
PUSH_VAR( "title" );
PUSH_VAR ("chapter" );
PUSH_VAR( "program" );
PUSH_VAR( "navigation" );
PUSH_VAR( "dvd_menus" );
return VLC_SUCCESS;
}
vlc_object_t *p_object, *p_input; int VideoAutoMenuBuilder( vlc_object_t *p_object,
char *ppsz_varnames[MAX_POPUP_ITEMS]; vector<int> &ri_objects, vector<string> &rs_varnames )
int pi_objects[MAX_POPUP_ITEMS]; {
int i = 0, i_last_separator = 0; PUSH_VAR( "fullscreen" );
PUSH_VAR( "zoom" );
PUSH_VAR( "deinterlace" );
PUSH_VAR( "aspect-ratio" );
PUSH_VAR( "crop" );
PUSH_VAR( "video-on-top" );
PUSH_VAR( "directx-wallpaper" );
PUSH_VAR( "video-snapshot" );
vlc_object_t *p_dec_obj = (vlc_object_t *)vlc_object_find( p_object,
VLC_OBJECT_DECODER,
FIND_PARENT );
if( p_dec_obj != NULL )
{
PUSH_VAR( "ffmpeg-pp-q" );
vlc_object_release( p_dec_obj );
}
return VLC_SUCCESS;
}
/* Initializations */ int AudioAutoMenuBuilder( vlc_object_t *p_object,
memset( pi_objects, 0, MAX_POPUP_ITEMS * sizeof(int) ); vector<int> &ri_objects, vector<string> &rs_varnames )
{
PUSH_VAR( "audio-device" );
PUSH_VAR( "audio-channels" );
PUSH_VAR( "visual" );
PUSH_VAR( "equalizer" );
return VLC_SUCCESS;
}
/* Input menu */ int IntfAutoMenuBuilder( intf_thread_t *p_intf,
p_object = (vlc_object_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT, vector<int> &ri_objects, vector<string> &rs_varnames )
FIND_ANYWHERE ); {
/* vlc_object_find is needed because of the dialogs provider case */
vlc_object_t *p_object;
p_object = (vlc_object_t *)vlc_object_find( p_intf, VLC_OBJECT_INTF,
FIND_PARENT );
if( p_object != NULL ) if( p_object != NULL )
{ {
ppsz_varnames[i] = "bookmark"; PUSH_VAR( "intf-add" );
pi_objects[i++] = p_object->i_object_id; PUSH_VAR( "intf-skins" );
ppsz_varnames[i] = "title"; vlc_object_release( p_object );
pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "chapter";
pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "program";
pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "navigation";
pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "dvd_menus";
pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "video-es";
pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "audio-es";
pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "spu-es";
pi_objects[i++] = p_object->i_object_id;
} }
p_input = p_object; return VLC_SUCCESS;
if( !p_input ) goto interfacemenu; }
/* Video menu */
if( i != i_last_separator ) ppsz_varnames[i++] = NULL; /* Separator */
i_last_separator = i;
p_object = (vlc_object_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT, #undef PUSH_VAR
FIND_ANYWHERE ); /*****************************************************************************
if( p_object != NULL ) * Popup menus
*****************************************************************************/
#define PUSH_VAR( var ) as_varnames.push_back( var ); \
ai_objects.push_back( p_object->i_object_id );
#define PUSH_SEPARATOR if( ai_objects.size() != i_last_separator ) { \
ai_objects.push_back( 0 ); \
as_varnames.push_back( "" ); \
i_last_separator = ai_objects.size(); }
#define POPUP_BOILERPLATE \
unsigned int i_last_separator = 0; \
vector<int> ai_objects; \
vector<string> as_varnames; \
playlist_t *p_playlist = (playlist_t *) vlc_object_find( p_intf, \
VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );\
if( !p_playlist ) \
return; \
input_thread_t *p_input = p_playlist->p_input;
#define CREATE_POPUP \
Menu popupmenu( p_intf, PopupMenu_Events ); \
popupmenu.Populate( as_varnames, ai_objects ); \
p_intf->p_sys->p_popup_menu = &popupmenu; \
p_parent->PopupMenu( &popupmenu, pos.x, pos.y ); \
p_intf->p_sys->p_popup_menu = NULL; \
#define POPUP_STATIC_ENTRIES \
if( p_input != NULL ) \
{ \
vlc_value_t val; \
popupmenu.InsertSeparator( 0 ); \
if (!minimal) \
{ \
popupmenu.Insert( 0, Stop_Event, wxU(_("Stop")) ); \
popupmenu.Insert( 0, Previous_Event, wxU(_("Previous")) ); \
popupmenu.Insert( 0, Next_Event, wxU(_("Next")) ); \
} \
\
var_Get( p_input, "state", &val ); \
if( val.i_int == PAUSE_S ) \
popupmenu.Insert( 0, Play_Event, wxU(_("Play")) ); \
else \
popupmenu.Insert( 0, Pause_Event, wxU(_("Pause")) ); \
\
vlc_object_release( p_input ); \
} \
else \
{ \
if( p_playlist && p_playlist->i_size ) \
{ \
popupmenu.InsertSeparator( 0 ); \
popupmenu.Insert( 0, Play_Event, wxU(_("Play")) ); \
} \
if( p_playlist ) vlc_object_release( p_playlist ); \
} \
\
popupmenu.Append( MenuDummy_Event, wxU(_("Miscellaneous")), \
MiscMenu( p_intf ), wxT("") ); \
void VideoPopupMenu( intf_thread_t *p_intf, wxWindow *p_parent,
const wxPoint& pos )
{
POPUP_BOILERPLATE;
if( p_input )
{ {
vlc_object_t *p_dec_obj; vlc_object_yield( p_input );
as_varnames.push_back( "video-es" );
ppsz_varnames[i] = "fullscreen"; ai_objects.push_back( p_input->i_object_id );
pi_objects[i++] = p_object->i_object_id; as_varnames.push_back( "spu-es" );
ppsz_varnames[i] = "zoom"; ai_objects.push_back( p_input->i_object_id );
pi_objects[i++] = p_object->i_object_id; vlc_object_t *p_vout = (vlc_object_t *)vlc_object_find( p_input,
ppsz_varnames[i] = "deinterlace"; VLC_OBJECT_VOUT, FIND_CHILD );
pi_objects[i++] = p_object->i_object_id; if( p_vout )
ppsz_varnames[i] = "aspect-ratio";
pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "crop";
pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "video-on-top";
pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "directx-wallpaper";
pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "video-snapshot";
pi_objects[i++] = p_object->i_object_id;
p_dec_obj = (vlc_object_t *)vlc_object_find( p_object,
VLC_OBJECT_DECODER,
FIND_PARENT );
if( p_dec_obj != NULL )
{ {
ppsz_varnames[i] = "ffmpeg-pp-q"; VideoAutoMenuBuilder( p_vout, ai_objects, as_varnames );
pi_objects[i++] = p_dec_obj->i_object_id; vlc_object_release( p_vout );
vlc_object_release( p_dec_obj );
} }
vlc_object_release( p_input );
vlc_object_release( p_object );
} }
CREATE_POPUP;
}
/* Audio menu */ void AudioPopupMenu( intf_thread_t *p_intf, wxWindow *p_parent,
if( i != i_last_separator ) ppsz_varnames[i++] = NULL; /* Separator */ const wxPoint& pos )
i_last_separator = i; {
POPUP_BOILERPLATE;
p_object = (vlc_object_t *)vlc_object_find( p_intf, VLC_OBJECT_AOUT, if( p_input )
FIND_ANYWHERE );
if( p_object != NULL )
{ {
ppsz_varnames[i] = "audio-device"; vlc_object_yield( p_input );
pi_objects[i++] = p_object->i_object_id; as_varnames.push_back( "audio-es" );
ppsz_varnames[i] = "audio-channels"; ai_objects.push_back( p_input->i_object_id );
pi_objects[i++] = p_object->i_object_id; vlc_object_t *p_aout = (vlc_object_t *)vlc_object_find( p_input,
ppsz_varnames[i] = "visual"; VLC_OBJECT_AOUT, FIND_ANYWHERE );
pi_objects[i++] = p_object->i_object_id; if( p_aout )
ppsz_varnames[i] = "equalizer"; {
pi_objects[i++] = p_object->i_object_id; AudioAutoMenuBuilder( p_aout, ai_objects, as_varnames );
vlc_object_release( p_object ); vlc_object_release( p_aout );
}
vlc_object_release( p_input );
} }
CREATE_POPUP;
}
interfacemenu: /* Navigation stuff, and general */
/* Interface menu */ void MiscPopupMenu( intf_thread_t *p_intf, wxWindow *p_parent,
if( i != i_last_separator ) ppsz_varnames[i++] = NULL; /* Separator */ const wxPoint& pos )
i_last_separator = i; {
int minimal = 0;
/* vlc_object_find is needed because of the dialogs provider case */ POPUP_BOILERPLATE;
p_object = (vlc_object_t *)vlc_object_find( p_intf, VLC_OBJECT_INTF, if( p_input )
FIND_PARENT );
if( p_object != NULL )
{ {
#if 0 vlc_object_yield( p_input );
#if (wxCHECK_VERSION(2,5,0)) as_varnames.push_back( "audio-es" );
ppsz_varnames[i] = "intf-switch"; InputAutoMenuBuilder( VLC_OBJECT(p_input), ai_objects, as_varnames );
pi_objects[i++] = p_object->i_object_id; PUSH_SEPARATOR;
#endif
#endif
ppsz_varnames[i] = "intf-add";
pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "intf-skins";
pi_objects[i++] = p_object->i_object_id;
vlc_object_release( p_object );
} }
IntfAutoMenuBuilder( p_intf, ai_objects, as_varnames );
/* Build menu */
Menu popupmenu( p_intf, PopupMenu_Events ); Menu popupmenu( p_intf, PopupMenu_Events );
popupmenu.Populate( i, ppsz_varnames, pi_objects ); popupmenu.Populate( as_varnames, ai_objects );
/* Add static entries */ POPUP_STATIC_ENTRIES;
if( p_input != NULL ) popupmenu.Append( MenuDummy_Event, wxU(_("Open")),
{ OpenStreamMenu( p_intf ), wxT("") );
vlc_value_t val;
popupmenu.InsertSeparator( 0 );
if (!minimal)
{
popupmenu.Insert( 0, Stop_Event, wxU(_("Stop")) );
popupmenu.Insert( 0, Previous_Event, wxU(_("Previous")) );
popupmenu.Insert( 0, Next_Event, wxU(_("Next")) );
}
var_Get( p_input, "state", &val ); p_intf->p_sys->p_popup_menu = &popupmenu;
if( val.i_int == PAUSE_S ) p_parent->PopupMenu( &popupmenu, pos.x, pos.y );
popupmenu.Insert( 0, Play_Event, wxU(_("Play")) ); p_intf->p_sys->p_popup_menu = NULL;
else }
popupmenu.Insert( 0, Pause_Event, wxU(_("Pause")) );
vlc_object_release( p_input ); void PopupMenu( intf_thread_t *p_intf, wxWindow *p_parent,
} const wxPoint& pos )
else {
int minimal = config_GetInt( p_intf, "wx-minimal" );
POPUP_BOILERPLATE;
if( p_input )
{ {
playlist_t * p_playlist = vlc_object_yield( p_input );
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, InputAutoMenuBuilder( VLC_OBJECT(p_input), ai_objects, as_varnames );
FIND_ANYWHERE );
if( p_playlist && p_playlist->i_size ) /* Video menu */
PUSH_SEPARATOR;
as_varnames.push_back( "video-es" );
ai_objects.push_back( p_input->i_object_id );
as_varnames.push_back( "spu-es" );
ai_objects.push_back( p_input->i_object_id );
vlc_object_t *p_vout = (vlc_object_t *)vlc_object_find( p_input,
VLC_OBJECT_VOUT, FIND_CHILD );
if( p_vout )
{ {
popupmenu.InsertSeparator( 0 ); VideoAutoMenuBuilder( p_vout, ai_objects, as_varnames );
popupmenu.Insert( 0, Play_Event, wxU(_("Play")) ); vlc_object_release( p_vout );
}
/* Audio menu */
PUSH_SEPARATOR
as_varnames.push_back( "audio-es" );
ai_objects.push_back( p_input->i_object_id );
vlc_object_t *p_aout = (vlc_object_t *)vlc_object_find( p_input,
VLC_OBJECT_AOUT, FIND_ANYWHERE );
if( p_aout )
{
AudioAutoMenuBuilder( p_aout, ai_objects, as_varnames );
vlc_object_release( p_aout );
} }
if( p_playlist ) vlc_object_release( p_playlist );
} }
popupmenu.Append( MenuDummy_Event, wxU(_("Miscellaneous")), /* Interface menu */
MiscMenu( p_intf ), wxT("") ); PUSH_SEPARATOR
IntfAutoMenuBuilder( p_intf, ai_objects, as_varnames );
/* Build menu */
Menu popupmenu( p_intf, PopupMenu_Events );
popupmenu.Populate( as_varnames, ai_objects );
POPUP_STATIC_ENTRIES;
if (!minimal) if (!minimal)
{ {
popupmenu.Append( MenuDummy_Event, wxU(_("Open")), popupmenu.Append( MenuDummy_Event, wxU(_("Open")),
OpenStreamMenu( p_intf ), wxT("") ); OpenStreamMenu( p_intf ), wxT("") );
} }
p_intf->p_sys->p_popup_menu = &popupmenu; p_intf->p_sys->p_popup_menu = &popupmenu;
p_parent->PopupMenu( &popupmenu, pos.x, pos.y ); p_parent->PopupMenu( &popupmenu, pos.x, pos.y );
p_intf->p_sys->p_popup_menu = NULL; p_intf->p_sys->p_popup_menu = NULL;
} }
/*****************************************************************************
* Auto menus
*****************************************************************************/
wxMenu *AudioMenu( intf_thread_t *_p_intf, wxWindow *p_parent, wxMenu *p_menu ) wxMenu *AudioMenu( intf_thread_t *_p_intf, wxWindow *p_parent, wxMenu *p_menu )
{ {
#define MAX_AUDIO_ITEMS 10
vlc_object_t *p_object; vlc_object_t *p_object;
char *ppsz_varnames[MAX_AUDIO_ITEMS]; vector<int> ai_objects;
int pi_objects[MAX_AUDIO_ITEMS]; vector<string> as_varnames;
int i = 0;
/* Initializations */
memset( pi_objects, 0, MAX_AUDIO_ITEMS * sizeof(int) );
p_object = (vlc_object_t *)vlc_object_find( _p_intf, VLC_OBJECT_INPUT, p_object = (vlc_object_t *)vlc_object_find( _p_intf, VLC_OBJECT_INPUT,
FIND_ANYWHERE ); FIND_ANYWHERE );
if( p_object != NULL ) if( p_object != NULL )
{ {
ppsz_varnames[i] = "audio-es"; PUSH_VAR( "audio-es" );
pi_objects[i++] = p_object->i_object_id;
vlc_object_release( p_object ); vlc_object_release( p_object );
} }
p_object = (vlc_object_t *)vlc_object_find( _p_intf, VLC_OBJECT_AOUT, p_object = (vlc_object_t *)vlc_object_find( _p_intf, VLC_OBJECT_AOUT,
FIND_ANYWHERE ); FIND_ANYWHERE );
if( p_object != NULL ) if( p_object )
{ {
ppsz_varnames[i] = "audio-device"; AudioAutoMenuBuilder( p_object, ai_objects, as_varnames );
pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "audio-channels";
pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "visual";
pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "equalizer";
pi_objects[i++] = p_object->i_object_id;
vlc_object_release( p_object ); vlc_object_release( p_object );
} }
...@@ -366,31 +427,23 @@ wxMenu *AudioMenu( intf_thread_t *_p_intf, wxWindow *p_parent, wxMenu *p_menu ) ...@@ -366,31 +427,23 @@ wxMenu *AudioMenu( intf_thread_t *_p_intf, wxWindow *p_parent, wxMenu *p_menu )
else else
p_vlc_menu->Clear(); p_vlc_menu->Clear();
p_vlc_menu->Populate( i, ppsz_varnames, pi_objects ); p_vlc_menu->Populate( as_varnames, ai_objects );
return p_vlc_menu; return p_vlc_menu;
} }
wxMenu *VideoMenu( intf_thread_t *_p_intf, wxWindow *p_parent, wxMenu *p_menu ) wxMenu *VideoMenu( intf_thread_t *_p_intf, wxWindow *p_parent, wxMenu *p_menu )
{ {
#define MAX_VIDEO_ITEMS 15
vlc_object_t *p_object; vlc_object_t *p_object;
char *ppsz_varnames[MAX_VIDEO_ITEMS]; vector<int> ai_objects;
int pi_objects[MAX_VIDEO_ITEMS]; vector<string> as_varnames;
int i = 0;
/* Initializations */
memset( pi_objects, 0, MAX_VIDEO_ITEMS * sizeof(int) );
p_object = (vlc_object_t *)vlc_object_find( _p_intf, VLC_OBJECT_INPUT, p_object = (vlc_object_t *)vlc_object_find( _p_intf, VLC_OBJECT_INPUT,
FIND_ANYWHERE ); FIND_ANYWHERE );
if( p_object != NULL ) if( p_object != NULL )
{ {
ppsz_varnames[i] = "video-es"; PUSH_VAR( "video-es" );
pi_objects[i++] = p_object->i_object_id; PUSH_VAR( "spu-es" );
ppsz_varnames[i] = "spu-es";
pi_objects[i++] = p_object->i_object_id;
vlc_object_release( p_object ); vlc_object_release( p_object );
} }
...@@ -398,35 +451,7 @@ wxMenu *VideoMenu( intf_thread_t *_p_intf, wxWindow *p_parent, wxMenu *p_menu ) ...@@ -398,35 +451,7 @@ wxMenu *VideoMenu( intf_thread_t *_p_intf, wxWindow *p_parent, wxMenu *p_menu )
FIND_ANYWHERE ); FIND_ANYWHERE );
if( p_object != NULL ) if( p_object != NULL )
{ {
vlc_object_t *p_dec_obj; VideoAutoMenuBuilder( p_object, ai_objects, as_varnames );
ppsz_varnames[i] = "fullscreen";
pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "zoom";
pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "deinterlace";
pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "aspect-ratio";
pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "crop";
pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "video-on-top";
pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "directx-wallpaper";
pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "video-snapshot";
pi_objects[i++] = p_object->i_object_id;
p_dec_obj = (vlc_object_t *)vlc_object_find( p_object,
VLC_OBJECT_DECODER,
FIND_PARENT );
if( p_dec_obj != NULL )
{
ppsz_varnames[i] = "ffmpeg-pp-q";
pi_objects[i++] = p_dec_obj->i_object_id;
vlc_object_release( p_dec_obj );
}
vlc_object_release( p_object ); vlc_object_release( p_object );
} }
...@@ -437,49 +462,23 @@ wxMenu *VideoMenu( intf_thread_t *_p_intf, wxWindow *p_parent, wxMenu *p_menu ) ...@@ -437,49 +462,23 @@ wxMenu *VideoMenu( intf_thread_t *_p_intf, wxWindow *p_parent, wxMenu *p_menu )
else else
p_vlc_menu->Clear(); p_vlc_menu->Clear();
p_vlc_menu->Populate( i, ppsz_varnames, pi_objects ); p_vlc_menu->Populate( as_varnames, ai_objects );
return p_vlc_menu; return p_vlc_menu;
} }
wxMenu *NavigMenu( intf_thread_t *_p_intf, wxWindow *p_parent, wxMenu *p_menu ) wxMenu *NavigMenu( intf_thread_t *_p_intf, wxWindow *p_parent, wxMenu *p_menu )
{ {
#define MAX_NAVIG_ITEMS 15
vlc_object_t *p_object; vlc_object_t *p_object;
char *ppsz_varnames[MAX_NAVIG_ITEMS]; vector<int> ai_objects;
int pi_objects[MAX_NAVIG_ITEMS]; vector<string> as_varnames;
int i = 0;
/* Initializations */
memset( pi_objects, 0, MAX_NAVIG_ITEMS * sizeof(int) );
p_object = (vlc_object_t *)vlc_object_find( _p_intf, VLC_OBJECT_INPUT, p_object = (vlc_object_t *)vlc_object_find( _p_intf, VLC_OBJECT_INPUT,
FIND_ANYWHERE ); FIND_ANYWHERE );
if( p_object != NULL ) if( p_object != NULL )
{ {
ppsz_varnames[i] = "bookmark"; InputAutoMenuBuilder( p_object, ai_objects, as_varnames );
pi_objects[i++] = p_object->i_object_id; PUSH_VAR( "prev-title"); PUSH_VAR ( "next-title" );
ppsz_varnames[i] = "title"; PUSH_VAR( "prev-chapter"); PUSH_VAR( "next-chapter" );
pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "chapter";
pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "program";
pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "navigation";
pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "dvd_menus";
pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "prev-title";
pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "next-title";
pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "prev-chapter";
pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "next-chapter";
pi_objects[i++] = p_object->i_object_id;
vlc_object_release( p_object ); vlc_object_release( p_object );
} }
...@@ -490,7 +489,7 @@ wxMenu *NavigMenu( intf_thread_t *_p_intf, wxWindow *p_parent, wxMenu *p_menu ) ...@@ -490,7 +489,7 @@ wxMenu *NavigMenu( intf_thread_t *_p_intf, wxWindow *p_parent, wxMenu *p_menu )
else else
p_vlc_menu->Clear(); p_vlc_menu->Clear();
p_vlc_menu->Populate( i, ppsz_varnames, pi_objects ); p_vlc_menu->Populate( as_varnames, ai_objects );
return p_vlc_menu; return p_vlc_menu;
} }
...@@ -498,28 +497,15 @@ wxMenu *NavigMenu( intf_thread_t *_p_intf, wxWindow *p_parent, wxMenu *p_menu ) ...@@ -498,28 +497,15 @@ wxMenu *NavigMenu( intf_thread_t *_p_intf, wxWindow *p_parent, wxMenu *p_menu )
wxMenu *SettingsMenu( intf_thread_t *_p_intf, wxWindow *p_parent, wxMenu *SettingsMenu( intf_thread_t *_p_intf, wxWindow *p_parent,
wxMenu *p_menu ) wxMenu *p_menu )
{ {
#define MAX_SETTINGS_ITEMS 10
vlc_object_t *p_object; vlc_object_t *p_object;
char *ppsz_varnames[MAX_SETTINGS_ITEMS]; vector<int> ai_objects;
int pi_objects[MAX_SETTINGS_ITEMS]; vector<string> as_varnames;
int i = 0;
/* Initializations */
memset( pi_objects, 0, MAX_SETTINGS_ITEMS * sizeof(int) );
p_object = (vlc_object_t *)vlc_object_find( _p_intf, VLC_OBJECT_INTF, p_object = (vlc_object_t *)vlc_object_find( _p_intf, VLC_OBJECT_INTF,
FIND_PARENT ); FIND_PARENT );
if( p_object != NULL ) if( p_object != NULL )
{ {
#if 0 PUSH_VAR( "intf-add" );
#if (wxCHECK_VERSION(2,5,0))
ppsz_varnames[i] = "intf-switch";
pi_objects[i++] = p_object->i_object_id;
#endif
#endif
ppsz_varnames[i] = "intf-add";
pi_objects[i++] = p_object->i_object_id;
vlc_object_release( p_object ); vlc_object_release( p_object );
} }
...@@ -530,7 +516,7 @@ wxMenu *SettingsMenu( intf_thread_t *_p_intf, wxWindow *p_parent, ...@@ -530,7 +516,7 @@ wxMenu *SettingsMenu( intf_thread_t *_p_intf, wxWindow *p_parent,
else else
p_vlc_menu->Clear(); p_vlc_menu->Clear();
p_vlc_menu->Populate( i, ppsz_varnames, pi_objects ); p_vlc_menu->Populate( as_varnames, ai_objects );
return p_vlc_menu; return p_vlc_menu;
} }
...@@ -552,7 +538,7 @@ Menu::~Menu() ...@@ -552,7 +538,7 @@ Menu::~Menu()
/***************************************************************************** /*****************************************************************************
* Public methods. * Public methods.
*****************************************************************************/ *****************************************************************************/
void Menu::Populate( int i_count, char **ppsz_varnames, int *pi_objects ) void Menu::Populate( vector<string> & ras_varnames, vector<int> & rai_objects )
{ {
vlc_object_t *p_object; vlc_object_t *p_object;
vlc_bool_t b_section_empty = VLC_FALSE; vlc_bool_t b_section_empty = VLC_FALSE;
...@@ -560,33 +546,33 @@ void Menu::Populate( int i_count, char **ppsz_varnames, int *pi_objects ) ...@@ -560,33 +546,33 @@ void Menu::Populate( int i_count, char **ppsz_varnames, int *pi_objects )
i_item_id = i_start_id; i_item_id = i_start_id;
for( i = 0; i < i_count; i++ ) for( i = 0; i < rai_objects.size() ; i++ )
{ {
if( !ppsz_varnames[i] ) if( ras_varnames[i] == "" )
{ {
if( b_section_empty ) if( b_section_empty )
{ {
Append( MenuDummy_Event + i, wxU(_("Empty")) ); Append( MenuDummy_Event + i, wxU(_("Empty")) );
Enable( MenuDummy_Event + i, FALSE ); Enable( MenuDummy_Event + i, FALSE );
} }
AppendSeparator(); AppendSeparator();
b_section_empty = VLC_TRUE; b_section_empty = VLC_TRUE;
continue; continue;
} }
if( !pi_objects[i] ) if( rai_objects[i] == 0 )
{ {
Append( MenuDummy_Event, wxU(ppsz_varnames[i]) ); Append( MenuDummy_Event, wxU(ras_varnames[i].c_str()) );
b_section_empty = VLC_FALSE; b_section_empty = VLC_FALSE;
continue; continue;
} }
p_object = (vlc_object_t *)vlc_object_get( p_intf, pi_objects[i] ); p_object = (vlc_object_t *)vlc_object_get( p_intf,
rai_objects[i] );
if( p_object == NULL ) continue; if( p_object == NULL ) continue;
b_section_empty = VLC_FALSE; b_section_empty = VLC_FALSE;
CreateMenuItem( this, ppsz_varnames[i], p_object ); CreateMenuItem( this, ras_varnames[i].c_str(), p_object );
vlc_object_release( p_object ); vlc_object_release( p_object );
} }
...@@ -693,7 +679,7 @@ void Menu::CreateMenuItem( wxMenu *menu, char *psz_var, ...@@ -693,7 +679,7 @@ void Menu::CreateMenuItem( wxMenu *menu, char *psz_var,
} }
/* Make sure we want to display the variable */ /* Make sure we want to display the variable */
if( IsMenuEmpty( psz_var, p_object ) ) return; if( IsMenuEmpty( psz_var, p_object ) ) return;
/* Get the descriptive name of the variable */ /* Get the descriptive name of the variable */
var_Change( p_object, psz_var, VLC_VAR_GETTEXT, &text, NULL ); var_Change( p_object, psz_var, VLC_VAR_GETTEXT, &text, NULL );
......
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