]> git.sesse.net Git - vlc/blob - modules/gui/wxwindows/preferences_widgets.cpp
* include/vlc_codec.h, modules/codec/ffmpeg/encoder.c, modules/stream_out/transcode...
[vlc] / modules / gui / wxwindows / preferences_widgets.cpp
1 /*****************************************************************************
2  * preferences_widgets.cpp : wxWindows plugin for vlc
3  *****************************************************************************
4  * Copyright (C) 2000-2001 VideoLAN
5  * $Id: preferences_widgets.cpp,v 1.13 2003/11/05 18:59:01 gbazin Exp $
6  *
7  * Authors: Gildas Bazin <gbazin@netcourrier.com>
8  *          Sigmund Augdal <sigmunau@idi.ntnu.no>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
23  *****************************************************************************/
24
25 /*****************************************************************************
26  * Preamble
27  *****************************************************************************/
28 #include <stdlib.h>                                      /* malloc(), free() */
29 #include <errno.h>                                                 /* ENOMEM */
30 #include <string.h>                                            /* strerror() */
31 #include <stdio.h>
32
33 #include <vlc/vlc.h>
34 #include <vlc/intf.h>
35
36 #include <vlc_help.h>
37
38 #include "wxwindows.h"
39 #include "preferences_widgets.h"
40
41 /*****************************************************************************
42  * CreateConfigControl wrapper
43  *****************************************************************************/
44 ConfigControl *CreateConfigControl( vlc_object_t *p_this,
45                                     module_config_t *p_item, wxWindow *parent )
46 {
47     ConfigControl *p_control = NULL;
48
49     switch( p_item->i_type )
50     {
51     case CONFIG_ITEM_MODULE:
52         p_control = new ModuleConfigControl( p_this, p_item, parent );
53         break;
54
55     case CONFIG_ITEM_STRING:
56         if( !p_item->i_list )
57         {
58             p_control = new StringConfigControl( p_this, p_item, parent );
59         }
60         else
61         {
62             p_control = new StringListConfigControl( p_this, p_item, parent );
63         }
64         break;
65
66     case CONFIG_ITEM_FILE:
67     case CONFIG_ITEM_DIRECTORY:
68         p_control = new FileConfigControl( p_this, p_item, parent );
69         break;
70
71     case CONFIG_ITEM_INTEGER:
72         if( p_item->i_list )
73         {
74             p_control = new IntegerListConfigControl( p_this, p_item, parent );
75         }
76         else if( p_item->i_min != 0 || p_item->i_max != 0 )
77         {
78             p_control = new RangedIntConfigControl( p_this, p_item, parent );
79         }
80         else
81         {
82             p_control = new IntegerConfigControl( p_this, p_item, parent );
83         }
84         break;
85
86     case CONFIG_ITEM_KEY:
87         p_control = new KeyConfigControl( p_this, p_item, parent );
88         break;
89
90     case CONFIG_ITEM_FLOAT:
91         p_control = new FloatConfigControl( p_this, p_item, parent );
92         break;
93
94     case CONFIG_ITEM_BOOL:
95         p_control = new BoolConfigControl( p_this, p_item, parent );
96         break;
97
98     default:
99         break;
100     }
101
102     return p_control;
103 }
104
105 /*****************************************************************************
106  * ConfigControl implementation
107  *****************************************************************************/
108 ConfigControl::ConfigControl( vlc_object_t *_p_this,
109                               module_config_t *p_item, wxWindow *parent )
110   : wxPanel( parent ), p_this( _p_this ), name( wxU(p_item->psz_name) ),
111     i_type( p_item->i_type ), b_advanced( p_item->b_advanced )
112 {
113     sizer = new wxBoxSizer( wxHORIZONTAL );
114 }
115
116 ConfigControl::~ConfigControl()
117 {
118 }
119
120 wxSizer *ConfigControl::Sizer()
121 {
122     return sizer;
123 }
124
125 wxString ConfigControl::GetName()
126 {
127     return name;
128 }
129
130 int ConfigControl::GetType()
131 {
132     return i_type;
133 }
134
135 vlc_bool_t ConfigControl::IsAdvanced()
136 {
137     return b_advanced;
138 }
139
140 /*****************************************************************************
141  * KeyConfigControl implementation
142  *****************************************************************************/
143 static wxString KeysList[] =
144 {
145     wxT("Unset"),
146     wxT("Left"),
147     wxT("Right"),
148     wxT("Up"),
149     wxT("Down"),
150     wxT("Space"),
151     wxT("Enter"),
152     wxT("F1"),
153     wxT("F2"),
154     wxT("F3"),
155     wxT("F4"),
156     wxT("F5"),
157     wxT("F6"),
158     wxT("F7"),
159     wxT("F8"),
160     wxT("F9"),
161     wxT("F10"),
162     wxT("F11"),
163     wxT("F12"),
164     wxT("Home"),
165     wxT("End"),
166     wxT("Menu"),
167     wxT("Esc"),
168     wxT("Page Up"),
169     wxT("Page Down"),
170     wxT("Tab"),
171     wxT("Backspace"),
172     wxT("a"),
173     wxT("b"),
174     wxT("c"),
175     wxT("d"),
176     wxT("e"),
177     wxT("f"),
178     wxT("g"),
179     wxT("h"),
180     wxT("i"),
181     wxT("j"),
182     wxT("k"),
183     wxT("l"),
184     wxT("m"),
185     wxT("n"),
186     wxT("o"),
187     wxT("p"),
188     wxT("q"),
189     wxT("r"),
190     wxT("s"),
191     wxT("t"),
192     wxT("u"),
193     wxT("v"),
194     wxT("w"),
195     wxT("x"),
196     wxT("y"),
197     wxT("z"),
198     wxT("+"),
199     wxT("="),
200     wxT("-"),
201     wxT(","),
202     wxT("."),
203     wxT("<"),
204     wxT(">"),
205     wxT("`"),
206     wxT("/"),
207     wxT(";"),
208     wxT("'"),
209     wxT("\\"),
210     wxT("["),
211     wxT("]"),
212     wxT("*")
213 };
214
215 KeyConfigControl::KeyConfigControl( vlc_object_t *p_this,
216                                     module_config_t *p_item, wxWindow *parent )
217   : ConfigControl( p_this, p_item, parent )
218 {
219     label = new wxStaticText(this, -1, wxU(p_item->psz_text));
220     alt = new wxCheckBox( this, -1, wxU(_("Alt")) );
221     alt->SetValue( p_item->i_value & KEY_MODIFIER_ALT );
222     ctrl = new wxCheckBox( this, -1, wxU(_("Ctrl")) );
223     ctrl->SetValue( p_item->i_value & KEY_MODIFIER_CTRL );
224     shift = new wxCheckBox( this, -1, wxU(_("Shift")) );
225     shift->SetValue( p_item->i_value & KEY_MODIFIER_SHIFT );
226     combo = new wxComboBox( this, -1, wxT(""), wxDefaultPosition,
227                             wxDefaultSize, WXSIZEOF(KeysList), KeysList,
228                             wxCB_READONLY );
229     for( unsigned int i = 0; i < WXSIZEOF(KeysList); i++ )
230     {
231         combo->SetClientData( i, (void*)keys[i].i_key_code );
232         if( keys[i].i_key_code ==
233             ( ((unsigned int)p_item->i_value) & ~KEY_MODIFIER ) )
234         {
235             combo->SetSelection( i );
236             combo->SetValue( wxU(_(keys[i].psz_key_string)) );
237         }
238     }
239
240     sizer->Add( label, 2, wxALIGN_CENTER_VERTICAL | wxALL | wxEXPAND, 5 );
241     sizer->Add( alt,   1, wxALIGN_CENTER_VERTICAL | wxALL | wxEXPAND, 5 );
242     sizer->Add( ctrl,  1, wxALIGN_CENTER_VERTICAL | wxALL | wxEXPAND, 5 );
243     sizer->Add( shift, 1, wxALIGN_CENTER_VERTICAL | wxALL | wxEXPAND, 5 );
244     sizer->Add( combo, 2, wxALIGN_CENTER_VERTICAL | wxALL | wxEXPAND, 5 );
245     sizer->Layout();
246     this->SetSizerAndFit( sizer );
247 }
248
249 KeyConfigControl::~KeyConfigControl()
250 {
251     ;
252 }
253
254 int KeyConfigControl::GetIntValue()
255 {
256     int result = 0;
257     if( alt->IsChecked() )
258     {
259         result |= KEY_MODIFIER_ALT;
260     }
261     if( ctrl->IsChecked() )
262     {
263         result |= KEY_MODIFIER_CTRL;
264     }
265     if( shift->IsChecked() )
266     {
267         result |= KEY_MODIFIER_SHIFT;
268     }
269     int selected = combo->GetSelection();
270     if( selected != -1 )
271     {
272         result |= (int)combo->GetClientData( selected );
273     }
274     return result;
275 }
276
277 /*****************************************************************************
278  * ModuleConfigControl implementation
279  *****************************************************************************/
280 ModuleConfigControl::ModuleConfigControl( vlc_object_t *p_this,
281                                           module_config_t *p_item,
282                                           wxWindow *parent )
283   : ConfigControl( p_this, p_item, parent )
284 {
285     vlc_list_t *p_list;
286     module_t *p_parser;
287
288     label = new wxStaticText(this, -1, wxU(p_item->psz_text));
289     combo = new wxComboBox( this, -1, wxU(p_item->psz_value),
290                             wxDefaultPosition, wxDefaultSize,
291                             0, NULL, wxCB_READONLY | wxCB_SORT );
292
293     /* build a list of available modules */
294     p_list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
295     combo->Append( wxU(_("Default")), (void *)NULL );
296     combo->SetSelection( 0 );
297     for( int i_index = 0; i_index < p_list->i_count; i_index++ )
298     {
299         p_parser = (module_t *)p_list->p_values[i_index].p_object ;
300
301         if( !strcmp( p_parser->psz_capability, p_item->psz_type ) )
302         {
303             combo->Append( wxU(p_parser->psz_longname),
304                            p_parser->psz_object_name );
305             if( p_item->psz_value && !strcmp(p_item->psz_value, 
306                                              p_parser->psz_object_name) )
307                 combo->SetValue( wxU(p_parser->psz_longname) );
308         }
309     }
310     vlc_list_release( p_list );
311
312     combo->SetToolTip( wxU(p_item->psz_longtext) );
313     sizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
314     sizer->Add( combo, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
315     sizer->Layout();
316     this->SetSizerAndFit( sizer );
317 }
318
319 ModuleConfigControl::~ModuleConfigControl()
320 {
321     ;
322 }
323
324 wxString ModuleConfigControl::GetPszValue()
325 {
326     return wxU( (char *)combo->GetClientData( combo->GetSelection() ));
327 }
328
329 /*****************************************************************************
330  * StringConfigControl implementation
331  *****************************************************************************/
332 StringConfigControl::StringConfigControl( vlc_object_t *p_this,
333                                           module_config_t *p_item,
334                                           wxWindow *parent )
335   : ConfigControl( p_this, p_item, parent )
336 {
337     label = new wxStaticText(this, -1, wxU(p_item->psz_text));
338     sizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
339     textctrl = new wxTextCtrl( this, -1, 
340                                wxU(p_item->psz_value),
341                                wxDefaultPosition,
342                                wxDefaultSize,
343                                wxTE_PROCESS_ENTER);
344     textctrl->SetToolTip( wxU(p_item->psz_longtext) );
345     sizer->Add( textctrl, 1, wxALL, 5 );
346     sizer->Layout();
347     this->SetSizerAndFit( sizer );
348 }
349
350 StringConfigControl::~StringConfigControl()
351 {
352     ;
353 }
354
355 wxString StringConfigControl::GetPszValue()
356 {
357     return textctrl->GetValue();
358 }
359
360 /*****************************************************************************
361  * StringListConfigControl implementation
362  *****************************************************************************/
363 StringListConfigControl::StringListConfigControl( vlc_object_t *p_this,
364                                                   module_config_t *p_item,
365                                                   wxWindow *parent )
366   : ConfigControl( p_this, p_item, parent ), psz_name( NULL )
367 {
368     label = new wxStaticText(this, -1, wxU(p_item->psz_text));
369     sizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
370     combo = new wxComboBox( this, -1, wxT(""),
371                             wxDefaultPosition, wxDefaultSize,
372                             0, NULL, wxCB_READONLY );
373     UpdateCombo( p_item );
374
375     combo->SetToolTip( wxU(p_item->psz_longtext) );
376     sizer->Add( combo, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );    
377
378     if( p_item->pf_list_update )
379     {
380         wxButton *refresh =
381             new wxButton( this, wxID_HIGHEST, wxU(_("Refresh")) );
382         sizer->Add( refresh, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
383
384         psz_name = strdup( p_item->psz_name );
385         pf_list_update = p_item->pf_list_update;
386     }
387
388     sizer->Layout();
389     this->SetSizerAndFit( sizer );
390 }
391
392 StringListConfigControl::~StringListConfigControl()
393 {
394     if( psz_name ) free( psz_name );
395 }
396
397 void StringListConfigControl::UpdateCombo( module_config_t *p_item )
398 {
399     /* build a list of available options */
400     for( int i_index = 0; i_index < p_item->i_list; i_index++ )
401     {
402         combo->Append( ( p_item->ppsz_list_text &&
403                          p_item->ppsz_list_text[i_index] ) ?
404                        wxU(p_item->ppsz_list_text[i_index]) :
405                        wxU(p_item->ppsz_list[i_index]) );
406         combo->SetClientData( i_index, (void *)p_item->ppsz_list[i_index] );
407         if( ( p_item->psz_value &&
408               !strcmp( p_item->psz_value, p_item->ppsz_list[i_index] ) ) ||
409              ( !p_item->psz_value && !*p_item->ppsz_list[i_index] ) )
410         {
411             combo->SetSelection( i_index );
412             combo->SetValue( ( p_item->ppsz_list_text &&
413                                p_item->ppsz_list_text[i_index] ) ?
414                              wxU(p_item->ppsz_list_text[i_index]) :
415                              wxU(p_item->ppsz_list[i_index]) );
416         }
417     }
418 }
419
420 BEGIN_EVENT_TABLE(StringListConfigControl, wxPanel)
421     /* Button events */
422     EVT_BUTTON(wxID_HIGHEST, StringListConfigControl::OnRefresh)
423 END_EVENT_TABLE()
424
425 void StringListConfigControl::OnRefresh( wxCommandEvent& event )
426 {
427     if( pf_list_update )
428     {
429         vlc_value_t val;
430         module_config_t *p_item;
431
432         pf_list_update( p_this, psz_name, val, val, 0 );
433         p_item = config_FindConfig( p_this, psz_name );
434
435         combo->Clear();
436         UpdateCombo( p_item );
437     }
438 }
439
440 wxString StringListConfigControl::GetPszValue()
441 {
442     int selected = combo->GetSelection();
443     if( selected != -1 )
444     {
445         return wxU((char *)combo->GetClientData( selected ));
446     }
447     return wxString();
448 }
449
450 /*****************************************************************************
451  * FileConfigControl implementation
452  *****************************************************************************/
453 FileConfigControl::FileConfigControl( vlc_object_t *p_this,
454                                       module_config_t *p_item,
455                                       wxWindow *parent )
456   : ConfigControl( p_this, p_item, parent )
457 {
458     directory = p_item->i_type == CONFIG_ITEM_DIRECTORY;
459     label = new wxStaticText(this, -1, wxU(p_item->psz_text));
460     sizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
461     textctrl = new wxTextCtrl( this, -1, 
462                                wxU(p_item->psz_value),
463                                wxDefaultPosition,
464                                wxDefaultSize,
465                                wxTE_PROCESS_ENTER);
466     textctrl->SetToolTip( wxU(p_item->psz_longtext) );
467     sizer->Add( textctrl, 1, wxALL, 5 );
468     browse = new wxButton( this, wxID_HIGHEST, wxU(_("Browse...")) );
469     sizer->Add( browse, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
470     sizer->Layout();
471     this->SetSizerAndFit( sizer );
472 }
473
474 BEGIN_EVENT_TABLE(FileConfigControl, wxPanel)
475     /* Button events */
476     EVT_BUTTON(wxID_HIGHEST, FileConfigControl::OnBrowse)
477 END_EVENT_TABLE()
478
479 void FileConfigControl::OnBrowse( wxCommandEvent& event )
480 {
481     if( directory )
482     {
483         wxDirDialog dialog( this, wxU(_("Choose Directory")) );
484
485         if( dialog.ShowModal() == wxID_OK )
486         {
487             textctrl->SetValue( dialog.GetPath() );      
488         }
489     }
490     else
491     {
492         wxFileDialog dialog( this, wxU(_("Choose File")),
493                              wxT(""), wxT(""), wxT("*.*"),
494 #if defined( __WXMSW__ )
495                              wxOPEN
496 #else
497                              wxOPEN | wxSAVE
498 #endif
499                            );
500     }
501 }
502
503 FileConfigControl::~FileConfigControl()
504 {
505     ;
506 }
507     
508 wxString FileConfigControl::GetPszValue()
509 {
510     return textctrl->GetValue();
511 }
512
513 /*****************************************************************************
514  * IntegerConfigControl implementation
515  *****************************************************************************/
516 IntegerConfigControl::IntegerConfigControl( vlc_object_t *p_this,
517                                             module_config_t *p_item,
518                                             wxWindow *parent )
519   : ConfigControl( p_this, p_item, parent )
520 {
521     label = new wxStaticText(this, -1, wxU(p_item->psz_text));
522     spin = new wxSpinCtrl( this, -1,
523                            wxString::Format(wxT("%d"),
524                                             p_item->i_value),
525                            wxDefaultPosition, wxDefaultSize,
526                            wxSP_ARROW_KEYS,
527                            -16000, 16000, p_item->i_value);
528     spin->SetToolTip( wxU(p_item->psz_longtext) );
529     sizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
530     sizer->Add( spin, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );    
531     sizer->Layout();
532     this->SetSizerAndFit( sizer );
533 }
534
535 IntegerConfigControl::~IntegerConfigControl()
536 {
537     ;
538 }
539
540 int IntegerConfigControl::GetIntValue()
541 {
542     return spin->GetValue();
543 }
544
545 /*****************************************************************************
546  * IntegerListConfigControl implementation
547  *****************************************************************************/
548 IntegerListConfigControl::IntegerListConfigControl( vlc_object_t *p_this,
549                                                     module_config_t *p_item,
550                                                     wxWindow *parent )
551   : ConfigControl( p_this, p_item, parent ), psz_name( NULL )
552 {
553     label = new wxStaticText(this, -1, wxU(p_item->psz_text));
554     sizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
555     combo = new wxComboBox( this, -1, wxT(""),
556                             wxDefaultPosition, wxDefaultSize,
557                             0, NULL, wxCB_READONLY );
558
559     UpdateCombo( p_item );
560
561     combo->SetToolTip( wxU(p_item->psz_longtext) );
562     sizer->Add( combo, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );    
563
564     if( p_item->pf_list_update )
565     {
566         wxButton *refresh =
567             new wxButton( this, wxID_HIGHEST, wxU(_("Refresh")) );
568         sizer->Add( refresh, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
569
570         psz_name = strdup( p_item->psz_name );
571         pf_list_update = p_item->pf_list_update;
572     }
573
574     sizer->Layout();
575     this->SetSizerAndFit( sizer );
576 }
577
578 IntegerListConfigControl::~IntegerListConfigControl()
579 {
580     if( psz_name ) free( psz_name );
581 }
582
583 void IntegerListConfigControl::UpdateCombo( module_config_t *p_item )
584 {
585     /* build a list of available options */
586     for( int i_index = 0; i_index < p_item->i_list; i_index++ )
587     {
588         combo->Append( ( p_item->ppsz_list_text &&
589                          p_item->ppsz_list_text[i_index] ) ?
590                        wxU(p_item->ppsz_list_text[i_index]) :
591                        wxString::Format(wxT("%i"),
592                                         p_item->pi_list[i_index]) );
593         combo->SetClientData( i_index, (void *)p_item->pi_list[i_index] );
594         if( p_item->i_value == p_item->pi_list[i_index] )
595         {
596             combo->SetSelection( i_index );
597             combo->SetValue( ( p_item->ppsz_list_text &&
598                                p_item->ppsz_list_text[i_index] ) ?
599                              wxU(p_item->ppsz_list_text[i_index]) :
600                              wxString::Format(wxT("%i"),
601                                               p_item->pi_list[i_index]) );
602         }
603     }
604 }
605
606 BEGIN_EVENT_TABLE(IntegerListConfigControl, wxPanel)
607     /* Button events */
608     EVT_BUTTON(wxID_HIGHEST, IntegerListConfigControl::OnRefresh)
609 END_EVENT_TABLE()
610
611 void IntegerListConfigControl::OnRefresh( wxCommandEvent& event )
612 {
613     if( pf_list_update )
614     {
615         vlc_value_t val;
616         module_config_t *p_item;
617
618         pf_list_update( p_this, psz_name, val, val, 0 );
619         p_item = config_FindConfig( p_this, psz_name );
620
621         combo->Clear();
622         UpdateCombo( p_item );
623     }
624 }
625
626 int IntegerListConfigControl::GetIntValue()
627 {
628     int selected = combo->GetSelection();
629     if( selected != -1 )
630     {
631         return (int)combo->GetClientData( selected );
632     }
633     return -1;
634 }
635
636 /*****************************************************************************
637  * RangedIntConfigControl implementation
638  *****************************************************************************/
639 RangedIntConfigControl::RangedIntConfigControl( vlc_object_t *p_this,
640                                                 module_config_t *p_item,
641                                                 wxWindow *parent )
642   : ConfigControl( p_this, p_item, parent )
643 {
644     label = new wxStaticText(this, -1, wxU(p_item->psz_text));
645     slider = new wxSlider( this, -1, p_item->i_value, p_item->i_min,
646                            p_item->i_max, wxDefaultPosition, wxDefaultSize,
647                            wxSL_LABELS | wxSL_HORIZONTAL );
648     slider->SetToolTip( wxU(p_item->psz_longtext) );
649     sizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
650     sizer->Add( slider, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );    
651     sizer->Layout();
652     this->SetSizerAndFit( sizer );
653 }
654
655 RangedIntConfigControl::~RangedIntConfigControl()
656 {
657     ;
658 }
659
660 int RangedIntConfigControl::GetIntValue()
661 {
662     return slider->GetValue();
663 }
664
665 /*****************************************************************************
666  * FloatConfigControl implementation
667  *****************************************************************************/
668 FloatConfigControl::FloatConfigControl( vlc_object_t *p_this,
669                                         module_config_t *p_item,
670                                         wxWindow *parent )
671   : ConfigControl( p_this, p_item, parent )
672 {
673     label = new wxStaticText(this, -1, wxU(p_item->psz_text));
674     textctrl = new wxTextCtrl( this, -1,
675                                wxString::Format(wxT("%f"),
676                                                 p_item->f_value),
677                                wxDefaultPosition, wxDefaultSize,
678                                wxTE_PROCESS_ENTER );
679     textctrl->SetToolTip( wxU(p_item->psz_longtext) );
680     sizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
681     sizer->Add( textctrl, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
682     sizer->Layout();
683     this->SetSizerAndFit( sizer );
684 }
685
686 FloatConfigControl::~FloatConfigControl()
687 {
688     ;
689 }
690
691 float FloatConfigControl::GetFloatValue()
692 {
693     float f_value;
694     if( (wxSscanf(textctrl->GetValue(), wxT("%f"), &f_value) == 1) )
695         return f_value;
696     else return 0.0;
697 }
698
699 /*****************************************************************************
700  * BoolConfigControl implementation
701  *****************************************************************************/
702 BoolConfigControl::BoolConfigControl( vlc_object_t *p_this,
703                                       module_config_t *p_item,
704                                       wxWindow *parent )
705   : ConfigControl( p_this, p_item, parent )
706 {
707     checkbox = new wxCheckBox( this, -1, wxU(p_item->psz_text) );
708     if( p_item->i_value ) checkbox->SetValue(TRUE);
709     checkbox->SetToolTip( wxU(p_item->psz_longtext) );
710     sizer->Add( checkbox, 0, wxALL, 5 );
711     sizer->Layout();
712     this->SetSizerAndFit( sizer );
713 }
714
715 BoolConfigControl::~BoolConfigControl()
716 {
717     ;
718 }
719
720 int BoolConfigControl::GetIntValue()
721 {
722     if( checkbox->IsChecked() )
723     {
724         return 1;
725     }
726     else
727     {
728         return 0;
729     }
730 }