Commit 9530fc9f authored by Stéphane Borel's avatar Stéphane Borel

*initialization bugfixes in input_dvd

*added a b_stopped flag to interface playlist to have a stop function in
interface plugins. As a consequence, the playlist no longer loops on end
but wait for the user to press 'play' or to add another item (gtk/gnome
interface). I think that other plugins are broken but it shouldn't be
difficult to repair: just add a 'p_main->p_playlist->b_stopped = 0' in
play functions and 'p_main->p_playlist->b_stopped = 1' when you have to
stop.

*Updated gtk interface so that it has the same features as gnome. I
think I will merge the code so that we don't have to copy and paste each
change. Only the .glade file would be different.
parent db7b0421
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* intf_playlist.h : Playlist functions * intf_playlist.h : Playlist functions
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: intf_playlist.h,v 1.2 2001/03/21 13:42:33 sam Exp $ * $Id: intf_playlist.h,v 1.3 2001/05/15 01:01:44 stef Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -45,6 +45,7 @@ typedef struct playlist_s ...@@ -45,6 +45,7 @@ typedef struct playlist_s
int i_mode; /* parse mode (random, forward, backward) */ int i_mode; /* parse mode (random, forward, backward) */
int i_seed; /* seed used for random mode */ int i_seed; /* seed used for random mode */
boolean_t b_stopped;
vlc_mutex_t change_lock; vlc_mutex_t change_lock;
......
...@@ -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.57 2001/05/07 04:42:42 sam Exp $ * $Id: input_dvd.c,v 1.58 2001/05/15 01:01:44 stef Exp $
* *
* Author: Stphane Borel <stef@via.ecp.fr> * Author: Stphane Borel <stef@via.ecp.fr>
* *
...@@ -562,6 +562,9 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) ...@@ -562,6 +562,9 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
vlc_mutex_lock( &p_input->stream.stream_lock ); vlc_mutex_lock( &p_input->stream.stream_lock );
/* we can't use the interface slider until initilization is complete */
p_input->stream.b_seekable = 0;
if( p_area != p_input->stream.p_selected_area ) if( p_area != p_input->stream.p_selected_area )
{ {
...@@ -581,7 +584,7 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) ...@@ -581,7 +584,7 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
/* uodate title environnement variable so that we don't /* uodate title environnement variable so that we don't
* loop on the same title forever */ * loop on the same title forever */
main_PutIntVariable( INPUT_TITLE_VAR, p_dvd->i_title + 1 ); // main_PutIntVariable( INPUT_TITLE_VAR, p_dvd->i_title + 1 );
/* ifo vts */ /* ifo vts */
if( IfoTitleSet( p_dvd->p_ifo ) < 0 ) if( IfoTitleSet( p_dvd->p_ifo ) < 0 )
...@@ -947,7 +950,9 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) ...@@ -947,7 +950,9 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
} }
/* warn interface that something has changed */ /* warn interface that something has changed */
p_input->stream.b_seekable = 1;
p_input->stream.b_changed = 1; p_input->stream.b_changed = 1;
intf_WarnMsg( 3, "Pos: %lld Size: %lld", p_input->stream.p_selected_area->i_tell,p_input->stream.p_selected_area->i_size );
vlc_mutex_unlock( &p_input->stream.stream_lock ); vlc_mutex_unlock( &p_input->stream.stream_lock );
...@@ -1153,6 +1158,7 @@ static int DVDRead( input_thread_t * p_input, ...@@ -1153,6 +1158,7 @@ static int DVDRead( input_thread_t * p_input,
if( b_eot ) if( b_eot )
{ {
intf_WarnMsg( 3, "dvd info: new title" );
p_dvd->i_title++; p_dvd->i_title++;
DVDSetArea( p_input, p_area ); DVDSetArea( p_input, p_area );
return 0; return 0;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* gnome_callbacks.c : Callbacks for the Gnome plugin. * gnome_callbacks.c : Callbacks for the Gnome plugin.
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: gnome_callbacks.c,v 1.28 2001/05/10 06:47:31 sam Exp $ * $Id: gnome_callbacks.c,v 1.29 2001/05/15 01:01:44 stef Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* Stphane Borel <stef@via.ecp.fr> * Stphane Borel <stef@via.ecp.fr>
...@@ -113,47 +113,6 @@ on_intf_window_drag_data_received (GtkWidget *widget, ...@@ -113,47 +113,6 @@ on_intf_window_drag_data_received (GtkWidget *widget,
guint time, guint time,
gpointer user_data) gpointer user_data)
{ {
#if 0
char *psz_text = data->data;
int i_len = strlen( psz_text );
switch( info )
{
case DROP_ACCEPT_TEXT_PLAIN: /* FIXME: handle multiple files */
if( i_len < 1 )
{
return;
}
/* get rid of ' ' at the end */
*( psz_text + i_len - 1 ) = 0;
intf_WarnMsg( 3, "intf: dropped text/uri-list data `%s'", psz_text );
intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END, psz_text );
break;
case DROP_ACCEPT_TEXT_URI_LIST: /* FIXME: handle multiple files */
if( i_len < 2 )
{
return;
}
/* get rid of \r\n at the end */
*( psz_text + i_len - 2 ) = 0;
intf_WarnMsg( 3, "intf: dropped text/uri-list data `%s'", psz_text );
intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END, psz_text );
break;
default:
intf_ErrMsg( "intf error: unknown dropped type");
break;
}
#else
intf_thread_t * p_intf = GetIntf( GTK_WIDGET( widget ), "intf_window" ); intf_thread_t * p_intf = GetIntf( GTK_WIDGET( widget ), "intf_window" );
int i_end = p_main->p_playlist->i_size; int i_end = p_main->p_playlist->i_size;
...@@ -166,8 +125,7 @@ on_intf_window_drag_data_received (GtkWidget *widget, ...@@ -166,8 +125,7 @@ on_intf_window_drag_data_received (GtkWidget *widget,
} }
intf_PlaylistJumpto( p_main->p_playlist, i_end - 1 ); intf_PlaylistJumpto( p_main->p_playlist, i_end - 1 );
p_main->p_playlist->b_stopped = 0;
#endif
} }
...@@ -741,10 +699,10 @@ on_toolbar_stop_clicked (GtkButton *button, ...@@ -741,10 +699,10 @@ on_toolbar_stop_clicked (GtkButton *button,
if( p_intf->p_input != NULL ) if( p_intf->p_input != NULL )
{ {
p_vout_bank->pp_vout[0]->b_die = 1; p_intf->p_input->b_eof = 1;
p_aout_bank->pp_aout[0]->b_die = 1; p_main->p_playlist->i_index--;
p_intf->p_input->b_die = 1;
} }
p_main->p_playlist->b_stopped = 1;
} }
...@@ -758,6 +716,20 @@ on_toolbar_play_clicked (GtkButton *button, ...@@ -758,6 +716,20 @@ on_toolbar_play_clicked (GtkButton *button,
{ {
input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY ); input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
} }
else if( p_main->p_playlist->b_stopped )
{
if( p_main->p_playlist->i_size )
{
intf_PlaylistJumpto( p_main->p_playlist,
p_main->p_playlist->i_index );
p_main->p_playlist->b_stopped = 0;
}
else
{
on_toolbar_open_clicked( button, user_data );
}
}
} }
...@@ -879,6 +851,7 @@ on_popup_play_activate (GtkMenuItem *menuitem, ...@@ -879,6 +851,7 @@ on_popup_play_activate (GtkMenuItem *menuitem,
if( p_intf->p_input != NULL ) if( p_intf->p_input != NULL )
{ {
input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY ); input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
p_main->p_playlist->b_stopped = 0;
} }
} }
...@@ -1210,6 +1183,7 @@ on_fileopen_ok_clicked (GtkButton *button, ...@@ -1210,6 +1183,7 @@ on_fileopen_ok_clicked (GtkButton *button,
} }
intf_PlaylistJumpto( p_main->p_playlist, i_end - 1 ); intf_PlaylistJumpto( p_main->p_playlist, i_end - 1 );
p_main->p_playlist->b_stopped = 0;
} }
...@@ -1356,6 +1330,7 @@ on_disc_ok_clicked (GtkButton *button, ...@@ -1356,6 +1330,7 @@ on_disc_ok_clicked (GtkButton *button,
} }
intf_PlaylistJumpto( p_main->p_playlist, i_end - 1 ); intf_PlaylistJumpto( p_main->p_playlist, i_end - 1 );
p_main->p_playlist->b_stopped = 0;
} }
...@@ -1468,6 +1443,7 @@ on_network_ok_clicked (GtkButton *button, ...@@ -1468,6 +1443,7 @@ on_network_ok_clicked (GtkButton *button,
} }
intf_PlaylistJumpto( p_main->p_playlist, i_end - 1 ); intf_PlaylistJumpto( p_main->p_playlist, i_end - 1 );
p_main->p_playlist->b_stopped = 0;
} }
...@@ -1545,6 +1521,7 @@ on_jump_apply_clicked (GtkButton *button, ...@@ -1545,6 +1521,7 @@ on_jump_apply_clicked (GtkButton *button,
{ {
input_Seek( p_intf->p_input, i_seek ); input_Seek( p_intf->p_input, i_seek );
} }
p_main->p_playlist->b_stopped = 0;
#endif #endif
} }
...@@ -1687,4 +1664,3 @@ on_preferences_cancel_clicked (GtkButton *button, ...@@ -1687,4 +1664,3 @@ on_preferences_cancel_clicked (GtkButton *button,
{ {
gtk_widget_hide( gtk_widget_get_toplevel( GTK_WIDGET (button) ) ); gtk_widget_hide( gtk_widget_get_toplevel( GTK_WIDGET (button) ) );
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* gnome_callbacks.h : Callbacks for the Gnome plugin. * gnome_callbacks.h : Callbacks for the Gnome plugin.
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: gnome_callbacks.h,v 1.16 2001/05/06 18:32:30 stef Exp $ * $Id: gnome_callbacks.h,v 1.17 2001/05/15 01:01:44 stef Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -426,3 +426,7 @@ on_playlist_cancel_clicked (GtkButton *button, ...@@ -426,3 +426,7 @@ on_playlist_cancel_clicked (GtkButton *button,
void void
on_popup_back_activate (GtkMenuItem *menuitem, on_popup_back_activate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void
on_playlist_destroy (GtkObject *object,
gpointer user_data);
...@@ -500,7 +500,6 @@ create_intf_window (void) ...@@ -500,7 +500,6 @@ create_intf_window (void)
(GtkDestroyNotify) gtk_widget_unref); (GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (slider); gtk_widget_show (slider);
gtk_container_add (GTK_CONTAINER (slider_frame), slider); gtk_container_add (GTK_CONTAINER (slider_frame), slider);
gtk_widget_set_usize (slider, 500, 15);
gtk_scale_set_draw_value (GTK_SCALE (slider), FALSE); gtk_scale_set_draw_value (GTK_SCALE (slider), FALSE);
gtk_scale_set_digits (GTK_SCALE (slider), 3); gtk_scale_set_digits (GTK_SCALE (slider), 3);
...@@ -510,7 +509,6 @@ create_intf_window (void) ...@@ -510,7 +509,6 @@ create_intf_window (void)
(GtkDestroyNotify) gtk_widget_unref); (GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (file_box); gtk_widget_show (file_box);
gtk_box_pack_start (GTK_BOX (vbox8), file_box, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox8), file_box, TRUE, TRUE, 0);
gtk_widget_set_usize (file_box, 500, 24);
label_status = gtk_label_new (""); label_status = gtk_label_new ("");
gtk_widget_ref (label_status); gtk_widget_ref (label_status);
...@@ -524,7 +522,6 @@ create_intf_window (void) ...@@ -524,7 +522,6 @@ create_intf_window (void)
gtk_object_set_data_full (GTK_OBJECT (intf_window), "dvd_box", dvd_box, gtk_object_set_data_full (GTK_OBJECT (intf_window), "dvd_box", dvd_box,
(GtkDestroyNotify) gtk_widget_unref); (GtkDestroyNotify) gtk_widget_unref);
gtk_box_pack_start (GTK_BOX (vbox8), dvd_box, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox8), dvd_box, TRUE, TRUE, 0);
gtk_widget_set_usize (dvd_box, 500, 24);
label21 = gtk_label_new (_("DVD ")); label21 = gtk_label_new (_("DVD "));
gtk_widget_ref (label21); gtk_widget_ref (label21);
...@@ -622,7 +619,6 @@ create_intf_window (void) ...@@ -622,7 +619,6 @@ create_intf_window (void)
gtk_object_set_data_full (GTK_OBJECT (intf_window), "network_box", network_box, gtk_object_set_data_full (GTK_OBJECT (intf_window), "network_box", network_box,
(GtkDestroyNotify) gtk_widget_unref); (GtkDestroyNotify) gtk_widget_unref);
gtk_box_pack_start (GTK_BOX (vbox8), network_box, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox8), network_box, FALSE, FALSE, 0);
gtk_widget_set_usize (network_box, 500, 24);
network_address_label = gtk_label_new (_("No server")); network_address_label = gtk_label_new (_("No server"));
gtk_widget_ref (network_address_label); gtk_widget_ref (network_address_label);
...@@ -810,7 +806,7 @@ static GnomeUIInfo intf_popup_uiinfo[] = ...@@ -810,7 +806,7 @@ static GnomeUIInfo intf_popup_uiinfo[] =
}, },
GNOMEUIINFO_SEPARATOR, GNOMEUIINFO_SEPARATOR,
{ {
GNOME_APP_UI_ITEM, N_("_Jump"), GNOME_APP_UI_ITEM, N_("_Jump..."),
N_("Got directly so specified point"), N_("Got directly so specified point"),
(gpointer) on_popup_jump_activate, NULL, NULL, (gpointer) on_popup_jump_activate, NULL, NULL,
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_JUMP_TO, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_JUMP_TO,
...@@ -988,7 +984,6 @@ create_intf_popup (void) ...@@ -988,7 +984,6 @@ create_intf_popup (void)
gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_preferences", gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_preferences",
intf_popup_uiinfo[17].widget, intf_popup_uiinfo[17].widget,
(GtkDestroyNotify) gtk_widget_unref); (GtkDestroyNotify) gtk_widget_unref);
gtk_widget_set_sensitive (intf_popup_uiinfo[17].widget, FALSE);
gtk_widget_ref (intf_popup_uiinfo[18].widget); gtk_widget_ref (intf_popup_uiinfo[18].widget);
gtk_object_set_data_full (GTK_OBJECT (intf_popup), "separator2", gtk_object_set_data_full (GTK_OBJECT (intf_popup), "separator2",
...@@ -1699,6 +1694,7 @@ create_intf_playlist (void) ...@@ -1699,6 +1694,7 @@ create_intf_playlist (void)
(GtkDestroyNotify) gtk_widget_unref); (GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (playlist_frame); gtk_widget_show (playlist_frame);
gtk_container_add (GTK_CONTAINER (playlist_viewport), playlist_frame); gtk_container_add (GTK_CONTAINER (playlist_viewport), playlist_frame);
gtk_container_set_border_width (GTK_CONTAINER (playlist_frame), 4);
gtk_frame_set_label_align (GTK_FRAME (playlist_frame), 0.05, 0.5); gtk_frame_set_label_align (GTK_FRAME (playlist_frame), 0.05, 0.5);
playlist_clist = gtk_clist_new (2); playlist_clist = gtk_clist_new (2);
...@@ -1817,6 +1813,9 @@ create_intf_playlist (void) ...@@ -1817,6 +1813,9 @@ create_intf_playlist (void)
gtk_widget_show (playlist_cancel); gtk_widget_show (playlist_cancel);
GTK_WIDGET_SET_FLAGS (playlist_cancel, GTK_CAN_DEFAULT); GTK_WIDGET_SET_FLAGS (playlist_cancel, GTK_CAN_DEFAULT);
gtk_signal_connect (GTK_OBJECT (intf_playlist), "destroy",
GTK_SIGNAL_FUNC (on_playlist_destroy),
NULL);
gtk_signal_connect (GTK_OBJECT (playlist_clist), "event", gtk_signal_connect (GTK_OBJECT (playlist_clist), "event",
GTK_SIGNAL_FUNC (on_playlist_clist_event), GTK_SIGNAL_FUNC (on_playlist_clist_event),
NULL); NULL);
...@@ -1870,6 +1869,7 @@ create_intf_jump (void) ...@@ -1870,6 +1869,7 @@ create_intf_jump (void)
(GtkDestroyNotify) gtk_widget_unref); (GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (jump_frame); gtk_widget_show (jump_frame);
gtk_box_pack_start (GTK_BOX (jump_vbox), jump_frame, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (jump_vbox), jump_frame, FALSE, FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (jump_frame), 5);
gtk_frame_set_label_align (GTK_FRAME (jump_frame), 0.05, 0.5); gtk_frame_set_label_align (GTK_FRAME (jump_frame), 0.05, 0.5);
jump_box = gtk_hbox_new (FALSE, 0); jump_box = gtk_hbox_new (FALSE, 0);
...@@ -1878,6 +1878,7 @@ create_intf_jump (void) ...@@ -1878,6 +1878,7 @@ create_intf_jump (void)
(GtkDestroyNotify) gtk_widget_unref); (GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (jump_box); gtk_widget_show (jump_box);
gtk_container_add (GTK_CONTAINER (jump_frame), jump_box); gtk_container_add (GTK_CONTAINER (jump_frame), jump_box);
gtk_container_set_border_width (GTK_CONTAINER (jump_box), 5);
jump_label3 = gtk_label_new (_("s.")); jump_label3 = gtk_label_new (_("s."));
gtk_widget_ref (jump_label3); gtk_widget_ref (jump_label3);
...@@ -2045,17 +2046,17 @@ create_intf_preferences (void) ...@@ -2045,17 +2046,17 @@ create_intf_preferences (void)
GtkWidget *preferences_playlist_enqueue_as_default_checkbutton; GtkWidget *preferences_playlist_enqueue_as_default_checkbutton;
GtkWidget *preferences_playlist; GtkWidget *preferences_playlist;
GtkWidget *preferences_misc_table; GtkWidget *preferences_misc_table;
GtkWidget *preferences_misc_associated_files_frame;
GtkWidget *preferences_misc_associated_table;
GtkWidget *preferences_misc_ts_checkbutton;
GtkWidget *preferences_misc_vob_checkbutton;
GtkWidget *preferences_misc_mp2_checkbutton;
GtkWidget *preferences_misc_mpeg_checkbutton;
GtkWidget *preferences_misc_message_frame; GtkWidget *preferences_misc_message_frame;
GtkWidget *preferences_misc_message_table; GtkWidget *preferences_misc_message_table;
GtkWidget *preferences_misc_messages_label; GtkWidget *preferences_misc_messages_label;
GtkObject *preferences_misc_messages_spinbutton_adj; GtkObject *preferences_misc_messages_spinbutton_adj;
GtkWidget *preferences_misc_messages_spinbutton; GtkWidget *preferences_misc_messages_spinbutton;
GtkWidget *preferences_misc_associated_files_frame;
GtkWidget *preferences_misc_associated_table;
GtkWidget *preferences_misc_mpeg_checkbutton;
GtkWidget *preferences_misc_mp2_checkbutton;
GtkWidget *preferences_misc_vob_checkbutton;
GtkWidget *preferences_misc_ts_checkbutton;
GtkWidget *preferences_misc; GtkWidget *preferences_misc;
GtkWidget *preferences_dialog; GtkWidget *preferences_dialog;
GtkWidget *preferences_ok; GtkWidget *preferences_ok;
...@@ -2070,6 +2071,7 @@ create_intf_preferences (void) ...@@ -2070,6 +2071,7 @@ create_intf_preferences (void)
preferences_vbox = GNOME_DIALOG (intf_preferences)->vbox; preferences_vbox = GNOME_DIALOG (intf_preferences)->vbox;
gtk_object_set_data (GTK_OBJECT (intf_preferences), "preferences_vbox", preferences_vbox); gtk_object_set_data (GTK_OBJECT (intf_preferences), "preferences_vbox", preferences_vbox);
gtk_widget_show (preferences_vbox); gtk_widget_show (preferences_vbox);
gtk_container_set_border_width (GTK_CONTAINER (preferences_vbox), 5);
preferences_frame = gtk_frame_new (_("Preferences")); preferences_frame = gtk_frame_new (_("Preferences"));
gtk_widget_ref (preferences_frame); gtk_widget_ref (preferences_frame);
...@@ -2092,6 +2094,9 @@ create_intf_preferences (void) ...@@ -2092,6 +2094,9 @@ create_intf_preferences (void)
(GtkDestroyNotify) gtk_widget_unref); (GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (preferences_file_table); gtk_widget_show (preferences_file_table);
gtk_container_add (GTK_CONTAINER (preferences_notebook), preferences_file_table); gtk_container_add (GTK_CONTAINER (preferences_notebook), preferences_file_table);
gtk_container_set_border_width (GTK_CONTAINER (preferences_file_table), 5);
gtk_table_set_row_spacings (GTK_TABLE (preferences_file_table), 5);
gtk_table_set_col_spacings (GTK_TABLE (preferences_file_table), 5);
preferences_file_combo = gnome_file_entry_new (NULL, NULL); preferences_file_combo = gnome_file_entry_new (NULL, NULL);
gtk_widget_ref (preferences_file_combo); gtk_widget_ref (preferences_file_combo);
...@@ -2131,6 +2136,9 @@ create_intf_preferences (void) ...@@ -2131,6 +2136,9 @@ create_intf_preferences (void)
(GtkDestroyNotify) gtk_widget_unref); (GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (preferences_disc_table); gtk_widget_show (preferences_disc_table);
gtk_container_add (GTK_CONTAINER (preferences_notebook), preferences_disc_table); gtk_container_add (GTK_CONTAINER (preferences_notebook), preferences_disc_table);
gtk_container_set_border_width (GTK_CONTAINER (preferences_disc_table), 5);
gtk_table_set_row_spacings (GTK_TABLE (preferences_disc_table), 5);
gtk_table_set_col_spacings (GTK_TABLE (preferences_disc_table), 5);
preferences_disc_dvd_combo = gnome_file_entry_new (NULL, NULL); preferences_disc_dvd_combo = gnome_file_entry_new (NULL, NULL);
gtk_widget_ref (preferences_disc_dvd_combo); gtk_widget_ref (preferences_disc_dvd_combo);
...@@ -2195,6 +2203,9 @@ create_intf_preferences (void) ...@@ -2195,6 +2203,9 @@ create_intf_preferences (void)
(GtkDestroyNotify) gtk_widget_unref); (GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (preferences_network_table); gtk_widget_show (preferences_network_table);
gtk_container_add (GTK_CONTAINER (preferences_notebook), preferences_network_table); gtk_container_add (GTK_CONTAINER (preferences_notebook), preferences_network_table);
gtk_container_set_border_width (GTK_CONTAINER (preferences_network_table), 5);
gtk_table_set_row_spacings (GTK_TABLE (preferences_network_table), 5);
gtk_table_set_col_spacings (GTK_TABLE (preferences_network_table), 5);
preferences_network_server_label = gtk_label_new (_("Default server: ")); preferences_network_server_label = gtk_label_new (_("Default server: "));
gtk_widget_ref (preferences_network_server_label); gtk_widget_ref (preferences_network_server_label);
...@@ -2329,6 +2340,9 @@ create_intf_preferences (void) ...@@ -2329,6 +2340,9 @@ create_intf_preferences (void)
(GtkDestroyNotify) gtk_widget_unref); (GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (preferences_network_interface_table); gtk_widget_show (preferences_network_interface_table);
gtk_container_add (GTK_CONTAINER (preferences_notebook), preferences_network_interface_table); gtk_container_add (GTK_CONTAINER (preferences_notebook), preferences_network_interface_table);
gtk_container_set_border_width (GTK_CONTAINER (preferences_network_interface_table), 5);
gtk_table_set_row_spacings (GTK_TABLE (preferences_network_interface_table), 5);
gtk_table_set_col_spacings (GTK_TABLE (preferences_network_interface_table), 5);
preferences_interface_label = gtk_label_new (_("Default interface: ")); preferences_interface_label = gtk_label_new (_("Default interface: "));
gtk_widget_ref (preferences_interface_label); gtk_widget_ref (preferences_interface_label);
...@@ -2368,6 +2382,9 @@ create_intf_preferences (void) ...@@ -2368,6 +2382,9 @@ create_intf_preferences (void)
(GtkDestroyNotify) gtk_widget_unref); (GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (preferences_video_table); gtk_widget_show (preferences_video_table);
gtk_container_add (GTK_CONTAINER (preferences_notebook), preferences_video_table); gtk_container_add (GTK_CONTAINER (preferences_notebook), preferences_video_table);
gtk_container_set_border_width (GTK_CONTAINER (preferences_video_table), 5);
gtk_table_set_row_spacings (GTK_TABLE (preferences_video_table), 5);
gtk_table_set_col_spacings (GTK_TABLE (preferences_video_table), 5);
preferences_video_output_label = gtk_label_new (_("Default output: ")); preferences_video_output_label = gtk_label_new (_("Default output: "));
gtk_widget_ref (preferences_video_output_label); gtk_widget_ref (preferences_video_output_label);
...@@ -2547,6 +2564,9 @@ create_intf_preferences (void) ...@@ -2547,6 +2564,9 @@ create_intf_preferences (void)
(GtkDestroyNotify) gtk_widget_unref); (GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (preference_audio_table); gtk_widget_show (preference_audio_table);
gtk_container_add (GTK_CONTAINER (preferences_notebook), preference_audio_table); gtk_container_add (GTK_CONTAINER (preferences_notebook), preference_audio_table);
gtk_container_set_border_width (GTK_CONTAINER (preference_audio_table), 5);
gtk_table_set_row_spacings (GTK_TABLE (preference_audio_table), 5);
gtk_table_set_col_spacings (GTK_TABLE (preference_audio_table), 5);
preferences_audio_spdif_checkbutton = gtk_check_button_new_with_label (_("Spdif output")); preferences_audio_spdif_checkbutton = gtk_check_button_new_with_label (_("Spdif output"));
gtk_widget_ref (preferences_audio_spdif_checkbutton); gtk_widget_ref (preferences_audio_spdif_checkbutton);
...@@ -2708,6 +2728,9 @@ create_intf_preferences (void) ...@@ -2708,6 +2728,9 @@ create_intf_preferences (void)
(GtkDestroyNotify) gtk_widget_unref); (GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (preference_playlist_table); gtk_widget_show (preference_playlist_table);
gtk_container_add (GTK_CONTAINER (preferences_notebook), preference_playlist_table); gtk_container_add (GTK_CONTAINER (preferences_notebook), preference_playlist_table);
gtk_container_set_border_width (GTK_CONTAINER (preference_playlist_table), 5);
gtk_table_set_row_spacings (GTK_TABLE (preference_playlist_table), 5);
gtk_table_set_col_spacings (GTK_TABLE (preference_playlist_table), 5);
preferences_playlist_launch_on_startup_checkbutton = gtk_check_button_new_with_label (_("Launch on startup")); preferences_playlist_launch_on_startup_checkbutton = gtk_check_button_new_with_label (_("Launch on startup"));
gtk_widget_ref (preferences_playlist_launch_on_startup_checkbutton); gtk_widget_ref (preferences_playlist_launch_on_startup_checkbutton);
...@@ -2749,42 +2772,9 @@ create_intf_preferences (void) ...@@ -2749,42 +2772,9 @@ create_intf_preferences (void)
(GtkDestroyNotify) gtk_widget_unref); (GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (preferences_misc_table); gtk_widget_show (preferences_misc_table);
gtk_container_add (GTK_CONTAINER (preferences_notebook), preferences_misc_table); gtk_container_add (GTK_CONTAINER (preferences_notebook), preferences_misc_table);
gtk_container_set_border_width (GTK_CONTAINER (preferences_misc_table), 5);
preferences_misc_message_frame = gtk_frame_new (_("Messages")); gtk_table_set_row_spacings (GTK_TABLE (preferences_misc_table), 5);
gtk_widget_ref (preferences_misc_message_frame); gtk_table_set_col_spacings (GTK_TABLE (preferences_misc_table), 5);
gtk_object_set_data_full (GTK_OBJECT (intf_preferences), "preferences_misc_message_frame", preferences_misc_message_frame,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (preferences_misc_message_frame);
gtk_table_attach (GTK_TABLE (preferences_misc_table), preferences_misc_message_frame, 1, 2, 0, 1,
(GtkAttachOptions) (GTK_EXPAND),
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
gtk_frame_set_label_align (GTK_FRAME (preferences_misc_message_frame), 0.05, 0.5);
preferences_misc_message_table = gtk_table_new (1, 2, FALSE);
gtk_widget_ref (preferences_misc_message_table);
gtk_object_set_data_full (GTK_OBJECT (intf_preferences), "preferences_misc_message_table", preferences_misc_message_table,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (preferences_misc_message_table);
gtk_container_add (GTK_CONTAINER (preferences_misc_message_frame), preferences_misc_message_table);
preferences_misc_messages_label = gtk_label_new (_("Warning level: "));
gtk_widget_ref (preferences_misc_messages_label);
gtk_object_set_data_full (GTK_OBJECT (intf_preferences), "preferences_misc_messages_label", preferences_misc_messages_label,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (preferences_misc_messages_label);
gtk_table_attach (GTK_TABLE (preferences_misc_message_table), preferences_misc_messages_label, 0, 1, 0, 1,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
preferences_misc_messages_spinbutton_adj = gtk_adjustment_new (0, 0, 100, 1, 10, 10);
preferences_misc_messages_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (preferences_misc_messages_spinbutton_adj), 1, 0);
gtk_widget_ref (preferences_misc_messages_spinbutton);
gtk_object_set_data_full (GTK_OBJECT (intf_preferences), "preferences_misc_messages_spinbutton", preferences_misc_messages_spinbutton,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (preferences_misc_messages_spinbutton);
gtk_table_attach (GTK_TABLE (preferences_misc_message_table), preferences_misc_messages_spinbutton, 1, 2, 0, 1,
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
preferences_misc_associated_files_frame = gtk_frame_new (_("Files associated with vlc")); preferences_misc_associated_files_frame = gtk_frame_new (_("Files associated with vlc"));
gtk_widget_ref (preferences_misc_associated_files_frame); gtk_widget_ref (preferences_misc_associated_files_frame);
...@@ -2793,7 +2783,7 @@ create_intf_preferences (void) ...@@ -2793,7 +2783,7 @@ create_intf_preferences (void)
gtk_widget_show (preferences_misc_associated_files_frame); gtk_widget_show (preferences_misc_associated_files_frame);
gtk_table_attach (GTK_TABLE (preferences_misc_table), preferences_misc_associated_files_frame, 0, 1, 0, 1, gtk_table_attach (GTK_TABLE (preferences_misc_table), preferences_misc_associated_files_frame, 0, 1, 0, 1,
(GtkAttachOptions) (GTK_EXPAND), (GtkAttachOptions) (GTK_EXPAND),
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0); (GtkAttachOptions) (GTK_FILL), 0, 0);
gtk_widget_set_sensitive (preferences_misc_associated_files_frame, FALSE); gtk_widget_set_sensitive (preferences_misc_associated_files_frame, FALSE);
gtk_frame_set_label_align (GTK_FRAME (preferences_misc_associated_files_frame), 0.05, 0.5); gtk_frame_set_label_align (GTK_FRAME (preferences_misc_associated_files_frame), 0.05, 0.5);
...@@ -2804,12 +2794,21 @@ create_intf_preferences (void) ...@@ -2804,12 +2794,21 @@ create_intf_preferences (void)
gtk_widget_show (preferences_misc_associated_table); gtk_widget_show (preferences_misc_associated_table);
gtk_container_add (GTK_CONTAINER (preferences_misc_associated_files_frame), preferences_misc_associated_table); gtk_container_add (GTK_CONTAINER (preferences_misc_associated_files_frame), preferences_misc_associated_table);
preferences_misc_mpeg_checkbutton = gtk_check_button_new_with_label (_("mpeg")); preferences_misc_ts_checkbutton = gtk_check_button_new_with_label (_("ts"));
gtk_widget_ref (preferences_misc_mpeg_checkbutton); gtk_widget_ref (preferences_misc_ts_checkbutton);
gtk_object_set_data_full (GTK_OBJECT (intf_preferences), "preferences_misc_mpeg_checkbutton", preferences_misc_mpeg_checkbutton, gtk_object_set_data_full (GTK_OBJECT (intf_preferences), "preferences_misc_ts_checkbutton", preferences_misc_ts_checkbutton,
(GtkDestroyNotify) gtk_widget_unref); (GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (preferences_misc_mpeg_checkbutton); gtk_widget_show (preferences_misc_ts_checkbutton);
gtk_table_attach (GTK_TABLE (preferences_misc_associated_table), preferences_misc_mpeg_checkbutton, 0, 1, 0, 1, gtk_table_attach (GTK_TABLE (preferences_misc_associated_table), preferences_misc_ts_checkbutton, 0, 1, 3, 4,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
preferences_misc_vob_checkbutton = gtk_check_button_new_with_label (_("vob"));
gtk_widget_ref (preferences_misc_vob_checkbutton);
gtk_object_set_data_full (GTK_OBJECT (intf_preferences), "preferences_misc_vob_checkbutton", preferences_misc_vob_checkbutton,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (preferences_misc_vob_checkbutton);
gtk_table_attach (GTK_TABLE (preferences_misc_associated_table), preferences_misc_vob_checkbutton, 0, 1, 2, 3,
(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0); (GtkAttachOptions) (0), 0, 0);
...@@ -2822,24 +2821,51 @@ create_intf_preferences (void) ...@@ -2822,24 +2821,51 @@ create_intf_preferences (void)
(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0); (GtkAttachOptions) (0), 0, 0);
preferences_misc_vob_checkbutton = gtk_check_button_new_with_label (_("vob")); preferences_misc_mpeg_checkbutton = gtk_check_button_new_with_label (_("mpeg"));
gtk_widget_ref (preferences_misc_vob_checkbutton); gtk_widget_ref (preferences_misc_mpeg_checkbutton);
gtk_object_set_data_full (GTK_OBJECT (intf_preferences), "preferences_misc_vob_checkbutton", preferences_misc_vob_checkbutton, gtk_object_set_data_full (GTK_OBJECT (intf_preferences), "preferences_misc_mpeg_checkbutton", preferences_misc_mpeg_checkbutton,
(GtkDestroyNotify) gtk_widget_unref); (GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (preferences_misc_vob_checkbutton); gtk_widget_show (preferences_misc_mpeg_checkbutton);
gtk_table_attach (GTK_TABLE (preferences_misc_associated_table), preferences_misc_vob_checkbutton, 0, 1, 2, 3, gtk_table_attach (GTK_TABLE (preferences_misc_associated_table), preferences_misc_mpeg_checkbutton, 0, 1, 0, 1,
(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0); (GtkAttachOptions) (0), 0, 0);
preferences_misc_ts_checkbutton = gtk_check_button_new_with_label (_("ts")); preferences_misc_message_frame = gtk_frame_new (_("Messages"));
gtk_widget_ref (preferences_misc_ts_checkbutton); gtk_widget_ref (preferences_misc_message_frame);
gtk_object_set_data_full (GTK_OBJECT (intf_preferences), "preferences_misc_ts_checkbutton", preferences_misc_ts_checkbutton, gtk_object_set_data_full (GTK_OBJECT (intf_preferences), "preferences_misc_message_frame", preferences_misc_message_frame,
(GtkDestroyNotify) gtk_widget_unref); (GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (preferences_misc_ts_checkbutton); gtk_widget_show (preferences_misc_message_frame);
gtk_table_attach (GTK_TABLE (preferences_misc_associated_table), preferences_misc_ts_checkbutton, 0, 1, 3, 4, gtk_table_attach (GTK_TABLE (preferences_misc_table), preferences_misc_message_frame, 1, 2, 0, 1,
(GtkAttachOptions) (GTK_EXPAND),
(GtkAttachOptions) (GTK_FILL), 0, 0);
gtk_frame_set_label_align (GTK_FRAME (preferences_misc_message_frame), 0.05, 0.5);
preferences_misc_message_table = gtk_table_new (1, 2, FALSE);
gtk_widget_ref (preferences_misc_message_table);
gtk_object_set_data_full (GTK_OBJECT (intf_preferences), "preferences_misc_message_table", preferences_misc_message_table,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (preferences_misc_message_table);
gtk_container_add (GTK_CONTAINER (preferences_misc_message_frame), preferences_misc_message_table);
preferences_misc_messages_label = gtk_label_new (_("Warning level: "));
gtk_widget_ref (preferences_misc_messages_label);
gtk_object_set_data_full (GTK_OBJECT (intf_preferences), "preferences_misc_messages_label", preferences_misc_messages_label,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (preferences_misc_messages_label);
gtk_table_attach (GTK_TABLE (preferences_misc_message_table), preferences_misc_messages_label, 0, 1, 0, 1,
(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0); (GtkAttachOptions) (0), 0, 0);
preferences_misc_messages_spinbutton_adj = gtk_adjustment_new (0, 0, 100, 1, 10, 10);
preferences_misc_messages_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (preferences_misc_messages_spinbutton_adj), 1, 0);
gtk_widget_ref (preferences_misc_messages_spinbutton);
gtk_object_set_data_full (GTK_OBJECT (intf_preferences), "preferences_misc_messages_spinbutton", preferences_misc_messages_spinbutton,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (preferences_misc_messages_spinbutton);
gtk_table_attach (GTK_TABLE (preferences_misc_message_table), preferences_misc_messages_spinbutton, 1, 2, 0, 1,
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
preferences_misc = gtk_label_new (_("Misc")); preferences_misc = gtk_label_new (_("Misc"));
gtk_widget_ref (preferences_misc); gtk_widget_ref (preferences_misc);
gtk_object_set_data_full (GTK_OBJECT (intf_preferences), "preferences_misc", preferences_misc, gtk_object_set_data_full (GTK_OBJECT (intf_preferences), "preferences_misc", preferences_misc,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* gnome_playlist.c : Interface for the playlist dialog * gnome_playlist.c : Interface for the playlist dialog
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: gnome_playlist.c,v 1.2 2001/05/07 03:14:09 stef Exp $ * $Id: gnome_playlist.c,v 1.3 2001/05/15 01:01:44 stef Exp $
* *
* Authors: Pierre Baillet <oct@zoy.org> * Authors: Pierre Baillet <oct@zoy.org>
* *
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
* The following callbacks are related to the playlist. * The following callbacks are related to the playlist.
*****************************************************************************/ *****************************************************************************/
void void
on_intf_playlist_destroy (GtkObject *object, on_playlist_destroy (GtkObject *object,
gpointer user_data) gpointer user_data)
{ {
gtk_widget_hide( GTK_WIDGET(object)); gtk_widget_hide( GTK_WIDGET(object));
...@@ -314,6 +314,7 @@ on_playlist_clist_event (GtkWidget *widget, ...@@ -314,6 +314,7 @@ on_playlist_clist_event (GtkWidget *widget,
p_intf->p_input->b_eof = 1; p_intf->p_input->b_eof = 1;
} }
intf_PlaylistJumpto( p_main->p_playlist, i_row - 1 ); intf_PlaylistJumpto( p_main->p_playlist, i_row - 1 );
p_main->p_playlist->b_stopped = 0;
} }
return TRUE; return TRUE;
} }
...@@ -337,6 +338,7 @@ on_playlist_clist_drag_data_received (GtkWidget *widget, ...@@ -337,6 +338,7 @@ on_playlist_clist_drag_data_received (GtkWidget *widget,
GtkCList * p_clist; GtkCList * p_clist;
gint i_row; gint i_row;
gint i_col; gint i_col;
int i_end = p_main->p_playlist->i_size;
p_clist = GTK_CLIST( gtk_object_get_data( GTK_OBJECT( p_clist = GTK_CLIST( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_playlist ), "playlist_clist" ) ); p_intf->p_sys->p_playlist ), "playlist_clist" ) );
...@@ -351,6 +353,10 @@ on_playlist_clist_drag_data_received (GtkWidget *widget, ...@@ -351,6 +353,10 @@ on_playlist_clist_drag_data_received (GtkWidget *widget,
/* else, put that at the end of the playlist */ /* else, put that at the end of the playlist */
GnomeDropDataReceived( p_intf, data, info, PLAYLIST_END ); GnomeDropDataReceived( p_intf, data, info, PLAYLIST_END );
} }
intf_PlaylistJumpto( p_main->p_playlist, i_end - 1 );
p_main->p_playlist->b_stopped = 0;
} }
...@@ -506,6 +512,8 @@ void GnomeDropDataReceived( intf_thread_t * p_intf, ...@@ -506,6 +512,8 @@ void GnomeDropDataReceived( intf_thread_t * p_intf,
/* unlock the interface */ /* unlock the interface */
vlc_mutex_unlock( &p_intf->change_lock ); vlc_mutex_unlock( &p_intf->change_lock );
p_main->p_playlist->b_stopped = 0;
} }
} }
......
...@@ -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.38 2001/05/10 06:47:31 sam Exp $ * $Id: intf_gnome.c,v 1.39 2001/05/15 01:01:44 stef Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* Stphane Borel <stef@via.ecp.fr> * Stphane Borel <stef@via.ecp.fr>
...@@ -439,7 +439,7 @@ static gint GnomeRadioMenu( intf_thread_t * p_intf, ...@@ -439,7 +439,7 @@ static gint GnomeRadioMenu( intf_thread_t * p_intf,
} }
snprintf( psz_name, GNOME_MENU_LABEL_SIZE, snprintf( psz_name, GNOME_MENU_LABEL_SIZE,
"Chapters %d to %d", i_item + 1, i_item + 10); "%ss %d to %d", psz_item_name, i_item + 1, i_item + 10);
psz_name[ GNOME_MENU_LABEL_SIZE - 1 ] = '\0'; psz_name[ GNOME_MENU_LABEL_SIZE - 1 ] = '\0';
p_item_group = gtk_menu_item_new_with_label( psz_name ); p_item_group = gtk_menu_item_new_with_label( psz_name );
gtk_widget_show( p_item_group ); gtk_widget_show( p_item_group );
...@@ -1121,14 +1121,14 @@ static gint GnomeModeManage( intf_thread_t * p_intf ) ...@@ -1121,14 +1121,14 @@ static gint GnomeModeManage( intf_thread_t * p_intf )
/* control buttons for free pace streams */ /* control buttons for free pace streams */
b_control = p_intf->p_input->stream.b_pace_control; b_control = p_intf->p_input->stream.b_pace_control;
gtk_widget_set_sensitive( GETWIDGET(p_window, "toolbar_back"), FALSE ); gtk_widget_set_sensitive( GETWIDGET(p_window, "toolbar_back"), FALSE );
gtk_widget_set_sensitive( GETWIDGET(p_window, "toolbar_stop"), FALSE ); gtk_widget_set_sensitive( GETWIDGET(p_window, "toolbar_stop"), b_control );
gtk_widget_set_sensitive( GETWIDGET(p_window, "toolbar_play"), b_control ); gtk_widget_set_sensitive( GETWIDGET(p_window, "toolbar_play"), TRUE );
gtk_widget_set_sensitive( GETWIDGET(p_window, "toolbar_pause"), b_control ); gtk_widget_set_sensitive( GETWIDGET(p_window, "toolbar_pause"), b_control );
gtk_widget_set_sensitive( GETWIDGET(p_window, "toolbar_slow"), b_control ); gtk_widget_set_sensitive( GETWIDGET(p_window, "toolbar_slow"), b_control );
gtk_widget_set_sensitive( GETWIDGET(p_window, "toolbar_fast"), b_control ); gtk_widget_set_sensitive( GETWIDGET(p_window, "toolbar_fast"), b_control );
gtk_widget_set_sensitive( GETWIDGET(p_popup, "popup_back"), FALSE ); gtk_widget_set_sensitive( GETWIDGET(p_popup, "popup_back"), FALSE );
gtk_widget_set_sensitive( GETWIDGET(p_popup, "popup_stop"), FALSE ); gtk_widget_set_sensitive( GETWIDGET(p_popup, "popup_stop"), FALSE );
gtk_widget_set_sensitive( GETWIDGET(p_popup, "popup_play"), b_control ); gtk_widget_set_sensitive( GETWIDGET(p_popup, "popup_play"), TRUE );
gtk_widget_set_sensitive( GETWIDGET(p_popup, "popup_pause"), b_control ); gtk_widget_set_sensitive( GETWIDGET(p_popup, "popup_pause"), b_control );
gtk_widget_set_sensitive( GETWIDGET(p_popup, "popup_slow"), b_control ); gtk_widget_set_sensitive( GETWIDGET(p_popup, "popup_slow"), b_control );
gtk_widget_set_sensitive( GETWIDGET(p_popup, "popup_fast"), b_control ); gtk_widget_set_sensitive( GETWIDGET(p_popup, "popup_fast"), b_control );
......
...@@ -73,8 +73,6 @@ ...@@ -73,8 +73,6 @@
<class>GtkMenuBar</class> <class>GtkMenuBar</class>
<name>menubar</name> <name>menubar</name>
<border_width>2</border_width> <border_width>2</border_width>
<width>500</width>
<height>32</height>
<shadow_type>GTK_SHADOW_NONE</shadow_type> <shadow_type>GTK_SHADOW_NONE</shadow_type>
<widget> <widget>
...@@ -546,8 +544,6 @@ ...@@ -546,8 +544,6 @@
<widget> <widget>
<class>GtkHScale</class> <class>GtkHScale</class>
<name>slider</name> <name>slider</name>
<width>500</width>
<height>15</height>
<can_focus>True</can_focus> <can_focus>True</can_focus>
<signal> <signal>
<name>button_press_event</name> <name>button_press_event</name>
...@@ -576,8 +572,6 @@ ...@@ -576,8 +572,6 @@
<widget> <widget>
<class>GtkHBox</class> <class>GtkHBox</class>
<name>file_box</name> <name>file_box</name>
<width>500</width>
<height>24</height>
<homogeneous>False</homogeneous> <homogeneous>False</homogeneous>
<spacing>0</spacing> <spacing>0</spacing>
<child> <child>
...@@ -607,8 +601,6 @@ ...@@ -607,8 +601,6 @@
<widget> <widget>
<class>GtkHBox</class> <class>GtkHBox</class>
<name>dvd_box</name> <name>dvd_box</name>
<width>500</width>
<height>24</height>
<visible>False</visible> <visible>False</visible>
<homogeneous>False</homogeneous> <homogeneous>False</homogeneous>
<spacing>0</spacing> <spacing>0</spacing>
...@@ -816,8 +808,6 @@ ...@@ -816,8 +808,6 @@
<widget> <widget>
<class>GtkHBox</class> <class>GtkHBox</class>
<name>network_box</name> <name>network_box</name>
<width>500</width>
<height>24</height>
<visible>False</visible> <visible>False</visible>
<homogeneous>True</homogeneous> <homogeneous>True</homogeneous>
<spacing>0</spacing> <spacing>0</spacing>
...@@ -1034,7 +1024,7 @@ ...@@ -1034,7 +1024,7 @@
<handler>on_popup_jump_activate</handler> <handler>on_popup_jump_activate</handler>
<last_modification_time>Tue, 01 May 2001 22:22:49 GMT</last_modification_time> <last_modification_time>Tue, 01 May 2001 22:22:49 GMT</last_modification_time>
</signal> </signal>
<label>_Jump</label> <label>_Jump...</label>
<right_justify>False</right_justify> <right_justify>False</right_justify>
<stock_icon>GNOME_STOCK_MENU_JUMP_TO</stock_icon> <stock_icon>GNOME_STOCK_MENU_JUMP_TO</stock_icon>
</widget> </widget>
...@@ -1168,7 +1158,6 @@ ...@@ -1168,7 +1158,6 @@
<widget> <widget>
<class>GtkPixmapMenuItem</class> <class>GtkPixmapMenuItem</class>
<name>popup_preferences</name> <name>popup_preferences</name>
<sensitive>False</sensitive>
<signal> <signal>
<name>activate</name> <name>activate</name>
<handler>on_popup_preferences_activate</handler> <handler>on_popup_preferences_activate</handler>
...@@ -2058,6 +2047,11 @@ Henri Fallon &lt;henri@via.ecp.fr&gt; ...@@ -2058,6 +2047,11 @@ Henri Fallon &lt;henri@via.ecp.fr&gt;
<widget> <widget>
<class>GnomeDialog</class> <class>GnomeDialog</class>
<name>intf_playlist</name> <name>intf_playlist</name>
<signal>
<name>destroy</name>
<handler>on_playlist_destroy</handler>
<last_modification_time>Tue, 08 May 2001 23:21:39 GMT</last_modification_time>
</signal>
<title>Playlist</title> <title>Playlist</title>
<type>GTK_WINDOW_TOPLEVEL</type> <type>GTK_WINDOW_TOPLEVEL</type>
<position>GTK_WIN_POS_NONE</position> <position>GTK_WIN_POS_NONE</position>
...@@ -2147,6 +2141,7 @@ Henri Fallon &lt;henri@via.ecp.fr&gt; ...@@ -2147,6 +2141,7 @@ Henri Fallon &lt;henri@via.ecp.fr&gt;
<widget> <widget>
<class>GtkFrame</class> <class>GtkFrame</class>
<name>playlist_frame</name> <name>playlist_frame</name>
<border_width>4</border_width>
<label>Playlist</label> <label>Playlist</label>
<label_xalign>0.05</label_xalign> <label_xalign>0.05</label_xalign>
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
...@@ -2382,7 +2377,7 @@ Henri Fallon &lt;henri@via.ecp.fr&gt; ...@@ -2382,7 +2377,7 @@ Henri Fallon &lt;henri@via.ecp.fr&gt;
<homogeneous>False</homogeneous> <homogeneous>False</homogeneous>
<spacing>8</spacing> <spacing>8</spacing>
<child> <child>
<padding>4</padding> <padding>0</padding>
<expand>True</expand> <expand>True</expand>
<fill>True</fill> <fill>True</fill>
</child> </child>
...@@ -2434,6 +2429,7 @@ Henri Fallon &lt;henri@via.ecp.fr&gt; ...@@ -2434,6 +2429,7 @@ Henri Fallon &lt;henri@via.ecp.fr&gt;
<widget> <widget>
<class>GtkFrame</class> <class>GtkFrame</class>
<name>jump_frame</name> <name>jump_frame</name>
<border_width>5</border_width>
<label>Jump to: </label> <label>Jump to: </label>
<label_xalign>0.05</label_xalign> <label_xalign>0.05</label_xalign>
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
...@@ -2446,6 +2442,7 @@ Henri Fallon &lt;henri@via.ecp.fr&gt; ...@@ -2446,6 +2442,7 @@ Henri Fallon &lt;henri@via.ecp.fr&gt;
<widget> <widget>
<class>GtkHBox</class> <class>GtkHBox</class>
<name>jump_box</name> <name>jump_box</name>
<border_width>5</border_width>
<homogeneous>False</homogeneous> <homogeneous>False</homogeneous>
<spacing>0</spacing> <spacing>0</spacing>
...@@ -2598,10 +2595,11 @@ Henri Fallon &lt;henri@via.ecp.fr&gt; ...@@ -2598,10 +2595,11 @@ Henri Fallon &lt;henri@via.ecp.fr&gt;
<class>GtkVBox</class> <class>GtkVBox</class>
<child_name>GnomeDialog:vbox</child_name> <child_name>GnomeDialog:vbox</child_name>
<name>preferences_vbox</name> <name>preferences_vbox</name>
<border_width>5</border_width>
<homogeneous>False</homogeneous> <homogeneous>False</homogeneous>
<spacing>8</spacing> <spacing>10</spacing>
<child> <child>
<padding>4</padding> <padding>0</padding>
<expand>True</expand> <expand>True</expand>
<fill>True</fill> <fill>True</fill>
</child> </child>
...@@ -2690,11 +2688,12 @@ Henri Fallon &lt;henri@via.ecp.fr&gt; ...@@ -2690,11 +2688,12 @@ Henri Fallon &lt;henri@via.ecp.fr&gt;
<widget> <widget>
<class>GtkTable</class> <class>GtkTable</class>
<name>preferences_file_table</name> <name>preferences_file_table</name>
<border_width>5</border_width>
<rows>1</rows> <rows>1</rows>
<columns>2</columns> <columns>2</columns>
<homogeneous>False</homogeneous> <homogeneous>False</homogeneous>
<row_spacing>0</row_spacing> <row_spacing>5</row_spacing>
<column_spacing>0</column_spacing> <column_spacing>5</column_spacing>
<widget> <widget>
<class>GnomeFileEntry</class> <class>GnomeFileEntry</class>
...@@ -2772,11 +2771,12 @@ Henri Fallon &lt;henri@via.ecp.fr&gt; ...@@ -2772,11 +2771,12 @@ Henri Fallon &lt;henri@via.ecp.fr&gt;
<widget> <widget>
<class>GtkTable</class> <class>GtkTable</class>
<name>preferences_disc_table</name> <name>preferences_disc_table</name>
<border_width>5</border_width>
<rows>2</rows> <rows>2</rows>
<columns>2</columns> <columns>2</columns>
<homogeneous>False</homogeneous> <homogeneous>False</homogeneous>
<row_spacing>0</row_spacing> <row_spacing>5</row_spacing>
<column_spacing>0</column_spacing> <column_spacing>5</column_spacing>
<widget> <widget>
<class>GnomeFileEntry</class> <class>GnomeFileEntry</class>
...@@ -2913,11 +2913,12 @@ Henri Fallon &lt;henri@via.ecp.fr&gt; ...@@ -2913,11 +2913,12 @@ Henri Fallon &lt;henri@via.ecp.fr&gt;
<widget> <widget>
<class>GtkTable</class> <class>GtkTable</class>
<name>preferences_network_table</name> <name>preferences_network_table</name>
<border_width>5</border_width>
<rows>7</rows> <rows>7</rows>
<columns>2</columns> <columns>2</columns>
<homogeneous>False</homogeneous> <homogeneous>False</homogeneous>
<row_spacing>0</row_spacing> <row_spacing>5</row_spacing>
<column_spacing>0</column_spacing> <column_spacing>5</column_spacing>
<widget> <widget>
<class>GtkLabel</class> <class>GtkLabel</class>
...@@ -3229,11 +3230,12 @@ Henri Fallon &lt;henri@via.ecp.fr&gt; ...@@ -3229,11 +3230,12 @@ Henri Fallon &lt;henri@via.ecp.fr&gt;
<widget> <widget>
<class>GtkTable</class> <class>GtkTable</class>
<name>preferences_network_interface_table</name> <name>preferences_network_interface_table</name>
<border_width>5</border_width>
<rows>1</rows> <rows>1</rows>
<columns>2</columns> <columns>2</columns>
<homogeneous>False</homogeneous> <homogeneous>False</homogeneous>
<row_spacing>0</row_spacing> <row_spacing>5</row_spacing>
<column_spacing>0</column_spacing> <column_spacing>5</column_spacing>
<widget> <widget>
<class>GtkLabel</class> <class>GtkLabel</class>
...@@ -3309,11 +3311,12 @@ Henri Fallon &lt;henri@via.ecp.fr&gt; ...@@ -3309,11 +3311,12 @@ Henri Fallon &lt;henri@via.ecp.fr&gt;
<widget> <widget>
<class>GtkTable</class> <class>GtkTable</class>
<name>preferences_video_table</name> <name>preferences_video_table</name>
<border_width>5</border_width>
<rows>7</rows> <rows>7</rows>
<columns>2</columns> <columns>2</columns>
<homogeneous>False</homogeneous> <homogeneous>False</homogeneous>
<row_spacing>0</row_spacing> <row_spacing>5</row_spacing>
<column_spacing>0</column_spacing> <column_spacing>5</column_spacing>
<widget> <widget>
<class>GtkLabel</class> <class>GtkLabel</class>
...@@ -3711,11 +3714,12 @@ Henri Fallon &lt;henri@via.ecp.fr&gt; ...@@ -3711,11 +3714,12 @@ Henri Fallon &lt;henri@via.ecp.fr&gt;
<widget> <widget>
<class>GtkTable</class> <class>GtkTable</class>
<name>preference_audio_table</name> <name>preference_audio_table</name>
<border_width>5</border_width>
<rows>6</rows> <rows>6</rows>
<columns>2</columns> <columns>2</columns>
<homogeneous>False</homogeneous> <homogeneous>False</homogeneous>
<row_spacing>0</row_spacing> <row_spacing>5</row_spacing>
<column_spacing>0</column_spacing> <column_spacing>5</column_spacing>
<widget> <widget>
<class>GtkCheckButton</class> <class>GtkCheckButton</class>
...@@ -4023,11 +4027,12 @@ Stereo ...@@ -4023,11 +4027,12 @@ Stereo
<widget> <widget>
<class>GtkTable</class> <class>GtkTable</class>
<name>preference_playlist_table</name> <name>preference_playlist_table</name>
<border_width>5</border_width>
<rows>3</rows> <rows>3</rows>
<columns>1</columns> <columns>1</columns>
<homogeneous>False</homogeneous> <homogeneous>False</homogeneous>
<row_spacing>0</row_spacing> <row_spacing>5</row_spacing>
<column_spacing>0</column_spacing> <column_spacing>5</column_spacing>
<widget> <widget>
<class>GtkCheckButton</class> <class>GtkCheckButton</class>
...@@ -4115,27 +4120,29 @@ Stereo ...@@ -4115,27 +4120,29 @@ Stereo
<widget> <widget>
<class>GtkTable</class> <class>GtkTable</class>
<name>preferences_misc_table</name> <name>preferences_misc_table</name>
<border_width>5</border_width>
<rows>1</rows> <rows>1</rows>
<columns>2</columns> <columns>2</columns>
<homogeneous>False</homogeneous> <homogeneous>False</homogeneous>
<row_spacing>0</row_spacing> <row_spacing>5</row_spacing>
<column_spacing>0</column_spacing> <column_spacing>5</column_spacing>
<widget> <widget>
<class>GtkFrame</class> <class>GtkFrame</class>
<name>preferences_misc_message_frame</name> <name>preferences_misc_associated_files_frame</name>
<label>Messages</label> <sensitive>False</sensitive>
<label>Files associated with vlc</label>
<label_xalign>0.05</label_xalign> <label_xalign>0.05</label_xalign>
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
<child> <child>
<left_attach>1</left_attach> <left_attach>0</left_attach>
<right_attach>2</right_attach> <right_attach>1</right_attach>
<top_attach>0</top_attach> <top_attach>0</top_attach>
<bottom_attach>1</bottom_attach> <bottom_attach>1</bottom_attach>
<xpad>0</xpad> <xpad>0</xpad>
<ypad>0</ypad> <ypad>0</ypad>
<xexpand>True</xexpand> <xexpand>True</xexpand>
<yexpand>True</yexpand> <yexpand>False</yexpand>
<xshrink>False</xshrink> <xshrink>False</xshrink>
<yshrink>False</yshrink> <yshrink>False</yshrink>
<xfill>False</xfill> <xfill>False</xfill>
...@@ -4144,28 +4151,25 @@ Stereo ...@@ -4144,28 +4151,25 @@ Stereo
<widget> <widget>
<class>GtkTable</class> <class>GtkTable</class>
<name>preferences_misc_message_table</name> <name>preferences_misc_associated_table</name>
<rows>1</rows> <rows>4</rows>
<columns>2</columns> <columns>1</columns>
<homogeneous>False</homogeneous> <homogeneous>False</homogeneous>
<row_spacing>0</row_spacing> <row_spacing>0</row_spacing>
<column_spacing>0</column_spacing> <column_spacing>0</column_spacing>
<widget> <widget>
<class>GtkLabel</class> <class>GtkCheckButton</class>
<name>preferences_misc_messages_label</name> <name>preferences_misc_ts_checkbutton</name>
<label>Warning level: </label> <can_focus>True</can_focus>
<justify>GTK_JUSTIFY_CENTER</justify> <label>ts</label>
<wrap>False</wrap> <active>False</active>
<xalign>0.5</xalign> <draw_indicator>True</draw_indicator>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child> <child>
<left_attach>0</left_attach> <left_attach>0</left_attach>
<right_attach>1</right_attach> <right_attach>1</right_attach>
<top_attach>0</top_attach> <top_attach>3</top_attach>
<bottom_attach>1</bottom_attach> <bottom_attach>4</bottom_attach>
<xpad>0</xpad> <xpad>0</xpad>
<ypad>0</ypad> <ypad>0</ypad>
<xexpand>False</xexpand> <xexpand>False</xexpand>
...@@ -4178,29 +4182,20 @@ Stereo ...@@ -4178,29 +4182,20 @@ Stereo
</widget> </widget>
<widget> <widget>
<class>GtkSpinButton</class> <class>GtkCheckButton</class>
<name>preferences_misc_messages_spinbutton</name> <name>preferences_misc_vob_checkbutton</name>
<can_focus>True</can_focus> <can_focus>True</can_focus>
<climb_rate>1</climb_rate> <label>vob</label>
<digits>0</digits> <active>False</active>
<numeric>False</numeric> <draw_indicator>True</draw_indicator>
<update_policy>GTK_UPDATE_ALWAYS</update_policy>
<snap>False</snap>
<wrap>False</wrap>
<value>0</value>
<lower>0</lower>
<upper>100</upper>
<step>1</step>
<page>10</page>
<page_size>10</page_size>
<child> <child>
<left_attach>1</left_attach> <left_attach>0</left_attach>
<right_attach>2</right_attach> <right_attach>1</right_attach>
<top_attach>0</top_attach> <top_attach>2</top_attach>
<bottom_attach>1</bottom_attach> <bottom_attach>3</bottom_attach>
<xpad>0</xpad> <xpad>0</xpad>
<ypad>0</ypad> <ypad>0</ypad>
<xexpand>True</xexpand> <xexpand>False</xexpand>
<yexpand>False</yexpand> <yexpand>False</yexpand>
<xshrink>False</xshrink> <xshrink>False</xshrink>
<yshrink>False</yshrink> <yshrink>False</yshrink>
...@@ -4208,52 +4203,19 @@ Stereo ...@@ -4208,52 +4203,19 @@ Stereo
<yfill>False</yfill> <yfill>False</yfill>
</child> </child>
</widget> </widget>
</widget>
</widget>
<widget>
<class>GtkFrame</class>
<name>preferences_misc_associated_files_frame</name>
<sensitive>False</sensitive>
<label>Files associated with vlc</label>
<label_xalign>0.05</label_xalign>
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>0</top_attach>
<bottom_attach>1</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>True</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>False</xfill>
<yfill>True</yfill>
</child>
<widget>
<class>GtkTable</class>
<name>preferences_misc_associated_table</name>
<rows>4</rows>
<columns>1</columns>
<homogeneous>False</homogeneous>
<row_spacing>0</row_spacing>
<column_spacing>0</column_spacing>
<widget> <widget>
<class>GtkCheckButton</class> <class>GtkCheckButton</class>
<name>preferences_misc_mpeg_checkbutton</name> <name>preferences_misc_mp2_checkbutton</name>
<can_focus>True</can_focus> <can_focus>True</can_focus>
<label>mpeg</label> <label>mp2</label>
<active>False</active> <active>False</active>
<draw_indicator>True</draw_indicator> <draw_indicator>True</draw_indicator>
<child> <child>
<left_attach>0</left_attach> <left_attach>0</left_attach>
<right_attach>1</right_attach> <right_attach>1</right_attach>
<top_attach>0</top_attach> <top_attach>1</top_attach>
<bottom_attach>1</bottom_attach> <bottom_attach>2</bottom_attach>
<xpad>0</xpad> <xpad>0</xpad>
<ypad>0</ypad> <ypad>0</ypad>
<xexpand>False</xexpand> <xexpand>False</xexpand>
...@@ -4267,16 +4229,16 @@ Stereo ...@@ -4267,16 +4229,16 @@ Stereo
<widget> <widget>
<class>GtkCheckButton</class> <class>GtkCheckButton</class>
<name>preferences_misc_mp2_checkbutton</name> <name>preferences_misc_mpeg_checkbutton</name>
<can_focus>True</can_focus> <can_focus>True</can_focus>
<label>mp2</label> <label>mpeg</label>
<active>False</active> <active>False</active>
<draw_indicator>True</draw_indicator> <draw_indicator>True</draw_indicator>
<child> <child>
<left_attach>0</left_attach> <left_attach>0</left_attach>
<right_attach>1</right_attach> <right_attach>1</right_attach>
<top_attach>1</top_attach> <top_attach>0</top_attach>
<bottom_attach>2</bottom_attach> <bottom_attach>1</bottom_attach>
<xpad>0</xpad> <xpad>0</xpad>
<ypad>0</ypad> <ypad>0</ypad>
<xexpand>False</xexpand> <xexpand>False</xexpand>
...@@ -4287,19 +4249,54 @@ Stereo ...@@ -4287,19 +4249,54 @@ Stereo
<yfill>False</yfill> <yfill>False</yfill>
</child> </child>
</widget> </widget>
</widget>
</widget>
<widget>
<class>GtkFrame</class>
<name>preferences_misc_message_frame</name>
<label>Messages</label>
<label_xalign>0.05</label_xalign>
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>0</top_attach>
<bottom_attach>1</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>False</xfill>
<yfill>True</yfill>
</child>
<widget>
<class>GtkTable</class>
<name>preferences_misc_message_table</name>
<rows>1</rows>
<columns>2</columns>
<homogeneous>False</homogeneous>
<row_spacing>0</row_spacing>
<column_spacing>0</column_spacing>
<widget> <widget>
<class>GtkCheckButton</class> <class>GtkLabel</class>
<name>preferences_misc_vob_checkbutton</name> <name>preferences_misc_messages_label</name>
<can_focus>True</can_focus> <label>Warning level: </label>
<label>vob</label> <justify>GTK_JUSTIFY_CENTER</justify>
<active>False</active> <wrap>False</wrap>
<draw_indicator>True</draw_indicator> <xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child> <child>
<left_attach>0</left_attach> <left_attach>0</left_attach>
<right_attach>1</right_attach> <right_attach>1</right_attach>
<top_attach>2</top_attach> <top_attach>0</top_attach>
<bottom_attach>3</bottom_attach> <bottom_attach>1</bottom_attach>
<xpad>0</xpad> <xpad>0</xpad>
<ypad>0</ypad> <ypad>0</ypad>
<xexpand>False</xexpand> <xexpand>False</xexpand>
...@@ -4312,20 +4309,29 @@ Stereo ...@@ -4312,20 +4309,29 @@ Stereo
</widget> </widget>
<widget> <widget>
<class>GtkCheckButton</class> <class>GtkSpinButton</class>
<name>preferences_misc_ts_checkbutton</name> <name>preferences_misc_messages_spinbutton</name>
<can_focus>True</can_focus> <can_focus>True</can_focus>
<label>ts</label> <climb_rate>1</climb_rate>
<active>False</active> <digits>0</digits>
<draw_indicator>True</draw_indicator> <numeric>False</numeric>
<update_policy>GTK_UPDATE_ALWAYS</update_policy>
<snap>False</snap>
<wrap>False</wrap>
<value>0</value>
<lower>0</lower>
<upper>100</upper>
<step>1</step>
<page>10</page>
<page_size>10</page_size>
<child> <child>
<left_attach>0</left_attach> <left_attach>1</left_attach>
<right_attach>1</right_attach> <right_attach>2</right_attach>
<top_attach>3</top_attach> <top_attach>0</top_attach>
<bottom_attach>4</bottom_attach> <bottom_attach>1</bottom_attach>
<xpad>0</xpad> <xpad>0</xpad>
<ypad>0</ypad> <ypad>0</ypad>
<xexpand>False</xexpand> <xexpand>True</xexpand>
<yexpand>False</yexpand> <yexpand>False</yexpand>
<xshrink>False</xshrink> <xshrink>False</xshrink>
<yshrink>False</yshrink> <yshrink>False</yshrink>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
# Objects # Objects
# #
PLUGIN_C = gtk.o intf_gtk.o gtk_callbacks.o gtk_interface.o gtk_support.o gtk_playlist.o PLUGIN_C = gtk.o intf_gtk.o gtk_callbacks.o gtk_interface.o gtk_support.o gtk_open.o gtk_control.o gtk_menu.o gtk_playlist.o gtk_modules.o gtk_preferences.o
BUILTIN_C = $(PLUGIN_C:%.o=BUILTIN_%.o) BUILTIN_C = $(PLUGIN_C:%.o=BUILTIN_%.o)
ALL_OBJ = $(PLUGIN_C) $(BUILTIN_C) ALL_OBJ = $(PLUGIN_C) $(BUILTIN_C)
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* gtk_callbacks.c : Callbacks for the Gtk+ plugin. * gtk_callbacks.c : Callbacks for the Gtk+ plugin.
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: gtk_callbacks.c,v 1.16 2001/05/06 18:32:30 stef Exp $ * $Id: gtk_callbacks.c,v 1.17 2001/05/15 01:01:44 stef Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* Stphane Borel <stef@via.ecp.fr> * Stphane Borel <stef@via.ecp.fr>
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
* Preamble * Preamble
*****************************************************************************/ *****************************************************************************/
#include "defs.h" #include "defs.h"
#include <sys/types.h> /* off_t */ #include <sys/types.h> /* off_t */
#include <stdlib.h> #include <stdlib.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
...@@ -48,10 +48,12 @@ ...@@ -48,10 +48,12 @@
#include "intf_playlist.h" #include "intf_playlist.h"
#include "intf_msg.h" #include "intf_msg.h"
#include "video.h"
#include "video_output.h"
#include "gtk_callbacks.h" #include "gtk_callbacks.h"
#include "gtk_interface.h" #include "gtk_interface.h"
#include "gtk_support.h" #include "gtk_support.h"
#include "gtk_playlist.h"
#include "intf_gtk.h" #include "intf_gtk.h"
#include "main.h" #include "main.h"
...@@ -59,874 +61,411 @@ ...@@ -59,874 +61,411 @@
/***************************************************************************** /*****************************************************************************
* Callbacks * Callbacks
*****************************************************************************/ *****************************************************************************/
void
on_menubar_open_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
/* If we have never used the file selector, open it */ /*
if( p_intf->p_sys->p_fileopen == NULL) * Main interface callbacks
{ */
p_intf->p_sys->p_fileopen = create_intf_fileopen();
gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_fileopen ),
"p_intf", p_intf );
}
gtk_widget_show( p_intf->p_sys->p_fileopen ); gboolean
gdk_window_raise( p_intf->p_sys->p_fileopen->window ); GtkExit (GtkWidget *widget,
} GdkEventButton *event,
void
on_menubar_exit_activate (GtkMenuItem *menuitem,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" ); intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
vlc_mutex_lock( &p_intf->change_lock ); vlc_mutex_lock( &p_intf->change_lock );
p_intf->b_die = 1; p_intf->b_die = 1;
vlc_mutex_unlock( &p_intf->change_lock ); vlc_mutex_unlock( &p_intf->change_lock );
}
void
on_menubar_preferences_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
return TRUE;
} }
gboolean
void GtkWindowDelete (GtkWidget *widget,
on_menubar_about_activate (GtkMenuItem *menuitem, GdkEvent *event,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" ); GtkExit( GTK_WIDGET( widget ), NULL, user_data );
if( !GTK_IS_WIDGET( p_intf->p_sys->p_about ) ) return TRUE;
{
p_intf->p_sys->p_about = create_intf_about();
gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_about ),
"p_intf", p_intf );
}
gtk_widget_show( p_intf->p_sys->p_about );
gdk_window_raise( p_intf->p_sys->p_about->window );
} }
void gboolean
on_toolbar_open_clicked (GtkButton *button, GtkWindowToggle (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_window" ); intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
if( GTK_WIDGET_VISIBLE(p_intf->p_sys->p_window) )
{
gtk_widget_hide( p_intf->p_sys->p_window);
/* If we have never used the file selector, open it */ }
if( p_intf->p_sys->p_fileopen == NULL) else
{ {
p_intf->p_sys->p_fileopen = create_intf_fileopen(); gtk_widget_show( p_intf->p_sys->p_window );
gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_fileopen ),
"p_intf", p_intf );
} }
gtk_widget_show( p_intf->p_sys->p_fileopen ); return TRUE;
gdk_window_raise( p_intf->p_sys->p_fileopen->window );
}
void
on_toolbar_back_clicked (GtkButton *button,
gpointer user_data)
{
}
void
on_toolbar_stop_clicked (GtkButton *button,
gpointer user_data)
{
} }
gboolean
void GtkFullscreen (GtkWidget *widget,
on_toolbar_play_clicked (GtkButton *button, GdkEventButton *event,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_window" ); if( p_vout_bank->i_count )
if( p_intf->p_input != NULL )
{ {
input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY ); vlc_mutex_lock( &p_vout_bank->pp_vout[0]->change_lock );
if( p_vout_bank->pp_vout[0]->b_fullscreen ==
!GTK_CHECK_MENU_ITEM( widget )->active )
p_vout_bank->pp_vout[0]->i_changes |= VOUT_FULLSCREEN_CHANGE;
vlc_mutex_unlock( &p_vout_bank->pp_vout[0]->change_lock );
} }
}
void return TRUE;
on_toolbar_pause_clicked (GtkButton *button,
gpointer user_data)
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
if( p_intf->p_input != NULL )
{
input_SetStatus( p_intf->p_input, INPUT_STATUS_PAUSE );
}
} }
void void
on_toolbar_prev_clicked (GtkButton *button, GtkWindowDrag (GtkWidget *widget,
GdkDragContext *drag_context,
gint x,
gint y,
GtkSelectionData *data,
guint info,
guint time,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_window" ); intf_thread_t * p_intf = GetIntf( GTK_WIDGET(widget), "intf_window" );
int end = p_main->p_playlist->i_size;
GtkDropDataReceived( p_intf, data, info, PLAYLIST_END);
if( p_intf->p_input != NULL ) if( p_intf->p_input != NULL )
{ {
/* FIXME: temporary hack */ /* FIXME: temporary hack */
intf_PlaylistPrev( p_main->p_playlist ); p_intf->p_input->b_eof = 1;
intf_PlaylistPrev( p_main->p_playlist );
p_intf->p_input->b_eof = 1;
} }
intf_PlaylistJumpto( p_main->p_playlist, end-1 );
p_main->p_playlist->b_stopped = 0;
} }
void
on_toolbar_next_clicked (GtkButton *button,
gpointer user_data)
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
if( p_intf->p_input != NULL )
{
/* FIXME: temporary hack */
p_intf->p_input->b_eof = 1;
}
}
gboolean
void GtkSliderRelease (GtkWidget *widget,
on_popup_play_activate (GtkMenuItem *menuitem, GdkEventButton *event,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" ); intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), "intf_window" );
if( p_intf->p_input != NULL )
{
input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
}
}
void vlc_mutex_lock( &p_intf->change_lock );
on_popup_pause_activate (GtkMenuItem *menuitem, p_intf->p_sys->b_slider_free = 1;
gpointer user_data) vlc_mutex_unlock( &p_intf->change_lock );
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
if( p_intf->p_input != NULL ) return FALSE;
{
input_SetStatus( p_intf->p_input, INPUT_STATUS_PAUSE );
}
} }
void gboolean
on_popup_exit_activate (GtkMenuItem *menuitem, GtkSliderPress (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" ); intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), "intf_window" );
vlc_mutex_lock( &p_intf->change_lock ); vlc_mutex_lock( &p_intf->change_lock );
p_intf->b_die = 1; p_intf->p_sys->b_slider_free = 0;
vlc_mutex_unlock( &p_intf->change_lock ); vlc_mutex_unlock( &p_intf->change_lock );
}
void
on_fileopen_ok_clicked (GtkButton *button,
gpointer user_data)
{
GtkCList *playlist_clist;
gchar *filename;
GtkWidget *filesel = gtk_widget_get_toplevel ( GTK_WIDGET (button) );
/* retrieve the interface */
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(filesel), "intf_fileopen" );
/* hide the widget */
gtk_widget_hide (filesel);
filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (filesel));
/* catch the GTK CList */
playlist_clist = GTK_CLIST(
lookup_widget(p_intf->p_sys->p_playlist,"playlist_clist"));
intf_PlaylistAdd( p_main->p_playlist,
PLAYLIST_END,
(char*)filename );
/* update the display */
rebuildCList( playlist_clist ,
p_main->p_playlist );
}
return FALSE;
void
on_fileopen_cancel_clicked (GtkButton *button,
gpointer user_data)
{
gtk_widget_hide( gtk_widget_get_toplevel( GTK_WIDGET (button) ) );
} }
void void
on_intf_fileopen_destroy (GtkObject *object, GtkTitlePrev (GtkButton *button,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(object), "intf_fileopen" ); intf_thread_t * p_intf;
input_area_t * p_area;
int i_id;
p_intf->p_sys->p_fileopen = NULL; p_intf = GetIntf( GTK_WIDGET(button), (char*)user_data );
} i_id = p_intf->p_input->stream.p_selected_area->i_id - 1;
/* Disallow area 0 since it is used for video_ts.vob */
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 );
void input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
on_popup_open_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
/* If we have never used the file selector, open it */ p_intf->p_sys->b_title_update = 1;
if( p_intf->p_sys->p_fileopen == NULL)
{
p_intf->p_sys->p_fileopen = create_intf_fileopen();
gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_fileopen ),
"p_intf", p_intf );
} }
gtk_widget_show( p_intf->p_sys->p_fileopen );
gdk_window_raise( p_intf->p_sys->p_fileopen->window );
} }
void void
on_popup_about_activate (GtkMenuItem *menuitem, GtkTitleNext (GtkButton *button,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" ); intf_thread_t * p_intf;
input_area_t * p_area;
int i_id;
if( !GTK_IS_WIDGET( p_intf->p_sys->p_about ) ) p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
{ i_id = p_intf->p_input->stream.p_selected_area->i_id + 1;
p_intf->p_sys->p_about = create_intf_about();
gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_about ),
"p_intf", p_intf );
}
gtk_widget_show( p_intf->p_sys->p_about );
gdk_window_raise( p_intf->p_sys->p_about->window );
}
void
on_popup_slow_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
if( p_intf->p_input != NULL ) if( i_id < p_intf->p_input->stream.i_area_nb )
{ {
input_SetStatus( p_intf->p_input, INPUT_STATUS_SLOWER ); 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 );
}
void input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
on_popup_fast_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
if( p_intf->p_input != NULL ) p_intf->p_sys->b_title_update = 1;
{
input_SetStatus( p_intf->p_input, INPUT_STATUS_FASTER );
} }
}
void
on_toolbar_slow_clicked (GtkButton *button,
gpointer user_data)
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
if( p_intf->p_input != NULL )
{
input_SetStatus( p_intf->p_input, INPUT_STATUS_SLOWER );
}
} }
void void
on_toolbar_fast_clicked (GtkButton *button, GtkChapterPrev (GtkButton *button,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_window" ); intf_thread_t * p_intf;
input_area_t * p_area;
if( p_intf->p_input != NULL ) p_intf = GetIntf( GTK_WIDGET(button), (char*)user_data );
{ p_area = p_intf->p_input->stream.p_selected_area;
input_SetStatus( p_intf->p_input, INPUT_STATUS_FASTER );
}
}
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 );
void input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
on_intf_modules_destroy (GtkObject *object,
gpointer user_data)
{
p_intf->p_sys->b_chapter_update = 1;
}
} }
void void
on_modules_ok_clicked (GtkButton *button, GtkChapterNext (GtkButton *button,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_modules" ); intf_thread_t * p_intf;
input_area_t * p_area;
gtk_widget_hide( p_intf->p_sys->p_modules );
} p_intf = GetIntf( GTK_WIDGET(button), (char*)user_data );
p_area = p_intf->p_input->stream.p_selected_area;
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 );
void input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
on_modules_apply_clicked (GtkButton *button,
gpointer user_data)
{
p_intf->p_sys->b_chapter_update = 1;
}
} }
/****************************************************************************
* About box
****************************************************************************/
void gboolean
on_modules_cancel_clicked (GtkButton *button, GtkAboutShow (GtkWidget *widget,
gpointer user_data) GdkEventButton *event,
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_modules" );
gtk_widget_hide( p_intf->p_sys->p_modules );
}
void
on_menubar_modules_activate (GtkMenuItem *menuitem,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" ); intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
if( !GTK_IS_WIDGET( p_intf->p_sys->p_modules ) ) if( !GTK_IS_WIDGET( p_intf->p_sys->p_about ) )
{ {
// p_intf->p_sys->p_modules = create_intf_modules(); p_intf->p_sys->p_about = create_intf_about();
gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_modules ), gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_about ),
"p_intf", p_intf ); "p_intf", p_intf );
} }
gtk_widget_show( p_intf->p_sys->p_modules ); gtk_widget_show( p_intf->p_sys->p_about );
gdk_window_raise( p_intf->p_sys->p_modules->window ); gdk_window_raise( p_intf->p_sys->p_about->window );
}
void
on_intf_window_drag_data_received (GtkWidget *widget,
GdkDragContext *drag_context,
gint x,
gint y,
GtkSelectionData *data,
guint info,
guint time,
gpointer user_data)
{
intf_thread_t * p_intf = GetIntf( GTK_WIDGET(widget), "intf_window" );
int end = p_main->p_playlist->i_size;
on_generic_drop_data_received( p_intf, data, info, PLAYLIST_END);
if( p_intf->p_input != NULL )
{
/* FIXME: temporary hack */
p_intf->p_input->b_eof = 1;
}
intf_PlaylistJumpto( p_main->p_playlist, end-1 );
return TRUE;
} }
void GtkAboutOk( GtkButton * button, gpointer user_data)
void
on_about_ok_clicked (GtkButton *button,
gpointer user_data)
{ {
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_about" ); intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), (char*)user_data );
gtk_widget_hide( p_intf->p_sys->p_about ); gtk_widget_hide( p_intf->p_sys->p_about );
} }
void /****************************************************************************
on_menubar_disc_activate (GtkMenuItem *menuitem, * Jump box
gpointer user_data) ****************************************************************************/
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
if( !GTK_IS_WIDGET( p_intf->p_sys->p_disc ) ) gboolean
{ GtkJumpShow (GtkWidget *widget,
p_intf->p_sys->p_disc = create_intf_disc(); GdkEventButton *event,
gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_disc ),
"p_intf", p_intf );
}
gtk_widget_show( p_intf->p_sys->p_disc );
gdk_window_raise( p_intf->p_sys->p_disc->window );
}
void
on_toolbar_disc_clicked (GtkButton *button,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_window" ); intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
if( !GTK_IS_WIDGET( p_intf->p_sys->p_disc ) ) if( !GTK_IS_WIDGET( p_intf->p_sys->p_jump ) )
{ {
p_intf->p_sys->p_disc = create_intf_disc(); p_intf->p_sys->p_jump = create_intf_jump();
gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_disc ), gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_jump ),
"p_intf", p_intf ); "p_intf", p_intf );
} }
gtk_widget_show( p_intf->p_sys->p_disc );
gdk_window_raise( p_intf->p_sys->p_disc->window );
}
void
on_disc_ok_clicked (GtkButton *button,
gpointer user_data)
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_disc" );
char *psz_device, *psz_source, *psz_method;
psz_device = gtk_entry_get_text( GTK_ENTRY( lookup_widget( gtk_widget_show( p_intf->p_sys->p_jump );
GTK_WIDGET(button), "disc_name" ) ) ); gdk_window_raise( p_intf->p_sys->p_jump->window );
/* "dvd:foo" has size 5 + strlen(foo) */ return FALSE;
psz_source = malloc( 5 + strlen( psz_device ) );
if( psz_source == NULL )
{
return;
}
/* Check which method was activated */
if( GTK_TOGGLE_BUTTON( lookup_widget( GTK_WIDGET(button),
"disc_dvd" ) )->active )
{
psz_method = "dvd";
}
else if( GTK_TOGGLE_BUTTON( lookup_widget( GTK_WIDGET(button),
"disc_vcd" ) )->active )
{
psz_method = "vcd";
}
else
{
intf_ErrMsg( "intf error: unknown toggle button configuration" );
free( psz_source );
return;
}
/* Select title and chapter */
main_PutIntVariable( INPUT_TITLE_VAR, gtk_spin_button_get_value_as_int(
GTK_SPIN_BUTTON( lookup_widget(
GTK_WIDGET(button), "disc_title" ) ) ) );
main_PutIntVariable( INPUT_CHAPTER_VAR, gtk_spin_button_get_value_as_int(
GTK_SPIN_BUTTON( lookup_widget(
GTK_WIDGET(button), "disc_chapter" ) ) ) );
/* Build source name and add it to playlist */
sprintf( psz_source, "%s:%s", psz_method, psz_device );
intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END, psz_source );
free( psz_source );
gtk_widget_hide( p_intf->p_sys->p_disc );
} }
void void
on_disc_cancel_clicked (GtkButton *button, GtkJumpOk (GtkButton *button,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_disc" ); intf_thread_t * p_intf;
off_t i_seek;
gtk_widget_hide( p_intf->p_sys->p_disc ); off_t i_size;
} int i_hours;
int i_minutes;
int i_seconds;
p_intf = GetIntf( GTK_WIDGET( button ), (char*)user_data );
void #define GET_VALUE( name ) \
on_disc_dvd_toggled (GtkToggleButton *togglebutton, gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON( gtk_object_get_data( \
gpointer user_data) GTK_OBJECT( p_intf->p_sys->p_jump ), name ) ) )
{
if( togglebutton->active )
{
gtk_entry_set_text( GTK_ENTRY( lookup_widget(
GTK_WIDGET(togglebutton), "disc_name" ) ), "/dev/dvd" );
}
}
i_hours = GET_VALUE( "jump_hour_spinbutton" );
i_minutes = GET_VALUE( "jump_minute_spinbutton" );
i_seconds = GET_VALUE( "jump_second_spinbutton" );
void #undef GET_VALUE
on_disc_vcd_toggled (GtkToggleButton *togglebutton,
gpointer user_data)
{
if( togglebutton->active )
{
gtk_entry_set_text( GTK_ENTRY( lookup_widget(
GTK_WIDGET(togglebutton), "disc_name" ) ), "/dev/cdrom" );
}
}
i_seconds += 60 *i_minutes + 3600* i_hours;
void vlc_mutex_lock( &p_intf->p_input->stream.stream_lock );
on_popup_disc_activate (GtkMenuItem *menuitem, i_seek = i_seconds * 50 * p_intf->p_input->stream.i_mux_rate;
gpointer user_data) i_size = p_intf->p_input->stream.p_selected_area->i_size;
{ vlc_mutex_unlock( &p_intf->p_input->stream.stream_lock );
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
if( !GTK_IS_WIDGET( p_intf->p_sys->p_disc ) ) if( i_seek < i_size )
{ {
p_intf->p_sys->p_disc = create_intf_disc(); input_Seek( p_intf->p_input, i_seek );
gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_disc ),
"p_intf", p_intf );
} }
gtk_widget_show( p_intf->p_sys->p_disc ); p_main->p_playlist->b_stopped = 0;
gdk_window_raise( p_intf->p_sys->p_disc->window ); gtk_widget_hide( gtk_widget_get_toplevel( GTK_WIDGET (button) ) );
}
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 void
on_popup_subpictures_activate (GtkMenuItem *menuitem, GtkJumpCancel (GtkButton *button,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" ); gtk_widget_hide( gtk_widget_get_toplevel( GTK_WIDGET (button) ) );
es_descriptor_t * p_es;
p_es = (es_descriptor_t*)user_data;
input_ChangeES( p_intf->p_input, p_es, 2 );
} }
void void
on_menubar_audio_activate (GtkMenuItem *menuitem, GtkFileOpenActivate (GtkMenuItem *menuitem,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" ); GtkFileOpenShow( GTK_WIDGET( menuitem ), NULL, user_data );
es_descriptor_t * p_es;
p_es = (es_descriptor_t*)user_data;
input_ChangeES( p_intf->p_input, p_es, 1 );
} }
void void
on_menubar_subpictures_activate (GtkMenuItem *menuitem, GtkDiscOpenActivate (GtkMenuItem *menuitem,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" ); GtkDiscOpenShow( GTK_WIDGET( menuitem ), NULL, user_data );
es_descriptor_t * p_es;
p_es = (es_descriptor_t*)user_data;
input_ChangeES( p_intf->p_input, p_es, 2 );
} }
void void
on_popup_navigation_activate (GtkMenuItem *menuitem, GtkNetworkOpenActivate (GtkMenuItem *menuitem,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t * p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" ); GtkNetworkOpenShow( GTK_WIDGET( menuitem ), NULL, user_data );
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 void
on_menubar_title_activate (GtkMenuItem *menuitem, GtkExitActivate (GtkMenuItem *menuitem,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" ); GtkExit( GTK_WIDGET( menuitem ), NULL, user_data );
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, GtkWindowToggleActivate (GtkMenuItem *menuitem,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t * p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" ); GtkWindowToggle( GTK_WIDGET( menuitem ), NULL, user_data );
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 );
}
gboolean
on_intf_window_destroy (GtkWidget *widget,
GdkEvent *event,
gpointer user_data)
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), "intf_window" );
vlc_mutex_lock( &p_intf->change_lock );
p_intf->b_die = 1;
vlc_mutex_unlock( &p_intf->change_lock );
return TRUE;
} }
void void
on_main_window_toggle (GtkMenuItem *menuitem, GtkFullscreenActivate (GtkMenuItem *menuitem,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" ); GtkFullscreen( GTK_WIDGET( menuitem ), NULL, user_data );
if( GTK_WIDGET_VISIBLE(p_intf->p_sys->p_window) ) {
gtk_widget_hide( p_intf->p_sys->p_window);
}
else
{
gtk_widget_show( p_intf->p_sys->p_window );
}
}
gboolean
on_playlist_clist_drag_motion (GtkWidget *widget,
GdkDragContext *drag_context,
gint x,
gint y,
guint time,
gpointer user_data)
{
GtkCList * clist;
gint row,col;
int dummy;
GdkColor color;
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), "intf_playlist" );
clist = GTK_CLIST(lookup_widget( p_intf->p_sys->p_playlist,"playlist_clist"
));
if(!GTK_WIDGET_TOPLEVEL(widget))
{
gdk_window_raise( p_intf->p_sys->p_playlist->window );
}
color.red = 0xffff;
color.green = 0xffff;
color.blue = 0xffff;
gtk_clist_freeze( clist );
for(dummy=0; dummy<clist->rows; dummy++)
{
gtk_clist_set_background ( clist, dummy , &color);
}
color.red = 0xffff;
color.green = 0;
color.blue = 0;
gtk_clist_set_background ( clist, p_main->p_playlist->i_index , &color);
if( gtk_clist_get_selection_info( clist,x,y ,&row,&col )== 1)
{
color.red = 0;
color.green = 0x9000;
color.blue = 0xf000;
gtk_clist_set_background ( clist, row-1 , &color);
gtk_clist_set_background ( clist, row , &color);
}
gtk_clist_thaw( clist );
return TRUE;
} }
void void
on_intf_network_destroy (GtkObject *object, GtkPlaylistActivate (GtkMenuItem *menuitem,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(object), "intf_network" ); GtkPlaylistShow( GTK_WIDGET( menuitem ), NULL, user_data );
p_intf->p_sys->p_network = NULL;
} }
void void
on_network_ok_clicked (GtkButton *button, GtkModulesActivate (GtkMenuItem *menuitem,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_network" );
char *psz_source, *psz_server, *psz_protocol;
unsigned int i_port;
psz_server = gtk_entry_get_text( GTK_ENTRY( lookup_widget(
GTK_WIDGET(button), "network_server" ) ) );
/* Check which protocol was activated */
if( GTK_TOGGLE_BUTTON( lookup_widget( GTK_WIDGET(button),
"network_ts" ) )->active )
{
psz_protocol = "ts";
}
else if( GTK_TOGGLE_BUTTON( lookup_widget( GTK_WIDGET(button),
"network_rtp" ) )->active )
{
psz_protocol = "rtp";
}
else
{
intf_ErrMsg( "intf error: unknown protocol toggle button position" );
return;
}
/* Get the port number and make sure it will not overflow 5 characters */
i_port = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON(
lookup_widget( GTK_WIDGET(button), "network_port" ) ) );
if( i_port > 65535 )
{
intf_ErrMsg( "intf error: invalid port %i", i_port );
}
/* Allocate room for "protocol://server:port" */
psz_source = malloc( strlen( psz_protocol ) + strlen( psz_server ) + 10 );
if( psz_source == NULL )
{
return;
}
/* Build source name and add it to playlist */
sprintf( psz_source, "%s://%s:%i", psz_protocol, psz_server, i_port );
intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END, psz_source );
free( psz_source );
gtk_widget_hide( p_intf->p_sys->p_network );
} }
void void
on_network_cancel_clicked (GtkButton *button, GtkPreferencesActivate (GtkMenuItem *menuitem,
gpointer user_data) gpointer user_data)
{ {
gtk_widget_hide( gtk_widget_get_toplevel( GTK_WIDGET (button) ) ); GtkPreferencesShow( GTK_WIDGET( menuitem ), NULL, user_data );
} }
void void
on_menubar_network_activate (GtkMenuItem *menuitem, GtkAboutActivate (GtkMenuItem *menuitem,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" ); GtkAboutShow( GTK_WIDGET( menuitem ), NULL, user_data );
gtk_widget_show( p_intf->p_sys->p_network );
gdk_window_raise( p_intf->p_sys->p_network->window );
} }
void
on_popup_network_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
gtk_widget_show( p_intf->p_sys->p_network );
gdk_window_raise( p_intf->p_sys->p_network->window );
}
void void
on_toolbar_network_clicked (GtkButton *button, GtkJumpActivate (GtkMenuItem *menuitem,
gpointer user_data)
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
gtk_widget_show( p_intf->p_sys->p_network );
gdk_window_raise( p_intf->p_sys->p_network->window );
}
gboolean
on_slider_button_release_event (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), "intf_window" ); GtkJumpShow( GTK_WIDGET( menuitem ), NULL, user_data );
vlc_mutex_lock( &p_intf->change_lock );
p_intf->p_sys->b_slider_free = 1;
vlc_mutex_unlock( &p_intf->change_lock );
return FALSE;
} }
gboolean
on_slider_button_press_event (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data)
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), "intf_window" );
vlc_mutex_lock( &p_intf->change_lock );
p_intf->p_sys->b_slider_free = 0;
vlc_mutex_unlock( &p_intf->change_lock );
return FALSE;
}
void
on_menubar_fullscreen_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
}
void
on_menubar_angle_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
}
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "gtk_control.h"
#include "gtk_menu.h"
#include "gtk_open.h"
#include "gtk_modules.h"
#include "gtk_playlist.h"
#include "gtk_preferences.h"
/* General glade callbacks */ /* General glade callbacks */
void gboolean
on_intf_window_drag_data_received (GtkWidget *widget, GtkExit (GtkWidget *widget,
GdkDragContext *drag_context, GdkEventButton *event,
gint x,
gint y,
GtkSelectionData *data,
guint info,
guint time,
gpointer user_data); gpointer user_data);
gboolean
void GtkWindowToggle (GtkWidget *widget,
on_toolbar_open_clicked (GtkButton *button, GdkEventButton *event,
gpointer user_data); gpointer user_data);
void
on_toolbar_back_clicked (GtkButton *button,
gpointer user_data);
void gboolean
on_toolbar_stop_clicked (GtkButton *button, GtkSliderRelease (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data); gpointer user_data);
void gboolean
on_toolbar_play_clicked (GtkButton *button, GtkSliderPress (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data); gpointer user_data);
void void
on_toolbar_pause_clicked (GtkButton *button, GtkTitlePrev (GtkButton *button,
gpointer user_data); gpointer user_data);
void void
on_toolbar_slow_clicked (GtkButton *button, GtkTitleNext (GtkButton *button,
gpointer user_data); gpointer user_data);
void void
on_toolbar_fast_clicked (GtkButton *button, GtkChapterPrev (GtkButton *button,
gpointer user_data); gpointer user_data);
void void
on_toolbar_playlist_clicked (GtkButton *button, GtkChapterNext (GtkButton *button,
gpointer user_data); gpointer user_data);
void
on_toolbar_prev_clicked (GtkButton *button,
gpointer user_data);
void gboolean
on_toolbar_next_clicked (GtkButton *button, GtkFullscreen (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data); gpointer user_data);
gboolean
void GtkAboutShow (GtkWidget *widget,
on_toolbar_network_clicked (GtkButton *button, GdkEventButton *event,
gpointer user_data); gpointer user_data);
void GtkAboutOk( GtkButton * button, gpointer user_data);
void void
on_intf_fileopen_destroy (GtkObject *object, GtkWindowDrag (GtkWidget *widget,
GdkDragContext *drag_context,
gint x,
gint y,
GtkSelectionData *data,
guint info,
guint time,
gpointer user_data); gpointer user_data);
void gboolean
on_fileopen_ok_clicked (GtkButton *button, GtkWindowDelete (GtkWidget *widget,
GdkEvent *event,
gpointer user_data); gpointer user_data);
gboolean
GtkJumpShow (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data);
void void
on_fileopen_cancel_clicked (GtkButton *button, GtkJumpOk (GtkButton *button,
gpointer user_data); gpointer user_data);
void void
on_intf_modules_destroy (GtkObject *object, GtkJumpCancel (GtkButton *button,
gpointer user_data); gpointer user_data);
void
on_modules_ok_clicked (GtkButton *button, gboolean
GtkDiscOpenShow (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data); gpointer user_data);
void gboolean
on_modules_apply_clicked (GtkButton *button, GtkFileOpenShow (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data); gpointer user_data);
void gboolean
on_modules_cancel_clicked (GtkButton *button, GtkNetworkOpenShow (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data); gpointer user_data);
void void
on_intf_playlist_destroy (GtkObject *object, on_menubar_open_activate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void void
on_playlist_ok_clicked (GtkButton *button, on_menubar_open_activate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void void
on_popup_fast_activate (GtkMenuItem *menuitem, on_menubar_disc_activate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void void
on_menubar_open_activate (GtkMenuItem *menuitem, on_menubar_network_activate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void void
...@@ -105,11 +122,11 @@ on_menubar_exit_activate (GtkMenuItem *menuitem, ...@@ -105,11 +122,11 @@ on_menubar_exit_activate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void void
on_popup_play_activate (GtkMenuItem *menuitem, on_menubar_interface_hide_activate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void void
on_popup_exit_activate (GtkMenuItem *menuitem, on_menubar_fullscreen_activate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void void
...@@ -129,190 +146,156 @@ on_menubar_about_activate (GtkMenuItem *menuitem, ...@@ -129,190 +146,156 @@ on_menubar_about_activate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void void
on_popup_pause_activate (GtkMenuItem *menuitem, on_popup_play_activate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void void
on_popup_slow_activate (GtkMenuItem *menuitem, on_popup_pause_activate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void void
on_popup_open_activate (GtkMenuItem *menuitem, on_popup_stop_activate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void void
on_popup_about_activate (GtkMenuItem *menuitem, on_popup_back_activate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void void
on_about_ok_clicked (GtkButton *button, on_popup_slow_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_disc_dvd_toggled (GtkToggleButton *togglebutton,
gpointer user_data); gpointer user_data);
void void
on_disc_vcd_toggled (GtkToggleButton *togglebutton, on_popup_fast_activate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void void
on_disc_ok_clicked (GtkButton *button, on_popup_interface_toggle_activate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void void
on_disc_cancel_clicked (GtkButton *button, on_popup_fullscreen_activate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void void
on_menubar_disc_activate (GtkMenuItem *menuitem, on_popup_next_activate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void void
on_toolbar_disc_clicked (GtkButton *button, on_popup_prev_activate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void void
on_popup_disc_activate (GtkMenuItem *menuitem, on_popup_jump_activate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void void
on_popup_audio_activate (GtkMenuItem *menuitem, on_popup_file_activate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void void
on_popup_subpictures_activate (GtkMenuItem *menuitem, on_popup_disc_activate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void void
on_menubar_audio_activate (GtkMenuItem *menuitem, on_popup_network_activate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void void
on_menubar_subpictures_activate (GtkMenuItem *menuitem, on_popup_about_activate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void void
on_popup_navigation_activate (GtkMenuItem *menuitem, on_popup_playlist_activate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void void
on_menubar_title_activate (GtkMenuItem *menuitem, on_popup_preferences_activate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void void
on_menubar_chapter_activate (GtkMenuItem *menuitem, on_popup_exit_activate (GtkMenuItem *menuitem,
gpointer user_data);
gboolean
on_playlist_clist_event (GtkWidget *widget,
GdkEvent *event,
gpointer user_data); gpointer user_data);
gboolean
on_intf_window_delete (GtkWidget *widget,
GdkEvent *event,
gpointer user_data);
gboolean
on_intf_playlist_destroy_event (GtkWidget *widget,
GdkEvent *event,
gpointer user_data);
gboolean void
on_intf_playlist_destroy_event (GtkWidget *widget, GtkPreferencesOk (GtkButton *button,
GdkEvent *event,
gpointer user_data); gpointer user_data);
void void
on_intf_playlist_drag_data_received (GtkWidget *widget, GtkPreferencesApply (GtkButton *button,
GdkDragContext *drag_context,
gint x,
gint y,
GtkSelectionData *data,
guint info,
guint time,
gpointer user_data); gpointer user_data);
gboolean void
on_playlist_clist_event (GtkWidget *widget, GtkPreferencesCancel (GtkButton *button,
GdkEvent *event,
gpointer user_data); gpointer user_data);
gboolean void
on_intf_playlist_destroy_event (GtkWidget *widget, GtkFileOpenActivate (GtkMenuItem *menuitem,
GdkEvent *event,
gpointer user_data); gpointer user_data);
gboolean void
on_intf_window_destroy (GtkWidget *widget, GtkDiscOpenActivate (GtkMenuItem *menuitem,
GdkEvent *event,
gpointer user_data); gpointer user_data);
gboolean void
on_intf_window_destroy (GtkWidget *widget, GtkNetworkOpenActivate (GtkMenuItem *menuitem,
GdkEvent *event,
gpointer user_data); gpointer user_data);
void void
on_main_window_toggle (GtkMenuItem *menuitem, GtkExitActivate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void void
on_delete_clicked (GtkMenuItem *menuitem, GtkWindowToggleActivate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void void
on_crop_activate (GtkMenuItem *menuitem, GtkFullscreenActivate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void void
on_invertselection_clicked (GtkMenuItem *menuitem, GtkPlaylistActivate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
gboolean void
on_playlist_clist_drag_motion (GtkWidget *widget, GtkModulesActivate (GtkMenuItem *menuitem,
GdkDragContext *drag_context,
gint x,
gint y,
guint time,
gpointer user_data); gpointer user_data);
void void
on_intf_network_destroy (GtkObject *object, GtkPreferencesActivate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void void
on_network_ok_clicked (GtkButton *button, GtkAboutActivate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void void
on_network_cancel_clicked (GtkButton *button, GtkNextActivate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void void
on_menubar_network_activate (GtkMenuItem *menuitem, GtkPrevActivate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void void
on_popup_network_activate (GtkMenuItem *menuitem, GtkJumpActivate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
gboolean void
on_slider_button_release_event (GtkWidget *widget, GtkDiscOpenActivate (GtkMenuItem *menuitem,
GdkEventButton *event,
gpointer user_data); gpointer user_data);
gboolean void
on_slider_button_press_event (GtkWidget *widget, GtkFileOpenActivate (GtkMenuItem *menuitem,
GdkEventButton *event,
gpointer user_data); gpointer user_data);
void void
on_menubar_fullscreen_activate (GtkMenuItem *menuitem, GtkNetworkOpenActivate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void void
on_menubar_angle_activate (GtkMenuItem *menuitem, GtkPlaylistAddUrl (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
/*****************************************************************************
* gtk_control.c : functions to handle stream control buttons.
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: gtk_control.c,v 1.1 2001/05/15 01:01:44 stef Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stphane Borel <stef@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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#define MODULE_NAME gtk
#include "modules_inner.h"
/*****************************************************************************
* Preamble
*****************************************************************************/
#include "defs.h"
#include <sys/types.h> /* off_t */
#include <stdlib.h>
#include <gtk/gtk.h>
#include <string.h>
#include "config.h"
#include "common.h"
#include "threads.h"
#include "mtime.h"
#include "stream_control.h"
#include "input_ext-intf.h"
#include "interface.h"
#include "intf_playlist.h"
#include "intf_msg.h"
#include "gtk_callbacks.h"
#include "gtk_interface.h"
#include "gtk_support.h"
#include "gtk_playlist.h"
#include "intf_gtk.h"
#include "main.h"
/****************************************************************************
* Control functions: this is where the functions are defined
****************************************************************************
* These functions are button-items callbacks, and are used
* by other callbacks
****************************************************************************/
gboolean GtkControlBack( GtkWidget *widget,
GdkEventButton *event,
gpointer user_data )
{
return FALSE;
}
gboolean GtkControlStop( GtkWidget *widget,
GdkEventButton *event,
gpointer user_data )
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
if( p_intf->p_input != NULL )
{
/* end playing item */
p_intf->p_input->b_eof = 1;
/* update playlist */
// vlc_mutex_lock( &p_main->p_playlist->change_lock );
p_main->p_playlist->i_index--;
p_main->p_playlist->b_stopped = 1;
// vlc_mutex_unlock( &p_main->p_playlist->change_lock );
}
return TRUE;
}
gboolean GtkControlPlay( GtkWidget *widget,
GdkEventButton *event,
gpointer user_data )
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
if( p_intf->p_input != NULL )
{
input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
p_main->p_playlist->b_stopped = 0;
}
else
{
// vlc_mutex_lock( &p_main->p_playlist->change_lock );
if( p_main->p_playlist->b_stopped )
{
if( p_main->p_playlist->i_size )
{
intf_PlaylistJumpto( p_main->p_playlist,
p_main->p_playlist->i_index );
p_main->p_playlist->b_stopped = 0;
}
else
{
GtkFileOpenShow( widget, event, user_data );
}
}
// vlc_mutex_unlock( &p_main->p_playlist->change_lock );
}
return TRUE;
}
gboolean GtkControlPause( GtkWidget *widget,
GdkEventButton *event,
gpointer user_data )
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
if( p_intf->p_input != NULL )
{
input_SetStatus( p_intf->p_input, INPUT_STATUS_PAUSE );
p_main->p_playlist->b_stopped = 0;
}
return TRUE;
}
gboolean GtkControlSlow( GtkWidget *widget,
GdkEventButton *event,
gpointer user_data )
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
if( p_intf->p_input != NULL )
{
input_SetStatus( p_intf->p_input, INPUT_STATUS_SLOWER );
p_main->p_playlist->b_stopped = 0;
}
return TRUE;
}
gboolean GtkControlFast( GtkWidget *widget,
GdkEventButton *event,
gpointer user_data )
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
if( p_intf->p_input != NULL )
{
input_SetStatus( p_intf->p_input, INPUT_STATUS_FASTER );
p_main->p_playlist->b_stopped = 0;
}
return TRUE;
}
/****************************************************************************
* Control callbacks for menuitems
****************************************************************************
* We have different callaback for menuitem since we must use the
* activate signal toi popdown the menu automatically
****************************************************************************/
void GtkPlayActivate( GtkMenuItem * menuitem, gpointer user_data )
{
GtkControlPlay( GTK_WIDGET( menuitem ), NULL, user_data );
}
void GtkPauseActivate( GtkMenuItem * menuitem, gpointer user_data )
{
GtkControlPause( GTK_WIDGET( menuitem ), NULL, user_data );
}
void
GtKStopActivate (GtkMenuItem *menuitem,
gpointer user_data)
{
GtkControlStop( GTK_WIDGET( menuitem ), NULL, user_data );
}
void
GtkBackActivate (GtkMenuItem *menuitem,
gpointer user_data)
{
GtkControlBack( GTK_WIDGET( menuitem ), NULL, user_data );
}
void
GtkSlowActivate (GtkMenuItem *menuitem,
gpointer user_data)
{
GtkControlSlow( GTK_WIDGET( menuitem ), NULL, user_data );
}
void
GtkFastActivate (GtkMenuItem *menuitem,
gpointer user_data)
{
GtkControlFast( GTK_WIDGET( menuitem ), NULL, user_data );
}
/*****************************************************************************
* gtk_control.h: prototypes for control functions
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: gtk_control.h,v 1.1 2001/05/15 01:01:44 stef Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stphane Borel <stef@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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
gboolean GtkControlBack ( GtkWidget *, GdkEventButton *, gpointer );
gboolean GtkControlStop ( GtkWidget *, GdkEventButton *, gpointer );
gboolean GtkControlPlay ( GtkWidget *, GdkEventButton *, gpointer );
gboolean GtkControlPause( GtkWidget *, GdkEventButton *, gpointer );
gboolean GtkControlSlow ( GtkWidget *, GdkEventButton *, gpointer );
gboolean GtkControlFast ( GtkWidget *, GdkEventButton *, gpointer );
void GtkPlayActivate ( GtkMenuItem *, gpointer );
void GtkPauseActivate ( GtkMenuItem *, gpointer );
void GtKStopActivate ( GtkMenuItem *, gpointer );
void GtkBackActivate ( GtkMenuItem *, gpointer );
void GtkSlowActivate ( GtkMenuItem *, gpointer );
void GtkFastActivate ( GtkMenuItem *, gpointer );
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -7,5 +7,7 @@ GtkWidget* create_intf_popup (void); ...@@ -7,5 +7,7 @@ GtkWidget* create_intf_popup (void);
GtkWidget* create_intf_about (void); GtkWidget* create_intf_about (void);
GtkWidget* create_intf_fileopen (void); GtkWidget* create_intf_fileopen (void);
GtkWidget* create_intf_disc (void); GtkWidget* create_intf_disc (void);
GtkWidget* create_intf_playlist (void);
GtkWidget* create_intf_network (void); GtkWidget* create_intf_network (void);
GtkWidget* create_intf_jump (void);
GtkWidget* create_intf_playlist (void);
GtkWidget* create_intf_preferences (void);
/*****************************************************************************
* gtk_menu.c : functions to handle menu items.
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: gtk_menu.c,v 1.1 2001/05/15 01:01:44 stef Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stphane Borel <stef@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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#define MODULE_NAME gtk
#include "modules_inner.h"
/*****************************************************************************
* Preamble
*****************************************************************************/
#include "defs.h"
#include <sys/types.h> /* off_t */
#include <stdlib.h>
#include <gtk/gtk.h>
#include <string.h>
#include "config.h"
#include "common.h"
#include "threads.h"
#include "mtime.h"
#include "stream_control.h"
#include "input_ext-intf.h"
#include "interface.h"
#include "intf_playlist.h"
#include "intf_msg.h"
#include "video.h"
#include "video_output.h"
#include "audio_output.h"
#include "gtk_callbacks.h"
#include "gtk_interface.h"
#include "gtk_support.h"
#include "gtk_playlist.h"
#include "intf_gtk.h"
#include "main.h"
/****************************************************************************
* Gtk*Toggle: callbacks to toggle the value of a checkmenuitem
****************************************************************************
* We need separate functions for menubar and popup here since we can't use
* user_data to transmit intf_*
****************************************************************************/
#define GtkLangToggle( b_update ) \
es_descriptor_t * p_es; \
\
if( !b_update ) \
{ \
p_es = (es_descriptor_t*)user_data; \
\
input_ToggleES( p_intf->p_input, p_es, menuitem->active ); \
\
b_update = menuitem->active; \
} \
/*
* Audio
*/
void GtkMenubarAudioToggle( GtkCheckMenuItem * menuitem, gpointer user_data )
{
intf_thread_t * p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
GtkLangToggle( p_intf->p_sys->b_audio_update );
}
void GtkPopupAudioToggle( GtkCheckMenuItem * menuitem, gpointer user_data )
{
intf_thread_t * p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
GtkLangToggle( p_intf->p_sys->b_audio_update );
}
/*
* Subtitles
*/
void GtkMenubarSubtitleToggle( GtkCheckMenuItem * menuitem, gpointer user_data )
{
intf_thread_t * p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
GtkLangToggle( p_intf->p_sys->b_spu_update );
}
void GtkPopupSubtitleToggle( GtkCheckMenuItem * menuitem, gpointer user_data )
{
intf_thread_t * p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
GtkLangToggle( p_intf->p_sys->b_spu_update );
}
/*
* Navigation
*/
void GtkPopupNavigationToggle( GtkCheckMenuItem * menuitem,
gpointer user_data )
{
intf_thread_t * p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
if( menuitem->active &&
!p_intf->p_sys->b_title_update &&
!p_intf->p_sys->b_chapter_update )
{
input_area_t *p_area = p_intf->p_input->stream.p_selected_area;
gint i_title = DATA2TITLE( user_data );
gint i_chapter = DATA2CHAPTER( user_data );
if( p_area != p_intf->p_input->stream.pp_areas[i_title] )
{
p_area = p_intf->p_input->stream.pp_areas[i_title];
p_intf->p_sys->b_title_update = 1;
}
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 );
}
}
/*
* Title
*/
#define GtkTitleToggle( intf ) \
intf_thread_t * p_intf = GetIntf( GTK_WIDGET(menuitem), (intf) ); \
\
if( menuitem->active && !p_intf->p_sys->b_title_update ) \
{ \
gint i_title = (gint)user_data; \
p_intf->p_input->pf_set_area( p_intf->p_input, \
p_intf->p_input->stream.pp_areas[i_title] ); \
\
input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY ); \
\
p_intf->p_sys->b_title_update = 1; \
}
void GtkMenubarTitleToggle( GtkCheckMenuItem * menuitem, gpointer user_data )
{
GtkTitleToggle( "intf_window" );
}
void GtkPopupTitleToggle( GtkCheckMenuItem * menuitem, gpointer user_data )
{
GtkTitleToggle( "intf_popup" );
}
/*
* Chapter
*/
#define GtkChapterToggle( intf ) \
intf_thread_t * p_intf; \
input_area_t * p_area; \
gint i_chapter; \
char psz_chapter[5]; \
\
p_intf = GetIntf( GTK_WIDGET(menuitem), (intf) ); \
p_area = p_intf->p_input->stream.p_selected_area; \
i_chapter = (gint)user_data; \
\
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; \
}
void GtkMenubarChapterToggle( GtkCheckMenuItem * menuitem, gpointer user_data )
{
GtkChapterToggle( "intf_window" );
}
void GtkPopupChapterToggle( GtkCheckMenuItem * menuitem, gpointer user_data )
{
GtkChapterToggle( "intf_popup" );
}
/*
* Angle
*/
#define GtkAngleToggle( intf ) \
intf_thread_t * p_intf; \
input_area_t * p_area; \
gint i_angle; \
\
p_intf = GetIntf( GTK_WIDGET(menuitem), (intf) ); \
p_area = p_intf->p_input->stream.p_selected_area; \
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 GtkMenubarAngleToggle( GtkCheckMenuItem * menuitem, gpointer user_data )
{
GtkAngleToggle( "intf_window" )
}
void GtkPopupAngleToggle( GtkCheckMenuItem * menuitem, gpointer user_data )
{
GtkAngleToggle( "intf_popup" )
}
/****************************************************************************
* Functions to generate menus
****************************************************************************/
/*****************************************************************************
* GtkRadioMenu: update interactive menus of the interface
*****************************************************************************
* Sets up menus with information from input
* Warning: since this function is designed to be called by management
* function, the interface lock has to be taken
*****************************************************************************/
static gint GtkRadioMenu( intf_thread_t * p_intf,
GtkWidget * p_root, GSList * p_menu_group,
char * psz_item_name,
int i_nb, int i_selected,
void( *pf_toggle )( GtkCheckMenuItem *, gpointer ) )
{
char psz_name[ GTK_MENU_LABEL_SIZE ];
GtkWidget * p_menu;
GtkWidget * p_submenu;
GtkWidget * p_item_group;
GtkWidget * p_item;
GtkWidget * p_item_selected;
GSList * p_group;
gint i_item;
/* 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_item_group = NULL;
p_submenu = NULL;
p_item_selected = NULL;
p_group = p_menu_group;
p_menu = gtk_menu_new();
for( i_item = 0 ; i_item < i_nb ; i_item++ )
{
/* we group chapters in packets of ten for small screens */
if( ( i_item % 10 == 0 ) && ( i_nb > 20 ) )
{
if( i_item != 0 )
{
gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_item_group ),
p_submenu );
gtk_menu_append( GTK_MENU( p_menu ), p_item_group );
}
snprintf( psz_name, GTK_MENU_LABEL_SIZE,
"%ss %d to %d", psz_item_name, i_item + 1, i_item + 10);
psz_name[ GTK_MENU_LABEL_SIZE - 1 ] = '\0';
p_item_group = gtk_menu_item_new_with_label( psz_name );
gtk_widget_show( p_item_group );
p_submenu = gtk_menu_new();
}
snprintf( psz_name, GTK_MENU_LABEL_SIZE, "%s %d",
psz_item_name, i_item + 1 );
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( i_selected == i_item + 1 )
{
p_item_selected = p_item;
}
gtk_widget_show( p_item );
/* setup signal hanling */
gtk_signal_connect( GTK_OBJECT( p_item ),
"toggled",
GTK_SIGNAL_FUNC( pf_toggle ),
(gpointer)(i_item + 1) );
if( i_nb > 20 )
{
gtk_menu_append( GTK_MENU( p_submenu ), p_item );
}
else
{
gtk_menu_append( GTK_MENU( p_menu ), p_item );
}
}
if( i_nb > 20 )
{
gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_item_group ), p_submenu );
gtk_menu_append( GTK_MENU( p_menu ), p_item_group );
}
/* link the new menu to the title menu item */
gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_root ), p_menu );
/* toggle currently selected chapter */
if( p_item_selected != NULL )
{
gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( p_item_selected ),
TRUE );
}
/* be sure that menu is sensitive, if there are several items */
if( i_nb > 1 )
{
gtk_widget_set_sensitive( p_root, TRUE );
}
return TRUE;
}
/*****************************************************************************
* 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_toggle )( GtkCheckMenuItem *, gpointer ) )
{
intf_thread_t * p_intf;
GtkWidget * p_menu;
GtkWidget * p_separator;
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();
/* special case for "off" item */
snprintf( psz_name, GTK_MENU_LABEL_SIZE, "None" );
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 ) );
gtk_widget_show( p_item );
/* signal hanling for off */
gtk_signal_connect( GTK_OBJECT( p_item ), "toggled",
GTK_SIGNAL_FUNC ( pf_toggle ), NULL );
gtk_menu_append( GTK_MENU( p_menu ), p_item );
p_separator = gtk_menu_item_new();
gtk_widget_set_sensitive( p_separator, FALSE );
gtk_widget_show( p_separator );
gtk_menu_append( GTK_MENU( p_menu ), p_separator );
vlc_mutex_lock( &p_intf->p_input->stream.stream_lock );
p_item_active = NULL;
i_item = 0;
/* 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++ )
{
if( p_intf->p_input->stream.pp_es[i]->i_cat == i_cat )
{
i_item++;
strcpy( psz_name, p_intf->p_input->stream.pp_es[i]->psz_desc );
if( psz_name[0] == '\0' )
{
snprintf( psz_name, GTK_MENU_LABEL_SIZE,
"Language %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_es == p_intf->p_input->stream.pp_es[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_intf->p_input->stream.pp_es[i] ) );
gtk_menu_append( GTK_MENU( p_menu ), p_item );
}
}
vlc_mutex_unlock( &p_intf->p_input->stream.stream_lock );
/* link the new menu to the menubar item */
gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_root ), p_menu );
/* acitvation will call signals so we can only do it
* when submenu is attached to menu - to get intf_window */
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 non empty */
if( i_item > 0 )
{
gtk_widget_set_sensitive( p_root, TRUE );
}
return TRUE;
}
#if 1
/*****************************************************************************
* GtkTitleMenu: sets menus for titles and chapters selection
*****************************************************************************
* Generates two types of menus:
* -simple list of titles
* -cascaded lists of chapters for each title
*****************************************************************************/
static gint GtkTitleMenu( gpointer p_data,
GtkWidget * p_navigation,
void(*pf_toggle )( GtkCheckMenuItem *, gpointer ) )
{
intf_thread_t * p_intf;
char psz_name[ GTK_MENU_LABEL_SIZE ];
GtkWidget * p_title_menu;
GtkWidget * p_title_submenu;
GtkWidget * p_title_item;
GtkWidget * p_item_active;
GtkWidget * p_chapter_menu;
GtkWidget * p_chapter_submenu;
GtkWidget * p_title_menu_item;
GtkWidget * p_chapter_menu_item;
GtkWidget * p_item;
GSList * p_title_group;
GSList * p_chapter_group;
gint i_title;
gint i_chapter;
gint i_title_nb;
gint i_chapter_nb;
/* 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_navigation)->submenu != NULL )
{
gtk_menu_popdown( GTK_MENU( GTK_MENU_ITEM(p_navigation)->submenu ) );
}
/* removes previous menu */
gtk_menu_item_remove_submenu( GTK_MENU_ITEM( p_navigation ) );
gtk_widget_set_sensitive( p_navigation, FALSE );
p_title_menu = gtk_menu_new();
p_title_group = NULL;
p_title_submenu = NULL;
p_title_menu_item = NULL;
p_chapter_group = NULL;
p_chapter_submenu = NULL;
p_chapter_menu_item = NULL;
p_item_active = NULL;
i_title_nb = p_intf->p_input->stream.i_area_nb;
/* loop on titles */
for( i_title = 1 ; i_title < i_title_nb ; i_title++ )
{
/* we group titles in packets of ten for small screens */
if( ( i_title % 10 == 1 ) && ( i_title_nb > 20 ) )
{
if( i_title != 1 )
{
gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_title_menu_item ),
p_title_submenu );
gtk_menu_append( GTK_MENU( p_title_menu ), p_title_menu_item );
}
snprintf( psz_name, GTK_MENU_LABEL_SIZE,
"%d - %d", i_title, i_title + 9 );
psz_name[ GTK_MENU_LABEL_SIZE - 1 ] = '\0';
p_title_menu_item = gtk_menu_item_new_with_label( psz_name );
gtk_widget_show( p_title_menu_item );
p_title_submenu = gtk_menu_new();
}
snprintf( psz_name, GTK_MENU_LABEL_SIZE, "Title %d (%d)", i_title,
p_intf->p_input->stream.pp_areas[i_title]->i_part_nb );
psz_name[ GTK_MENU_LABEL_SIZE - 1 ] = '\0';
#if 0
if( pf_toggle == on_menubar_title_toggle )
{
p_title_item = gtk_radio_menu_item_new_with_label( p_title_group,
psz_name );
p_title_group =
gtk_radio_menu_item_group( GTK_RADIO_MENU_ITEM( p_title_item ) );
if( p_intf->p_input->stream.pp_areas[i_title] ==
p_intf->p_input->stream.p_selected_area )
{
p_item_active = p_title_item;
}
/* setup signal hanling */
gtk_signal_connect( GTK_OBJECT( p_title_item ),
"toggled",
GTK_SIGNAL_FUNC( pf_toggle ),
(gpointer)(p_intf->p_input->stream.pp_areas[i_title]) );
if( p_intf->p_input->stream.i_area_nb > 1 )
{
/* be sure that menu is sensitive */
gtk_widget_set_sensitive( p_navigation, TRUE );
}
}
else
#endif
{
p_title_item = gtk_menu_item_new_with_label( psz_name );
#if 1
p_chapter_menu = gtk_menu_new();
i_chapter_nb =
p_intf->p_input->stream.pp_areas[i_title]->i_part_nb;
for( i_chapter = 0 ; i_chapter < i_chapter_nb ; i_chapter++ )
{
/* we group chapters in packets of ten for small screens */
if( ( i_chapter % 10 == 0 ) && ( i_chapter_nb > 20 ) )
{
if( i_chapter != 0 )
{
gtk_menu_item_set_submenu(
GTK_MENU_ITEM( p_chapter_menu_item ),
p_chapter_submenu );
gtk_menu_append( GTK_MENU( p_chapter_menu ),
p_chapter_menu_item );
}
snprintf( psz_name, GTK_MENU_LABEL_SIZE,
"%d - %d", i_chapter + 1, i_chapter + 10 );
psz_name[ GTK_MENU_LABEL_SIZE - 1 ] = '\0';
p_chapter_menu_item =
gtk_menu_item_new_with_label( psz_name );
gtk_widget_show( p_chapter_menu_item );
p_chapter_submenu = gtk_menu_new();
}
snprintf( psz_name, GTK_MENU_LABEL_SIZE,
"Chapter %d", i_chapter + 1 );
psz_name[ GTK_MENU_LABEL_SIZE - 1 ] = '\0';
p_item = gtk_radio_menu_item_new_with_label(
p_chapter_group, psz_name );
p_chapter_group = gtk_radio_menu_item_group(
GTK_RADIO_MENU_ITEM( p_item ) );
gtk_widget_show( p_item );
#define p_area p_intf->p_input->stream.pp_areas[i_title]
if( ( p_area == p_intf->p_input->stream.p_selected_area ) &&
( p_area->i_part == i_chapter + 1 ) )
{
p_item_active = p_item;
}
#undef p_area
/* setup signal hanling */
gtk_signal_connect( GTK_OBJECT( p_item ),
"toggled",
GTK_SIGNAL_FUNC( pf_toggle ),
(gpointer)POS2DATA( i_title, i_chapter + 1) );
if( i_chapter_nb > 20 )
{
gtk_menu_append( GTK_MENU( p_chapter_submenu ), p_item );
}
else
{
gtk_menu_append( GTK_MENU( p_chapter_menu ), p_item );
}
}
if( i_chapter_nb > 20 )
{
gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_chapter_menu_item ),
p_chapter_submenu );
gtk_menu_append( GTK_MENU( p_chapter_menu ),
p_chapter_menu_item );
}
/* link the new menu to the title menu item */
gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_title_item ),
p_chapter_menu );
if( p_intf->p_input->stream.pp_areas[i_title]->i_part_nb > 1 )
{
/* be sure that menu is sensitive */
gtk_widget_set_sensitive( p_navigation, TRUE );
}
#else
GtkRadioMenu( p_intf, p_title_item, p_chapter_group, "Chapter",
p_intf->p_input->stream.pp_areas[i_title]->i_part_nb,
i_title * 100,
p_intf->p_input->stream.p_selected_area->i_part +
p_intf->p_input->stream.p_selected_area->i_id *100,
pf_toggle );
#endif
}
gtk_widget_show( p_title_item );
if( i_title_nb > 20 )
{
gtk_menu_append( GTK_MENU( p_title_submenu ), p_title_item );
}
else
{
gtk_menu_append( GTK_MENU( p_title_menu ), p_title_item );
}
}
if( i_title_nb > 20 )
{
gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_title_menu_item ),
p_title_submenu );
gtk_menu_append( GTK_MENU( p_title_menu ), p_title_menu_item );
}
/* be sure that menu is sensitive */
gtk_widget_set_sensitive( p_title_menu, TRUE );
/* link the new menu to the menubar item */
gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_navigation ), p_title_menu );
if( p_item_active != NULL )
{
gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( p_item_active ),
TRUE );
}
#if 0
if( p_intf->p_input->stream.i_area_nb > 1 )
{
/* be sure that menu is sensitive */
gtk_widget_set_sensitive( p_navigation, TRUE );
}
#endif
return TRUE;
}
#endif
/*****************************************************************************
* GtkSetupMenu: function that generates title/chapter/audio/subpic
* menus with help from preceding functions
*****************************************************************************/
gint GtkSetupMenu( 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_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;
p_intf->p_sys->b_spu_update |= p_intf->p_sys->b_title_update;
if( p_intf->p_sys->b_title_update )
{
char psz_title[5];
p_menubar_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_window ), "menubar_title" ) );
GtkRadioMenu( p_intf, p_menubar_menu, NULL, "Title",
p_intf->p_input->stream.i_area_nb - 1,
p_intf->p_input->stream.p_selected_area->i_id,
GtkMenubarTitleToggle );
snprintf( psz_title, 4, "%d",
p_intf->p_input->stream.p_selected_area->i_id );
psz_title[ 4 ] = '\0';
gtk_label_set_text( p_intf->p_sys->p_label_title, psz_title );
p_intf->p_sys->b_title_update = 0;
}
if( p_intf->p_sys->b_chapter_update )
{
char psz_chapter[5];
p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_popup ), "popup_navigation" ) );
GtkTitleMenu( p_intf, p_popup_menu, GtkPopupNavigationToggle );
#if 0
GtkRadioMenu( p_intf, p_menubar_menu, NULL, "Title",
p_intf->p_input->stream.i_area_nb - 1,
p_intf->p_input->stream.p_selected_area->i_id,
on_menubar_chapter_toggle );
#endif
p_menubar_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_window ), "menubar_chapter" ) );
GtkRadioMenu( p_intf, p_menubar_menu, NULL, "Chapter",
p_intf->p_input->stream.p_selected_area->i_part_nb,
p_intf->p_input->stream.p_selected_area->i_part,
GtkMenubarChapterToggle );
snprintf( psz_chapter, 4, "%d",
p_intf->p_input->stream.p_selected_area->i_part );
psz_chapter[ 4 ] = '\0';
gtk_label_set_text( p_intf->p_sys->p_label_chapter, psz_chapter );
p_intf->p_sys->i_part =
p_intf->p_input->stream.p_selected_area->i_part;
p_intf->p_sys->b_chapter_update = 0;
}
if( p_intf->p_sys->b_angle_update )
{
p_menubar_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_window ), "menubar_angle" ) );
GtkRadioMenu( p_intf, p_menubar_menu, NULL, "Angle",
p_intf->p_input->stream.p_selected_area->i_angle_nb,
p_intf->p_input->stream.p_selected_area->i_angle,
GtkMenubarAngleToggle );
p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_popup ), "popup_angle" ) );
GtkRadioMenu( p_intf, p_popup_menu, NULL, "Angle",
p_intf->p_input->stream.p_selected_area->i_angle_nb,
p_intf->p_input->stream.p_selected_area->i_angle,
GtkPopupAngleToggle );
p_intf->p_sys->b_angle_update = 0;
}
/* 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_selected_es[i]->i_cat == AUDIO_ES )
{
p_audio_es = p_intf->p_input->stream.pp_selected_es[i];
}
if( p_intf->p_input->stream.pp_selected_es[i]->i_cat == SPU_ES )
{
p_spu_es = p_intf->p_input->stream.pp_selected_es[i];
}
}
/* audio menus */
if( p_intf->p_sys->b_audio_update )
{
/* 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" ) );
GtkLanguageMenus( p_intf, p_menubar_menu, p_audio_es, AUDIO_ES,
GtkMenubarAudioToggle );
GtkLanguageMenus( p_intf, p_popup_menu, p_audio_es, AUDIO_ES,
GtkPopupAudioToggle );
p_intf->p_sys->b_audio_update = 0;
}
/* sub picture menus */
if( p_intf->p_sys->b_spu_update )
{
/* find spu root menu */
p_menubar_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_window ), "menubar_subpictures" ) );
p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_popup ), "popup_subpictures" ) );
GtkLanguageMenus( p_intf, p_menubar_menu, p_spu_es, SPU_ES,
GtkMenubarSubtitleToggle );
GtkLanguageMenus( p_intf, p_popup_menu, p_spu_es, SPU_ES,
GtkPopupSubtitleToggle );
p_intf->p_sys->b_spu_update = 0;
}
/* handle fullscreen check items */
if( p_vout_bank->i_count )
{
p_menubar_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_window ), "menubar_fullscreen" ) );
p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_popup ), "popup_fullscreen" ) );
gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( p_menubar_menu ),
p_vout_bank->pp_vout[0]->b_fullscreen );
gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( p_popup_menu ),
p_vout_bank->pp_vout[0]->b_fullscreen );
}
return TRUE;
}
/*****************************************************************************
* gtk_menu.h: prototypes for menu functions
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: gtk_menu.h,v 1.1 2001/05/15 01:01:44 stef Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stphane Borel <stef@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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#if 0
void GtkMenubarAudioToggle ( GtkCheckMenuItem *, gpointer );
void GtkPopupAudioToggle ( GtkCheckMenuItem *, gpointer );
void GtkMenubarSubtitleToggle ( GtkCheckMenuItem *, gpointer );
void GtkPopupSubtitleToggle ( GtkCheckMenuItem *, gpointer );
void GtkMenubarTitleToggle ( GtkCheckMenuItem *, gpointer );
void GtkPopupTitleToggle ( GtkCheckMenuItem *, gpointer );
void GtkMenubarChapterToggle ( GtkCheckMenuItem *, gpointer );
void GtkPopupChapterToggle ( GtkCheckMenuItem *, gpointer );
void GtkMenubarAngleToggle ( GtkCheckMenuItem *, gpointer );
void GtkPopupAngleToggle ( GtkCheckMenuItem *, gpointer );
#endif
/*****************************************************************************
* gtk_modules.c : functions to build modules configuration boxes.
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: gtk_modules.c,v 1.1 2001/05/15 01:01:44 stef Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stphane Borel <stef@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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#define MODULE_NAME gtk
#include "modules_inner.h"
/*****************************************************************************
* Preamble
*****************************************************************************/
#include "defs.h"
#include <sys/types.h> /* off_t */
#include <stdlib.h>
#include <gtk/gtk.h>
#include <string.h>
#include "config.h"
#include "common.h"
#include "threads.h"
#include "mtime.h"
#include "stream_control.h"
#include "input_ext-intf.h"
#include "interface.h"
#include "intf_playlist.h"
#include "intf_msg.h"
#include "gtk_callbacks.h"
#include "gtk_interface.h"
#include "gtk_support.h"
#include "gtk_playlist.h"
#include "intf_gtk.h"
#include "main.h"
gboolean GtkModulesShow( GtkWidget *widget,
GdkEventButton *event,
gpointer user_data )
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), "intf_window" );
if( !GTK_IS_WIDGET( p_intf->p_sys->p_modules ) )
{
// p_intf->p_sys->p_modules = create_intf_modules();
gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_modules ),
"p_intf", p_intf );
}
gtk_widget_show( p_intf->p_sys->p_modules );
gdk_window_raise( p_intf->p_sys->p_modules->window );
return FALSE;
}
void GtkModulesCancel( GtkButton * button, gpointer user_data )
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_modules" );
gtk_widget_hide( p_intf->p_sys->p_modules );
}
/*****************************************************************************
* gtk_modules.h: prototypes for modules functions
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: gtk_modules.h,v 1.1 2001/05/15 01:01:44 stef Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stéphane Borel <stef@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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
gboolean GtkModulesShow( GtkWidget *widget,
GdkEventButton *event,
gpointer user_data);
void GtkModulesCancel ( GtkButton * button, gpointer user_data );
/*****************************************************************************
* gtk_open.c : functions to handle file/disc/network open widgets.
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: gtk_open.c,v 1.1 2001/05/15 01:01:44 stef Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stphane Borel <stef@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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#define MODULE_NAME gtk
#include "modules_inner.h"
/*****************************************************************************
* Preamble
*****************************************************************************/
#include "defs.h"
#include <sys/types.h> /* off_t */
#include <stdlib.h>
#include <gtk/gtk.h>
#include <string.h>
#include "config.h"
#include "common.h"
#include "threads.h"
#include "mtime.h"
#include "stream_control.h"
#include "input_ext-intf.h"
#include "interface.h"
#include "intf_playlist.h"
#include "intf_msg.h"
#include "gtk_callbacks.h"
#include "gtk_interface.h"
#include "gtk_support.h"
#include "gtk_playlist.h"
#include "intf_gtk.h"
#include "main.h"
/*****************************************************************************
* Fileopen callbacks
*****************************************************************************
* The following callbacks are related to the file requester.
*****************************************************************************/
#if 0
void GtkFileOpenShow( GtkMenuItem * menuitem, gpointer user_data)
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), (char*)user_data );
/* If we have never used the file selector, open it */
if( !GTK_IS_WIDGET( p_intf->p_sys->p_fileopen ) )
{
p_intf->p_sys->p_fileopen = create_intf_fileopen();
gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_fileopen ),
"p_intf", p_intf );
gtk_file_selection_set_filename( GTK_FILE_SELECTION(
p_intf->p_sys->p_fileopen ),
main_GetPszVariable( INTF_PATH_VAR, INTF_PATH_DEFAULT ) );
}
gtk_widget_show( p_intf->p_sys->p_fileopen );
gdk_window_raise( p_intf->p_sys->p_fileopen->window );
}
#else
gboolean
GtkFileOpenShow (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data)
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
/* If we have never used the file selector, open it */
if( !GTK_IS_WIDGET( p_intf->p_sys->p_fileopen ) )
{
p_intf->p_sys->p_fileopen = create_intf_fileopen();
gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_fileopen ),
"p_intf", p_intf );
gtk_file_selection_set_filename( GTK_FILE_SELECTION(
p_intf->p_sys->p_fileopen ),
main_GetPszVariable( INTF_PATH_VAR, INTF_PATH_DEFAULT ) );
}
gtk_widget_show( p_intf->p_sys->p_fileopen );
gdk_window_raise( p_intf->p_sys->p_fileopen->window );
return FALSE;
}
#endif
void GtkFileOpenCancel( GtkButton * button, gpointer user_data)
{
gtk_widget_hide( gtk_widget_get_toplevel( GTK_WIDGET (button) ) );
}
void GtkFileOpenOk( GtkButton * button, gpointer user_data )
{
intf_thread_t * p_intf = GetIntf( GTK_WIDGET(button), "intf_fileopen" );
GtkCList * p_playlist_clist;
GtkWidget * p_filesel;
gchar * psz_filename;
int i_end = p_main->p_playlist->i_size;
/* hide the file selector */
p_filesel = gtk_widget_get_toplevel( GTK_WIDGET(button) );
gtk_widget_hide( p_filesel );
/* add the new file to the interface playlist */
psz_filename =
gtk_file_selection_get_filename( GTK_FILE_SELECTION( p_filesel ) );
intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END, (char*)psz_filename );
/* catch the GTK CList */
p_playlist_clist = GTK_CLIST( gtk_object_get_data(
GTK_OBJECT( p_intf->p_sys->p_playlist ), "playlist_clist" ) );
/* update the plugin display */
GtkRebuildCList( p_playlist_clist, p_main->p_playlist );
/* end current item, select added item */
if( p_intf->p_input != NULL )
{
p_intf->p_input->b_eof = 1;
}
intf_PlaylistJumpto( p_main->p_playlist, i_end - 1 );
p_main->p_playlist->b_stopped = 0;
}
/*****************************************************************************
* Open disc callbacks
*****************************************************************************
* The following callbacks are related to the disc manager.
*****************************************************************************/
#if 0
void GtkDiscOpenShow( GtkMenuItem * menuitem, gpointer user_data)
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), (char*)user_data );
if( !GTK_IS_WIDGET( p_intf->p_sys->p_disc ) )
{
p_intf->p_sys->p_disc = create_intf_disc();
gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_disc ),
"p_intf", p_intf );
}
gtk_widget_show( p_intf->p_sys->p_disc );
gdk_window_raise( p_intf->p_sys->p_disc->window );
}
#else
gboolean
GtkDiscOpenShow (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data)
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
if( !GTK_IS_WIDGET( p_intf->p_sys->p_disc ) )
{
p_intf->p_sys->p_disc = create_intf_disc();
gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_disc ),
"p_intf", p_intf );
}
gtk_widget_show( p_intf->p_sys->p_disc );
gdk_window_raise( p_intf->p_sys->p_disc->window );
return FALSE;
}
#endif
void GtkDiscOpenDvd( GtkToggleButton * togglebutton, gpointer user_data )
{
if( togglebutton->active )
{
gtk_entry_set_text(
GTK_ENTRY( lookup_widget( GTK_WIDGET(togglebutton), "disc_name" ) ),
main_GetPszVariable( INPUT_DVD_DEVICE_VAR, INPUT_DVD_DEVICE_DEFAULT )
);
}
}
void GtkDiscOpenVcd( GtkToggleButton *togglebutton, gpointer user_data )
{
if( togglebutton->active )
{
gtk_entry_set_text(
GTK_ENTRY( lookup_widget( GTK_WIDGET(togglebutton), "disc_name" ) ),
main_GetPszVariable( INPUT_VCD_DEVICE_VAR, INPUT_VCD_DEVICE_DEFAULT )
);
}
}
void GtkDiscOpenOk( GtkButton * button, gpointer user_data )
{
intf_thread_t * p_intf = GetIntf( GTK_WIDGET(button), "intf_disc" );
GtkCList * p_playlist_clist;
char * psz_device, *psz_source, *psz_method;
int i_end = p_main->p_playlist->i_size;
gtk_widget_hide( p_intf->p_sys->p_disc );
psz_device = gtk_entry_get_text( GTK_ENTRY( lookup_widget(
GTK_WIDGET(button), "disc_name" ) ) );
/* "dvd:foo" has size 5 + strlen(foo) */
psz_source = malloc( 3 /* "dvd" */ + 1 /* ":" */
+ strlen( psz_device ) + 1 /* "\0" */ );
if( psz_source == NULL )
{
return;
}
/* Check which method was activated */
if( GTK_TOGGLE_BUTTON( lookup_widget( GTK_WIDGET(button),
"disc_dvd" ) )->active )
{
psz_method = "dvd";
}
else if( GTK_TOGGLE_BUTTON( lookup_widget( GTK_WIDGET(button),
"disc_vcd" ) )->active )
{
psz_method = "vcd";
}
else
{
intf_ErrMsg( "intf error: unknown disc type toggle button position" );
free( psz_source );
return;
}
/* Select title and chapter */
main_PutIntVariable( INPUT_TITLE_VAR, gtk_spin_button_get_value_as_int(
GTK_SPIN_BUTTON( lookup_widget(
GTK_WIDGET(button), "disc_title" ) ) ) );
main_PutIntVariable( INPUT_CHAPTER_VAR, gtk_spin_button_get_value_as_int(
GTK_SPIN_BUTTON( lookup_widget(
GTK_WIDGET(button), "disc_chapter" ) ) ) );
/* Build source name and add it to playlist */
sprintf( psz_source, "%s:%s", psz_method, psz_device );
intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END, psz_source );
free( psz_source );
/* catch the GTK CList */
p_playlist_clist = GTK_CLIST( gtk_object_get_data(
GTK_OBJECT( p_intf->p_sys->p_playlist ), "playlist_clist" ) );
/* update the display */
GtkRebuildCList( p_playlist_clist, p_main->p_playlist );
/* stop current item, select added item */
if( p_intf->p_input != NULL )
{
p_intf->p_input->b_eof = 1;
}
// vlc_mutex_lock( &p_main->p_playlist->change_lock );
intf_PlaylistJumpto( p_main->p_playlist, i_end - 1 );
p_main->p_playlist->b_stopped = 0;
// vlc_mutex_unlock( &p_main->p_playlist->change_lock );
}
void GtkDiscOpenCancel( GtkButton * button, gpointer user_data)
{
gtk_widget_hide( gtk_widget_get_toplevel( GTK_WIDGET (button) ) );
}
/*****************************************************************************
* Network stream callbacks
*****************************************************************************
* The following callbacks are related to the network stream manager.
*****************************************************************************/
#if 0
void GtkNetworkOpenShow( GtkMenuItem * menuitem, gpointer user_data)
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), (char*)user_data );
if( !GTK_IS_WIDGET( p_intf->p_sys->p_network ) )
{
p_intf->p_sys->p_disc = create_intf_network();
gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_network ),
"p_intf", p_intf );
}
gtk_widget_show( p_intf->p_sys->p_network );
gdk_window_raise( p_intf->p_sys->p_network->window );
}
#else
gboolean
GtkNetworkOpenShow (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data)
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
if( !GTK_IS_WIDGET( p_intf->p_sys->p_network ) )
{
p_intf->p_sys->p_network = create_intf_network();
gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_network ),
"p_intf", p_intf );
}
gtk_widget_show( p_intf->p_sys->p_network );
gdk_window_raise( p_intf->p_sys->p_network->window );
return FALSE;
}
#endif
void GtkNetworkOpenOk( GtkButton *button, gpointer user_data )
{
intf_thread_t * p_intf = GetIntf( GTK_WIDGET(button), "intf_network" );
GtkCList * p_playlist_clist;
char * psz_source, *psz_server, *psz_protocol;
unsigned int i_port;
boolean_t b_broadcast;
int i_end = p_main->p_playlist->i_size;
gtk_widget_hide( p_intf->p_sys->p_network );
psz_server = gtk_entry_get_text( GTK_ENTRY( lookup_widget(
GTK_WIDGET(button), "network_server" ) ) );
/* Check which protocol was activated */
if( GTK_TOGGLE_BUTTON( lookup_widget( GTK_WIDGET(button),
"network_ts" ) )->active )
{
psz_protocol = "ts";
}
else if( GTK_TOGGLE_BUTTON( lookup_widget( GTK_WIDGET(button),
"network_rtp" ) )->active )
{
psz_protocol = "rtp";
}
else
{
intf_ErrMsg( "intf error: unknown protocol toggle button position" );
return;
}
/* Get the port number and make sure it will not overflow 5 characters */
i_port = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON(
lookup_widget( GTK_WIDGET(button), "network_port" ) ) );
if( i_port > 65535 )
{
intf_ErrMsg( "intf error: invalid port %i", i_port );
}
/* do we have a broadcast address */
b_broadcast = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(
lookup_widget( GTK_WIDGET(button), "broadcast_check" ) ) );
if( b_broadcast )
{
char * psz_broadcast;
psz_broadcast = gtk_entry_get_text( GTK_ENTRY( lookup_widget(
GTK_WIDGET(button), "network_broadcast" ) ) );
/* Allocate room for "protocol://server:port" */
psz_source = malloc( strlen( psz_protocol ) + 3 /* "://" */
+ strlen( psz_server ) + 1 /* ":" */
+ 5 /* 0-65535 */
+ strlen( psz_broadcast ) + 2 /* "::" */
+ 1 /* "\0" */ );
if( psz_source == NULL )
{
return;
}
/* Build source name and add it to playlist */
sprintf( psz_source, "%s://%s:%i::%s", psz_protocol,
psz_server,
i_port,
psz_broadcast );
}
else
{
/* Allocate room for "protocol://server:port" */
psz_source = malloc( strlen( psz_protocol ) + 3 /* "://" */
+ strlen( psz_server ) + 1 /* ":" */
+ 5 /* 0-65535 */ + 1 /* "\0" */ );
if( psz_source == NULL )
{
return;
}
/* Build source name and add it to playlist */
sprintf( psz_source, "%s://%s:%i", psz_protocol, psz_server, i_port );
}
intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END, psz_source );
free( psz_source );
/* catch the GTK CList */
p_playlist_clist = GTK_CLIST( gtk_object_get_data(
GTK_OBJECT( p_intf->p_sys->p_playlist ), "playlist_clist" ) );
/* update the display */
GtkRebuildCList( p_playlist_clist, p_main->p_playlist );
/* select added item */
if( p_intf->p_input != NULL )
{
p_intf->p_input->b_eof = 1;
}
// vlc_mutex_lock( &p_main->p_playlist->change_lock );
intf_PlaylistJumpto( p_main->p_playlist, i_end - 1 );
p_main->p_playlist->b_stopped = 0;
// vlc_mutex_unlock( &p_main->p_playlist->change_lock );
}
void GtkNetworkOpenCancel( GtkButton * button, gpointer user_data)
{
gtk_widget_hide( gtk_widget_get_toplevel( GTK_WIDGET (button) ) );
}
void GtkNetworkOpenBroadcast( GtkToggleButton * togglebutton,
gpointer user_data )
{
GtkWidget * p_network;
p_network = gtk_widget_get_toplevel( GTK_WIDGET (togglebutton) );
gtk_widget_set_sensitive( gtk_object_get_data( GTK_OBJECT( p_network ),
"network_broadcast_combo" ),
gtk_toggle_button_get_active( togglebutton ) );
gtk_widget_set_sensitive( gtk_object_get_data( GTK_OBJECT( p_network ),
"network_broadcast" ),
gtk_toggle_button_get_active( togglebutton ) );
}
/*****************************************************************************
* gtk_open.h: prototypes for open functions
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: gtk_open.h,v 1.1 2001/05/15 01:01:44 stef Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stphane Borel <stef@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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
gboolean
GtkFileOpenShow (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data);
void GtkFileOpenCancel( GtkButton * button, gpointer user_data);
void GtkFileOpenOk( GtkButton * button, gpointer user_data );
gboolean
GtkDiscOpenShow (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data);
void GtkDiscOpenDvd( GtkToggleButton * togglebutton, gpointer user_data );
void GtkDiscOpenVcd( GtkToggleButton *togglebutton, gpointer user_data );
void GtkDiscOpenOk( GtkButton * button, gpointer user_data );
void GtkDiscOpenCancel( GtkButton * button, gpointer user_data);
gboolean
GtkNetworkOpenShow (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data);
void GtkNetworkOpenOk( GtkButton *button, gpointer user_data );
void GtkNetworkOpenCancel( GtkButton * button, gpointer user_data);
void GtkNetworkOpenBroadcast( GtkToggleButton * togglebutton,
gpointer user_data );
...@@ -2,9 +2,10 @@ ...@@ -2,9 +2,10 @@
* gtk_playlist.c : Interface for the playlist dialog * gtk_playlist.c : Interface for the playlist dialog
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: gtk_playlist.c,v 1.11 2001/05/07 03:14:09 stef Exp $ * $Id: gtk_playlist.c,v 1.12 2001/05/15 01:01:44 stef Exp $
* *
* Authors: Pierre Baillet <oct@zoy.org> * Authors: Pierre Baillet <oct@zoy.org>
* Stphane Borel <stef@via.ecp.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
...@@ -62,276 +63,358 @@ ...@@ -62,276 +63,358 @@
#include "main.h" #include "main.h"
void /****************************************************************************
on_menubar_playlist_activate (GtkMenuItem *menuitem, * Playlist window management
gpointer user_data) ****************************************************************************/
gboolean GtkPlaylistShow( GtkWidget *widget,
GdkEventButton *event,
gpointer user_data )
{ {
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
playlist_t * p_playlist ;
GtkCList * list;
if( !GTK_IS_WIDGET( p_intf->p_sys->p_playlist ) ) if( !GTK_IS_WIDGET( p_intf->p_sys->p_playlist ) )
{ {
/* this shoud never happen */
intf_ErrMsgImm("intf_playlist is not a widget !");
p_intf->p_sys->p_playlist = create_intf_playlist(); p_intf->p_sys->p_playlist = create_intf_playlist();
gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_playlist ), gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_playlist ),
"p_intf", p_intf ); "p_intf", p_intf );
} }
vlc_mutex_lock( &p_main->p_playlist->change_lock );
if(p_main->p_playlist->i_size > 0 )
{
p_playlist = p_main->p_playlist;
list = GTK_CLIST(lookup_widget( p_intf->p_sys->p_playlist, "playlist_clist" )) ;
rebuildCList( list, p_playlist );
}
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
gtk_widget_show( p_intf->p_sys->p_playlist );
gdk_window_raise( p_intf->p_sys->p_playlist->window );
}
void if( GTK_WIDGET_VISIBLE( p_intf->p_sys->p_playlist ) )
on_toolbar_playlist_clicked (GtkButton *button,
gpointer user_data)
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
if( !GTK_IS_WIDGET( p_intf->p_sys->p_playlist ) )
{ {
/* this should never happen */ gtk_widget_hide( p_intf->p_sys->p_playlist );
intf_ErrMsgImm("intf_playlist is not a widget !");
p_intf->p_sys->p_playlist = create_intf_playlist();
gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_playlist ),
"p_intf", p_intf );
}
if( GTK_WIDGET_VISIBLE(p_intf->p_sys->p_playlist) ) {
gtk_widget_hide( p_intf->p_sys->p_playlist);
} }
else else
{ {
GtkCList * clist; GtkCList * p_clist;
p_clist = GTK_CLIST( gtk_object_get_data(
GTK_OBJECT( p_intf->p_sys->p_playlist ), "playlist_clist" ) );
GtkRebuildCList( p_clist , p_main->p_playlist );
gtk_widget_show( p_intf->p_sys->p_playlist ); gtk_widget_show( p_intf->p_sys->p_playlist );
clist = GTK_CLIST(lookup_widget( p_intf->p_sys->p_playlist,"playlist_clist" ));
gdk_window_raise( p_intf->p_sys->p_playlist->window ); gdk_window_raise( p_intf->p_sys->p_playlist->window );
rebuildCList( clist , p_main->p_playlist );
} }
return TRUE;
} }
void
on_playlist_ok_clicked (GtkButton *button, void GtkPlaylistOk( GtkButton * button, gpointer user_data )
gpointer user_data)
{ {
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_playlist" ); gtk_widget_hide( gtk_widget_get_toplevel( GTK_WIDGET (button) ) );
gtk_widget_hide( p_intf->p_sys->p_playlist );
} }
void deleteGListItem(gpointer data, gpointer param)
void GtkPlaylistCancel( GtkButton * button, gpointer user_data )
{ {
int curRow = ( int )data; gtk_widget_hide( gtk_widget_get_toplevel( GTK_WIDGET (button) ) );
intf_thread_t * p_intf = param; }
intf_PlaylistDelete( p_main->p_playlist, curRow );
/* are we deleting the current played stream */
if( p_intf->p_sys->i_playing == curRow )
gboolean GtkPlaylistPrev( GtkWidget *widget,
GdkEventButton *event,
gpointer user_data )
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
if( p_intf->p_input != NULL )
{ {
/* next ! */ /* FIXME: temporary hack */
intf_PlaylistPrev( p_main->p_playlist );
intf_PlaylistPrev( p_main->p_playlist );
p_intf->p_input->b_eof = 1; p_intf->p_input->b_eof = 1;
/* this has to set the slider to 0 */
/* step minus one */
p_intf->p_sys->i_playing-- ;
p_main->p_playlist->i_index-- ;
} }
}
gint compareItems(gconstpointer a, gconstpointer b) return TRUE;
{
return b - a;
} }
void
rebuildCList(GtkCList * clist, playlist_t * playlist_p) gboolean GtkPlaylistNext( GtkWidget *widget,
GdkEventButton *event,
gpointer user_data)
{ {
int dummy; intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
gchar * text[2];
GdkColor red;
red.red = 65535;
red.green = 0;
red.blue = 0;
if( p_intf->p_input != NULL )
gtk_clist_freeze( clist );
gtk_clist_clear( clist );
for( dummy=0; dummy < playlist_p->i_size; dummy++ )
{ {
#ifdef WIN32 /* WIN32 HACK */ /* FIXME: temporary hack */
text[0] = g_strdup( "" ); p_intf->p_input->b_eof = 1;
#else
text[0] = g_strdup( rindex( (char *)(playlist_p->p_item[playlist_p->i_size -1 - dummy].psz_name ), '/' ) + 1 );
#endif
text[1] = g_strdup( "no info");
gtk_clist_insert( clist, 0, text );
free(text[0]);
free(text[1]);
} }
gtk_clist_set_background (
clist, return TRUE;
playlist_p->i_index, }
&red);
gtk_clist_thaw( clist ); /****************************************************************************
* Menu callbacks for playlist functions
****************************************************************************/
void GtkNextActivate( GtkMenuItem * menuitem, gpointer user_data )
{
GtkPlaylistNext( GTK_WIDGET( menuitem ), NULL, user_data );
}
void GtkPrevActivate( GtkMenuItem * menuitem, gpointer user_data )
{
GtkPlaylistPrev( GTK_WIDGET( menuitem ), NULL, user_data );
}
/****************************************************************************
* Playlist core functions
****************************************************************************/
void GtkPlaylistAddUrl( GtkMenuItem * menuitem, gpointer user_data )
{
}
void GtkPlaylistDeleteAll( GtkMenuItem * menuitem, gpointer user_data )
{
} }
void
on_invertselection_clicked (GtkMenuItem *item, gpointer user_data) void GtkPlaylistDeleteSelected( GtkMenuItem * menuitem, gpointer user_data )
{ {
int * selected, sel_l; /* user wants to delete a file in the queue */
GtkCList * clist; GList * p_selection;
playlist_t * playlist_p; GtkCList * p_clist;
int dummy; playlist_t *p_playlist;
/* catch the thread back */ /* catch the thread back */
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(item), "intf_playlist" ); intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), (char*)user_data );
playlist_p = p_main->p_playlist;
p_playlist = p_main->p_playlist;
/* lock the struct */ /* lock the struct */
vlc_mutex_lock( &p_intf->change_lock ); vlc_mutex_lock( &p_intf->change_lock );
clist = GTK_CLIST( lookup_widget(p_intf->p_sys->p_playlist,"playlist_clist") );
p_clist = GTK_CLIST( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_playlist ), "playlist_clist" ) );
/* have to copy the selection to an int * /* I use UNDOCUMENTED features to retrieve the selection... */
I wasn't able to copy the g_list to another g_list p_selection = p_clist->selection;
glib only does pointer copies, not real copies :( */
selected = malloc(sizeof(int)* g_list_length(clist->selection)); if( g_list_length( p_selection ) > 0 )
sel_l = g_list_length(clist->selection);
for(dummy=0; dummy < sel_l; dummy++)
{ {
selected[dummy] = (int)g_list_nth_data(clist->selection,dummy); /* reverse-sort so that we can delete from the furthest
* to the closest item to delete...
*/
p_selection = g_list_sort( p_selection, GtkCompareItems );
g_list_foreach( p_selection, GtkDeleteGListItem, p_intf );
/* rebuild the CList */
GtkRebuildCList( p_clist, p_playlist );
} }
gtk_clist_freeze( clist );
gtk_clist_select_all( clist );
for(dummy=0; dummy < sel_l; dummy++)
{
gtk_clist_unselect_row( clist, selected[dummy],0);
gtk_clist_unselect_row( clist, selected[dummy],1);
}
free( selected );
gtk_clist_thaw( clist );
vlc_mutex_unlock( &p_intf->change_lock ); vlc_mutex_unlock( &p_intf->change_lock );
} }
void void GtkPlaylistCrop( GtkMenuItem * menuitem, gpointer user_data )
on_crop_activate (GtkMenuItem *menuitem,
gpointer user_data)
{ {
/* Ok, this is a really small thing, but, hey, it works and /* Ok, this is a really small thing, but, hey, it works and
might be useful, who knows ? */ might be useful, who knows ? */
GtkPlaylistInvert( menuitem, user_data );
on_invertselection_clicked (menuitem, user_data); GtkPlaylistDeleteSelected( menuitem, user_data );
on_delete_clicked(menuitem, user_data);
} }
void GtkPlaylistInvert( GtkMenuItem * menuitem, gpointer user_data )
void
on_delete_clicked (GtkMenuItem *item,
gpointer user_data)
{ {
/* user wants to delete a file in the queue */ playlist_t *p_playlist;
GList * selection; GtkCList * p_clist;
GtkCList * clist; int * pi_selected;
playlist_t * playlist_p; int i_sel_l;
int i_dummy;
/* catch the thread back */ /* catch the thread back */
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(item), "intf_playlist" ); intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), (char*)user_data );
playlist_p = p_main->p_playlist;
p_playlist = p_main->p_playlist;
/* lock the struct */ /* lock the struct */
vlc_mutex_lock( &p_intf->change_lock ); vlc_mutex_lock( &p_intf->change_lock );
clist = GTK_CLIST( lookup_widget(p_intf->p_sys->p_playlist,"playlist_clist") );
p_clist = GTK_CLIST( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_playlist ), "playlist_clist" ) );
/* I use UNDOCUMENTED features to retrieve the selection... */ /* have to copy the selection to an int *
selection = clist->selection; I wasn't able to copy the g_list to another g_list
glib only does pointer copies, not real copies :( */
if( g_list_length(selection)>0 ) pi_selected = malloc( sizeof(int) *g_list_length( p_clist->selection ) );
i_sel_l = g_list_length( p_clist->selection );
for( i_dummy = 0 ; i_dummy < i_sel_l ; i_dummy++)
{ {
/* reverse-sort so that we can delete from the furthest to the pi_selected[i_dummy] = (int)g_list_nth_data( p_clist->selection,
closest item to delete... i_dummy );
*/
selection = g_list_sort( selection, compareItems );
g_list_foreach( selection,
deleteGListItem,
p_intf );
/* rebuild the CList */
rebuildCList( clist, playlist_p );
} }
gtk_clist_freeze( p_clist );
gtk_clist_select_all( p_clist );
for( i_dummy = 0; i_dummy < i_sel_l; i_dummy++)
{
gtk_clist_unselect_row( p_clist, pi_selected[i_dummy], 0 );
gtk_clist_unselect_row( p_clist, pi_selected[i_dummy], 1 );
}
free( pi_selected );
gtk_clist_thaw( p_clist );
vlc_mutex_unlock( &p_intf->change_lock ); vlc_mutex_unlock( &p_intf->change_lock );
} }
gboolean void GtkPlaylistSelect( GtkMenuItem * menuitem, gpointer user_data)
on_intf_playlist_destroy_event (GtkWidget *widget,
GdkEvent *event,
gpointer user_data)
{ {
/* hide ! */
gtk_widget_hide(widget); }
return TRUE;
gboolean GtkPlaylistEvent( GtkWidget * widget,
GdkEvent * event,
gpointer user_data)
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
if( ( event->button ).type == GDK_2BUTTON_PRESS )
{
GtkCList * p_clist;
gint i_row;
gint i_col;
p_clist = GTK_CLIST( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_playlist ), "playlist_clist" ) );
if( gtk_clist_get_selection_info( p_clist, (event->button).x,
(event->button).y, &i_row, &i_col ) == 1 )
{
/* clicked is in range. */
if( p_intf->p_input != NULL )
{
/* FIXME: temporary hack */
p_intf->p_input->b_eof = 1;
}
// vlc_mutex_lock( &p_main->p_playlist->change_lock );
intf_PlaylistJumpto( p_main->p_playlist, i_row - 1 );
p_main->p_playlist->b_stopped = 0;
// vlc_mutex_unlock( &p_main->p_playlist->change_lock );
}
return TRUE;
}
return FALSE;
} }
void void GtkPlaylistDragData( GtkWidget *widget,
on_intf_playlist_drag_data_received (GtkWidget *widget, GdkDragContext *drag_context,
GdkDragContext *drag_context, gint x,
gint x, gint y,
gint y, GtkSelectionData *data,
GtkSelectionData *data, guint info,
guint info, guint time,
guint time, gpointer user_data )
gpointer user_data)
{ {
intf_thread_t * p_intf;
GtkCList * p_clist;
gint i_row;
gint i_col;
int i_end = p_main->p_playlist->i_size;
/* catch the interface back */ /* catch the interface back */
intf_thread_t * p_intf = GetIntf( GTK_WIDGET(widget), "intf_playlist" ); p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
GtkCList * clist;
gint row, col;
clist = GTK_CLIST(lookup_widget( p_intf->p_sys->p_playlist,"playlist_clist" )); p_clist = GTK_CLIST( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_playlist ), "playlist_clist" ) );
/* are we dropping somewhere into the clist items ? */ if( gtk_clist_get_selection_info( p_clist, x, y, &i_row, &i_col ) == 1 )
if( gtk_clist_get_selection_info( clist,
x,
y,
&row,
&col )== 1)
{ {
on_generic_drop_data_received( p_intf, data, info, row ); /* we are dropping somewhere into the clist items */
GtkDropDataReceived( p_intf, data, info, i_row );
} }
/* else, put that at the end of the playlist */
else else
{ {
on_generic_drop_data_received( p_intf, data, info, PLAYLIST_END); /* else, put that at the end of the playlist */
GtkDropDataReceived( p_intf, data, info, PLAYLIST_END );
} }
// vlc_mutex_lock( &p_main->p_playlist->change_lock );
intf_PlaylistJumpto( p_main->p_playlist, i_end - 1 );
p_main->p_playlist->b_stopped = 0;
// vlc_mutex_unlock( &p_main->p_playlist->change_lock );
} }
gboolean GtkPlaylistDragMotion( GtkWidget *widget,
GdkDragContext *drag_context,
gint x,
gint y,
guint time,
gpointer user_data )
{
intf_thread_t *p_intf;
GtkCList * p_clist;
gint i_row;
gint i_col;
int i_dummy;
GdkColor color;
p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
p_clist = GTK_CLIST( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_playlist ), "playlist_clist" ) );
if( !GTK_WIDGET_TOPLEVEL(widget) )
{
gdk_window_raise( p_intf->p_sys->p_playlist->window );
}
color.red = 0xffff;
color.blue = 0xffff;
color.green = 0xffff;
gtk_clist_freeze( p_clist );
for( i_dummy = 0; i_dummy < p_clist->rows; i_dummy++)
{
gtk_clist_set_background ( p_clist, i_dummy , &color);
}
color.red = 0xffff;
color.blue = 0;
color.green = 0;
gtk_clist_set_background( p_clist, p_main->p_playlist->i_index , &color );
if( gtk_clist_get_selection_info( p_clist, x, y, &i_row, &i_col ) == 1)
{
color.red = 0;
color.blue = 0xf000;
color.green = 0x9000;
gtk_clist_set_background ( p_clist, i_row - 1, &color);
gtk_clist_set_background ( p_clist, i_row, &color);
}
gtk_clist_thaw( p_clist );
void on_generic_drop_data_received( intf_thread_t * p_intf, return TRUE;
GtkSelectionData *data, guint info, int position) }
void GtkDropDataReceived( intf_thread_t * p_intf,
GtkSelectionData * p_data, guint i_info, int i_position)
{ {
/* first we'll have to split against all the '\n' we have */ /* first we'll have to split against all the '\n' we have */
gchar * protocol; gchar * p_protocol;
gchar * temp; gchar * p_temp;
gchar * string = data->data ; gchar * p_string = p_data->data ;
GList * files = NULL; GList * p_files = NULL;
GtkCList * clist; GtkCList * p_clist;
/* catch the playlist back */ /* catch the playlist back */
playlist_t * p_playlist = p_main->p_playlist ; playlist_t * p_playlist = p_main->p_playlist;
/* if this has been URLencoded, decode it /* if this has been URLencoded, decode it
...@@ -339,47 +422,47 @@ void on_generic_drop_data_received( intf_thread_t * p_intf, ...@@ -339,47 +422,47 @@ void on_generic_drop_data_received( intf_thread_t * p_intf,
* Is it a good thing to do it in place ? * Is it a good thing to do it in place ?
* probably not... * probably not...
*/ */
if(info == DROP_ACCEPT_TEXT_URI_LIST) if( i_info == DROP_ACCEPT_TEXT_URI_LIST )
{ {
urldecode_path( string ); urldecode_path( p_string );
} }
/* this cuts string into single file drops */ /* this cuts string into single file drops */
/* this code was borrowed from xmms, thx guys :) */ /* this code was borrowed from xmms, thx guys :) */
while(*string) while( *p_string)
{ {
temp = strchr(string, '\n'); p_temp = strchr( p_string, '\n' );
if(temp) if( p_temp )
{ {
if (*(temp - 1) == '\r') if( *( p_temp - 1 ) == '\r' )
*(temp - 1) = '\0'; {
*temp = '\0'; *( p_temp - 1) = '\0';
}
*p_temp = '\0';
} }
/* do we have a protocol or something ? */ /* do we have a protocol or something ? */
protocol = strstr( string, ":/" ); p_protocol = strstr( p_string, ":/" );
if( protocol != NULL ) if( p_protocol != NULL )
{ {
protocol = calloc( protocol - string + 2 , p_protocol = calloc( p_protocol - p_string + 2, sizeof(char) );
sizeof(char)); p_protocol = strncpy( p_protocol, p_string,
protocol = strncpy( protocol, string, strstr( string, ":/") + 1 - string ); strstr( p_string, ":/" ) + 1 - p_string );
intf_WarnMsg(4,"Protocol dropped is %s",protocol); intf_WarnMsg( 4, "Protocol dropped is %s", p_protocol );
string += strlen(protocol) ; p_string += strlen( p_protocol );
/* Allowed things are proto: or proto:// */ /* Allowed things are proto: or proto:// */
if(string[0]=='/' && string[1]=='/') if( p_string[0] == '/' && p_string[1] == '/')
{ {
/* eat one '/' */ /* eat one '/' */
string++; p_string++;
} }
intf_WarnMsg(4,"Dropped %s",string); intf_WarnMsg( 4, " Dropped %s", p_string );
} }
else else
{ {
protocol = strdup(""); p_protocol = strdup( "" );
} }
/* if it uses the file protocol we can do something, else, sorry :( /* if it uses the file protocol we can do something, else, sorry :(
...@@ -387,70 +470,110 @@ void on_generic_drop_data_received( intf_thread_t * p_intf, ...@@ -387,70 +470,110 @@ void on_generic_drop_data_received( intf_thread_t * p_intf,
* ability to read http:// or ftp:// files * ability to read http:// or ftp:// files
* what about adding dvd:// to the list of authorized proto ? */ * what about adding dvd:// to the list of authorized proto ? */
if( strcmp(protocol,"file:")==0 ) if( strcmp( p_protocol, "file:" ) == 0 )
{ {
files = g_list_concat( files, intf_readFiles( string ) ); p_files = g_list_concat( p_files, GtkReadFiles( p_string ) );
} }
/* free the malloc and go on... */ /* free the malloc and go on... */
free( protocol ); free( p_protocol );
if (!temp) if( !p_temp )
{
break; break;
string = temp + 1; }
p_string = p_temp + 1;
} }
/* At this point, we have a nice big list maybe NULL */ /* At this point, we have a nice big list maybe NULL */
if(files != NULL) if( p_files != NULL )
{ {
/* lock the interface */ /* lock the interface */
vlc_mutex_lock( &p_intf->change_lock ); vlc_mutex_lock( &p_intf->change_lock );
intf_WarnMsg( 4, "List has %d elements",g_list_length( files ) );
intf_AppendList( p_playlist, position, files ); intf_WarnMsg( 4, "List has %d elements", g_list_length( p_files ) );
GtkAppendList( p_playlist, i_position, p_files );
/* get the CList and rebuild it. */ /* get the CList and rebuild it. */
clist = GTK_CLIST( p_clist = GTK_CLIST( lookup_widget( p_intf->p_sys->p_playlist,
lookup_widget( p_intf->p_sys->p_playlist, "playlist_clist" ) );
"playlist_clist" ) ); GtkRebuildCList( p_clist , p_playlist );
rebuildCList( clist , p_playlist );
/* unlock the interface */ /* unlock the interface */
vlc_mutex_unlock( &p_intf->change_lock ); vlc_mutex_unlock( &p_intf->change_lock );
p_main->p_playlist->b_stopped = 0;
}
}
void GtkDeleteGListItem( gpointer data, gpointer param )
{
int i_cur_row = ( int )data;
intf_thread_t * p_intf = param;
intf_PlaylistDelete( p_main->p_playlist, i_cur_row );
/* are we deleting the current played stream */
if( p_intf->p_sys->i_playing == i_cur_row )
{
/* next ! */
p_intf->p_input->b_eof = 1;
/* this has to set the slider to 0 */
/* step minus one */
p_intf->p_sys->i_playing-- ;
vlc_mutex_lock( &p_main->p_playlist->change_lock );
p_main->p_playlist->i_index-- ;
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
} }
} }
gint GtkCompareItems( gconstpointer a, gconstpointer b )
{
return b - a;
}
/* check a file (string) against supposed valid extension */ /* check a file (string) against supposed valid extension */
int int GtkHasValidExtension( gchar * psz_filename )
hasValidExtension( gchar * filename )
{ {
char * ext[6] = {"mpg","mpeg","vob","mp2","ts","ps"}; char * ppsz_ext[6] = { "mpg", "mpeg", "vob", "mp2", "ts", "ps" };
int i_ext = 6; int i_ext = 6;
int dummy; int i_dummy;
gchar * p_filename = strrchr( filename, '.' ) + sizeof( char );
for( dummy=0; dummy<i_ext;dummy++ ) gchar * psz_ext = strrchr( psz_filename, '.' ) + sizeof( char );
for( i_dummy = 0 ; i_dummy < i_ext ; i_dummy++ )
{ {
if( strcmp( p_filename,ext[dummy] )==0 ) if( strcmp( psz_ext, ppsz_ext[i_dummy] ) == 0 )
{
return 1; return 1;
}
} }
return 0; return 0;
} }
/* recursive function: descend into folders and build a list of valid filenames */ /* recursive function: descend into folders and build a list of
GList * * valid filenames */
intf_readFiles( gchar * fsname ) GList * GtkReadFiles( gchar * psz_fsname )
{ {
struct stat statbuf; struct stat statbuf;
GList * current = NULL; GList * p_current = NULL;
/* get the attributes of this file */ /* get the attributes of this file */
stat(fsname, &statbuf); stat( psz_fsname, &statbuf );
/* is it a regular file ? */ /* is it a regular file ? */
if( S_ISREG( statbuf.st_mode ) ) if( S_ISREG( statbuf.st_mode ) )
{ {
if( hasValidExtension(fsname) ) if( GtkHasValidExtension( psz_fsname ) )
{ {
intf_WarnMsg( 2, "%s is a valid file. Stacking on the playlist", fsname ); intf_WarnMsg( 2, "%s is a valid file. Stacking on the playlist",
return g_list_append( NULL, g_strdup(fsname) ); psz_fsname );
return g_list_append( NULL, g_strdup( psz_fsname ) );
} }
else else
{ {
...@@ -461,140 +584,133 @@ intf_readFiles( gchar * fsname ) ...@@ -461,140 +584,133 @@ intf_readFiles( gchar * fsname )
else if( S_ISDIR( statbuf.st_mode ) ) else if( S_ISDIR( statbuf.st_mode ) )
{ {
/* have to cd into this dir */ /* have to cd into this dir */
DIR * currentDir = opendir( fsname ); DIR * p_current_dir = opendir( psz_fsname );
struct dirent * dirContent; struct dirent * p_dir_content;
intf_WarnMsg( 2, "%s is a folder.", fsname ); intf_WarnMsg( 2, "%s is a folder.", psz_fsname );
if( currentDir == NULL ) if( p_current_dir == NULL )
{ {
/* something went bad, get out of here ! */ /* something went bad, get out of here ! */
return current; return p_current;
} }
dirContent = readdir( currentDir ); p_dir_content = readdir( p_current_dir );
/* while we still have entries in the directory */ /* while we still have entries in the directory */
while( dirContent != NULL ) while( p_dir_content != NULL )
{ {
/* if it is "." or "..", forget it */ /* if it is "." or "..", forget it */
if(strcmp(dirContent->d_name,".") != 0 if( ( strcmp( p_dir_content->d_name, "." ) != 0 ) &&
&& strcmp(dirContent->d_name,"..") != 0) ( strcmp( p_dir_content->d_name, ".." ) != 0 ) )
{ {
/* else build the new directory by adding /* else build the new directory by adding
fsname "/" and the current entry name fsname "/" and the current entry name
(kludgy :() (kludgy :()
*/ */
char * newfs = malloc ( 2 + char * psz_newfs = malloc ( 2 + strlen( psz_fsname ) +
strlen( fsname ) + strlen( p_dir_content->d_name ) * sizeof(char) );
strlen( dirContent->d_name ) * sizeof( char ) ); strcpy( psz_newfs, psz_fsname );
strcpy( newfs, fsname ); strcpy( psz_newfs + strlen( psz_fsname ) + 1,
strcpy( newfs + strlen( fsname )+1, dirContent->d_name); p_dir_content->d_name );
newfs[strlen( fsname )] = '/'; psz_newfs[strlen( psz_fsname )] = '/';
current = g_list_concat( current, intf_readFiles( newfs ) ); p_current = g_list_concat( p_current,
GtkReadFiles( psz_newfs ) );
g_free( newfs ); g_free( psz_newfs );
} }
dirContent = readdir( currentDir ); p_dir_content = readdir( p_current_dir );
} }
return current; return p_current;
} }
return NULL; return NULL;
} }
/* add items in a playlist /* add items in a playlist
when i_pos==-1 add to the end of the list... * when i_pos==-1 add to the end of the list...
*/ */
int intf_AppendList( playlist_t * p_playlist, int i_pos, GList * list ) int GtkAppendList( playlist_t * p_playlist, int i_pos, GList * p_list )
{ {
guint length, dummy; guint i_dummy;
length = g_list_length( list ); guint i_length;
for( dummy=0; dummy<length; dummy++ )
i_length = g_list_length( p_list );
for( i_dummy = 0; i_dummy < i_length ; i_dummy++ )
{ {
intf_PlaylistAdd( p_playlist, intf_PlaylistAdd( p_playlist,
/* ok; this is a really nasty trick to insert /* ok; this is a really nasty trick to insert
the item where they are suppose to go but, hey the item where they are suppose to go but, hey
this works :P (btw, you are really nasty too) */ this works :P (btw, you are really nasty too) */
i_pos==PLAYLIST_END?PLAYLIST_END:( i_pos + dummy ), i_pos==PLAYLIST_END?PLAYLIST_END:( i_pos + i_dummy ),
g_list_nth_data(list, dummy)); g_list_nth_data( p_list, i_dummy ) );
} }
return 0; return 0;
} }
gboolean
on_playlist_clist_event (GtkWidget *widget,
GdkEvent *event,
gpointer user_data)
{
intf_thread_t * p_intf = GetIntf( GTK_WIDGET( widget ), "intf_playlist" );
if( ( event->button ).type == GDK_2BUTTON_PRESS )
{
GtkCList * clist;
gint row, col;
clist = GTK_CLIST(
lookup_widget(
p_intf->p_sys->p_playlist,
"playlist_clist" ) );
if( gtk_clist_get_selection_info( clist,
(event->button).x,
(event->button).y,
&row,
&col )== 1 )
{
/* clicked is in range. */
if( p_intf->p_input != NULL )
{
/* FIXME: temporary hack */
p_intf->p_input->b_eof = 1;
}
intf_PlaylistJumpto( p_main->p_playlist, row-1 );
}
return TRUE;
}
return FALSE;
}
/* statis timeouted function */ /* statis timeouted function */
void GtkPlayListManage( gpointer p_data ) void GtkPlayListManage( intf_thread_t * p_intf )
{ {
/* this thing really sucks for now :( */ /* this thing really sucks for now :( */
/* TODO speak more with interface/intf_playlist.c */ /* TODO speak more with interface/intf_playlist.c */
intf_thread_t *p_intf = (void *)p_data; playlist_t * p_playlist = p_main->p_playlist ;
playlist_t * p_playlist = p_main->p_playlist ; GtkCList * p_clist;
vlc_mutex_lock( &p_intf->change_lock ); p_clist = GTK_CLIST( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_playlist ), "playlist_clist" ) );
if( p_intf->p_sys->i_playing != p_playlist->i_index ) if( p_intf->p_sys->i_playing != p_playlist->i_index )
{ {
GdkColor color; GdkColor color;
color.red = 0xffff; color.red = 0xffff;
color.green = 0;
color.blue = 0; color.blue = 0;
color.green = 0;
gtk_clist_set_background ( GTK_CLIST( gtk_clist_set_background( p_clist, p_playlist->i_index, &color );
lookup_widget( p_intf->p_sys->p_playlist,
"playlist_clist" ) ),
p_playlist->i_index,
&color );
if( p_intf->p_sys->i_playing != -1 ) if( p_intf->p_sys->i_playing != -1 )
{ {
color.red = 0xffff; color.red = 0xffff;
color.green = 0xffff;
color.blue = 0xffff; color.blue = 0xffff;
gtk_clist_set_background ( color.green = 0xffff;
GTK_CLIST(lookup_widget( p_intf->p_sys->p_playlist, "playlist_clist" ) ), gtk_clist_set_background( p_clist, p_intf->p_sys->i_playing,
p_intf->p_sys->i_playing, &color);
&color);
} }
p_intf->p_sys->i_playing = p_playlist->i_index; p_intf->p_sys->i_playing = p_playlist->i_index;
} }
vlc_mutex_unlock( &p_intf->change_lock ); }
void GtkRebuildCList( GtkCList * p_clist, playlist_t * p_playlist )
{
int i_dummy;
gchar * ppsz_text[2];
GdkColor red;
red.red = 65535;
red.blue = 0;
red.green = 0;
gtk_clist_freeze( p_clist );
gtk_clist_clear( p_clist );
for( i_dummy = 0; i_dummy < p_playlist->i_size ; i_dummy++ )
{
#ifdef WIN32 /* WIN32 HACK */
ppsz_text[0] = g_strdup( "" );
#else
ppsz_text[0] = g_strdup( rindex( (char *)(p_playlist->p_item[
p_playlist->i_size - 1 - i_dummy].psz_name ), '/' ) + 1 );
#endif
ppsz_text[1] = g_strdup( "no info");
gtk_clist_insert( p_clist, 0, ppsz_text );
free( ppsz_text[0] );
free( ppsz_text[1] );
}
gtk_clist_set_background( p_clist, p_playlist->i_index, &red);
gtk_clist_thaw( p_clist );
} }
void on_generic_drop_data_received( intf_thread_t * p_intf, /*****************************************************************************
GtkSelectionData *data, guint info, int position); * gtk_playlist.h : Playlist functions for the Gtk plugin.
void rebuildCList(GtkCList * clist, playlist_t * playlist_p); *****************************************************************************
int hasValidExtension(gchar * filename); * Copyright (C) 2000, 2001 VideoLAN
int intf_AppendList( playlist_t * p_playlist, int i_pos, GList * list ); * $Id: gtk_playlist.h,v 1.2 2001/05/15 01:01:44 stef Exp $
void GtkPlayListManage( gpointer p_data ); *
void on_generic_drop_data_received( intf_thread_t * p_intf, * Authors: Pierre Baillet <oct@zoy.org>
GtkSelectionData *data, guint info, int position); * Stphane Borel <stef@via.ecp.fr>
gint compareItems(gconstpointer a, gconstpointer b); *
GList * intf_readFiles(gchar * fsname ); * 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
void GtkPlaylistDeleteAll ( GtkMenuItem *, gpointer );
void GtkPlaylistDeleteSelected( GtkMenuItem *, gpointer );
void GtkPlaylistCrop ( GtkMenuItem *, gpointer );
void GtkPlaylistInvert ( GtkMenuItem *, gpointer );
void GtkPlaylistSelect ( GtkMenuItem *, gpointer );
void GtkPlaylistOk ( GtkButton *, gpointer );
void GtkPlaylistCancel ( GtkButton *, gpointer );
int GtkHasValidExtension ( gchar * );
gint GtkCompareItems ( gconstpointer, gconstpointer );
GList * GtkReadFiles ( gchar * );
gboolean GtkPlaylistShow ( GtkWidget *, GdkEventButton *, gpointer );
gboolean GtkPlaylistPrev ( GtkWidget *, GdkEventButton *, gpointer );
gboolean GtkPlaylistNext ( GtkWidget *, GdkEventButton *, gpointer );
gboolean GtkPlaylistDragMotion( GtkWidget *, GdkDragContext *,
gint, gint, uint, gpointer );
gboolean GtkPlaylistEvent ( GtkWidget *, GdkEvent *, gpointer );
void GtkPlaylistDragData ( GtkWidget *, GdkDragContext *,
gint, gint, GtkSelectionData *,
guint, guint, gpointer );
void GtkDeleteGListItem ( gpointer, gpointer );
/*****************************************************************************
* gtk_control.c : functions to handle stream control buttons.
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: gtk_preferences.c,v 1.1 2001/05/15 01:01:44 stef Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stphane Borel <stef@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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#define MODULE_NAME gtk
#include "modules_inner.h"
/*****************************************************************************
* Preamble
*****************************************************************************/
#include "defs.h"
#include <sys/types.h> /* off_t */
#include <stdlib.h>
#include <gtk/gtk.h>
#include <string.h>
#include "config.h"
#include "common.h"
#include "threads.h"
#include "mtime.h"
#include "stream_control.h"
#include "input_ext-intf.h"
#include "interface.h"
#include "intf_playlist.h"
#include "intf_msg.h"
#include "gtk_callbacks.h"
#include "gtk_interface.h"
#include "gtk_support.h"
#include "gtk_playlist.h"
#include "intf_gtk.h"
#include "main.h"
/****************************************************************************
* GtkPreferencesShow: display interface window after initialization
* if necessary
****************************************************************************/
/* macros to create preference box */
#define ASSIGN_PSZ_ENTRY( var, default, name ) \
gtk_entry_set_text( GTK_ENTRY( gtk_object_get_data( GTK_OBJECT( \
p_intf->p_sys->p_preferences ), name ) ), \
main_GetPszVariable( var, default ) )
#define ASSIGN_INT_VALUE( var, default, name ) \
gtk_spin_button_set_value( GTK_SPIN_BUTTON( gtk_object_get_data( \
GTK_OBJECT( p_intf->p_sys->p_preferences ), name ) ), \
main_GetIntVariable( var, default ) )
#define ASSIGN_INT_TOGGLE( var, default, name ) \
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( gtk_object_get_data( \
GTK_OBJECT( p_intf->p_sys->p_preferences ), name ) ), \
main_GetIntVariable( var, default ) )
gboolean GtkPreferencesShow( GtkWidget *widget,
GdkEventButton *event,
gpointer user_data )
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
/* If we have never used the file selector, open it */
if( !GTK_IS_WIDGET( p_intf->p_sys->p_preferences ) )
{
p_intf->p_sys->p_preferences = create_intf_preferences();
gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_preferences ),
"p_intf", p_intf );
/* Default path */
ASSIGN_PSZ_ENTRY( INTF_PATH_VAR, INTF_PATH_DEFAULT,
"preferences_file_path_entry" );
/* Default DVD */
ASSIGN_PSZ_ENTRY( INPUT_DVD_DEVICE_VAR,INPUT_DVD_DEVICE_DEFAULT,
"preferences_disc_dvd_entry" );
/* Default VCD */
ASSIGN_PSZ_ENTRY( INPUT_VCD_DEVICE_VAR, INPUT_VCD_DEVICE_DEFAULT,
"preferences_disc_vcd_entry" );
/* Default server */
ASSIGN_PSZ_ENTRY( INPUT_SERVER_VAR, INPUT_SERVER_DEFAULT,
"preferences_network_server_entry" );
/* Default port */
ASSIGN_INT_VALUE( INPUT_PORT_VAR, INPUT_PORT_DEFAULT,
"preferences_network_port_spinbutton" );
/* Broadcast address */
ASSIGN_PSZ_ENTRY( INPUT_BCAST_ADRR_VAR, INPUT_BCAST_ADDR_DEFAULT,
"preferences_network_broadcast_entry" );
/* Broadcast stream by default ? */
ASSIGN_INT_TOGGLE( INPUT_BROADCAST_VAR, INPUT_BROADCAST_DEFAULT,
"preferences_network_broadcast_checkbutton" );
/* XXX Protocol */
/* Default interface */
ASSIGN_PSZ_ENTRY( INTF_METHOD_VAR, INTF_METHOD_DEFAULT,
"preferences_interface_entry" );
/* Default video output */
ASSIGN_PSZ_ENTRY( VOUT_METHOD_VAR, VOUT_METHOD_DEFAULT,
"preferences_video_output_entry" );
/* Default output width */
ASSIGN_INT_VALUE( VOUT_WIDTH_VAR, VOUT_WIDTH_DEFAULT,
"preferences_video_width_spinbutton" );
/* Default output height */
ASSIGN_INT_VALUE( VOUT_HEIGHT_VAR, VOUT_HEIGHT_DEFAULT,
"preferences_video_height_spinbutton" );
/* XXX Default screen depth */
/* XXX Default fullscreen depth */
/* XXX Default gamma */
/* Fullscreen on play */
ASSIGN_INT_TOGGLE( VOUT_FULLSCREEN_VAR, VOUT_FULLSCREEN_DEFAULT,
"preferences_video_fullscreen_checkbutton" );
/* Grayscale display */
ASSIGN_INT_TOGGLE( VOUT_GRAYSCALE_VAR, VOUT_GRAYSCALE_DEFAULT,
"preferences_video_grayscale_checkbutton" );
/* Default audio output */
ASSIGN_PSZ_ENTRY( AOUT_METHOD_VAR, AOUT_METHOD_DEFAULT,
"preferences_audio_output_entry" );
/* Default audio device */
ASSIGN_PSZ_ENTRY( AOUT_DSP_VAR, AOUT_DSP_DEFAULT,
"preferences_audio_device_entry" );
/* XXX Default frequency */
/* XXX Default quality */
/* XXX Default number of channels */
/* Use spdif output ? */
ASSIGN_INT_TOGGLE( AOUT_SPDIF_VAR, AOUT_SPDIF_DEFAULT,
"preferences_audio_spdif_checkbutton" );
/* Launch playlist on startup */
ASSIGN_INT_TOGGLE( PLAYLIST_STARTUP_VAR, PLAYLIST_STARTUP_DEFAULT,
"preferences_playlist_startup_checkbutton" );
/* Enqueue drag'n dropped item as default */
ASSIGN_INT_TOGGLE( PLAYLIST_ENQUEUE_VAR, PLAYLIST_ENQUEUE_DEFAULT,
"preferences_playlist_enqueue_checkbutton" );
/* Loop on playlist end */
ASSIGN_INT_TOGGLE( PLAYLIST_LOOP_VAR, PLAYLIST_LOOP_DEFAULT,
"preferences_playlist_loop_checkbutton" );
/* Verbosity of warning messages */
ASSIGN_INT_VALUE( INTF_WARNING_VAR, INTF_WARNING_DEFAULT,
"preferences_misc_messages_spinbutton" );
#undef ASSIGN_PSZ_ENTRY
#undef ASSIGN_INT_VALUE
#undef ASSIGN_INT_TOGGLE
}
gtk_widget_show( p_intf->p_sys->p_preferences );
gdk_window_raise( p_intf->p_sys->p_preferences->window );
return TRUE;
}
/****************************************************************************
* GtkPreferencesApply: store the values into the environnement variables
****************************************************************************/
/* macros to read value frfom preference box */
#define ASSIGN_PSZ_ENTRY( var, name ) \
main_PutPszVariable( var, gtk_entry_get_text( \
GTK_ENTRY( gtk_object_get_data( GTK_OBJECT( p_preferences ), name ) ) ) )
#define ASSIGN_INT_VALUE( var, name ) \
main_PutIntVariable( var, gtk_spin_button_get_value_as_int( \
GTK_SPIN_BUTTON( gtk_object_get_data( GTK_OBJECT( p_preferences ), \
name ) ) ) )
#define ASSIGN_INT_TOGGLE( var, name ) \
main_PutIntVariable( var, gtk_toggle_button_get_active( \
GTK_TOGGLE_BUTTON( gtk_object_get_data( GTK_OBJECT( p_preferences ), \
name ) ) ) )
void GtkPreferencesApply( GtkButton * button, gpointer user_data )
{
GtkWidget * p_preferences;
/* get preferences window */
p_preferences = gtk_widget_get_toplevel( GTK_WIDGET( button ) );
/* Default path */
ASSIGN_PSZ_ENTRY( INTF_PATH_VAR, "preferences_file_path_entry" );
/* Default DVD */
ASSIGN_PSZ_ENTRY( INPUT_DVD_DEVICE_VAR, "preferences_disc_dvd_entry" );
/* Default VCD */
ASSIGN_PSZ_ENTRY( INPUT_VCD_DEVICE_VAR, "preferences_disc_vcd_entry" );
/* Default server */
ASSIGN_PSZ_ENTRY( INPUT_SERVER_VAR, "preferences_network_server_entry" );
/* Default port */
ASSIGN_INT_VALUE( INPUT_PORT_VAR, "preferences_network_port_spinbutton" );
/* Broadcast address */
ASSIGN_PSZ_ENTRY( INPUT_BCAST_ADRR_VAR,
"preferences_network_broadcast_entry" );
/* Broadcast stream by default ? */
ASSIGN_INT_TOGGLE( INPUT_BROADCAST_VAR,
"preferences_network_broadcast_checkbutton" );
/* XXX Protocol */
/* Default interface */
ASSIGN_PSZ_ENTRY( INTF_METHOD_VAR, "preferences_interface_entry" );
/* Default video output */
ASSIGN_PSZ_ENTRY( VOUT_METHOD_VAR, "preferences_video_output_entry" );
/* Default output width */
ASSIGN_INT_VALUE( VOUT_WIDTH_VAR, "preferences_video_width_spinbutton" );
/* Default output height */
ASSIGN_INT_VALUE( VOUT_HEIGHT_VAR, "preferences_video_height_spinbutton" );
/* XXX Default screen depth */
/* XXX Default fullscreen depth */
/* XXX Default gamma */
/* Fullscreen on play */
ASSIGN_INT_TOGGLE( VOUT_FULLSCREEN_VAR,
"preferences_video_fullscreen_checkbutton" );
/* Grayscale display */
ASSIGN_INT_TOGGLE( VOUT_GRAYSCALE_VAR,
"preferences_video_grayscale_checkbutton" );
/* Default audio output */
ASSIGN_PSZ_ENTRY( AOUT_METHOD_VAR, "preferences_audio_output_entry" );
/* Default audio device */
ASSIGN_PSZ_ENTRY( AOUT_DSP_VAR, "preferences_audio_device_entry" );
/* XXX Default frequency */
/* XXX Default quality */
/* XXX Default number of channels */
/* Use spdif output ? */
ASSIGN_INT_TOGGLE( AOUT_SPDIF_VAR, "preferences_audio_spdif_checkbutton" );
/* Launch playlist on startup */
ASSIGN_INT_TOGGLE( PLAYLIST_STARTUP_VAR,
"preferences_playlist_startup_checkbutton" );
/* Enqueue drag'n dropped item as default */
ASSIGN_INT_TOGGLE( PLAYLIST_ENQUEUE_VAR,
"preferences_playlist_enqueue_checkbutton" );
/* Loop on playlist end */
ASSIGN_INT_TOGGLE( PLAYLIST_LOOP_VAR,
"preferences_playlist_loop_checkbutton" );
/* Verbosity of warning messages */
ASSIGN_INT_VALUE( INTF_WARNING_VAR,
"preferences_misc_messages_spinbutton" );
}
#undef ASSIGN_PSZ_ENTRY
#undef ASSIGN_INT_VALUE
#undef ASSIGN_INT_TOGGLE
void GtkPreferencesOk( GtkButton * button, gpointer user_data )
{
GtkPreferencesApply( button, user_data );
gtk_widget_hide( gtk_widget_get_toplevel( GTK_WIDGET (button) ) );
}
void GtkPreferencesCancel( GtkButton * button, gpointer user_data )
{
gtk_widget_hide( gtk_widget_get_toplevel( GTK_WIDGET (button) ) );
}
/*****************************************************************************
* gtk_control.h: prototypes for control functions
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: gtk_preferences.h,v 1.1 2001/05/15 01:01:44 stef Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stéphane Borel <stef@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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
gboolean GtkPreferencesShow ( GtkWidget *, GdkEventButton *, gpointer );
void GtkPreferencesOk ( GtkButton *, gpointer );
void GtkPreferencesApply ( GtkButton *, gpointer );
void GtkPreferencesCancel( GtkButton *, gpointer );
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* intf_gtk.c: Gtk+ interface * intf_gtk.c: Gtk+ interface
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: intf_gtk.c,v 1.17 2001/05/07 03:14:09 stef Exp $ * $Id: intf_gtk.c,v 1.18 2001/05/15 01:01:44 stef Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* Stphane Borel <stef@via.ecp.fr> * Stphane Borel <stef@via.ecp.fr>
...@@ -47,12 +47,17 @@ ...@@ -47,12 +47,17 @@
#include "stream_control.h" #include "stream_control.h"
#include "input_ext-intf.h" #include "input_ext-intf.h"
#include "intf_msg.h"
#include "interface.h" #include "interface.h"
#include "intf_msg.h"
#include "intf_playlist.h"
#include "video.h"
#include "video_output.h"
#include "gtk_callbacks.h" #include "gtk_callbacks.h"
#include "gtk_interface.h" #include "gtk_interface.h"
#include "gtk_support.h" #include "gtk_support.h"
#include "gtk_menu.h"
#include "intf_gtk.h" #include "intf_gtk.h"
#include "main.h" #include "main.h"
...@@ -66,16 +71,9 @@ static void intf_Close ( intf_thread_t *p_intf ); ...@@ -66,16 +71,9 @@ static void intf_Close ( intf_thread_t *p_intf );
static void intf_Run ( intf_thread_t *p_intf ); static void intf_Run ( intf_thread_t *p_intf );
static gint GtkManage ( gpointer p_data ); static gint GtkManage ( gpointer p_data );
static gint GtkLanguageMenus( gpointer, GtkWidget *, es_descriptor_t *, gint, static gint GtkModeManage ( intf_thread_t * p_intf );
void (*pf_activate)(GtkMenuItem *, gpointer) );
static gint GtkChapterMenu ( gpointer, GtkWidget *,
void (*pf_activate)(GtkMenuItem *, gpointer) );
static gint GtkTitleMenu ( gpointer, GtkWidget *,
void (*pf_activate)(GtkMenuItem *, gpointer) );
static void GtkDisplayDate ( GtkAdjustment *p_adj ); static void GtkDisplayDate ( GtkAdjustment *p_adj );
void GtkPlayListManage( gpointer p_data );
/***************************************************************************** /*****************************************************************************
* g_atexit: kludge to avoid the Gtk+ thread to segfault at exit * g_atexit: kludge to avoid the Gtk+ thread to segfault at exit
***************************************************************************** *****************************************************************************
...@@ -151,12 +149,8 @@ static int intf_Open( intf_thread_t *p_intf ) ...@@ -151,12 +149,8 @@ static int intf_Open( intf_thread_t *p_intf )
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_slider_free = 1; p_intf->p_sys->b_slider_free = 1;
p_intf->p_sys->i_playing = -1;
p_intf->p_sys->pf_gtk_callback = NULL; p_intf->p_sys->pf_gtk_callback = NULL;
p_intf->p_sys->pf_gdk_callback = NULL; p_intf->p_sys->pf_gdk_callback = NULL;
...@@ -204,10 +198,7 @@ static void intf_Run( intf_thread_t *p_intf ) ...@@ -204,10 +198,7 @@ static void intf_Run( intf_thread_t *p_intf )
/* Create some useful widgets that will certainly be used */ /* Create some useful widgets that will certainly be used */
p_intf->p_sys->p_window = create_intf_window( ); p_intf->p_sys->p_window = create_intf_window( );
p_intf->p_sys->p_popup = create_intf_popup( ); p_intf->p_sys->p_popup = create_intf_popup( );
p_intf->p_sys->p_disc = create_intf_disc( );
p_intf->p_sys->p_network = create_intf_network( );
p_intf->p_sys->p_playlist = create_intf_playlist( ); p_intf->p_sys->p_playlist = create_intf_playlist( );
/* Set the title of the main window */ /* Set the title of the main window */
gtk_window_set_title( GTK_WINDOW(p_intf->p_sys->p_window), gtk_window_set_title( GTK_WINDOW(p_intf->p_sys->p_window),
...@@ -228,20 +219,30 @@ static void intf_Run( intf_thread_t *p_intf ) ...@@ -228,20 +219,30 @@ static void intf_Run( intf_thread_t *p_intf )
p_intf->p_sys->p_slider_frame = GTK_FRAME( gtk_object_get_data( p_intf->p_sys->p_slider_frame = GTK_FRAME( gtk_object_get_data(
GTK_OBJECT(p_intf->p_sys->p_window ), "slider_frame" ) ); GTK_OBJECT(p_intf->p_sys->p_window ), "slider_frame" ) );
#define P_LABEL( name ) GTK_LABEL( gtk_object_get_data( \
GTK_OBJECT( p_intf->p_sys->p_window ), name ) )
p_intf->p_sys->p_label_title = P_LABEL( "title_label" );
p_intf->p_sys->p_label_chapter = P_LABEL( "chapter_label" );
#undef P_LABEL
/* Connect the date display to the slider */ /* Connect the date display to the slider */
#define P_SLIDER GTK_RANGE( gtk_object_get_data( \ #define P_SLIDER GTK_RANGE( gtk_object_get_data( \
GTK_OBJECT( p_intf->p_sys->p_window ), "slider" ) ) GTK_OBJECT( p_intf->p_sys->p_window ), "slider" ) )
p_intf->p_sys->p_adj = gtk_range_get_adjustment( P_SLIDER ); p_intf->p_sys->p_adj = gtk_range_get_adjustment( P_SLIDER );
gtk_signal_connect ( GTK_OBJECT( p_intf->p_sys->p_adj ), "value_changed", gtk_signal_connect ( GTK_OBJECT( p_intf->p_sys->p_adj ), "value_changed",
GTK_SIGNAL_FUNC( GtkDisplayDate ), NULL ); GTK_SIGNAL_FUNC( GtkDisplayDate ), NULL );
p_intf->p_sys->f_adj_oldvalue = 0; p_intf->p_sys->f_adj_oldvalue = 0;
#undef P_SLIDER #undef P_SLIDER
/* We don't create these ones yet because we perhaps won't need them */ /* We don't create these ones yet because we perhaps won't need them */
p_intf->p_sys->p_about = NULL; p_intf->p_sys->p_about = NULL;
p_intf->p_sys->p_modules = NULL; p_intf->p_sys->p_modules = NULL;
p_intf->p_sys->p_fileopen = NULL; p_intf->p_sys->p_fileopen = NULL;
p_intf->p_sys->p_disc = NULL;
p_intf->p_sys->p_network = NULL;
p_intf->p_sys->p_preferences = NULL;
p_intf->p_sys->p_jump = NULL;
/* Store p_intf to keep an eye on it */ /* Store p_intf to keep an eye on it */
gtk_object_set_data( GTK_OBJECT(p_intf->p_sys->p_window), gtk_object_set_data( GTK_OBJECT(p_intf->p_sys->p_window),
...@@ -253,12 +254,6 @@ static void intf_Run( intf_thread_t *p_intf ) ...@@ -253,12 +254,6 @@ static void intf_Run( intf_thread_t *p_intf )
gtk_object_set_data( GTK_OBJECT(p_intf->p_sys->p_playlist), gtk_object_set_data( GTK_OBJECT(p_intf->p_sys->p_playlist),
"p_intf", p_intf ); "p_intf", p_intf );
gtk_object_set_data( GTK_OBJECT(p_intf->p_sys->p_disc),
"p_intf", p_intf );
gtk_object_set_data( GTK_OBJECT(p_intf->p_sys->p_network),
"p_intf", p_intf );
gtk_object_set_data( GTK_OBJECT(p_intf->p_sys->p_adj), gtk_object_set_data( GTK_OBJECT(p_intf->p_sys->p_adj),
"p_intf", p_intf ); "p_intf", p_intf );
...@@ -300,8 +295,6 @@ static gint GtkManage( gpointer p_data ) ...@@ -300,8 +295,6 @@ static gint GtkManage( gpointer p_data )
{ {
#define p_intf ((intf_thread_t *)p_data) #define p_intf ((intf_thread_t *)p_data)
GtkPlayListManage( p_data );
vlc_mutex_lock( &p_intf->change_lock ); vlc_mutex_lock( &p_intf->change_lock );
/* If the "display popup" flag has changed */ /* If the "display popup" flag has changed */
...@@ -318,122 +311,53 @@ static gint GtkManage( gpointer p_data ) ...@@ -318,122 +311,53 @@ static gint GtkManage( gpointer p_data )
p_intf->b_menu_change = 0; p_intf->b_menu_change = 0;
} }
if( p_intf->p_input != NULL ) /* update the playlist */
GtkPlayListManage( p_data );
if( p_intf->p_input != NULL && !p_intf->b_die )
{ {
/* Used by TS input when PMT changes */ /* New input or stream map change */
if( p_intf->p_input->stream.b_changed ) if( p_intf->p_input->stream.b_changed )
{ {
p_intf->p_sys->b_menus_update = 1; GtkModeManage( p_intf );
p_intf->p_input->stream.b_changed = 0;
intf_WarnMsg( 3,
"Interface menus refreshed as stream has changed" );
} }
} GtkSetupMenu( p_intf );
/* 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( /* Manage the slider */
p_intf->p_sys->p_window ), "menubar_title" ) ); if( p_intf->p_input->stream.b_seekable )
GtkTitleMenu( 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" ) );
GtkChapterMenu( 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" ) );
GtkTitleMenu( 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]->i_cat == AUDIO_ES ) float newvalue = p_intf->p_sys->p_adj->value;
#define p_area p_intf->p_input->stream.p_selected_area
/* If the user hasn't touched the slider since the last time,
* then the input can safely change it */
if( newvalue == p_intf->p_sys->f_adj_oldvalue )
{ {
p_audio_es = p_intf->p_input->stream.pp_es[i]; /* Update the value */
} p_intf->p_sys->p_adj->value = p_intf->p_sys->f_adj_oldvalue =
( 100. * p_area->i_tell ) / p_area->i_size;
if( p_intf->p_input->stream.pp_es[i]->i_cat == SPU_ES ) gtk_signal_emit_by_name( GTK_OBJECT( p_intf->p_sys->p_adj ),
"value_changed" );
}
/* Otherwise, send message to the input if the user has
* finished dragging the slider */
else if( p_intf->p_sys->b_slider_free )
{ {
p_spu_es = p_intf->p_input->stream.pp_es[i]; off_t i_seek = ( newvalue * p_area->i_size ) / 100;
input_Seek( p_intf->p_input, i_seek );
/* Update the old value */
p_intf->p_sys->f_adj_oldvalue = newvalue;
} }
#undef p_area
} }
/* 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" ) );
GtkLanguageMenus( p_intf, p_menubar_menu, p_audio_es, AUDIO_ES,
on_menubar_audio_activate );
GtkLanguageMenus( p_intf, p_popup_menu, p_audio_es, AUDIO_ES,
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_subpictures" ) );
p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_popup ), "popup_subpictures" ) );
GtkLanguageMenus( p_intf, p_menubar_menu, p_spu_es, SPU_ES,
on_menubar_subpictures_activate );
GtkLanguageMenus( p_intf, p_popup_menu, p_spu_es, SPU_ES,
on_popup_subpictures_activate );
/* everything is ready */
p_intf->p_sys->b_menus_update = 0;
} }
else if( !p_intf->b_die )
/* Manage the slider */
if( p_intf->p_input != NULL && p_intf->p_input->stream.b_seekable )
{ {
float newvalue = p_intf->p_sys->p_adj->value; GtkModeManage( p_intf );
#define p_area p_intf->p_input->stream.p_selected_area
/* If the user hasn't touched the slider since the last time,
* then the input can safely change it */
if( newvalue == p_intf->p_sys->f_adj_oldvalue )
{
/* Update the value */
p_intf->p_sys->p_adj->value = p_intf->p_sys->f_adj_oldvalue =
( 100. * p_area->i_tell ) / p_area->i_size;
gtk_signal_emit_by_name( GTK_OBJECT( p_intf->p_sys->p_adj ),
"value_changed" );
}
/* Otherwise, send message to the input if the user has
* finished dragging the slider */
else if( p_intf->p_sys->b_slider_free )
{
off_t i_seek = ( newvalue * p_area->i_size ) / 100;
input_Seek( p_intf->p_input, i_seek );
/* Update the old value */
p_intf->p_sys->f_adj_oldvalue = newvalue;
}
#undef p_area
} }
/* Manage core vlc functions through the callback */ /* Manage core vlc functions through the callback */
...@@ -458,310 +382,139 @@ static gint GtkManage( gpointer p_data ) ...@@ -458,310 +382,139 @@ static gint GtkManage( gpointer p_data )
} }
/***************************************************************************** /*****************************************************************************
* GtkMenuRadioItem: give a menu item adapted to language/title selection, * GtkDisplayDate: display stream date
* 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: * This function displays the current date related to the position in
* -languages * the stream. It is called whenever the slider changes its value.
* -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, void GtkDisplayDate( GtkAdjustment *p_adj )
GtkWidget * p_root,
es_descriptor_t * p_es,
gint i_cat,
void(*pf_activate )( GtkMenuItem *, gpointer ) )
{ {
intf_thread_t * p_intf; intf_thread_t *p_intf;
GtkWidget * p_menu;
GtkWidget * p_separator; p_intf = gtk_object_get_data( GTK_OBJECT( p_adj ), "p_intf" );
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 != NULL )
{ {
if( p_intf->p_input->stream.pp_es[i]->i_cat == i_cat ) #define p_area p_intf->p_input->stream.p_selected_area
{ char psz_time[ OFFSETTOTIME_MAX_SIZE ];
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 */ vlc_mutex_lock( &p_intf->p_input->stream.stream_lock );
gtk_widget_set_sensitive( p_root, TRUE );
vlc_mutex_unlock( &p_intf->p_input->stream.stream_lock ); gtk_frame_set_label( GTK_FRAME( p_intf->p_sys->p_slider_frame ),
input_OffsetToTime( p_intf->p_input, psz_time,
( p_area->i_size * p_adj->value ) / 100 ) );
return TRUE; vlc_mutex_unlock( &p_intf->p_input->stream.stream_lock );
#undef p_area
}
} }
/*****************************************************************************
* 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 * GtkModeManage
*****************************************************************************
* Generates two type of menus:
* -simple list of titles
* -cascaded lists of chapters for each title
*****************************************************************************/ *****************************************************************************/
static gint GtkTitleMenu( gpointer p_data, static gint GtkModeManage( intf_thread_t * p_intf )
GtkWidget * p_navigation,
void(*pf_activate )( GtkMenuItem *, gpointer ) )
{ {
intf_thread_t * p_intf; GtkWidget * p_dvd_box;
char psz_name[ GTK_MENU_LABEL_SIZE ]; GtkWidget * p_file_box;
GtkWidget * p_title_menu; GtkWidget * p_network_box;
GtkWidget * p_title_item; GtkWidget * p_slider;
GtkWidget * p_chapter_menu; GtkWidget * p_label;
GtkWidget * p_item; boolean_t b_control;
GSList * p_title_button_group;
GSList * p_chapter_button_group; #define GETWIDGET( ptr, name ) GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( \
gint i_title; p_intf->p_sys->ptr ) , ( name ) ) )
gint i_chapter; /* hide all boxes except default file box */
gint b_active; p_file_box = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_window ), "file_box" ) );
/* cast */ gtk_widget_hide( GTK_WIDGET( p_file_box ) );
p_intf = (intf_thread_t*)p_data;
p_network_box = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
p_title_menu = gtk_menu_new(); p_intf->p_sys->p_window ), "network_box" ) );
p_title_button_group = NULL; gtk_widget_hide( GTK_WIDGET( p_network_box ) );
p_chapter_button_group = NULL;
p_dvd_box = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
/* loop on titles */ p_intf->p_sys->p_window ), "dvd_box" ) );
for( i_title = 1 ; gtk_widget_hide( GTK_WIDGET( p_dvd_box ) );
i_title < p_intf->p_input->stream.i_area_nb ;
i_title++ ) /* hide slider */
p_slider = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_window ), "slider_frame" ) );
gtk_widget_hide( GTK_WIDGET( p_slider ) );
/* controls unavailable */
b_control = 0;
/* show the box related to current input mode */
if( p_intf->p_input != NULL )
{ {
b_active = ( p_intf->p_input->stream.pp_areas[i_title] == switch( p_intf->p_input->stream.i_method & 0xf0 )
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 */ case INPUT_METHOD_FILE:
gtk_signal_connect( GTK_OBJECT( p_title_item ), gtk_widget_show( GTK_WIDGET( p_file_box ) );
"activate", p_label = gtk_object_get_data( GTK_OBJECT(
GTK_SIGNAL_FUNC( pf_activate ), p_intf->p_sys->p_window ),
(gpointer)(p_intf->p_input->stream.pp_areas[i_title]) ); "label_status" );
gtk_label_set_text( GTK_LABEL( p_label ),
p_intf->p_input->p_source );
break;
case INPUT_METHOD_DISC:
gtk_widget_show( GTK_WIDGET( p_dvd_box ) );
break;
case INPUT_METHOD_NETWORK:
gtk_widget_show( GTK_WIDGET( p_network_box ) );
p_label = gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_window ),
"network_address_label" );
gtk_label_set_text( GTK_LABEL( p_label ),
p_intf->p_input->p_source );
break;
default:
intf_ErrMsg( "intf error: can't determine input method" );
break;
} }
else
{
p_chapter_menu = gtk_menu_new();
for( i_chapter = 0; /* slider for seekable streams */
i_chapter < if( p_intf->p_input->stream.b_seekable )
p_intf->p_input->stream.pp_areas[i_title]->i_part_nb ; {
i_chapter++ ) gtk_widget_show( GTK_WIDGET( p_slider ) );
{ }
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, /* control buttons for free pace streams */
&p_chapter_button_group, b_control = p_intf->p_input->stream.b_pace_control;
b_active, psz_name );
/* get ready for menu regeneration */
p_intf->p_sys->b_title_update = 1;
p_intf->p_sys->b_chapter_update = 1;
p_intf->p_sys->b_angle_update = 1;
p_intf->p_sys->b_audio_update = 1;
p_intf->p_sys->b_spu_update = 1;
p_intf->p_sys->i_part = 0;
/* setup signal hanling */ p_intf->p_input->stream.b_changed = 0;
gtk_signal_connect( GTK_OBJECT( p_item ), intf_WarnMsg( 3,
"activate", "intf info: menus refreshed as stream has changed" );
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 );
} }
else
/* 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 p_label = gtk_object_get_data( GTK_OBJECT( p_intf->p_sys->p_window ),
char psz_time[ OFFSETTOTIME_MAX_SIZE ]; "label_status" );
gtk_label_set_text( GTK_LABEL( p_label ), "" );
vlc_mutex_lock( &p_intf->p_input->stream.stream_lock ); gtk_widget_show( GTK_WIDGET( p_file_box ) );
}
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 ); /* set control items */
#undef p_area gtk_widget_set_sensitive( GETWIDGET(p_window, "toolbar_back"), FALSE );
} gtk_widget_set_sensitive( GETWIDGET(p_window, "toolbar_stop"), b_control );
gtk_widget_set_sensitive( GETWIDGET(p_window, "toolbar_pause"), b_control );
gtk_widget_set_sensitive( GETWIDGET(p_window, "toolbar_slow"), b_control );
gtk_widget_set_sensitive( GETWIDGET(p_window, "toolbar_fast"), b_control );
gtk_widget_set_sensitive( GETWIDGET(p_popup, "popup_back"), FALSE );
gtk_widget_set_sensitive( GETWIDGET(p_popup, "popup_stop"), b_control );
gtk_widget_set_sensitive( GETWIDGET(p_popup, "popup_pause"), b_control );
gtk_widget_set_sensitive( GETWIDGET(p_popup, "popup_slow"), b_control );
gtk_widget_set_sensitive( GETWIDGET(p_popup, "popup_fast"), b_control );
#undef GETWIDGET
return TRUE;
} }
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* intf_gtk.h: private Gtk+ interface description * intf_gtk.h: private Gtk+ interface description
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: intf_gtk.h,v 1.3 2001/05/06 18:32:30 stef Exp $ * $Id: intf_gtk.h,v 1.4 2001/05/15 01:01:44 stef Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -32,6 +32,13 @@ ...@@ -32,6 +32,13 @@
*****************************************************************************/ *****************************************************************************/
#define GTK_MENU_LABEL_SIZE 64 #define GTK_MENU_LABEL_SIZE 64
/*****************************************************************************
* Convert user_data structures to title and chapter information
*****************************************************************************/
#define DATA2TITLE( user_data ) ( (gint)(user_data) >> 16 )
#define DATA2CHAPTER( user_data ) ( (gint)(user_data) & 0xffff )
#define POS2DATA( title, chapter ) ( ((title) << 16) | ((chapter) & 0xffff) )
/***************************************************************************** /*****************************************************************************
* Useful inline function * Useful inline function
****************************************************************************/ ****************************************************************************/
...@@ -53,10 +60,13 @@ typedef struct intf_sys_s ...@@ -53,10 +60,13 @@ typedef struct intf_sys_s
boolean_t b_menus_update; /* menus have changed ? */ boolean_t b_menus_update; /* menus have changed ? */
boolean_t b_slider_free; /* slider status */ boolean_t b_slider_free; /* slider status */
int i_list_timeout; /* menus handlers */
boolean_t b_title_update; /* do we need to update title menus */
/* Playlist selected item */ boolean_t b_chapter_update; /* do we need to update
int i_playing; chapter menus */
boolean_t b_angle_update; /* do we need to update angle menus */
boolean_t b_audio_update; /* do we need to update audio menus */
boolean_t b_spu_update; /* do we need to update spu menus */
/* windows and widgets */ /* windows and widgets */
GtkWidget * p_window; /* main window */ GtkWidget * p_window; /* main window */
...@@ -67,15 +77,43 @@ typedef struct intf_sys_s ...@@ -67,15 +77,43 @@ typedef struct intf_sys_s
GtkWidget * p_fileopen; /* file open window */ GtkWidget * p_fileopen; /* file open window */
GtkWidget * p_disc; /* disc selection window */ GtkWidget * p_disc; /* disc selection window */
GtkWidget * p_network; /* network stream window */ GtkWidget * p_network; /* network stream window */
GtkWidget * p_preferences; /* preferences window */
GtkWidget * p_jump; /* jump window */
/* The slider */ /* The slider */
GtkFrame * p_slider_frame; GtkFrame * p_slider_frame;
GtkAdjustment * p_adj; /* slider adjustment object */ GtkAdjustment * p_adj; /* slider adjustment object */
float f_adj_oldvalue; /* previous value */ float f_adj_oldvalue; /* previous value */
/* Playlist management */
int i_playing; /* playlist selected item */
/* The window labels for DVD mode */
GtkLabel * p_label_title;
GtkLabel * p_label_chapter;
gint i_part; /* current chapter */
/* XXX: Ugly kludge, see intf_gnome.c */ /* XXX: Ugly kludge, see intf_gnome.c */
void ( *pf_gtk_callback ) ( void ); void ( *pf_gtk_callback ) ( void );
void ( *pf_gdk_callback ) ( void ); void ( *pf_gdk_callback ) ( void );
} intf_sys_t; } intf_sys_t;
/****************************************************************************
* Prototypes
****************************************************************************/
/*
* from gtk_menu.c
*/
gint GtkSetupMenu( intf_thread_t * );
/*
* from gtk_playlist.c
*/
void GtkDropDataReceived ( intf_thread_t *, GtkSelectionData *,
guint, int );
int GtkAppendList ( playlist_t *, int, GList * );
void GtkRebuildCList ( GtkCList *, playlist_t * );
void GtkPlayListManage ( intf_thread_t * );
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* aout_spdif: ac3 passthrough output * aout_spdif: ac3 passthrough output
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: aout_spdif.c,v 1.4 2001/05/07 03:14:09 stef Exp $ * $Id: aout_spdif.c,v 1.5 2001/05/15 01:01:44 stef Exp $
* *
* Authors: Michel Kaempf <maxx@via.ecp.fr> * Authors: Michel Kaempf <maxx@via.ecp.fr>
* Stphane Borel <stef@via.ecp.fr> * Stphane Borel <stef@via.ecp.fr>
...@@ -98,7 +98,9 @@ void aout_SpdifThread( aout_thread_t * p_aout ) ...@@ -98,7 +98,9 @@ void aout_SpdifThread( aout_thread_t * p_aout )
} }
else if( !AOUT_FIFO_ISEMPTY( p_aout->fifo[i_fifo] ) ) else if( !AOUT_FIFO_ISEMPTY( p_aout->fifo[i_fifo] ) )
{ {
vlc_mutex_unlock( &p_aout->fifo[i_fifo].data_lock ); // vlc_mutex_unlock( &p_aout->fifo[i_fifo].data_lock );
//fprintf(stderr, "delay %lld\n",p_aout->fifo[i_fifo].date[p_aout->fifo[i_fifo].l_start_frame] -mdate() );
/* play spdif frame to the external decoder */ /* play spdif frame to the external decoder */
p_aout->pf_play( p_aout, p_aout->pf_play( p_aout,
p_aout->fifo[i_fifo].buffer + p_aout->fifo[i_fifo].buffer +
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* interface, such as command line. * interface, such as command line.
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: interface.c,v 1.77 2001/05/07 03:14:09 stef Exp $ * $Id: interface.c,v 1.78 2001/05/15 01:01:44 stef Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* *
...@@ -154,20 +154,37 @@ static void intf_Manage( intf_thread_t *p_intf ) ...@@ -154,20 +154,37 @@ static void intf_Manage( intf_thread_t *p_intf )
/* If no stream is being played, try to find one */ /* If no stream is being played, try to find one */
if( p_intf->p_input == NULL && !p_intf->b_die ) if( p_intf->p_input == NULL && !p_intf->b_die )
{ {
/* Select the next playlist item */ if( !p_main->p_playlist->b_stopped )
intf_PlaylistNext( p_main->p_playlist );
if( p_main->p_playlist->i_index == -1 )
{ {
/* FIXME: wait for user to add stuff to playlist ? */ /* Select the next playlist item */
#if 0 intf_PlaylistNext( p_main->p_playlist );
p_intf->b_die = 1;
#endif /* don't loop by default: stop at playlist end */
if( p_main->p_playlist->i_index == -1 )
{
p_main->p_playlist->b_stopped = 1;
}
else
{
p_main->p_playlist->b_stopped = 0;
p_intf->p_input =
input_CreateThread( &p_main->p_playlist->current, NULL );
}
} }
else else
{ {
p_intf->p_input = /* playing has been stopped: we no longer need outputs */
input_CreateThread( &p_main->p_playlist->current, NULL ); if( p_aout_bank->i_count )
{
/* FIXME kludge that does not work with several outputs */
aout_DestroyThread( p_aout_bank->pp_aout[0], NULL );
p_aout_bank->i_count--;
}
if( p_vout_bank->i_count )
{
vout_DestroyThread( p_vout_bank->pp_vout[0], NULL );
p_vout_bank->i_count--;
}
} }
} }
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* intf_playlist.c : Playlist management functions * intf_playlist.c : Playlist management functions
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: intf_playlist.c,v 1.4 2001/05/07 03:14:09 stef Exp $ * $Id: intf_playlist.c,v 1.5 2001/05/15 01:01:44 stef Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -77,6 +77,7 @@ void intf_PlaylistInit ( playlist_t * p_playlist ) ...@@ -77,6 +77,7 @@ void intf_PlaylistInit ( playlist_t * p_playlist )
p_playlist->i_mode = PLAYLIST_FORWARD; p_playlist->i_mode = PLAYLIST_FORWARD;
p_playlist->i_seed = 0; p_playlist->i_seed = 0;
p_playlist->b_stopped = 0;
/* There is no current item */ /* There is no current item */
p_playlist->current.i_type = 0; p_playlist->current.i_type = 0;
...@@ -246,7 +247,9 @@ void intf_PlaylistDestroy( playlist_t * p_playlist ) ...@@ -246,7 +247,9 @@ void intf_PlaylistDestroy( playlist_t * p_playlist )
} }
/***************************************************************************** /*****************************************************************************
* intf_PlaylistJumpto * intf_PlaylistJumpto: go to a specified position in playlist.
*****************************************************************************
* Note that this function does NOT take the lock
*****************************************************************************/ *****************************************************************************/
void intf_PlaylistJumpto( playlist_t * p_playlist , int i_pos) void intf_PlaylistJumpto( playlist_t * p_playlist , int i_pos)
{ {
...@@ -260,10 +263,12 @@ void intf_PlaylistJumpto( playlist_t * p_playlist , int i_pos) ...@@ -260,10 +263,12 @@ void intf_PlaylistJumpto( playlist_t * p_playlist , int i_pos)
{ {
free( p_playlist->current.psz_name ); free( p_playlist->current.psz_name );
} }
p_playlist->current = p_playlist->p_item[ p_playlist->i_index ]; p_playlist->current = p_playlist->p_item[ p_playlist->i_index ];
p_playlist->current.psz_name p_playlist->current.psz_name
= strdup( p_playlist->current.psz_name ); = strdup( p_playlist->current.psz_name );
}
}
vlc_mutex_unlock( &p_playlist->change_lock ); vlc_mutex_unlock( &p_playlist->change_lock );
} }
......
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