]> git.sesse.net Git - vlc/blob - modules/gui/wxwidgets/extrapanel.cpp
Removes trailing spaces. Removes tabs.
[vlc] / modules / gui / wxwidgets / extrapanel.cpp
1 /*****************************************************************************
2  * extrapanel.cpp : wxWindows plugin for vlc
3  *****************************************************************************
4  * Copyright (C) 2000-2004, 2003 the VideoLAN team
5  * $Id$
6  *
7  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23
24 /*****************************************************************************
25  * Preamble
26  *****************************************************************************/
27 #include <vlc/vlc.h>
28 #include <vlc_aout.h>
29 #include <vlc_vout.h>
30 #include <vlc_interface.h>
31
32 #include <math.h>
33
34 #include "extrapanel.hpp"
35
36 /*****************************************************************************
37  * Local class declarations.
38  *****************************************************************************/
39
40 #define SMOOTH_TIP N_( "Controls the blending of equalizer bands. The higher" \
41             " this value is, the more correlated their movement will be." )
42
43 static int IntfBandsCallback( vlc_object_t *, char const *,
44                               vlc_value_t, vlc_value_t, void * );
45 static int IntfPreampCallback( vlc_object_t *, char const *,
46                                vlc_value_t, vlc_value_t, void * );
47 static void ChangeFiltersString( intf_thread_t *, aout_instance_t *,
48                                  char *, vlc_bool_t );
49 static void ChangeVFiltersString( intf_thread_t *, char *, vlc_bool_t );
50
51
52 /* IDs for the controls and the menu commands */
53 enum
54 {
55     Notebook_Event,
56
57     Adjust_Event,
58     RestoreDefaults_Event,
59
60     Hue_Event,
61     Contrast_Event,
62     Brightness_Event,
63     Saturation_Event,
64     Gamma_Event,
65     Ratio_Event,
66
67     FiltersInfo_Event,
68
69     Filter0_Event, Filter1_Event, Filter2_Event, Filter3_Event, Filter4_Event,
70     Filter5_Event, Filter6_Event, Filter7_Event, Filter8_Event, Filter9_Event,
71
72     EqEnable_Event,
73     Eq2Pass_Event,
74     EqRestore_Event,
75
76     Smooth_Event,
77
78     Preamp_Event,
79
80     Band0_Event,Band1_Event,Band2_Event,Band3_Event,Band4_Event,
81     Band5_Event,Band6_Event,Band7_Event,Band8_Event,Band9_Event,
82
83     NormVol_Event, NVSlider_Event, HeadPhone_Event
84 };
85
86 BEGIN_EVENT_TABLE( ExtraPanel, wxPanel )
87     EVT_IDLE( ExtraPanel::OnIdle )
88
89     /* Equalizer */
90     EVT_CHECKBOX( EqEnable_Event, ExtraPanel::OnEnableEqualizer )
91     EVT_CHECKBOX( Eq2Pass_Event, ExtraPanel::OnEq2Pass )
92     EVT_BUTTON( EqRestore_Event, ExtraPanel::OnEqRestore )
93
94     EVT_COMMAND_SCROLL( Preamp_Event, ExtraPanel::OnPreamp )
95     EVT_COMMAND_SCROLL( Smooth_Event, ExtraPanel::OnEqSmooth )
96
97     EVT_COMMAND_SCROLL(Band0_Event, ExtraPanel::OnChangeEqualizer)
98     EVT_COMMAND_SCROLL(Band1_Event, ExtraPanel::OnChangeEqualizer)
99     EVT_COMMAND_SCROLL(Band2_Event, ExtraPanel::OnChangeEqualizer)
100     EVT_COMMAND_SCROLL(Band3_Event, ExtraPanel::OnChangeEqualizer)
101     EVT_COMMAND_SCROLL(Band4_Event, ExtraPanel::OnChangeEqualizer)
102     EVT_COMMAND_SCROLL(Band5_Event, ExtraPanel::OnChangeEqualizer)
103     EVT_COMMAND_SCROLL(Band6_Event, ExtraPanel::OnChangeEqualizer)
104     EVT_COMMAND_SCROLL(Band7_Event, ExtraPanel::OnChangeEqualizer)
105     EVT_COMMAND_SCROLL(Band8_Event, ExtraPanel::OnChangeEqualizer)
106     EVT_COMMAND_SCROLL(Band9_Event, ExtraPanel::OnChangeEqualizer)
107
108     /* Video */
109     EVT_CHECKBOX( Adjust_Event, ExtraPanel::OnEnableAdjust )
110     EVT_BUTTON( RestoreDefaults_Event, ExtraPanel::OnRestoreDefaults )
111
112     EVT_COMMAND_SCROLL(Hue_Event, ExtraPanel::OnAdjustUpdate)
113     EVT_COMMAND_SCROLL(Contrast_Event, ExtraPanel::OnAdjustUpdate)
114     EVT_COMMAND_SCROLL(Brightness_Event, ExtraPanel::OnAdjustUpdate)
115     EVT_COMMAND_SCROLL(Saturation_Event, ExtraPanel::OnAdjustUpdate)
116     EVT_COMMAND_SCROLL(Gamma_Event, ExtraPanel::OnAdjustUpdate)
117
118     EVT_BUTTON( FiltersInfo_Event, ExtraPanel::OnFiltersInfo )
119
120     EVT_CHECKBOX( Filter0_Event, ExtraPanel::OnSelectFilter )
121     EVT_CHECKBOX( Filter1_Event, ExtraPanel::OnSelectFilter )
122     EVT_CHECKBOX( Filter2_Event, ExtraPanel::OnSelectFilter )
123     EVT_CHECKBOX( Filter3_Event, ExtraPanel::OnSelectFilter )
124     EVT_CHECKBOX( Filter4_Event, ExtraPanel::OnSelectFilter )
125     EVT_CHECKBOX( Filter5_Event, ExtraPanel::OnSelectFilter )
126     EVT_CHECKBOX( Filter6_Event, ExtraPanel::OnSelectFilter )
127     EVT_CHECKBOX( Filter7_Event, ExtraPanel::OnSelectFilter )
128     EVT_CHECKBOX( Filter8_Event, ExtraPanel::OnSelectFilter )
129     EVT_CHECKBOX( Filter9_Event, ExtraPanel::OnSelectFilter )
130
131     /* Audio */
132     EVT_CHECKBOX( NormVol_Event, ExtraPanel::OnNormvol )
133     EVT_CHECKBOX( HeadPhone_Event, ExtraPanel::OnHeadphone )
134
135     EVT_COMMAND_SCROLL( NVSlider_Event, ExtraPanel::OnNormvolSlider )
136
137 END_EVENT_TABLE()
138
139 struct filter {
140     char *psz_filter;
141     char *psz_name;
142     char *psz_help;
143 };
144
145 static const struct filter vfilters[] =
146 {
147     { "clone", N_("Image clone"), N_("Creates several clones of the image") },
148     { "distort", N_("Distortion"), N_("Adds distortion effects") },
149     { "invert", N_("Image inversion") , N_("Inverts the colors of the image") },
150     { "motionblur", N_("Blurring"), N_("Adds motion blurring to the image") },
151     { "transform",  N_("Transformation"), N_("Rotates or flips the image") },
152     { "magnify",  N_("Magnify"), N_("Magnifies part of the image") },
153     { "puzzle",  N_("Puzzle"), N_("Turns the image into a puzzle") },
154     { NULL, NULL, NULL } /* Do not remove this line */
155 };
156
157 /*****************************************************************************
158  * Constructor.
159  *****************************************************************************/
160 ExtraPanel::ExtraPanel( intf_thread_t *_p_intf, wxWindow *_p_parent ):
161         wxPanel( _p_parent , -1, wxDefaultPosition, wxDefaultSize )
162 {
163
164     p_intf = _p_intf;
165     p_parent = _p_parent;
166     SetAutoLayout( TRUE );
167
168     wxBoxSizer *extra_sizer = new wxBoxSizer( wxHORIZONTAL );
169
170     notebook = new wxNotebook( this, Notebook_Event );
171
172 #if (!wxCHECK_VERSION(2,5,2))
173     wxNotebookSizer *notebook_sizer = new wxNotebookSizer( notebook );
174 #endif
175
176     notebook->AddPage( VideoPanel( notebook ), wxU(_("Video")) );
177     notebook->AddPage( EqzPanel( notebook ), wxU(_("Equalizer")) );
178     notebook->AddPage( AudioPanel( notebook ), wxU(_("Audio")) );
179
180 #if (!wxCHECK_VERSION(2,5,2))
181     extra_sizer->Add( notebook_sizer, 1, wxEXPAND, 0 );
182 #else
183     extra_sizer->Add( notebook, 1, wxEXPAND, 0 );
184 #endif
185
186     SetSizerAndFit( extra_sizer );
187     extra_sizer->Layout();
188 }
189
190 ExtraPanel::~ExtraPanel()
191 {
192 }
193
194 /* Video Panel constructor */
195 wxPanel *ExtraPanel::VideoPanel( wxWindow *parent )
196 {
197     char *psz_filters;
198
199     wxPanel *panel = new wxPanel( parent, -1 );
200     wxBoxSizer *panel_sizer = new wxBoxSizer( wxHORIZONTAL );
201
202     /* Create static box to surround the adjust controls */
203     wxStaticBox *adjust_box =
204            new wxStaticBox( panel, -1, wxU(_("Image adjustment" )) );
205     wxStaticBoxSizer *adjust_sizer =
206         new wxStaticBoxSizer( adjust_box, wxVERTICAL );
207     adjust_sizer->SetMinSize( -1, 50 );
208
209     /* Create flex grid */
210     wxFlexGridSizer *adjust_gridsizer =
211         new wxFlexGridSizer( 6, 2, 0, 0);
212     adjust_gridsizer->AddGrowableCol(1);
213
214     /* Create the adjust button */
215     wxCheckBox * adjust_check = new wxCheckBox( panel, Adjust_Event,
216                                                  wxU(_("Enable")));
217
218     /* Create the restore to defaults button */
219     restoredefaults_button =
220         new wxButton( panel, RestoreDefaults_Event,
221         wxU(_("Restore Defaults")), wxDefaultPosition);
222
223     wxStaticText *hue_text = new wxStaticText( panel, -1,
224                                        wxU(_("Hue")) );
225     hue_slider = new wxSlider ( panel, Hue_Event, 0, 0,
226                                 360, wxDefaultPosition, wxDefaultSize );
227
228     wxStaticText *contrast_text = new wxStaticText( panel, -1,
229                                        wxU(_("Contrast")) );
230     contrast_slider = new wxSlider ( panel, Contrast_Event, 0, 0,
231                                 200, wxDefaultPosition, wxDefaultSize);
232
233     wxStaticText *brightness_text = new wxStaticText( panel, -1,
234                                        wxU(_("Brightness")) );
235     brightness_slider = new wxSlider ( panel, Brightness_Event, 0, 0,
236                            200, wxDefaultPosition, wxDefaultSize) ;
237
238     wxStaticText *saturation_text = new wxStaticText( panel, -1,
239                                           wxU(_("Saturation")) );
240     saturation_slider = new wxSlider ( panel, Saturation_Event, 0, 0,
241                            300, wxDefaultPosition, wxDefaultSize );
242
243     wxStaticText *gamma_text = new wxStaticText( panel, -1,
244                                           wxU(_("Gamma")) );
245     gamma_slider = new wxSlider ( panel, Gamma_Event, 0, 0,
246                            100, wxDefaultPosition, wxDefaultSize );
247
248     adjust_gridsizer->Add( adjust_check, 1, wxEXPAND|wxALL, 2 );
249     adjust_gridsizer->Add( restoredefaults_button, 1, wxEXPAND|wxALL, 2 );
250     adjust_gridsizer->Add( hue_text, 1, wxEXPAND|wxALL, 2 );
251     adjust_gridsizer->Add( hue_slider, 1, wxEXPAND|wxALL, 2 );
252     adjust_gridsizer->Add( contrast_text, 1, wxEXPAND|wxALL, 2 );
253     adjust_gridsizer->Add( contrast_slider, 1, wxEXPAND|wxALL, 2 );
254     adjust_gridsizer->Add( brightness_text, 1, wxEXPAND|wxALL, 2 );
255     adjust_gridsizer->Add( brightness_slider, 1, wxEXPAND|wxALL, 2 );
256     adjust_gridsizer->Add( saturation_text, 1, wxEXPAND|wxALL, 2 );
257     adjust_gridsizer->Add( saturation_slider, 1, wxEXPAND|wxALL, 2 );
258     adjust_gridsizer->Add( gamma_text, 1, wxEXPAND|wxALL, 2 );
259     adjust_gridsizer->Add( gamma_slider, 1, wxEXPAND|wxALL, 2 );
260
261     adjust_sizer->Add( adjust_gridsizer, 1, wxEXPAND|wxALL, 2);
262
263     panel_sizer->Add( adjust_sizer , 1, wxTOP, 2 );
264
265 #if 0
266     /* Create sizer to surround the other controls */
267     wxBoxSizer *other_sizer = new wxBoxSizer( wxVERTICAL );
268
269     wxStaticBox *video_box =
270             new wxStaticBox( panel, -1, wxU(_("Video Options")) );
271     /* Create the sizer for the frame */
272     wxStaticBoxSizer *video_sizer =
273        new wxStaticBoxSizer( video_box, wxVERTICAL );
274     video_sizer->SetMinSize( -1, 50 );
275
276     static const wxString ratio_array[] =
277     {
278         wxT("4:3"),
279         wxT("16:9"),
280     };
281
282     wxBoxSizer *ratio_sizer = new wxBoxSizer( wxHORIZONTAL );
283     wxStaticText *ratio_text = new wxStaticText( panel, -1,
284                                           wxU(_("Aspect Ratio")) );
285
286     ratio_combo = new wxComboBox( panel, Ratio_Event, wxT(""),
287                                   wxDefaultPosition, wxSize( 80 , -1),
288                                   WXSIZEOF(ratio_array), ratio_array,
289                                   0 );
290
291     ratio_sizer->Add( ratio_text, 0, wxALL, 2 );
292     ratio_sizer->Add( ratio_combo, 0, wxALL, 2 );
293     ratio_sizer->Layout();
294
295     video_sizer->Add( ratio_sizer  , 0 , wxALL , 2 );
296     video_sizer->Layout();
297 #endif
298
299     wxStaticBox *filter_box =
300                   new wxStaticBox( panel, -1, wxU(_("Video filters")) );
301     wxStaticBoxSizer *filter_sizer =
302                    new wxStaticBoxSizer( filter_box, wxHORIZONTAL );
303
304     wxBoxSizer *t_col_sizer = new wxBoxSizer( wxVERTICAL );
305
306
307     for( int i = 0 ; vfilters[i].psz_filter != NULL ; i++ )
308     {
309         wxCheckBox *box = new wxCheckBox( panel, Filter0_Event + i,
310                                           wxU( _( vfilters[i].psz_name ) ) );
311         t_col_sizer->Add( box, 0, wxALL, 2 );
312         box->SetToolTip( wxU( _( vfilters[i].psz_help ) ) );
313     }
314
315     filter_sizer->Add( t_col_sizer );
316     filter_sizer->Add( new wxButton( panel, FiltersInfo_Event,
317                             wxU(_("More Info" ) ) ), 0, wxALL, 4 );
318 #if 0
319     other_sizer->Add( video_sizer, 0, wxALL | wxEXPAND , 0);
320     other_sizer->Add( filter_sizer, 0, wxALL | wxEXPAND , 0);
321     other_sizer->Layout();
322     panel_sizer->Add(other_sizer , 1 );
323 #endif
324
325     panel_sizer->Add( filter_sizer, 1, wxTOP|wxLEFT, 2 );
326
327     panel->SetSizerAndFit( panel_sizer );
328
329     /* Layout the whole panel */
330     panel_sizer->Layout();
331
332     panel_sizer->SetSizeHints( panel );
333
334     /* Write down initial values */
335     psz_filters = config_GetPsz( p_intf, "vout-filter" );
336     if( psz_filters && strstr( psz_filters, "adjust" ) )
337     {
338         adjust_check->SetValue( 1 );
339         restoredefaults_button->Enable();
340         saturation_slider->Enable();
341         contrast_slider->Enable();
342         brightness_slider->Enable();
343         hue_slider->Enable();
344         gamma_slider->Enable();
345     }
346     else
347     {
348         adjust_check->SetValue( 0 );
349         restoredefaults_button->Disable();
350         saturation_slider->Disable();
351         contrast_slider->Disable();
352         brightness_slider->Disable();
353         hue_slider->Disable();
354         gamma_slider->Disable();
355     }
356     if( psz_filters ) free( psz_filters );
357
358     int i_value = config_GetInt( p_intf, "hue" );
359     if( i_value > 0 && i_value < 360 )
360         hue_slider->SetValue( i_value );
361     float f_value;
362     f_value = config_GetFloat( p_intf, "saturation" );
363     if( f_value > 0 && f_value < 5 )
364         saturation_slider->SetValue( (int)(100 * f_value) );
365     f_value = config_GetFloat( p_intf, "contrast" );
366     if( f_value > 0 && f_value < 4 )
367         contrast_slider->SetValue( (int)(100 * f_value) );
368     f_value = config_GetFloat( p_intf, "brightness" );
369     if( f_value > 0 && f_value < 2 )
370         brightness_slider->SetValue( (int)(100 * f_value) );
371     f_value = config_GetFloat( p_intf, "gamma" );
372     if( f_value > 0 && f_value < 10 )
373         gamma_slider->SetValue( (int)(10 * f_value) );
374
375     b_update = VLC_FALSE;
376
377     return panel;
378 }
379
380 /* Audio panel constructor */
381 wxPanel *ExtraPanel::AudioPanel( wxWindow *parent )
382 {
383     char *psz_filters;
384
385     wxPanel *panel = new wxPanel( parent, -1 );
386     wxBoxSizer *panel_sizer = new wxBoxSizer( wxHORIZONTAL );
387
388     /* Create static box to surround the adjust controls */
389     wxStaticBox *filter_box =
390            new wxStaticBox( panel, -1, wxU(_("Audio filters")) );
391     wxStaticBoxSizer *filter_sizer =
392         new wxStaticBoxSizer( filter_box, wxVERTICAL );
393     filter_sizer->SetMinSize( -1, 50 );
394
395     wxCheckBox * headphone_check = new wxCheckBox( panel, HeadPhone_Event,
396                                     wxU(_("Headphone virtualization")));
397     headphone_check->SetToolTip( wxU(_("Imitates the effect of "
398              "surround sound when using headphones." ) ) );
399
400     wxCheckBox * normvol_check = new wxCheckBox( panel, NormVol_Event,
401                                     wxU(_("Volume normalization")));
402     normvol_check->SetToolTip( wxU(_("Prevents the audio output "
403                          "level from going over a predefined value." ) ) );
404
405     wxStaticText *normvol_label = new wxStaticText( panel, -1,
406                                    wxU( _("Maximum level") ) );
407
408     wxSlider *normvol_slider = new wxSlider ( panel, NVSlider_Event, 20, 5,
409                            100, wxDefaultPosition, wxSize( 100, -1 ) );
410
411     filter_sizer->Add( headphone_check, 0, wxALL, 4 );
412     filter_sizer->Add( normvol_check, 0, wxALL, 4 );
413     filter_sizer->Add( normvol_label, 0, wxALL, 4 );
414     filter_sizer->Add( normvol_slider, 0, wxALL, 4 );
415
416     panel_sizer->Add( filter_sizer, 1, wxTOP, 2 );
417     panel->SetSizerAndFit( panel_sizer );
418     panel_sizer->Layout();
419     panel_sizer->SetSizeHints( panel );
420
421     /* Write down initial values */
422     psz_filters = config_GetPsz( p_intf, "audio-filter" );
423     if( psz_filters )
424     {
425         headphone_check->SetValue( strstr( psz_filters, "headphone" ) );
426         normvol_check->SetValue( strstr( psz_filters, "normvol" ) );
427         free( psz_filters );
428     }
429     else
430     {
431         headphone_check->SetValue( 0 );
432         normvol_check->SetValue( 0 );
433     }
434
435     return panel;
436 }
437
438
439 static const wxString band_frequencies[] =
440 {
441     wxT(" 60 Hz"),
442     wxT("170 Hz"),
443     wxT("310 Hz"),
444     wxT("600 Hz"),
445     wxT(" 1 kHz"),
446     wxT(" 3 kHz"),
447     wxT(" 6 kHz"),
448     wxT("12 kHz"),
449     wxT("14 kHz"),
450     wxT("16 kHz")
451 };
452
453 /* Equalizer Panel constructor */
454 wxPanel *ExtraPanel::EqzPanel( wxWindow *parent )
455 {
456     wxPanel *panel = new wxPanel( parent, -1 );
457     wxBoxSizer *panel_sizer = new wxBoxSizer( wxVERTICAL );
458
459     /* Create static box to surround the adjust controls */
460     wxBoxSizer *top_sizer =
461         new wxBoxSizer( wxHORIZONTAL );
462
463     /* Create the enable button */
464     eq_chkbox =  new wxCheckBox( panel, EqEnable_Event,
465                             wxU(_("Enable") ) );
466     eq_chkbox->SetToolTip( wxU(_("Enable the equalizer. You can either "
467     "manually adjust the bands or use a preset (Audio Menu->Equalizer)." ) ) );
468     top_sizer->Add( eq_chkbox, 0, wxALL, 2 );
469
470     eq_2p_chkbox =  new wxCheckBox( panel, Eq2Pass_Event,
471                             wxU(_("2 Pass") ) );
472
473     eq_2p_chkbox->SetToolTip( wxU(_("Apply the equalizer twice. "
474                "The resulting effect will be sharper.") ) );
475
476     top_sizer->Add( eq_2p_chkbox, 0, wxALL, 2 );
477
478     top_sizer->Add( 0, 0, 1, wxALL, 2 );
479
480     eq_restoredefaults_button = new wxButton( panel, EqRestore_Event,
481                                   wxU( _("Restore Defaults") ) );
482     top_sizer->Add( eq_restoredefaults_button, 0, wxALL, 2 );
483     top_sizer->Add( 0, 0, 1, wxALL, 2 );
484
485     smooth_text = new wxStaticText( panel, -1, wxU( _("Smooth :") ));
486     smooth_text->SetToolTip( wxU( _(SMOOTH_TIP) ) );
487     top_sizer->Add( smooth_text, 0, wxALL, 2 );
488
489     smooth_slider =new wxSlider( panel, Smooth_Event, 0, 0, 10 ,
490                     wxDefaultPosition, wxSize( 100, -1 ) );
491     smooth_slider->SetToolTip( wxU( _(SMOOTH_TIP) ) );
492     top_sizer->Add( smooth_slider, 0, wxALL, 2 );
493     i_smooth = 0;
494
495     /* Create flex grid */
496     wxFlexGridSizer *eq_gridsizer =
497         new wxFlexGridSizer( 2, 12, 0, 0);
498     eq_gridsizer->AddGrowableRow( 0 );
499     eq_gridsizer->AddGrowableCol( 1 );
500
501     preamp_slider = new wxSlider( panel, Preamp_Event, 80, 0, 400,
502                     wxDefaultPosition, wxSize( -1 , 90 ) , wxSL_VERTICAL );
503     eq_gridsizer->Add( preamp_slider, 1, wxEXPAND|wxALL, 2 );
504
505     eq_gridsizer->Add( 0, 0, 1, wxALL, 2 );
506
507     for( int i = 0 ; i < 10 ; i++ )
508     {
509         band_sliders[i] = new wxSlider( panel, Band0_Event + i, 200, 0, 400,
510                     wxDefaultPosition, wxSize( -1 , 90 ) , wxSL_VERTICAL );
511
512         i_values[i] = 200;
513         eq_gridsizer->Add( band_sliders[i], 1, wxEXPAND|wxALL, 2 );
514     }
515
516     preamp_text = new wxStaticText( panel, -1, wxU( _("Preamp\n12.0dB") ) );
517     wxFont font= preamp_text->GetFont();
518     font.SetPointSize(7);
519     preamp_text->SetFont( font );
520     eq_gridsizer->Add( preamp_text, wxALL, 2 );
521
522     eq_gridsizer->Add( 0, 0, 1 );
523
524     for( int i = 0 ; i < 10 ; i++ )
525     {
526         band_texts[i] = new wxStaticText( panel, -1,
527                                 band_frequencies[i] + wxU("\n0.0dB" ) ) ;
528         eq_gridsizer->Add( band_texts[i], 1, wxEXPAND|wxALL, 2 );
529         wxFont font= band_texts[i]->GetFont();
530         font.SetPointSize(7);
531         band_texts[i]->SetFont( font );
532     }
533
534     panel_sizer->Add( top_sizer , 0 , wxTOP | wxEXPAND, 5 );
535     panel_sizer->Add( eq_gridsizer , 0 , wxEXPAND, 0 );
536
537     panel->SetSizer( panel_sizer );
538
539     panel_sizer->Layout();
540
541     panel_sizer->SetSizeHints( panel );
542
543     CheckAout();
544
545     aout_instance_t *p_aout = (aout_instance_t *)vlc_object_find(p_intf,
546                                  VLC_OBJECT_AOUT, FIND_ANYWHERE);
547     char *psz_af = NULL;
548     if( p_aout )
549     {
550         psz_af = var_GetString( p_aout, "audio-filter" );
551         if( var_GetBool( p_aout, "equalizer-2pass" ) )
552             eq_2p_chkbox->SetValue( true );
553     vlc_object_release( p_aout );
554     }
555     else
556     {
557         psz_af = config_GetPsz( p_intf, "audio-filter" );
558         if( config_GetInt( p_intf, "equalizer-2pass" ) )
559             eq_2p_chkbox->SetValue( true );
560     }
561     if( psz_af != NULL ? strstr( psz_af, "equalizer" ) != NULL : VLC_FALSE )
562     {
563         eq_chkbox->SetValue( true );
564     } else {
565         eq_2p_chkbox->Disable();
566         eq_restoredefaults_button->Disable();
567         smooth_slider->Disable();
568         smooth_text->Disable();
569         preamp_slider->Disable();
570         preamp_text->Disable();
571         for( int i_index=0; i_index < 10; i_index++ )
572         {
573             band_sliders[i_index]->Disable();
574             band_texts[i_index]->Disable();
575         }
576     }
577     free( psz_af );
578
579     return panel;
580 }
581
582 /*******************************************************
583  * Event handlers
584  *******************************************************/
585
586 /* Keep aout up to date and update the bands if needed */
587 void ExtraPanel::OnIdle( wxIdleEvent &event )
588 {
589     CheckAout();
590     if( b_update == VLC_TRUE )
591     {
592         if( b_my_update == VLC_TRUE )
593         {
594             b_update = b_my_update = VLC_FALSE;
595             return;
596         }
597         char *p = psz_bands;
598         for( int i = 0; i < 10; i++ )
599         {
600                 float f;
601                 char psz_val[5];
602                 int i_val;
603                 /* Read dB -20/20*/
604                 f = strtof( p, &p );
605                 i_val= (int)( ( f + 20 ) * 10 );
606                 band_sliders[i]->SetValue( 400 - i_val );
607                 i_values[i] = 400 - i_val;
608                 sprintf( psz_val, "%.1f", f );
609                 band_texts[i]->SetLabel( band_frequencies[i] + wxT("\n") +
610                                                 wxU( psz_val ) + wxT("dB") );
611                 if( p == NULL )
612                 {
613                     break;
614                 }
615                 p++;
616                 if( *p == 0 )
617                     break;
618         }
619         char psz_val[5];
620         int i_val = (int)( ( f_preamp + 20 ) * 10 );
621         sprintf( psz_val, "%.1f", f_preamp );
622         preamp_slider->SetValue( 400 - i_val );
623         const wxString preamp = wxT("Preamp\n");
624         preamp_text->SetLabel( preamp + wxU( psz_val ) + wxT( "dB" ) );
625         eq_chkbox->SetValue( TRUE );
626         b_update = VLC_FALSE;
627     }
628 }
629
630 /*************************
631  *  Equalizer Panel events
632  *************************/
633 void ExtraPanel::OnEnableEqualizer( wxCommandEvent &event )
634 {
635     int i_index;
636     aout_instance_t *p_aout= (aout_instance_t *)vlc_object_find(p_intf,
637                                  VLC_OBJECT_AOUT, FIND_ANYWHERE);
638     ChangeFiltersString( p_intf,p_aout, "equalizer",
639                          event.IsChecked() ? VLC_TRUE : VLC_FALSE );
640
641     if( event.IsChecked() )
642     {
643         eq_2p_chkbox->Enable();
644         eq_restoredefaults_button->Enable();
645         smooth_slider->Enable();
646         smooth_text->Enable();
647         preamp_slider->Enable();
648         preamp_text->Enable();
649         for( i_index=0; i_index < 10; i_index++ )
650         {
651             band_sliders[i_index]->Enable();
652             band_texts[i_index]->Enable();
653         }
654     } else {
655         eq_2p_chkbox->Disable();
656         eq_restoredefaults_button->Disable();
657         smooth_slider->Disable();
658         smooth_text->Disable();
659         preamp_slider->Disable();
660         preamp_text->Disable();
661         for( i_index=0; i_index < 10; i_index++ )
662         {
663             band_sliders[i_index]->Disable();
664             band_texts[i_index]->Disable();
665         }
666     }
667
668     if( p_aout != NULL )
669         vlc_object_release( p_aout );
670 }
671
672 void ExtraPanel::OnEqRestore( wxCommandEvent &event )
673 {
674     aout_instance_t *p_aout= (aout_instance_t *)vlc_object_find(p_intf,
675                                  VLC_OBJECT_AOUT, FIND_ANYWHERE);
676     if( p_aout == NULL )
677     {
678         vlc_value_t val;
679         vlc_bool_t b_previous = eq_chkbox->IsChecked();
680         val.f_float = 12.0;
681         IntfPreampCallback( NULL, NULL, val,val, this );
682         config_PutFloat( p_intf, "equalizer-preamp", 12.0 );
683         val.psz_string = strdup( "0 0 0 0 0 0 0 0 0 0" );
684         IntfBandsCallback( NULL, NULL, val,val, this );
685         config_PutPsz( p_intf, "equalizer-bands",
686                                 "0 0 0 0 0 0 0 0 0 0");
687         config_PutPsz( p_intf, "equalizer-preset","flat" );
688         eq_chkbox->SetValue( b_previous );
689     }
690     else
691     {
692         var_SetFloat( p_aout, "equalizer-preamp", 12.0 );
693         config_PutFloat( p_intf, "equalizer-preamp", 12.0 );
694         var_SetString( p_aout, "equalizer-bands",
695                                 "0 0 0 0 0 0 0 0 0 0");
696         config_PutPsz( p_intf, "equalizer-bands",
697                                 "0 0 0 0 0 0 0 0 0 0");
698         var_SetString( p_aout , "equalizer-preset" , "flat" );
699         config_PutPsz( p_intf, "equalizer-preset","flat" );
700         vlc_object_release( p_aout );
701     }
702 }
703
704 void ExtraPanel::OnEq2Pass( wxCommandEvent &event )
705 {
706     aout_instance_t *p_aout= (aout_instance_t *)vlc_object_find(p_intf,
707                                  VLC_OBJECT_AOUT, FIND_ANYWHERE);
708
709     vlc_bool_t b_2p = event.IsChecked() ? VLC_TRUE : VLC_FALSE;
710
711     if( p_aout == NULL )
712     {
713         config_PutInt( p_intf, "equalizer-2pass", b_2p );
714     }
715     else
716     {
717         var_SetBool( p_aout, "equalizer-2pass", b_2p );
718         config_PutInt( p_intf, "equalizer-2pass", b_2p );
719         if( eq_chkbox->IsChecked() )
720         {
721             for( int i = 0; i < p_aout->i_nb_inputs; i++ )
722             {
723                 p_aout->pp_inputs[i]->b_restart = VLC_TRUE;
724             }
725         }
726         vlc_object_release( p_aout );
727     }
728 }
729
730 void ExtraPanel::OnEqSmooth( wxScrollEvent &event )
731 {
732     /* Max smoothing : 70% */
733     i_smooth = event.GetPosition() * 7;
734 }
735
736 void ExtraPanel::OnPreamp( wxScrollEvent &event )
737 {
738     float f= (float)( 400 - event.GetPosition() ) / 10 - 20 ;
739     char psz_val[5];
740
741     aout_instance_t *p_aout= (aout_instance_t *)vlc_object_find(p_intf,
742                                  VLC_OBJECT_AOUT, FIND_ANYWHERE);
743
744     sprintf( psz_val, "%.1f", f );
745     const wxString preamp = wxT("Preamp\n");
746     preamp_text->SetLabel( preamp + wxU( psz_val ) + wxT( "dB" ) );
747
748     if( p_aout == NULL )
749     {
750         config_PutFloat( p_intf, "equalizer-preamp", f );
751     }
752     else
753     {
754         var_SetFloat( p_aout, "equalizer-preamp", f );
755         config_PutFloat( p_intf, "equalizer-preamp", f );
756         b_my_update = VLC_TRUE;
757         vlc_object_release( p_aout );
758     }
759 }
760
761 void ExtraPanel::OnChangeEqualizer( wxScrollEvent &event )
762 {
763     aout_instance_t *p_aout= (aout_instance_t *)vlc_object_find(p_intf,
764                                  VLC_OBJECT_AOUT, FIND_ANYWHERE);
765     char psz_values[102];
766     memset( psz_values, 0, 102 );
767
768
769     /* Smoothing */
770     int i_diff = event.GetPosition() - i_values[  event.GetId() - Band0_Event ];
771     i_values[ event.GetId() - Band0_Event] = event.GetPosition();
772
773     for( int i = event.GetId() + 1 ; i <= Band9_Event ; i++ )
774     {
775         int i_new = band_sliders[ i-Band0_Event ]->GetValue() +
776            (int)( i_diff * pow( (float)i_smooth / 100 , i- event.GetId() ) ) ;
777         if( i_new < 0 ) i_new = 0;
778         if( i_new > 400 ) i_new = 400;
779         band_sliders[ i-Band0_Event ]->SetValue( i_new );
780     }
781     for( int i = Band0_Event ; i < event.GetId() ; i++ )
782     {
783         int i_new =   band_sliders[ i-Band0_Event ]->GetValue() +
784            (int)( i_diff * pow( (float)i_smooth / 100 , event.GetId() - i  ) );
785         if( i_new < 0 ) i_new = 0;
786         if( i_new > 400 ) i_new = 400;
787         band_sliders[ i-Band0_Event ]->SetValue( i_new );
788     }
789
790     /* Write the new bands values */
791     for( int i = 0 ; i < 10 ; i++ )
792     {
793         char psz_val[5];
794         float f_val = (float)( 400 - band_sliders[i]->GetValue() ) / 10- 20 ;
795         sprintf( psz_values, "%s %f", psz_values, f_val );
796         sprintf( psz_val, "%.1f", f_val );
797         band_texts[i]->SetLabel( band_frequencies[i] + wxT("\n") +
798                         wxU( psz_val ) + wxT("dB" ) );
799     }
800     if( p_aout == NULL )
801     {
802         config_PutPsz( p_intf, "equalizer-bands", psz_values );
803     }
804     else
805     {
806         var_SetString( p_aout, "equalizer-bands", psz_values );
807         config_PutPsz( p_intf, "equalizer-bands", psz_values );
808         b_my_update = VLC_TRUE;
809         vlc_object_release( p_aout );
810     }
811 }
812
813 /***********************
814  * Audio Panel events
815  ***********************/
816 void ExtraPanel::OnHeadphone( wxCommandEvent &event )
817 {
818     aout_instance_t *p_aout= (aout_instance_t *)vlc_object_find(p_intf,
819                                  VLC_OBJECT_AOUT, FIND_ANYWHERE);
820     ChangeFiltersString( p_intf , p_aout, "headphone_channel_mixer",
821                          event.IsChecked() ? VLC_TRUE : VLC_FALSE );
822     if( p_aout != NULL )
823         vlc_object_release( p_aout );
824 }
825
826 void ExtraPanel::OnNormvol( wxCommandEvent &event )
827 {
828     aout_instance_t *p_aout= (aout_instance_t *)vlc_object_find(p_intf,
829                                  VLC_OBJECT_AOUT, FIND_ANYWHERE);
830     ChangeFiltersString( p_intf , p_aout, "normvol",
831                          event.IsChecked() ? VLC_TRUE : VLC_FALSE );
832     if( p_aout != NULL )
833         vlc_object_release( p_aout );
834 }
835
836 void ExtraPanel::OnNormvolSlider( wxScrollEvent &event )
837 {
838     aout_instance_t *p_aout= (aout_instance_t *)vlc_object_find(p_intf,
839                                  VLC_OBJECT_AOUT, FIND_ANYWHERE);
840     if( p_aout != NULL )
841     {
842         var_SetFloat( p_aout, "norm-max-level", (float)event.GetPosition()/10 );
843         vlc_object_release( p_aout );
844     }
845     else
846     {
847         config_PutFloat( p_intf, "norm-max-level",
848                         (float)event.GetPosition()/10 );
849     }
850 }
851 /***********************
852  *  Video Panel events
853  ***********************/
854 void ExtraPanel::OnEnableAdjust(wxCommandEvent& event)
855 {
856     ChangeVFiltersString( p_intf,  "adjust",
857                           event.IsChecked() ? VLC_TRUE : VLC_FALSE );
858
859     if( event.IsChecked() )
860     {
861         restoredefaults_button->Enable();
862         brightness_slider->Enable();
863         saturation_slider->Enable();
864         contrast_slider->Enable();
865         hue_slider->Enable();
866         gamma_slider->Enable();
867     }
868     else
869     {
870         restoredefaults_button->Disable();
871         brightness_slider->Disable();
872         saturation_slider->Disable();
873         contrast_slider->Disable();
874         hue_slider->Disable();
875         gamma_slider->Disable();
876     }
877 }
878
879 void ExtraPanel::OnRestoreDefaults( wxCommandEvent &event)
880 {
881     hue_slider->SetValue(0);
882     saturation_slider->SetValue(100);
883     brightness_slider->SetValue(100);
884     contrast_slider->SetValue(100),
885     gamma_slider->SetValue(10);
886
887     wxScrollEvent *hscroll_event = new wxScrollEvent(0, Hue_Event, 0);
888     OnAdjustUpdate(*hscroll_event);
889
890     wxScrollEvent *sscroll_event = new wxScrollEvent(0, Saturation_Event, 100);
891     OnAdjustUpdate(*sscroll_event);
892
893     wxScrollEvent *bscroll_event = new wxScrollEvent(0, Brightness_Event, 100);
894     OnAdjustUpdate(*bscroll_event);
895
896     wxScrollEvent *cscroll_event = new wxScrollEvent(0, Contrast_Event, 100);
897     OnAdjustUpdate(*cscroll_event);
898
899     wxScrollEvent *gscroll_event = new wxScrollEvent(0, Gamma_Event, 10);
900     OnAdjustUpdate(*gscroll_event);
901
902 }
903
904 void ExtraPanel::OnAdjustUpdate( wxScrollEvent &event)
905 {
906     vout_thread_t *p_vout = (vout_thread_t *)vlc_object_find(p_intf,
907                                  VLC_OBJECT_VOUT, FIND_ANYWHERE);
908     if( p_vout == NULL )
909     {
910         switch( event.GetId() )
911         {
912             case Hue_Event:
913                 config_PutInt( p_intf , "hue" , event.GetPosition() );
914                 break;
915
916             case Saturation_Event:
917                 config_PutFloat( p_intf , "saturation" ,
918                                 (float)event.GetPosition()/100 );
919                 break;
920
921             case Brightness_Event:
922                 config_PutFloat( p_intf , "brightness" ,
923                                 (float)event.GetPosition()/100 );
924                 break;
925
926             case Contrast_Event:
927                 config_PutFloat( p_intf , "contrast" ,
928                                 (float)event.GetPosition()/100 );
929                 break;
930
931             case Gamma_Event:
932                 config_PutFloat( p_intf , "gamma" ,
933                                 (float)event.GetPosition()/10 );
934                 break;
935         }
936     }
937     else
938     {
939         vlc_value_t val;
940         switch( event.GetId() )
941         {
942             case Hue_Event:
943                 val.i_int = event.GetPosition();
944                 var_Set( p_vout, "hue", val );
945                 config_PutInt( p_intf , "hue" , event.GetPosition() );
946                 break;
947
948             case Saturation_Event:
949                 val.f_float = (float)event.GetPosition() / 100;
950                 var_Set( p_vout, "saturation", val );
951                 config_PutFloat( p_intf , "saturation" ,
952                                 (float)event.GetPosition()/100 );
953                 break;
954
955             case Brightness_Event:
956                 val.f_float = (float)event.GetPosition() / 100;
957                 var_Set( p_vout, "brightness", val );
958                 config_PutFloat( p_intf , "brightness" ,
959                                 (float)event.GetPosition()/100 );
960                 break;
961
962             case Contrast_Event:
963                 val.f_float = (float)event.GetPosition() / 100;
964                 var_Set( p_vout, "contrast", val );
965                 config_PutFloat( p_intf , "contrast" ,
966                                 (float)event.GetPosition()/100 );
967                 break;
968
969             case Gamma_Event:
970                 val.f_float = (float)event.GetPosition() / 10;
971                 var_Set( p_vout, "gamma", val );
972                 config_PutFloat( p_intf , "gamma" ,
973                                 (float)event.GetPosition()/10 );
974                 break;
975         }
976         vlc_object_release(p_vout);
977     }
978 }
979
980 /* FIXME */
981 void ExtraPanel::OnRatio( wxCommandEvent& event )
982 {
983    config_PutPsz( p_intf, "aspect-ratio", ratio_combo->GetValue().mb_str(wxConvUTF8) );
984 }
985
986
987 void ExtraPanel::OnSelectFilter(wxCommandEvent& event)
988 {
989     int i_filter = event.GetId() - Filter0_Event ;
990     if( vfilters[i_filter].psz_filter  )
991     {
992         ChangeVFiltersString( p_intf, vfilters[i_filter].psz_filter ,
993                               event.IsChecked() ? VLC_TRUE : VLC_FALSE );
994     }
995 }
996
997 void ExtraPanel::OnFiltersInfo(wxCommandEvent& event)
998 {
999     wxMessageBox( wxU( _("Filtering effects to apply to the video. "
1000                   "You must restart the stream for these settings to "
1001                   "take effect.\n\n"
1002                   "To configure these filters, go to Preferences / Video / "
1003                   "Filters. In order to control the order in which they "
1004                   "are applied, enter a filters string in the Video Filter "
1005                   "Module inside the preferences."
1006                   ) ),
1007                     wxU( _("More Information" ) ), wxOK | wxICON_INFORMATION,
1008                     this->p_parent );
1009 }
1010 /**********************************
1011  * Other functions
1012  **********************************/
1013 void ExtraPanel::CheckAout()
1014 {
1015     aout_instance_t *p_aout= (aout_instance_t *)vlc_object_find(p_intf,
1016                                  VLC_OBJECT_AOUT, FIND_ANYWHERE);
1017     if( p_aout != NULL )
1018     {
1019         if( p_aout != p_intf->p_sys->p_aout )
1020         {
1021             /* We want to know if someone changes the bands */
1022             if( var_AddCallback( p_aout, "equalizer-bands",
1023                                     IntfBandsCallback, this ) )
1024             {
1025                 /* The variable does not exist yet, wait */
1026                 vlc_object_release( p_aout );
1027                 return;
1028             }
1029             if( var_AddCallback( p_aout, "equalizer-preamp",
1030                                     IntfPreampCallback, this )  )
1031             {
1032                 vlc_object_release( p_aout );
1033                 return;
1034             }
1035             /* Ok, we have our variables, make a first update round */
1036             p_intf->p_sys->p_aout = p_aout;
1037
1038             f_preamp = var_GetFloat( p_aout, "equalizer-preamp" );
1039             psz_bands = var_GetString( p_aout, "equalizer-bands" );
1040             b_update = VLC_TRUE;
1041         }
1042         vlc_object_release( p_aout );
1043     }
1044 }
1045
1046
1047 static void ChangeVFiltersString( intf_thread_t *p_intf,
1048                                  char *psz_name, vlc_bool_t b_add )
1049 {
1050     vout_thread_t *p_vout;
1051     char *psz_parser, *psz_string;
1052
1053     psz_string = config_GetPsz( p_intf, "vout-filter" );
1054
1055     if( !psz_string ) psz_string = strdup("");
1056
1057     psz_parser = strstr( psz_string, psz_name );
1058
1059     if( b_add )
1060     {
1061         if( !psz_parser )
1062         {
1063             psz_parser = psz_string;
1064             asprintf( &psz_string, (*psz_string) ? "%s:%s" : "%s%s",
1065                             psz_string, psz_name );
1066             free( psz_parser );
1067         }
1068         else
1069         {
1070             return;
1071         }
1072     }
1073     else
1074     {
1075         if( psz_parser )
1076         {
1077             memmove( psz_parser, psz_parser + strlen(psz_name) +
1078                             (*(psz_parser + strlen(psz_name)) == ':' ? 1 : 0 ),
1079                             strlen(psz_parser + strlen(psz_name)) + 1 );
1080
1081             /* Remove trailing : : */
1082             if( *(psz_string+strlen(psz_string ) -1 ) == ':' )
1083             {
1084                 *(psz_string+strlen(psz_string ) -1 ) = '\0';
1085             }
1086          }
1087          else
1088          {
1089              free( psz_string );
1090              return;
1091          }
1092     }
1093     /* Vout is not kept, so put that in the config */
1094     config_PutPsz( p_intf, "vout-filter", psz_string );
1095
1096     /* Try to set on the fly */
1097     p_vout = (vout_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT,
1098                                               FIND_ANYWHERE );
1099     if( p_vout )
1100     {
1101         var_SetString( p_vout, "vout-filter", psz_string );
1102         vlc_object_release( p_vout );
1103     }
1104
1105     free( psz_string );
1106 }
1107
1108
1109 static void ChangeFiltersString( intf_thread_t *p_intf,
1110                                  aout_instance_t * p_aout,
1111                                  char *psz_name, vlc_bool_t b_add )
1112 {
1113     char *psz_parser, *psz_string;
1114
1115     if( p_aout )
1116     {
1117         psz_string = var_GetString( p_aout, "audio-filter" );
1118     }
1119     else
1120     {
1121         psz_string = config_GetPsz( p_intf, "audio-filter" );
1122     }
1123
1124     if( !psz_string ) psz_string = strdup("");
1125
1126     psz_parser = strstr( psz_string, psz_name );
1127
1128     if( b_add )
1129     {
1130         if( !psz_parser )
1131         {
1132             psz_parser = psz_string;
1133             asprintf( &psz_string, (*psz_string) ? "%s:%s" : "%s%s",
1134                             psz_string, psz_name );
1135             free( psz_parser );
1136         }
1137         else
1138         {
1139             return;
1140         }
1141     }
1142     else
1143     {
1144         if( psz_parser )
1145         {
1146             memmove( psz_parser, psz_parser + strlen(psz_name) +
1147                             (*(psz_parser + strlen(psz_name)) == ':' ? 1 : 0 ),
1148                             strlen(psz_parser + strlen(psz_name)) + 1 );
1149
1150             if( *(psz_string+strlen(psz_string ) -1 ) == ':' )
1151             {
1152                 *(psz_string+strlen(psz_string ) -1 ) = '\0';
1153             }
1154          }
1155          else
1156          {
1157              free( psz_string );
1158              return;
1159          }
1160     }
1161
1162     if( p_aout == NULL )
1163     {
1164         config_PutPsz( p_intf, "audio-filter", psz_string );
1165     }
1166     else
1167     {
1168         var_SetString( p_aout, "audio-filter", psz_string );
1169         for( int i = 0; i < p_aout->i_nb_inputs; i++ )
1170         {
1171             p_aout->pp_inputs[i]->b_restart = VLC_TRUE;
1172         }
1173     }
1174     free( psz_string );
1175 }
1176
1177
1178 static int IntfBandsCallback( vlc_object_t *p_this, char const *psz_cmd,
1179                           vlc_value_t oldval, vlc_value_t newval, void *param )
1180 {
1181     ExtraPanel *p_panel = (ExtraPanel *)param;
1182
1183     p_panel->psz_bands = strdup( newval.psz_string );
1184     p_panel->b_update = VLC_TRUE;
1185
1186     return VLC_SUCCESS;
1187 }
1188
1189 static int IntfPreampCallback( vlc_object_t *p_this, char const *psz_cmd,
1190                           vlc_value_t oldval, vlc_value_t newval, void *param )
1191 {
1192     ExtraPanel *p_panel = (ExtraPanel *)param;
1193
1194     p_panel->f_preamp = newval.f_float;
1195     p_panel->b_update = VLC_TRUE;
1196
1197     return VLC_SUCCESS;
1198 }
1199
1200 #if 0
1201 /**********************************************************************
1202  * A small window to contain the extrapanel in its undocked state
1203  **********************************************************************/
1204 BEGIN_EVENT_TABLE(ExtraWindow, wxFrame)
1205 END_EVENT_TABLE()
1206
1207
1208 ExtraWindow::ExtraWindow( intf_thread_t *_p_intf, wxWindow *p_parent,
1209                           wxPanel *_extra_panel ):
1210        wxFrame( p_parent, -1, wxU(_("Extended controls")), wxDefaultPosition,
1211                  wxDefaultSize, wxDEFAULT_FRAME_STYLE )
1212 {
1213     p_intf = _p_intf;
1214     SetIcon( *p_intf->p_sys->p_icon );
1215
1216     wxBoxSizer *window_sizer = new wxBoxSizer( wxVERTICAL );
1217     SetSizer( window_sizer );
1218
1219     panel = _extra_panel;
1220     window_sizer->Add( panel );
1221
1222     window_sizer->Layout();
1223     window_sizer->Fit( this );
1224
1225     Show();
1226 }
1227
1228 ExtraWindow::~ExtraWindow()
1229 {
1230     delete panel;
1231 }
1232 #endif