1 /*****************************************************************************
2 * interface.cpp : wxWindows plugin for vlc
3 *****************************************************************************
4 * Copyright (C) 2000-2001 VideoLAN
5 * $Id: interface.cpp,v 1.31 2003/05/20 23:17:59 gbazin Exp $
7 * Authors: Gildas Bazin <gbazin@netcourrier.com>
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 /*****************************************************************************
26 *****************************************************************************/
27 #include <stdlib.h> /* malloc(), free() */
28 #include <errno.h> /* ENOMEM */
29 #include <string.h> /* strerror() */
34 #ifdef WIN32 /* mingw32 hack */
39 /* Let vlc take care of the i18n stuff */
40 #define WXINTL_NO_GETTEXT_MACRO
42 #include <wx/wxprec.h>
46 #include "stream_control.h"
48 #include "wxwindows.h"
50 /* include the toolbar graphics */
51 #include "bitmaps/file.xpm"
52 #include "bitmaps/disc.xpm"
53 #include "bitmaps/net.xpm"
55 #include "bitmaps/sat.xpm"
57 #include "bitmaps/play.xpm"
58 #include "bitmaps/pause.xpm"
59 #include "bitmaps/stop.xpm"
60 #include "bitmaps/previous.xpm"
61 #include "bitmaps/next.xpm"
62 #include "bitmaps/playlist.xpm"
63 #include "bitmaps/fast.xpm"
64 #include "bitmaps/slow.xpm"
66 #define TOOLBAR_BMP_WIDTH 36
67 #define TOOLBAR_BMP_HEIGHT 36
69 /* include the icon graphic */
70 #include "share/vlc32x32.xpm"
72 /*****************************************************************************
73 * Local class declarations.
74 *****************************************************************************/
75 class wxMenuExt: public wxMenu
79 wxMenuExt( wxMenu* parentMenu, int id, const wxString& text,
80 const wxString& helpString, wxItemKind kind,
81 char *_psz_var, int _i_object_id, vlc_value_t _val,
84 virtual ~wxMenuExt() {};
95 /*****************************************************************************
97 *****************************************************************************/
99 /* IDs for the controls and the menu commands */
103 Exit_Event = wxID_HIGHEST,
124 /* it is important for the id corresponding to the "About" command to have
125 * this standard value as otherwise it won't be handled properly under Mac
126 * (where it is special and put into the "Apple" menu) */
127 About_Event = wxID_ABOUT
130 BEGIN_EVENT_TABLE(Interface, wxFrame)
132 EVT_MENU(Exit_Event, Interface::OnExit)
133 EVT_MENU(About_Event, Interface::OnAbout)
134 EVT_MENU(Playlist_Event, Interface::OnPlaylist)
135 EVT_MENU(Logs_Event, Interface::OnLogs)
136 EVT_MENU(FileInfo_Event, Interface::OnFileInfo)
137 EVT_MENU(Prefs_Event, Interface::OnPreferences)
139 EVT_MENU_OPEN(Interface::OnMenuOpen)
141 #if defined( __WXMSW__ ) || defined( __WXMAC__ )
142 EVT_CONTEXT_MENU(Interface::OnContextMenu)
144 EVT_RIGHT_UP(Interface::OnContextMenu)
148 EVT_MENU(OpenFile_Event, Interface::OnOpenFile)
149 EVT_MENU(OpenDisc_Event, Interface::OnOpenDisc)
150 EVT_MENU(OpenNet_Event, Interface::OnOpenNet)
151 EVT_MENU(OpenSat_Event, Interface::OnOpenSat)
152 EVT_MENU(StopStream_Event, Interface::OnStopStream)
153 EVT_MENU(PlayStream_Event, Interface::OnPlayStream)
154 EVT_MENU(PrevStream_Event, Interface::OnPrevStream)
155 EVT_MENU(NextStream_Event, Interface::OnNextStream)
156 EVT_MENU(SlowStream_Event, Interface::OnSlowStream)
157 EVT_MENU(FastStream_Event, Interface::OnFastStream)
160 EVT_COMMAND_SCROLL(SliderScroll_Event, Interface::OnSliderUpdate)
163 /*****************************************************************************
165 *****************************************************************************/
166 Interface::Interface( intf_thread_t *_p_intf ):
167 wxFrame( NULL, -1, wxT(VOUT_TITLE),
168 wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE )
170 /* Initializations */
172 p_prefs_dialog = NULL;
173 i_old_playing_status = PAUSE_S;
174 p_open_dialog = NULL;
176 /* Give our interface a nice little icon */
177 p_intf->p_sys->p_icon = new wxIcon( vlc_xpm );
178 SetIcon( *p_intf->p_sys->p_icon );
180 /* Create a sizer for the main frame */
181 frame_sizer = new wxBoxSizer( wxHORIZONTAL );
182 SetSizer( frame_sizer );
184 /* Creation of the menu bar */
187 /* Creation of the tool bar */
190 /* Creation of the slider sub-window */
192 frame_sizer->Add( slider_frame, 1, wxGROW, 0 );
193 frame_sizer->Hide( slider_frame );
195 /* Creation of the status bar
196 * Helptext for menu items and toolbar tools will automatically get
198 int i_status_width[3] = {-6, -2, -9};
199 statusbar = CreateStatusBar( 3 ); /* 2 fields */
200 statusbar->SetStatusWidths( 3, i_status_width );
201 statusbar->SetStatusText( wxString::Format(wxT("x%.2f"), 1.0), 1 );
204 /* Make sure we've got the right background colour */
205 SetBackgroundColour( slider_frame->GetBackgroundColour() );
207 /* Layout everything */
208 SetAutoLayout( TRUE );
209 frame_sizer->Layout();
210 frame_sizer->Fit(this);
212 #if !defined(__WXX11__)
213 /* Associate drop targets with the main interface */
214 SetDropTarget( new DragAndDrop( p_intf ) );
218 Interface::~Interface()
221 if( p_open_dialog ) delete p_open_dialog;
222 if( p_prefs_dialog ) p_prefs_dialog->Destroy();
225 /*****************************************************************************
227 *****************************************************************************/
228 void Interface::CreateOurMenuBar()
230 #define HELP_FILE N_("Open a file")
231 #define HELP_DISC N_("Open a DVD or (S)VCD")
232 #define HELP_NET N_("Open a network stream")
233 #define HELP_SAT N_("Open a satellite stream")
234 #define HELP_EJECT N_("Eject the DVD/CD")
235 #define HELP_EXIT N_("Exit this program")
237 #define HELP_PLAYLIST N_("Open the playlist")
238 #define HELP_LOGS N_("Show the program logs")
239 #define HELP_FILEINFO N_("Show information about the file being played")
241 #define HELP_PREFS N_("Go to the preferences menu")
243 #define HELP_ABOUT N_("About this program")
245 /* Create the "File" menu */
246 wxMenu *file_menu = new wxMenu;
247 file_menu->Append( OpenFile_Event, wxU(_("&Open File...")),
249 file_menu->Append( OpenDisc_Event, wxU(_("Open &Disc...")),
251 file_menu->Append( OpenNet_Event, wxU(_("&Network Stream...")),
254 file_menu->Append( OpenSat_Event, wxU(_("&Satellite Stream...")),
258 file_menu->AppendSeparator();
259 file_menu->Append( EjectDisc_Event, wxU(_("&Eject Disc")),
260 wxU(_(HELP_EJECT)) );
262 file_menu->AppendSeparator();
263 file_menu->Append( Exit_Event, wxU(_("E&xit")), wxU(_(HELP_EXIT)) );
265 /* Create the "View" menu */
266 wxMenu *view_menu = new wxMenu;
267 view_menu->Append( Playlist_Event, wxU(_("&Playlist...")),
268 wxU(_(HELP_PLAYLIST)) );
269 view_menu->Append( Logs_Event, wxU(_("&Logs...")), wxU(_(HELP_LOGS)) );
270 view_menu->Append( FileInfo_Event, wxU(_("&File info...")),
271 wxU(_(HELP_FILEINFO)) );
273 /* Create the "Settings" menu */
274 wxMenu *settings_menu = new wxMenu;
275 settings_menu->Append( Prefs_Event, wxU(_("&Preferences...")),
276 wxU(_(HELP_PREFS)) );
278 /* Create the "Audio" menu */
279 p_audio_menu = new wxMenu;
282 /* Create the "Video" menu */
283 p_video_menu = new wxMenu;
286 /* Create the "Navigation" menu */
287 p_navig_menu = new wxMenu;
290 /* Create the "Help" menu */
291 wxMenu *help_menu = new wxMenu;
292 help_menu->Append( About_Event, wxU(_("&About...")), wxU(_(HELP_ABOUT)) );
294 /* Append the freshly created menus to the menu bar... */
295 wxMenuBar *menubar = new wxMenuBar( wxMB_DOCKABLE );
296 menubar->Append( file_menu, wxU(_("&File")) );
297 menubar->Append( view_menu, wxU(_("&View")) );
298 menubar->Append( settings_menu, wxU(_("&Settings")) );
299 menubar->Append( p_audio_menu, wxU(_("&Audio")) );
300 menubar->Append( p_video_menu, wxU(_("&Video")) );
301 menubar->Append( p_navig_menu, wxU(_("&Navigation")) );
302 menubar->Append( help_menu, wxU(_("&Help")) );
304 /* Attach the menu bar to the frame */
305 SetMenuBar( menubar );
307 /* Intercept all menu events in our custom event handler */
308 PushEventHandler( new MenuEvtHandler( p_intf, this ) );
310 #if !defined(__WXX11__)
311 /* Associate drop targets with the menubar */
312 menubar->SetDropTarget( new DragAndDrop( p_intf ) );
316 void Interface::CreateOurToolBar()
318 #define HELP_STOP N_("Stop current playlist item")
319 #define HELP_PLAY N_("Play current playlist item")
320 #define HELP_PAUSE N_("Pause current playlist item")
321 #define HELP_PLO N_("Open playlist")
322 #define HELP_PLP N_("Previous playlist item")
323 #define HELP_PLN N_("Next playlist item")
324 #define HELP_SLOW N_("Play slower")
325 #define HELP_FAST N_("Play faster")
327 wxLogNull LogDummy; /* Hack to suppress annoying log message on the win32
328 * version because we don't include wx.rc */
330 wxToolBar *toolbar = CreateToolBar(
331 wxTB_HORIZONTAL | wxTB_FLAT | wxTB_DOCKABLE );
333 toolbar->SetToolBitmapSize( wxSize(TOOLBAR_BMP_WIDTH,TOOLBAR_BMP_HEIGHT) );
335 toolbar->AddTool( OpenFile_Event, wxU(_("File")), wxBitmap( file_xpm ),
337 toolbar->AddTool( OpenDisc_Event, wxU(_("Disc")), wxBitmap( disc_xpm ),
339 toolbar->AddTool( OpenNet_Event, wxU(_("Net")), wxBitmap( net_xpm ),
342 toolbar->AddTool( OpenSat_Event, wxU(_("Sat")), wxBitmap( sat_xpm ),
345 toolbar->AddSeparator();
346 toolbar->AddTool( StopStream_Event, wxU(_("Stop")), wxBitmap( stop_xpm ),
348 toolbar->AddTool( PlayStream_Event, wxU(_("Play")), wxBitmap( play_xpm ),
350 toolbar->AddSeparator();
351 toolbar->AddTool( Playlist_Event, wxU(_("Playlist")),
352 wxBitmap( playlist_xpm ), wxU(_(HELP_PLO)) );
353 toolbar->AddTool( PrevStream_Event, wxU(_("Prev")),
354 wxBitmap( previous_xpm ), wxU(_(HELP_PLP)) );
355 toolbar->AddTool( NextStream_Event, wxU(_("Next")), wxBitmap( next_xpm ),
357 toolbar->AddTool( SlowStream_Event, wxU(_("Slower")), wxBitmap( slow_xpm ),
359 toolbar->AddTool( FastStream_Event, wxU(_("Faster")), wxBitmap( fast_xpm ),
364 /* Place the toolbar in a sizer, so we can calculate the width of the
365 * toolbar and set this as the minimum for the main frame size. */
366 wxBoxSizer *toolbar_sizer = new wxBoxSizer( wxHORIZONTAL );
367 toolbar_sizer->Add( toolbar, 0, 0, 0 );
368 toolbar_sizer->Layout();
371 frame_sizer->SetMinSize( toolbar_sizer->GetMinSize().GetWidth(), -1 );
373 frame_sizer->SetMinSize( toolbar->GetToolSize().GetWidth() *
374 toolbar->GetToolsCount(), -1 );
377 #if !defined(__WXX11__)
378 /* Associate drop targets with the toolbar */
379 toolbar->SetDropTarget( new DragAndDrop( p_intf ) );
383 void Interface::CreateOurSlider()
385 /* Create a new frame containing the slider */
386 slider_frame = new wxPanel( this, -1, wxDefaultPosition, wxDefaultSize );
387 slider_frame->SetAutoLayout( TRUE );
389 /* Create static box to surround the slider */
390 slider_box = new wxStaticBox( slider_frame, -1, wxT("") );
392 /* Create sizer for slider frame */
393 wxStaticBoxSizer *slider_sizer =
394 new wxStaticBoxSizer( slider_box, wxHORIZONTAL );
395 slider_frame->SetSizer( slider_sizer );
396 slider_sizer->SetMinSize( -1, 50 );
399 slider = new wxSlider( slider_frame, SliderScroll_Event, 0, 0,
400 SLIDER_MAX_POS, wxDefaultPosition, wxDefaultSize );
401 slider_sizer->Add( slider, 1, wxGROW | wxALL, 5 );
402 slider_sizer->Layout();
403 slider_sizer->SetSizeHints(slider_frame);
405 /* Hide the slider by default */
406 slider_frame->Hide();
409 void Interface::Open( int i_access_method )
411 /* Show/hide the open dialog */
412 if( p_open_dialog == NULL )
413 p_open_dialog = new OpenDialog( p_intf, this, i_access_method );
415 if( p_open_dialog && p_open_dialog->ShowModal() == wxID_OK )
417 /* Update the playlist */
418 playlist_t *p_playlist =
419 (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
421 if( p_playlist == NULL )
426 for( size_t i = 0; i < p_open_dialog->mrl.GetCount(); i++ )
428 playlist_Add( p_playlist,
429 (const char *)p_open_dialog->mrl[i].mb_str(),
430 PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO), PLAYLIST_END );
433 TogglePlayButton( PLAYING_S );
435 vlc_object_release( p_playlist );
439 /*****************************************************************************
441 *****************************************************************************/
442 /* Work-around helper for buggy wxGTK */
443 void RecursiveDestroy( wxMenu *menu )
445 wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst();
448 wxMenuItem *item = node->GetData();
449 node = node->GetNext();
451 /* Delete the submenus */
452 wxMenu *submenu = item->GetSubMenu();
455 RecursiveDestroy( submenu );
457 menu->Delete( item );
461 void Interface::OnMenuOpen(wxMenuEvent& event)
463 #if !defined( __WXMSW__ )
464 if( event.GetEventObject() == p_audio_menu )
468 p_audio_menu = AudioMenu( p_intf, this );
470 /* Work-around for buggy wxGTK */
471 wxMenu *menu = GetMenuBar()->GetMenu( 3 );
472 RecursiveDestroy( menu );
473 /* End work-around */
476 GetMenuBar()->Replace( 3, p_audio_menu, wxU(_("&Audio")) );
477 if( menu ) delete menu;
481 else b_audio_menu = 1;
483 else if( event.GetEventObject() == p_video_menu )
487 p_video_menu = VideoMenu( p_intf, this );
489 /* Work-around for buggy wxGTK */
490 wxMenu *menu = GetMenuBar()->GetMenu( 4 );
491 RecursiveDestroy( menu );
492 /* End work-around */
495 GetMenuBar()->Replace( 4, p_video_menu, wxU(_("&Video")) );
496 if( menu ) delete menu;
500 else b_video_menu = 1;
502 else if( event.GetEventObject() == p_navig_menu )
506 p_navig_menu = NavigMenu( p_intf, this );
508 /* Work-around for buggy wxGTK */
509 wxMenu *menu = GetMenuBar()->GetMenu( 5 );
510 RecursiveDestroy( menu );
511 /* End work-around */
514 GetMenuBar()->Replace( 5, p_navig_menu, wxU(_("&Navigation")));
515 if( menu ) delete menu;
519 else b_navig_menu = 1;
523 p_audio_menu = AudioMenu( p_intf, this );
524 wxMenu *menu = GetMenuBar()->Replace( 3, p_audio_menu, wxU(_("&Audio")) );
525 if( menu ) delete menu;
527 p_video_menu = VideoMenu( p_intf, this );
528 menu = GetMenuBar()->Replace( 4, p_video_menu, wxU(_("&Video")) );
529 if( menu ) delete menu;
531 p_navig_menu = NavigMenu( p_intf, this );
532 menu = GetMenuBar()->Replace( 5, p_navig_menu, wxU(_("&Navigation")) );
533 if( menu ) delete menu;
538 #if defined( __WXMSW__ ) || defined( __WXMAC__ )
539 void Interface::OnContextMenu(wxContextMenuEvent& event)
541 ::PopupMenu( p_intf, this, ScreenToClient(event.GetPosition()) );
544 void Interface::OnContextMenu(wxMouseEvent& event)
546 ::PopupMenu( p_intf, this, event.GetPosition() );
550 void Interface::OnExit( wxCommandEvent& WXUNUSED(event) )
552 /* TRUE is to force the frame to close. */
556 void Interface::OnAbout( wxCommandEvent& WXUNUSED(event) )
559 msg.Printf( wxString(wxT(VOUT_TITLE)) +
560 wxU(_(" (wxWindows interface)\n\n")) +
561 wxU(_("(C) 1996-2003 - the VideoLAN Team\n\n")) +
562 wxU(_("The VideoLAN team <videolan@videolan.org>\n"
563 "http://www.videolan.org/\n\n")) +
564 wxU(_("This is the VideoLAN Client, a DVD, MPEG and DivX player."
565 "\nIt can play MPEG and MPEG2 files from a file or from a "
566 "network source.")) );
568 wxMessageBox( msg, wxString::Format(wxU(_("About %s")), wxT(VOUT_TITLE)),
569 wxOK | wxICON_INFORMATION, this );
572 void Interface::OnPlaylist( wxCommandEvent& WXUNUSED(event) )
574 /* Show/hide the playlist window */
575 Playlist *p_playlist_window = p_intf->p_sys->p_playlist_window;
576 if( p_playlist_window )
578 p_playlist_window->ShowPlaylist( ! p_playlist_window->IsShown() );
582 void Interface::OnLogs( wxCommandEvent& WXUNUSED(event) )
584 /* Show/hide the log window */
585 wxFrame *p_messages_window = p_intf->p_sys->p_messages_window;
586 if( p_messages_window )
588 p_messages_window->Show( ! p_messages_window->IsShown() );
592 void Interface::OnFileInfo( wxCommandEvent& WXUNUSED(event) )
594 /* Show/hide the file info window */
595 wxFrame *p_fileinfo_window = p_intf->p_sys->p_fileinfo_window;
596 if( p_fileinfo_window )
598 p_fileinfo_window->Show( ! p_fileinfo_window->IsShown() );
602 void Interface::OnPreferences( wxCommandEvent& WXUNUSED(event) )
604 /* Show/hide the open dialog */
605 if( p_prefs_dialog == NULL )
607 p_prefs_dialog = new PrefsDialog( p_intf, this );
612 p_prefs_dialog->Show( true );
616 void Interface::OnOpenFile( wxCommandEvent& WXUNUSED(event) )
621 void Interface::OnOpenDisc( wxCommandEvent& WXUNUSED(event) )
626 void Interface::OnOpenNet( wxCommandEvent& WXUNUSED(event) )
631 void Interface::OnOpenSat( wxCommandEvent& WXUNUSED(event) )
636 void Interface::OnPlayStream( wxCommandEvent& WXUNUSED(event) )
638 wxCommandEvent dummy;
639 playlist_t *p_playlist =
640 (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
642 if( p_playlist == NULL )
644 /* If the playlist is empty, open a file requester instead */
649 vlc_mutex_lock( &p_playlist->object_lock );
650 if( p_playlist->i_size )
652 vlc_mutex_unlock( &p_playlist->object_lock );
654 input_thread_t *p_input = (input_thread_t *)vlc_object_find( p_intf,
657 if( p_input == NULL )
659 /* No stream was playing, start one */
660 playlist_Play( p_playlist );
661 TogglePlayButton( PLAYING_S );
662 vlc_object_release( p_playlist );
666 if( p_input->stream.control.i_status != PAUSE_S )
668 /* A stream is being played, pause it */
669 input_SetStatus( p_input, INPUT_STATUS_PAUSE );
670 TogglePlayButton( PAUSE_S );
671 vlc_object_release( p_playlist );
672 vlc_object_release( p_input );
676 /* Stream is paused, resume it */
677 playlist_Play( p_playlist );
678 TogglePlayButton( PLAYING_S );
679 vlc_object_release( p_input );
680 vlc_object_release( p_playlist );
684 vlc_mutex_unlock( &p_playlist->object_lock );
685 vlc_object_release( p_playlist );
690 void Interface::OnStopStream( wxCommandEvent& WXUNUSED(event) )
692 playlist_t * p_playlist =
693 (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
695 if( p_playlist == NULL )
700 playlist_Stop( p_playlist );
701 TogglePlayButton( PAUSE_S );
702 vlc_object_release( p_playlist );
705 void Interface::OnSliderUpdate( wxScrollEvent& event )
707 vlc_mutex_lock( &p_intf->change_lock );
710 if( event.GetEventType() == wxEVT_SCROLL_THUMBRELEASE
711 || event.GetEventType() == wxEVT_SCROLL_ENDSCROLL )
714 if( p_intf->p_sys->i_slider_pos != event.GetPosition()
715 && p_intf->p_sys->p_input )
717 p_intf->p_sys->i_slider_pos = event.GetPosition();
718 input_Seek( p_intf->p_sys->p_input, p_intf->p_sys->i_slider_pos *
719 100 / SLIDER_MAX_POS,
720 INPUT_SEEK_PERCENT | INPUT_SEEK_SET );
724 p_intf->p_sys->b_slider_free = VLC_TRUE;
728 p_intf->p_sys->b_slider_free = VLC_FALSE;
730 if( p_intf->p_sys->p_input )
732 /* Update stream date */
733 #define p_area p_intf->p_sys->p_input->stream.p_selected_area
734 char psz_time[ OFFSETTOTIME_MAX_SIZE ];
736 slider_box->SetLabel(
737 wxU(input_OffsetToTime( p_intf->p_sys->p_input,
739 p_area->i_size * event.GetPosition()
740 / SLIDER_MAX_POS )) );
746 vlc_mutex_unlock( &p_intf->change_lock );
749 void Interface::OnPrevStream( wxCommandEvent& WXUNUSED(event) )
751 playlist_t * p_playlist =
752 (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
754 if( p_playlist == NULL )
759 playlist_Prev( p_playlist );
760 vlc_object_release( p_playlist );
763 void Interface::OnNextStream( wxCommandEvent& WXUNUSED(event) )
765 playlist_t * p_playlist =
766 (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
768 if( p_playlist == NULL )
773 playlist_Next( p_playlist );
774 vlc_object_release( p_playlist );
777 void Interface::OnSlowStream( wxCommandEvent& WXUNUSED(event) )
779 input_thread_t *p_input =
780 (input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT,
784 input_SetStatus( p_input, INPUT_STATUS_SLOWER );
785 vlc_object_release( p_input );
789 void Interface::OnFastStream( wxCommandEvent& WXUNUSED(event) )
791 input_thread_t *p_input =
792 (input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT,
796 input_SetStatus( p_input, INPUT_STATUS_FASTER );
797 vlc_object_release( p_input );
801 void Interface::TogglePlayButton( int i_playing_status )
803 if( i_playing_status == i_old_playing_status )
806 GetToolBar()->DeleteTool( PlayStream_Event );
808 if( i_playing_status == PLAYING_S )
810 GetToolBar()->InsertTool( 5, PlayStream_Event, wxU(_("Pause")),
811 wxBitmap( pause_xpm ) );
815 GetToolBar()->InsertTool( 5, PlayStream_Event, wxU(_("Play")),
816 wxBitmap( play_xpm ) );
819 GetToolBar()->Realize();
821 i_old_playing_status = i_playing_status;
824 #if !defined(__WXX11__)
825 /*****************************************************************************
826 * Definition of DragAndDrop class.
827 *****************************************************************************/
828 DragAndDrop::DragAndDrop( intf_thread_t *_p_intf )
833 bool DragAndDrop::OnDropFiles( wxCoord, wxCoord,
834 const wxArrayString& filenames )
836 /* Add dropped files to the playlist */
838 playlist_t *p_playlist =
839 (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
841 if( p_playlist == NULL )
846 for( size_t i = 0; i < filenames.GetCount(); i++ )
847 playlist_Add( p_playlist, (const char *)filenames[i].mb_str(),
848 PLAYLIST_APPEND | i ? 0 : PLAYLIST_GO, PLAYLIST_END );
850 vlc_object_release( p_playlist );