* familiar.c : familiar plugin for vlc
*****************************************************************************
* Copyright (C) 2002 VideoLAN
- * $Id: familiar.c,v 1.22 2003/01/03 20:55:00 jpsaman Exp $
+ * $Id: familiar.c,v 1.31 2003/03/13 15:50:17 marcari Exp $
*
* Authors: Jean-Paul Saman <jpsaman@wxs.nl>
+ * Marc Ariberti <marcari@videolan.org>
*
* 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
* Module descriptor
*****************************************************************************/
vlc_module_begin();
- add_category_hint( N_("Miscellaneous"), NULL );
- add_bool( "familiar-autoplayfile", 1, GtkAutoPlayFile, AUTOPLAYFILE_TEXT, AUTOPLAYFILE_LONGTEXT );
+ add_category_hint( N_("Miscellaneous"), NULL, VLC_TRUE );
+ add_bool( "familiar-autoplayfile", 1, GtkAutoPlayFile, AUTOPLAYFILE_TEXT, AUTOPLAYFILE_LONGTEXT, VLC_TRUE );
set_description( _("Familiar Linux Gtk+ interface module") );
set_capability( "interface", 70 );
set_callbacks( Open, Close );
*****************************************************************************/
static void Run( intf_thread_t *p_intf )
{
-#ifndef NEED_GTK_MAIN
+#ifndef NEED_GTK_MAIN
/* gtk_init needs to know the command line. We don't care, so we
* give it an empty one */
char *p_args[] = { "" };
// FIXME: magic path
add_pixmap_directory("share");
add_pixmap_directory("/usr/share/vlc");
+ /* Path for pixmaps under linupy */
+ add_pixmap_directory("/usr/local/share/pixmaps/vlc");
+
+
+ /* Path for pixmaps under linupy */
+ add_pixmap_directory("/usr/local/share/pixmaps/vlc");
p_intf->p_sys->p_window = create_familiar();
if (p_intf->p_sys->p_window == NULL)
{
msg_Err( p_intf, "unable to create familiar interface" );
}
+ gtk_widget_set_usize(p_intf->p_sys->p_window,
+ gdk_screen_width() , gdk_screen_height() - 30 );
/* Set the title of the main window */
gtk_window_set_title( GTK_WINDOW(p_intf->p_sys->p_window),
p_intf->p_sys->p_notebook = GTK_NOTEBOOK( gtk_object_get_data(
GTK_OBJECT( p_intf->p_sys->p_window ), "notebook" ) );
+ p_intf->p_sys->p_mediabook = GTK_NOTEBOOK( gtk_object_get_data(
+ GTK_OBJECT( p_intf->p_sys->p_window ), "mediabook" ) );
/* Get the slider object */
p_intf->p_sys->p_slider = GTK_HSCALE( gtk_object_get_data(
gtk_signal_connect ( GTK_OBJECT( p_intf->p_sys->p_adj ), "value_changed",
GTK_SIGNAL_FUNC( E_(GtkDisplayDate) ), NULL );
p_intf->p_sys->f_adj_oldvalue = 0;
+ p_intf->p_sys->i_adj_oldvalue = 0;
#undef P_SLIDER
p_intf->p_sys->p_clist = GTK_CLIST( gtk_object_get_data(
gtk_clist_set_column_visibility (GTK_CLIST (p_intf->p_sys->p_clist), 4, FALSE);
gtk_clist_column_titles_show (GTK_CLIST (p_intf->p_sys->p_clist));
+ /* the playlist object */
+ p_intf->p_sys->p_clistplaylist = GTK_CLIST( gtk_object_get_data(
+ GTK_OBJECT( p_intf->p_sys->p_window ), "clistplaylist" ) );
+
+ p_intf->p_sys->p_mrlentry = GTK_ENTRY( gtk_object_get_data(
+ GTK_OBJECT( p_intf->p_sys->p_window ), "mrl_entry" ) );
+
/* Store p_intf to keep an eye on it */
gtk_object_set_data( GTK_OBJECT(p_intf->p_sys->p_window),
"p_intf", p_intf );
gtk_object_set_data( GTK_OBJECT(p_intf->p_sys->p_adj),
"p_intf", p_intf );
-
+
/* Show the control window */
gtk_widget_show( p_intf->p_sys->p_window );
- ReadDirectory(p_intf->p_sys->p_clist, "/mnt");
+ ReadDirectory(p_intf->p_sys->p_clist, ".");
+ /* update the playlist */
+ FamiliarRebuildCList( p_intf->p_sys->p_clistplaylist,
+ vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ));
+
#ifdef NEED_GTK_MAIN
msg_Dbg( p_intf, "Manage GTK keyboard events using threads" );
while( !p_intf->b_die )
/* Sleep to avoid using all CPU - since some interfaces need to
* access keyboard events, a 100ms delay is a good compromise */
gdk_threads_leave();
- msleep( INTF_IDLE_SLEEP );
+ if (p_intf->p_libvlc->i_cpu & CPU_CAPABILITY_FPU)
+ msleep( INTF_IDLE_SLEEP );
+ else
+ msleep( 1000 );
gdk_threads_enter();
}
#else
msg_Dbg( p_intf, "Manage GTK keyboard events using timeouts" );
/* Sleep to avoid using all CPU - since some interfaces needs to access
- * keyboard events, a 100ms delay is a good compromise */
- i_dummy = gtk_timeout_add( INTF_IDLE_SLEEP / 1000, (GtkFunction)Manage, p_intf );
+ * keyboard events, a 1000ms delay is a good compromise */
+ if (p_intf->p_libvlc->i_cpu & CPU_CAPABILITY_FPU)
+ i_dummy = gtk_timeout_add( INTF_IDLE_SLEEP / 1000, (GtkFunction)Manage, p_intf );
+ else
+ i_dummy = gtk_timeout_add( 1000, (GtkFunction)Manage, p_intf );
/* Enter Gtk mode */
gtk_main();
gtk_object_destroy( GTK_OBJECT(p_intf->p_sys->p_window) );
#ifdef NEED_GTK_MAIN
gdk_threads_leave();
-#else
- gtk_main_quit();
#endif
}
GtkWidget *cbautoplay;
intf_thread_t *p_intf;
int i_index;
- vlc_list_t list = vlc_list_find( p_this, VLC_OBJECT_INTF, FIND_ANYWHERE );
+ vlc_list_t *p_list = vlc_list_find( p_this, VLC_OBJECT_INTF,
+ FIND_ANYWHERE );
- for( i_index = 0; i_index < list.i_count; i_index++ )
+ for( i_index = 0; i_index < p_list->i_count; i_index++ )
{
- p_intf = (intf_thread_t *)list.p_values[i_index].p_object ;
+ p_intf = (intf_thread_t *)p_list->p_values[i_index].p_object ;
if( strcmp( MODULE_STRING, p_intf->p_module->psz_object_name ) )
{
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( cbautoplay ),
p_intf->p_sys->b_autoplayfile );
}
- vlc_list_release( &list );
+ vlc_list_release( p_list );
}
/* following functions are local */
/* New input or stream map change */
if( p_input->stream.b_changed )
{
+ playlist_t *p_playlist;
+
E_(GtkModeManage)( p_intf );
p_intf->p_sys->b_playing = 1;
+
+ /* update playlist interface */
+ p_playlist = (playlist_t *) vlc_object_find(
+ p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+ if (p_playlist != NULL)
+ {
+ FamiliarRebuildCList( p_intf->p_sys->p_clistplaylist,
+ p_playlist );
+ }
}
/* Manage the slider */
- if( p_input->stream.b_seekable && p_intf->p_sys->b_playing )
+ if (p_intf->p_libvlc->i_cpu & CPU_CAPABILITY_FPU)
{
- float newvalue = p_intf->p_sys->p_adj->value;
-
-#define p_area 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 )
+ /* Manage the slider for CPU_CAPABILITY_FPU hardware */
+ if( p_input->stream.b_seekable && p_intf->p_sys->b_playing )
{
- /* 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;
+ float newvalue = p_intf->p_sys->p_adj->value;
- gtk_signal_emit_by_name( GTK_OBJECT( p_intf->p_sys->p_adj ),
- "value_changed" );
+#define p_area 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;
+
+ /* release the lock to be able to seek */
+ vlc_mutex_unlock( &p_input->stream.stream_lock );
+ input_Seek( p_input, i_seek, INPUT_SEEK_SET );
+ vlc_mutex_lock( &p_input->stream.stream_lock );
+
+ /* Update the old value */
+ p_intf->p_sys->f_adj_oldvalue = newvalue;
+ }
+#undef p_area
}
- /* Otherwise, send message to the input if the user has
- * finished dragging the slider */
- else if( p_intf->p_sys->b_slider_free )
+ }
+ else
+ {
+ /* Manage the slider without CPU_CAPABILITY_FPU hardware */
+ if( p_input->stream.b_seekable && p_intf->p_sys->b_playing )
{
- off_t i_seek = ( newvalue * p_area->i_size ) / 100;
-
- /* release the lock to be able to seek */
- vlc_mutex_unlock( &p_input->stream.stream_lock );
- input_Seek( p_input, i_seek, INPUT_SEEK_SET );
- vlc_mutex_lock( &p_input->stream.stream_lock );
+ off_t newvalue = p_intf->p_sys->p_adj->value;
- /* Update the old value */
- p_intf->p_sys->f_adj_oldvalue = newvalue;
- }
+#define p_area 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->i_adj_oldvalue )
+ {
+ /* Update the value */
+ p_intf->p_sys->p_adj->value =
+ p_intf->p_sys->i_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;
+
+ /* release the lock to be able to seek */
+ vlc_mutex_unlock( &p_input->stream.stream_lock );
+ input_Seek( p_input, i_seek, INPUT_SEEK_SET );
+ vlc_mutex_lock( &p_input->stream.stream_lock );
+
+ /* Update the old value */
+ p_intf->p_sys->i_adj_oldvalue = newvalue;
+ }
#undef p_area
+ }
}
}
vlc_mutex_unlock( &p_input->stream.stream_lock );
/* initialize and show slider for seekable streams */
if( p_intf->p_sys->p_input->stream.b_seekable )
{
- p_intf->p_sys->p_adj->value = p_intf->p_sys->f_adj_oldvalue = 0;
+ if (p_intf->p_libvlc->i_cpu & CPU_CAPABILITY_FPU)
+ p_intf->p_sys->p_adj->value = p_intf->p_sys->f_adj_oldvalue = 0;
+ else
+ p_intf->p_sys->p_adj->value = p_intf->p_sys->i_adj_oldvalue = 0;
gtk_signal_emit_by_name( GTK_OBJECT( p_intf->p_sys->p_adj ),
"value_changed" );
gtk_widget_show( GTK_WIDGET( p_slider ) );