]> git.sesse.net Git - vlc/blob - modules/gui/wxwindows/interface.cpp
* ALL: improved hotkeys support.
[vlc] / modules / gui / wxwindows / interface.cpp
1 /*****************************************************************************
2  * interface.cpp : wxWindows plugin for vlc
3  *****************************************************************************
4  * Copyright (C) 2000-2001 VideoLAN
5  * $Id: interface.cpp,v 1.68 2003/10/29 01:33:27 gbazin Exp $
6  *
7  * Authors: Gildas Bazin <gbazin@netcourrier.com>
8  *
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.
13  *
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.
18  *
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  *****************************************************************************/
23
24 /*****************************************************************************
25  * Preamble
26  *****************************************************************************/
27 #include <stdlib.h>                                      /* malloc(), free() */
28 #include <errno.h>                                                 /* ENOMEM */
29 #include <string.h>                                            /* strerror() */
30 #include <stdio.h>
31
32 #include <vlc/vlc.h>
33 #include <vlc/aout.h>
34 #include <vlc/vout.h>
35 #include <vlc/intf.h>
36 #include "stream_control.h"
37
38 #include "wxwindows.h"
39
40 /* include the toolbar graphics */
41 #include "bitmaps/file.xpm"
42 #include "bitmaps/disc.xpm"
43 #include "bitmaps/net.xpm"
44 #if 0
45 #include "bitmaps/sat.xpm"
46 #endif
47 #include "bitmaps/play.xpm"
48 #include "bitmaps/pause.xpm"
49 #include "bitmaps/stop.xpm"
50 #include "bitmaps/previous.xpm"
51 #include "bitmaps/next.xpm"
52 #include "bitmaps/playlist.xpm"
53 #include "bitmaps/fast.xpm"
54 #include "bitmaps/slow.xpm"
55
56 #define TOOLBAR_BMP_WIDTH 36
57 #define TOOLBAR_BMP_HEIGHT 36
58
59 /* include the icon graphic */
60 #include "../../../share/vlc32x32.xpm"
61
62 /*****************************************************************************
63  * Local class declarations.
64  *****************************************************************************/
65 class wxMenuExt: public wxMenu
66 {
67 public:
68     /* Constructor */
69     wxMenuExt( wxMenu* parentMenu, int id, const wxString& text,
70                    const wxString& helpString, wxItemKind kind,
71                    char *_psz_var, int _i_object_id, vlc_value_t _val,
72                    int _i_val_type );
73
74     virtual ~wxMenuExt() {};
75
76     char *psz_var;
77     int  i_val_type;
78     int  i_object_id;
79     vlc_value_t val;
80
81 private:
82
83 };
84
85 class wxVolCtrl: public wxGauge
86 {
87 public:
88     /* Constructor */
89     wxVolCtrl( intf_thread_t *_p_intf, wxWindow* parent, wxWindowID id );
90     virtual ~wxVolCtrl() {};
91
92     void Change( int i_volume );
93
94     void OnChange( wxMouseEvent& event );
95
96 private:
97     intf_thread_t *p_intf;
98
99     DECLARE_EVENT_TABLE();
100 };
101
102 BEGIN_EVENT_TABLE(wxVolCtrl, wxWindow)
103     /* Mouse events */
104     EVT_LEFT_DOWN(wxVolCtrl::OnChange)
105     EVT_MOTION(wxVolCtrl::OnChange)
106 END_EVENT_TABLE()
107
108 /*****************************************************************************
109  * Event Table.
110  *****************************************************************************/
111
112 /* IDs for the controls and the menu commands */
113 enum
114 {
115     /* menu items */
116     Exit_Event = wxID_HIGHEST,
117     OpenFileSimple_Event,
118     OpenFile_Event,
119     OpenDisc_Event,
120     OpenNet_Event,
121     OpenSat_Event,
122     EjectDisc_Event,
123
124     Playlist_Event,
125     Logs_Event,
126     FileInfo_Event,
127
128     Prefs_Event,
129     Extra_Event,
130     Skins_Event,
131
132     SliderScroll_Event,
133     StopStream_Event,
134     PlayStream_Event,
135     PrevStream_Event,
136     NextStream_Event,
137     SlowStream_Event,
138     FastStream_Event,
139
140     Adjust_Event,
141     Hue_Event,
142     Contrast_Event,
143     Brightness_Event,
144     Saturation_Event,
145
146     Ratio_Event,
147     /* it is important for the id corresponding to the "About" command to have
148      * this standard value as otherwise it won't be handled properly under Mac
149      * (where it is special and put into the "Apple" menu) */
150     About_Event = wxID_ABOUT
151 };
152
153 BEGIN_EVENT_TABLE(Interface, wxFrame)
154     /* Menu events */
155     EVT_MENU(Exit_Event, Interface::OnExit)
156     EVT_MENU(About_Event, Interface::OnAbout)
157
158     EVT_MENU(Playlist_Event, Interface::OnShowDialog)
159     EVT_MENU(Logs_Event, Interface::OnShowDialog)
160     EVT_MENU(FileInfo_Event, Interface::OnShowDialog)
161     EVT_MENU(Prefs_Event, Interface::OnShowDialog)
162
163     EVT_MENU_OPEN(Interface::OnMenuOpen)
164
165     EVT_MENU( Extra_Event, Interface::OnExtra)
166     EVT_CHECKBOX( Adjust_Event, Interface::OnEnableAdjust)
167
168     EVT_COMBOBOX( Ratio_Event, Interface::OnRatio)
169
170 #if defined( __WXMSW__ ) || defined( __WXMAC__ )
171     EVT_CONTEXT_MENU(Interface::OnContextMenu2)
172 #endif
173     EVT_RIGHT_UP(Interface::OnContextMenu)
174
175     /* Toolbar events */
176     EVT_MENU(OpenFileSimple_Event, Interface::OnShowDialog)
177     EVT_MENU(OpenFile_Event, Interface::OnShowDialog)
178     EVT_MENU(OpenDisc_Event, Interface::OnShowDialog)
179     EVT_MENU(OpenNet_Event, Interface::OnShowDialog)
180     EVT_MENU(OpenSat_Event, Interface::OnShowDialog)
181     EVT_MENU(StopStream_Event, Interface::OnStopStream)
182     EVT_MENU(PlayStream_Event, Interface::OnPlayStream)
183     EVT_MENU(PrevStream_Event, Interface::OnPrevStream)
184     EVT_MENU(NextStream_Event, Interface::OnNextStream)
185     EVT_MENU(SlowStream_Event, Interface::OnSlowStream)
186     EVT_MENU(FastStream_Event, Interface::OnFastStream)
187
188     /* Slider events */
189     EVT_COMMAND_SCROLL(SliderScroll_Event, Interface::OnSliderUpdate)
190
191     EVT_COMMAND_SCROLL(Hue_Event, Interface::OnHueUpdate)
192     EVT_COMMAND_SCROLL(Contrast_Event, Interface::OnContrastUpdate)
193     EVT_COMMAND_SCROLL(Brightness_Event, Interface::OnBrightnessUpdate)
194     EVT_COMMAND_SCROLL(Saturation_Event, Interface::OnSaturationUpdate)
195
196 END_EVENT_TABLE()
197
198 /*****************************************************************************
199  * Constructor.
200  *****************************************************************************/
201 Interface::Interface( intf_thread_t *_p_intf ):
202     wxFrame( NULL, -1, wxT("VLC media player"),
203              wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE )
204 {
205     /* Initializations */
206     p_intf = _p_intf;
207     i_old_playing_status = PAUSE_S;
208     b_extra = VLC_FALSE;
209
210     /* Give our interface a nice little icon */
211     SetIcon( wxIcon( vlc_xpm ) );
212
213     /* Create a sizer for the main frame */
214     //frame_sizer= new wxFlexGridSizer( 1, 0, 0);
215     frame_sizer = new wxBoxSizer( wxVERTICAL );
216     SetSizer( frame_sizer );
217
218     /* Create a dummy widget that can get the keyboard focus */
219     wxWindow *p_dummy = new wxWindow( this, 0, wxDefaultPosition,
220                                       wxSize(0,0) );
221     p_dummy->SetFocus();
222     frame_sizer->Add( p_dummy );
223
224     /* Creation of the menu bar */
225     CreateOurMenuBar();
226
227     /* Creation of the tool bar */
228     CreateOurToolBar();
229
230     /* Creation of the slider sub-window */
231     CreateOurSlider();
232     frame_sizer->Add( slider_frame, 0, wxEXPAND , 0 );
233     frame_sizer->Hide( slider_frame );
234
235     /* Create the extra panel */
236     CreateOurExtraPanel();
237     frame_sizer->Add( extra_frame, 0, wxEXPAND , 0 );
238     frame_sizer->Hide( extra_frame );
239
240     /* Creation of the status bar
241      * Helptext for menu items and toolbar tools will automatically get
242      * displayed here. */
243     int i_status_width[3] = {-6, -2, -9};
244     statusbar = CreateStatusBar( 3 );                            /* 2 fields */
245     statusbar->SetStatusWidths( 3, i_status_width );
246     statusbar->SetStatusText( wxString::Format(wxT("x%.2f"), 1.0), 1 );
247
248     /* Make sure we've got the right background colour */
249     SetBackgroundColour( slider_frame->GetBackgroundColour() );
250
251     /* Layout everything */
252     SetAutoLayout( TRUE );
253     frame_sizer->Layout();
254     frame_sizer->Fit(this);
255
256 #if !defined(__WXX11__)
257     /* Associate drop targets with the main interface */
258     SetDropTarget( new DragAndDrop( p_intf ) );
259 #endif
260
261     UpdateAcceleratorTable();
262
263     /* Start timer */
264     timer = new Timer( p_intf, this );
265 }
266
267 Interface::~Interface()
268 {
269     if( p_intf->p_sys->p_wxwindow )
270     {
271         delete p_intf->p_sys->p_wxwindow;
272     }
273
274     /* Clean up */
275     delete timer;
276 }
277
278 /*****************************************************************************
279  * Private methods.
280  *****************************************************************************/
281 void Interface::CreateOurMenuBar()
282 {
283 #define HELP_FILE  N_("Open a file")
284 #define HELP_DISC  N_("Open a DVD or (S)VCD")
285 #define HELP_NET   N_("Open a network stream")
286 #define HELP_SAT   N_("Open a satellite stream")
287 #define HELP_EJECT N_("Eject the DVD/CD")
288 #define HELP_EXIT  N_("Exit this program")
289
290 #define HELP_PLAYLIST   N_("Open the playlist")
291 #define HELP_LOGS       N_("Show the program logs")
292 #define HELP_FILEINFO       N_("Show information about the file being played")
293
294 #define HELP_PREFS N_("Go to the preferences menu")
295 #define EXTRA_PREFS N_("Shows the extended GUI")
296
297 #define HELP_ABOUT N_("About this program")
298
299     /* Create the "File" menu */
300     wxMenu *file_menu = new wxMenu;
301     file_menu->Append( OpenFileSimple_Event, wxU(_("Simple &Open ...")),
302                        wxU(_(HELP_FILE)) );
303     file_menu->Append( OpenFile_Event, wxU(_("Open &File...")),
304                        wxU(_(HELP_FILE)) );
305     file_menu->Append( OpenDisc_Event, wxU(_("Open &Disc...")),
306                        wxU(_(HELP_DISC)) );
307     file_menu->Append( OpenNet_Event, wxU(_("Open &Network Stream...")),
308                        wxU(_(HELP_NET)) );
309 #if 0
310     file_menu->Append( OpenSat_Event, wxU(_("Open &Satellite Stream...")),
311                        wxU(_(HELP_NET)) );
312 #endif
313 #if 0
314     file_menu->AppendSeparator();
315     file_menu->Append( EjectDisc_Event, wxU(_("&Eject Disc")),
316                        wxU(_(HELP_EJECT)) );
317 #endif
318     file_menu->AppendSeparator();
319     file_menu->Append( Exit_Event, wxU(_("E&xit")), wxU(_(HELP_EXIT)) );
320
321     /* Create the "View" menu */
322     wxMenu *view_menu = new wxMenu;
323     view_menu->Append( Playlist_Event, wxU(_("&Playlist...")),
324                        wxU(_(HELP_PLAYLIST)) );
325     view_menu->Append( Logs_Event, wxU(_("&Messages...")), wxU(_(HELP_LOGS)) );
326     view_menu->Append( FileInfo_Event, wxU(_("&File info...")),
327                        wxU(_(HELP_FILEINFO)) );
328
329     /* Create the "Settings" menu */
330     wxMenu *settings_menu = new wxMenu;
331     settings_menu->Append( Prefs_Event, wxU(_("&Preferences...")),
332                            wxU(_(HELP_PREFS)) );
333     settings_menu->AppendCheckItem( Extra_Event, wxU(_("&Extended GUI") ),
334                                     wxU(_(EXTRA_PREFS)) );
335
336     /* Create the "Audio" menu */
337     p_audio_menu = new wxMenu;
338     b_audio_menu = 1;
339
340     /* Create the "Video" menu */
341     p_video_menu = new wxMenu;
342     b_video_menu = 1;
343
344     /* Create the "Navigation" menu */
345     p_navig_menu = new wxMenu;
346     b_navig_menu = 1;
347
348     /* Create the "Miscellaneous" menu */
349     p_misc_menu = new wxMenu;
350     b_misc_menu = 1;
351
352     /* Create the "Help" menu */
353     wxMenu *help_menu = new wxMenu;
354     help_menu->Append( About_Event, wxU(_("&About...")), wxU(_(HELP_ABOUT)) );
355
356     /* Append the freshly created menus to the menu bar... */
357     wxMenuBar *menubar = new wxMenuBar( wxMB_DOCKABLE );
358     menubar->Append( file_menu, wxU(_("&File")) );
359     menubar->Append( view_menu, wxU(_("&View")) );
360     menubar->Append( settings_menu, wxU(_("&Settings")) );
361     menubar->Append( p_audio_menu, wxU(_("&Audio")) );
362     menubar->Append( p_video_menu, wxU(_("&Video")) );
363     menubar->Append( p_navig_menu, wxU(_("&Navigation")) );
364     menubar->Append( p_misc_menu, wxU(_("&Miscellaneous")) );
365     menubar->Append( help_menu, wxU(_("&Help")) );
366
367     /* Attach the menu bar to the frame */
368     SetMenuBar( menubar );
369
370     /* Intercept all menu events in our custom event handler */
371     PushEventHandler( new MenuEvtHandler( p_intf, this ) );
372
373 #if !defined(__WXX11__)
374     /* Associate drop targets with the menubar */
375     menubar->SetDropTarget( new DragAndDrop( p_intf ) );
376 #endif
377 }
378
379 void Interface::CreateOurToolBar()
380 {
381 #define HELP_STOP N_("Stop current playlist item")
382 #define HELP_PLAY N_("Play current playlist item")
383 #define HELP_PAUSE N_("Pause current playlist item")
384 #define HELP_PLO N_("Open playlist")
385 #define HELP_PLP N_("Previous playlist item")
386 #define HELP_PLN N_("Next playlist item")
387 #define HELP_SLOW N_("Play slower")
388 #define HELP_FAST N_("Play faster")
389
390     wxLogNull LogDummy; /* Hack to suppress annoying log message on the win32
391                          * version because we don't include wx.rc */
392
393     wxToolBar *toolbar = CreateToolBar(
394                                        wxTB_HORIZONTAL | wxTB_FLAT | wxTB_DOCKABLE );
395
396     toolbar->SetToolBitmapSize( wxSize(TOOLBAR_BMP_WIDTH,TOOLBAR_BMP_HEIGHT) );
397
398     toolbar->AddTool( OpenFile_Event, wxU(_("File")), wxBitmap( file_xpm ),
399                       wxU(_(HELP_FILE)) );
400     toolbar->AddTool( OpenDisc_Event, wxU(_("Disc")), wxBitmap( disc_xpm ),
401                       wxU(_(HELP_DISC)) );
402     toolbar->AddTool( OpenNet_Event, wxU(_("Net")), wxBitmap( net_xpm ),
403                       wxU(_(HELP_NET)) );
404 #if 0
405     toolbar->AddTool( OpenSat_Event, wxU(_("Sat")), wxBitmap( sat_xpm ),
406                       wxU(_(HELP_SAT)) );
407 #endif
408     toolbar->AddSeparator();
409     toolbar->AddTool( StopStream_Event, wxU(_("Stop")), wxBitmap( stop_xpm ),
410                       wxU(_(HELP_STOP)) );
411     toolbar->AddTool( PlayStream_Event, wxU(_("Play")), wxBitmap( play_xpm ),
412                       wxU(_(HELP_PLAY)) );
413     toolbar->AddSeparator();
414     toolbar->AddTool( Playlist_Event, wxU(_("Playlist")),
415                       wxBitmap( playlist_xpm ), wxU(_(HELP_PLO)) );
416     toolbar->AddTool( PrevStream_Event, wxU(_("Prev")),
417                       wxBitmap( previous_xpm ), wxU(_(HELP_PLP)) );
418     toolbar->AddTool( NextStream_Event, wxU(_("Next")), wxBitmap( next_xpm ),
419                       wxU(_(HELP_PLN)) );
420     toolbar->AddTool( SlowStream_Event, wxU(_("Slower")), wxBitmap( slow_xpm ),
421                       wxU(_(HELP_SLOW)) );
422     toolbar->AddTool( FastStream_Event, wxU(_("Faster")), wxBitmap( fast_xpm ),
423                       wxU(_(HELP_FAST)) );
424
425     toolbar->Realize();
426
427     /* Place the toolbar in a sizer, so we can calculate the width of the
428      * toolbar and set this as the minimum for the main frame size. */
429     wxBoxSizer *toolbar_sizer = new wxBoxSizer( wxHORIZONTAL );
430     toolbar_sizer->Add( toolbar, 0, 0, 0 );
431
432     toolbar_sizer->Layout();
433
434 #ifndef WIN32
435     frame_sizer->SetMinSize( toolbar_sizer->GetMinSize().GetWidth(), -1 );
436 #else
437     frame_sizer->SetMinSize( toolbar->GetToolSize().GetWidth() *
438                              toolbar->GetToolsCount(), -1 );
439 #endif
440
441 #if !defined(__WXX11__)
442     /* Associate drop targets with the toolbar */
443     toolbar->SetDropTarget( new DragAndDrop( p_intf ) );
444 #endif
445 }
446
447 void Interface::CreateOurSlider()
448 {
449     /* Create a new frame and sizer containing the slider */
450     slider_frame = new wxPanel( this, -1, wxDefaultPosition, wxDefaultSize );
451     slider_frame->SetAutoLayout( TRUE );
452     wxBoxSizer *frame_sizer =
453         new wxBoxSizer( wxHORIZONTAL );
454
455     /* Create static box to surround the slider */
456     slider_box = new wxStaticBox( slider_frame, -1, wxT("") );
457
458     /* Create sizer for slider frame */
459     wxStaticBoxSizer *slider_sizer =
460         new wxStaticBoxSizer( slider_box, wxHORIZONTAL );
461     slider_sizer->SetMinSize( -1, 50 );
462
463     /* Create slider */
464     slider = new wxSlider( slider_frame, SliderScroll_Event, 0, 0,
465                            SLIDER_MAX_POS, wxDefaultPosition, wxDefaultSize );
466     slider_sizer->Add( slider, 1, wxEXPAND | wxALL, 5 );
467
468
469     volctrl = new wxVolCtrl( p_intf, slider_frame, -1 );
470
471     /* Add everything to the frame */
472     frame_sizer->Add( slider_sizer, 1, wxEXPAND | wxBOTTOM, 5 );
473     frame_sizer->Add( volctrl, 0, wxEXPAND | wxALL, 5 );
474     slider_frame->SetSizer( frame_sizer );
475     frame_sizer->Layout();
476     frame_sizer->SetSizeHints(slider_frame);
477
478     /* Hide the slider by default */
479     slider_frame->Hide();
480 }
481
482
483 void Interface::CreateOurExtraPanel()
484 {
485     char *psz_filters;
486
487     extra_frame = new wxPanel( this, -1, wxDefaultPosition, wxDefaultSize );
488     extra_frame->SetAutoLayout( TRUE );
489     wxBoxSizer *extra_sizer = new wxBoxSizer( wxHORIZONTAL );
490
491     /* Create static box to surround the adjust controls */
492     adjust_box = new wxStaticBox( extra_frame, -1, wxU(_("Image adjust")) );
493
494     /* Create the size for the frame */
495     wxStaticBoxSizer *adjust_sizer =
496         new wxStaticBoxSizer( adjust_box, wxVERTICAL );
497     adjust_sizer->SetMinSize( -1, 50 );
498
499     /* Create every controls */
500
501     /* Create the adjust button */
502     wxCheckBox * adjust_check = new wxCheckBox( extra_frame, Adjust_Event,
503                                                  wxU(_("Enable")));
504
505
506     wxBoxSizer *hue_sizer = new wxBoxSizer( wxHORIZONTAL );
507     wxStaticText *hue_text = new wxStaticText( extra_frame, -1,
508                                        wxU(_("Hue")) );
509     hue_slider = new wxSlider ( extra_frame, Hue_Event, 0, 0,
510                                 360, wxDefaultPosition, wxDefaultSize );
511
512     hue_sizer->Add(hue_text,1, 0 ,0);
513     hue_sizer->Add(hue_slider,1, 0 ,0);
514     hue_sizer->Layout();
515
516     wxBoxSizer *contrast_sizer = new wxBoxSizer( wxHORIZONTAL );
517     wxStaticText *contrast_text = new wxStaticText( extra_frame, -1,
518                                        wxU(_("Contrast")) );
519     contrast_slider = new wxSlider ( extra_frame, Contrast_Event, 0, 0,
520                                 200, wxDefaultPosition, wxDefaultSize);
521     contrast_sizer->Add(contrast_text,1, 0 ,0);
522     contrast_sizer->Add(contrast_slider,1, 0 ,0);
523     contrast_sizer->Layout();
524
525     wxBoxSizer *brightness_sizer = new wxBoxSizer( wxHORIZONTAL );
526     wxStaticText *brightness_text = new wxStaticText( extra_frame, -1,
527                                        wxU(_("Brightness")) );
528     brightness_slider = new wxSlider ( extra_frame, Brightness_Event, 0, 0,
529                            200, wxDefaultPosition, wxDefaultSize) ;
530     brightness_sizer->Add(brightness_text,1,0,0);
531     brightness_sizer->Add(brightness_slider,1,0,0);
532     brightness_sizer->Layout();
533
534     wxBoxSizer *saturation_sizer = new wxBoxSizer( wxHORIZONTAL );
535     wxStaticText *saturation_text = new wxStaticText( extra_frame, -1,
536                                           wxU(_("Saturation")) );
537     saturation_slider = new wxSlider ( extra_frame, Saturation_Event, 0, 0,
538                            300, wxDefaultPosition, wxDefaultSize );
539     saturation_sizer->Add(saturation_text,1,0,0);
540     saturation_sizer->Add(saturation_slider,1,0,0);
541     saturation_sizer->Layout();
542
543     adjust_sizer->Add(adjust_check, 1, wxEXPAND, 0);
544     adjust_sizer->Add(hue_sizer, 1, wxEXPAND, 0);
545     adjust_sizer->Add(contrast_sizer, 1, wxEXPAND, 0);
546     adjust_sizer->Add(brightness_sizer, 1, wxEXPAND, 0);
547     adjust_sizer->Add(saturation_sizer, 1, wxEXPAND, 0);
548
549     extra_sizer->Add(adjust_sizer,1,wxBOTTOM,5);
550
551
552     /* Create static box to surround the other controls */
553     other_box = new wxStaticBox( extra_frame, -1, wxU(_("Video Options")) );
554
555     /* Create the sizer for the frame */
556     wxStaticBoxSizer *other_sizer =
557         new wxStaticBoxSizer( other_box, wxVERTICAL );
558     other_sizer->SetMinSize( -1, 50 );
559
560     static const wxString ratio_array[] =
561     {
562         wxT("4:3"),
563         wxT("16:9"),
564     };
565
566     wxBoxSizer *ratio_sizer = new wxBoxSizer( wxHORIZONTAL );
567     wxStaticText *ratio_text = new wxStaticText( extra_frame, -1,
568                                           wxU(_("Ratio")) );
569
570     ratio_combo = new wxComboBox( extra_frame, Ratio_Event, wxT(""),
571                                   wxDefaultPosition, wxSize(120,-1),
572                                   WXSIZEOF(ratio_array), ratio_array,
573                                   0 );
574
575     ratio_sizer->Add( ratio_text, 0, wxALL, 2 );
576     ratio_sizer->Add( ratio_combo, 0, wxALL, 2 );
577     ratio_sizer->Layout();
578
579     other_sizer->Add(ratio_sizer,0,wxALL,0 );
580
581     extra_sizer->Add(other_sizer,0,wxBOTTOM,5);
582
583     extra_frame->SetSizer( extra_sizer );
584
585     /* Layout the whole panel */
586     extra_sizer->Layout();
587
588     extra_sizer->SetSizeHints(extra_frame);
589
590     /* Write down initial values */
591     psz_filters = config_GetPsz( p_intf, "filter" );
592
593     if(psz_filters == NULL) psz_filters=strdup("");
594
595     if( strstr(psz_filters,"adjust") )
596     {
597         adjust_check->SetValue( 1 );
598         saturation_slider->Enable();
599         contrast_slider->Enable();
600         brightness_slider->Enable();
601         hue_slider->Enable();
602     }
603     else
604     {
605         adjust_check->SetValue( 0 );
606         saturation_slider->Disable();
607         contrast_slider->Disable();
608         brightness_slider->Disable();
609         hue_slider->Disable();
610     }
611
612     int i_value = config_GetInt( p_intf, "hue" );
613     if( i_value > 0 && i_value < 360 )
614         hue_slider->SetValue( i_value );
615
616     float f_value;
617     f_value = config_GetFloat( p_intf, "saturation" );
618     if( f_value > 0 && f_value < 5 )
619         saturation_slider->SetValue( (int)(100 * f_value) );
620     f_value = config_GetFloat( p_intf, "contrast" );
621     if( f_value > 0 && f_value < 4 )
622         contrast_slider->SetValue( (int)(100 * f_value) );
623     f_value = config_GetFloat( p_intf, "brightness" );
624     if( f_value > 0 && f_value < 2 )
625         brightness_slider->SetValue( (int)(100 * f_value) );
626
627     extra_frame->Hide();
628     free(psz_filters);
629 }
630
631 void Interface::UpdateAcceleratorTable()
632 {
633     /* Set some hotkeys */
634     wxAcceleratorEntry entries[7];
635     vlc_value_t val;
636     int i = 0;
637
638     var_Get( p_intf->p_vlc, "key-quit", &val );
639     entries[i++].Set( ConvertHotkeyModifiers( val.i_int ),
640                       ConvertHotkey( val.i_int ), Exit_Event );
641     var_Get( p_intf->p_vlc, "key-stop", &val );
642     entries[i++].Set( ConvertHotkeyModifiers( val.i_int ),
643                       ConvertHotkey( val.i_int ), StopStream_Event );
644     var_Get( p_intf->p_vlc, "key-play-pause", &val );
645     entries[i++].Set( ConvertHotkeyModifiers( val.i_int ),
646                       ConvertHotkey( val.i_int ), PlayStream_Event );
647     var_Get( p_intf->p_vlc, "key-next", &val );
648     entries[i++].Set( ConvertHotkeyModifiers( val.i_int ),
649                       ConvertHotkey( val.i_int ), NextStream_Event );
650     var_Get( p_intf->p_vlc, "key-prev", &val );
651     entries[i++].Set( ConvertHotkeyModifiers( val.i_int ),
652                       ConvertHotkey( val.i_int ), PrevStream_Event );
653     var_Get( p_intf->p_vlc, "key-faster", &val );
654     entries[i++].Set( ConvertHotkeyModifiers( val.i_int ),
655                       ConvertHotkey( val.i_int ), FastStream_Event );
656     var_Get( p_intf->p_vlc, "key-slower", &val );
657     entries[i++].Set( ConvertHotkeyModifiers( val.i_int ),
658                       ConvertHotkey( val.i_int ), SlowStream_Event );
659
660     wxAcceleratorTable accel( 7, entries );
661
662     if( !accel.Ok() )
663         msg_Err( p_intf, "invalid accelerator table" );
664
665     SetAcceleratorTable( accel );
666     msg_Dbg( p_intf, "accelerator table loaded" );
667
668 }
669
670 /*****************************************************************************
671  * Event Handlers.
672  *****************************************************************************/
673 /* Work-around helper for buggy wxGTK */
674 void RecursiveDestroy( wxMenu *menu )
675 {
676     wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst();
677     for( ; node; )
678     {
679         wxMenuItem *item = node->GetData();
680         node = node->GetNext();
681
682         /* Delete the submenus */
683         wxMenu *submenu = item->GetSubMenu();
684         if( submenu )
685         {
686             RecursiveDestroy( submenu );
687         }
688         menu->Delete( item );
689     }
690 }
691
692 void Interface::OnMenuOpen(wxMenuEvent& event)
693 {
694 #if !defined( __WXMSW__ )
695     if( event.GetEventObject() == p_audio_menu )
696     {
697         if( b_audio_menu )
698         {
699             p_audio_menu = AudioMenu( p_intf, this );
700
701             /* Work-around for buggy wxGTK */
702             wxMenu *menu = GetMenuBar()->GetMenu( 3 );
703             RecursiveDestroy( menu );
704             /* End work-around */
705
706             menu =
707                 GetMenuBar()->Replace( 3, p_audio_menu, wxU(_("&Audio")) );
708             if( menu ) delete menu;
709
710             b_audio_menu = 0;
711         }
712         else b_audio_menu = 1;
713     }
714     else if( event.GetEventObject() == p_video_menu )
715     {
716         if( b_video_menu )
717         {
718             p_video_menu = VideoMenu( p_intf, this );
719
720             /* Work-around for buggy wxGTK */
721             wxMenu *menu = GetMenuBar()->GetMenu( 4 );
722             RecursiveDestroy( menu );
723             /* End work-around */
724
725             menu =
726                 GetMenuBar()->Replace( 4, p_video_menu, wxU(_("&Video")) );
727             if( menu ) delete menu;
728
729             b_video_menu = 0;
730         }
731         else b_video_menu = 1;
732     }
733     else if( event.GetEventObject() == p_navig_menu )
734     {
735         if( b_navig_menu )
736         {
737             p_navig_menu = NavigMenu( p_intf, this );
738
739             /* Work-around for buggy wxGTK */
740             wxMenu *menu = GetMenuBar()->GetMenu( 5 );
741             RecursiveDestroy( menu );
742             /* End work-around */
743
744             menu =
745                 GetMenuBar()->Replace( 5, p_navig_menu, wxU(_("&Navigation")));
746             if( menu ) delete menu;
747
748             b_navig_menu = 0;
749         }
750         else b_navig_menu = 1;
751     }
752     else if( event.GetEventObject() == p_misc_menu )
753     {
754         if( b_misc_menu )
755         {
756             p_misc_menu = MiscMenu( p_intf, this );
757
758             /* Work-around for buggy wxGTK */
759             wxMenu *menu = GetMenuBar()->GetMenu( 6 );
760             RecursiveDestroy( menu );
761             /* End work-around */
762
763             menu = GetMenuBar()->Replace( 6, p_misc_menu,
764                                           wxU(_("&Miscellaneous")));
765             if( menu ) delete menu;
766
767             b_misc_menu = 0;
768         }
769         else b_misc_menu = 1;
770     }
771
772 #else
773     p_audio_menu = AudioMenu( p_intf, this );
774     wxMenu *menu = GetMenuBar()->Replace( 3, p_audio_menu, wxU(_("&Audio")) );
775     if( menu ) delete menu;
776
777     p_video_menu = VideoMenu( p_intf, this );
778     menu = GetMenuBar()->Replace( 4, p_video_menu, wxU(_("&Video")) );
779     if( menu ) delete menu;
780
781     p_navig_menu = NavigMenu( p_intf, this );
782     menu = GetMenuBar()->Replace( 5, p_navig_menu, wxU(_("&Navigation")) );
783     if( menu ) delete menu;
784
785     p_misc_menu = MiscMenu( p_intf, this );
786     menu = GetMenuBar()->Replace( 6, p_misc_menu, wxU(_("&Miscellaneous")) );
787     if( menu ) delete menu;
788 #endif
789 }
790
791 #if defined( __WXMSW__ ) || defined( __WXMAC__ )
792 void Interface::OnContextMenu2(wxContextMenuEvent& event)
793 {
794     /* Only show the context menu for the main interface */
795     if( GetId() != event.GetId() )
796     {
797         event.Skip();
798         return;
799     }
800
801     if( p_intf->p_sys->pf_show_dialog )
802         p_intf->p_sys->pf_show_dialog( p_intf, INTF_DIALOG_POPUPMENU, 1, 0 );
803 }
804 #endif
805 void Interface::OnContextMenu(wxMouseEvent& event)
806 {
807     if( p_intf->p_sys->pf_show_dialog )
808         p_intf->p_sys->pf_show_dialog( p_intf, INTF_DIALOG_POPUPMENU, 1, 0 );
809 }
810
811 void Interface::OnExit( wxCommandEvent& WXUNUSED(event) )
812 {
813     /* TRUE is to force the frame to close. */
814     Close(TRUE);
815 }
816
817 void Interface::OnAbout( wxCommandEvent& WXUNUSED(event) )
818 {
819     wxString msg;
820     msg.Printf( wxString(wxT("VLC media player " VERSION)) +
821         wxU(_(" (wxWindows interface)\n\n")) +
822         wxU(_("(C) 1996-2003 - the VideoLAN Team\n\n")) +
823         wxU( INTF_ABOUT_MSG ) + wxT("\n\n") +
824         wxU(_("The VideoLAN team <videolan@videolan.org>\n"
825               "http://www.videolan.org/\n\n")) );
826
827     wxMessageBox( msg, wxString::Format(wxU(_("About %s")),
828                   wxT("VLC media player")), wxOK | wxICON_INFORMATION, this );
829 }
830
831 void Interface::OnShowDialog( wxCommandEvent& event )
832 {
833     if( p_intf->p_sys->pf_show_dialog )
834     {
835         int i_id;
836
837         switch( event.GetId() )
838         {
839         case OpenFileSimple_Event:
840             i_id = INTF_DIALOG_FILE_SIMPLE;
841             break;
842         case OpenFile_Event:
843             i_id = INTF_DIALOG_FILE;
844             break;
845         case OpenDisc_Event:
846             i_id = INTF_DIALOG_DISC;
847             break;
848         case OpenNet_Event:
849             i_id = INTF_DIALOG_NET;
850             break;
851         case OpenSat_Event:
852             i_id = INTF_DIALOG_SAT;
853             break;
854         case Playlist_Event:
855             i_id = INTF_DIALOG_PLAYLIST;
856             break;
857         case Logs_Event:
858             i_id = INTF_DIALOG_MESSAGES;
859             break;
860         case FileInfo_Event:
861             i_id = INTF_DIALOG_FILEINFO;
862             break;
863         case Prefs_Event:
864             i_id = INTF_DIALOG_PREFS;
865             break;
866         default:
867             i_id = INTF_DIALOG_FILE;
868             break;
869
870         }
871
872         p_intf->p_sys->pf_show_dialog( p_intf, i_id, 1, 0 );
873     }
874 }
875
876 void Interface::OnExtra(wxCommandEvent& event)
877 {
878     if( b_extra == VLC_FALSE)
879     {
880         extra_frame->Show();
881         frame_sizer->Show( extra_frame );
882         b_extra = VLC_TRUE;
883     }
884     else
885     {
886         extra_frame->Hide();
887         frame_sizer->Hide( extra_frame );
888         b_extra = VLC_FALSE;
889     }
890     frame_sizer->Layout();
891     frame_sizer->Fit(this);
892 }
893
894 void Interface::OnEnableAdjust(wxCommandEvent& event)
895 {
896     char *psz_filters=config_GetPsz( p_intf, "filter");
897     char *psz_new = NULL;
898     if( event.IsChecked() )
899     {
900         if(psz_filters == NULL)
901         {
902             psz_new = strdup( "adjust" );
903         }
904         else
905         {
906             psz_new= (char *) malloc(strlen(psz_filters) + 8 );
907             sprintf( psz_new, "%s:adjust", psz_filters);
908         }
909         config_PutPsz( p_intf, "filter", psz_new );
910         vlc_value_t val;
911         vout_thread_t *p_vout =
912            (vout_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT,
913                                        FIND_ANYWHERE );
914         if( p_vout != NULL )
915         {
916             val.psz_string = strdup( psz_new );
917             var_Set( p_vout, "filter", val);
918             vlc_object_release( p_vout );
919         }
920         if( val.psz_string ) free( val.psz_string );
921         brightness_slider->Enable();
922         saturation_slider->Enable();
923         contrast_slider->Enable();
924         hue_slider->Enable();
925     }
926     else
927     {
928         if( psz_filters != NULL )
929         {
930
931             char *psz_current;
932             unsigned int i=0;
933             for( i = 0; i< strlen(psz_filters ); i++)
934             {
935                 if ( !strncasecmp( &psz_filters[i],"adjust",6 ))
936                 {
937                     if(i > 0)
938                         if( psz_filters[i-1] == ':' ) i--;
939                     psz_current = strchr( &psz_filters[i+1] , ':' );
940                     if( !psz_current )
941                         psz_filters[i] = '\0';
942                     else
943                     {
944                        memmove( &psz_filters[i] , psz_current,
945                                 &psz_filters[strlen(psz_filters)]-psz_current
946                                 +1);
947                     }
948                 }
949             }
950             config_PutPsz( p_intf, "filter", psz_filters);
951             vlc_value_t val;
952             val.psz_string = strdup( psz_filters );
953             vout_thread_t *p_vout =
954                (vout_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT,
955                                        FIND_ANYWHERE );
956             if( p_vout != NULL )
957             {
958                 var_Set( p_vout, "filter", val);
959                 vlc_object_release( p_vout );
960             }
961             if( val.psz_string ) free( val.psz_string );
962         }
963         brightness_slider->Disable();
964         saturation_slider->Disable();
965         contrast_slider->Disable();
966         hue_slider->Disable();
967     }
968     if(psz_filters) free(psz_filters);
969     if(psz_new) free(psz_new);
970 }
971
972 void Interface::OnHueUpdate( wxScrollEvent& event)
973 {
974    config_PutInt( p_intf , "hue" , event.GetPosition() );
975 }
976
977 void Interface::OnSaturationUpdate( wxScrollEvent& event)
978 {
979    config_PutFloat( p_intf , "saturation" , (float)event.GetPosition()/100 );
980 }
981
982 void Interface::OnBrightnessUpdate( wxScrollEvent& event)
983 {
984    config_PutFloat( p_intf , "brightness", (float)event.GetPosition()/100 );
985 }
986
987 void Interface::OnContrastUpdate(wxScrollEvent& event)
988 {
989    config_PutFloat( p_intf , "contrast" , (float)event.GetPosition()/100 );
990
991 }
992
993 void Interface::OnRatio( wxCommandEvent& event )
994 {
995    config_PutPsz( p_intf, "aspect-ratio", ratio_combo->GetValue().mb_str() );
996 }
997
998 void Interface::OnPlayStream( wxCommandEvent& WXUNUSED(event) )
999 {
1000     wxCommandEvent dummy;
1001     playlist_t *p_playlist =
1002         (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
1003                                        FIND_ANYWHERE );
1004     if( p_playlist == NULL ) return;
1005
1006     if( p_playlist->i_size && p_playlist->i_enabled )
1007     {
1008         vlc_value_t state;
1009
1010         input_thread_t *p_input = (input_thread_t *)vlc_object_find( p_intf,
1011                                                        VLC_OBJECT_INPUT,
1012                                                        FIND_ANYWHERE );
1013         if( p_input == NULL )
1014         {
1015             /* No stream was playing, start one */
1016             playlist_Play( p_playlist );
1017             TogglePlayButton( PLAYING_S );
1018             vlc_object_release( p_playlist );
1019             return;
1020         }
1021
1022         var_Get( p_input, "state", &state );
1023
1024         if( state.i_int != PAUSE_S )
1025         {
1026             /* A stream is being played, pause it */
1027             state.i_int = PAUSE_S;
1028         }
1029         else
1030         {
1031             /* Stream is paused, resume it */
1032             state.i_int = PLAYING_S;
1033         }
1034         var_Set( p_input, "state", state );
1035
1036         TogglePlayButton( state.i_int );
1037         vlc_object_release( p_input );
1038         vlc_object_release( p_playlist );
1039     }
1040     else
1041     {
1042         /* If the playlist is empty, open a file requester instead */
1043         vlc_object_release( p_playlist );
1044         OnShowDialog( dummy );
1045     }
1046 }
1047
1048 void Interface::OnStopStream( wxCommandEvent& WXUNUSED(event) )
1049 {
1050     playlist_t * p_playlist =
1051         (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
1052                                        FIND_ANYWHERE );
1053     if( p_playlist == NULL )
1054     {
1055         return;
1056     }
1057
1058     playlist_Stop( p_playlist );
1059     TogglePlayButton( PAUSE_S );
1060     vlc_object_release( p_playlist );
1061 }
1062
1063 void Interface::OnSliderUpdate( wxScrollEvent& event )
1064 {
1065     vlc_mutex_lock( &p_intf->change_lock );
1066
1067 #ifdef WIN32
1068     if( event.GetEventType() == wxEVT_SCROLL_THUMBRELEASE
1069         || event.GetEventType() == wxEVT_SCROLL_ENDSCROLL )
1070     {
1071 #endif
1072         if( p_intf->p_sys->i_slider_pos != event.GetPosition()
1073             && p_intf->p_sys->p_input )
1074         {
1075             vlc_value_t pos;
1076             pos.f_float = (float)event.GetPosition() / (float)SLIDER_MAX_POS;
1077
1078             var_Set( p_intf->p_sys->p_input, "position", pos );
1079         }
1080
1081 #ifdef WIN32
1082         p_intf->p_sys->b_slider_free = VLC_TRUE;
1083     }
1084     else
1085     {
1086         p_intf->p_sys->b_slider_free = VLC_FALSE;
1087
1088         if( p_intf->p_sys->p_input )
1089         {
1090             /* Update stream date */
1091 #define p_area p_intf->p_sys->p_input->stream.p_selected_area
1092             char psz_time[ OFFSETTOTIME_MAX_SIZE ];
1093
1094             slider_box->SetLabel(
1095                 wxU(input_OffsetToTime( p_intf->p_sys->p_input,
1096                                         psz_time,
1097                                         p_area->i_size * event.GetPosition()
1098                                         / SLIDER_MAX_POS )) );
1099 #undef p_area
1100         }
1101     }
1102 #endif
1103
1104     vlc_mutex_unlock( &p_intf->change_lock );
1105 }
1106
1107 void Interface::OnPrevStream( wxCommandEvent& WXUNUSED(event) )
1108 {
1109     playlist_t * p_playlist =
1110         (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
1111                                        FIND_ANYWHERE );
1112     if( p_playlist == NULL )
1113     {
1114         return;
1115     }
1116
1117     vlc_mutex_lock( &p_playlist->object_lock );
1118     if( p_playlist->p_input != NULL )
1119     {
1120         vlc_mutex_lock( &p_playlist->p_input->stream.stream_lock );
1121         if( p_playlist->p_input->stream.p_selected_area->i_id > 1 )
1122         {
1123             vlc_value_t val; val.b_bool = VLC_TRUE;
1124             vlc_mutex_unlock( &p_playlist->p_input->stream.stream_lock );
1125             var_Set( p_playlist->p_input, "prev-title", val );
1126             vlc_mutex_unlock( &p_playlist->object_lock );
1127             vlc_object_release( p_playlist );  
1128             return;
1129         }
1130         vlc_mutex_unlock( &p_playlist->p_input->stream.stream_lock );
1131     }
1132     vlc_mutex_unlock( &p_playlist->object_lock );
1133
1134     playlist_Prev( p_playlist );
1135     vlc_object_release( p_playlist );
1136 }
1137
1138 void Interface::OnNextStream( wxCommandEvent& WXUNUSED(event) )
1139 {
1140     playlist_t * p_playlist =
1141         (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
1142                                        FIND_ANYWHERE );
1143     if( p_playlist == NULL )
1144     {
1145         return;
1146     }
1147
1148     vlc_mutex_lock( &p_playlist->object_lock );
1149     if( p_playlist->p_input != NULL )
1150     {
1151         vlc_mutex_lock( &p_playlist->p_input->stream.stream_lock );
1152         if( p_playlist->p_input->stream.i_area_nb > 1 &&
1153             p_playlist->p_input->stream.p_selected_area->i_id <
1154               p_playlist->p_input->stream.i_area_nb - 1 )
1155         {
1156             vlc_value_t val; val.b_bool = VLC_TRUE;
1157             vlc_mutex_unlock( &p_playlist->p_input->stream.stream_lock );
1158             var_Set( p_playlist->p_input, "next-title", val );
1159             vlc_mutex_unlock( &p_playlist->object_lock );
1160             vlc_object_release( p_playlist );  
1161             return;
1162         }
1163         vlc_mutex_unlock( &p_playlist->p_input->stream.stream_lock );
1164     }
1165     vlc_mutex_unlock( &p_playlist->object_lock );
1166
1167     playlist_Next( p_playlist );
1168     vlc_object_release( p_playlist );
1169 }
1170
1171 void Interface::OnSlowStream( wxCommandEvent& WXUNUSED(event) )
1172 {
1173     input_thread_t *p_input =
1174         (input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT,
1175                                            FIND_ANYWHERE );
1176     if( p_input )
1177     {
1178         vlc_value_t val; val.b_bool = VLC_TRUE;
1179
1180         var_Set( p_input, "rate-slower", val );
1181         vlc_object_release( p_input );
1182     }
1183 }
1184
1185 void Interface::OnFastStream( wxCommandEvent& WXUNUSED(event) )
1186 {
1187     input_thread_t *p_input =
1188         (input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT,
1189                                            FIND_ANYWHERE );
1190     if( p_input )
1191     {
1192         vlc_value_t val; val.b_bool = VLC_TRUE;
1193
1194         var_Set( p_input, "rate-faster", val );
1195         vlc_object_release( p_input );
1196     }
1197 }
1198
1199 void Interface::TogglePlayButton( int i_playing_status )
1200 {
1201     if( i_playing_status == i_old_playing_status )
1202         return;
1203
1204     GetToolBar()->DeleteTool( PlayStream_Event );
1205
1206     if( i_playing_status == PLAYING_S )
1207     {
1208         GetToolBar()->InsertTool( 5, PlayStream_Event, wxU(_("Pause")),
1209                                   wxBitmap( pause_xpm ), wxNullBitmap,
1210                                   wxITEM_NORMAL, wxU(_(HELP_PAUSE)) );
1211     }
1212     else
1213     {
1214         GetToolBar()->InsertTool( 5, PlayStream_Event, wxU(_("Play")),
1215                                   wxBitmap( play_xpm ), wxNullBitmap,
1216                                   wxITEM_NORMAL, wxU(_(HELP_PLAY)) );
1217     }
1218
1219     GetToolBar()->Realize();
1220
1221     i_old_playing_status = i_playing_status;
1222 }
1223
1224 #if !defined(__WXX11__)
1225 /*****************************************************************************
1226  * Definition of DragAndDrop class.
1227  *****************************************************************************/
1228 DragAndDrop::DragAndDrop( intf_thread_t *_p_intf )
1229 {
1230     p_intf = _p_intf;
1231 }
1232
1233 bool DragAndDrop::OnDropFiles( wxCoord, wxCoord,
1234                                const wxArrayString& filenames )
1235 {
1236     /* Add dropped files to the playlist */
1237
1238     playlist_t *p_playlist =
1239         (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
1240                                        FIND_ANYWHERE );
1241     if( p_playlist == NULL )
1242     {
1243         return FALSE;
1244     }
1245
1246     for( size_t i = 0; i < filenames.GetCount(); i++ )
1247         playlist_Add( p_playlist, (const char *)filenames[i].mb_str(), 0, 0,
1248                       PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO), PLAYLIST_END );
1249
1250     vlc_object_release( p_playlist );
1251
1252     return TRUE;
1253 }
1254 #endif
1255
1256 /*****************************************************************************
1257  * Definition of wxVolCtrl class.
1258  *****************************************************************************/
1259 wxVolCtrl::wxVolCtrl( intf_thread_t *_p_intf, wxWindow* parent, wxWindowID id )
1260   : wxGauge( parent, id, 200, wxDefaultPosition, wxDefaultSize,
1261              wxGA_VERTICAL | wxGA_SMOOTH )
1262 {
1263     p_intf = _p_intf;
1264 }
1265
1266 void wxVolCtrl::OnChange( wxMouseEvent& event )
1267 {
1268     if( !event.LeftDown() && !event.LeftIsDown() ) return;
1269
1270     int i_volume = (GetClientSize().GetHeight() - event.GetY()) * 200 /
1271                     GetClientSize().GetHeight();
1272     Change( i_volume );
1273 }
1274
1275 void wxVolCtrl::Change( int i_volume )
1276 {
1277     aout_VolumeSet( p_intf, i_volume * AOUT_VOLUME_MAX / 200 / 2 );
1278     SetValue( i_volume );
1279     SetToolTip( wxString::Format((wxString)wxU(_("Volume")) + wxT(" %d"),
1280                 i_volume ) );
1281 }