* gnome_callbacks.c : Callbacks for the Gnome plugin.
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
- * $Id: gnome_callbacks.c,v 1.20 2001/04/03 03:39:41 stef Exp $
+ * $Id: gnome_callbacks.c,v 1.25 2001/05/01 04:18:18 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stéphane Borel <stef@via.ecp.fr>
}
+void
+on_button_title_prev_clicked (GtkButton *button,
+ gpointer user_data)
+{
+ intf_thread_t * p_intf;
+ input_area_t * p_area;
+ int i_id;
+
+ p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
+ i_id = p_intf->p_input->stream.p_selected_area->i_id - 1;
+
+ if( i_id >= 0 )
+ {
+ p_area = p_intf->p_input->stream.pp_areas[i_id];
+ 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_intf->p_sys->b_title_update = 1;
+ }
+}
+
+
+void
+on_button_title_next_clicked (GtkButton *button,
+ gpointer user_data)
+{
+ intf_thread_t * p_intf;
+ input_area_t * p_area;
+ int i_id;
+
+ p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
+ i_id = p_intf->p_input->stream.p_selected_area->i_id + 1;
+
+ if( i_id < p_intf->p_input->stream.i_area_nb )
+ {
+ p_area = p_intf->p_input->stream.pp_areas[i_id];
+ 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_intf->p_sys->b_title_update = 1;
+ }
+}
+
+
void
on_button_chapter_prev_clicked (GtkButton *button,
gpointer user_data)
p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
p_area = p_intf->p_input->stream.p_selected_area;
- if( p_area->i_part - 1 >= 0 )
+ if( p_area->i_part > 0 )
{
p_area->i_part--;
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_intf->p_sys->b_chapter_update = 1;
}
}
p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
p_area = p_intf->p_input->stream.p_selected_area;
- if( p_area->i_part + 1 < p_area->i_part_nb )
+ if( p_area->i_part < p_area->i_part_nb )
{
p_area->i_part++;
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_intf->p_sys->b_chapter_update = 1;
}
}
on_menubar_audio_toggle (GtkCheckMenuItem *menuitem,
gpointer user_data)
{
- intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
+ intf_thread_t * p_intf;
es_descriptor_t * p_es;
- p_es = (es_descriptor_t*)user_data;
+ p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
- if( p_intf->p_sys->b_menus_ready )
+ if( !p_intf->p_sys->b_audio_update )
{
+ p_es = (es_descriptor_t*)user_data;
+
input_ToggleES( p_intf->p_input, p_es, menuitem->active );
+
+ p_intf->p_sys->b_audio_update = menuitem->active;
}
}
on_menubar_subtitle_toggle (GtkCheckMenuItem *menuitem,
gpointer user_data)
{
- intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
+ intf_thread_t * p_intf;
es_descriptor_t * p_es;
- p_es = (es_descriptor_t*)user_data;
+ p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
- if( p_intf->p_sys->b_menus_ready )
+ if( !p_intf->p_sys->b_spu_update )
{
+ p_es = (es_descriptor_t*)user_data;
+
input_ToggleES( p_intf->p_input, p_es, menuitem->active );
+
+ p_intf->p_sys->b_spu_update = menuitem->active;
}
}
on_menubar_title_toggle (GtkCheckMenuItem *menuitem,
gpointer user_data)
{
- intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
+ intf_thread_t * p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
- if( menuitem->active && p_intf->p_sys->b_menus_ready )
+ if( menuitem->active && !p_intf->p_sys->b_title_update )
{
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 );
+
+ p_intf->p_sys->b_title_update = 1;
}
}
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;
+ char psz_chapter[3];
- if( menuitem->active && p_intf->p_sys->b_menus_ready )
+ if( menuitem->active && !p_intf->p_sys->b_chapter_update )
{
p_area->i_part = i_chapter;
p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)p_area );
+
+ snprintf( psz_chapter, 3, "%02d", p_area->i_part );
+ gtk_label_set_text( p_intf->p_sys->p_label_chapter, psz_chapter );
+
+ input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
+
+ p_intf->p_sys->b_chapter_update = 1;
}
- input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
}
+
+void
+on_menubar_angle_toggle (GtkCheckMenuItem *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_angle = (gint)user_data;
+
+ if( menuitem->active && !p_intf->p_sys->b_angle_update )
+ {
+ p_area->i_angle = i_angle;
+ p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)p_area );
+
+ p_intf->p_sys->b_angle_update = 1;
+ }
+}
+
+
void
on_menubar_modules_activate (GtkMenuItem *menuitem,
gpointer user_data)
intf_PlaylistPrev( p_main->p_playlist );
p_intf->p_input->b_eof = 1;
}
+
+ p_intf->p_sys->b_mode_changed = 1;
}
/* FIXME: temporary hack */
p_intf->p_input->b_eof = 1;
}
-}
-
-
-void
-on_toolbar_prev_title_clicked (GtkButton *button,
- gpointer user_data)
-{
- intf_thread_t * p_intf;
- input_area_t * p_area;
- int i_id;
- p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
- i_id = p_intf->p_input->stream.p_selected_area->i_id - 1;
-
- if( i_id >= 0 )
- {
- p_area = p_intf->p_input->stream.pp_areas[i_id];
- p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)p_area );
- p_intf->p_sys->b_menus_update = 1;
- input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
- }
-}
-
-
-void
-on_toolbar_next_title_clicked (GtkButton *button,
- gpointer user_data)
-{
- intf_thread_t * p_intf;
- input_area_t * p_area;
- int i_id;
-
- p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
- i_id = p_intf->p_input->stream.p_selected_area->i_id + 1;
-
- if( i_id < p_intf->p_input->stream.i_area_nb )
- {
- p_area = p_intf->p_input->stream.pp_areas[i_id];
- p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)p_area );
- p_intf->p_sys->b_menus_update = 1;
- input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
- }
+ p_intf->p_sys->b_mode_changed = 1;
}
p_es = (es_descriptor_t*)user_data;
- if( p_intf->p_sys->b_menus_ready )
+ if( !p_intf->p_sys->b_audio_update )
{
input_ToggleES( p_intf->p_input, p_es, menuitem->active );
+
+ p_intf->p_sys->b_audio_update = menuitem->active;
}
}
p_es = (es_descriptor_t*)user_data;
- if( p_intf->p_sys->b_menus_ready )
+ if( !p_intf->p_sys->b_spu_update )
{
input_ToggleES( p_intf->p_input, p_es, menuitem->active );
+
+ p_intf->p_sys->b_spu_update = menuitem->active;
}
}
{
intf_thread_t * p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
- if( menuitem->active && p_intf->p_sys->b_menus_ready )
+ if( menuitem->active &&
+ !p_intf->p_sys->b_title_update &&
+ !p_intf->p_sys->b_chapter_update )
{
input_area_t * p_area;
gint i_title;
i_title = (gint)(user_data) / 100;
i_chapter = (gint)(user_data) - ( 100 * i_title );
+ p_area = p_intf->p_input->stream.p_selected_area;
- if( i_title != p_intf->p_input->stream.p_selected_area->i_id )
+
+ if( p_area != p_intf->p_input->stream.pp_areas[i_title] )
{
- p_intf->p_sys->b_menus_update = 1;
+ p_area = p_intf->p_input->stream.pp_areas[i_title];
+ p_intf->p_sys->b_title_update = 1;
}
- p_area = p_intf->p_input->stream.pp_areas[i_title];
p_area->i_part = i_chapter;
+ p_intf->p_sys->b_chapter_update = 1;
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_popup_angle_toggle (GtkCheckMenuItem *menuitem,
+ gpointer user_data)
+{
+ intf_thread_t * p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
+ input_area_t * p_area = p_intf->p_input->stream.p_selected_area;
+ gint i_angle = (gint)user_data;
+
+ if( menuitem->active && !p_intf->p_sys->b_angle_update )
+ {
+ p_area->i_angle = i_angle;
+ p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)p_area );
+
+ p_intf->p_sys->b_angle_update = 1;
+ }
+}
+
+
void
on_popup_open_activate (GtkMenuItem *menuitem,
gpointer user_data)
on_fileopen_ok_clicked (GtkButton *button,
gpointer user_data)
{
+ intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_fileopen" );
+
GtkWidget *filesel;
gchar *filename;
filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (filesel));
intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END, (char*)filename );
+
+ /* Select added item and switch to file interface */
+ if( p_intf->p_input != NULL )
+ p_intf->p_input->b_eof = 1;
+
+// p_intf->p_sys->b_mode_changed = 1;
}
GTK_WIDGET(button), "disc_name" ) ) );
/* "dvd:foo" has size 5 + strlen(foo) */
- psz_source = malloc( 5 + strlen( psz_device ) );
+ psz_source = malloc( 3 /* "dvd" */ + 1 /* ":" */
+ + strlen( psz_device ) + 1 /* "\0" */ );
if( psz_source == NULL )
{
return;
{
psz_method = "dvd";
p_intf->p_sys->i_intf_mode = DVD_MODE;
- p_intf->p_sys->b_mode_changed = 1;
}
else if( GTK_TOGGLE_BUTTON( lookup_widget( GTK_WIDGET(button),
"disc_vcd" ) )->active )
intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END, psz_source );
free( psz_source );
+ /* Select added item and switch to DVD interface */
+ intf_PlaylistJumpto( p_main->p_playlist, p_main->p_playlist->i_size-2 );
+ if( p_intf->p_input != NULL )
+ p_intf->p_input->b_eof = 1;
+// p_intf->p_sys->b_mode_changed = 1;
+
gtk_widget_hide( p_intf->p_sys->p_disc );
}
}
/* Allocate room for "protocol://server:port" */
- psz_source = malloc( strlen( psz_protocol ) + strlen( psz_server ) + 10 );
+ psz_source = malloc( strlen( psz_protocol ) + 3 /* "://" */
+ + strlen( psz_server ) + 1 /* ":" */
+ + 5 /* 0-65535 */ + 1 /* "\0" */ );
if( psz_source == NULL )
{
return;
intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END, psz_source );
free( psz_source );
+ /* Select added item and switch to network interface */
+ intf_PlaylistJumpto( p_main->p_playlist, p_main->p_playlist->i_size-2 );
+ if( p_intf->p_input != NULL )
+ p_intf->p_input->b_eof = 1;
+// p_intf->p_sys->b_mode_changed = 1;
+
gtk_widget_hide( p_intf->p_sys->p_network );
}