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