1 /*****************************************************************************
2 * gtk_menu.c : functions to handle menu items.
3 *****************************************************************************
4 * Copyright (C) 2000, 2001 VideoLAN
5 * $Id: gtk_menu.c,v 1.2 2001/05/15 14:49:48 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 * We have to release the lock since input_ToggleES needs it */
352 if( p_item_selected != NULL )
354 vlc_mutex_unlock( &p_intf->p_input->stream.stream_lock );
355 gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( p_item_selected ),
357 vlc_mutex_lock( &p_intf->p_input->stream.stream_lock );
360 /* be sure that menu is sensitive, if there are several items */
363 gtk_widget_set_sensitive( p_root, TRUE );
369 /*****************************************************************************
370 * GtkLanguageMenus: update interactive menus of the interface
371 *****************************************************************************
372 * Sets up menus with information from input:
375 * Warning: since this function is designed to be called by management
376 * function, the interface lock has to be taken
377 *****************************************************************************/
378 static gint GtkLanguageMenus( gpointer p_data,
380 es_descriptor_t * p_es,
382 void(*pf_toggle )( GtkCheckMenuItem *, gpointer ) )
384 intf_thread_t * p_intf;
386 GtkWidget * p_separator;
388 GtkWidget * p_item_active;
390 char psz_name[ GTK_MENU_LABEL_SIZE ];
397 p_intf = (intf_thread_t *)p_data;
399 /* temporary hack to avoid blank menu when an open menu is removed */
400 if( GTK_MENU_ITEM(p_root)->submenu != NULL )
402 gtk_menu_popdown( GTK_MENU( GTK_MENU_ITEM(p_root)->submenu ) );
404 /* removes previous menu */
405 gtk_menu_item_remove_submenu( GTK_MENU_ITEM( p_root ) );
406 gtk_widget_set_sensitive( p_root, FALSE );
411 p_menu = gtk_menu_new();
413 /* special case for "off" item */
414 snprintf( psz_name, GTK_MENU_LABEL_SIZE, "None" );
415 psz_name[ GTK_MENU_LABEL_SIZE - 1 ] = '\0';
417 p_item = gtk_radio_menu_item_new_with_label( p_group, psz_name );
418 p_group = gtk_radio_menu_item_group( GTK_RADIO_MENU_ITEM( p_item ) );
420 gtk_widget_show( p_item );
422 /* signal hanling for off */
423 gtk_signal_connect( GTK_OBJECT( p_item ), "toggled",
424 GTK_SIGNAL_FUNC ( pf_toggle ), NULL );
426 gtk_menu_append( GTK_MENU( p_menu ), p_item );
428 p_separator = gtk_menu_item_new();
429 gtk_widget_set_sensitive( p_separator, FALSE );
430 gtk_widget_show( p_separator );
431 gtk_menu_append( GTK_MENU( p_menu ), p_separator );
433 p_item_active = NULL;
436 /* create a set of language buttons and append them to the container */
437 for( i = 0 ; i < p_intf->p_input->stream.i_es_number ; i++ )
439 if( p_intf->p_input->stream.pp_es[i]->i_cat == i_cat )
442 strcpy( psz_name, p_intf->p_input->stream.pp_es[i]->psz_desc );
443 if( psz_name[0] == '\0' )
445 snprintf( psz_name, GTK_MENU_LABEL_SIZE,
446 "Language %d", i_item );
447 psz_name[ GTK_MENU_LABEL_SIZE - 1 ] = '\0';
450 p_item = gtk_radio_menu_item_new_with_label( p_group, psz_name );
452 gtk_radio_menu_item_group( GTK_RADIO_MENU_ITEM( p_item ) );
454 if( p_es == p_intf->p_input->stream.pp_es[i] )
456 /* don't lose p_item when we append into menu */
457 p_item_active = p_item;
460 gtk_widget_show( p_item );
462 /* setup signal hanling */
463 gtk_signal_connect( GTK_OBJECT( p_item ), "toggled",
464 GTK_SIGNAL_FUNC( pf_toggle ),
465 (gpointer)( p_intf->p_input->stream.pp_es[i] ) );
467 gtk_menu_append( GTK_MENU( p_menu ), p_item );
472 /* link the new menu to the menubar item */
473 gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_root ), p_menu );
475 /* acitvation will call signals so we can only do it
476 * when submenu is attached to menu - to get intf_window
477 * We have to release the lock since input_ToggleES needs it */
478 if( p_item_active != NULL )
480 vlc_mutex_unlock( &p_intf->p_input->stream.stream_lock );
481 gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( p_item_active ),
483 vlc_mutex_lock( &p_intf->p_input->stream.stream_lock );
486 /* be sure that menu is sensitive if non empty */
489 gtk_widget_set_sensitive( p_root, TRUE );
496 /*****************************************************************************
497 * GtkTitleMenu: sets menus for titles and chapters selection
498 *****************************************************************************
499 * Generates two types of menus:
500 * -simple list of titles
501 * -cascaded lists of chapters for each title
502 *****************************************************************************/
503 static gint GtkTitleMenu( gpointer p_data,
504 GtkWidget * p_navigation,
505 void(*pf_toggle )( GtkCheckMenuItem *, gpointer ) )
507 intf_thread_t * p_intf;
508 char psz_name[ GTK_MENU_LABEL_SIZE ];
509 GtkWidget * p_title_menu;
510 GtkWidget * p_title_submenu;
511 GtkWidget * p_title_item;
512 GtkWidget * p_item_active;
513 GtkWidget * p_chapter_menu;
514 GtkWidget * p_chapter_submenu;
515 GtkWidget * p_title_menu_item;
516 GtkWidget * p_chapter_menu_item;
518 GSList * p_title_group;
519 GSList * p_chapter_group;
526 p_intf = (intf_thread_t*)p_data;
528 /* temporary hack to avoid blank menu when an open menu is removed */
529 if( GTK_MENU_ITEM(p_navigation)->submenu != NULL )
531 gtk_menu_popdown( GTK_MENU( GTK_MENU_ITEM(p_navigation)->submenu ) );
533 /* removes previous menu */
534 gtk_menu_item_remove_submenu( GTK_MENU_ITEM( p_navigation ) );
535 gtk_widget_set_sensitive( p_navigation, FALSE );
537 p_title_menu = gtk_menu_new();
538 p_title_group = NULL;
539 p_title_submenu = NULL;
540 p_title_menu_item = NULL;
541 p_chapter_group = NULL;
542 p_chapter_submenu = NULL;
543 p_chapter_menu_item = NULL;
544 p_item_active = NULL;
545 i_title_nb = p_intf->p_input->stream.i_area_nb;
548 for( i_title = 1 ; i_title < i_title_nb ; i_title++ )
550 /* we group titles in packets of ten for small screens */
551 if( ( i_title % 10 == 1 ) && ( i_title_nb > 20 ) )
555 gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_title_menu_item ),
557 gtk_menu_append( GTK_MENU( p_title_menu ), p_title_menu_item );
560 snprintf( psz_name, GTK_MENU_LABEL_SIZE,
561 "%d - %d", i_title, i_title + 9 );
562 psz_name[ GTK_MENU_LABEL_SIZE - 1 ] = '\0';
563 p_title_menu_item = gtk_menu_item_new_with_label( psz_name );
564 gtk_widget_show( p_title_menu_item );
565 p_title_submenu = gtk_menu_new();
568 snprintf( psz_name, GTK_MENU_LABEL_SIZE, "Title %d (%d)", i_title,
569 p_intf->p_input->stream.pp_areas[i_title]->i_part_nb );
570 psz_name[ GTK_MENU_LABEL_SIZE - 1 ] = '\0';
572 if( pf_toggle == on_menubar_title_toggle )
574 p_title_item = gtk_radio_menu_item_new_with_label( p_title_group,
577 gtk_radio_menu_item_group( GTK_RADIO_MENU_ITEM( p_title_item ) );
579 if( p_intf->p_input->stream.pp_areas[i_title] ==
580 p_intf->p_input->stream.p_selected_area )
582 p_item_active = p_title_item;
585 /* setup signal hanling */
586 gtk_signal_connect( GTK_OBJECT( p_title_item ),
588 GTK_SIGNAL_FUNC( pf_toggle ),
589 (gpointer)(p_intf->p_input->stream.pp_areas[i_title]) );
591 if( p_intf->p_input->stream.i_area_nb > 1 )
593 /* be sure that menu is sensitive */
594 gtk_widget_set_sensitive( p_navigation, TRUE );
600 p_title_item = gtk_menu_item_new_with_label( psz_name );
603 p_chapter_menu = gtk_menu_new();
605 p_intf->p_input->stream.pp_areas[i_title]->i_part_nb;
607 for( i_chapter = 0 ; i_chapter < i_chapter_nb ; i_chapter++ )
609 /* we group chapters in packets of ten for small screens */
610 if( ( i_chapter % 10 == 0 ) && ( i_chapter_nb > 20 ) )
614 gtk_menu_item_set_submenu(
615 GTK_MENU_ITEM( p_chapter_menu_item ),
617 gtk_menu_append( GTK_MENU( p_chapter_menu ),
618 p_chapter_menu_item );
621 snprintf( psz_name, GTK_MENU_LABEL_SIZE,
622 "%d - %d", i_chapter + 1, i_chapter + 10 );
623 psz_name[ GTK_MENU_LABEL_SIZE - 1 ] = '\0';
624 p_chapter_menu_item =
625 gtk_menu_item_new_with_label( psz_name );
626 gtk_widget_show( p_chapter_menu_item );
627 p_chapter_submenu = gtk_menu_new();
630 snprintf( psz_name, GTK_MENU_LABEL_SIZE,
631 "Chapter %d", i_chapter + 1 );
632 psz_name[ GTK_MENU_LABEL_SIZE - 1 ] = '\0';
634 p_item = gtk_radio_menu_item_new_with_label(
635 p_chapter_group, psz_name );
636 p_chapter_group = gtk_radio_menu_item_group(
637 GTK_RADIO_MENU_ITEM( p_item ) );
638 gtk_widget_show( p_item );
640 #define p_area p_intf->p_input->stream.pp_areas[i_title]
641 if( ( p_area == p_intf->p_input->stream.p_selected_area ) &&
642 ( p_area->i_part == i_chapter + 1 ) )
644 p_item_active = p_item;
648 /* setup signal hanling */
649 gtk_signal_connect( GTK_OBJECT( p_item ),
651 GTK_SIGNAL_FUNC( pf_toggle ),
652 (gpointer)POS2DATA( i_title, i_chapter + 1) );
654 if( i_chapter_nb > 20 )
656 gtk_menu_append( GTK_MENU( p_chapter_submenu ), p_item );
660 gtk_menu_append( GTK_MENU( p_chapter_menu ), p_item );
664 if( i_chapter_nb > 20 )
666 gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_chapter_menu_item ),
668 gtk_menu_append( GTK_MENU( p_chapter_menu ),
669 p_chapter_menu_item );
672 /* link the new menu to the title menu item */
673 gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_title_item ),
676 if( p_intf->p_input->stream.pp_areas[i_title]->i_part_nb > 1 )
678 /* be sure that menu is sensitive */
679 gtk_widget_set_sensitive( p_navigation, TRUE );
682 GtkRadioMenu( p_intf, p_title_item, p_chapter_group, "Chapter",
683 p_intf->p_input->stream.pp_areas[i_title]->i_part_nb,
685 p_intf->p_input->stream.p_selected_area->i_part +
686 p_intf->p_input->stream.p_selected_area->i_id *100,
691 gtk_widget_show( p_title_item );
693 if( i_title_nb > 20 )
695 gtk_menu_append( GTK_MENU( p_title_submenu ), p_title_item );
699 gtk_menu_append( GTK_MENU( p_title_menu ), p_title_item );
703 if( i_title_nb > 20 )
705 gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_title_menu_item ),
707 gtk_menu_append( GTK_MENU( p_title_menu ), p_title_menu_item );
710 /* be sure that menu is sensitive */
711 gtk_widget_set_sensitive( p_title_menu, TRUE );
713 /* link the new menu to the menubar item */
714 gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_navigation ), p_title_menu );
716 /* Default selected chapter
717 * We have to release the lock since input_ToggleES needs it */
718 if( p_item_active != NULL )
720 vlc_mutex_unlock( &p_intf->p_input->stream.stream_lock );
721 gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( p_item_active ),
723 vlc_mutex_lock( &p_intf->p_input->stream.stream_lock );
726 if( p_intf->p_input->stream.i_area_nb > 1 )
728 /* be sure that menu is sensitive */
729 gtk_widget_set_sensitive( p_navigation, TRUE );
737 /*****************************************************************************
738 * GtkSetupMenu: function that generates title/chapter/audio/subpic
739 * menus with help from preceding functions
740 *****************************************************************************/
741 gint GtkSetupMenu( intf_thread_t * p_intf )
743 es_descriptor_t * p_audio_es;
744 es_descriptor_t * p_spu_es;
745 GtkWidget * p_menubar_menu;
746 GtkWidget * p_popup_menu;
749 p_intf->p_sys->b_chapter_update |= p_intf->p_sys->b_title_update |
750 ( p_intf->p_sys->i_part !=
751 p_intf->p_input->stream.p_selected_area->i_part );
752 p_intf->p_sys->b_angle_update |= p_intf->p_sys->b_title_update;
753 p_intf->p_sys->b_audio_update |= p_intf->p_sys->b_title_update;
754 p_intf->p_sys->b_spu_update |= p_intf->p_sys->b_title_update;
756 if( p_intf->p_sys->b_title_update )
760 p_menubar_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
761 p_intf->p_sys->p_window ), "menubar_title" ) );
762 GtkRadioMenu( p_intf, p_menubar_menu, NULL, "Title",
763 p_intf->p_input->stream.i_area_nb - 1,
764 p_intf->p_input->stream.p_selected_area->i_id,
765 GtkMenubarTitleToggle );
767 snprintf( psz_title, 4, "%d",
768 p_intf->p_input->stream.p_selected_area->i_id );
769 psz_title[ 4 ] = '\0';
770 gtk_label_set_text( p_intf->p_sys->p_label_title, psz_title );
772 p_intf->p_sys->b_title_update = 0;
775 if( p_intf->p_sys->b_chapter_update )
779 p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
780 p_intf->p_sys->p_popup ), "popup_navigation" ) );
781 GtkTitleMenu( p_intf, p_popup_menu, GtkPopupNavigationToggle );
783 GtkRadioMenu( p_intf, p_menubar_menu, NULL, "Title",
784 p_intf->p_input->stream.i_area_nb - 1,
785 p_intf->p_input->stream.p_selected_area->i_id,
786 on_menubar_chapter_toggle );
789 p_menubar_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
790 p_intf->p_sys->p_window ), "menubar_chapter" ) );
791 GtkRadioMenu( p_intf, p_menubar_menu, NULL, "Chapter",
792 p_intf->p_input->stream.p_selected_area->i_part_nb,
793 p_intf->p_input->stream.p_selected_area->i_part,
794 GtkMenubarChapterToggle );
797 snprintf( psz_chapter, 4, "%d",
798 p_intf->p_input->stream.p_selected_area->i_part );
799 psz_chapter[ 4 ] = '\0';
800 gtk_label_set_text( p_intf->p_sys->p_label_chapter, psz_chapter );
802 p_intf->p_sys->i_part =
803 p_intf->p_input->stream.p_selected_area->i_part;
805 p_intf->p_sys->b_chapter_update = 0;
808 if( p_intf->p_sys->b_angle_update )
810 p_menubar_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
811 p_intf->p_sys->p_window ), "menubar_angle" ) );
812 GtkRadioMenu( p_intf, p_menubar_menu, NULL, "Angle",
813 p_intf->p_input->stream.p_selected_area->i_angle_nb,
814 p_intf->p_input->stream.p_selected_area->i_angle,
815 GtkMenubarAngleToggle );
817 p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
818 p_intf->p_sys->p_popup ), "popup_angle" ) );
819 GtkRadioMenu( p_intf, p_popup_menu, NULL, "Angle",
820 p_intf->p_input->stream.p_selected_area->i_angle_nb,
821 p_intf->p_input->stream.p_selected_area->i_angle,
822 GtkPopupAngleToggle );
824 p_intf->p_sys->b_angle_update = 0;
827 /* look for selected ES */
831 for( i = 0 ; i < p_intf->p_input->stream.i_selected_es_number ; i++ )
833 if( p_intf->p_input->stream.pp_selected_es[i]->i_cat == AUDIO_ES )
835 p_audio_es = p_intf->p_input->stream.pp_selected_es[i];
838 if( p_intf->p_input->stream.pp_selected_es[i]->i_cat == SPU_ES )
840 p_spu_es = p_intf->p_input->stream.pp_selected_es[i];
845 if( p_intf->p_sys->b_audio_update )
847 /* find audio root menu */
848 p_menubar_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
849 p_intf->p_sys->p_window ), "menubar_audio" ) );
851 p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
852 p_intf->p_sys->p_popup ), "popup_audio" ) );
854 GtkLanguageMenus( p_intf, p_menubar_menu, p_audio_es, AUDIO_ES,
855 GtkMenubarAudioToggle );
856 GtkLanguageMenus( p_intf, p_popup_menu, p_audio_es, AUDIO_ES,
857 GtkPopupAudioToggle );
859 p_intf->p_sys->b_audio_update = 0;
862 /* sub picture menus */
863 if( p_intf->p_sys->b_spu_update )
865 /* find spu root menu */
866 p_menubar_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
867 p_intf->p_sys->p_window ), "menubar_subpictures" ) );
869 p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
870 p_intf->p_sys->p_popup ), "popup_subpictures" ) );
872 GtkLanguageMenus( p_intf, p_menubar_menu, p_spu_es, SPU_ES,
873 GtkMenubarSubtitleToggle );
874 GtkLanguageMenus( p_intf, p_popup_menu, p_spu_es, SPU_ES,
875 GtkPopupSubtitleToggle );
877 p_intf->p_sys->b_spu_update = 0;