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