1
/*****************************************************************************
2
* gtk_control.c : functions to handle stream control buttons.
3
*****************************************************************************
4
* Copyright (C) 2000, 2001 VideoLAN
5
* $Id: gtk_control.c,v 1.7 2001/12/07 18:33:07 sam Exp $
7
* Authors: Samuel Hocevar <sam@zoy.org>
8
* St�phane Borel <stef@via.ecp.fr>
10
* This program is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; either version 2 of the License, or
13
* (at your option) any later version.
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU General Public License for more details.
20
* You should have received a copy of the GNU General Public License
21
* along with this program; if not, write to the Free Software
22
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
23
*****************************************************************************/
25
/*****************************************************************************
27
*****************************************************************************/
29
#include <sys/types.h> /* off_t */
34
#if ( MODULE_NAME == gtk )
36
#elif ( MODULE_NAME == gnome )
49
#include "stream_control.h"
50
#include "input_ext-intf.h"
52
#include "interface.h"
53
#include "intf_playlist.h"
55
#include "gtk_callbacks.h"
56
#include "gtk_interface.h"
57
#include "gtk_support.h"
58
#include "gtk_playlist.h"
61
#include "modules_export.h"
63
/****************************************************************************
64
* Control functions: this is where the functions are defined
65
****************************************************************************
66
* These functions are button-items callbacks, and are used
68
****************************************************************************/
69
gboolean GtkControlBack( GtkWidget *widget,
70
GdkEventButton *event,
78
gboolean GtkControlStop( GtkWidget *widget,
79
GdkEventButton *event,
82
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
84
if( p_intf->p_input != NULL )
86
/* end playing item */
87
p_intf->p_input->b_eof = 1;
90
vlc_mutex_lock( &p_main->p_playlist->change_lock );
92
p_main->p_playlist->i_index--;
93
p_main->p_playlist->b_stopped = 1;
95
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
103
gboolean GtkControlPlay( GtkWidget *widget,
104
GdkEventButton *event,
107
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
109
if( p_intf->p_input != NULL )
111
input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
112
p_main->p_playlist->b_stopped = 0;
116
vlc_mutex_lock( &p_main->p_playlist->change_lock );
118
if( p_main->p_playlist->b_stopped )
120
if( p_main->p_playlist->i_size )
122
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
123
intf_PlaylistJumpto( p_main->p_playlist,
124
p_main->p_playlist->i_index );
128
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
129
GtkFileOpenShow( widget, event, user_data );
135
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
144
gboolean GtkControlPause( GtkWidget *widget,
145
GdkEventButton *event,
148
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
150
if( p_intf->p_input != NULL )
152
input_SetStatus( p_intf->p_input, INPUT_STATUS_PAUSE );
154
vlc_mutex_lock( &p_main->p_playlist->change_lock );
155
p_main->p_playlist->b_stopped = 0;
156
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
163
gboolean GtkControlSlow( GtkWidget *widget,
164
GdkEventButton *event,
167
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
169
if( p_intf->p_input != NULL )
171
input_SetStatus( p_intf->p_input, INPUT_STATUS_SLOWER );
173
vlc_mutex_lock( &p_main->p_playlist->change_lock );
174
p_main->p_playlist->b_stopped = 0;
175
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
182
gboolean GtkControlFast( GtkWidget *widget,
183
GdkEventButton *event,
186
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
188
if( p_intf->p_input != NULL )
190
input_SetStatus( p_intf->p_input, INPUT_STATUS_FASTER );
192
vlc_mutex_lock( &p_main->p_playlist->change_lock );
193
p_main->p_playlist->b_stopped = 0;
194
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
201
/****************************************************************************
202
* Control callbacks for menuitems
203
****************************************************************************
204
* We have different callaback for menuitem since we must use the
205
* activate signal toi popdown the menu automatically
206
****************************************************************************/
207
void GtkPlayActivate( GtkMenuItem * menuitem, gpointer user_data )
209
GtkControlPlay( GTK_WIDGET( menuitem ), NULL, user_data );
213
void GtkPauseActivate( GtkMenuItem * menuitem, gpointer user_data )
215
GtkControlPause( GTK_WIDGET( menuitem ), NULL, user_data );
221
GtKStopActivate (GtkMenuItem *menuitem,
224
GtkControlStop( GTK_WIDGET( menuitem ), NULL, user_data );
230
GtkBackActivate (GtkMenuItem *menuitem,
233
GtkControlBack( GTK_WIDGET( menuitem ), NULL, user_data );
239
GtkSlowActivate (GtkMenuItem *menuitem,
242
GtkControlSlow( GTK_WIDGET( menuitem ), NULL, user_data );
248
GtkFastActivate (GtkMenuItem *menuitem,
251
GtkControlFast( GTK_WIDGET( menuitem ), NULL, user_data );