#include "interface.hpp"
#include <vector>
-#include <string>
using namespace std;
class wxMenuItemExt: public wxMenuItem
Menu( intf_thread_t *p_intf, int i_start_id );
virtual ~Menu();
- void Populate( vector<string> &, vector<int> &);
+ void Populate( vector<const char *> &, vector<int> &);
void Clear();
private:
wxMenu *CreateDummyMenu();
void CreateMenuItem( wxMenu *, const char *, vlc_object_t * );
- wxMenu *CreateChoicesMenu( char *, vlc_object_t *, bool );
+ wxMenu *CreateChoicesMenu( const char *, vlc_object_t *, bool );
DECLARE_EVENT_TABLE();
* Builders for the dynamic menus
*****************************************************************************/
#define PUSH_VAR( var ) rs_varnames.push_back( var ); \
- ri_objects.push_back( p_object->i_object_id );
+ ri_objects.push_back( p_object->i_object_id )
-int InputAutoMenuBuilder( vlc_object_t *p_object,
- vector<int> &ri_objects, vector<string> &rs_varnames )
+int InputAutoMenuBuilder( vlc_object_t *p_object, vector<int> &ri_objects,
+ vector<const char *> &rs_varnames )
{
PUSH_VAR( "bookmark");
PUSH_VAR( "title" );
return VLC_SUCCESS;
}
-int VideoAutoMenuBuilder( vlc_object_t *p_object,
- vector<int> &ri_objects, vector<string> &rs_varnames )
+int VideoAutoMenuBuilder( vlc_object_t *p_object, vector<int> &ri_objects,
+ vector<const char *> &rs_varnames )
{
PUSH_VAR( "fullscreen" );
PUSH_VAR( "zoom" );
return VLC_SUCCESS;
}
-int AudioAutoMenuBuilder( vlc_object_t *p_object,
- vector<int> &ri_objects, vector<string> &rs_varnames )
+int AudioAutoMenuBuilder( vlc_object_t *p_object, vector<int> &ri_objects,
+ vector<const char *> &rs_varnames )
{
PUSH_VAR( "audio-device" );
PUSH_VAR( "audio-channels" );
return VLC_SUCCESS;
}
-int IntfAutoMenuBuilder( intf_thread_t *p_intf,
- vector<int> &ri_objects, vector<string> &rs_varnames,
- bool is_popup)
+int IntfAutoMenuBuilder( intf_thread_t *p_intf, vector<int> &ri_objects,
+ vector<const char *> &rs_varnames, bool is_popup)
{
/* vlc_object_find is needed because of the dialogs provider case */
vlc_object_t *p_object;
* Popup menus
*****************************************************************************/
#define PUSH_VAR( var ) as_varnames.push_back( var ); \
- ai_objects.push_back( p_object->i_object_id );
+ 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( "" ); \
#define POPUP_BOILERPLATE \
unsigned int i_last_separator = 0; \
vector<int> ai_objects; \
- vector<string> as_varnames; \
+ vector<const char *> 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;
+ input_thread_t *p_input = p_playlist->p_input
#define CREATE_POPUP \
Menu popupmenu( p_intf, PopupMenu_Events ); \
p_intf->p_sys->p_popup_menu = &popupmenu; \
p_parent->PopupMenu( &popupmenu, pos.x, pos.y ); \
p_intf->p_sys->p_popup_menu = NULL; \
+ i_last_separator = 0 /* stop compiler warning */
#define POPUP_STATIC_ENTRIES \
if( p_input != NULL ) \
} \
\
popupmenu.Append( MenuDummy_Event, wxU(_("Miscellaneous")), \
- MiscMenu( p_intf ), wxT("") ); \
+ MiscMenu( p_intf ), wxT("") )
void VideoPopupMenu( intf_thread_t *p_intf, wxWindow *p_parent,
{
vlc_object_t *p_object;
vector<int> ai_objects;
- vector<string> as_varnames;
+ vector<const char *> as_varnames;
p_object = (vlc_object_t *)vlc_object_find( _p_intf, VLC_OBJECT_INPUT,
FIND_ANYWHERE );
{
vlc_object_t *p_object;
vector<int> ai_objects;
- vector<string> as_varnames;
+ vector<const char *> as_varnames;
p_object = (vlc_object_t *)vlc_object_find( _p_intf, VLC_OBJECT_INPUT,
FIND_ANYWHERE );
{
vlc_object_t *p_object;
vector<int> ai_objects;
- vector<string> as_varnames;
+ vector<const char *> as_varnames;
p_object = (vlc_object_t *)vlc_object_find( _p_intf, VLC_OBJECT_INPUT,
FIND_ANYWHERE );
{
vlc_object_t *p_object;
vector<int> ai_objects;
- vector<string> as_varnames;
+ vector<const char *> as_varnames;
p_object = (vlc_object_t *)vlc_object_find( _p_intf, VLC_OBJECT_INTF,
FIND_PARENT );
/*****************************************************************************
* Public methods.
*****************************************************************************/
-void Menu::Populate( vector<string> & ras_varnames, vector<int> & rai_objects )
+void Menu::Populate( vector<const char *> & ras_varnames,
+ vector<int> & rai_objects )
{
vlc_object_t *p_object;
vlc_bool_t b_section_empty = VLC_FALSE;
i_item_id = i_start_id;
- for( i = 0; i < rai_objects.size() ; i++ )
+ for( i = 0; i < (int)rai_objects.size() ; i++ )
{
- if( ras_varnames[i] == "" )
+ if( !ras_varnames[i] || !*ras_varnames[i] )
{
if( b_section_empty )
{
if( rai_objects[i] == 0 )
{
- Append( MenuDummy_Event, wxU(ras_varnames[i].c_str()) );
+ Append( MenuDummy_Event, wxU(ras_varnames[i]) );
b_section_empty = VLC_FALSE;
continue;
}
if( p_object == NULL ) continue;
b_section_empty = VLC_FALSE;
- CreateMenuItem( this, ras_varnames[i].c_str(), p_object );
+ CreateMenuItem( this, ras_varnames[i], p_object );
vlc_object_release( p_object );
}
/*****************************************************************************
* Private methods.
*****************************************************************************/
-static bool IsMenuEmpty( char *psz_var, vlc_object_t *p_object,
+static bool IsMenuEmpty( const char *psz_var, vlc_object_t *p_object,
bool b_root = TRUE )
{
vlc_value_t val, val_list;
if( text.psz_string ) free( text.psz_string );
}
-wxMenu *Menu::CreateChoicesMenu( char *psz_var, vlc_object_t *p_object,
+wxMenu *Menu::CreateChoicesMenu( const char *psz_var, vlc_object_t *p_object,
bool b_root )
{
vlc_value_t val, val_list, text_list;