-
-/*****************************************************************************
- * GtkMenuRadioItem: give a menu item adapted to language/title selection,
- * ie the menu item is a radio button.
- *****************************************************************************/
-static GtkWidget * GtkMenuRadioItem( GtkWidget * p_menu,
- GSList ** p_button_group,
- gint b_active,
- char * psz_name )
-{
- GtkWidget * p_item;
-
-#if 0
- GtkWidget * p_button;
-
- /* create button */
- p_button =
- gtk_radio_button_new_with_label( *p_button_group, psz_name );
-
- /* add button to group */
- *p_button_group =
- gtk_radio_button_group( GTK_RADIO_BUTTON( p_button ) );
-
- /* prepare button for display */
- gtk_widget_show( p_button );
-
- /* create menu item to store button */
- p_item = gtk_menu_item_new();
-
- /* put button inside item */
- gtk_container_add( GTK_CONTAINER( p_item ), p_button );
-
- /* add item to menu */
- gtk_menu_append( GTK_MENU( p_menu ), p_item );
-
- gtk_signal_connect( GTK_OBJECT( p_item ), "activate",
- GTK_SIGNAL_FUNC( on_audio_toggle ),
- NULL );
-
-
- /* prepare item for display */
- gtk_widget_show( p_item );
-
- /* is it the selected item ? */
- if( b_active )
- {
- gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( p_button ), TRUE );
- }
-#else
- p_item = gtk_menu_item_new_with_label( psz_name );
- gtk_menu_append( GTK_MENU( p_menu ), p_item );
- gtk_widget_show( p_item );
-#endif
-
- return p_item;
-}
-
-/*****************************************************************************
- * GtkLanguageMenus: update interactive menus of the interface
- *****************************************************************************
- * Sets up menus with information from input:
- * -languages
- * -sub-pictures
- * Warning: since this function is designed to be called by management
- * function, the interface lock has to be taken
- *****************************************************************************/
-static gint GtkLanguageMenus( gpointer p_data,
- GtkWidget * p_root,
- es_descriptor_t * p_es,
- gint i_cat,
- void(*pf_activate )( GtkMenuItem *, gpointer ) )
-{
- intf_thread_t * p_intf;
- GtkWidget * p_menu;
- GtkWidget * p_separator;
- GtkWidget * p_item;
- GSList * p_button_group;
- char * psz_name;
- gint b_active;
- gint i;
-
-
-
- /* cast */
- p_intf = (intf_thread_t *)p_data;
-
- vlc_mutex_lock( &p_intf->p_input->stream.stream_lock );
-
- p_button_group = NULL;
-
- /* menu container for audio */
- p_menu = gtk_menu_new();
-
- /* create a set of language buttons and append them to the container */
- b_active = ( p_es == NULL );
- psz_name = "Off";
-
- p_item = GtkMenuRadioItem( p_menu, &p_button_group, b_active, psz_name );
-
- /* setup signal hanling */
- gtk_signal_connect( GTK_OBJECT( p_item ), "activate",
- GTK_SIGNAL_FUNC ( pf_activate ), NULL );
-
- p_separator = gtk_menu_item_new();
- gtk_widget_show( p_separator );
- gtk_menu_append( GTK_MENU( p_menu ), p_separator );
- gtk_widget_set_sensitive( p_separator, FALSE );
-
- for( i = 0 ; i < p_intf->p_input->stream.i_es_number ; i++ )
- {
- if( p_intf->p_input->stream.pp_es[i]->i_cat == i_cat )
- {
- b_active = ( p_es == p_intf->p_input->stream.pp_es[i] ) ? 1 : 0;
- psz_name = p_intf->p_input->stream.pp_es[i]->psz_desc;
-
- p_item = GtkMenuRadioItem( p_menu, &p_button_group,
- b_active, psz_name );
-
- /* setup signal hanling */
- gtk_signal_connect( GTK_OBJECT( p_item ), "activate",
- GTK_SIGNAL_FUNC( pf_activate ),
- (gpointer)( p_intf->p_input->stream.pp_es[i] ) );
-
- }
- }
-
- /* link the new menu to the menubar item */
- gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_root ), p_menu );
-
- /* be sure that menu is sensitive */
- gtk_widget_set_sensitive( p_root, TRUE );
-
- vlc_mutex_unlock( &p_intf->p_input->stream.stream_lock );
-
- return TRUE;
-}
-
-/*****************************************************************************
- * GtkChapterMenu: generate chapter menu for current title
- *****************************************************************************/
-static gint GtkChapterMenu( gpointer p_data, GtkWidget * p_chapter,
- void(*pf_activate )( GtkMenuItem *, gpointer ) )
-{
- intf_thread_t * p_intf;
- char psz_name[ GTK_MENU_LABEL_SIZE ];
- GtkWidget * p_chapter_menu;
- GtkWidget * p_item;
- GSList * p_chapter_button_group;
- gint i_title;
- gint i_chapter;
- gint b_active;
-
- /* cast */
- p_intf = (intf_thread_t*)p_data;
-
- i_title = p_intf->p_input->stream.p_selected_area->i_id;
- p_chapter_menu = gtk_menu_new();
-
- for( i_chapter = 0;
- i_chapter < p_intf->p_input->stream.pp_areas[i_title]->i_part_nb ;
- i_chapter++ )
- {
- b_active = ( p_intf->p_input->stream.pp_areas[i_title]->i_part
- == i_chapter + 1 ) ? 1 : 0;
-
- snprintf( psz_name, GTK_MENU_LABEL_SIZE,
- "Chapter %d", i_chapter + 1 );
- psz_name[ GTK_MENU_LABEL_SIZE - 1 ] = '\0';
-
- p_item = GtkMenuRadioItem( p_chapter_menu, &p_chapter_button_group,
- b_active, psz_name );
- /* setup signal hanling */
- gtk_signal_connect( GTK_OBJECT( p_item ),
- "activate",
- GTK_SIGNAL_FUNC( pf_activate ),
- (gpointer)(i_chapter + 1) );
- }
-
- /* link the new menu to the title menu item */
- gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_chapter ),
- p_chapter_menu );
-
- /* be sure that chapter menu is sensitive */
- gtk_widget_set_sensitive( p_chapter, TRUE );
-
- return TRUE;
-}
-
-/*****************************************************************************
- * GtkTitleMenu: sets menus for titles and chapters selection
- *****************************************************************************
- * Generates two type of menus:
- * -simple list of titles
- * -cascaded lists of chapters for each title
- *****************************************************************************/
-static gint GtkTitleMenu( gpointer p_data,
- GtkWidget * p_navigation,
- void(*pf_activate )( GtkMenuItem *, gpointer ) )
-{
- intf_thread_t * p_intf;
- char psz_name[ GTK_MENU_LABEL_SIZE ];
- GtkWidget * p_title_menu;
- GtkWidget * p_title_item;
- GtkWidget * p_chapter_menu;
- GtkWidget * p_item;
- GSList * p_title_button_group;
- GSList * p_chapter_button_group;
- gint i_title;
- gint i_chapter;
- gint b_active;
-
- /* cast */
- p_intf = (intf_thread_t*)p_data;
-
- p_title_menu = gtk_menu_new();
- p_title_button_group = NULL;
- p_chapter_button_group = NULL;
-
- /* loop on titles */
- for( i_title = 1 ;
- i_title < p_intf->p_input->stream.i_area_nb ;
- i_title++ )
- {
- b_active = ( p_intf->p_input->stream.pp_areas[i_title] ==
- p_intf->p_input->stream.p_selected_area ) ? 1 : 0;
- snprintf( psz_name, GTK_MENU_LABEL_SIZE, "Title %d", i_title );
- psz_name[ GTK_MENU_LABEL_SIZE - 1 ] = '\0';
-
- p_title_item = GtkMenuRadioItem( p_title_menu, &p_title_button_group,
- b_active, psz_name );
-
- if( pf_activate == on_menubar_title_activate )
- {
- /* setup signal hanling */
- gtk_signal_connect( GTK_OBJECT( p_title_item ),
- "activate",
- GTK_SIGNAL_FUNC( pf_activate ),
- (gpointer)(p_intf->p_input->stream.pp_areas[i_title]) );
- }
- else
- {
- p_chapter_menu = gtk_menu_new();
-
- for( i_chapter = 0;
- i_chapter <
- p_intf->p_input->stream.pp_areas[i_title]->i_part_nb ;
- i_chapter++ )
- {
- b_active = ( p_intf->p_input->stream.pp_areas[i_title]->i_part
- == i_chapter + 1 ) ? 1 : 0;
-
- snprintf( psz_name, GTK_MENU_LABEL_SIZE,
- "Chapter %d", i_chapter + 1 );
- psz_name[ GTK_MENU_LABEL_SIZE - 1 ] = '\0';
-
- p_item = GtkMenuRadioItem( p_chapter_menu,
- &p_chapter_button_group,
- b_active, psz_name );
-
- /* setup signal hanling */
- gtk_signal_connect( GTK_OBJECT( p_item ),
- "activate",
- GTK_SIGNAL_FUNC( pf_activate ),
- (gpointer)( ( i_title * 100 ) + ( i_chapter + 1) ) );
- }
-
- /* link the new menu to the title menu item */
- gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_title_item ),
- p_chapter_menu );
- }
-
- /* be sure that chapter menu is sensitive */
- gtk_widget_set_sensitive( p_title_menu, TRUE );
-
- }
-
- /* link the new menu to the menubar audio item */
- gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_navigation ), p_title_menu );
-
- /* be sure that audio menu is sensitive */
- gtk_widget_set_sensitive( p_navigation, TRUE );
-
-
- return TRUE;
-}
-
-void GtkDisplayDate( GtkAdjustment *p_adj )
-{
- intf_thread_t *p_intf;
-
- p_intf = gtk_object_get_data( GTK_OBJECT( p_adj ), "p_intf" );
-
- if( p_intf->p_input != NULL )
- {
-#define p_area p_intf->p_input->stream.p_selected_area
- char psz_time[ OFFSETTOTIME_MAX_SIZE ];
-
- vlc_mutex_lock( &p_intf->p_input->stream.stream_lock );
-
- gtk_frame_set_label( p_intf->p_sys->p_slider_frame,
- input_OffsetToTime( p_intf->p_input, psz_time,
- ( p_area->i_size * p_adj->value ) / 100 ) );
-
- vlc_mutex_unlock( &p_intf->p_input->stream.stream_lock );
-#undef p_area
- }
-}
-
-