Commit 93ca3031 authored by Stéphane Borel's avatar Stéphane Borel

-Fixed most of the bugs in gnome interface menus

-Added radio checks in menu items.

There are still issues with default selected item but it works well.
parent e996c64e
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* -dvd_udf to find files * -dvd_udf to find files
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: input_dvd.c,v 1.31 2001/03/07 10:31:10 stef Exp $ * $Id: input_dvd.c,v 1.32 2001/03/15 00:37:04 stef Exp $
* *
* Author: Stphane Borel <stef@via.ecp.fr> * Author: Stphane Borel <stef@via.ecp.fr>
* *
...@@ -393,7 +393,7 @@ static int DVDFindSector( thread_dvd_data_t * p_dvd ) ...@@ -393,7 +393,7 @@ static int DVDFindSector( thread_dvd_data_t * p_dvd )
p_dvd->ifo.vts.c_adt.p_cell_inf[i_cell].i_esector, p_dvd->ifo.vts.c_adt.p_cell_inf[i_cell].i_esector,
p_pgc->p_cell_play_inf[i_index].i_lsector ); p_pgc->p_cell_play_inf[i_index].i_lsector );
//intf_WarnMsg( 3, "cell: %d index: %d sector1: %x sector2: %x end1: %x end2: %x", i_cell, i_index, p_dvd->ifo.vts.c_adt.p_cell_inf[i_cell].i_ssector, p_pgc->p_cell_play_inf[i_index].i_entry_sector, p_dvd->ifo.vts.c_adt.p_cell_inf[i_cell].i_esector,p_pgc->p_cell_play_inf[i_index].i_lsector ); intf_WarnMsg( 3, "cell: %d index: %d sector1: %x sector2: %x end1: %x end2: %x", i_cell, i_index, p_dvd->ifo.vts.c_adt.p_cell_inf[i_cell].i_ssector, p_pgc->p_cell_play_inf[i_index].i_entry_sector, p_dvd->ifo.vts.c_adt.p_cell_inf[i_cell].i_esector,p_pgc->p_cell_play_inf[i_index].i_lsector );
return 0; return 0;
} }
...@@ -464,7 +464,8 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) ...@@ -464,7 +464,8 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
* We have to load all title information * We have to load all title information
*/ */
/* Change the default area */ /* Change the default area */
p_input->stream.p_selected_area = p_input->stream.pp_areas[p_area->i_id]; p_input->stream.p_selected_area =
p_input->stream.pp_areas[p_area->i_id];
/* title number: it is not vts nb! */ /* title number: it is not vts nb! */
p_dvd->i_title = p_area->i_id; p_dvd->i_title = p_area->i_id;
...@@ -897,6 +898,7 @@ static int DVDRead( input_thread_t * p_input, ...@@ -897,6 +898,7 @@ static int DVDRead( input_thread_t * p_input,
if( DVDFindSector( p_dvd ) < 0 ) if( DVDFindSector( p_dvd ) < 0 )
{ {
pp_packets[0] = NULL; pp_packets[0] = NULL;
intf_ErrMsg( "dvd error: can't find next cell" );
return 1; return 1;
} }
......
...@@ -723,98 +723,127 @@ on_popup_disc_activate (GtkMenuItem *menuitem, ...@@ -723,98 +723,127 @@ on_popup_disc_activate (GtkMenuItem *menuitem,
void void
on_popup_audio_activate (GtkMenuItem *menuitem, on_popup_audio_toggle (GtkCheckMenuItem *menuitem,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" ); if( menuitem->active )
es_descriptor_t * p_es; {
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
p_es = (es_descriptor_t*)user_data; es_descriptor_t * p_es;
input_ChangeES( p_intf->p_input, p_es, 1 ); p_es = (es_descriptor_t*)user_data;
input_ChangeES( p_intf->p_input, p_es, 1 );
}
} }
void void
on_popup_subtitle_activate (GtkMenuItem *menuitem, on_popup_subtitle_toggle (GtkCheckMenuItem *menuitem,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" ); if( menuitem->active )
es_descriptor_t * p_es; {
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
p_es = (es_descriptor_t*)user_data; es_descriptor_t * p_es;
input_ChangeES( p_intf->p_input, p_es, 2 ); p_es = (es_descriptor_t*)user_data;
input_ChangeES( p_intf->p_input, p_es, 2 );
}
} }
void void
on_menubar_audio_activate (GtkMenuItem *menuitem, on_menubar_audio_toggle (GtkCheckMenuItem *menuitem,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" ); if( menuitem->active )
es_descriptor_t * p_es; {
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
es_descriptor_t * p_es;
p_es = (es_descriptor_t*)user_data; p_es = (es_descriptor_t*)user_data;
input_ChangeES( p_intf->p_input, p_es, 1 ); input_ChangeES( p_intf->p_input, p_es, 1 );
}
} }
void void
on_menubar_subtitle_activate (GtkMenuItem *menuitem, on_menubar_subtitle_toggle (GtkCheckMenuItem *menuitem,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" ); if( menuitem->active )
es_descriptor_t * p_es; {
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
p_es = (es_descriptor_t*)user_data; es_descriptor_t * p_es;
input_ChangeES( p_intf->p_input, p_es, 2 ); p_es = (es_descriptor_t*)user_data;
input_ChangeES( p_intf->p_input, p_es, 2 );
}
} }
void void
on_popup_navigation_activate (GtkMenuItem *menuitem, on_popup_navigation_toggle (GtkCheckMenuItem *menuitem,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t * p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" ); if( menuitem->active )
input_area_t * p_area; {
gint i_title; intf_thread_t * p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
gint i_chapter; input_area_t * p_area;
gint i_title;
gint i_chapter;
i_title = (gint)(user_data) / 100 ;
i_chapter = (gint)(user_data) - ( 100 * i_title );
i_title = (gint)(user_data) / 100 ; if( i_title != p_intf->p_input->stream.p_selected_area->i_id )
i_chapter = (gint)(user_data) - ( 100 * i_title ); {
p_area = p_intf->p_input->stream.pp_areas[i_title]; p_intf->p_sys->b_menus_update = 1;
p_area->i_part = i_chapter; }
p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)p_area ); p_area = p_intf->p_input->stream.pp_areas[i_title];
input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY ); p_area->i_part = i_chapter;
p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)p_area );
input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
}
} }
void void
on_menubar_title_activate (GtkMenuItem *menuitem, on_menubar_title_toggle (GtkCheckMenuItem *menuitem,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" ); if( menuitem->active )
{
p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)user_data ); intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
p_intf->p_sys->b_menus_update = 1;
input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY ); p_intf->p_input->pf_set_area( p_intf->p_input,
(input_area_t*)user_data );
p_intf->p_sys->b_menus_update = 1;
input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
}
} }
void void
on_menubar_chapter_activate (GtkMenuItem *menuitem, on_menubar_chapter_toggle (GtkCheckMenuItem *menuitem,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t * p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" ); if( menuitem->active )
input_area_t * p_area = p_intf->p_input->stream.p_selected_area; {
gint i_chapter = (gint)user_data; intf_thread_t * p_intf = GetIntf( GTK_WIDGET(menuitem),
"intf_window" );
p_area->i_part = i_chapter; input_area_t * p_area = p_intf->p_input->stream.p_selected_area;
gint i_chapter = (gint)user_data;
p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)p_area );
input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY ); p_area->i_part = i_chapter;
p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)p_area );
input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
}
} }
...@@ -231,29 +231,29 @@ on_popup_disc_activate (GtkMenuItem *menuitem, ...@@ -231,29 +231,29 @@ on_popup_disc_activate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void void
on_popup_audio_activate (GtkMenuItem *menuitem, on_menubar_audio_toggle (GtkCheckMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void void
on_popup_subtitle_activate (GtkMenuItem *menuitem, on_menubar_subtitle_toggle (GtkCheckMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void void
on_menubar_audio_activate (GtkMenuItem *menuitem, on_popup_audio_toggle (GtkCheckMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void void
on_menubar_subtitle_activate (GtkMenuItem *menuitem, on_popup_subtitle_toggle (GtkCheckMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void void
on_popup_navigation_activate (GtkMenuItem *menuitem, on_popup_navigation_toggle (GtkCheckMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void void
on_menubar_title_activate (GtkMenuItem *menuitem, on_menubar_title_toggle (GtkCheckMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void void
on_menubar_chapter_activate (GtkMenuItem *menuitem, on_menubar_chapter_toggle (GtkCheckMenuItem *menuitem,
gpointer user_data); gpointer user_data);
...@@ -540,7 +540,7 @@ static GnomeUIInfo intf_popup_uiinfo[] = ...@@ -540,7 +540,7 @@ static GnomeUIInfo intf_popup_uiinfo[] =
GNOMEUIINFO_SEPARATOR, GNOMEUIINFO_SEPARATOR,
{ {
GNOME_APP_UI_ITEM, N_("_Navigation"), GNOME_APP_UI_ITEM, N_("_Navigation"),
NULL, N_("Navigate through titles and chapters"),
(gpointer) NULL, NULL, NULL, (gpointer) NULL, NULL, NULL,
GNOME_APP_PIXMAP_NONE, NULL, GNOME_APP_PIXMAP_NONE, NULL,
0, (GdkModifierType) 0, NULL 0, (GdkModifierType) 0, NULL
...@@ -549,14 +549,14 @@ static GnomeUIInfo intf_popup_uiinfo[] = ...@@ -549,14 +549,14 @@ static GnomeUIInfo intf_popup_uiinfo[] =
{ {
GNOME_APP_UI_ITEM, N_("Audio"), GNOME_APP_UI_ITEM, N_("Audio"),
N_("Select audio channel"), N_("Select audio channel"),
(gpointer) on_popup_audio_activate, NULL, NULL, (gpointer) NULL, NULL, NULL,
GNOME_APP_PIXMAP_NONE, NULL, GNOME_APP_PIXMAP_NONE, NULL,
0, (GdkModifierType) 0, NULL 0, (GdkModifierType) 0, NULL
}, },
{ {
GNOME_APP_UI_ITEM, N_("_Subtitle"), GNOME_APP_UI_ITEM, N_("_Subtitle"),
NULL, N_("Select subtitle channel"),
(gpointer) on_popup_subtitle_activate, NULL, NULL, (gpointer) NULL, NULL, NULL,
GNOME_APP_PIXMAP_NONE, NULL, GNOME_APP_PIXMAP_NONE, NULL,
0, (GdkModifierType) 0, NULL 0, (GdkModifierType) 0, NULL
}, },
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* intf_gnome.c: Gnome interface * intf_gnome.c: Gnome interface
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: intf_gnome.c,v 1.20 2001/03/07 11:56:33 stef Exp $ * $Id: intf_gnome.c,v 1.21 2001/03/15 00:37:04 stef Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -66,11 +66,12 @@ static void intf_Run ( intf_thread_t *p_intf ); ...@@ -66,11 +66,12 @@ static void intf_Run ( intf_thread_t *p_intf );
static gint GnomeManage ( gpointer p_data ); static gint GnomeManage ( gpointer p_data );
static gint GnomeLanguageMenus( gpointer, GtkWidget *, es_descriptor_t *, gint, static gint GnomeLanguageMenus( gpointer, GtkWidget *, es_descriptor_t *, gint,
void (*pf_activate)(GtkMenuItem *, gpointer) ); void (*pf_toggle)(GtkCheckMenuItem *, gpointer) );
static gint GnomeChapterMenu ( gpointer, GtkWidget *, static gint GnomeChapterMenu ( gpointer, GtkWidget *,
void (*pf_activate)(GtkMenuItem *, gpointer) ); void (*pf_toggle)(GtkCheckMenuItem *, gpointer) );
static gint GnomeTitleMenu ( gpointer, GtkWidget *, static gint GnomeTitleMenu ( gpointer, GtkWidget *,
void (*pf_activate)(GtkMenuItem *, gpointer) ); void (*pf_toggle)(GtkCheckMenuItem *, gpointer) );
static gint GnomeSetupMenu ( intf_thread_t * p_intf );
/***************************************************************************** /*****************************************************************************
* g_atexit: kludge to avoid the Gnome thread to segfault at exit * g_atexit: kludge to avoid the Gnome thread to segfault at exit
...@@ -141,6 +142,7 @@ static int intf_Open( intf_thread_t *p_intf ) ...@@ -141,6 +142,7 @@ static int intf_Open( intf_thread_t *p_intf )
p_intf->p_sys->b_popup_changed = 0; p_intf->p_sys->b_popup_changed = 0;
p_intf->p_sys->b_window_changed = 0; p_intf->p_sys->b_window_changed = 0;
p_intf->p_sys->b_playlist_changed = 0; p_intf->p_sys->b_playlist_changed = 0;
p_intf->p_sys->b_menus_update = 1;
p_intf->p_sys->b_scale_isfree = 1; p_intf->p_sys->b_scale_isfree = 1;
...@@ -266,74 +268,7 @@ static gint GnomeManage( gpointer p_data ) ...@@ -266,74 +268,7 @@ static gint GnomeManage( gpointer p_data )
if( p_intf->p_input != NULL && p_intf->p_sys->p_window != NULL && if( p_intf->p_input != NULL && p_intf->p_sys->p_window != NULL &&
p_intf->p_sys->b_menus_update ) p_intf->p_sys->b_menus_update )
{ {
es_descriptor_t * p_audio_es; GnomeSetupMenu( p_intf );
es_descriptor_t * p_spu_es;
GtkWidget * p_menubar_menu;
GtkWidget * p_popup_menu;
gint i;
p_menubar_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_window ), "menubar_title" ) );
GnomeTitleMenu( p_intf, p_menubar_menu, on_menubar_title_activate );
p_menubar_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_window ), "menubar_chapter" ) );
GnomeChapterMenu( p_intf, p_menubar_menu, on_menubar_chapter_activate );
p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_popup ), "popup_navigation" ) );
GnomeTitleMenu( p_intf, p_popup_menu, on_popup_navigation_activate );
/* look for selected ES */
p_audio_es = NULL;
p_spu_es = NULL;
for( i = 0 ; i < p_intf->p_input->stream.i_selected_es_number ; i++ )
{
if( p_intf->p_input->stream.pp_es[i]->b_audio )
{
p_audio_es = p_intf->p_input->stream.pp_es[i];
}
if( p_intf->p_input->stream.pp_es[i]->b_spu )
{
p_spu_es = p_intf->p_input->stream.pp_es[i];
}
}
/* audio menus */
/* find audio root menu */
p_menubar_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_window ), "menubar_audio" ) );
p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_popup ), "popup_audio" ) );
GnomeLanguageMenus( p_intf, p_menubar_menu, p_audio_es, 1,
on_menubar_audio_activate );
GnomeLanguageMenus( p_intf, p_popup_menu, p_audio_es, 1,
on_popup_audio_activate );
/* sub picture menus */
/* find spu root menu */
p_menubar_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_window ), "menubar_subtitle" ) );
p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_popup ), "popup_subtitle" ) );
GnomeLanguageMenus( p_intf, p_menubar_menu, p_spu_es, 2,
on_menubar_subtitle_activate );
GnomeLanguageMenus( p_intf, p_popup_menu, p_spu_es, 2,
on_popup_subtitle_activate );
/* everything is ready */
p_intf->p_sys->b_menus_update = 0;
} }
/* Manage the slider */ /* Manage the slider */
...@@ -379,62 +314,6 @@ static gint GnomeManage( gpointer p_data ) ...@@ -379,62 +314,6 @@ static gint GnomeManage( gpointer p_data )
return( TRUE ); return( TRUE );
} }
/*****************************************************************************
* GnomeMenuRadioItem: give a menu item adapted to language/title selection,
* ie the menu item is a radio button.
*****************************************************************************/
static GtkWidget * GnomeMenuRadioItem( 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;
}
/***************************************************************************** /*****************************************************************************
* GnomeLanguageMenus: update interactive menus of the interface * GnomeLanguageMenus: update interactive menus of the interface
***************************************************************************** *****************************************************************************
...@@ -448,13 +327,14 @@ static gint GnomeLanguageMenus( gpointer p_data, ...@@ -448,13 +327,14 @@ static gint GnomeLanguageMenus( gpointer p_data,
GtkWidget * p_root, GtkWidget * p_root,
es_descriptor_t * p_es, es_descriptor_t * p_es,
gint i_type, gint i_type,
void(*pf_activate )( GtkMenuItem *, gpointer ) ) void(*pf_toggle )( GtkCheckMenuItem *, gpointer ) )
{ {
intf_thread_t * p_intf; intf_thread_t * p_intf;
GtkWidget * p_menu; GtkWidget * p_menu;
GtkWidget * p_separator; GtkWidget * p_separator;
GtkWidget * p_item; GtkWidget * p_item;
GSList * p_button_group; GtkWidget * p_item_off;
GSList * p_group;
char * psz_name; char * psz_name;
gint b_active; gint b_active;
gint b_audio; gint b_audio;
...@@ -468,27 +348,32 @@ static gint GnomeLanguageMenus( gpointer p_data, ...@@ -468,27 +348,32 @@ static gint GnomeLanguageMenus( gpointer p_data,
vlc_mutex_lock( &p_intf->p_input->stream.stream_lock ); vlc_mutex_lock( &p_intf->p_input->stream.stream_lock );
/* removes previous menu */
gtk_menu_item_remove_submenu( GTK_MENU_ITEM( p_root ) );
b_audio = ( i_type == 1 ); b_audio = ( i_type == 1 );
p_button_group = NULL; p_group = NULL;
/* menu container for audio */ /* menu container */
p_menu = gtk_menu_new(); p_menu = gtk_menu_new();
/* create a set of language buttons and append them to the container */ /* special case for "off" item */
b_active = ( p_es == NULL ) ? 1 : 0; b_active = ( p_es == NULL ) ? TRUE : FALSE;
psz_name = "Off"; psz_name = "Off";
p_item = GnomeMenuRadioItem( p_menu, &p_button_group, b_active, psz_name ); p_item_off = gtk_radio_menu_item_new_with_label( p_group, psz_name );
p_group = gtk_radio_menu_item_group( GTK_RADIO_MENU_ITEM( p_item_off ) );
/* setup signal hanling */ gtk_widget_show( p_item_off );
gtk_signal_connect( GTK_OBJECT( p_item ), "activate", gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( p_item_off ),
GTK_SIGNAL_FUNC ( pf_activate ), NULL ); b_active );
gtk_menu_append( GTK_MENU( p_menu ), p_item_off );
p_separator = gtk_menu_item_new(); p_separator = gtk_menu_item_new();
gtk_widget_show( p_separator ); gtk_widget_show( p_separator );
gtk_menu_append( GTK_MENU( p_menu ), p_separator ); gtk_menu_append( GTK_MENU( p_menu ), p_separator );
gtk_widget_set_sensitive( p_separator, FALSE ); gtk_widget_set_sensitive( p_separator, FALSE );
/* create a set of language buttons and append them to the container */
for( i = 0 ; i < p_intf->p_input->stream.i_es_number ; i++ ) for( i = 0 ; i < p_intf->p_input->stream.i_es_number ; i++ )
{ {
...@@ -497,20 +382,31 @@ static gint GnomeLanguageMenus( gpointer p_data, ...@@ -497,20 +382,31 @@ static gint GnomeLanguageMenus( gpointer p_data,
if( b_audio || b_spu ) if( b_audio || b_spu )
{ {
b_active = ( p_es == p_intf->p_input->stream.pp_es[i] ) ? 1 : 0; b_active = ( p_es == p_intf->p_input->stream.pp_es[i] ) ? TRUE :
FALSE;
psz_name = p_intf->p_input->stream.pp_es[i]->psz_desc; psz_name = p_intf->p_input->stream.pp_es[i]->psz_desc;
p_item = GnomeMenuRadioItem( p_menu, &p_button_group, p_item = gtk_radio_menu_item_new_with_label( p_group, psz_name );
b_active, psz_name ); p_group =
gtk_radio_menu_item_group( GTK_RADIO_MENU_ITEM( p_item ) );
gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( p_item ),
b_active );
gtk_menu_append( GTK_MENU( p_menu ), p_item );
gtk_widget_show( p_item );
/* setup signal hanling */ /* setup signal hanling */
gtk_signal_connect( GTK_OBJECT( p_item ), "activate", gtk_signal_connect( GTK_OBJECT( p_item ), "toggled",
GTK_SIGNAL_FUNC( pf_activate ), GTK_SIGNAL_FUNC( pf_toggle ),
(gpointer)( p_intf->p_input->stream.pp_es[i] ) ); (gpointer)( p_intf->p_input->stream.pp_es[i] ) );
} }
} }
/* signal hanling for off - dunno why this does not work
* if it is before the loop */
gtk_signal_connect( GTK_OBJECT( p_item_off ), "toggled",
GTK_SIGNAL_FUNC ( pf_toggle ), NULL );
/* link the new menu to the menubar item */ /* link the new menu to the menubar item */
gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_root ), p_menu ); gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_root ), p_menu );
...@@ -523,16 +419,16 @@ static gint GnomeLanguageMenus( gpointer p_data, ...@@ -523,16 +419,16 @@ static gint GnomeLanguageMenus( gpointer p_data,
} }
/***************************************************************************** /*****************************************************************************
* GnomeChapterMenu: generate chapter menu foir current title * GnomeChapterMenu: generate chapter menu for current title
*****************************************************************************/ *****************************************************************************/
static gint GnomeChapterMenu( gpointer p_data, GtkWidget * p_chapter, static gint GnomeChapterMenu( gpointer p_data, GtkWidget * p_chapter,
void(*pf_activate )( GtkMenuItem *, gpointer ) ) void(*pf_toggle )( GtkCheckMenuItem *, gpointer ) )
{ {
intf_thread_t * p_intf; intf_thread_t * p_intf;
char psz_name[10]; char psz_name[10];
GtkWidget * p_chapter_menu; GtkWidget * p_chapter_menu;
GtkWidget * p_item; GtkWidget * p_item;
GSList * p_chapter_button_group; GSList * p_chapter_group;
gint i_title; gint i_title;
gint i_chapter; gint i_chapter;
gint b_active; gint b_active;
...@@ -540,6 +436,11 @@ static gint GnomeChapterMenu( gpointer p_data, GtkWidget * p_chapter, ...@@ -540,6 +436,11 @@ static gint GnomeChapterMenu( gpointer p_data, GtkWidget * p_chapter,
/* cast */ /* cast */
p_intf = (intf_thread_t*)p_data; p_intf = (intf_thread_t*)p_data;
/* removes previous menu */
gtk_menu_item_remove_submenu( GTK_MENU_ITEM( p_chapter ) );
p_chapter_group = NULL;
i_title = p_intf->p_input->stream.p_selected_area->i_id; i_title = p_intf->p_input->stream.p_selected_area->i_id;
p_chapter_menu = gtk_menu_new(); p_chapter_menu = gtk_menu_new();
...@@ -552,12 +453,19 @@ static gint GnomeChapterMenu( gpointer p_data, GtkWidget * p_chapter, ...@@ -552,12 +453,19 @@ static gint GnomeChapterMenu( gpointer p_data, GtkWidget * p_chapter,
sprintf( psz_name, "Chapter %d", i_chapter + 1 ); sprintf( psz_name, "Chapter %d", i_chapter + 1 );
p_item = GnomeMenuRadioItem( p_chapter_menu, &p_chapter_button_group, p_item = gtk_radio_menu_item_new_with_label( p_chapter_group,
b_active, psz_name ); psz_name );
p_chapter_group =
gtk_radio_menu_item_group( GTK_RADIO_MENU_ITEM( p_item ) );
gtk_menu_append( GTK_MENU( p_chapter_menu ), p_item );
gtk_widget_show( p_item );
gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( p_item ),
b_active );
/* setup signal hanling */ /* setup signal hanling */
gtk_signal_connect( GTK_OBJECT( p_item ), gtk_signal_connect( GTK_OBJECT( p_item ),
"activate", "toggled",
GTK_SIGNAL_FUNC( pf_activate ), GTK_SIGNAL_FUNC( pf_toggle ),
(gpointer)(i_chapter + 1) ); (gpointer)(i_chapter + 1) );
} }
...@@ -574,13 +482,13 @@ static gint GnomeChapterMenu( gpointer p_data, GtkWidget * p_chapter, ...@@ -574,13 +482,13 @@ static gint GnomeChapterMenu( gpointer p_data, GtkWidget * p_chapter,
/***************************************************************************** /*****************************************************************************
* GnomeTitleMenu: sets menus for titles and chapters selection * GnomeTitleMenu: sets menus for titles and chapters selection
***************************************************************************** *****************************************************************************
* Generates two type of menus: * Generates two types of menus:
* -simple list of titles * -simple list of titles
* -cascaded lists of chapters for each title * -cascaded lists of chapters for each title
*****************************************************************************/ *****************************************************************************/
static gint GnomeTitleMenu( gpointer p_data, static gint GnomeTitleMenu( gpointer p_data,
GtkWidget * p_navigation, GtkWidget * p_navigation,
void(*pf_activate )( GtkMenuItem *, gpointer ) ) void(*pf_toggle )( GtkCheckMenuItem *, gpointer ) )
{ {
intf_thread_t * p_intf; intf_thread_t * p_intf;
char psz_name[10]; char psz_name[10];
...@@ -588,8 +496,8 @@ static gint GnomeTitleMenu( gpointer p_data, ...@@ -588,8 +496,8 @@ static gint GnomeTitleMenu( gpointer p_data,
GtkWidget * p_title_item; GtkWidget * p_title_item;
GtkWidget * p_chapter_menu; GtkWidget * p_chapter_menu;
GtkWidget * p_item; GtkWidget * p_item;
GSList * p_title_button_group; GSList * p_title_group;
GSList * p_chapter_button_group; GSList * p_chapter_group;
gint i_title; gint i_title;
gint i_chapter; gint i_chapter;
gint b_active; gint b_active;
...@@ -598,8 +506,8 @@ static gint GnomeTitleMenu( gpointer p_data, ...@@ -598,8 +506,8 @@ static gint GnomeTitleMenu( gpointer p_data,
p_intf = (intf_thread_t*)p_data; p_intf = (intf_thread_t*)p_data;
p_title_menu = gtk_menu_new(); p_title_menu = gtk_menu_new();
p_title_button_group = NULL; p_title_group = NULL;
p_chapter_button_group = NULL; p_chapter_group = NULL;
/* loop on titles */ /* loop on titles */
for( i_title = 1 ; for( i_title = 1 ;
...@@ -610,15 +518,24 @@ static gint GnomeTitleMenu( gpointer p_data, ...@@ -610,15 +518,24 @@ static gint GnomeTitleMenu( gpointer p_data,
p_intf->p_input->stream.p_selected_area ) ? 1 : 0; p_intf->p_input->stream.p_selected_area ) ? 1 : 0;
sprintf( psz_name, "Title %d", i_title ); sprintf( psz_name, "Title %d", i_title );
p_title_item = GnomeMenuRadioItem( p_title_menu, &p_title_button_group, p_title_item = gtk_radio_menu_item_new_with_label( p_title_group,
b_active, psz_name ); psz_name );
p_title_group =
gtk_radio_menu_item_group( GTK_RADIO_MENU_ITEM( p_title_item ) );
gtk_menu_append( GTK_MENU( p_title_menu ), p_title_item );
gtk_widget_show( p_title_item );
if( pf_activate == on_menubar_title_activate ) if( pf_toggle == on_menubar_title_toggle )
{ {
gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( p_title_item ),
b_active );
/* setup signal hanling */ /* setup signal hanling */
gtk_signal_connect( GTK_OBJECT( p_title_item ), gtk_signal_connect( GTK_OBJECT( p_title_item ),
"activate", "toggled",
GTK_SIGNAL_FUNC( pf_activate ), GTK_SIGNAL_FUNC( pf_toggle ),
(gpointer)(p_intf->p_input->stream.pp_areas[i_title]) ); (gpointer)(p_intf->p_input->stream.pp_areas[i_title]) );
} }
else else
...@@ -635,14 +552,19 @@ static gint GnomeTitleMenu( gpointer p_data, ...@@ -635,14 +552,19 @@ static gint GnomeTitleMenu( gpointer p_data,
sprintf( psz_name, "Chapter %d", i_chapter + 1 ); sprintf( psz_name, "Chapter %d", i_chapter + 1 );
p_item = GnomeMenuRadioItem( p_chapter_menu, p_item = gtk_radio_menu_item_new_with_label(
&p_chapter_button_group, p_chapter_group, psz_name );
b_active, psz_name ); p_chapter_group = gtk_radio_menu_item_group(
GTK_RADIO_MENU_ITEM( p_item ) );
gtk_menu_append( GTK_MENU( p_chapter_menu ), p_item );
gtk_widget_show( p_item );
gtk_check_menu_item_set_active(
GTK_CHECK_MENU_ITEM( p_item ), b_active );
/* setup signal hanling */ /* setup signal hanling */
gtk_signal_connect( GTK_OBJECT( p_item ), gtk_signal_connect( GTK_OBJECT( p_item ),
"activate", "toggled",
GTK_SIGNAL_FUNC( pf_activate ), GTK_SIGNAL_FUNC( pf_toggle ),
(gpointer)( ( i_title * 100 ) + ( i_chapter + 1) ) ); (gpointer)( ( i_title * 100 ) + ( i_chapter + 1) ) );
} }
...@@ -656,12 +578,90 @@ static gint GnomeTitleMenu( gpointer p_data, ...@@ -656,12 +578,90 @@ static gint GnomeTitleMenu( gpointer p_data,
} }
/* link the new menu to the menubar audio item */ /* link the new menu to the menubar item */
gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_navigation ), p_title_menu ); gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_navigation ), p_title_menu );
/* be sure that audio menu is sensitive */ /* be sure that menu is sensitive */
gtk_widget_set_sensitive( p_navigation, TRUE ); gtk_widget_set_sensitive( p_navigation, TRUE );
return TRUE;
}
/*****************************************************************************
* GnomeSetupMenu: function that generates title/chapter/audio/subpic
* menus with help from preceding functions
*****************************************************************************/
static gint GnomeSetupMenu( intf_thread_t * p_intf )
{
es_descriptor_t * p_audio_es;
es_descriptor_t * p_spu_es;
GtkWidget * p_menubar_menu;
GtkWidget * p_popup_menu;
gint i;
p_menubar_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_window ), "menubar_title" ) );
GnomeTitleMenu( p_intf, p_menubar_menu, on_menubar_title_toggle );
p_menubar_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_window ), "menubar_chapter" ) );
GnomeChapterMenu( p_intf, p_menubar_menu, on_menubar_chapter_toggle );
p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_popup ), "popup_navigation" ) );
GnomeTitleMenu( p_intf, p_popup_menu, on_popup_navigation_toggle );
/* look for selected ES */
p_audio_es = NULL;
p_spu_es = NULL;
for( i = 0 ; i < p_intf->p_input->stream.i_selected_es_number ; i++ )
{
if( p_intf->p_input->stream.pp_es[i]->b_audio )
{
p_audio_es = p_intf->p_input->stream.pp_es[i];
}
if( p_intf->p_input->stream.pp_es[i]->b_spu )
{
p_spu_es = p_intf->p_input->stream.pp_es[i];
}
}
/* audio menus */
/* find audio root menu */
p_menubar_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_window ), "menubar_audio" ) );
p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_popup ), "popup_audio" ) );
GnomeLanguageMenus( p_intf, p_menubar_menu, p_audio_es, 1,
on_menubar_audio_toggle );
GnomeLanguageMenus( p_intf, p_popup_menu, p_audio_es, 1,
on_popup_audio_toggle );
/* sub picture menus */
/* find spu root menu */
p_menubar_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_window ), "menubar_subtitle" ) );
p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_popup ), "popup_subtitle" ) );
GnomeLanguageMenus( p_intf, p_menubar_menu, p_spu_es, 2,
on_menubar_subtitle_toggle );
GnomeLanguageMenus( p_intf, p_popup_menu, p_spu_es, 2,
on_popup_subtitle_toggle );
/* everything is ready */
p_intf->p_sys->b_menus_update = 0;
return TRUE; return TRUE;
} }
...@@ -657,6 +657,7 @@ ...@@ -657,6 +657,7 @@
<class>GtkMenuItem</class> <class>GtkMenuItem</class>
<name>popup_navigation</name> <name>popup_navigation</name>
<sensitive>False</sensitive> <sensitive>False</sensitive>
<tooltip>Navigate through titles and chapters</tooltip>
<label>_Navigation</label> <label>_Navigation</label>
<right_justify>False</right_justify> <right_justify>False</right_justify>
</widget> </widget>
...@@ -672,11 +673,6 @@ ...@@ -672,11 +673,6 @@
<name>popup_audio</name> <name>popup_audio</name>
<sensitive>False</sensitive> <sensitive>False</sensitive>
<tooltip>Select audio channel</tooltip> <tooltip>Select audio channel</tooltip>
<signal>
<name>activate</name>
<handler>on_popup_audio_activate</handler>
<last_modification_time>Thu, 22 Feb 2001 05:35:57 GMT</last_modification_time>
</signal>
<label>Audio</label> <label>Audio</label>
<right_justify>False</right_justify> <right_justify>False</right_justify>
</widget> </widget>
...@@ -685,11 +681,7 @@ ...@@ -685,11 +681,7 @@
<class>GtkMenuItem</class> <class>GtkMenuItem</class>
<name>popup_subtitle</name> <name>popup_subtitle</name>
<sensitive>False</sensitive> <sensitive>False</sensitive>
<signal> <tooltip>Select subtitle channel</tooltip>
<name>activate</name>
<handler>on_popup_subtitle_activate</handler>
<last_modification_time>Thu, 22 Feb 2001 05:35:57 GMT</last_modification_time>
</signal>
<label>_Subtitle</label> <label>_Subtitle</label>
<right_justify>False</right_justify> <right_justify>False</right_justify>
</widget> </widget>
......
...@@ -267,14 +267,14 @@ int input_ChangeES( input_thread_t * p_input, es_descriptor_t * p_es, ...@@ -267,14 +267,14 @@ int input_ChangeES( input_thread_t * p_input, es_descriptor_t * p_es,
input_UnselectES( p_input, input_UnselectES( p_input,
p_input->stream.pp_selected_es[i_index] ); p_input->stream.pp_selected_es[i_index] );
input_SelectES( p_input, p_es ); input_SelectES( p_input, p_es );
intf_WarnMsg( 1, "dvd info: ES selected -> %s (0x%x)", intf_WarnMsg( 1, "input info: es selected -> %s (0x%x)",
p_es->psz_desc, p_es->i_id ); p_es->psz_desc, p_es->i_id );
} }
} }
else else
{ {
input_SelectES( p_input, p_es ); input_SelectES( p_input, p_es );
intf_WarnMsg( 1, "dvd info: selected -> %s (0x%x)", intf_WarnMsg( 1, "input info: es selected -> %s (0x%x)",
p_es->psz_desc, p_es->i_id ); p_es->psz_desc, p_es->i_id );
} }
} }
...@@ -282,6 +282,10 @@ int input_ChangeES( input_thread_t * p_input, es_descriptor_t * p_es, ...@@ -282,6 +282,10 @@ int input_ChangeES( input_thread_t * p_input, es_descriptor_t * p_es,
{ {
if( i_index != -1 ) if( i_index != -1 )
{ {
intf_WarnMsg( 1, "input info: es unselected -> %s (0x%x)",
p_input->stream.pp_selected_es[i_index]->psz_desc,
p_input->stream.pp_selected_es[i_index]->i_id );
input_UnselectES( p_input, input_UnselectES( p_input,
p_input->stream.pp_selected_es[i_index] ); p_input->stream.pp_selected_es[i_index] );
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* mpeg_system.c: TS, PS and PES management * mpeg_system.c: TS, PS and PES management
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: mpeg_system.c,v 1.43 2001/03/07 00:18:46 henri Exp $ * $Id: mpeg_system.c,v 1.44 2001/03/15 00:37:04 stef Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* Michel Lespinasse <walken@via.ecp.fr> * Michel Lespinasse <walken@via.ecp.fr>
...@@ -748,6 +748,7 @@ es_descriptor_t * input_ParsePS( input_thread_t * p_input, ...@@ -748,6 +748,7 @@ es_descriptor_t * input_ParsePS( input_thread_t * p_input,
{ {
/* Subtitles video (0x20->0x3F) */ /* Subtitles video (0x20->0x3F) */
p_es->i_type = DVD_SPU_ES; p_es->i_type = DVD_SPU_ES;
p_es->b_spu = 1;
#ifdef AUTO_SPAWN #ifdef AUTO_SPAWN
if( main_GetIntVariable( INPUT_SUBTITLE_VAR, -1 ) if( main_GetIntVariable( INPUT_SUBTITLE_VAR, -1 )
== ((p_es->i_id & 0x1F00) >> 8) ) == ((p_es->i_id & 0x1F00) >> 8) )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment