1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright (C) 2000-2004 the VideoLAN team
5 * $Id: menus.cpp 15858 2006-06-09 21:35:13Z gbazin $
7 * Authors: ClÃment Stenac <zorglub@videolan.org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
25 #include "dialogs_provider.hpp"
28 #include <QActionGroup>
29 #include <QSignalMapper>
38 static QActionGroup *currentGroup;
40 /*****************************************************************************
42 * These create already mapped and connected menus
43 *****************************************************************************/
45 #define STATIC_ADD( text, help, icon, slot ) { QAction *action = menu->addAction( text, THEDP, SLOT( slot ) ); }
47 QMenu *QVLCMenu::FileMenu()
49 QMenu *menu = new QMenu();
51 STATIC_ADD( _("Quick &Open File...") , "", NULL, simpleOpenDialog() );
52 STATIC_ADD( _("&Advanced Open..." ), "", NULL, openDialog() );
54 STATIC_ADD( _("Streaming..."), "", NULL, streamingDialog() );
56 STATIC_ADD( _("&Quit") , "", NULL, quit() );
62 QMenu *OpenStreamMenu( intf_thread_t *p_intf )
64 QMenu *menu = new QMenu;
65 menu->Append( OpenFileSimple_Event, wxU(_("Quick &Open File...")) );
66 menu->Append( OpenFile_Event, wxU(_("Open &File...")) );
67 menu->Append( OpenDirectory_Event, wxU(_("Open D&irectory...")) );
68 menu->Append( OpenDisc_Event, wxU(_("Open &Disc...")) );
69 menu->Append( OpenNet_Event, wxU(_("Open &Network Stream...")) );
70 menu->Append( OpenCapture_Event, wxU(_("Open &Capture Device...")) );
74 wxMenu *MiscMenu( intf_thread_t *p_intf )
76 wxMenu *menu = new wxMenu;
77 menu->Append( MediaInfo_Event, wxU(_("Media &Info...")) );
78 menu->Append( Messages_Event, wxU(_("&Messages...")) );
79 menu->Append( Preferences_Event, wxU(_("&Preferences...")) );
84 /*****************************************************************************
85 * Builders for the dynamic menus
86 *****************************************************************************/
87 #define PUSH_VAR( var ) rs_varnames.push_back( var ); \
88 ri_objects.push_back( p_object->i_object_id )
90 static int InputAutoMenuBuilder( vlc_object_t *p_object,
91 vector<int> &ri_objects,
92 vector<const char *> &rs_varnames )
94 PUSH_VAR( "bookmark");
96 PUSH_VAR ("chapter" );
97 PUSH_VAR( "program" );
98 PUSH_VAR( "navigation" );
99 PUSH_VAR( "dvd_menus" );
103 static int VideoAutoMenuBuilder( vlc_object_t *p_object,
104 vector<int> &ri_objects,
105 vector<const char *> &rs_varnames )
107 PUSH_VAR( "fullscreen" );
109 PUSH_VAR( "deinterlace" );
110 PUSH_VAR( "aspect-ratio" );
112 PUSH_VAR( "video-on-top" );
113 PUSH_VAR( "directx-wallpaper" );
114 PUSH_VAR( "video-snapshot" );
116 vlc_object_t *p_dec_obj = (vlc_object_t *)vlc_object_find( p_object,
119 if( p_dec_obj != NULL )
121 PUSH_VAR( "ffmpeg-pp-q" );
122 vlc_object_release( p_dec_obj );
127 static int AudioAutoMenuBuilder( vlc_object_t *p_object,
128 vector<int> &ri_objects,
129 vector<const char *> &rs_varnames )
131 PUSH_VAR( "audio-device" );
132 PUSH_VAR( "audio-channels" );
133 PUSH_VAR( "visual" );
134 PUSH_VAR( "equalizer" );
138 static int IntfAutoMenuBuilder( intf_thread_t *p_intf, vector<int> &ri_objects,
139 vector<const char *> &rs_varnames, bool is_popup )
141 /* vlc_object_find is needed because of the dialogs provider case */
142 vlc_object_t *p_object;
143 p_object = (vlc_object_t *)vlc_object_find( p_intf, VLC_OBJECT_INTF,
145 if( p_object != NULL )
149 PUSH_VAR( "intf-switch" );
153 PUSH_VAR( "intf-switch" );
155 PUSH_VAR( "intf-add" );
156 PUSH_VAR( "intf-skins" );
157 vlc_object_release( p_object );
163 /*****************************************************************************
165 *****************************************************************************/
167 #define PUSH_VAR( var ) as_varnames.push_back( var ); \
168 ai_objects.push_back( p_object->i_object_id )
170 #define PUSH_SEPARATOR if( ai_objects.size() != i_last_separator ) { \
171 ai_objects.push_back( 0 ); \
172 as_varnames.push_back( "" ); \
173 i_last_separator = ai_objects.size(); }
175 #define POPUP_BOILERPLATE \
176 unsigned int i_last_separator = 0; \
177 vector<int> ai_objects; \
178 vector<const char *> as_varnames; \
179 playlist_t *p_playlist = (playlist_t *) vlc_object_find( p_intf, \
180 VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );\
183 input_thread_t *p_input = p_playlist->p_input
185 #define CREATE_POPUP \
186 QMenu *popupmenu = new QMenu(); \
187 QVLCMenu::Populate( popupmenu, as_varnames, ai_objects ); \
188 p_intf->p_sys->p_popup_menu = &popupmenu; \
189 p_intf->p_sys->p_popup_menu = NULL; \
190 i_last_separator = 0 // stop compiler warning
191 /// p_parent->PopupMenu( &popupmenu, pos.x, pos.y ); \ /// TODO
193 #define POPUP_STATIC_ENTRIES \
194 if( p_input != NULL ) \
197 popupmenu.InsertSeparator( 0 ); \
198 popupmenu.Insert( 0, Stop_Event, wxU(_("Stop")) ); \
199 popupmenu.Insert( 0, Previous_Event, wxU(_("Previous")) ); \
200 popupmenu.Insert( 0, Next_Event, wxU(_("Next")) ); \
201 var_Get( p_input, "state", &val ); \
202 if( val.i_int == PAUSE_S ) \
203 popupmenu.Insert( 0, Play_Event, wxU(_("Play")) ); \
205 popupmenu.Insert( 0, Pause_Event, wxU(_("Pause")) ); \
207 vlc_object_release( p_input ); \
211 if( p_playlist && p_playlist->i_size ) \
213 popupmenu.InsertSeparator( 0 ); \
214 popupmenu.Insert( 0, Play_Event, wxU(_("Play")) ); \
216 if( p_playlist ) vlc_object_release( p_playlist ); \
219 popupmenu.Append( MenuDummy_Event, wxU(_("Miscellaneous")), \
220 MiscMenu( p_intf ), wxT("") )
222 void QVLCMenu::VideoPopupMenu( intf_thread_t *p_intf, const QPoint &pos )
227 vlc_object_yield( p_input );
228 as_varnames.push_back( "video-es" );
229 ai_objects.push_back( p_input->i_object_id );
230 as_varnames.push_back( "spu-es" );
231 ai_objects.push_back( p_input->i_object_id );
232 vlc_object_t *p_vout = (vlc_object_t *)vlc_object_find( p_input,
233 VLC_OBJECT_VOUT, FIND_CHILD );
236 VideoAutoMenuBuilder( p_vout, ai_objects, as_varnames );
237 vlc_object_release( p_vout );
239 vlc_object_release( p_input );
241 vlc_object_release( p_playlist );
245 void QVLCMenu::AudioPopupMenu( intf_thread_t *p_intf, const QPoint &pos )
250 vlc_object_yield( p_input );
251 as_varnames.push_back( "audio-es" );
252 ai_objects.push_back( p_input->i_object_id );
253 vlc_object_t *p_aout = (vlc_object_t *)vlc_object_find( p_input,
254 VLC_OBJECT_AOUT, FIND_ANYWHERE );
257 AudioAutoMenuBuilder( p_aout, ai_objects, as_varnames );
258 vlc_object_release( p_aout );
260 vlc_object_release( p_input );
262 vlc_object_release( p_playlist );
267 /* Navigation stuff, and general */
268 static void MiscPopupMenu( intf_thread_t *p_intf, const QPoint &pos )
273 vlc_object_yield( p_input );
274 as_varnames.push_back( "audio-es" );
275 InputAutoMenuBuilder( VLC_OBJECT(p_input), ai_objects, as_varnames );
278 IntfAutoMenuBuilder( p_intf, ai_objects, as_varnames, true );
280 Menu popupmenu( p_intf, PopupMenu_Events );
281 popupmenu.Populate( as_varnames, ai_objects );
283 POPUP_STATIC_ENTRIES;
284 popupmenu.Append( MenuDummy_Event, wxU(_("Open")),
285 OpenStreamMenu( p_intf ), wxT("") );
287 p_intf->p_sys->p_popup_menu = &popupmenu;
288 p_parent->PopupMenu( &popupmenu, pos.x, pos.y );
289 p_intf->p_sys->p_popup_menu = NULL;
290 vlc_object_release( p_playlist );
293 void PopupMenu( intf_thread_t *p_intf, wxWindow *p_parent,
299 vlc_object_yield( p_input );
300 InputAutoMenuBuilder( VLC_OBJECT(p_input), ai_objects, as_varnames );
304 as_varnames.push_back( "video-es" );
305 ai_objects.push_back( p_input->i_object_id );
306 as_varnames.push_back( "spu-es" );
307 ai_objects.push_back( p_input->i_object_id );
308 vlc_object_t *p_vout = (vlc_object_t *)vlc_object_find( p_input,
309 VLC_OBJECT_VOUT, FIND_CHILD );
312 VideoAutoMenuBuilder( p_vout, ai_objects, as_varnames );
313 vlc_object_release( p_vout );
317 as_varnames.push_back( "audio-es" );
318 ai_objects.push_back( p_input->i_object_id );
319 vlc_object_t *p_aout = (vlc_object_t *)vlc_object_find( p_input,
320 VLC_OBJECT_AOUT, FIND_ANYWHERE );
323 AudioAutoMenuBuilder( p_aout, ai_objects, as_varnames );
324 vlc_object_release( p_aout );
330 IntfAutoMenuBuilder( p_intf, ai_objects, as_varnames, true );
333 Menu popupmenu( p_intf, PopupMenu_Events );
334 popupmenu.Populate( as_varnames, ai_objects );
335 POPUP_STATIC_ENTRIES;
337 popupmenu.Append( MenuDummy_Event, wxU(_("Open")),
338 OpenStreamMenu( p_intf ), wxT("") );
339 p_intf->p_sys->p_popup_menu = &popupmenu;
340 p_parent->PopupMenu( &popupmenu, pos.x, pos.y );
341 p_intf->p_sys->p_popup_menu = NULL;
342 vlc_object_release( p_playlist );
346 /*****************************************************************************
348 *****************************************************************************/
349 QMenu *QVLCMenu::AudioMenu( intf_thread_t *p_intf, QMenu * current )
351 vector<int> ai_objects;
352 vector<const char *> as_varnames;
354 vlc_object_t *p_object = (vlc_object_t *)vlc_object_find( p_intf,
355 VLC_OBJECT_INPUT, FIND_ANYWHERE );
356 if( p_object != NULL )
358 PUSH_VAR( "audio-es" );
359 vlc_object_release( p_object );
362 p_object = (vlc_object_t *)vlc_object_find( p_intf, VLC_OBJECT_AOUT,
366 AudioAutoMenuBuilder( p_object, ai_objects, as_varnames );
367 vlc_object_release( p_object );
369 return Populate( p_intf, current, as_varnames, ai_objects );
373 QMenu *QVLCMenu::VideoMenu( intf_thread_t *p_intf, QMenu *current )
375 vlc_object_t *p_object;
376 vector<int> ai_objects;
377 vector<const char *> as_varnames;
379 p_object = (vlc_object_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT,
381 if( p_object != NULL )
383 PUSH_VAR( "video-es" );
384 PUSH_VAR( "spu-es" );
385 vlc_object_release( p_object );
388 p_object = (vlc_object_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT,
390 if( p_object != NULL )
392 VideoAutoMenuBuilder( p_object, ai_objects, as_varnames );
393 vlc_object_release( p_object );
395 return Populate( p_intf, current, as_varnames, ai_objects );
398 QMenu *QVLCMenu::NavigMenu( intf_thread_t *p_intf, QMenu *current )
400 vlc_object_t *p_object;
401 vector<int> ai_objects;
402 vector<const char *> as_varnames;
404 p_object = (vlc_object_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT,
406 if( p_object != NULL )
408 InputAutoMenuBuilder( p_object, ai_objects, as_varnames );
409 PUSH_VAR( "prev-title"); PUSH_VAR ( "next-title" );
410 PUSH_VAR( "prev-chapter"); PUSH_VAR( "next-chapter" );
411 vlc_object_release( p_object );
413 return Populate( p_intf, current, as_varnames, ai_objects );
416 wxMenu *SettingsMenu( intf_thread_t *_p_intf, wxWindow *p_parent,
419 vlc_object_t *p_object;
420 vector<int> ai_objects;
421 vector<const char *> as_varnames;
423 p_object = (vlc_object_t *)vlc_object_find( _p_intf, VLC_OBJECT_INTF,
425 if( p_object != NULL )
427 PUSH_VAR( "intf-switch" );
428 PUSH_VAR( "intf-add" );
429 vlc_object_release( p_object );
433 Menu *p_vlc_menu = (Menu *)p_menu;
435 p_vlc_menu = new Menu( _p_intf, SettingsMenu_Events );
439 p_vlc_menu->Populate( as_varnames, ai_objects );
445 QMenu * QVLCMenu::Populate( intf_thread_t *p_intf, QMenu *current,
446 vector< const char *> & ras_varnames,
447 vector<int> & rai_objects )
449 QMenu *menu = current;
457 vlc_object_t *p_object;
458 vlc_bool_t b_section_empty = VLC_FALSE;
461 #define APPEND_EMPTY { QAction *action = menu->addAction( _("Empty" ) ); \
462 action->setEnabled( false ); }
464 for( i = 0; i < (int)rai_objects.size() ; i++ )
466 if( !ras_varnames[i] || !*ras_varnames[i] )
468 if( b_section_empty )
470 menu->addSeparator();
471 b_section_empty = VLC_TRUE;
475 if( rai_objects[i] == 0 )
477 /// \bug What is this ?
478 // Append( menu, ras_varnames[i], NULL );
479 b_section_empty = VLC_FALSE;
483 p_object = (vlc_object_t *)vlc_object_get( p_intf,
485 if( p_object == NULL ) continue;
487 b_section_empty = VLC_FALSE;
488 CreateItem( menu, ras_varnames[i], p_object );
489 vlc_object_release( p_object );
492 /* Special case for empty menus */
493 if( menu->actions().size() == 0 || b_section_empty )
499 /*****************************************************************************
501 *****************************************************************************/
503 #define FREE(x) if(x) { free(x);x=NULL;}
505 static bool IsMenuEmpty( const char *psz_var, vlc_object_t *p_object,
508 vlc_value_t val, val_list;
509 int i_type, i_result, i;
511 /* Check the type of the object variable */
512 i_type = var_Type( p_object, psz_var );
514 /* Check if we want to display the variable */
515 if( !(i_type & VLC_VAR_HASCHOICE) ) return FALSE;
517 var_Change( p_object, psz_var, VLC_VAR_CHOICESCOUNT, &val, NULL );
518 if( val.i_int == 0 ) return TRUE;
520 if( (i_type & VLC_VAR_TYPE) != VLC_VAR_VARIABLE )
522 /* Very evil hack ! intf-switch can have only one value */
523 if( !strcmp( psz_var, "intf-switch" ) ) return FALSE;
524 if( val.i_int == 1 && b_root ) return TRUE;
528 /* Check children variables in case of VLC_VAR_VARIABLE */
529 if( var_Change( p_object, psz_var, VLC_VAR_GETLIST, &val_list, NULL ) < 0 )
534 for( i = 0, i_result = TRUE; i < val_list.p_list->i_count; i++ )
536 if( !IsMenuEmpty( val_list.p_list->p_values[i].psz_string,
544 /* clean up everything */
545 var_Change( p_object, psz_var, VLC_VAR_FREELIST, &val_list, NULL );
550 void QVLCMenu::CreateItem( QMenu *menu, const char *psz_var,
551 vlc_object_t *p_object )
554 vlc_value_t val, text;
557 /* Check the type of the object variable */
558 i_type = var_Type( p_object, psz_var );
560 switch( i_type & VLC_VAR_TYPE )
564 case VLC_VAR_VARIABLE:
566 case VLC_VAR_INTEGER:
570 /* Variable doesn't exist or isn't handled */
574 /* Make sure we want to display the variable */
575 if( IsMenuEmpty( psz_var, p_object ) ) return;
577 /* Get the descriptive name of the variable */
578 var_Change( p_object, psz_var, VLC_VAR_GETTEXT, &text, NULL );
580 if( i_type & VLC_VAR_HASCHOICE )
582 /* Append choices menu */
583 QMenu *submenu = CreateChoicesMenu( psz_var, p_object, true );
584 submenu->setTitle( text.psz_string ? text.psz_string : psz_var );
585 menu->addMenu( submenu );
586 FREE( text.psz_string );
590 #define TEXT_OR_VAR text.psz_string ? text.psz_string : psz_var
592 switch( i_type & VLC_VAR_TYPE )
595 var_Get( p_object, psz_var, &val );
596 CreateAndConnect( menu, psz_var, TEXT_OR_VAR, "", ITEM_NORMAL,
597 p_object->i_object_id, val, i_type );
601 var_Get( p_object, psz_var, &val );
602 val.b_bool = !val.b_bool;
603 CreateAndConnect( menu, psz_var, TEXT_OR_VAR, "", ITEM_CHECK,
604 p_object->i_object_id, val, i_type, val.b_bool );
607 FREE( text.psz_string );
611 QMenu *QVLCMenu::CreateChoicesMenu( const char *psz_var,
612 vlc_object_t *p_object, bool b_root )
614 vlc_value_t val, val_list, text_list;
617 /* Check the type of the object variable */
618 i_type = var_Type( p_object, psz_var );
620 /* Make sure we want to display the variable */
621 if( IsMenuEmpty( psz_var, p_object, b_root ) ) return NULL;
623 switch( i_type & VLC_VAR_TYPE )
627 case VLC_VAR_VARIABLE:
629 case VLC_VAR_INTEGER:
633 /* Variable doesn't exist or isn't handled */
637 if( var_Change( p_object, psz_var, VLC_VAR_GETLIST,
638 &val_list, &text_list ) < 0 )
642 #define NORMAL_OR_RADIO i_type & VLC_VAR_ISCOMMAND ? ITEM_NORMAL: ITEM_RADIO
643 #define NOTCOMMAND !(i_type & VLC_VAR_ISCOMMAND)
644 #define CURVAL val_list.p_list->p_values[i]
645 #define CURTEXT text_list.p_list->p_values[i].psz_string
647 QMenu *submenu = new QMenu();
648 for( i = 0; i < val_list.p_list->i_count; i++ )
650 vlc_value_t another_val;
654 switch( i_type & VLC_VAR_TYPE )
656 case VLC_VAR_VARIABLE:
657 subsubmenu = CreateChoicesMenu( CURVAL.psz_string,
659 subsubmenu->setTitle( CURTEXT ? CURTEXT : CURVAL.psz_string );
660 submenu->addMenu( subsubmenu );
664 var_Get( p_object, psz_var, &val );
665 another_val.psz_string = strdup( CURVAL.psz_string );
667 menutext = CURTEXT ? CURTEXT : another_val.psz_string;
668 CreateAndConnect( submenu, psz_var, menutext, "", NORMAL_OR_RADIO,
669 p_object->i_object_id, another_val, i_type,
670 NOTCOMMAND && val.psz_string &&
671 !strcmp( val.psz_string, CURVAL.psz_string ) );
673 if( val.psz_string ) free( val.psz_string );
676 case VLC_VAR_INTEGER:
677 var_Get( p_object, psz_var, &val );
678 if( CURTEXT ) menutext = CURTEXT;
679 else menutext.sprintf( "%d", CURVAL.i_int);
680 CreateAndConnect( submenu, psz_var, menutext, "", NORMAL_OR_RADIO,
681 p_object->i_object_id, CURVAL, i_type,
682 NOTCOMMAND && CURVAL.i_int == val.i_int );
686 var_Get( p_object, psz_var, &val );
687 if( CURTEXT ) menutext = CURTEXT ;
688 else menutext.sprintf( "%.2f", CURVAL.f_float );
689 CreateAndConnect( submenu, psz_var, menutext, "", NORMAL_OR_RADIO,
690 p_object->i_object_id, CURVAL, i_type,
691 NOTCOMMAND && CURVAL.f_float == val.f_float );
699 /* clean up everything */
700 var_Change( p_object, psz_var, VLC_VAR_FREELIST, &val_list, &text_list );
702 #undef NORMAL_OR_RADIO
709 void QVLCMenu::CreateAndConnect( QMenu *menu, const char *psz_var,
710 QString text, QString help,
711 int i_item_type, int i_object_id,
712 vlc_value_t val, int i_val_type,
715 QAction *action = new QAction( text, menu );
716 action->setText( text );
717 action->setToolTip( help );
719 if( i_item_type == ITEM_CHECK )
721 action->setCheckable( true );
724 else if( i_item_type == ITEM_RADIO )
726 action->setCheckable( true );
728 currentGroup = new QActionGroup(menu);
729 currentGroup->addAction( action );
733 if( checked ) action->setChecked( true );
735 MenuItemData *itemData = new MenuItemData( i_object_id, i_val_type,
737 connect( action, SIGNAL(triggered()), THEDP->menusMapper, SLOT(map()) );
738 THEDP->menusMapper->setMapping( action, itemData );
740 menu->addAction( action );
743 void QVLCMenu::DoAction( intf_thread_t *p_intf, QObject *data )
745 MenuItemData *itemData = qobject_cast<MenuItemData *>(data);
747 vlc_object_t *p_object = (vlc_object_t *)vlc_object_get( p_intf,
748 itemData->i_object_id );
749 if( p_object == NULL ) return;
751 var_Set( p_object, itemData->psz_var, itemData->val );
752 vlc_object_release( p_object );
757 void MenuEvtHandler::OnMenuEvent( wxCommandEvent& event )
759 wxMenuItem *p_menuitem = NULL;
760 int i_hotkey_event = p_intf->p_sys->i_first_hotkey_event;
761 int i_hotkeys = p_intf->p_sys->i_hotkeys;
763 if( event.GetId() >= Play_Event && event.GetId() <= Stop_Event )
765 input_thread_t *p_input;
766 playlist_t * p_playlist =
767 (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
769 if( !p_playlist ) return;
771 switch( event.GetId() )
776 (input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT,
778 if( !p_input ) playlist_Play( p_playlist );
782 var_Get( p_input, "state", &val );
783 if( val.i_int != PAUSE_S ) val.i_int = PAUSE_S;
784 else val.i_int = PLAYING_S;
785 var_Set( p_input, "state", val );
786 vlc_object_release( p_input );
790 playlist_Stop( p_playlist );
793 playlist_Prev( p_playlist );
796 playlist_Next( p_playlist );
800 vlc_object_release( p_playlist );
804 /* Check if this is an auto generated menu item */
805 if( event.GetId() < FirstAutoGenerated_Event )
811 /* Check if this is an hotkey event */
812 if( event.GetId() >= i_hotkey_event &&
813 event.GetId() < i_hotkey_event + i_hotkeys )
818 p_intf->p_vlc->p_hotkeys[event.GetId() - i_hotkey_event].i_key;
820 /* Get the key combination and send it to the hotkey handler */
821 var_Set( p_intf->p_vlc, "key-pressed", val );
825 if( !p_main_interface ||
826 (p_menuitem = p_main_interface->GetMenuBar()->FindItem(event.GetId()))
829 if( p_intf->p_sys->p_popup_menu )
832 p_intf->p_sys->p_popup_menu->FindItem( event.GetId() );
838 wxMenuItemExt *p_menuitemext = (wxMenuItemExt *)p_menuitem;
839 vlc_object_t *p_object;
841 p_object = (vlc_object_t *)vlc_object_get( p_intf,
842 p_menuitemext->i_object_id );
843 if( p_object == NULL ) return;
845 wxMutexGuiLeave(); // We don't want deadlocks
846 var_Set( p_object, p_menuitemext->psz_var, p_menuitemext->val );
849 vlc_object_release( p_object );