* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
+#define MODULE_NAME gnome
+#include "modules_inner.h"
+
/*****************************************************************************
* Preamble
*****************************************************************************/
#include "interface.h"
#include "intf_plst.h"
+#include "intf_msg.h"
#include "gnome_sys.h"
#include "gnome_callbacks.h"
if( p_intf->p_input != NULL )
{
- input_SetRate( p_intf->p_input, INPUT_RATE_PLAY );
+ input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
}
}
if( p_intf->p_input != NULL )
{
- input_SetRate( p_intf->p_input, INPUT_RATE_PAUSE );
+ input_SetStatus( p_intf->p_input, INPUT_STATUS_PAUSE );
}
}
if( p_intf->p_input != NULL )
{
- input_SetRate( p_intf->p_input, INPUT_RATE_PLAY );
+ input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
}
}
if( p_intf->p_input != NULL )
{
- input_SetRate( p_intf->p_input, INPUT_RATE_PAUSE );
+ input_SetStatus( p_intf->p_input, INPUT_STATUS_PAUSE );
}
}
if( p_intf->p_input != NULL )
{
- input_SetRate( p_intf->p_input, INPUT_RATE_SLOWER );
+ input_SetStatus( p_intf->p_input, INPUT_STATUS_SLOWER );
}
}
if( p_intf->p_input != NULL )
{
- input_SetRate( p_intf->p_input, INPUT_RATE_FASTER );
+ input_SetStatus( p_intf->p_input, INPUT_STATUS_FASTER );
}
}
if( p_intf->p_input != NULL )
{
- input_SetRate( p_intf->p_input, INPUT_RATE_SLOWER );
+ input_SetStatus( p_intf->p_input, INPUT_STATUS_SLOWER );
}
}
if( p_intf->p_input != NULL )
{
- input_SetRate( p_intf->p_input, INPUT_RATE_FASTER );
+ input_SetStatus( p_intf->p_input, INPUT_STATUS_FASTER );
}
}
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), "intf_window" );
GtkAdjustment *p_adj = gtk_range_get_adjustment( GTK_RANGE(widget) );
- off_t i_seek = (p_adj->value * p_intf->p_input->stream.i_size) / 100;
+ off_t i_seek;
vlc_mutex_lock( &p_intf->p_sys->change_lock );
- p_intf->p_sys->b_scale_isfree = 1;
if( p_intf->p_input != NULL )
{
+ i_seek = (p_adj->value *
+ p_intf->p_input->stream.p_selected_area->i_size) / 100;
input_Seek( p_intf->p_input, i_seek );
}
+ p_intf->p_sys->b_scale_isfree = 1;
vlc_mutex_unlock( &p_intf->p_sys->change_lock );
gdk_window_raise( p_intf->p_sys->p_modules->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)
+{
+ 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( 1, "intf: dropped text/uri-list data `%s'", psz_text );
+ intf_PlstAdd( 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( 1, "intf: dropped text/uri-list data `%s'", psz_text );
+ intf_PlstAdd( p_main->p_playlist, PLAYLIST_END, psz_text );
+ break;
+
+ default:
+
+ intf_ErrMsg( "intf error: unknown dropped type");
+ break;
+ }
+}
+
+
+void
+on_menubar_disc_activate (GtkMenuItem *menuitem,
+ gpointer user_data)
+{
+ intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
+
+ 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 );
+}
+
+
+void
+on_toolbar_disc_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_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 );
+}
+
+
+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(button), "disc_name" ) ) );
+
+ /* "dvd:foo" has size 5 + strlen(foo) */
+ 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_PlstAdd( p_main->p_playlist, PLAYLIST_END, psz_source );
+
+ gtk_widget_hide( p_intf->p_sys->p_disc );
+}
+
+
+void
+on_disc_cancel_clicked (GtkButton *button,
+ gpointer user_data)
+{
+ intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_disc" );
+
+ gtk_widget_hide( p_intf->p_sys->p_disc );
+}
+
+
+void
+on_disc_dvd_toggled (GtkToggleButton *togglebutton,
+ gpointer user_data)
+{
+ if( togglebutton->active )
+ {
+ gtk_entry_set_text( GTK_ENTRY( lookup_widget(
+ GTK_WIDGET(togglebutton), "disc_name" ) ), "/dev/dvd" );
+ }
+}
+
+
+void
+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" );
+ }
+}
+
+
+void
+on_popup_disc_activate (GtkMenuItem *menuitem,
+ gpointer user_data)
+{
+ intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
+
+ 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 );
+}
+
+
+void
+on_popup_audio_toggle (GtkCheckMenuItem *menuitem,
+ gpointer user_data)
+{
+ if( menuitem->active )
+ {
+ intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
+ es_descriptor_t * p_es;
+
+ p_es = (es_descriptor_t*)user_data;
+
+ input_ChangeES( p_intf->p_input, p_es, 1 );
+ }
+}
+
+
+void
+on_popup_subtitle_toggle (GtkCheckMenuItem *menuitem,
+ gpointer user_data)
+{
+ if( menuitem->active )
+ {
+ intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
+ es_descriptor_t * p_es;
+
+ p_es = (es_descriptor_t*)user_data;
+
+ input_ChangeES( p_intf->p_input, p_es, 2 );
+ }
+}
+
+
+void
+on_menubar_audio_toggle (GtkCheckMenuItem *menuitem,
+ gpointer user_data)
+{
+ if( menuitem->active )
+ {
+ intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
+ es_descriptor_t * p_es;
+
+ p_es = (es_descriptor_t*)user_data;
+
+ input_ChangeES( p_intf->p_input, p_es, 1 );
+ }
+}
+
+
+void
+on_menubar_subtitle_toggle (GtkCheckMenuItem *menuitem,
+ gpointer user_data)
+{
+ if( menuitem->active )
+ {
+ intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
+ es_descriptor_t * p_es;
+
+ p_es = (es_descriptor_t*)user_data;
+
+ input_ChangeES( p_intf->p_input, p_es, 2 );
+ }
+}
+
+
+void
+on_popup_navigation_toggle (GtkCheckMenuItem *menuitem,
+ gpointer user_data)
+{
+ if( menuitem->active )
+ {
+ intf_thread_t * p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
+ input_area_t * p_area;
+ gint i_title;
+ gint i_chapter;
+
+ i_title = (gint)(user_data) / 100 ;
+ i_chapter = (gint)(user_data) - ( 100 * i_title );
+
+ if( i_title != p_intf->p_input->stream.p_selected_area->i_id )
+ {
+ p_intf->p_sys->b_menus_update = 1;
+ }
+
+ p_area = p_intf->p_input->stream.pp_areas[i_title];
+ p_area->i_part = i_chapter;
+
+ p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)p_area );
+ input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
+ }
+}
+
+
+void
+on_menubar_title_toggle (GtkCheckMenuItem *menuitem,
+ gpointer user_data)
+{
+ if( menuitem->active )
+ {
+ intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
+
+ p_intf->p_input->pf_set_area( p_intf->p_input,
+ (input_area_t*)user_data );
+ p_intf->p_sys->b_menus_update = 1;
+ input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
+ }
+}
+
+
+void
+on_menubar_chapter_toggle (GtkCheckMenuItem *menuitem,
+ gpointer user_data)
+{
+ if( menuitem->active )
+ {
+ intf_thread_t * p_intf = GetIntf( GTK_WIDGET(menuitem),
+ "intf_window" );
+ input_area_t * p_area = p_intf->p_input->stream.p_selected_area;
+ gint i_chapter = (gint)user_data;
+
+ p_area->i_part = i_chapter;
+
+ p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)p_area );
+ input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
+ }
+}