in multi-program streams (such as ones provided by a DVB-S card).
* Collection of useful common types and macros definitions
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: common.h,v 1.76 2002/02/24 20:51:09 gbazin Exp $
+ * $Id: common.h,v 1.77 2002/02/24 21:36:20 jobi Exp $
*
* Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr>
struct es_descriptor_s *, boolean_t );
int ( * input_ChangeArea ) ( struct input_thread_s *,
struct input_area_s * );
+ int ( * input_ChangeProgram ) ( struct input_thread_s *, u16 );
struct es_descriptor_s * ( * input_FindES ) ( struct input_thread_s *,
u16 );
struct es_descriptor_s * ( * input_AddES ) ( struct input_thread_s *,
* control the pace of reading.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: input_ext-intf.h,v 1.59 2002/02/15 13:32:52 sam Exp $
+ * $Id: input_ext-intf.h,v 1.60 2002/02/24 21:36:20 jobi Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
int input_ToggleES ( struct input_thread_s *,
struct es_descriptor_s *, boolean_t );
int input_ChangeArea ( struct input_thread_s *, struct input_area_s * );
+int input_ChangeProgram ( struct input_thread_s *, u16 );
int input_ToggleGrayscale( struct input_thread_s * );
int input_ToggleMute ( struct input_thread_s * );
int input_SetSMP ( struct input_thread_s *, int );
# define input_ChangeES p_symbols->input_ChangeES
# define input_ToggleES p_symbols->input_ToggleES
# define input_ChangeArea p_symbols->input_ChangeArea
+# define input_ChangeProgram p_symbols->input_ChangeProgram
#endif
<right_justify>False</right_justify>
</widget>
+ <widget>
+ <class>GtkMenuItem</class>
+ <name>menubar_program</name>
+ <sensitive>False</sensitive>
+ <tooltip>Choose the program</tooltip>
+ <label>Progr_am</label>
+ <right_justify>False</right_justify>
+ </widget>
+
<widget>
<class>GtkMenuItem</class>
<name>menubar_title</name>
0, (GdkModifierType) 0, NULL
},
GNOMEUIINFO_SEPARATOR,
+ {
+ GNOME_APP_UI_ITEM, N_("Progr_am"),
+ N_("Choose the program"),
+ (gpointer) NULL, NULL, NULL,
+ GNOME_APP_PIXMAP_NONE, NULL,
+ 0, (GdkModifierType) 0, NULL
+ },
{
GNOME_APP_UI_ITEM, N_("_Title"),
N_("Choose title"),
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_ref (menubar_view_menu_uiinfo[3].widget);
- gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_title",
+ gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_program",
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_chapter",
+ gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_title",
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_view_menu_uiinfo[5].widget);
- gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_angle",
+ gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_chapter",
menubar_view_menu_uiinfo[5].widget,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_set_sensitive (menubar_view_menu_uiinfo[5].widget, FALSE);
gtk_widget_ref (menubar_view_menu_uiinfo[6].widget);
- gtk_object_set_data_full (GTK_OBJECT (intf_window), "separator7",
+ gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_angle",
menubar_view_menu_uiinfo[6].widget,
(GtkDestroyNotify) gtk_widget_unref);
+ gtk_widget_set_sensitive (menubar_view_menu_uiinfo[6].widget, FALSE);
gtk_widget_ref (menubar_view_menu_uiinfo[7].widget);
- gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_playlist",
+ gtk_object_set_data_full (GTK_OBJECT (intf_window), "separator7",
menubar_view_menu_uiinfo[7].widget,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_ref (menubar_view_menu_uiinfo[8].widget);
- gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_modules",
+ gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_playlist",
menubar_view_menu_uiinfo[8].widget,
(GtkDestroyNotify) gtk_widget_unref);
- gtk_widget_set_sensitive (menubar_view_menu_uiinfo[8].widget, FALSE);
gtk_widget_ref (menubar_view_menu_uiinfo[9].widget);
- gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_messages",
+ gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_modules",
menubar_view_menu_uiinfo[9].widget,
(GtkDestroyNotify) gtk_widget_unref);
+ gtk_widget_set_sensitive (menubar_view_menu_uiinfo[9].widget, FALSE);
+
+ gtk_widget_ref (menubar_view_menu_uiinfo[10].widget);
+ gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_messages",
+ menubar_view_menu_uiinfo[10].widget,
+ (GtkDestroyNotify) gtk_widget_unref);
gtk_widget_ref (menubar_uiinfo[2].widget);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_settings",
<signal>
<name>activate</name>
<handler>GtkFileOpenActivate</handler>
- <data>"intf_window"</data>
<last_modification_time>Mon, 14 May 2001 21:27:36 GMT</last_modification_time>
</signal>
<label>_Open File...</label>
<signal>
<name>activate</name>
<handler>GtkDiscOpenActivate</handler>
- <data>"intf_window"</data>
<last_modification_time>Mon, 14 May 2001 21:27:47 GMT</last_modification_time>
</signal>
<label>Open _Disc...</label>
<signal>
<name>activate</name>
<handler>GtkNetworkOpenActivate</handler>
- <data>"intf_window"</data>
<last_modification_time>Mon, 14 May 2001 21:28:06 GMT</last_modification_time>
</signal>
<label>_Network Stream...</label>
<signal>
<name>activate</name>
<handler>GtkEjectDiscActivate</handler>
- <data>"intf_window"</data>
<last_modification_time>Fri, 21 Dec 2001 12:51:34 GMT</last_modification_time>
</signal>
<label>_Eject Disc</label>
<signal>
<name>activate</name>
<handler>GtkExitActivate</handler>
- <data>"intf_window"</data>
<last_modification_time>Mon, 14 May 2001 21:28:20 GMT</last_modification_time>
</signal>
<label>E_xit</label>
<signal>
<name>activate</name>
<handler>GtkWindowToggleActivate</handler>
- <data>"intf_window"</data>
<last_modification_time>Mon, 14 May 2001 21:32:49 GMT</last_modification_time>
</signal>
<label>_Hide interface</label>
<signal>
<name>activate</name>
<handler>GtkFullscreenActivate</handler>
- <data>"intf_window"</data>
<last_modification_time>Mon, 14 May 2001 21:29:21 GMT</last_modification_time>
</signal>
<label>_Fullscreen</label>
<right_justify>False</right_justify>
</widget>
+ <widget>
+ <class>GtkMenuItem</class>
+ <name>menubar_program</name>
+ <sensitive>False</sensitive>
+ <tooltip>Choose the program</tooltip>
+ <label>Progr_am</label>
+ <right_justify>False</right_justify>
+ </widget>
+
<widget>
<class>GtkMenuItem</class>
<name>menubar_title</name>
<signal>
<name>activate</name>
<handler>GtkPlaylistActivate</handler>
- <data>"intf_window"</data>
<last_modification_time>Mon, 14 May 2001 21:29:34 GMT</last_modification_time>
</signal>
<label>_Playlist...</label>
<signal>
<name>activate</name>
<handler>GtkModulesActivate</handler>
- <data>"intf_window"</data>
<last_modification_time>Mon, 14 May 2001 21:29:44 GMT</last_modification_time>
</signal>
<label>_Modules...</label>
<signal>
<name>activate</name>
<handler>GtkMessagesActivate</handler>
- <data>"intf_window"</data>
<last_modification_time>Tue, 19 Feb 2002 02:03:47 GMT</last_modification_time>
</signal>
<label>Messages...</label>
<signal>
<name>activate</name>
<handler>GtkPreferencesActivate</handler>
- <data>"intf_window"</data>
<last_modification_time>Mon, 14 May 2001 21:30:02 GMT</last_modification_time>
</signal>
<label>_Preferences...</label>
<signal>
<name>activate</name>
<handler>GtkAboutActivate</handler>
- <data>"intf_window"</data>
<last_modification_time>Mon, 14 May 2001 21:30:15 GMT</last_modification_time>
</signal>
<label>_About...</label>
* gtk_common.h: private Gtk+ interface description
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: gtk_common.h,v 1.2 2002/02/19 03:54:55 sam Exp $
+ * $Id: gtk_common.h,v 1.3 2002/02/24 21:36:20 jobi Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
boolean_t b_slider_free; /* slider status */
/* menus handlers */
+ boolean_t b_program_update; /* do we need to update programs
+ menu */
boolean_t b_title_update; /* do we need to update title menus */
boolean_t b_chapter_update; /* do we need to update
chapter menus */
* gtk_display.c: Gtk+ tools for main interface
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: gtk_display.c,v 1.14 2002/02/24 20:51:10 gbazin Exp $
+ * $Id: gtk_display.c,v 1.15 2002/02/24 21:36:20 jobi Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stéphane Borel <stef@via.ecp.fr>
b_control = p_input_bank->pp_input[0]->stream.b_pace_control;
/* get ready for menu regeneration */
+ p_intf->p_sys->b_program_update = 1;
p_intf->p_sys->b_title_update = 1;
p_intf->p_sys->b_chapter_update = 1;
p_intf->p_sys->b_angle_update = 1;
gtk_widget_show( GTK_WIDGET( p_file_box ) );
/* unsensitize menus */
+ gtk_widget_set_sensitive( GETWIDGET(p_window,"menubar_program"),
+ FALSE );
gtk_widget_set_sensitive( GETWIDGET(p_window,"menubar_title"), FALSE );
gtk_widget_set_sensitive( GETWIDGET(p_window,"menubar_chapter"),
FALSE );
GtkWidget *menubar_interface_hide;
GtkWidget *menubar_fullscreen;
GtkWidget *separator13;
+ GtkWidget *menubar_program;
GtkWidget *menubar_title;
GtkWidget *menubar_chapter;
GtkWidget *menubar_angle;
gtk_container_add (GTK_CONTAINER (menubar_view_menu), separator13);
gtk_widget_set_sensitive (separator13, FALSE);
+ menubar_program = gtk_menu_item_new_with_label ("");
+ tmp_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (menubar_program)->child),
+ _("Progr_am"));
+ gtk_widget_add_accelerator (menubar_program, "activate_item", menubar_view_menu_accels,
+ tmp_key, 0, 0);
+ gtk_widget_ref (menubar_program);
+ gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_program", menubar_program,
+ (GtkDestroyNotify) gtk_widget_unref);
+ gtk_widget_show (menubar_program);
+ gtk_container_add (GTK_CONTAINER (menubar_view_menu), menubar_program);
+ gtk_widget_set_sensitive (menubar_program, FALSE);
+ gtk_tooltips_set_tip (tooltips, menubar_program, _("Choose the program"), NULL);
+
menubar_title = gtk_menu_item_new_with_label ("");
tmp_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (menubar_title)->child),
_("_Title"));
"intf_window");
gtk_signal_connect (GTK_OBJECT (menubar_open), "activate",
GTK_SIGNAL_FUNC (GtkFileOpenActivate),
- "intf_window");
+ NULL);
gtk_signal_connect (GTK_OBJECT (menubar_disc), "activate",
GTK_SIGNAL_FUNC (GtkDiscOpenActivate),
- "intf_window");
+ NULL);
gtk_signal_connect (GTK_OBJECT (menubar_network), "activate",
GTK_SIGNAL_FUNC (GtkNetworkOpenActivate),
- "intf_window");
+ NULL);
gtk_signal_connect (GTK_OBJECT (menubar_eject), "activate",
GTK_SIGNAL_FUNC (GtkEjectDiscActivate),
- "intf_window");
+ NULL);
gtk_signal_connect (GTK_OBJECT (menubar_exit), "activate",
GTK_SIGNAL_FUNC (GtkExitActivate),
- "intf_window");
+ NULL);
gtk_signal_connect (GTK_OBJECT (menubar_interface_hide), "activate",
GTK_SIGNAL_FUNC (GtkWindowToggleActivate),
- "intf_window");
+ NULL);
gtk_signal_connect (GTK_OBJECT (menubar_fullscreen), "activate",
GTK_SIGNAL_FUNC (GtkFullscreenActivate),
- "intf_window");
+ NULL);
gtk_signal_connect (GTK_OBJECT (menubar_playlist), "activate",
GTK_SIGNAL_FUNC (GtkPlaylistActivate),
- "intf_window");
+ NULL);
gtk_signal_connect (GTK_OBJECT (menubar_modules), "activate",
GTK_SIGNAL_FUNC (GtkModulesActivate),
- "intf_window");
+ NULL);
gtk_signal_connect (GTK_OBJECT (menubar_messages), "activate",
GTK_SIGNAL_FUNC (GtkMessagesActivate),
- "intf_window");
+ NULL);
gtk_signal_connect (GTK_OBJECT (menubar_preferences), "activate",
GTK_SIGNAL_FUNC (GtkPreferencesActivate),
- "intf_window");
+ NULL);
gtk_signal_connect (GTK_OBJECT (menubar_about), "activate",
GTK_SIGNAL_FUNC (GtkAboutActivate),
- "intf_window");
+ NULL);
gtk_signal_connect (GTK_OBJECT (toolbar_open), "button_press_event",
GTK_SIGNAL_FUNC (GtkFileOpenShow),
"intf_window");
* gtk_menu.c : functions to handle menu items.
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
- * $Id: gtk_menu.c,v 1.18 2002/01/07 02:12:29 sam Exp $
+ * $Id: gtk_menu.c,v 1.19 2002/02/24 21:36:20 jobi Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stéphane Borel <stef@via.ecp.fr>
+ * Johan Bilien <jobi@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
}
}
+/*
+ * Program
+ */
+
+void GtkMenubarProgramToggle( GtkCheckMenuItem * menuitem, gpointer user_data )
+{
+ intf_thread_t * p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
+
+ if( menuitem->active && !p_intf->p_sys->b_program_update )
+ {
+ u16 i_program_id = (u16)user_data;
+
+ input_ChangeProgram( p_input_bank->pp_input[0], i_program_id );
+
+ p_intf->p_sys->b_program_update = 1;
+
+ vlc_mutex_lock( &p_input_bank->pp_input[0]->stream.stream_lock );
+ GtkSetupMenus( p_intf );
+ vlc_mutex_unlock( &p_input_bank->pp_input[0]->stream.stream_lock );
+
+ p_intf->p_sys->b_title_update = 0;
+
+ input_SetStatus( p_input_bank->pp_input[0], INPUT_STATUS_PLAY );
+
+ }
+}
+
+
/*
* Title
*/
return TRUE;
}
+/*****************************************************************************
+ * GtkProgramMenu: update the programs menu of the interface
+ *****************************************************************************
+ * Builds the program menu according to what have been found in the PAT
+ * by the input. Usefull for multi-programs streams such as DVB ones.
+ *****************************************************************************/
+static gint GtkProgramMenu( gpointer p_data,
+ GtkWidget * p_root,
+ void(*pf_toggle )( GtkCheckMenuItem *, gpointer ) )
+{
+ intf_thread_t * p_intf;
+ GtkWidget * p_menu;
+ GtkWidget * p_item;
+ GtkWidget * p_item_active;
+ GSList * p_group;
+ char psz_name[ GTK_MENU_LABEL_SIZE ];
+ gint i_item;
+ gint i;
+
+ /* cast */
+ p_intf = (intf_thread_t *)p_data;
+
+ /* temporary hack to avoid blank menu when an open menu is removed */
+ if( GTK_MENU_ITEM(p_root)->submenu != NULL )
+ {
+ gtk_menu_popdown( GTK_MENU( GTK_MENU_ITEM(p_root)->submenu ) );
+ }
+ /* removes previous menu */
+ gtk_menu_item_remove_submenu( GTK_MENU_ITEM( p_root ) );
+ gtk_widget_set_sensitive( p_root, FALSE );
+
+ p_group = NULL;
+
+ /* menu container */
+ p_menu = gtk_menu_new();
+
+ p_item_active = NULL;
+ i_item = 0;
+
+ /* create a set of program buttons and append them to the container */
+ for( i = 0 ; i < p_input_bank->pp_input[0]->stream.i_pgrm_number ; i++ )
+ {
+ i_item++;
+ snprintf( psz_name, GTK_MENU_LABEL_SIZE, "id %x",
+ p_input_bank->pp_input[0]->stream.pp_programs[i]->i_number );
+
+ if( psz_name[0] == '\0' )
+ {
+ snprintf( psz_name, GTK_MENU_LABEL_SIZE,
+ "Program %d", i_item );
+ psz_name[ GTK_MENU_LABEL_SIZE - 1 ] = '\0';
+ }
+
+ p_item = gtk_radio_menu_item_new_with_label( p_group, psz_name );
+ p_group =
+ gtk_radio_menu_item_group( GTK_RADIO_MENU_ITEM( p_item ) );
+
+ if( p_input_bank->pp_input[0]->stream.p_new_program ==
+ p_input_bank->pp_input[0]->stream.pp_programs[i] ||
+ p_input_bank->pp_input[0]->stream.p_selected_program ==
+ p_input_bank->pp_input[0]->stream.pp_programs[i] )
+ {
+ /* don't lose p_item when we append into menu */
+ p_item_active = p_item;
+ }
+
+ gtk_widget_show( p_item );
+
+ /* setup signal hanling */
+ gtk_signal_connect( GTK_OBJECT( p_item ), "toggled",
+ GTK_SIGNAL_FUNC( pf_toggle ),
+ (gpointer)( p_input_bank->pp_input[0]->
+ stream.pp_programs[i]->i_number ) );
+
+ gtk_menu_append( GTK_MENU( p_menu ), p_item );
+ }
+
+ /* link the new menu to the menubar item */
+ gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_root ), p_menu );
+
+ /* activation will call signals so we can only do it
+ * when submenu is attached to menu - to get intf_window
+ * We have to release the lock since input_ToggleES needs it */
+ if( p_item_active != NULL )
+ {
+ gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( p_item_active ),
+ TRUE );
+ }
+
+ /* be sure that menu is sensitive if more than 1 program */
+ if( i_item > 1 )
+ {
+ gtk_widget_set_sensitive( p_root, TRUE );
+ }
+
+ return TRUE;
+}
+
/*****************************************************************************
* GtkLanguageMenus: update interactive menus of the interface
*****************************************************************************
GtkWidget * p_popup_menu;
gint i;
+ p_intf->p_sys->b_title_update |= p_intf->p_sys->b_program_update;
p_intf->p_sys->b_chapter_update |= p_intf->p_sys->b_title_update;
p_intf->p_sys->b_angle_update |= p_intf->p_sys->b_title_update;
p_intf->p_sys->b_audio_update |= p_intf->p_sys->b_title_update;
// vlc_mutex_lock( &p_input_bank->pp_input[0]->stream.stream_lock );
+ if( p_intf->p_sys->b_program_update )
+ {
+ p_menubar_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
+ p_intf->p_sys->p_window ), "menubar_program" ) );
+
+ GtkProgramMenu( p_intf, p_menubar_menu, GtkMenubarProgramToggle );
+
+ p_intf->p_sys->b_program_update = 0;
+ }
+
if( p_intf->p_sys->b_title_update )
{
char psz_title[5];
* input_ext-intf.c: services to the interface
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
- * $Id: input_ext-intf.c,v 1.33 2002/01/10 04:11:25 sam Exp $
+ * $Id: input_ext-intf.c,v 1.34 2002/02/24 21:36:20 jobi Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
}
/****************************************************************************
- * input_ChangeProgram: interface request an area change
+ * input_ChangeProgram: interface request a program change
****************************************************************************/
int input_ChangeProgram( input_thread_t * p_input,
- pgrm_descriptor_t * p_program )
+ u16 i_program_number )
{
+ pgrm_descriptor_t * p_program;
+
vlc_mutex_lock( &p_input->stream.stream_lock );
- p_input->stream.p_new_program = p_program;
+ p_program = input_FindProgram( p_input, i_program_number );
+ if ( p_program == NULL )
+ {
+ intf_ErrMsg("input: Could not find selected program");
+ return -1;
+ }
+
+ p_input->stream.p_new_program = p_program;
+
vlc_mutex_unlock( &p_input->stream.stream_lock );
return 0;
* modules_plugin.h : Plugin management functions used by the core application.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: modules_plugin.h,v 1.11 2002/02/24 20:51:10 gbazin Exp $
+ * $Id: modules_plugin.h,v 1.12 2002/02/24 21:36:20 jobi Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
(p_symbols)->input_OffsetToTime = input_OffsetToTime; \
(p_symbols)->input_ChangeES = input_ChangeES; \
(p_symbols)->input_ToggleES = input_ToggleES; \
+ (p_symbols)->input_ChangeProgram = input_ChangeProgram; \
(p_symbols)->input_ChangeArea = input_ChangeArea; \
(p_symbols)->input_FindES = input_FindES; \
(p_symbols)->input_AddES = input_AddES; \