1 /*****************************************************************************
2 * interface.cpp : wxWindows plugin for vlc
3 *****************************************************************************
4 * Copyright (C) 2000-2001 VideoLAN
5 * $Id: interface.cpp,v 1.36 2003/05/27 11:35:34 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::OnContextMenu2)
144 EVT_RIGHT_UP(Interface::OnContextMenu)
147 EVT_MENU(OpenFile_Event, Interface::OnOpenFile)
148 EVT_MENU(OpenDisc_Event, Interface::OnOpenDisc)
149 EVT_MENU(OpenNet_Event, Interface::OnOpenNet)
150 EVT_MENU(OpenSat_Event, Interface::OnOpenSat)
151 EVT_MENU(StopStream_Event, Interface::OnStopStream)
152 EVT_MENU(PlayStream_Event, Interface::OnPlayStream)
153 EVT_MENU(PrevStream_Event, Interface::OnPrevStream)
154 EVT_MENU(NextStream_Event, Interface::OnNextStream)
155 EVT_MENU(SlowStream_Event, Interface::OnSlowStream)
156 EVT_MENU(FastStream_Event, Interface::OnFastStream)
159 EVT_COMMAND_SCROLL(SliderScroll_Event, Interface::OnSliderUpdate)
162 /*****************************************************************************
164 *****************************************************************************/
165 Interface::Interface( intf_thread_t *_p_intf ):
166 wxFrame( NULL, -1, wxT("VLC media player"),
167 wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE )
169 /* Initializations */
171 p_prefs_dialog = NULL;
172 i_old_playing_status = PAUSE_S;
173 p_open_dialog = NULL;
175 b_popup_change = VLC_FALSE;
177 /* Give our interface a nice little icon */
178 p_intf->p_sys->p_icon = new wxIcon( vlc_xpm );
179 SetIcon( *p_intf->p_sys->p_icon );
181 /* Create a sizer for the main frame */
182 frame_sizer = new wxBoxSizer( wxHORIZONTAL );
183 SetSizer( frame_sizer );
185 /* Creation of the menu bar */
188 /* Creation of the tool bar */
191 /* Creation of the slider sub-window */
193 frame_sizer->Add( slider_frame, 1, wxGROW, 0 );
194 frame_sizer->Hide( slider_frame );
196 /* Creation of the status bar
197 * Helptext for menu items and toolbar tools will automatically get
199 int i_status_width[3] = {-6, -2, -9};
200 statusbar = CreateStatusBar( 3 ); /* 2 fields */
201 statusbar->SetStatusWidths( 3, i_status_width );
202 statusbar->SetStatusText( wxString::Format(wxT("x%.2f"), 1.0), 1 );
205 /* Make sure we've got the right background colour */
206 SetBackgroundColour( slider_frame->GetBackgroundColour() );
208 /* Layout everything */
209 SetAutoLayout( TRUE );
210 frame_sizer->Layout();
211 frame_sizer->Fit(this);
213 #if !defined(__WXX11__)
214 /* Associate drop targets with the main interface */
215 SetDropTarget( new DragAndDrop( p_intf ) );
219 Interface::~Interface()
222 if( p_open_dialog ) delete p_open_dialog;
223 if( p_prefs_dialog ) p_prefs_dialog->Destroy();
226 /*****************************************************************************
228 *****************************************************************************/
229 void Interface::CreateOurMenuBar()
231 #define HELP_FILE N_("Open a file")
232 #define HELP_DISC N_("Open a DVD or (S)VCD")
233 #define HELP_NET N_("Open a network stream")
234 #define HELP_SAT N_("Open a satellite stream")
235 #define HELP_EJECT N_("Eject the DVD/CD")
236 #define HELP_EXIT N_("Exit this program")
238 #define HELP_PLAYLIST N_("Open the playlist")
239 #define HELP_LOGS N_("Show the program logs")
240 #define HELP_FILEINFO N_("Show information about the file being played")
242 #define HELP_PREFS N_("Go to the preferences menu")
244 #define HELP_ABOUT N_("About this program")
246 /* Create the "File" menu */
247 wxMenu *file_menu = new wxMenu;
248 file_menu->Append( OpenFile_Event, wxU(_("&Open File...")),
250 file_menu->Append( OpenDisc_Event, wxU(_("Open &Disc...")),
252 file_menu->Append( OpenNet_Event, wxU(_("&Network Stream...")),
255 file_menu->Append( OpenSat_Event, wxU(_("&Satellite Stream...")),
259 file_menu->AppendSeparator();
260 file_menu->Append( EjectDisc_Event, wxU(_("&Eject Disc")),
261 wxU(_(HELP_EJECT)) );
263 file_menu->AppendSeparator();
264 file_menu->Append( Exit_Event, wxU(_("E&xit")), wxU(_(HELP_EXIT)) );
266 /* Create the "View" menu */
267 wxMenu *view_menu = new wxMenu;
268 view_menu->Append( Playlist_Event, wxU(_("&Playlist...")),
269 wxU(_(HELP_PLAYLIST)) );
270 view_menu->Append( Logs_Event, wxU(_("&Messages...")), wxU(_(HELP_LOGS)) );
271 view_menu->Append( FileInfo_Event, wxU(_("&File info...")),
272 wxU(_(HELP_FILEINFO)) );
274 /* Create the "Settings" menu */
275 wxMenu *settings_menu = new wxMenu;
276 settings_menu->Append( Prefs_Event, wxU(_("&Preferences...")),
277 wxU(_(HELP_PREFS)) );
279 /* Create the "Audio" menu */
280 p_audio_menu = new wxMenu;
283 /* Create the "Video" menu */
284 p_video_menu = new wxMenu;
287 /* Create the "Navigation" menu */
288 p_navig_menu = new wxMenu;
291 /* Create the "Help" menu */
292 wxMenu *help_menu = new wxMenu;
293 help_menu->Append( About_Event, wxU(_("&About...")), wxU(_(HELP_ABOUT)) );
295 /* Append the freshly created menus to the menu bar... */
296 wxMenuBar *menubar = new wxMenuBar( wxMB_DOCKABLE );
297 menubar->Append( file_menu, wxU(_("&File")) );
298 menubar->Append( view_menu, wxU(_("&View")) );
299 menubar->Append( settings_menu, wxU(_("&Settings")) );
300 menubar->Append( p_audio_menu, wxU(_("&Audio")) );
301 menubar->Append( p_video_menu, wxU(_("&Video")) );
302 menubar->Append( p_navig_menu, wxU(_("&Navigation")) );
303 menubar->Append( help_menu, wxU(_("&Help")) );
305 /* Attach the menu bar to the frame */
306 SetMenuBar( menubar );
308 /* Intercept all menu events in our custom event handler */
309 PushEventHandler( new MenuEvtHandler( p_intf, this ) );
311 #if !defined(__WXX11__)
312 /* Associate drop targets with the menubar */
313 menubar->SetDropTarget( new DragAndDrop( p_intf ) );
317 void Interface::CreateOurToolBar()
319 #define HELP_STOP N_("Stop current playlist item")
320 #define HELP_PLAY N_("Play current playlist item")
321 #define HELP_PAUSE N_("Pause current playlist item")
322 #define HELP_PLO N_("Open playlist")
323 #define HELP_PLP N_("Previous playlist item")
324 #define HELP_PLN N_("Next playlist item")
325 #define HELP_SLOW N_("Play slower")
326 #define HELP_FAST N_("Play faster")
328 wxLogNull LogDummy; /* Hack to suppress annoying log message on the win32
329 * version because we don't include wx.rc */
331 wxToolBar *toolbar = CreateToolBar(
332 wxTB_HORIZONTAL | wxTB_FLAT | wxTB_DOCKABLE );
334 toolbar->SetToolBitmapSize( wxSize(TOOLBAR_BMP_WIDTH,TOOLBAR_BMP_HEIGHT) );
336 toolbar->AddTool( OpenFile_Event, wxU(_("File")), wxBitmap( file_xpm ),
338 toolbar->AddTool( OpenDisc_Event, wxU(_("Disc")), wxBitmap( disc_xpm ),
340 toolbar->AddTool( OpenNet_Event, wxU(_("Net")), wxBitmap( net_xpm ),
343 toolbar->AddTool( OpenSat_Event, wxU(_("Sat")), wxBitmap( sat_xpm ),
346 toolbar->AddSeparator();
347 toolbar->AddTool( StopStream_Event, wxU(_("Stop")), wxBitmap( stop_xpm ),
349 toolbar->AddTool( PlayStream_Event, wxU(_("Play")), wxBitmap( play_xpm ),
351 toolbar->AddSeparator();
352 toolbar->AddTool( Playlist_Event, wxU(_("Playlist")),
353 wxBitmap( playlist_xpm ), wxU(_(HELP_PLO)) );
354 toolbar->AddTool( PrevStream_Event, wxU(_("Prev")),
355 wxBitmap( previous_xpm ), wxU(_(HELP_PLP)) );
356 toolbar->AddTool( NextStream_Event, wxU(_("Next")), wxBitmap( next_xpm ),
358 toolbar->AddTool( SlowStream_Event, wxU(_("Slower")), wxBitmap( slow_xpm ),
360 toolbar->AddTool( FastStream_Event, wxU(_("Faster")), wxBitmap( fast_xpm ),
365 /* Place the toolbar in a sizer, so we can calculate the width of the
366 * toolbar and set this as the minimum for the main frame size. */
367 wxBoxSizer *toolbar_sizer = new wxBoxSizer( wxHORIZONTAL );
368 toolbar_sizer->Add( toolbar, 0, 0, 0 );
369 toolbar_sizer->Layout();
372 frame_sizer->SetMinSize( toolbar_sizer->GetMinSize().GetWidth(), -1 );
374 frame_sizer->SetMinSize( toolbar->GetToolSize().GetWidth() *
375 toolbar->GetToolsCount(), -1 );
378 #if !defined(__WXX11__)
379 /* Associate drop targets with the toolbar */
380 toolbar->SetDropTarget( new DragAndDrop( p_intf ) );
384 void Interface::CreateOurSlider()
386 /* Create a new frame containing the slider */
387 slider_frame = new wxPanel( this, -1, wxDefaultPosition, wxDefaultSize );
388 slider_frame->SetAutoLayout( TRUE );
390 /* Create static box to surround the slider */
391 slider_box = new wxStaticBox( slider_frame, -1, wxT("") );
393 /* Create sizer for slider frame */
394 wxStaticBoxSizer *slider_sizer =
395 new wxStaticBoxSizer( slider_box, wxHORIZONTAL );
396 slider_frame->SetSizer( slider_sizer );
397 slider_sizer->SetMinSize( -1, 50 );
400 slider = new wxSlider( slider_frame, SliderScroll_Event, 0, 0,
401 SLIDER_MAX_POS, wxDefaultPosition, wxDefaultSize );
402 slider_sizer->Add( slider, 1, wxGROW | wxALL, 5 );
403 slider_sizer->Layout();
404 slider_sizer->SetSizeHints(slider_frame);
406 /* Hide the slider by default */
407 slider_frame->Hide();
410 void Interface::Open( int i_access_method )
412 /* Show/hide the open dialog */
413 if( p_open_dialog == NULL )
414 p_open_dialog = new OpenDialog( p_intf, this, i_access_method );
417 p_open_dialog->ShowModal( i_access_method ) == wxID_OK )
419 /* Update the playlist */
420 playlist_t *p_playlist =
421 (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
423 if( p_playlist == NULL )
428 for( size_t i = 0; i < p_open_dialog->mrl.GetCount(); i++ )
430 playlist_Add( p_playlist,
431 (const char *)p_open_dialog->mrl[i].mb_str(),
432 PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO), PLAYLIST_END );
435 TogglePlayButton( PLAYING_S );
437 vlc_object_release( p_playlist );
441 /*****************************************************************************
443 *****************************************************************************/
444 /* Work-around helper for buggy wxGTK */
445 void RecursiveDestroy( wxMenu *menu )
447 wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst();
450 wxMenuItem *item = node->GetData();
451 node = node->GetNext();
453 /* Delete the submenus */
454 wxMenu *submenu = item->GetSubMenu();
457 RecursiveDestroy( submenu );
459 menu->Delete( item );
463 void Interface::OnMenuOpen(wxMenuEvent& event)
465 #if !defined( __WXMSW__ )
466 if( event.GetEventObject() == p_audio_menu )
470 p_audio_menu = AudioMenu( p_intf, this );
472 /* Work-around for buggy wxGTK */
473 wxMenu *menu = GetMenuBar()->GetMenu( 3 );
474 RecursiveDestroy( menu );
475 /* End work-around */
478 GetMenuBar()->Replace( 3, p_audio_menu, wxU(_("&Audio")) );
479 if( menu ) delete menu;
483 else b_audio_menu = 1;
485 else if( event.GetEventObject() == p_video_menu )
489 p_video_menu = VideoMenu( p_intf, this );
491 /* Work-around for buggy wxGTK */
492 wxMenu *menu = GetMenuBar()->GetMenu( 4 );
493 RecursiveDestroy( menu );
494 /* End work-around */
497 GetMenuBar()->Replace( 4, p_video_menu, wxU(_("&Video")) );
498 if( menu ) delete menu;
502 else b_video_menu = 1;
504 else if( event.GetEventObject() == p_navig_menu )
508 p_navig_menu = NavigMenu( p_intf, this );
510 /* Work-around for buggy wxGTK */
511 wxMenu *menu = GetMenuBar()->GetMenu( 5 );
512 RecursiveDestroy( menu );
513 /* End work-around */
516 GetMenuBar()->Replace( 5, p_navig_menu, wxU(_("&Navigation")));
517 if( menu ) delete menu;
521 else b_navig_menu = 1;
525 p_audio_menu = AudioMenu( p_intf, this );
526 wxMenu *menu = GetMenuBar()->Replace( 3, p_audio_menu, wxU(_("&Audio")) );
527 if( menu ) delete menu;
529 p_video_menu = VideoMenu( p_intf, this );
530 menu = GetMenuBar()->Replace( 4, p_video_menu, wxU(_("&Video")) );
531 if( menu ) delete menu;
533 p_navig_menu = NavigMenu( p_intf, this );
534 menu = GetMenuBar()->Replace( 5, p_navig_menu, wxU(_("&Navigation")) );
535 if( menu ) delete menu;
540 #if defined( __WXMSW__ ) || defined( __WXMAC__ )
541 void Interface::OnContextMenu2(wxContextMenuEvent& event)
543 ::PopupMenu( p_intf, this, ScreenToClient(event.GetPosition()) );
546 void Interface::OnContextMenu(wxMouseEvent& event)
548 ::PopupMenu( p_intf, this, event.GetPosition() );
551 void Interface::OnExit( wxCommandEvent& WXUNUSED(event) )
553 /* TRUE is to force the frame to close. */
557 void Interface::OnAbout( wxCommandEvent& WXUNUSED(event) )
560 msg.Printf( wxString(wxT("VLC media player")) +
561 wxU(_(" (wxWindows interface)\n\n")) +
562 wxU(_("(C) 1996-2003 - the VideoLAN Team\n\n")) +
563 wxU(_("The VideoLAN team <videolan@videolan.org>\n"
564 "http://www.videolan.org/\n\n")) +
565 wxU(_("This is the VideoLAN Client, a DVD, MPEG and DivX player."
566 "\nIt can play MPEG and MPEG2 files from a file or from a "
567 "network source.")) );
569 wxMessageBox( msg, wxString::Format(wxU(_("About %s")),
570 wxT("VLC media player")), wxOK | wxICON_INFORMATION, this );
573 void Interface::OnPlaylist( wxCommandEvent& WXUNUSED(event) )
575 /* Show/hide the playlist window */
576 Playlist *p_playlist_window = p_intf->p_sys->p_playlist_window;
577 if( p_playlist_window )
579 p_playlist_window->ShowPlaylist( ! p_playlist_window->IsShown() );
583 void Interface::OnLogs( wxCommandEvent& WXUNUSED(event) )
585 /* Show/hide the log window */
586 wxFrame *p_messages_window = p_intf->p_sys->p_messages_window;
587 if( p_messages_window )
589 p_messages_window->Show( ! p_messages_window->IsShown() );
593 void Interface::OnFileInfo( wxCommandEvent& WXUNUSED(event) )
595 /* Show/hide the file info window */
596 wxFrame *p_fileinfo_window = p_intf->p_sys->p_fileinfo_window;
597 if( p_fileinfo_window )
599 p_fileinfo_window->Show( ! p_fileinfo_window->IsShown() );
603 void Interface::OnPreferences( wxCommandEvent& WXUNUSED(event) )
605 /* Show/hide the open dialog */
606 if( p_prefs_dialog == NULL )
608 p_prefs_dialog = new PrefsDialog( p_intf, this );
613 p_prefs_dialog->Show( true );
617 void Interface::OnOpenFile( wxCommandEvent& WXUNUSED(event) )
622 void Interface::OnOpenDisc( wxCommandEvent& WXUNUSED(event) )
627 void Interface::OnOpenNet( wxCommandEvent& WXUNUSED(event) )
632 void Interface::OnOpenSat( wxCommandEvent& WXUNUSED(event) )
637 void Interface::OnPlayStream( wxCommandEvent& WXUNUSED(event) )
639 wxCommandEvent dummy;
640 playlist_t *p_playlist =
641 (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
643 if( p_playlist == NULL )
645 /* If the playlist is empty, open a file requester instead */
650 vlc_mutex_lock( &p_playlist->object_lock );
651 if( p_playlist->i_size )
653 vlc_mutex_unlock( &p_playlist->object_lock );
655 input_thread_t *p_input = (input_thread_t *)vlc_object_find( p_intf,
658 if( p_input == NULL )
660 /* No stream was playing, start one */
661 playlist_Play( p_playlist );
662 TogglePlayButton( PLAYING_S );
663 vlc_object_release( p_playlist );
667 if( p_input->stream.control.i_status != PAUSE_S )
669 /* A stream is being played, pause it */
670 input_SetStatus( p_input, INPUT_STATUS_PAUSE );
671 TogglePlayButton( PAUSE_S );
672 vlc_object_release( p_playlist );
673 vlc_object_release( p_input );
677 /* Stream is paused, resume it */
678 playlist_Play( p_playlist );
679 TogglePlayButton( PLAYING_S );
680 vlc_object_release( p_input );
681 vlc_object_release( p_playlist );
685 vlc_mutex_unlock( &p_playlist->object_lock );
686 vlc_object_release( p_playlist );
691 void Interface::OnStopStream( wxCommandEvent& WXUNUSED(event) )
693 playlist_t * p_playlist =
694 (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
696 if( p_playlist == NULL )
701 playlist_Stop( p_playlist );
702 TogglePlayButton( PAUSE_S );
703 vlc_object_release( p_playlist );
706 void Interface::OnSliderUpdate( wxScrollEvent& event )
708 vlc_mutex_lock( &p_intf->change_lock );
711 if( event.GetEventType() == wxEVT_SCROLL_THUMBRELEASE
712 || event.GetEventType() == wxEVT_SCROLL_ENDSCROLL )
715 if( p_intf->p_sys->i_slider_pos != event.GetPosition()
716 && p_intf->p_sys->p_input )
718 p_intf->p_sys->i_slider_pos = event.GetPosition();
719 input_Seek( p_intf->p_sys->p_input, p_intf->p_sys->i_slider_pos *
720 100 / SLIDER_MAX_POS,
721 INPUT_SEEK_PERCENT | INPUT_SEEK_SET );
725 p_intf->p_sys->b_slider_free = VLC_TRUE;
729 p_intf->p_sys->b_slider_free = VLC_FALSE;
731 if( p_intf->p_sys->p_input )
733 /* Update stream date */
734 #define p_area p_intf->p_sys->p_input->stream.p_selected_area
735 char psz_time[ OFFSETTOTIME_MAX_SIZE ];
737 slider_box->SetLabel(
738 wxU(input_OffsetToTime( p_intf->p_sys->p_input,
740 p_area->i_size * event.GetPosition()
741 / SLIDER_MAX_POS )) );
747 vlc_mutex_unlock( &p_intf->change_lock );
750 void Interface::OnPrevStream( wxCommandEvent& WXUNUSED(event) )
752 playlist_t * p_playlist =
753 (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
755 if( p_playlist == NULL )
760 playlist_Prev( p_playlist );
761 vlc_object_release( p_playlist );
764 void Interface::OnNextStream( wxCommandEvent& WXUNUSED(event) )
766 playlist_t * p_playlist =
767 (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
769 if( p_playlist == NULL )
774 playlist_Next( p_playlist );
775 vlc_object_release( p_playlist );
778 void Interface::OnSlowStream( wxCommandEvent& WXUNUSED(event) )
780 input_thread_t *p_input =
781 (input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT,
785 input_SetStatus( p_input, INPUT_STATUS_SLOWER );
786 vlc_object_release( p_input );
790 void Interface::OnFastStream( wxCommandEvent& WXUNUSED(event) )
792 input_thread_t *p_input =
793 (input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT,
797 input_SetStatus( p_input, INPUT_STATUS_FASTER );
798 vlc_object_release( p_input );
802 void Interface::TogglePlayButton( int i_playing_status )
804 if( i_playing_status == i_old_playing_status )
807 GetToolBar()->DeleteTool( PlayStream_Event );
809 if( i_playing_status == PLAYING_S )
811 GetToolBar()->InsertTool( 5, PlayStream_Event, wxU(_("Pause")),
812 wxBitmap( pause_xpm ) );
816 GetToolBar()->InsertTool( 5, PlayStream_Event, wxU(_("Play")),
817 wxBitmap( play_xpm ) );
820 GetToolBar()->Realize();
822 i_old_playing_status = i_playing_status;
825 #if !defined(__WXX11__)
826 /*****************************************************************************
827 * Definition of DragAndDrop class.
828 *****************************************************************************/
829 DragAndDrop::DragAndDrop( intf_thread_t *_p_intf )
834 bool DragAndDrop::OnDropFiles( wxCoord, wxCoord,
835 const wxArrayString& filenames )
837 /* Add dropped files to the playlist */
839 playlist_t *p_playlist =
840 (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
842 if( p_playlist == NULL )
847 for( size_t i = 0; i < filenames.GetCount(); i++ )
848 playlist_Add( p_playlist, (const char *)filenames[i].mb_str(),
849 PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO), PLAYLIST_END );
851 vlc_object_release( p_playlist );