1 /*****************************************************************************
2 * interface.cpp : wxWindows plugin for vlc
3 *****************************************************************************
4 * Copyright (C) 2000-2001 VideoLAN
5 * $Id: interface.cpp,v 1.47 2003/07/17 18:58:23 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() */
35 #ifdef WIN32 /* mingw32 hack */
40 /* Let vlc take care of the i18n stuff */
41 #define WXINTL_NO_GETTEXT_MACRO
43 #include <wx/wxprec.h>
47 #include "stream_control.h"
49 #include "wxwindows.h"
51 /* include the toolbar graphics */
52 #include "bitmaps/file.xpm"
53 #include "bitmaps/disc.xpm"
54 #include "bitmaps/net.xpm"
56 #include "bitmaps/sat.xpm"
58 #include "bitmaps/play.xpm"
59 #include "bitmaps/pause.xpm"
60 #include "bitmaps/stop.xpm"
61 #include "bitmaps/previous.xpm"
62 #include "bitmaps/next.xpm"
63 #include "bitmaps/playlist.xpm"
64 #include "bitmaps/fast.xpm"
65 #include "bitmaps/slow.xpm"
67 #define TOOLBAR_BMP_WIDTH 36
68 #define TOOLBAR_BMP_HEIGHT 36
70 /* include the icon graphic */
71 #include "../../../share/vlc32x32.xpm"
73 /*****************************************************************************
74 * Local class declarations.
75 *****************************************************************************/
76 class wxMenuExt: public wxMenu
80 wxMenuExt( wxMenu* parentMenu, int id, const wxString& text,
81 const wxString& helpString, wxItemKind kind,
82 char *_psz_var, int _i_object_id, vlc_value_t _val,
85 virtual ~wxMenuExt() {};
96 class wxVolCtrl: public wxGauge
100 wxVolCtrl( intf_thread_t *_p_intf, wxWindow* parent, wxWindowID id );
101 virtual ~wxVolCtrl() {};
103 void Change( int i_volume );
105 void OnChange( wxMouseEvent& event );
108 intf_thread_t *p_intf;
110 DECLARE_EVENT_TABLE();
113 BEGIN_EVENT_TABLE(wxVolCtrl, wxWindow)
115 EVT_LEFT_DOWN(wxVolCtrl::OnChange)
118 /*****************************************************************************
120 *****************************************************************************/
122 /* IDs for the controls and the menu commands */
126 Exit_Event = wxID_HIGHEST,
127 OpenFileSimple_Event,
148 /* it is important for the id corresponding to the "About" command to have
149 * this standard value as otherwise it won't be handled properly under Mac
150 * (where it is special and put into the "Apple" menu) */
151 About_Event = wxID_ABOUT
154 BEGIN_EVENT_TABLE(Interface, wxFrame)
156 EVT_MENU(Exit_Event, Interface::OnExit)
157 EVT_MENU(About_Event, Interface::OnAbout)
159 EVT_MENU(Playlist_Event, Interface::OnShowDialog)
160 EVT_MENU(Logs_Event, Interface::OnShowDialog)
161 EVT_MENU(FileInfo_Event, Interface::OnShowDialog)
162 EVT_MENU(Prefs_Event, Interface::OnShowDialog)
164 EVT_MENU_OPEN(Interface::OnMenuOpen)
166 #if defined( __WXMSW__ ) || defined( __WXMAC__ )
167 EVT_CONTEXT_MENU(Interface::OnContextMenu2)
169 EVT_RIGHT_UP(Interface::OnContextMenu)
172 EVT_MENU(OpenFileSimple_Event, Interface::OnShowDialog)
173 EVT_MENU(OpenFile_Event, Interface::OnShowDialog)
174 EVT_MENU(OpenDisc_Event, Interface::OnShowDialog)
175 EVT_MENU(OpenNet_Event, Interface::OnShowDialog)
176 EVT_MENU(OpenSat_Event, Interface::OnShowDialog)
177 EVT_MENU(StopStream_Event, Interface::OnStopStream)
178 EVT_MENU(PlayStream_Event, Interface::OnPlayStream)
179 EVT_MENU(PrevStream_Event, Interface::OnPrevStream)
180 EVT_MENU(NextStream_Event, Interface::OnNextStream)
181 EVT_MENU(SlowStream_Event, Interface::OnSlowStream)
182 EVT_MENU(FastStream_Event, Interface::OnFastStream)
185 EVT_COMMAND_SCROLL(SliderScroll_Event, Interface::OnSliderUpdate)
189 /*****************************************************************************
191 *****************************************************************************/
192 Interface::Interface( intf_thread_t *_p_intf ):
193 wxFrame( NULL, -1, wxT("VLC media player"),
194 wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE )
196 /* Initializations */
198 i_old_playing_status = PAUSE_S;
200 /* Give our interface a nice little icon */
201 SetIcon( wxIcon( vlc_xpm ) );
203 /* Create a sizer for the main frame */
204 frame_sizer = new wxBoxSizer( wxHORIZONTAL );
205 SetSizer( frame_sizer );
207 /* Creation of the menu bar */
210 /* Creation of the tool bar */
213 /* Creation of the slider sub-window */
215 frame_sizer->Add( slider_frame, 1, wxGROW, 0 );
216 frame_sizer->Hide( slider_frame );
218 /* Creation of the status bar
219 * Helptext for menu items and toolbar tools will automatically get
221 int i_status_width[3] = {-6, -2, -9};
222 statusbar = CreateStatusBar( 3 ); /* 2 fields */
223 statusbar->SetStatusWidths( 3, i_status_width );
224 statusbar->SetStatusText( wxString::Format(wxT("x%.2f"), 1.0), 1 );
226 /* Make sure we've got the right background colour */
227 SetBackgroundColour( slider_frame->GetBackgroundColour() );
229 /* Layout everything */
230 SetAutoLayout( TRUE );
231 frame_sizer->Layout();
232 frame_sizer->Fit(this);
234 #if !defined(__WXX11__)
235 /* Associate drop targets with the main interface */
236 SetDropTarget( new DragAndDrop( p_intf ) );
240 Interface::~Interface()
245 /*****************************************************************************
247 *****************************************************************************/
248 void Interface::CreateOurMenuBar()
250 #define HELP_FILE N_("Open a file")
251 #define HELP_DISC N_("Open a DVD or (S)VCD")
252 #define HELP_NET N_("Open a network stream")
253 #define HELP_SAT N_("Open a satellite stream")
254 #define HELP_EJECT N_("Eject the DVD/CD")
255 #define HELP_EXIT N_("Exit this program")
257 #define HELP_PLAYLIST N_("Open the playlist")
258 #define HELP_LOGS N_("Show the program logs")
259 #define HELP_FILEINFO N_("Show information about the file being played")
261 #define HELP_PREFS N_("Go to the preferences menu")
263 #define HELP_ABOUT N_("About this program")
265 /* Create the "File" menu */
266 wxMenu *file_menu = new wxMenu;
267 file_menu->Append( OpenFileSimple_Event, wxU(_("Simple &Open ...")),
269 file_menu->Append( OpenFile_Event, wxU(_("Open &File...")),
271 file_menu->Append( OpenDisc_Event, wxU(_("Open &Disc...")),
273 file_menu->Append( OpenNet_Event, wxU(_("Open &Network Stream...")),
276 file_menu->Append( OpenSat_Event, wxU(_("Open &Satellite Stream...")),
280 file_menu->AppendSeparator();
281 file_menu->Append( EjectDisc_Event, wxU(_("&Eject Disc")),
282 wxU(_(HELP_EJECT)) );
284 file_menu->AppendSeparator();
285 file_menu->Append( Exit_Event, wxU(_("E&xit")), wxU(_(HELP_EXIT)) );
287 /* Create the "View" menu */
288 wxMenu *view_menu = new wxMenu;
289 view_menu->Append( Playlist_Event, wxU(_("&Playlist...")),
290 wxU(_(HELP_PLAYLIST)) );
291 view_menu->Append( Logs_Event, wxU(_("&Messages...")), wxU(_(HELP_LOGS)) );
292 view_menu->Append( FileInfo_Event, wxU(_("&File info...")),
293 wxU(_(HELP_FILEINFO)) );
295 /* Create the "Settings" menu */
296 wxMenu *settings_menu = new wxMenu;
297 settings_menu->Append( Prefs_Event, wxU(_("&Preferences...")),
298 wxU(_(HELP_PREFS)) );
300 /* Create the "Audio" menu */
301 p_audio_menu = new wxMenu;
304 /* Create the "Video" menu */
305 p_video_menu = new wxMenu;
308 /* Create the "Navigation" menu */
309 p_navig_menu = new wxMenu;
312 /* Create the "Help" menu */
313 wxMenu *help_menu = new wxMenu;
314 help_menu->Append( About_Event, wxU(_("&About...")), wxU(_(HELP_ABOUT)) );
316 /* Append the freshly created menus to the menu bar... */
317 wxMenuBar *menubar = new wxMenuBar( wxMB_DOCKABLE );
318 menubar->Append( file_menu, wxU(_("&File")) );
319 menubar->Append( view_menu, wxU(_("&View")) );
320 menubar->Append( settings_menu, wxU(_("&Settings")) );
321 menubar->Append( p_audio_menu, wxU(_("&Audio")) );
322 menubar->Append( p_video_menu, wxU(_("&Video")) );
323 menubar->Append( p_navig_menu, wxU(_("&Navigation")) );
324 menubar->Append( help_menu, wxU(_("&Help")) );
326 /* Attach the menu bar to the frame */
327 SetMenuBar( menubar );
329 /* Intercept all menu events in our custom event handler */
330 PushEventHandler( new MenuEvtHandler( p_intf, this ) );
332 #if !defined(__WXX11__)
333 /* Associate drop targets with the menubar */
334 menubar->SetDropTarget( new DragAndDrop( p_intf ) );
338 void Interface::CreateOurToolBar()
340 #define HELP_STOP N_("Stop current playlist item")
341 #define HELP_PLAY N_("Play current playlist item")
342 #define HELP_PAUSE N_("Pause current playlist item")
343 #define HELP_PLO N_("Open playlist")
344 #define HELP_PLP N_("Previous playlist item")
345 #define HELP_PLN N_("Next playlist item")
346 #define HELP_SLOW N_("Play slower")
347 #define HELP_FAST N_("Play faster")
349 wxLogNull LogDummy; /* Hack to suppress annoying log message on the win32
350 * version because we don't include wx.rc */
352 wxToolBar *toolbar = CreateToolBar(
353 wxTB_HORIZONTAL | wxTB_FLAT | wxTB_DOCKABLE );
355 toolbar->SetToolBitmapSize( wxSize(TOOLBAR_BMP_WIDTH,TOOLBAR_BMP_HEIGHT) );
357 toolbar->AddTool( OpenFile_Event, wxU(_("File")), wxBitmap( file_xpm ),
359 toolbar->AddTool( OpenDisc_Event, wxU(_("Disc")), wxBitmap( disc_xpm ),
361 toolbar->AddTool( OpenNet_Event, wxU(_("Net")), wxBitmap( net_xpm ),
364 toolbar->AddTool( OpenSat_Event, wxU(_("Sat")), wxBitmap( sat_xpm ),
367 toolbar->AddSeparator();
368 toolbar->AddTool( StopStream_Event, wxU(_("Stop")), wxBitmap( stop_xpm ),
370 toolbar->AddTool( PlayStream_Event, wxU(_("Play")), wxBitmap( play_xpm ),
372 toolbar->AddSeparator();
373 toolbar->AddTool( Playlist_Event, wxU(_("Playlist")),
374 wxBitmap( playlist_xpm ), wxU(_(HELP_PLO)) );
375 toolbar->AddTool( PrevStream_Event, wxU(_("Prev")),
376 wxBitmap( previous_xpm ), wxU(_(HELP_PLP)) );
377 toolbar->AddTool( NextStream_Event, wxU(_("Next")), wxBitmap( next_xpm ),
379 toolbar->AddTool( SlowStream_Event, wxU(_("Slower")), wxBitmap( slow_xpm ),
381 toolbar->AddTool( FastStream_Event, wxU(_("Faster")), wxBitmap( fast_xpm ),
386 /* Place the toolbar in a sizer, so we can calculate the width of the
387 * toolbar and set this as the minimum for the main frame size. */
388 wxBoxSizer *toolbar_sizer = new wxBoxSizer( wxHORIZONTAL );
389 toolbar_sizer->Add( toolbar, 0, 0, 0 );
390 toolbar_sizer->Layout();
393 frame_sizer->SetMinSize( toolbar_sizer->GetMinSize().GetWidth(), -1 );
395 frame_sizer->SetMinSize( toolbar->GetToolSize().GetWidth() *
396 toolbar->GetToolsCount(), -1 );
399 #if !defined(__WXX11__)
400 /* Associate drop targets with the toolbar */
401 toolbar->SetDropTarget( new DragAndDrop( p_intf ) );
405 void Interface::CreateOurSlider()
407 /* Create a new frame and sizer containing the slider */
408 slider_frame = new wxPanel( this, -1, wxDefaultPosition, wxDefaultSize );
409 slider_frame->SetAutoLayout( TRUE );
410 wxBoxSizer *frame_sizer =
411 new wxBoxSizer( wxHORIZONTAL );
413 /* Create static box to surround the slider */
414 slider_box = new wxStaticBox( slider_frame, -1, wxT("") );
416 /* Create sizer for slider frame */
417 wxStaticBoxSizer *slider_sizer =
418 new wxStaticBoxSizer( slider_box, wxHORIZONTAL );
419 slider_sizer->SetMinSize( -1, 50 );
422 slider = new wxSlider( slider_frame, SliderScroll_Event, 0, 0,
423 SLIDER_MAX_POS, wxDefaultPosition, wxDefaultSize );
424 slider_sizer->Add( slider, 1, wxEXPAND | wxALL, 5 );
427 volctrl = new wxVolCtrl( p_intf, slider_frame, -1 );
429 /* Add everything to the frame */
430 frame_sizer->Add( slider_sizer, 1, wxEXPAND | wxBOTTOM, 5 );
431 frame_sizer->Add( volctrl, 0, wxEXPAND | wxALL, 5 );
432 slider_frame->SetSizer( frame_sizer );
433 frame_sizer->Layout();
434 frame_sizer->SetSizeHints(slider_frame);
436 /* Hide the slider by default */
437 slider_frame->Hide();
440 /*****************************************************************************
442 *****************************************************************************/
443 /* Work-around helper for buggy wxGTK */
444 void RecursiveDestroy( wxMenu *menu )
446 wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst();
449 wxMenuItem *item = node->GetData();
450 node = node->GetNext();
452 /* Delete the submenus */
453 wxMenu *submenu = item->GetSubMenu();
456 RecursiveDestroy( submenu );
458 menu->Delete( item );
462 void Interface::OnMenuOpen(wxMenuEvent& event)
464 #if !defined( __WXMSW__ )
465 if( event.GetEventObject() == p_audio_menu )
469 p_audio_menu = AudioMenu( p_intf, this );
471 /* Work-around for buggy wxGTK */
472 wxMenu *menu = GetMenuBar()->GetMenu( 3 );
473 RecursiveDestroy( menu );
474 /* End work-around */
477 GetMenuBar()->Replace( 3, p_audio_menu, wxU(_("&Audio")) );
478 if( menu ) delete menu;
482 else b_audio_menu = 1;
484 else if( event.GetEventObject() == p_video_menu )
488 p_video_menu = VideoMenu( p_intf, this );
490 /* Work-around for buggy wxGTK */
491 wxMenu *menu = GetMenuBar()->GetMenu( 4 );
492 RecursiveDestroy( menu );
493 /* End work-around */
496 GetMenuBar()->Replace( 4, p_video_menu, wxU(_("&Video")) );
497 if( menu ) delete menu;
501 else b_video_menu = 1;
503 else if( event.GetEventObject() == p_navig_menu )
507 p_navig_menu = NavigMenu( p_intf, this );
509 /* Work-around for buggy wxGTK */
510 wxMenu *menu = GetMenuBar()->GetMenu( 5 );
511 RecursiveDestroy( menu );
512 /* End work-around */
515 GetMenuBar()->Replace( 5, p_navig_menu, wxU(_("&Navigation")));
516 if( menu ) delete menu;
520 else b_navig_menu = 1;
524 p_audio_menu = AudioMenu( p_intf, this );
525 wxMenu *menu = GetMenuBar()->Replace( 3, p_audio_menu, wxU(_("&Audio")) );
526 if( menu ) delete menu;
528 p_video_menu = VideoMenu( p_intf, this );
529 menu = GetMenuBar()->Replace( 4, p_video_menu, wxU(_("&Video")) );
530 if( menu ) delete menu;
532 p_navig_menu = NavigMenu( p_intf, this );
533 menu = GetMenuBar()->Replace( 5, p_navig_menu, wxU(_("&Navigation")) );
534 if( menu ) delete menu;
539 #if defined( __WXMSW__ ) || defined( __WXMAC__ )
540 void Interface::OnContextMenu2(wxContextMenuEvent& event)
542 if( p_intf->p_sys->pf_show_dialog )
543 p_intf->p_sys->pf_show_dialog( p_intf, INTF_DIALOG_POPUPMENU, 0 );
544 //::PopupMenu( p_intf, this, ScreenToClient(event.GetPosition()) );
547 void Interface::OnContextMenu(wxMouseEvent& event)
549 if( p_intf->p_sys->pf_show_dialog )
550 p_intf->p_sys->pf_show_dialog( p_intf, INTF_DIALOG_POPUPMENU, 0 );
551 //::PopupMenu( p_intf, this, event.GetPosition() );
554 void Interface::OnExit( wxCommandEvent& WXUNUSED(event) )
556 /* TRUE is to force the frame to close. */
560 void Interface::OnAbout( wxCommandEvent& WXUNUSED(event) )
563 msg.Printf( wxString(wxT("VLC media player " VERSION)) +
564 wxU(_(" (wxWindows interface)\n\n")) +
565 wxU(_("(C) 1996-2003 - the VideoLAN Team\n\n")) +
566 wxU(_("The VideoLAN team <videolan@videolan.org>\n"
567 "http://www.videolan.org/\n\n")) +
568 wxU(_("This is the VideoLAN Client, a DVD, MPEG and DivX player."
569 "\nIt can play MPEG and MPEG2 files from a file or from a "
570 "network source.")) );
572 wxMessageBox( msg, wxString::Format(wxU(_("About %s")),
573 wxT("VLC media player")), wxOK | wxICON_INFORMATION, this );
576 void Interface::OnShowDialog( wxCommandEvent& event )
578 if( p_intf->p_sys->pf_show_dialog )
582 switch( event.GetId() )
584 case OpenFileSimple_Event:
585 i_id = INTF_DIALOG_FILE_SIMPLE;
588 i_id = INTF_DIALOG_FILE;
591 i_id = INTF_DIALOG_DISC;
594 i_id = INTF_DIALOG_NET;
597 i_id = INTF_DIALOG_SAT;
600 i_id = INTF_DIALOG_PLAYLIST;
603 i_id = INTF_DIALOG_MESSAGES;
606 i_id = INTF_DIALOG_FILEINFO;
609 i_id = INTF_DIALOG_PREFS;
612 i_id = INTF_DIALOG_FILE;
617 p_intf->p_sys->pf_show_dialog( p_intf, i_id, 1 );
621 void Interface::OnPlayStream( wxCommandEvent& WXUNUSED(event) )
623 wxCommandEvent dummy;
624 playlist_t *p_playlist =
625 (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
627 if( p_playlist == NULL )
629 /* If the playlist is empty, open a file requester instead */
630 OnShowDialog( dummy );
634 if( p_playlist->i_size )
636 input_thread_t *p_input = (input_thread_t *)vlc_object_find( p_intf,
639 if( p_input == NULL )
641 /* No stream was playing, start one */
642 playlist_Play( p_playlist );
643 TogglePlayButton( PLAYING_S );
644 vlc_object_release( p_playlist );
648 if( p_input->stream.control.i_status != PAUSE_S )
650 /* A stream is being played, pause it */
651 input_SetStatus( p_input, INPUT_STATUS_PAUSE );
652 TogglePlayButton( PAUSE_S );
653 vlc_object_release( p_playlist );
654 vlc_object_release( p_input );
658 /* Stream is paused, resume it */
659 input_SetStatus( p_input, INPUT_STATUS_PLAY );
660 TogglePlayButton( PLAYING_S );
661 vlc_object_release( p_input );
662 vlc_object_release( p_playlist );
666 vlc_mutex_unlock( &p_playlist->object_lock );
667 vlc_object_release( p_playlist );
668 OnShowDialog( dummy );
672 void Interface::OnStopStream( wxCommandEvent& WXUNUSED(event) )
674 playlist_t * p_playlist =
675 (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
677 if( p_playlist == NULL )
682 playlist_Stop( p_playlist );
683 TogglePlayButton( PAUSE_S );
684 vlc_object_release( p_playlist );
687 void Interface::OnSliderUpdate( wxScrollEvent& event )
689 vlc_mutex_lock( &p_intf->change_lock );
692 if( event.GetEventType() == wxEVT_SCROLL_THUMBRELEASE
693 || event.GetEventType() == wxEVT_SCROLL_ENDSCROLL )
696 if( p_intf->p_sys->i_slider_pos != event.GetPosition()
697 && p_intf->p_sys->p_input )
699 p_intf->p_sys->i_slider_pos = event.GetPosition();
700 input_Seek( p_intf->p_sys->p_input, p_intf->p_sys->i_slider_pos *
701 100 / SLIDER_MAX_POS,
702 INPUT_SEEK_PERCENT | INPUT_SEEK_SET );
706 p_intf->p_sys->b_slider_free = VLC_TRUE;
710 p_intf->p_sys->b_slider_free = VLC_FALSE;
712 if( p_intf->p_sys->p_input )
714 /* Update stream date */
715 #define p_area p_intf->p_sys->p_input->stream.p_selected_area
716 char psz_time[ OFFSETTOTIME_MAX_SIZE ];
718 slider_box->SetLabel(
719 wxU(input_OffsetToTime( p_intf->p_sys->p_input,
721 p_area->i_size * event.GetPosition()
722 / SLIDER_MAX_POS )) );
728 vlc_mutex_unlock( &p_intf->change_lock );
731 void Interface::OnPrevStream( wxCommandEvent& WXUNUSED(event) )
733 playlist_t * p_playlist =
734 (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
736 if( p_playlist == NULL )
741 playlist_Prev( p_playlist );
742 vlc_object_release( p_playlist );
745 void Interface::OnNextStream( wxCommandEvent& WXUNUSED(event) )
747 playlist_t * p_playlist =
748 (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
750 if( p_playlist == NULL )
755 playlist_Next( p_playlist );
756 vlc_object_release( p_playlist );
759 void Interface::OnSlowStream( wxCommandEvent& WXUNUSED(event) )
761 input_thread_t *p_input =
762 (input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT,
766 input_SetStatus( p_input, INPUT_STATUS_SLOWER );
767 vlc_object_release( p_input );
771 void Interface::OnFastStream( wxCommandEvent& WXUNUSED(event) )
773 input_thread_t *p_input =
774 (input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT,
778 input_SetStatus( p_input, INPUT_STATUS_FASTER );
779 vlc_object_release( p_input );
783 void Interface::TogglePlayButton( int i_playing_status )
785 if( i_playing_status == i_old_playing_status )
788 GetToolBar()->DeleteTool( PlayStream_Event );
790 if( i_playing_status == PLAYING_S )
792 GetToolBar()->InsertTool( 5, PlayStream_Event, wxU(_("Pause")),
793 wxBitmap( pause_xpm ), wxNullBitmap,
794 wxITEM_NORMAL, wxU(_(HELP_PAUSE)) );
798 GetToolBar()->InsertTool( 5, PlayStream_Event, wxU(_("Play")),
799 wxBitmap( play_xpm ), wxNullBitmap,
800 wxITEM_NORMAL, wxU(_(HELP_PLAY)) );
803 GetToolBar()->Realize();
805 i_old_playing_status = i_playing_status;
808 #if !defined(__WXX11__)
809 /*****************************************************************************
810 * Definition of DragAndDrop class.
811 *****************************************************************************/
812 DragAndDrop::DragAndDrop( intf_thread_t *_p_intf )
817 bool DragAndDrop::OnDropFiles( wxCoord, wxCoord,
818 const wxArrayString& filenames )
820 /* Add dropped files to the playlist */
822 playlist_t *p_playlist =
823 (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
825 if( p_playlist == NULL )
830 for( size_t i = 0; i < filenames.GetCount(); i++ )
831 playlist_Add( p_playlist, (const char *)filenames[i].mb_str(),
832 PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO), PLAYLIST_END );
834 vlc_object_release( p_playlist );
840 /*****************************************************************************
841 * Definition of wxVolCtrl class.
842 *****************************************************************************/
843 wxVolCtrl::wxVolCtrl( intf_thread_t *_p_intf, wxWindow* parent, wxWindowID id )
844 : wxGauge( parent, id, 200, wxDefaultPosition, wxDefaultSize,
845 wxGA_VERTICAL | wxGA_SMOOTH )
850 void wxVolCtrl::OnChange( wxMouseEvent& event )
852 int i_volume = (GetRect().height - event.GetY()) * 200 / GetRect().height;
856 void wxVolCtrl::Change( int i_volume )
858 aout_VolumeSet( p_intf, i_volume * AOUT_VOLUME_MAX / 200 );
859 SetValue( i_volume );
860 SetToolTip( wxString::Format((wxString)wxU(_("Volume")) + wxT(" %d"),