Commit f57fdbdd authored by Gildas Bazin's avatar Gildas Bazin

* modules/gui/wxwindows/preferences.cpp: compilation fix + cosmetic code clean-up
(indentations mainly).
parent a8855655
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* preferences.cpp : wxWindows plugin for vlc * preferences.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: preferences.cpp,v 1.28 2003/09/22 14:40:10 zorglub Exp $ * $Id: preferences.cpp,v 1.29 2003/09/22 21:07:35 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -121,7 +121,7 @@ public: ...@@ -121,7 +121,7 @@ public:
PrefsPanel() { } PrefsPanel() { }
PrefsPanel( wxWindow *parent, intf_thread_t *_p_intf, PrefsPanel( wxWindow *parent, intf_thread_t *_p_intf,
PrefsDialog *_p_prefs_dialog, int i_object_id, char *, char * ); PrefsDialog *, int i_object_id, char *, char * );
virtual ~PrefsPanel() {} virtual ~PrefsPanel() {}
void ApplyChanges(); void ApplyChanges();
...@@ -410,7 +410,6 @@ PrefsTreeCtrl::PrefsTreeCtrl( wxWindow *_p_parent, intf_thread_t *_p_intf, ...@@ -410,7 +410,6 @@ PrefsTreeCtrl::PrefsTreeCtrl( wxWindow *_p_parent, intf_thread_t *_p_intf,
config_data->psz_section = NULL; config_data->psz_section = NULL;
config_data->i_object_id = GENERAL_ID; config_data->i_object_id = GENERAL_ID;
config_data->psz_help = strdup( GENERAL_HELP ); config_data->psz_help = strdup( GENERAL_HELP );
printf("dans pouet: %i\n",config_data->i_object_id);
general_item = AppendItem( root_item, wxU(_("General Settings")), general_item = AppendItem( root_item, wxU(_("General Settings")),
-1, -1, config_data ); -1, -1, config_data );
...@@ -765,7 +764,7 @@ void PrefsTreeCtrl::OnAdvanced( wxCommandEvent& event ) ...@@ -765,7 +764,7 @@ void PrefsTreeCtrl::OnAdvanced( wxCommandEvent& event )
*****************************************************************************/ *****************************************************************************/
PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf, PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf,
PrefsDialog *_p_prefs_dialog, PrefsDialog *_p_prefs_dialog,
int i_object_id, char *psz_section, char*psz_help ) int i_object_id, char *psz_section, char *psz_help )
: wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize ) : wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize )
{ {
module_config_t *p_item; module_config_t *p_item;
...@@ -797,14 +796,11 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf, ...@@ -797,14 +796,11 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf,
if( i_object_id == PLUGIN_ID || i_object_id == GENERAL_ID || if( i_object_id == PLUGIN_ID || i_object_id == GENERAL_ID ||
i_object_id == CAPABILITY_ID ) i_object_id == CAPABILITY_ID )
{ {
wxStaticBox *static_box = new wxStaticBox( this, -1, wxT( "" ) ); wxStaticBox *static_box = new wxStaticBox( this, -1, wxT("") );
wxStaticBoxSizer *box_sizer = new wxStaticBoxSizer( static_box, wxStaticBoxSizer *box_sizer = new wxStaticBoxSizer( static_box,
wxVERTICAL ); wxVERTICAL );
label = new wxStaticText( this, -1, label = new wxStaticText( this, -1, wxU(_( psz_help) ) );
wxU(_( psz_help) ) );
box_sizer->Add( label, 1, wxEXPAND | wxLEFT | wxRIGHT, 5 ); box_sizer->Add( label, 1, wxEXPAND | wxLEFT | wxRIGHT, 5 );
sizer->Add( box_sizer, 0, wxEXPAND | wxALL , 5 ); sizer->Add( box_sizer, 0, wxEXPAND | wxALL , 5 );
} }
else else
...@@ -836,8 +832,9 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf, ...@@ -836,8 +832,9 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf,
p_item++; p_item++;
} }
} }
/* Add a head title to the panel */ /* Add a head title to the panel */
wxStaticBox *static_box = new wxStaticBox( this, -1, wxT( "" ) ); wxStaticBox *static_box = new wxStaticBox( this, -1, wxT("") );
wxStaticBoxSizer *box_sizer = new wxStaticBoxSizer( static_box, wxStaticBoxSizer *box_sizer = new wxStaticBoxSizer( static_box,
wxVERTICAL ); wxVERTICAL );
...@@ -852,14 +849,12 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf, ...@@ -852,14 +849,12 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf,
sizer->Add( box_sizer, 0, wxEXPAND | wxLEFT | wxRIGHT , 5 ); sizer->Add( box_sizer, 0, wxEXPAND | wxLEFT | wxRIGHT , 5 );
if( psz_help && psz_help[1] )
/* Check that we have at least something */ /* Check that we have at least something */
if( psz_help && psz_help[1] )
{ {
help_box = new wxStaticBox( this, -1, wxT( "" ) ); help_box = new wxStaticBox( this, -1, wxT("") );
help_sizer = new wxStaticBoxSizer( help_box, help_sizer = new wxStaticBoxSizer( help_box, wxHORIZONTAL ) ;
wxHORIZONTAL ) ; help = new wxStaticText( this, -1, wxU(_(psz_help)),
help = new wxStaticText( this, -1,
wxT(_( psz_help) ),
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
wxST_NO_AUTORESIZE | wxALIGN_LEFT, wxST_NO_AUTORESIZE | wxALIGN_LEFT,
wxT("") ); wxT("") );
...@@ -882,8 +877,8 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf, ...@@ -882,8 +877,8 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf,
strcmp( psz_section, p_item->psz_text ) ) strcmp( psz_section, p_item->psz_text ) )
break; break;
/* put each config option in a separate panel so we can hide advanced /* put each config option in a separate panel so we can hide
* options easily */ * advanced options easily */
wxPanel *panel = new wxPanel( config_window, -1, wxDefaultPosition, wxPanel *panel = new wxPanel( config_window, -1, wxDefaultPosition,
wxDefaultSize ); wxDefaultSize );
wxBoxSizer *panel_sizer = new wxBoxSizer( wxHORIZONTAL ); wxBoxSizer *panel_sizer = new wxBoxSizer( wxHORIZONTAL );
...@@ -908,13 +903,11 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf, ...@@ -908,13 +903,11 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf,
{ {
p_parser = (module_t *)p_list->p_values[i_index].p_object ; p_parser = (module_t *)p_list->p_values[i_index].p_object ;
if( !strcmp( p_parser->psz_capability, if( !strcmp( p_parser->psz_capability, p_item->psz_type ) )
p_item->psz_type ) )
{ {
combo->Append( wxU(p_parser->psz_longname), combo->Append( wxU(p_parser->psz_longname),
p_parser->psz_object_name ); p_parser->psz_object_name );
if( p_item->psz_value && if( p_item->psz_value && !strcmp(p_item->psz_value,
!strcmp(p_item->psz_value,
p_parser->psz_object_name) ) p_parser->psz_object_name) )
combo->SetValue( wxU(p_parser->psz_longname) ); combo->SetValue( wxU(p_parser->psz_longname) );
} }
...@@ -940,7 +933,8 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf, ...@@ -940,7 +933,8 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf,
{ {
textctrl = new wxTextCtrl( panel, -1, textctrl = new wxTextCtrl( panel, -1,
wxU(p_item->psz_value), wxU(p_item->psz_value),
wxDefaultPosition, wxDefaultSize, wxDefaultPosition,
wxDefaultSize,
wxTE_PROCESS_ENTER); wxTE_PROCESS_ENTER);
textctrl->SetToolTip( wxU(p_item->psz_longtext) ); textctrl->SetToolTip( wxU(p_item->psz_longtext) );
config_data->control.textctrl = textctrl; config_data->control.textctrl = textctrl;
...@@ -950,7 +944,7 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf, ...@@ -950,7 +944,7 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf,
{ {
combo = new wxComboBox( panel, -1, wxU(p_item->psz_value), combo = new wxComboBox( panel, -1, wxU(p_item->psz_value),
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
0, NULL, wxCB_READONLY | wxCB_SORT ); 0, NULL, wxCB_READONLY|wxCB_SORT );
/* build a list of available options */ /* build a list of available options */
for( int i_index = 0; p_item->ppsz_list[i_index]; for( int i_index = 0; p_item->ppsz_list[i_index];
...@@ -984,7 +978,8 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf, ...@@ -984,7 +978,8 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf,
case CONFIG_ITEM_INTEGER: case CONFIG_ITEM_INTEGER:
label = new wxStaticText(panel, -1, wxU(p_item->psz_text)); label = new wxStaticText(panel, -1, wxU(p_item->psz_text));
spin = new wxSpinCtrl( panel, -1, spin = new wxSpinCtrl( panel, -1,
wxString::Format(wxT("%d"),p_item->i_value), wxString::Format(wxT("%d"),
p_item->i_value),
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
wxSP_ARROW_KEYS, wxSP_ARROW_KEYS,
-16000, 16000, p_item->i_value); -16000, 16000, p_item->i_value);
...@@ -1012,8 +1007,7 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf, ...@@ -1012,8 +1007,7 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf,
combo = new wxComboBox( panel, -1, wxU("f"), combo = new wxComboBox( panel, -1, wxU("f"),
wxDefaultPosition, wxDefaultSize, 0 wxDefaultPosition, wxDefaultSize, 0
, NULL, wxCB_READONLY | wxCB_SORT ); , NULL, wxCB_READONLY | wxCB_SORT );
for( int i = 0; i < sizeof(keys)/sizeof(key_descriptor_s); for( int i=0; i < sizeof(keys)/sizeof(key_descriptor_s); i++ )
i++ )
{ {
combo->Append( wxU(_(keys[i].psz_key_string)), combo->Append( wxU(_(keys[i].psz_key_string)),
(void*)&keys[i].i_key_code ); (void*)&keys[i].i_key_code );
...@@ -1024,18 +1018,17 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf, ...@@ -1024,18 +1018,17 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf,
panel_sizer->Add( label, 0, wxALIGN_CENTER_VERTICAL panel_sizer->Add( label, 0, wxALIGN_CENTER_VERTICAL
| wxALL, 5 ); | wxALL, 5 );
panel_sizer->Add( alt, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); panel_sizer->Add( alt, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
panel_sizer->Add( ctrl, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); panel_sizer->Add( ctrl, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
panel_sizer->Add( shift, 0, wxALIGN_CENTER_VERTICAL | panel_sizer->Add( shift, 0, wxALIGN_CENTER_VERTICAL |wxALL, 5);
wxALL, 5 ); panel_sizer->Add( combo, 0, wxALIGN_CENTER_VERTICAL |wxALL, 5);
panel_sizer->Add( combo, 0, wxALIGN_CENTER_VERTICAL
| wxALL, 5 );
break; break;
} }
case CONFIG_ITEM_FLOAT: case CONFIG_ITEM_FLOAT:
label = new wxStaticText(panel, -1, wxU(p_item->psz_text)); label = new wxStaticText(panel, -1, wxU(p_item->psz_text));
textctrl = new wxTextCtrl( panel, -1, textctrl = new wxTextCtrl( panel, -1,
wxString::Format(wxT("%f"),p_item->f_value), wxString::Format(wxT("%f"),
p_item->f_value),
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
wxTE_PROCESS_ENTER ); wxTE_PROCESS_ENTER );
textctrl->SetToolTip( wxU(p_item->psz_longtext) ); textctrl->SetToolTip( wxU(p_item->psz_longtext) );
...@@ -1056,7 +1049,6 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf, ...@@ -1056,7 +1049,6 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf,
if( p_item->b_advanced ) b_has_advanced = VLC_TRUE; if( p_item->b_advanced ) b_has_advanced = VLC_TRUE;
break; break;
default: default:
delete panel; panel = NULL; delete panel; panel = NULL;
delete panel_sizer; delete panel_sizer;
...@@ -1076,6 +1068,7 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf, ...@@ -1076,6 +1068,7 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf,
config_sizer->Add( panel, 0, wxEXPAND | wxALL, 2 ); config_sizer->Add( panel, 0, wxEXPAND | wxALL, 2 );
} }
while( p_item->i_type != CONFIG_HINT_END && p_item++ ); while( p_item->i_type != CONFIG_HINT_END && p_item++ );
config_sizer->Layout(); config_sizer->Layout();
config_window->SetSizer( config_sizer ); config_window->SetSizer( config_sizer );
sizer->Add( config_window, 1, wxEXPAND | wxALL, 5 ); sizer->Add( config_window, 1, wxEXPAND | wxALL, 5 );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment