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