1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright (C) 2000-2005 the VideoLAN team
5 * $Id: playlist.cpp 12582 2005-09-17 14:15:32Z zorglub $
7 * Authors: Clément Stenac <zorglub@videolan.org>
9 * This program is free software; you can redistribute it and/OR MODIFy
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
22 *****************************************************************************/
24 #include "dialogs/vlm/vlm_streampanel.hpp"
25 #include "dialogs/vlm/vlm_stream.hpp"
26 #include "dialogs/vlm/vlm_slider_manager.hpp"
28 #include "dialogs/vlm/vlm_panel.hpp"
30 #include "bitmaps/play.xpm"
31 #include "bitmaps/pause.xpm"
32 #include "bitmaps/stop.xpm"
33 #include "bitmaps/trash.xpm"
44 BEGIN_EVENT_TABLE( VLMBroadcastStreamPanel, wxPanel )
45 EVT_BUTTON( BPlay_Event, VLMBroadcastStreamPanel::OnPlay )
46 EVT_BUTTON( BStop_Event, VLMBroadcastStreamPanel::OnStop )
47 EVT_BUTTON( BEdit_Event, VLMBroadcastStreamPanel::OnEdit )
48 EVT_BUTTON( BTrash_Event, VLMBroadcastStreamPanel::OnTrash )
49 EVT_COMMAND_SCROLL( BSlider_Event, VLMBroadcastStreamPanel::OnSliderUpdate )
52 /***********************************************************************
54 ***********************************************************************/
55 VLMStreamPanel::VLMStreamPanel( intf_thread_t * _p_intf, wxWindow * _p_parent ):
56 wxPanel( _p_parent, -1, wxDefaultPosition, wxDefaultSize )
62 VLMStreamPanel::~VLMStreamPanel()
66 /***********************************************************************
68 ***********************************************************************/
69 VLMBroadcastStreamPanel::VLMBroadcastStreamPanel( intf_thread_t* _p_intf,
70 wxWindow *_p_parent , VLMBroadcastStream *_stream ):
71 VLMStreamPanel( _p_intf, _p_parent ),
74 wxStaticBox *box = new wxStaticBox( this, -1,
75 wxU( p_stream->p_media->psz_name ) );
77 wxStaticBoxSizer *box_sizer = new wxStaticBoxSizer( box, wxHORIZONTAL );
79 play_button = new wxBitmapButton( this, BPlay_Event,
80 wxBitmap( play_xpm ) );
81 play_button->SetToolTip( wxU(_("Play/Pause") ) );
82 box_sizer->Add( play_button, 0, wxEXPAND | wxALL, 5 );
84 wxBitmapButton *stop_button = new wxBitmapButton( this, BStop_Event,
85 wxBitmap( stop_xpm ) );
86 stop_button->SetToolTip( wxU(_("Stop") ) );
87 box_sizer->Add( stop_button, 0, wxEXPAND | wxALL, 5 );
89 p_slider = new wxSlider( this, BSlider_Event, 0, 0,
90 SLIDER_MAX_POS, wxDefaultPosition, wxDefaultSize );
92 box_sizer->Add( p_slider, 1, wxEXPAND | wxALL, 5 );
94 p_time = new wxStaticText( this, -1, wxU( "0:00:00 / 0:00:00") );
95 box_sizer->Add( p_time, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5 );
97 wxBitmapButton *edit_button = new wxBitmapButton( this, BEdit_Event,
98 wxBitmap( trash_xpm ) );
99 edit_button->SetToolTip( wxU( _("Edit") ) );
100 box_sizer->Add( edit_button, 0, wxEXPAND | wxALL , 5 );
102 wxBitmapButton *trash_button = new wxBitmapButton( this, BTrash_Event,
103 wxBitmap( trash_xpm ) );
104 trash_button->SetToolTip( wxU( _("Delete" ) ) );
105 box_sizer->Add( trash_button, 0, wxEXPAND | wxALL , 5 );
108 SetSizerAndFit( box_sizer );
110 p_sm = new VLMSliderManager( p_intf, this );
113 VLMBroadcastStreamPanel::~VLMBroadcastStreamPanel()
117 void VLMBroadcastStreamPanel::TogglePlayButton( int state )
119 if( state == PLAYING_S )
121 play_button->SetBitmapLabel( wxBitmap( pause_xpm ) );
123 if( state == PAUSE_S )
125 play_button->SetBitmapLabel( wxBitmap( play_xpm ) );
129 void VLMBroadcastStreamPanel::Update()
131 /* Update managed slider */
133 p_time->SetLabel( p_sm->time_string );
136 void VLMBroadcastStreamPanel::OnPlay( wxCommandEvent &event )
138 /* FIXME: Factorize input / VLM code here */
139 /* Handle multiple instance */
140 if( p_stream->p_media->i_instance > 0 &&
141 p_stream->p_media->instance[0]->p_input )
144 vlc_object_yield( p_stream->p_media->instance[0]->p_input );
145 var_Get( p_stream->p_media->instance[0]->p_input, "state", &val );
146 if( val.i_int != PAUSE_S )
154 val.i_int = PLAYING_S;
156 var_Set( p_stream->p_media->instance[0]->p_input, "state", val );
157 TogglePlayButton( val.i_int );
158 vlc_object_release( p_stream->p_media->instance[0]->p_input );
163 TogglePlayButton( PLAYING_S );
167 void VLMBroadcastStreamPanel::OnStop( wxCommandEvent &event )
172 void VLMBroadcastStreamPanel::OnEdit( wxCommandEvent &event )
174 VLMEditStreamFrame *p_frame =
175 new VLMEditStreamFrame( p_intf, this, p_stream->p_vlm, VLC_TRUE,
180 void VLMBroadcastStreamPanel::OnTrash( wxCommandEvent &event )
185 void VLMBroadcastStreamPanel::OnSliderUpdate( wxScrollEvent& event )
187 p_sm->ProcessUpdate( event );
190 /***********************************************************************
192 ***********************************************************************/
193 VLMVODStreamPanel::VLMVODStreamPanel( intf_thread_t* _p_intf,
194 wxWindow *_p_parent , VLMVODStream *_stream ):
195 VLMStreamPanel( _p_intf, _p_parent ),
200 VLMVODStreamPanel::~VLMVODStreamPanel()