1 /*****************************************************************************
2 * gtk_menu.c : functions to handle menu items.
3 *****************************************************************************
4 * Copyright (C) 2000, 2001 VideoLAN
5 * $Id: gtk_menu.c,v 1.1 2001/05/15 01:01:44 stef Exp $
7 * Authors: Samuel Hocevar <sam@zoy.org>
8 * Stéphane Borel <stef@via.ecp.fr>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
23 *****************************************************************************/
25 #define MODULE_NAME gtk
26 #include "modules_inner.h"
28 /*****************************************************************************
30 *****************************************************************************/
32 #include <sys/types.h> /* off_t */
44 #include "stream_control.h"
45 #include "input_ext-intf.h"
47 #include "interface.h"
48 #include "intf_playlist.h"
52 #include "video_output.h"
53 #include "audio_output.h"
55 #include "gtk_callbacks.h"
56 #include "gtk_interface.h"
57 #include "gtk_support.h"
58 #include "gtk_playlist.h"
63 /****************************************************************************
64 * Gtk*Toggle: callbacks to toggle the value of a checkmenuitem
65 ****************************************************************************
66 * We need separate functions for menubar and popup here since we can't use
67 * user_data to transmit intf_*
68 ****************************************************************************/
70 #define GtkLangToggle( b_update ) \
71 es_descriptor_t * p_es; \
75 p_es = (es_descriptor_t*)user_data; \
77 input_ToggleES( p_intf->p_input, p_es, menuitem->active ); \
79 b_update = menuitem->active; \
86 void GtkMenubarAudioToggle( GtkCheckMenuItem * menuitem, gpointer user_data )
88 intf_thread_t * p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
90 GtkLangToggle( p_intf->p_sys->b_audio_update );
93 void GtkPopupAudioToggle( GtkCheckMenuItem * menuitem, gpointer user_data )
95 intf_thread_t * p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
97 GtkLangToggle( p_intf->p_sys->b_audio_update );
105 void GtkMenubarSubtitleToggle( GtkCheckMenuItem * menuitem, gpointer user_data )
107 intf_thread_t * p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
109 GtkLangToggle( p_intf->p_sys->b_spu_update );
111 void GtkPopupSubtitleToggle( GtkCheckMenuItem * menuitem, gpointer user_data )
113 intf_thread_t * p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
115 GtkLangToggle( p_intf->p_sys->b_spu_update );
121 void GtkPopupNavigationToggle( GtkCheckMenuItem * menuitem,
124 intf_thread_t * p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
126 if( menuitem->active &&
127 !p_intf->p_sys->b_title_update &&
128 !p_intf->p_sys->b_chapter_update )
130 input_area_t *p_area = p_intf->p_input->stream.p_selected_area;
132 gint i_title = DATA2TITLE( user_data );
133 gint i_chapter = DATA2CHAPTER( user_data );
135 if( p_area != p_intf->p_input->stream.pp_areas[i_title] )
137 p_area = p_intf->p_input->stream.pp_areas[i_title];
138 p_intf->p_sys->b_title_update = 1;
141 p_area->i_part = i_chapter;
142 p_intf->p_sys->b_chapter_update = 1;
144 p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)p_area );
146 input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
154 #define GtkTitleToggle( intf ) \
155 intf_thread_t * p_intf = GetIntf( GTK_WIDGET(menuitem), (intf) ); \
157 if( menuitem->active && !p_intf->p_sys->b_title_update ) \
159 gint i_title = (gint)user_data; \
160 p_intf->p_input->pf_set_area( p_intf->p_input, \
161 p_intf->p_input->stream.pp_areas[i_title] ); \
163 input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY ); \
165 p_intf->p_sys->b_title_update = 1; \
168 void GtkMenubarTitleToggle( GtkCheckMenuItem * menuitem, gpointer user_data )
170 GtkTitleToggle( "intf_window" );
173 void GtkPopupTitleToggle( GtkCheckMenuItem * menuitem, gpointer user_data )
175 GtkTitleToggle( "intf_popup" );
182 #define GtkChapterToggle( intf ) \
183 intf_thread_t * p_intf; \
184 input_area_t * p_area; \
186 char psz_chapter[5]; \
188 p_intf = GetIntf( GTK_WIDGET(menuitem), (intf) ); \
189 p_area = p_intf->p_input->stream.p_selected_area; \
190 i_chapter = (gint)user_data; \
192 if( menuitem->active && !p_intf->p_sys->b_chapter_update ) \
194 p_area->i_part = i_chapter; \
195 p_intf->p_input->pf_set_area( p_intf->p_input, \
196 (input_area_t*)p_area ); \
198 snprintf( psz_chapter, 3, "%02d", p_area->i_part ); \
199 gtk_label_set_text( p_intf->p_sys->p_label_chapter, psz_chapter ); \
201 input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY ); \
203 p_intf->p_sys->b_chapter_update = 1; \
207 void GtkMenubarChapterToggle( GtkCheckMenuItem * menuitem, gpointer user_data )
209 GtkChapterToggle( "intf_window" );
212 void GtkPopupChapterToggle( GtkCheckMenuItem * menuitem, gpointer user_data )
214 GtkChapterToggle( "intf_popup" );
221 #define GtkAngleToggle( intf ) \
222 intf_thread_t * p_intf; \
223 input_area_t * p_area; \
226 p_intf = GetIntf( GTK_WIDGET(menuitem), (intf) ); \
227 p_area = p_intf->p_input->stream.p_selected_area; \
228 i_angle = (gint)user_data; \
230 if( menuitem->active && !p_intf->p_sys->b_angle_update ) \
232 p_area->i_angle = i_angle; \
233 p_intf->p_input->pf_set_area( p_intf->p_input, \
234 (input_area_t*)p_area ); \
236 p_intf->p_sys->b_angle_update = 1; \
239 void GtkMenubarAngleToggle( GtkCheckMenuItem * menuitem, gpointer user_data )
241 GtkAngleToggle( "intf_window" )
244 void GtkPopupAngleToggle( GtkCheckMenuItem * menuitem, gpointer user_data )
246 GtkAngleToggle( "intf_popup" )
249 /****************************************************************************
250 * Functions to generate menus
251 ****************************************************************************/
253 /*****************************************************************************
254 * GtkRadioMenu: update interactive menus of the interface
255 *****************************************************************************
256 * Sets up menus with information from input
257 * Warning: since this function is designed to be called by management
258 * function, the interface lock has to be taken
259 *****************************************************************************/
260 static gint GtkRadioMenu( intf_thread_t * p_intf,
261 GtkWidget * p_root, GSList * p_menu_group,
262 char * psz_item_name,
263 int i_nb, int i_selected,
264 void( *pf_toggle )( GtkCheckMenuItem *, gpointer ) )
266 char psz_name[ GTK_MENU_LABEL_SIZE ];
268 GtkWidget * p_submenu;
269 GtkWidget * p_item_group;
271 GtkWidget * p_item_selected;
275 /* temporary hack to avoid blank menu when an open menu is removed */
276 if( GTK_MENU_ITEM(p_root)->submenu != NULL )
278 gtk_menu_popdown( GTK_MENU( GTK_MENU_ITEM(p_root)->submenu ) );
280 /* removes previous menu */
281 gtk_menu_item_remove_submenu( GTK_MENU_ITEM( p_root ) );
282 gtk_widget_set_sensitive( p_root, FALSE );
286 p_item_selected = NULL;
287 p_group = p_menu_group;
289 p_menu = gtk_menu_new();
291 for( i_item = 0 ; i_item < i_nb ; i_item++ )
293 /* we group chapters in packets of ten for small screens */
294 if( ( i_item % 10 == 0 ) && ( i_nb > 20 ) )
298 gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_item_group ),
300 gtk_menu_append( GTK_MENU( p_menu ), p_item_group );
303 snprintf( psz_name, GTK_MENU_LABEL_SIZE,
304 "%ss %d to %d", psz_item_name, i_item + 1, i_item + 10);
305 psz_name[ GTK_MENU_LABEL_SIZE - 1 ] = '\0';
306 p_item_group = gtk_menu_item_new_with_label( psz_name );
307 gtk_widget_show( p_item_group );
308 p_submenu = gtk_menu_new();
311 snprintf( psz_name, GTK_MENU_LABEL_SIZE, "%s %d",
312 psz_item_name, i_item + 1 );
313 psz_name[ GTK_MENU_LABEL_SIZE - 1 ] = '\0';
315 p_item = gtk_radio_menu_item_new_with_label( p_group, psz_name );
316 p_group = gtk_radio_menu_item_group( GTK_RADIO_MENU_ITEM( p_item ) );
318 if( i_selected == i_item + 1 )
320 p_item_selected = p_item;
323 gtk_widget_show( p_item );
325 /* setup signal hanling */
326 gtk_signal_connect( GTK_OBJECT( p_item ),
328 GTK_SIGNAL_FUNC( pf_toggle ),
329 (gpointer)(i_item + 1) );
333 gtk_menu_append( GTK_MENU( p_submenu ), p_item );
337 gtk_menu_append( GTK_MENU( p_menu ), p_item );
343 gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_item_group ), p_submenu );
344 gtk_menu_append( GTK_MENU( p_menu ), p_item_group );
347 /* link the new menu to the title menu item */
348 gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_root ), p_menu );
350 /* toggle currently selected chapter */
351 if( p_item_selected != NULL )
353 gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( p_item_selected ),
357 /* be sure that menu is sensitive, if there are several items */
360 gtk_widget_set_sensitive( p_root, TRUE );
366 /*****************************************************************************
367 * GtkLanguageMenus: update interactive menus of the interface
368 *****************************************************************************
369 * Sets up menus with information from input:
372 * Warning: since this function is designed to be called by management
373 * function, the interface lock has to be taken
374 *****************************************************************************/
375 static gint GtkLanguageMenus( gpointer p_data,
377 es_descriptor_t * p_es,
379 void(*pf_toggle )( GtkCheckMenuItem *, gpointer ) )
381 intf_thread_t * p_intf;
383 GtkWidget * p_separator;
385 GtkWidget * p_item_active;
387 char psz_name[ GTK_MENU_LABEL_SIZE ];
394 p_intf = (intf_thread_t *)p_data;
396 /* temporary hack to avoid blank menu when an open menu is removed */
397 if( GTK_MENU_ITEM(p_root)->submenu != NULL )
399 gtk_menu_popdown( GTK_MENU( GTK_MENU_ITEM(p_root)->submenu ) );
401 /* removes previous menu */
402 gtk_menu_item_remove_submenu( GTK_MENU_ITEM( p_root ) );
403 gtk_widget_set_sensitive( p_root, FALSE );
408 p_menu = gtk_menu_new();
410 /* special case for "off" item */
411 snprintf( psz_name, GTK_MENU_LABEL_SIZE, "None" );
412 psz_name[ GTK_MENU_LABEL_SIZE - 1 ] = '\0';
414 p_item = gtk_radio_menu_item_new_with_label( p_group, psz_name );
415 p_group = gtk_radio_menu_item_group( GTK_RADIO_MENU_ITEM( p_item ) );
417 gtk_widget_show( p_item );
419 /* signal hanling for off */
420 gtk_signal_connect( GTK_OBJECT( p_item ), "toggled",
421 GTK_SIGNAL_FUNC ( pf_toggle ), NULL );
423 gtk_menu_append( GTK_MENU( p_menu ), p_item );
425 p_separator = gtk_menu_item_new();
426 gtk_widget_set_sensitive( p_separator, FALSE );
427 gtk_widget_show( p_separator );
428 gtk_menu_append( GTK_MENU( p_menu ), p_separator );
430 vlc_mutex_lock( &p_intf->p_input->stream.stream_lock );
431 p_item_active = NULL;
434 /* create a set of language buttons and append them to the container */
435 for( i = 0 ; i < p_intf->p_input->stream.i_es_number ; i++ )
437 if( p_intf->p_input->stream.pp_es[i]->i_cat == i_cat )
440 strcpy( psz_name, p_intf->p_input->stream.pp_es[i]->psz_desc );
441 if( psz_name[0] == '\0' )
443 snprintf( psz_name, GTK_MENU_LABEL_SIZE,
444 "Language %d", i_item );
445 psz_name[ GTK_MENU_LABEL_SIZE - 1 ] = '\0';
448 p_item = gtk_radio_menu_item_new_with_label( p_group, psz_name );
450 gtk_radio_menu_item_group( GTK_RADIO_MENU_ITEM( p_item ) );
452 if( p_es == p_intf->p_input->stream.pp_es[i] )
454 /* don't lose p_item when we append into menu */
455 p_item_active = p_item;
458 gtk_widget_show( p_item );
460 /* setup signal hanling */
461 gtk_signal_connect( GTK_OBJECT( p_item ), "toggled",
462 GTK_SIGNAL_FUNC( pf_toggle ),
463 (gpointer)( p_intf->p_input->stream.pp_es[i] ) );
465 gtk_menu_append( GTK_MENU( p_menu ), p_item );
469 vlc_mutex_unlock( &p_intf->p_input->stream.stream_lock );
471 /* link the new menu to the menubar item */
472 gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_root ), p_menu );
474 /* acitvation will call signals so we can only do it
475 * when submenu is attached to menu - to get intf_window */
476 if( p_item_active != NULL )
478 gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( p_item_active ),
482 /* be sure that menu is sensitive if non empty */
485 gtk_widget_set_sensitive( p_root, TRUE );
491 /*****************************************************************************
492 * GtkTitleMenu: sets menus for titles and chapters selection
493 *****************************************************************************
494 * Generates two types of menus:
495 * -simple list of titles
496 * -cascaded lists of chapters for each title
497 *****************************************************************************/
498 static gint GtkTitleMenu( gpointer p_data,
499 GtkWidget * p_navigation,
500 void(*pf_toggle )( GtkCheckMenuItem *, gpointer ) )
502 intf_thread_t * p_intf;
503 char psz_name[ GTK_MENU_LABEL_SIZE ];
504 GtkWidget * p_title_menu;
505 GtkWidget * p_title_submenu;
506 GtkWidget * p_title_item;
507 GtkWidget * p_item_active;
508 GtkWidget * p_chapter_menu;
509 GtkWidget * p_chapter_submenu;
510 GtkWidget * p_title_menu_item;
511 GtkWidget * p_chapter_menu_item;
513 GSList * p_title_group;
514 GSList * p_chapter_group;
521 p_intf = (intf_thread_t*)p_data;
523 /* temporary hack to avoid blank menu when an open menu is removed */
524 if( GTK_MENU_ITEM(p_navigation)->submenu != NULL )
526 gtk_menu_popdown( GTK_MENU( GTK_MENU_ITEM(p_navigation)->submenu ) );
528 /* removes previous menu */
529 gtk_menu_item_remove_submenu( GTK_MENU_ITEM( p_navigation ) );
530 gtk_widget_set_sensitive( p_navigation, FALSE );
532 p_title_menu = gtk_menu_new();
533 p_title_group = NULL;
534 p_title_submenu = NULL;
535 p_title_menu_item = NULL;
536 p_chapter_group = NULL;
537 p_chapter_submenu = NULL;
538 p_chapter_menu_item = NULL;
539 p_item_active = NULL;
540 i_title_nb = p_intf->p_input->stream.i_area_nb;
543 for( i_title = 1 ; i_title < i_title_nb ; i_title++ )
545 /* we group titles in packets of ten for small screens */
546 if( ( i_title % 10 == 1 ) && ( i_title_nb > 20 ) )
550 gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_title_menu_item ),
552 gtk_menu_append( GTK_MENU( p_title_menu ), p_title_menu_item );
555 snprintf( psz_name, GTK_MENU_LABEL_SIZE,
556 "%d - %d", i_title, i_title + 9 );
557 psz_name[ GTK_MENU_LABEL_SIZE - 1 ] = '\0';
558 p_title_menu_item = gtk_menu_item_new_with_label( psz_name );
559 gtk_widget_show( p_title_menu_item );
560 p_title_submenu = gtk_menu_new();
563 snprintf( psz_name, GTK_MENU_LABEL_SIZE, "Title %d (%d)", i_title,
564 p_intf->p_input->stream.pp_areas[i_title]->i_part_nb );
565 psz_name[ GTK_MENU_LABEL_SIZE - 1 ] = '\0';
567 if( pf_toggle == on_menubar_title_toggle )
569 p_title_item = gtk_radio_menu_item_new_with_label( p_title_group,
572 gtk_radio_menu_item_group( GTK_RADIO_MENU_ITEM( p_title_item ) );
574 if( p_intf->p_input->stream.pp_areas[i_title] ==
575 p_intf->p_input->stream.p_selected_area )
577 p_item_active = p_title_item;
580 /* setup signal hanling */
581 gtk_signal_connect( GTK_OBJECT( p_title_item ),
583 GTK_SIGNAL_FUNC( pf_toggle ),
584 (gpointer)(p_intf->p_input->stream.pp_areas[i_title]) );
586 if( p_intf->p_input->stream.i_area_nb > 1 )
588 /* be sure that menu is sensitive */
589 gtk_widget_set_sensitive( p_navigation, TRUE );
595 p_title_item = gtk_menu_item_new_with_label( psz_name );
598 p_chapter_menu = gtk_menu_new();
600 p_intf->p_input->stream.pp_areas[i_title]->i_part_nb;
602 for( i_chapter = 0 ; i_chapter < i_chapter_nb ; i_chapter++ )
604 /* we group chapters in packets of ten for small screens */
605 if( ( i_chapter % 10 == 0 ) && ( i_chapter_nb > 20 ) )
609 gtk_menu_item_set_submenu(
610 GTK_MENU_ITEM( p_chapter_menu_item ),
612 gtk_menu_append( GTK_MENU( p_chapter_menu ),
613 p_chapter_menu_item );
616 snprintf( psz_name, GTK_MENU_LABEL_SIZE,
617 "%d - %d", i_chapter + 1, i_chapter + 10 );
618 psz_name[ GTK_MENU_LABEL_SIZE - 1 ] = '\0';
619 p_chapter_menu_item =
620 gtk_menu_item_new_with_label( psz_name );
621 gtk_widget_show( p_chapter_menu_item );
622 p_chapter_submenu = gtk_menu_new();
625 snprintf( psz_name, GTK_MENU_LABEL_SIZE,
626 "Chapter %d", i_chapter + 1 );
627 psz_name[ GTK_MENU_LABEL_SIZE - 1 ] = '\0';
629 p_item = gtk_radio_menu_item_new_with_label(
630 p_chapter_group, psz_name );
631 p_chapter_group = gtk_radio_menu_item_group(
632 GTK_RADIO_MENU_ITEM( p_item ) );
633 gtk_widget_show( p_item );
635 #define p_area p_intf->p_input->stream.pp_areas[i_title]
636 if( ( p_area == p_intf->p_input->stream.p_selected_area ) &&
637 ( p_area->i_part == i_chapter + 1 ) )
639 p_item_active = p_item;
643 /* setup signal hanling */
644 gtk_signal_connect( GTK_OBJECT( p_item ),
646 GTK_SIGNAL_FUNC( pf_toggle ),
647 (gpointer)POS2DATA( i_title, i_chapter + 1) );
649 if( i_chapter_nb > 20 )
651 gtk_menu_append( GTK_MENU( p_chapter_submenu ), p_item );
655 gtk_menu_append( GTK_MENU( p_chapter_menu ), p_item );
659 if( i_chapter_nb > 20 )
661 gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_chapter_menu_item ),
663 gtk_menu_append( GTK_MENU( p_chapter_menu ),
664 p_chapter_menu_item );
667 /* link the new menu to the title menu item */
668 gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_title_item ),
671 if( p_intf->p_input->stream.pp_areas[i_title]->i_part_nb > 1 )
673 /* be sure that menu is sensitive */
674 gtk_widget_set_sensitive( p_navigation, TRUE );
677 GtkRadioMenu( p_intf, p_title_item, p_chapter_group, "Chapter",
678 p_intf->p_input->stream.pp_areas[i_title]->i_part_nb,
680 p_intf->p_input->stream.p_selected_area->i_part +
681 p_intf->p_input->stream.p_selected_area->i_id *100,
686 gtk_widget_show( p_title_item );
688 if( i_title_nb > 20 )
690 gtk_menu_append( GTK_MENU( p_title_submenu ), p_title_item );
694 gtk_menu_append( GTK_MENU( p_title_menu ), p_title_item );
698 if( i_title_nb > 20 )
700 gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_title_menu_item ),
702 gtk_menu_append( GTK_MENU( p_title_menu ), p_title_menu_item );
705 /* be sure that menu is sensitive */
706 gtk_widget_set_sensitive( p_title_menu, TRUE );
708 /* link the new menu to the menubar item */
709 gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_navigation ), p_title_menu );
711 if( p_item_active != NULL )
713 gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( p_item_active ),
717 if( p_intf->p_input->stream.i_area_nb > 1 )
719 /* be sure that menu is sensitive */
720 gtk_widget_set_sensitive( p_navigation, TRUE );
727 /*****************************************************************************
728 * GtkSetupMenu: function that generates title/chapter/audio/subpic
729 * menus with help from preceding functions
730 *****************************************************************************/
731 gint GtkSetupMenu( intf_thread_t * p_intf )
733 es_descriptor_t * p_audio_es;
734 es_descriptor_t * p_spu_es;
735 GtkWidget * p_menubar_menu;
736 GtkWidget * p_popup_menu;
739 p_intf->p_sys->b_chapter_update |= p_intf->p_sys->b_title_update;
740 p_intf->p_sys->b_angle_update |= p_intf->p_sys->b_title_update;
741 p_intf->p_sys->b_audio_update |= p_intf->p_sys->b_title_update;
742 p_intf->p_sys->b_spu_update |= p_intf->p_sys->b_title_update;
744 if( p_intf->p_sys->b_title_update )
748 p_menubar_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
749 p_intf->p_sys->p_window ), "menubar_title" ) );
750 GtkRadioMenu( p_intf, p_menubar_menu, NULL, "Title",
751 p_intf->p_input->stream.i_area_nb - 1,
752 p_intf->p_input->stream.p_selected_area->i_id,
753 GtkMenubarTitleToggle );
755 snprintf( psz_title, 4, "%d",
756 p_intf->p_input->stream.p_selected_area->i_id );
757 psz_title[ 4 ] = '\0';
758 gtk_label_set_text( p_intf->p_sys->p_label_title, psz_title );
760 p_intf->p_sys->b_title_update = 0;
763 if( p_intf->p_sys->b_chapter_update )
767 p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
768 p_intf->p_sys->p_popup ), "popup_navigation" ) );
769 GtkTitleMenu( p_intf, p_popup_menu, GtkPopupNavigationToggle );
771 GtkRadioMenu( p_intf, p_menubar_menu, NULL, "Title",
772 p_intf->p_input->stream.i_area_nb - 1,
773 p_intf->p_input->stream.p_selected_area->i_id,
774 on_menubar_chapter_toggle );
777 p_menubar_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
778 p_intf->p_sys->p_window ), "menubar_chapter" ) );
779 GtkRadioMenu( p_intf, p_menubar_menu, NULL, "Chapter",
780 p_intf->p_input->stream.p_selected_area->i_part_nb,
781 p_intf->p_input->stream.p_selected_area->i_part,
782 GtkMenubarChapterToggle );
785 snprintf( psz_chapter, 4, "%d",
786 p_intf->p_input->stream.p_selected_area->i_part );
787 psz_chapter[ 4 ] = '\0';
788 gtk_label_set_text( p_intf->p_sys->p_label_chapter, psz_chapter );
790 p_intf->p_sys->i_part =
791 p_intf->p_input->stream.p_selected_area->i_part;
793 p_intf->p_sys->b_chapter_update = 0;
796 if( p_intf->p_sys->b_angle_update )
798 p_menubar_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
799 p_intf->p_sys->p_window ), "menubar_angle" ) );
800 GtkRadioMenu( p_intf, p_menubar_menu, NULL, "Angle",
801 p_intf->p_input->stream.p_selected_area->i_angle_nb,
802 p_intf->p_input->stream.p_selected_area->i_angle,
803 GtkMenubarAngleToggle );
805 p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
806 p_intf->p_sys->p_popup ), "popup_angle" ) );
807 GtkRadioMenu( p_intf, p_popup_menu, NULL, "Angle",
808 p_intf->p_input->stream.p_selected_area->i_angle_nb,
809 p_intf->p_input->stream.p_selected_area->i_angle,
810 GtkPopupAngleToggle );
812 p_intf->p_sys->b_angle_update = 0;
815 /* look for selected ES */
819 for( i = 0 ; i < p_intf->p_input->stream.i_selected_es_number ; i++ )
821 if( p_intf->p_input->stream.pp_selected_es[i]->i_cat == AUDIO_ES )
823 p_audio_es = p_intf->p_input->stream.pp_selected_es[i];
826 if( p_intf->p_input->stream.pp_selected_es[i]->i_cat == SPU_ES )
828 p_spu_es = p_intf->p_input->stream.pp_selected_es[i];
833 if( p_intf->p_sys->b_audio_update )
835 /* find audio root menu */
836 p_menubar_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
837 p_intf->p_sys->p_window ), "menubar_audio" ) );
839 p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
840 p_intf->p_sys->p_popup ), "popup_audio" ) );
842 GtkLanguageMenus( p_intf, p_menubar_menu, p_audio_es, AUDIO_ES,
843 GtkMenubarAudioToggle );
844 GtkLanguageMenus( p_intf, p_popup_menu, p_audio_es, AUDIO_ES,
845 GtkPopupAudioToggle );
847 p_intf->p_sys->b_audio_update = 0;
850 /* sub picture menus */
851 if( p_intf->p_sys->b_spu_update )
853 /* find spu root menu */
854 p_menubar_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
855 p_intf->p_sys->p_window ), "menubar_subpictures" ) );
857 p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
858 p_intf->p_sys->p_popup ), "popup_subpictures" ) );
860 GtkLanguageMenus( p_intf, p_menubar_menu, p_spu_es, SPU_ES,
861 GtkMenubarSubtitleToggle );
862 GtkLanguageMenus( p_intf, p_popup_menu, p_spu_es, SPU_ES,
863 GtkPopupSubtitleToggle );
865 p_intf->p_sys->b_spu_update = 0;
868 /* handle fullscreen check items */
869 if( p_vout_bank->i_count )
871 p_menubar_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
872 p_intf->p_sys->p_window ), "menubar_fullscreen" ) );
874 p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
875 p_intf->p_sys->p_popup ), "popup_fullscreen" ) );
877 gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( p_menubar_menu ),
878 p_vout_bank->pp_vout[0]->b_fullscreen );
879 gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( p_popup_menu ),
880 p_vout_bank->pp_vout[0]->b_fullscreen );