}
-void
-on_menubar_audio_activate (GtkMenuItem *menuitem,
- gpointer user_data)
-{
-
-}
-
-
-void
-on_menubar_subtitles_activate (GtkMenuItem *menuitem,
- gpointer user_data)
-{
-
-}
-
-
-void
-on_popup_title_activate (GtkMenuItem *menuitem,
- gpointer user_data)
-{
-
-}
-
-
-void
-on_popup_chapter_activate (GtkMenuItem *menuitem,
- gpointer user_data)
-{
-
-}
-
-
-void
-on_popup_audio_activate (GtkMenuItem *menuitem,
- gpointer user_data)
-{
-
-}
-
-
-void
-on_popup_subtitle_activate (GtkMenuItem *menuitem,
- gpointer user_data)
-{
-
-}
-
-
void
on_menubar_disc_activate (GtkMenuItem *menuitem,
gpointer user_data)
gdk_window_raise( p_intf->p_sys->p_disc->window );
}
+
+void
+on_popup_audio_activate (GtkMenuItem *menuitem,
+ gpointer user_data)
+{
+ intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
+ es_descriptor_t * p_es;
+
+ p_es = (es_descriptor_t*)user_data;
+
+ input_ChangeES( p_intf->p_input, p_es, 1 );
+}
+
+
+void
+on_popup_subtitle_activate (GtkMenuItem *menuitem,
+ gpointer user_data)
+{
+ intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
+ es_descriptor_t * p_es;
+
+ p_es = (es_descriptor_t*)user_data;
+
+ input_ChangeES( p_intf->p_input, p_es, 2 );
+}
+
+
+void
+on_menubar_audio_activate (GtkMenuItem *menuitem,
+ gpointer user_data)
+{
+ intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
+ es_descriptor_t * p_es;
+
+ p_es = (es_descriptor_t*)user_data;
+
+ input_ChangeES( p_intf->p_input, p_es, 1 );
+}
+
+
+void
+on_menubar_subtitle_activate (GtkMenuItem *menuitem,
+ gpointer user_data)
+{
+ intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
+ es_descriptor_t * p_es;
+
+ p_es = (es_descriptor_t*)user_data;
+
+ input_ChangeES( p_intf->p_input, p_es, 2 );
+}
+
+
+void
+on_popup_navigation_activate (GtkMenuItem *menuitem,
+ gpointer user_data)
+{
+ intf_thread_t * p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
+ 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 );
+ p_area = p_intf->p_input->stream.pp_areas[i_title];
+ 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
+on_menubar_title_activate (GtkMenuItem *menuitem,
+ gpointer user_data)
+{
+ intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
+
+ 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
+on_menubar_chapter_activate (GtkMenuItem *menuitem,
+ gpointer user_data)
+{
+ intf_thread_t * p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
+ input_area_t * p_area = p_intf->p_input->stream.p_selected_area;
+ gint i_chapter = (gint)user_data;
+
+ 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 );
+}
gpointer user_data);
void
-on_menubar_subtitles_activate (GtkMenuItem *menuitem,
+on_menubar_disc_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
-on_popup_title_activate (GtkMenuItem *menuitem,
+on_toolbar_disc_clicked (GtkButton *button,
gpointer user_data);
void
-on_popup_chapter_activate (GtkMenuItem *menuitem,
+on_disc_ok_clicked (GtkButton *button,
gpointer user_data);
void
-on_popup_audio_activate (GtkMenuItem *menuitem,
+on_disc_cancel_clicked (GtkButton *button,
gpointer user_data);
void
-on_popup_subtitle_activate (GtkMenuItem *menuitem,
+on_disc_dvd_toggled (GtkToggleButton *togglebutton,
gpointer user_data);
void
-on_menubar_disc_activate (GtkMenuItem *menuitem,
+on_disc_vcd_toggled (GtkToggleButton *togglebutton,
gpointer user_data);
void
-on_toolbar_disc_clicked (GtkButton *button,
+on_popup_disc_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
-on_disc_ok_clicked (GtkButton *button,
+on_popup_audio_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
-on_disc_cancel_clicked (GtkButton *button,
+on_popup_subtitle_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
-on_disc_dvd_toggled (GtkToggleButton *togglebutton,
+on_menubar_audio_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
-on_disc_vcd_toggled (GtkToggleButton *togglebutton,
+on_menubar_subtitle_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
-on_popup_disc_activate (GtkMenuItem *menuitem,
+on_popup_navigation_activate (GtkMenuItem *menuitem,
+ gpointer user_data);
+
+void
+on_menubar_title_activate (GtkMenuItem *menuitem,
+ gpointer user_data);
+
+void
+on_menubar_chapter_activate (GtkMenuItem *menuitem,
gpointer user_data);
static GnomeUIInfo menubar_view_menu_uiinfo[] =
{
+ {
+ GNOME_APP_UI_ITEM, N_("_Title"),
+ NULL,
+ (gpointer) NULL, NULL, NULL,
+ GNOME_APP_PIXMAP_NONE, NULL,
+ 0, (GdkModifierType) 0, NULL
+ },
+ {
+ GNOME_APP_UI_ITEM, N_("_Chapter"),
+ NULL,
+ (gpointer) NULL, NULL, NULL,
+ GNOME_APP_PIXMAP_NONE, NULL,
+ 0, (GdkModifierType) 0, NULL
+ },
+ GNOMEUIINFO_SEPARATOR,
{
GNOME_APP_UI_ITEM, N_("_Playlist..."),
N_("Open the playlist window"),
{
GNOME_APP_UI_ITEM, N_("_Audio"),
N_("Select audio channel"),
- (gpointer) on_menubar_audio_activate, NULL, NULL,
+ (gpointer) NULL, NULL, NULL,
GNOME_APP_PIXMAP_NONE, NULL,
0, (GdkModifierType) 0, NULL
},
{
- GNOME_APP_UI_ITEM, N_("_Subtitles"),
+ GNOME_APP_UI_ITEM, N_("_Subtitle"),
N_("Select subtitle unit"),
- (gpointer) on_menubar_subtitles_activate, NULL, NULL,
+ (gpointer) NULL, NULL, NULL,
GNOME_APP_PIXMAP_NONE, NULL,
0, (GdkModifierType) 0, NULL
},
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_ref (menubar_view_menu_uiinfo[0].widget);
- gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_playlist",
+ gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_title",
menubar_view_menu_uiinfo[0].widget,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_set_sensitive (menubar_view_menu_uiinfo[0].widget, FALSE);
gtk_widget_ref (menubar_view_menu_uiinfo[1].widget);
- gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_modules",
+ gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_chapter",
menubar_view_menu_uiinfo[1].widget,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_set_sensitive (menubar_view_menu_uiinfo[1].widget, FALSE);
+ gtk_widget_ref (menubar_view_menu_uiinfo[2].widget);
+ gtk_object_set_data_full (GTK_OBJECT (intf_window), "separator7",
+ menubar_view_menu_uiinfo[2].widget,
+ (GtkDestroyNotify) gtk_widget_unref);
+
+ gtk_widget_ref (menubar_view_menu_uiinfo[3].widget);
+ gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_playlist",
+ menubar_view_menu_uiinfo[3].widget,
+ (GtkDestroyNotify) gtk_widget_unref);
+ gtk_widget_set_sensitive (menubar_view_menu_uiinfo[3].widget, FALSE);
+
+ gtk_widget_ref (menubar_view_menu_uiinfo[4].widget);
+ gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_modules",
+ menubar_view_menu_uiinfo[4].widget,
+ (GtkDestroyNotify) gtk_widget_unref);
+ gtk_widget_set_sensitive (menubar_view_menu_uiinfo[4].widget, FALSE);
+
gtk_widget_ref (menubar_uiinfo[2].widget);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_settings",
menubar_uiinfo[2].widget,
gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_audio",
menubar_settings_menu_uiinfo[0].widget,
(GtkDestroyNotify) gtk_widget_unref);
+ gtk_widget_set_sensitive (menubar_settings_menu_uiinfo[0].widget, FALSE);
gtk_widget_ref (menubar_settings_menu_uiinfo[1].widget);
- gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_subtitles",
+ gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_subtitle",
menubar_settings_menu_uiinfo[1].widget,
(GtkDestroyNotify) gtk_widget_unref);
+ gtk_widget_set_sensitive (menubar_settings_menu_uiinfo[1].widget, FALSE);
gtk_widget_ref (menubar_settings_menu_uiinfo[2].widget);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "separator5",
return intf_window;
}
-static GnomeUIInfo popup_title_menu_uiinfo[] =
-{
- {
- GNOME_APP_UI_ITEM, N_("_Chapter"),
- NULL,
- (gpointer) on_popup_chapter_activate, NULL, NULL,
- GNOME_APP_PIXMAP_NONE, NULL,
- 0, (GdkModifierType) 0, NULL
- },
- GNOMEUIINFO_END
-};
-
static GnomeUIInfo intf_popup_uiinfo[] =
{
{
},
GNOMEUIINFO_SEPARATOR,
{
- GNOME_APP_UI_SUBTREE, N_("_Title"),
- N_("Select Title"),
- popup_title_menu_uiinfo, NULL, NULL,
+ GNOME_APP_UI_ITEM, N_("_Navigation"),
+ NULL,
+ (gpointer) NULL, NULL, NULL,
GNOME_APP_PIXMAP_NONE, NULL,
0, (GdkModifierType) 0, NULL
},
+ GNOMEUIINFO_SEPARATOR,
{
GNOME_APP_UI_ITEM, N_("Audio"),
N_("Select audio channel"),
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_ref (intf_popup_uiinfo[8].widget);
- gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_title",
+ gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_navigation",
intf_popup_uiinfo[8].widget,
(GtkDestroyNotify) gtk_widget_unref);
-
- gtk_widget_ref (popup_title_menu_uiinfo[0].widget);
- gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_chapter",
- popup_title_menu_uiinfo[0].widget,
- (GtkDestroyNotify) gtk_widget_unref);
+ gtk_widget_set_sensitive (intf_popup_uiinfo[8].widget, FALSE);
gtk_widget_ref (intf_popup_uiinfo[9].widget);
- gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_audio",
+ gtk_object_set_data_full (GTK_OBJECT (intf_popup), "separator8",
intf_popup_uiinfo[9].widget,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_ref (intf_popup_uiinfo[10].widget);
- gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_subtitle",
+ gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_audio",
intf_popup_uiinfo[10].widget,
(GtkDestroyNotify) gtk_widget_unref);
+ gtk_widget_set_sensitive (intf_popup_uiinfo[10].widget, FALSE);
gtk_widget_ref (intf_popup_uiinfo[11].widget);
- gtk_object_set_data_full (GTK_OBJECT (intf_popup), "separator4",
+ gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_subtitle",
intf_popup_uiinfo[11].widget,
(GtkDestroyNotify) gtk_widget_unref);
+ gtk_widget_set_sensitive (intf_popup_uiinfo[11].widget, FALSE);
gtk_widget_ref (intf_popup_uiinfo[12].widget);
- gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_about",
+ gtk_object_set_data_full (GTK_OBJECT (intf_popup), "separator4",
intf_popup_uiinfo[12].widget,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_ref (intf_popup_uiinfo[13].widget);
- gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_exit",
+ gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_about",
intf_popup_uiinfo[13].widget,
(GtkDestroyNotify) gtk_widget_unref);
+ gtk_widget_ref (intf_popup_uiinfo[14].widget);
+ gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_exit",
+ intf_popup_uiinfo[14].widget,
+ (GtkDestroyNotify) gtk_widget_unref);
+
return intf_popup;
}
* gnome_sys.h: private Gnome interface description
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: gnome_sys.h,v 1.6 2001/03/04 03:12:00 sam Exp $
+ * $Id: gnome_sys.h,v 1.7 2001/03/07 11:56:33 stef Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
boolean_t b_window_changed; /* window display toggled ? */
boolean_t b_playlist_changed; /* playlist display toggled ? */
boolean_t b_scale_isfree; /* user isn't dragging scale ? */
+ boolean_t b_menus_update;
/* intf_Manage callback timeout */
int i_timeout;
* intf_gnome.c: Gnome interface
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: intf_gnome.c,v 1.19 2001/03/04 03:12:00 sam Exp $
+ * $Id: intf_gnome.c,v 1.20 2001/03/07 11:56:33 stef Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
#include "interface.h"
#include "gnome_sys.h"
+#include "gnome_callbacks.h"
#include "gnome_interface.h"
#include "gnome_support.h"
static void intf_Run ( intf_thread_t *p_intf );
static gint GnomeManage ( gpointer p_data );
+static gint GnomeLanguageMenus( gpointer, GtkWidget *, es_descriptor_t *, gint,
+ void (*pf_activate)(GtkMenuItem *, gpointer) );
+static gint GnomeChapterMenu ( gpointer, GtkWidget *,
+ void (*pf_activate)(GtkMenuItem *, gpointer) );
+static gint GnomeTitleMenu ( gpointer, GtkWidget *,
+ void (*pf_activate)(GtkMenuItem *, gpointer) );
/*****************************************************************************
* g_atexit: kludge to avoid the Gnome thread to segfault at exit
p_intf->b_menu_change = 0;
}
+ /* Update language/chapter menus after user request */
+ if( p_intf->p_input != NULL && p_intf->p_sys->p_window != NULL &&
+ p_intf->p_sys->b_menus_update )
+ {
+ 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_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 */
if( p_intf->p_input != NULL && p_intf->p_sys->p_window != NULL
&& p_intf->p_sys->b_scale_isfree )
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
+ *****************************************************************************
+ * 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 GnomeLanguageMenus( gpointer p_data,
+ GtkWidget * p_root,
+ es_descriptor_t * p_es,
+ gint i_type,
+ 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 b_audio;
+ gint b_spu;
+ gint i;
+
+
+
+ /* cast */
+ p_intf = (intf_thread_t *)p_data;
+
+ vlc_mutex_lock( &p_intf->p_input->stream.stream_lock );
+
+ b_audio = ( i_type == 1 );
+ 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 ) ? 1 : 0;
+ psz_name = "Off";
+
+ p_item = GnomeMenuRadioItem( 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++ )
+ {
+
+ b_audio = ( i_type == 1 ) && p_intf->p_input->stream.pp_es[i]->b_audio;
+ b_spu = ( i_type == 2 ) && p_intf->p_input->stream.pp_es[i]->b_spu;
+
+ if( b_audio || b_spu )
+ {
+ 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 = GnomeMenuRadioItem( 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;
+}
+
+/*****************************************************************************
+ * GnomeChapterMenu: generate chapter menu foir current title
+ *****************************************************************************/
+static gint GnomeChapterMenu( gpointer p_data, GtkWidget * p_chapter,
+ void(*pf_activate )( GtkMenuItem *, gpointer ) )
+{
+ intf_thread_t * p_intf;
+ char psz_name[10];
+ 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;
+
+ sprintf( psz_name, "Chapter %d", i_chapter + 1 );
+
+ p_item = GnomeMenuRadioItem( 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;
+}
+
+/*****************************************************************************
+ * GnomeTitleMenu: 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 GnomeTitleMenu( gpointer p_data,
+ GtkWidget * p_navigation,
+ void(*pf_activate )( GtkMenuItem *, gpointer ) )
+{
+ intf_thread_t * p_intf;
+ char psz_name[10];
+ 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;
+ sprintf( psz_name, "Title %d", i_title );
+
+ p_title_item = GnomeMenuRadioItem( 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;
+
+ sprintf( psz_name, "Chapter %d", i_chapter + 1 );
+
+ p_item = GnomeMenuRadioItem( 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;
+}
<class>GtkMenu</class>
<name>menubar_view_menu</name>
+ <widget>
+ <class>GtkMenuItem</class>
+ <name>menubar_title</name>
+ <sensitive>False</sensitive>
+ <label>_Title</label>
+ <right_justify>False</right_justify>
+ </widget>
+
+ <widget>
+ <class>GtkMenuItem</class>
+ <name>menubar_chapter</name>
+ <sensitive>False</sensitive>
+ <label>_Chapter</label>
+ <right_justify>False</right_justify>
+ </widget>
+
+ <widget>
+ <class>GtkMenuItem</class>
+ <name>separator7</name>
+ <right_justify>False</right_justify>
+ </widget>
+
<widget>
<class>GtkPixmapMenuItem</class>
<name>menubar_playlist</name>
<widget>
<class>GtkMenuItem</class>
<name>menubar_audio</name>
+ <sensitive>False</sensitive>
<tooltip>Select audio channel</tooltip>
- <signal>
- <name>activate</name>
- <handler>on_menubar_audio_activate</handler>
- <last_modification_time>Thu, 22 Feb 2001 05:42:43 GMT</last_modification_time>
- </signal>
<label>_Audio</label>
<right_justify>False</right_justify>
</widget>
<widget>
<class>GtkMenuItem</class>
- <name>menubar_subtitles</name>
+ <name>menubar_subtitle</name>
+ <sensitive>False</sensitive>
<tooltip>Select subtitle unit</tooltip>
- <signal>
- <name>activate</name>
- <handler>on_menubar_subtitles_activate</handler>
- <last_modification_time>Thu, 22 Feb 2001 05:42:43 GMT</last_modification_time>
- </signal>
- <label>_Subtitles</label>
+ <label>_Subtitle</label>
<right_justify>False</right_justify>
</widget>
<widget>
<class>GtkMenuItem</class>
- <name>popup_title</name>
- <tooltip>Select Title</tooltip>
- <signal>
- <name>activate</name>
- <handler>on_popup_title_activate</handler>
- <last_modification_time>Thu, 22 Feb 2001 05:35:57 GMT</last_modification_time>
- </signal>
- <label>_Title</label>
+ <name>popup_navigation</name>
+ <sensitive>False</sensitive>
+ <label>_Navigation</label>
<right_justify>False</right_justify>
+ </widget>
- <widget>
- <class>GtkMenu</class>
- <name>popup_title_menu</name>
-
- <widget>
- <class>GtkMenuItem</class>
- <name>popup_chapter</name>
- <signal>
- <name>activate</name>
- <handler>on_popup_chapter_activate</handler>
- <last_modification_time>Thu, 22 Feb 2001 05:48:48 GMT</last_modification_time>
- </signal>
- <label>_Chapter</label>
- <right_justify>False</right_justify>
- </widget>
- </widget>
+ <widget>
+ <class>GtkMenuItem</class>
+ <name>separator8</name>
+ <right_justify>False</right_justify>
</widget>
<widget>
<class>GtkMenuItem</class>
<name>popup_audio</name>
+ <sensitive>False</sensitive>
<tooltip>Select audio channel</tooltip>
<signal>
<name>activate</name>
<widget>
<class>GtkMenuItem</class>
<name>popup_subtitle</name>
+ <sensitive>False</sensitive>
<signal>
<name>activate</name>
<handler>on_popup_subtitle_activate</handler>
i_title = (gint)(user_data) / 100 ;
i_chapter = (gint)(user_data) - ( 100 * i_title );
-fprintf(stderr, "title %d chapter %d\n", i_title, i_chapter );
p_area = p_intf->p_input->stream.pp_areas[i_title];
p_area->i_part = i_chapter;
* intf_gtk.c: Gtk+ interface
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: intf_gtk.c,v 1.4 2001/03/07 10:31:10 stef Exp $
+ * $Id: intf_gtk.c,v 1.5 2001/03/07 11:56:33 stef Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stéphane Borel <stef@via.ecp.fr>
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;
}
}
/*****************************************************************************
- * GtkChapterMenu: generate chapter menu foir current title
+ * GtkChapterMenu: generate chapter menu for current title
*****************************************************************************/
static gint GtkChapterMenu( gpointer p_data, GtkWidget * p_chapter,
void(*pf_activate )( GtkMenuItem *, gpointer ) )
/*****************************************************************************
* GtkTitleMenu: sets menus for titles and chapters selection
- * ---
+ *****************************************************************************
* Generates two type of menus:
* -simple list of titles
* -cascaded lists of chapters for each title